Merge branch 'develop' of github.com:phpservermon/phpservermon into develop
commit
97edea3487
|
@ -248,11 +248,13 @@ function psm_curl_get($href, $header = false, $body = true, $timeout = 10, $add_
|
||||||
* Get a "nice" timespan message
|
* Get a "nice" timespan message
|
||||||
*
|
*
|
||||||
* Source: http://www.interactivetools.com/forum/forum-posts.php?postNum=2208966
|
* Source: http://www.interactivetools.com/forum/forum-posts.php?postNum=2208966
|
||||||
* @param int $time
|
* @param string $time
|
||||||
* @return string
|
* @return string
|
||||||
* @todo add translation to timespan messages
|
* @todo add translation to timespan messages
|
||||||
*/
|
*/
|
||||||
function psm_timespan($time) {
|
function psm_timespan($time) {
|
||||||
|
if(empty($time) || $time == '0000-00-00 00:00:00')
|
||||||
|
return 'never';
|
||||||
if ($time !== intval($time)) { $time = strtotime($time); }
|
if ($time !== intval($time)) { $time = strtotime($time); }
|
||||||
$d = time() - $time;
|
$d = time() - $time;
|
||||||
if ($time < strtotime(date('Y-m-d 00:00:00')) - 60*60*24*3) {
|
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";
|
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
|
* Check if an update is available for PHP Server Monitor
|
||||||
*
|
*
|
||||||
|
|
|
@ -62,8 +62,8 @@ abstract class AbstractServerController extends AbstractController {
|
||||||
`s`.`status`,
|
`s`.`status`,
|
||||||
`s`.`error`,
|
`s`.`error`,
|
||||||
`s`.`rtime`,
|
`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`,
|
`s`.`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_online`,
|
||||||
`s`.`active`,
|
`s`.`active`,
|
||||||
`s`.`email`,
|
`s`.`email`,
|
||||||
`s`.`sms`,
|
`s`.`sms`,
|
||||||
|
|
|
@ -79,6 +79,8 @@ class ServerController extends AbstractServerController {
|
||||||
$servers[$x] = $html_actions + $servers[$x];
|
$servers[$x] = $html_actions + $servers[$x];
|
||||||
$servers[$x]['class'] = ($x & 1) ? 'odd' : 'even';
|
$servers[$x]['class'] = ($x & 1) ? 'odd' : 'even';
|
||||||
$servers[$x]['rtime'] = round((float) $servers[$x]['rtime'], 4);
|
$servers[$x]['rtime'] = round((float) $servers[$x]['rtime'], 4);
|
||||||
|
$servers[$x]['last_online'] = psm_date($servers[$x]['last_online']);
|
||||||
|
$servers[$x]['last_check'] = psm_date($servers[$x]['last_check']);
|
||||||
|
|
||||||
if($servers[$x]['type'] == 'website') {
|
if($servers[$x]['type'] == 'website') {
|
||||||
// add link to label
|
// add link to label
|
||||||
|
|
|
@ -154,7 +154,7 @@ class Template {
|
||||||
$result = preg_replace('{<!--%(.+?)-->(.*?)<!--%%\\1-->}is', '', $this->templates[$id]);
|
$result = preg_replace('{<!--%(.+?)-->(.*?)<!--%%\\1-->}is', '', $this->templates[$id]);
|
||||||
|
|
||||||
// check for tpl variables that have not been replaced. ie: {name}. ignore literal stuff, though. ie: {{name}} is {name} and should not be removed
|
// check for tpl variables that have not been replaced. ie: {name}. ignore literal stuff, though. ie: {{name}} is {name} and should not be removed
|
||||||
preg_match_all('~{?{(.+?)}}?~', $result, $matches);
|
preg_match_all('~{?{(\w+?)}}?~', $result, $matches);
|
||||||
|
|
||||||
foreach($matches[0] as $match) {
|
foreach($matches[0] as $match) {
|
||||||
if (substr($match, 0, 2) == '{{') {
|
if (substr($match, 0, 2) == '{{') {
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
body{
|
body {
|
||||||
padding-top:70px;
|
padding-top: 70px;
|
||||||
|
}
|
||||||
|
.navbar-fixed-top {
|
||||||
|
position: fixed;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.navbar-fixed-top .navbar-inner {
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
}
|
}
|
||||||
body.install{
|
body.install{
|
||||||
padding-top:20px;
|
padding-top:20px;
|
||||||
|
|
Loading…
Reference in New Issue