Merge pull request #1110 from laf/issue-279

Updated mysql DATE_FORMAT() and php date() to use $config variables
This commit is contained in:
Paul Gear
2015-06-13 10:15:23 +10:00
26 changed files with 63 additions and 35 deletions

View File

@@ -31,7 +31,7 @@ if( !empty($_POST['string']) ) {
$sql .= " AND message LIKE '%".mres($_POST['string'])."%'";
}
$entries = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` WHERE `host` = ? $sql ORDER BY `datetime` DESC LIMIT 0,250", array($device['device_id']));
$entries = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '".$config['dateformat']['mysql']['compact']."') as humandate FROM `eventlog` WHERE `host` = ? $sql ORDER BY `datetime` DESC LIMIT 0,250", array($device['device_id']));
echo(' <div class="panel panel-default panel-condensed">
<div class="panel-heading">

View File

@@ -40,7 +40,7 @@ if ($_POST['program'])
$param[] = $_POST['program'];
}
$sql = "SELECT *, DATE_FORMAT(timestamp, '%Y-%m-%d %T') AS date from syslog WHERE device_id = ? $where";
$sql = "SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog WHERE device_id = ? $where";
$sql .= " ORDER BY timestamp DESC LIMIT 1000";
echo(' <div class="panel panel-default panel-condensed">
<div class="panel-heading">

View File

@@ -10,7 +10,7 @@ echo("<img src='images/16/report.png'> Recent Events</a>");
echo(' </div>
<table class="table table-hover table-condensed table-striped">');
$eventlog = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '%d/%b/%y %T') as humandate FROM `eventlog` WHERE `host` = ? ORDER BY `datetime` DESC LIMIT 0,10", array($device['device_id']));
$eventlog = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '".$config['dateformat']['mysql']['compact']."') as humandate FROM `eventlog` WHERE `host` = ? ORDER BY `datetime` DESC LIMIT 0,10", array($device['device_id']));
foreach ($eventlog as $entry)
{
include("includes/print-event-short.inc.php");

View File

@@ -2,7 +2,7 @@
if ($config['enable_syslog'])
{
$syslog = dbFetchRows("SELECT *, DATE_FORMAT(timestamp, '%Y-%m-%d %T') AS date from syslog WHERE device_id = ? ORDER BY timestamp DESC LIMIT 20", array($device['device_id']));
$syslog = dbFetchRows("SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog WHERE device_id = ? ORDER BY timestamp DESC LIMIT 20", array($device['device_id']));
if (count($syslog))
{
echo('<div class="container-fluid">');

View File

@@ -1,6 +1,6 @@
<?php
$entries = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` WHERE `host` = ? AND `type` = 'interface' AND `reference` = '".$port['port_id']."' ORDER BY `datetime` DESC LIMIT 0,250", array($device['device_id']));
$entries = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '".$config['dateformat']['mysql']['compact']."') as humandate FROM `eventlog` WHERE `host` = ? AND `type` = 'interface' AND `reference` = '".$port['port_id']."' ORDER BY `datetime` DESC LIMIT 0,250", array($device['device_id']));
echo('<table cellspacing="0" cellpadding="2" width="100%">');
foreach ($entries as $entry)

View File

@@ -48,7 +48,7 @@ if ($_SESSION['userlevel'] >= "7")
if ($vars['rev'] == $svnlog["rev"]) {
echo('<span class="pagemenu-selected">');
}
$linktext = "r" . $svnlog["rev"] . " <small>" . date("d M H:i", strtotime($svnlog["date"])) . "</small>";
$linktext = "r" . $svnlog["rev"] . " <small>" . date($config['dateformat']['byminute'], strtotime($svnlog["date"])) . "</small>";
echo(generate_link($linktext, array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'showconfig', 'rev' => $svnlog["rev"])));
if ($vars['rev'] == $svnlog["rev"]) {