Commit 7e136b88 authored by Eric - kg6wxc's avatar Eric - kg6wxc
Browse files

Merge branch 'timezoneFixes' into 'master'

Timezone fixes

Closes #4

See merge request !1
parents 18dd89e9 af859350
......@@ -431,7 +431,13 @@ function load_LinkedTO($node_info, $TopoList)
*/
function build_Marker($node_info, $node_ServiceList, $node_LinkedList, $node_FirmwareStatus)
{
$markerList = '';
//timezone fixes - wxc 11-27-2018
$nodeLastSeen = new DateTime($node_info['last_seen']);
date_timezone_set($nodeLastSeen, $GLOBALS['localTimeZone']);
$markerList = '';
$nodeUrl = "<NodeTitle><a href='http://" . $node_info['node'] . ".local.mesh:8080'>" . $node_info['node'] .
"</a></NodeTitle>";
......@@ -510,7 +516,10 @@ function build_Marker($node_info, $node_ServiceList, $node_LinkedList, $node_Fir
"', icon: " . $icon . "}).bindPopup(\" " . $nodeUrl . " (" . $band . ")<br>" . $node_info['lat'] .
", " . $node_info['lon'] . "<br>SSID: " . $node_info['ssid'] . "<br>Channel: " . $node_info['channel'] .
", Bandwidth: " . $node_info['chanbw'] . "<br>" . $node_info['model'] . "<br>" . $firmware .
"<br>Last Polled: " . $node_info['last_seen'] . '<br>' . "Uptime: " . $node_info['uptime'] . '<br>';
//"<br>Last Polled: " . $node_info['last_seen'] . '<br>' . "Uptime: " . $node_info['uptime'] . '<br>';
//timezone fixes - wxc 11-26-2018
"<br>Last Polled: " . date_format($nodeLastSeen, 'Y-m-d H:i:s T') . '<br>' . "Uptime: " . $node_info['uptime'] . '<br>';
//dot
if ($node_info['loadavg'] !== "NotAvailable") {
$loadavgs = unserialize($node_info['loadavg']);
......@@ -1093,7 +1102,8 @@ function show_MapMarkerDetails($numNodes, $numLinks, $numMarkers, $numNodesTotal
$filetime = wxc_scriptGetLastDateTime("LINKINFO", "topology");
if ($filetime)
{
$filetime = date_format($filetime, 'F d Y H:i:s');
date_timezone_set($filetime, $GLOBALS['localTimeZone']);
$filetime = date_format($filetime, 'F d Y H:i:s T');
}
//$Content = "MeshMapDetails = '<strong>" . $numNodes . " Nodes shown, with " . $numLinks .
......
......@@ -490,8 +490,12 @@ function wxc_scriptGetLastDateTime ($id, $name) {
// $lastRunSelf = wxc_getMySql("SELECT script_last_run FROM map_info WHERE id = '$id' AND table_or_script_name = '$name'");
return 0;
}
//mysqli_close();
return date_create($lastRunSelf['script_last_run']);
//timezone fixes - wxc 11-27-2018
$datetime = new DateTime($lastRunSelf['script_last_run']);
date_timezone_set($datetime, $GLOBALS['localTimeZone']);
return $datetime;
}
//put a new "last_run_time" for the script into the DB
......
......@@ -28,6 +28,12 @@ if (!$sql_connection) {
$totalNumNonMeshMarkers = mysqli_num_rows(mysqli_query($sql_connection, "SELECT name from marker_info"));
mysqli_close($sql_connection);
}
$localTimeZone = new DateTimeZone($USER_SETTINGS['localTimeZone']);
$nodeInfoLastUpdate = new DateTime($lastUpdateNodeInfo['script_last_run']);
$linkInfoLastUpdate = new DateTime($lastUpdateLinkInfo['table_last_update']);
date_timezone_set($nodeInfoLastUpdate, $localTimeZone);
date_timezone_set($linkInfoLastUpdate, $localTimeZone);
?>
<table id="admin_sql_status_table">
<thead>
......@@ -63,7 +69,8 @@ echo "<td class=\"admin_sql_status_table_background\">With Locations:</td>\n";
echo "<td class=\"admin_sql_status_table_background\">$totalNumNodesWithLocations</td>\n";
echo "<td colspan=\"2\" class=\"admin_sql_status_table_background\">Nodes Last Polled:</td>\n";
//echo "<td class=\"admin_sql_status_table_background\">&nbsp;</td>\n";
echo "<td class=\"admin_sql_status_table_background\">" . $lastUpdateNodeInfo['script_last_run'] . "\n";
echo "<td class=\"admin_sql_status_table_background\">" . date_format($nodeInfoLastUpdate, 'Y-m-d H:i:s T') . "\n";
//echo "<td class=\"admin_sql_status_table_background\">" . $lastUpdateNodeInfo['script_last_run'] . "\n";
echo "<td class=\"admin_sql_status_table_background\"></td>\n";
echo "</tr>";
echo "<tr>";
......@@ -73,7 +80,7 @@ echo "<td class=\"admin_sql_status_table_background\">With Locations:</td>\n";
echo "<td class=\"admin_sql_status_table_background\">$totalNumLinksWithLocations</td>\n";
echo "<td colspan=\"2\" class=\"admin_sql_status_table_background\">Links Last Updated:</td>\n";
//echo "<td class=\"admin_sql_status_table_background\">Updated:</td>\n";
echo "<td class=\"admin_sql_status_table_background\">" . $lastUpdateLinkInfo['table_last_update'] . "\n";
echo "<td class=\"admin_sql_status_table_background\">" . date_format($linkInfoLastUpdate, 'Y-m-d H:i:s T') . "\n";
echo "<td class=\"admin_sql_status_table_background\">&nbsp;</td>\n";
echo "</tr>\n";
echo "<tr>\n";
......
......@@ -46,6 +46,9 @@ if (!isset($_SESSION['userLoggedIn'])) {
echo "<th class=\"pointerCursor\" onclick=\"sortTable(5)\"><boldText>Last Seen</boldText></th>\n";
echo "</tr>\n";
foreach ($nodeInfo as $value) {
$localTimeZone = new DateTimeZone($USER_SETTINGS['localTimeZone']);
$lastSeen = new DateTime($value['last_seen']);
date_timezone_set($lastSeen, $localTimeZone);
// if ($value['location_fix'] == 0) {
// $yesOrNo = "No";
// }elseif ($value['location_fix'] == 1) {
......@@ -61,7 +64,7 @@ if (!isset($_SESSION['userLoggedIn'])) {
"<td>" . $value['grid_square'] . "</td>" .
"<td contenteditable='true' onBlur=\"saveToDatabase(this, 'location_fix', '" . $value['node'] ."')\" " .
"onClick=\"showEdit(this);\">" . $value['location_fix'] . "</td>" .
"<td>" . $value['last_seen'] . "</td>" .
"<td>" . date_format($lastSeen, 'Y-m-d H:i:s T') . "</td>" .
"<td class='BackgroundColor'>\n" .
"<form class='remove_node_from_db' action='remove_node.php' method='post'>\n" .
"<input type='hidden' name='wifi_mac_address' value='" . $value['wifi_mac_address'] . "'>\n" .
......
......@@ -294,6 +294,9 @@ if (!isset($_SESSION['userLoggedIn'])) {
echo "<th class=\"pointerCursor\" onclick=\"sortTable(2)\"><boldText>Last Login</boldText></th>\n";
echo "</tr>\n";
foreach ($users as $value) {
$localTimeZone = new DateTimeZone($USER_SETTINGS['localTimeZone']);
$lastLogin = new DateTime($value['last_login']);
date_timezone_set($lastLogin, $localTimeZone);
/*
if ($value['id'] !== "map-admin") {
echo "\n<tr><td>" . $value['id'] . "</td>" .
......@@ -316,7 +319,7 @@ if (!isset($_SESSION['userLoggedIn'])) {
"<td>" . $value['super_user'] . "</td>" .
"<td>" . $value['id'] . "</td>" .
"<td>" . $value['user'] . "</td>" .
"<td>" . $value['last_login'] . "</td>" .
"<td>" . date_format($lastLogin, 'Y-m-d H:i:s T') . "</td>" .
// "<td>" . $value['timestamp'] . "</td>" .
// "<td>" . $value['lon'] . "</td>" .
"<td class='BackgroundColor'>" .
......@@ -372,7 +375,7 @@ if (!isset($_SESSION['userLoggedIn'])) {
if ($value['user'] == $_SESSION['username']) {
echo "\n<tr>" .
"<td>" . $value['user'] . "</td>" .
"<td>" . $value['last_login'] . "</td>" .
"<td>" . date_format($lastLogin, 'Y-m-d H:i:s T') . "</td>" .
// "<td>" . $value['timestamp'] . "</td>" .
// "<td>" . $value['lon'] . "</td>" .
//"<td class='BackgroundColor'>" .
......
......@@ -48,10 +48,13 @@ if (!isset($_SESSION['userLoggedIn'])) {
// echo "<th onclick=\"sortTable(4)\"><boldText>Lon</boldText></th>\n";
echo "</tr>\n";
foreach ($ignoredNodes as $value) {
$tz = new DateTimeZone($GLOBALS['USER_SETTINGS']['localTimeZone']);
$datetime = new DateTime($value['timestamp'], $tz);
echo "\n<tr><td>" . $value['ip'] . "</td>" .
"<td>" . $value['name'] . "</td>" .
"<td>" . $value['reason'] . "</td>" .
"<td>" . $value['timestamp'] . "</td>" .
"<td>" . date_format($datetime, 'Y-m-d H:i:s T') . "</td>" .
// "<td>" . $value['timestamp'] . "</td>" .
// "<td>" . $value['lon'] . "</td>" .
"<td>" .
"<form class='remove_ignored_node_form' action='view_ignored_nodes.php' method='post'>" .
......
......@@ -33,9 +33,12 @@ if (!isset($_SESSION['userLoggedIn'])) {
// echo "<th onclick=\"sortTable(4)\"><boldText>Lon</boldText></th>\n";
echo "</tr>\n";
foreach ($removedNodes as $value) {
$tz = new DateTimeZone($GLOBALS['USER_SETTINGS']['localTimeZone']);
$lastSeen = new DateTime($value['last_seen'], $tz);
$timeRemoved = new DateTime($value['time_removed'], $tz);
echo "\n<tr><td>" . $value['node'] . "</td>" .
"<td>" . $value['last_seen'] . "</td>" .
"<td>" . $value['time_removed'] . "</td>" .
"<td>" . date_format($lastSeen, 'Y-m-d H:i:s T') . "</td>" .
"<td>" . date_format($timeRemoved, 'Y-m-d H:i:s T') . "</td>" .
// "<td>" . $value['lat'] . "</td>" .
// "<td>" . $value['lon'] . "</td>" .
"<td></td>" .
......
......@@ -73,7 +73,9 @@ if (file_exists($INCLUDE_DIR . "/scripts/meshmap-settings.ini")) {
require $INCLUDE_DIR . "/scripts/wxc_functions.inc";
require $INCLUDE_DIR . "/scripts/map_functions.inc";
date_default_timezone_set($USER_SETTINGS['localTimeZone']);
//commented out for timezone fizes -wxc 11-27-2018
global $localTimeZone;
$localTimeZone = new DateTimeZone($USER_SETTINGS['localTimeZone']);
/*
* This section will try to tell if the client has internet access or not
......
......@@ -184,6 +184,9 @@ if (is_array($NodeList) && !empty($NodeList))
echo "<tbody>\n\n";
foreach ($NodeList as $Node)
{
$tz = new DateTimeZone($USER_SETTINGS['localTimeZone']);
$datetime = new DateTime($Node['last_seen']);
date_timezone_set($datetime, $tz);
$node_FirmwareStatus = checkVersion($Node['firmware_version'], $STABLE_MESH_VERSION);
/*
* If you add columns here, make sure to add them to display_HeaderTitles()
......@@ -215,8 +218,7 @@ if (is_array($NodeList) && !empty($NodeList))
}
echo "<td>" . $firmware . "</td>\n";
echo "<td align=\"center\">"
. $Node['last_seen']
." GMT"
. date_format($datetime, 'F d Y H:i:s T')
."</td>\n";
//added kg6wxc may 2018
/*****START*****/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment