From 8ea9385d560cf08553566837cac82c55bcddd7b8 Mon Sep 17 00:00:00 2001 From: LX1IQ Date: Tue, 19 Dec 2017 11:16:04 +0100 Subject: [PATCH] v2.3.8 add support for network traffic statistics via vnstat. --- dashboard/changes.txt | 12 ++++++++- dashboard/index.php | 63 ++++++++++++++++++++++--------------------- 2 files changed, 43 insertions(+), 32 deletions(-) diff --git a/dashboard/changes.txt b/dashboard/changes.txt index 727e0b5..2bba828 100755 --- a/dashboard/changes.txt +++ b/dashboard/changes.txt @@ -1,6 +1,16 @@ +xlx db v2.3.8 + +add support for network traffic statistics via vnstat. + +- "config.inc.php" +- "index.php" +- "functions.php" + +add traffic.php + xlx db v2.3.7 -add background button color change on active page. +add background color change on active page. - "config.inc.php" - "layout.css" diff --git a/dashboard/index.php b/dashboard/index.php index 6509be5..f64d1ab 100755 --- a/dashboard/index.php +++ b/dashboard/index.php @@ -2,8 +2,8 @@ session_start(); -if (file_exists("./pgs/functions.php")) { require_once("./pgs/functions.php"); } else { die("functions.php does not exist."); } -if (file_exists("./pgs/config.inc.php")) { require_once("./pgs/config.inc.php"); } else { die("config.inc.php does not exist."); } +if (file_exists("./pgs/functions.php")) { require_once("./pgs/functions.php"); } else { die("functions.php does not exist."); } +if (file_exists("./pgs/config.inc.php")) { require_once("./pgs/config.inc.php"); } else { die("config.inc.php does not exist."); } if (!class_exists('ParseXML')) require_once("./pgs/class.parsexml.php"); if (!class_exists('Node')) require_once("./pgs/class.node.php"); @@ -12,6 +12,8 @@ if (!class_exists('Station')) require_once("./pgs/class.station.php"); if (!class_exists('Peer')) require_once("./pgs/class.peer.php"); if (!class_exists('Interlink')) require_once("./pgs/class.interlink.php"); +setlocale(LC_ALL, $VNStat['Locale']); + $Reflector = new xReflector(); $Reflector->SetFlagFile("./pgs/country.csv"); $Reflector->SetPIDFile($Service['PIDFile']); @@ -19,38 +21,23 @@ $Reflector->SetXMLFile($Service['XMLFile']); $Reflector->LoadXML(); -if ($CallingHome['Active']) { - +if ($CallingHome['Active']) { + $CallHomeNow = false; if (!file_exists($CallingHome['HashFile'])) { $Hash = CreateCode(16); $LastSync = 0; - $Ressource = @fopen($CallingHome['HashFile'],"w"); - if ($Ressource) { - @fwrite($Ressource, "'); - @fclose($Ressource); - @exec("chmod 777 ".$CallingHome['HashFile']); - $CallHomeNow = true; - } + UpdateHashFile($CallingHome['HashFile'], $LastSync, $Hash); + $CallHomeNow = true; } else { include($CallingHome['HashFile']); - if ($LastSync < (time() - $CallingHome['PushDelay'])) { - $Ressource = @fopen($CallingHome['HashFile'],"w"); - if ($Ressource) { - @fwrite($Ressource, "'); - @fclose($Ressource); - } + if ($LastSync < (time() - $CallingHome['PushDelay'])) { + UpdateHashFile($CallingHome['HashFile'], time(), $Hash); $CallHomeNow = true; } } - + if ($CallHomeNow || isset($_GET['callhome'])) { $Reflector->SetCallingHome($CallingHome, $Hash); $Reflector->ReadInterlinkFile(); @@ -58,14 +45,13 @@ if ($CallingHome['Active']) { $Reflector->PrepareReflectorXML(); $Reflector->CallHome(); } + } else { $Hash = ""; } - - ?> @@ -76,7 +62,7 @@ else { - + <?php echo $Reflector->GetReflectorName(); ?> Reflector Dashboard @@ -85,8 +71,8 @@ else { if ($PageOptions['PageRefreshActive']) { echo ' '; } - + if (!isset($_GET['show'])) $_GET['show'] = ""; ?> @@ -118,7 +104,21 @@ else { @@ -141,6 +141,7 @@ else { case 'liveircddb' : require_once("./pgs/liveircddb.php"); break; case 'peers' : require_once("./pgs/peers.php"); break; case 'reflectors' : require_once("./pgs/reflectors.php"); break; + case 'traffic' : require_once("./pgs/traffic.php"); break; default : require_once("./pgs/users.php"); }