Bad Status last online value.
parent
f376f374b4
commit
ae2b4700a7
|
@ -248,11 +248,13 @@ function psm_curl_get($href, $header = false, $body = true, $timeout = 10, $add_
|
|||
* Get a "nice" timespan message
|
||||
*
|
||||
* Source: http://www.interactivetools.com/forum/forum-posts.php?postNum=2208966
|
||||
* @param int $time
|
||||
* @param string $time
|
||||
* @return string
|
||||
* @todo add translation to timespan messages
|
||||
*/
|
||||
function psm_timespan($time) {
|
||||
if(empty($time) || $time == '0000-00-00 00:00:00')
|
||||
return 'never';
|
||||
if ($time !== intval($time)) { $time = strtotime($time); }
|
||||
$d = time() - $time;
|
||||
if ($time < strtotime(date('Y-m-d 00:00:00')) - 60*60*24*3) {
|
||||
|
@ -276,6 +278,19 @@ function psm_timespan($time) {
|
|||
return "a few seconds ago";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a localised date from MySQL date format
|
||||
* @param string $time
|
||||
* @return string
|
||||
* @todo add translation
|
||||
*/
|
||||
function psm_date($time)
|
||||
{
|
||||
if(empty($time) || $time == '0000-00-00 00:00:00')
|
||||
return 'never';
|
||||
return date('d/m/Y H:i:s', strtotime($time));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an update is available for PHP Server Monitor
|
||||
*
|
||||
|
|
|
@ -62,8 +62,8 @@ abstract class AbstractServerController extends AbstractController {
|
|||
`s`.`status`,
|
||||
`s`.`error`,
|
||||
`s`.`rtime`,
|
||||
IF(`s`.`last_check`='0000-00-00 00:00:00', 'never', DATE_FORMAT(`s`.`last_check`, '%d-%m-%y %H:%i')) AS `last_check`,
|
||||
IF(`s`.`last_online`='0000-00-00 00:00:00', 'never', DATE_FORMAT(`s`.`last_online`, '%d-%m-%y %H:%i')) AS `last_online`,
|
||||
`s`.`last_check`,
|
||||
`s`.`last_online`,
|
||||
`s`.`active`,
|
||||
`s`.`email`,
|
||||
`s`.`sms`
|
||||
|
|
|
@ -79,6 +79,7 @@ class ServerController extends AbstractServerController {
|
|||
$servers[$x] = $html_actions + $servers[$x];
|
||||
$servers[$x]['class'] = ($x & 1) ? 'odd' : 'even';
|
||||
$servers[$x]['rtime'] = round((float) $servers[$x]['rtime'], 4);
|
||||
$servers[$x]['last_online'] = psm_date($servers[$x]['last_online']);
|
||||
|
||||
if($servers[$x]['type'] == 'website') {
|
||||
// add link to label
|
||||
|
|
Loading…
Reference in New Issue