Merge branch 'develop' of github.com:phpservermon/phpservermon into develop

pull/36/merge
Pepijn Over 2014-03-24 16:37:59 +01:00
commit 97edea3487
5 changed files with 31 additions and 6 deletions

View File

@ -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
*

View File

@ -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`,

View File

@ -79,6 +79,8 @@ 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']);
$servers[$x]['last_check'] = psm_date($servers[$x]['last_check']);
if($servers[$x]['type'] == 'website') {
// add link to label

View File

@ -154,7 +154,7 @@ class Template {
$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
preg_match_all('~{?{(.+?)}}?~', $result, $matches);
preg_match_all('~{?{(\w+?)}}?~', $result, $matches);
foreach($matches[0] as $match) {
if (substr($match, 0, 2) == '{{') {

View File

@ -1,6 +1,14 @@
body {
padding-top: 70px;
}
.navbar-fixed-top {
position: fixed;
margin: 0;
}
.navbar-fixed-top .navbar-inner {
padding-left: 0;
padding-right: 0;
}
body.install{
padding-top:20px;
}