Fix IPv6-IPv4 bug
This commit is contained in:
parent
cfbda5433a
commit
0d2e3c71e4
@ -62,7 +62,7 @@
|
||||
|
||||
// ::ffff:0.0.0.0
|
||||
if(preg_match('/^\:\:(ffff\:)?(\d+\.\d+\.\d+\.\d+)$/', $__ip, $m))
|
||||
$_SERVER['REMOTE_ADDR'] = $m[1];
|
||||
$_SERVER['REMOTE_ADDR'] = $m[2];
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,6 +145,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
function ago($timestamp) {
|
||||
$difference = time() - $timestamp;
|
||||
if($difference < 60) {
|
||||
return $difference . ' second' . ($difference != 1 ? 's' : '');
|
||||
} elseif($difference < 60*60) {
|
||||
return ($num = round($difference/(60))) . ' minute' . ($num != 1 ? 's' : '');
|
||||
} elseif($difference < 60*60*24) {
|
||||
return ($num = round($difference/(60*60))) . ' hour' . ($num != 1 ? 's' : '');
|
||||
} elseif($difference < 60*60*24*7) {
|
||||
return ($num = round($difference/(60*60*24))) . ' day' . ($num != 1 ? 's' : '');
|
||||
} elseif($difference < 60*60*24*365) {
|
||||
return ($num = round($difference/(60*60*24*7))) . ' week' . ($num != 1 ? 's' : '');
|
||||
} else {
|
||||
return ($num = round($difference/(60*60*24*365))) . ' year' . ($num != 1 ? 's' : '');
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate($timestamp) {
|
||||
return date('jS F, Y', $timestamp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user