4
function time_ago ($tm, $rcs = 0) {
7
$pds = array('second','minute','hour','day','week','month','year','decade');
8
$lngh = array(1,60,3600,86400,604800,2630880,31570560,315705600);
10
for ($v = count($lngh) - 1; ($v >= 0) && (($no = $dif / $lngh[$v]) <= 1); $v--);
13
$_tm = $cur_tm - ($dif % $lngh[$v]);
15
$no = ($rcs ? floor($no) : round($no)); // if last denomination, round
19
$x = $no . ' ' . $pds[$v];
21
if (($rcs > 0) && ($v >= 1))
22
$x .= ' ' . $this->time_ago($_tm, $rcs - 1);
28
function get_ip_address() {
29
$ip = $_SERVER['REMOTE_ADDR'];
31
$headers = apache_request_headers();
32
if (isset($headers['X-Forwarded-For'])) $ip = $headers['X-Forwarded-For'];
33
if (isset($headers['Proxy-Client-IP'])) $ip = $headers['Proxy-Client-IP'];
34
if (isset($headers['X-Client-IP'])) $ip = $headers['X-Client-IP'];
35
if (isset($headers['Client-IP'])) $ip = $headers['Client-IP'];
40
function opt_explode($echar, $str) {
43
if (strlen($echar) != 1 || strlen($str) == 0) {
52
while($idx < strlen($str)) {
53
if($str[$idx] == '"') {
56
while ($idx < strlen($str)) {
57
// look for ending quote
58
if($str[$idx] == '"') {
63
$newstrarr[$arr] = $newstrarr[$arr] . $str[$idx];
66
} elseif ($str[$idx] == $echar) {
67
// normal delimiter, advance element
70
// must be normal char, tack onto current element
71
if (isset($newstrarr[$arr])) {
72
$newstrarr[$arr] = $newstrarr[$arr] . $str[$idx];
74
$newstrarr[$arr] = $str[$idx];
b'\\ No newline at end of file'