1
0
mirror of https://github.com/ShaYmez/xlxd.git synced 2025-08-10 00:52:26 -04:00

db v2.3.9

redesign for the callinghome.php
This commit is contained in:
LX1IQ 2018-01-19 10:15:04 +01:00 committed by GitHub
parent 6d5055a927
commit 8b52495cf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 20 deletions

View File

@ -1,3 +1,11 @@
xlx db v2.3.9
redesign for the callinghome.php
- "config.inc.php"
- "index.php"
- "functions.php"
xlx db v2.3.8 xlx db v2.3.8
add support for network traffic statistics via vnstat. add support for network traffic statistics via vnstat.

View File

@ -2,8 +2,8 @@
session_start(); session_start();
if (file_exists("./pgs/functions.php")) { require_once("./pgs/functions.php"); } else { die("functions.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 (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('ParseXML')) require_once("./pgs/class.parsexml.php");
if (!class_exists('Node')) require_once("./pgs/class.node.php"); if (!class_exists('Node')) require_once("./pgs/class.node.php");
@ -19,23 +19,49 @@ $Reflector->SetXMLFile($Service['XMLFile']);
$Reflector->LoadXML(); $Reflector->LoadXML();
if ($CallingHome['Active']) { if ($CallingHome['Active']) {
$CallHomeNow = false; $CallHomeNow = false;
$LastSync = 0;
$Hash = "";
if (!file_exists($CallingHome['HashFile'])) { if (!file_exists($CallingHome['HashFile'])) {
$Hash = CreateCode(16); $Ressource = fopen($CallingHome['HashFile'], "w+");
$LastSync = 0; if ($Ressource) {
UpdateHashFile($CallingHome['HashFile'], $LastSync, $Hash); $Hash = CreateCode(16);
$CallHomeNow = true; @fwrite($Ressource, "<?php\n");
@fwrite($Ressource, "\n".'$Hash = "'.$Hash.'";');
@fwrite($Ressource, "\n\n".'?>');
@fflush($Ressource);
@fclose($Ressource);
@chmod($HashFile, 0777);
}
} }
else { else {
include($CallingHome['HashFile']); require_once($CallingHome['HashFile']);
if ($LastSync < (time() - $CallingHome['PushDelay'])) { }
UpdateHashFile($CallingHome['HashFile'], time(), $Hash);
$CallHomeNow = true; if (@file_exists($CallingHome['LastCallHomefile'])) {
if (@is_readable($CallingHome['LastCallHomefile'])) {
$tmp = @file($CallingHome['LastCallHomefile']);
if (isset($tmp[0])) {
$LastSync = $tmp[0];
}
unset($tmp);
} }
} }
if ($LastSync < (time() - $CallingHome['PushDelay'])) {
$CallHomeNow = true;
$Ressource = @fopen($CallingHome['LastCallHomefile'], "w+");
if ($Ressource) {
@fwrite($Ressource, time());
@fflush($Ressource);
@fclose($Ressource);
@chmod($HashFile, 0777);
}
}
if ($CallHomeNow || isset($_GET['callhome'])) { if ($CallHomeNow || isset($_GET['callhome'])) {
$Reflector->SetCallingHome($CallingHome, $Hash); $Reflector->SetCallingHome($CallingHome, $Hash);
$Reflector->ReadInterlinkFile(); $Reflector->ReadInterlinkFile();
@ -43,7 +69,7 @@ if ($CallingHome['Active']) {
$Reflector->PrepareReflectorXML(); $Reflector->PrepareReflectorXML();
$Reflector->CallHome(); $Reflector->CallHome();
} }
} }
else { else {
$Hash = ""; $Hash = "";
@ -60,7 +86,7 @@ else {
<meta name="author" content="<?php echo $PageOptions['MetaAuthor']; ?>" /> <meta name="author" content="<?php echo $PageOptions['MetaAuthor']; ?>" />
<meta name="revisit" content="<?php echo $PageOptions['MetaRevisit']; ?>" /> <meta name="revisit" content="<?php echo $PageOptions['MetaRevisit']; ?>" />
<meta name="robots" content="<?php echo $PageOptions['MetaAuthor']; ?>" /> <meta name="robots" content="<?php echo $PageOptions['MetaAuthor']; ?>" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo $Reflector->GetReflectorName(); ?> Reflector Dashboard</title> <title><?php echo $Reflector->GetReflectorName(); ?> Reflector Dashboard</title>
<link rel="stylesheet" type="text/css" href="./css/layout.css"> <link rel="stylesheet" type="text/css" href="./css/layout.css">
@ -69,8 +95,8 @@ else {
if ($PageOptions['PageRefreshActive']) { if ($PageOptions['PageRefreshActive']) {
echo ' echo '
<script> <script>
var PageRefresh; var PageRefresh;
function ReloadPage() { function ReloadPage() {
document.location.href = "./index.php'; document.location.href = "./index.php';
if (isset($_GET['show'])) { if (isset($_GET['show'])) {
@ -90,7 +116,7 @@ else {
} }
</script>'; </script>';
} }
if (!isset($_GET['show'])) $_GET['show'] = ""; if (!isset($_GET['show'])) $_GET['show'] = "";
?> ?>
</head> </head>
@ -106,14 +132,14 @@ else {
<td><a href="./index.php?show=repeaters" class="menulink<?php if ($_GET['show'] == 'repeaters') { echo 'active'; } ?>">Repeaters / Nodes (<?php echo $Reflector->NodeCount(); ?>)</a></td> <td><a href="./index.php?show=repeaters" class="menulink<?php if ($_GET['show'] == 'repeaters') { echo 'active'; } ?>">Repeaters / Nodes (<?php echo $Reflector->NodeCount(); ?>)</a></td>
<td><a href="./index.php?show=peers" class="menulink<?php if ($_GET['show'] == 'peers') { echo 'active'; } ?>">Peers (<?php echo $Reflector->PeerCount(); ?>)</a></td> <td><a href="./index.php?show=peers" class="menulink<?php if ($_GET['show'] == 'peers') { echo 'active'; } ?>">Peers (<?php echo $Reflector->PeerCount(); ?>)</a></td>
<td><a href="./index.php?show=reflectors" class="menulink<?php if ($_GET['show'] == 'reflectors') { echo 'active'; } ?>">Reflectorlist</a></td> <td><a href="./index.php?show=reflectors" class="menulink<?php if ($_GET['show'] == 'reflectors') { echo 'active'; } ?>">Reflectorlist</a></td>
<td><a href="./index.php?show=liveircddb" class="menulink<?php if ($_GET['show'] == 'liveircddb') { echo 'active'; } ?>">ircDDB live</a></td> <td><a href="./index.php?show=liveircddb" class="menulink<?php if ($_GET['show'] == 'liveircddb') { echo 'active'; } ?>">D-Star live</a></td>
<?php <?php
if ($PageOptions['Traffic']['Show']) { if ($PageOptions['Traffic']['Show']) {
echo ' echo '
<td><a href="./index.php?show=traffic" class="menulink'; <td><a href="./index.php?show=traffic" class="menulink';
if ($_GET['show'] == 'traffic') { echo 'active'; } if ($_GET['show'] == 'traffic') { echo 'active'; }
echo '">Traffic</a></td>'; echo '">Traffic statistics</a></td>';
} }
?> ?>