mirror of
https://github.com/ShaYmez/xlxd.git
synced 2024-12-23 10:05:48 -05:00
Merge pull request #47 from lamaral/db2-update
Dashboard 2 updates for xlxd 2.x.x
This commit is contained in:
commit
6633a59a22
@ -6,15 +6,23 @@
|
||||
* The dashboard is based of the Bootstrap dashboard template.
|
||||
*/
|
||||
|
||||
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");
|
||||
if (!class_exists('ParseXML')) require_once("./pgs/class.parsexml.php");
|
||||
if (!class_exists('Node')) require_once("./pgs/class.node.php");
|
||||
if (!class_exists('xReflector')) require_once("./pgs/class.reflector.php");
|
||||
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");
|
||||
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");
|
||||
|
||||
$Reflector = new xReflector();
|
||||
$Reflector->SetFlagFile("./pgs/country.csv");
|
||||
@ -23,176 +31,198 @@ $Reflector->SetXMLFile($Service['XMLFile']);
|
||||
|
||||
$Reflector->LoadXML();
|
||||
|
||||
if ($CallingHome['Active']) {
|
||||
|
||||
$CallHomeNow = false;
|
||||
if (!file_exists($CallingHome['HashFile'])) {
|
||||
$Hash = CreateCode(16);
|
||||
$LastSync = 0;
|
||||
$Ressource = @fopen($CallingHome['HashFile'],"w");
|
||||
if ($Ressource) {
|
||||
@fwrite($Ressource, "<?php\n");
|
||||
@fwrite($Ressource, "\n".'$LastSync = 0;');
|
||||
@fwrite($Ressource, "\n".'$Hash = "'.$Hash.'";');
|
||||
@fwrite($Ressource, "\n\n".'?>');
|
||||
@fclose($Ressource);
|
||||
@exec("chmod 777 ".$CallingHome['HashFile']);
|
||||
$CallHomeNow = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
include($CallingHome['HashFile']);
|
||||
if ($LastSync < (time() - $CallingHome['PushDelay'])) {
|
||||
$Ressource = @fopen($CallingHome['HashFile'],"w");
|
||||
if ($Ressource) {
|
||||
if ($CallingHome['Active']) {
|
||||
|
||||
$CallHomeNow = false;
|
||||
if (!file_exists($CallingHome['HashFile'])) {
|
||||
$Hash = CreateCode(16);
|
||||
$LastSync = 0;
|
||||
$Ressource = @fopen($CallingHome['HashFile'], "w");
|
||||
if ($Ressource) {
|
||||
@fwrite($Ressource, "<?php\n");
|
||||
@fwrite($Ressource, "\n".'$LastSync = '.time().';');
|
||||
@fwrite($Ressource, "\n".'$Hash = "'.$Hash.'";');
|
||||
@fwrite($Ressource, "\n\n".'?>');
|
||||
@fwrite($Ressource, "\n" . '$LastSync = 0;');
|
||||
@fwrite($Ressource, "\n" . '$Hash = "' . $Hash . '";');
|
||||
@fwrite($Ressource, "\n\n" . '?>');
|
||||
@fclose($Ressource);
|
||||
}
|
||||
$CallHomeNow = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($CallHomeNow || isset($_GET['callhome'])) {
|
||||
$Reflector->SetCallingHome($CallingHome, $Hash);
|
||||
$Reflector->ReadInterlinkFile();
|
||||
$Reflector->PrepareInterlinkXML();
|
||||
$Reflector->PrepareReflectorXML();
|
||||
$Reflector->CallHome();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$Hash = "";
|
||||
@exec("chmod 777 " . $CallingHome['HashFile']);
|
||||
$CallHomeNow = true;
|
||||
}
|
||||
} else {
|
||||
include($CallingHome['HashFile']);
|
||||
if ($LastSync < (time() - $CallingHome['PushDelay'])) {
|
||||
$Ressource = @fopen($CallingHome['HashFile'], "w");
|
||||
if ($Ressource) {
|
||||
@fwrite($Ressource, "<?php\n");
|
||||
@fwrite($Ressource, "\n" . '$LastSync = ' . time() . ';');
|
||||
@fwrite($Ressource, "\n" . '$Hash = "' . $Hash . '";');
|
||||
@fwrite($Ressource, "\n\n" . '?>');
|
||||
@fclose($Ressource);
|
||||
}
|
||||
$CallHomeNow = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($CallHomeNow || isset($_GET['callhome'])) {
|
||||
$Reflector->SetCallingHome($CallingHome, $Hash);
|
||||
$Reflector->ReadInterlinkFile();
|
||||
$Reflector->PrepareInterlinkXML();
|
||||
$Reflector->PrepareReflectorXML();
|
||||
$Reflector->CallHome();
|
||||
}
|
||||
} else {
|
||||
$Hash = "";
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="<?php echo $PageOptions['MetaDescription']; ?>" />
|
||||
<meta name="keywords" content="<?php echo $PageOptions['MetaKeywords']; ?>" />
|
||||
<meta name="author" content="<?php echo $PageOptions['MetaAuthor']; ?>" />
|
||||
<meta name="revisit" content="<?php echo $PageOptions['MetaRevisit']; ?>" />
|
||||
<meta name="robots" content="<?php echo $PageOptions['MetaAuthor']; ?>" />
|
||||
|
||||
<link rel="icon" href="./favicon.ico" type="image/vnd.microsoft.icon">
|
||||
<title><?php echo $Reflector->GetReflectorName(); ?> Reflector Dashboard</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="css/bootstrap.min.css" rel="stylesheet">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="<?php echo $PageOptions['MetaDescription']; ?>"/>
|
||||
<meta name="keywords" content="<?php echo $PageOptions['MetaKeywords']; ?>"/>
|
||||
<meta name="author" content="<?php echo $PageOptions['MetaAuthor']; ?>"/>
|
||||
<meta name="revisit" content="<?php echo $PageOptions['MetaRevisit']; ?>"/>
|
||||
<meta name="robots" content="<?php echo $PageOptions['MetaAuthor']; ?>"/>
|
||||
|
||||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
|
||||
<link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
||||
<title><?php echo $Reflector->GetReflectorName(); ?> Reflector Dashboard</title>
|
||||
<link rel="icon" href="./favicon.ico" type="image/vnd.microsoft.icon">
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="css/dashboard.css" rel="stylesheet">
|
||||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
|
||||
<link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
|
||||
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<?php
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="css/dashboard.css" rel="stylesheet">
|
||||
|
||||
if ($PageOptions['PageRefreshActive']) {
|
||||
echo '
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<?php
|
||||
|
||||
if ($PageOptions['PageRefreshActive']) {
|
||||
echo '
|
||||
<script>
|
||||
|
||||
function ReloadPage() {
|
||||
document.location.href = "./index.php';
|
||||
if (isset($_GET['show'])) {
|
||||
echo '?show='.$_GET['show'];
|
||||
}
|
||||
echo '";
|
||||
if (isset($_GET['show'])) {
|
||||
echo '?show=' . $_GET['show'];
|
||||
}
|
||||
echo '";
|
||||
}';
|
||||
|
||||
if (!isset($_GET['show']) || (($_GET['show'] != 'liveircddb') && ($_GET['show'] != 'reflectors') && ($_GET['show'] != 'interlinks'))) {
|
||||
echo '
|
||||
setTimeout(ReloadPage, '.$PageOptions['PageRefreshDelay'].');';
|
||||
}
|
||||
echo '
|
||||
if (!isset($_GET['show']) || (($_GET['show'] != 'liveircddb') && ($_GET['show'] != 'reflectors') && ($_GET['show'] != 'interlinks'))) {
|
||||
echo '
|
||||
setTimeout(ReloadPage, ' . $PageOptions['PageRefreshDelay'] . ');';
|
||||
}
|
||||
echo '
|
||||
|
||||
</script>';
|
||||
}
|
||||
if (!isset($_GET['show'])) $_GET['show'] = "";
|
||||
?>
|
||||
}
|
||||
if (!isset($_GET['show'])) $_GET['show'] = "";
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<?php if (file_exists("./tracking.php")) { include_once("tracking.php"); }?>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container-fluid">
|
||||
<?php if (file_exists("./tracking.php")) {
|
||||
include_once("tracking.php");
|
||||
} ?>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<span class="navbar-brand"><?php echo $Reflector->GetReflectorName(); ?> Multiprotocol Gateway</span>
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
|
||||
aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<span class="navbar-brand"><?php echo $Reflector->GetReflectorName(); ?> Multiprotocol Gateway</span>
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="navbar-info"><?php echo $Reflector->GetVersion(); ?> - Dashboard v<?php echo $PageOptions['DashboardVersion']; ?></li>
|
||||
<li class="navbar-info">Service uptime: <?php echo FormatSeconds($Reflector->GetServiceUptime()); ?></li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="navbar-info"><?php echo $Reflector->GetVersion(); ?> - Dashboard
|
||||
v<?php echo $PageOptions['DashboardVersion']; ?></li>
|
||||
<li class="navbar-info">Service
|
||||
uptime: <?php echo FormatSeconds($Reflector->GetServiceUptime()); ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 col-md-2 sidebar">
|
||||
<ul class="nav nav-sidebar">
|
||||
<li<?php echo (($_GET['show'] == "users") || ($_GET['show'] == "")) ? ' class="active"' : ''; ?>><a href="./index.php">Users / Modules</a></li>
|
||||
<li<?php echo ($_GET['show'] == "repeaters") ? ' class="active"' : ''; ?>><a href="./index.php?show=repeaters">Repeaters / Nodes (<?php echo $Reflector->NodeCount(); ?>)</a></li>
|
||||
<li<?php echo ($_GET['show'] == "peers") ? ' class="active"' : ''; ?>><a href="./index.php?show=peers">Peers (<?php echo $Reflector->PeerCount(); ?>)</a></li>
|
||||
<li<?php echo ($_GET['show'] == "reflectors") ? ' class="active"' : ''; ?>><a href="./index.php?show=reflectors">Reflectorlist</a></li>
|
||||
<li<?php echo ($_GET['show'] == "liveircddb") ? ' class="active"' : ''; ?>><a href="./index.php?show=liveircddb">D-Star live</a></li>
|
||||
</ul>
|
||||
<ul class="nav nav-sidebar">
|
||||
<li<?php echo (($_GET['show'] == "users") || ($_GET['show'] == "")) ? ' class="active"' : ''; ?>><a
|
||||
href="./index.php">Users / Modules</a></li>
|
||||
<li<?php echo ($_GET['show'] == "repeaters") ? ' class="active"' : ''; ?>><a
|
||||
href="./index.php?show=repeaters">Repeaters / Nodes (<?php echo $Reflector->NodeCount(); ?>
|
||||
)</a></li>
|
||||
<li<?php echo ($_GET['show'] == "peers") ? ' class="active"' : ''; ?>><a href="./index.php?show=peers">Peers
|
||||
(<?php echo $Reflector->PeerCount(); ?>)</a></li>
|
||||
<li<?php echo ($_GET['show'] == "reflectors") ? ' class="active"' : ''; ?>><a
|
||||
href="./index.php?show=reflectors">Reflectorlist</a></li>
|
||||
<li<?php echo ($_GET['show'] == "liveircddb") ? ' class="active"' : ''; ?>><a
|
||||
href="./index.php?show=liveircddb">D-Star live</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
||||
|
||||
<?php
|
||||
if ($CallingHome['Active']) {
|
||||
if (!is_readable($CallingHome['HashFile']) && (!is_writeable($CallingHome['HashFile']))) {
|
||||
echo '
|
||||
<?php
|
||||
if ($CallingHome['Active']) {
|
||||
if (!is_readable($CallingHome['HashFile']) && (!is_writeable($CallingHome['HashFile']))) {
|
||||
echo '
|
||||
<div class="error">
|
||||
your private hash in '.$CallingHome['HashFile'].' could not be created, please check your config file and the permissions for the defined folder.
|
||||
your private hash in ' . $CallingHome['HashFile'] . ' could not be created, please check your config file and the permissions for the defined folder.
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ($_GET['show']) {
|
||||
case 'users' : require_once("./pgs/users.php"); break;
|
||||
case 'repeaters' : require_once("./pgs/repeaters.php"); break;
|
||||
case 'liveircddb' : require_once("./pgs/liveircddb.php"); break;
|
||||
case 'peers' : require_once("./pgs/peers.php"); break;
|
||||
case 'reflectors' : require_once("./pgs/reflectors.php"); break;
|
||||
default : require_once("./pgs/users.php");
|
||||
}
|
||||
switch ($_GET['show']) {
|
||||
case 'users' :
|
||||
require_once("./pgs/users.php");
|
||||
break;
|
||||
case 'repeaters' :
|
||||
require_once("./pgs/repeaters.php");
|
||||
break;
|
||||
case 'liveircddb' :
|
||||
require_once("./pgs/liveircddb.php");
|
||||
break;
|
||||
case 'peers' :
|
||||
require_once("./pgs/peers.php");
|
||||
break;
|
||||
case 'reflectors' :
|
||||
require_once("./pgs/reflectors.php");
|
||||
break;
|
||||
default :
|
||||
require_once("./pgs/users.php");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p><a href="mailto:<?php echo $PageOptions['ContactEmail']; ?>"><?php echo $PageOptions['ContactEmail']; ?></a></p>
|
||||
</div>
|
||||
</footer>
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p><a href="mailto:<?php echo $PageOptions['ContactEmail']; ?>"><?php echo $PageOptions['ContactEmail']; ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
||||
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
|
||||
<script src="js/ie10-viewport-bug-workaround.js"></script>
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
||||
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
|
||||
<script src="js/ie10-viewport-bug-workaround.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -10,8 +10,9 @@ class Node {
|
||||
private $LastHeardTime;
|
||||
private $Suffix;
|
||||
private $Prefix;
|
||||
private $RandomID;
|
||||
|
||||
public function __construct($Callsign, $IP, $LinkedModule, $Protocol, $ConnectTime, $LastHeardTime) {
|
||||
public function __construct($Callsign, $IP, $LinkedModule, $Protocol, $ConnectTime, $LastHeardTime, $RandomID) {
|
||||
|
||||
$this->IP = $IP;
|
||||
|
||||
@ -34,8 +35,8 @@ class Node {
|
||||
$this->Prefix = "";
|
||||
}
|
||||
|
||||
|
||||
$this->LinkedModule = trim($LinkedModule);
|
||||
$this->LinkedModule = trim($LinkedModule);
|
||||
$this->RandomID = $RandomID;
|
||||
}
|
||||
|
||||
public function GetFullCallsign() { return $this->FullCallsign; }
|
||||
@ -47,6 +48,8 @@ class Node {
|
||||
public function GetLastHeardTime() { return $this->LastHeardTime; }
|
||||
public function GetSuffix() { return $this->Suffix; }
|
||||
public function GetPrefix() { return $this->Prefix; }
|
||||
public function GetRandomID() { return $this->RandomID; }
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,32 +1,29 @@
|
||||
<?php
|
||||
|
||||
class ParseXML {
|
||||
|
||||
|
||||
public function __construct() {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function GetElement($InputString, $ElementName) {
|
||||
if (strpos($InputString, "<".$ElementName.">") === false) return false;
|
||||
if (strpos($InputString, "</".$ElementName.">") === false) return false;
|
||||
|
||||
|
||||
$Element = substr($InputString, strpos($InputString, "<".$ElementName.">")+strlen($ElementName)+2, strpos($InputString, "</".$ElementName.">")-strpos($InputString, "<".$ElementName.">")-strlen($ElementName)-2);
|
||||
return $Element;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function GetAllElements($InputString, $ElementName) {
|
||||
$Elements = array();
|
||||
while (strpos($InputString, $ElementName) !== false) {
|
||||
$Elements[] = $this->GetElement($InputString, $ElementName);
|
||||
$InputString = substr($InputString, strpos($InputString, "</".$ElementName.">")+strlen($ElementName)+3, strlen($InputString));
|
||||
$InputString = substr($InputString, strpos($InputString, "</".$ElementName.">")+strlen($ElementName)+3, strlen($InputString));
|
||||
}
|
||||
return $Elements;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -59,14 +59,14 @@ class xReflector {
|
||||
$tmpNodes = $XML->GetAllElements($AllNodesString, "NODE");
|
||||
|
||||
for ($i=0;$i<count($tmpNodes);$i++) {
|
||||
$Node = new Node($XML->GetElement($tmpNodes[$i], 'Callsign'), $XML->GetElement($tmpNodes[$i], 'IP'), $XML->GetElement($tmpNodes[$i], 'LinkedModule'), $XML->GetElement($tmpNodes[$i], 'Protocol'), $XML->GetElement($tmpNodes[$i], 'ConnectTime'), $XML->GetElement($tmpNodes[$i], 'LastHeardTime'));
|
||||
$Node = new Node($XML->GetElement($tmpNodes[$i], 'Callsign'), $XML->GetElement($tmpNodes[$i], 'IP'), $XML->GetElement($tmpNodes[$i], 'LinkedModule'), $XML->GetElement($tmpNodes[$i], 'Protocol'), $XML->GetElement($tmpNodes[$i], 'ConnectTime'), $XML->GetElement($tmpNodes[$i], 'LastHeardTime'), CreateCode(16));
|
||||
$this->AddNode($Node);
|
||||
}
|
||||
|
||||
$AllStationsString = $XML->GetElement($this->XMLContent, $LinkedUsersName);
|
||||
$tmpStations = $XML->GetAllElements($AllStationsString, "STATION");
|
||||
for ($i=0;$i<count($tmpStations);$i++) {
|
||||
$Station = new Station($XML->GetElement($tmpStations[$i], 'Callsign'), $XML->GetElement($tmpStations[$i], 'Via node'), $XML->GetElement($tmpStations[$i], 'Via peer'), $XML->GetElement($tmpStations[$i], 'LastHeardTime'));
|
||||
$Station = new Station($XML->GetElement($tmpStations[$i], 'Callsign'), $XML->GetElement($tmpStations[$i], 'Via node'), $XML->GetElement($tmpStations[$i], 'Via peer'), $XML->GetElement($tmpStations[$i], 'LastHeardTime'), $XML->GetElement($tmpStations[$i], 'On module'));
|
||||
$this->AddStation($Station, false);
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ class xReflector {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function GetSuffixOfRepeater($Repeater, $LinkedModul, $StartWithIndex = 0) {
|
||||
$suffix = "";
|
||||
$found = false;
|
||||
@ -230,6 +230,19 @@ class xReflector {
|
||||
return $suffix;
|
||||
}
|
||||
|
||||
public function GetCallsignAndSuffixByID($RandomId) {
|
||||
$suffix = "";
|
||||
$callsign = "";
|
||||
$i = 0;
|
||||
while ($i < $this->NodeCount()) {
|
||||
if ($this->Nodes[$i]->GetRandomID() == $RandomId) {
|
||||
return $this->Nodes[$i]->GetCallSign().'-'.$this->Nodes[$i]->GetSuffix();
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return 'N/A';
|
||||
}
|
||||
|
||||
public function StationCount() {
|
||||
return count($this->Stations);
|
||||
}
|
||||
@ -264,7 +277,6 @@ class xReflector {
|
||||
}
|
||||
$Letters--;
|
||||
}
|
||||
|
||||
return array(strtolower($Image), $Name);
|
||||
}
|
||||
|
||||
@ -287,6 +299,7 @@ class xReflector {
|
||||
}
|
||||
|
||||
public function GetModuleOfNode($Node) {
|
||||
die("FUNCTION DEPRECATED...");
|
||||
$Node = trim(str_replace(" ", "-", $Node));
|
||||
$Node = trim(str_replace(" ", "-", $Node));
|
||||
$Node = trim(str_replace(" ", "-", $Node));
|
||||
@ -314,6 +327,16 @@ class xReflector {
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function GetNodesInModulesById($Module) {
|
||||
$out = array();
|
||||
for ($i=0;$i<$this->NodeCount();$i++) {
|
||||
if ($this->Nodes[$i]->GetLinkedModule() == $Module) {
|
||||
$out[] = $this->Nodes[$i]->GetRandomID();
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function SetCallingHome($CallingHomeVariables, $Hash) {
|
||||
|
||||
if (!isset($CallingHomeVariables['Active'])) { $CallingHomeVariables['Active'] = false; }
|
||||
@ -345,11 +368,6 @@ class xReflector {
|
||||
|
||||
public function PushCallingHome() {
|
||||
$CallingHome = @fopen($this->CallingHomeServerURL."?ReflectorName=".$this->ReflectorName."&ReflectorUptime=".$this->ServiceUptime."&ReflectorHash=".$this->CallingHomeHash."&DashboardURL=".$this->CallingHomeDashboardURL."&Country=".urlencode($this->CallingHomeCountry)."&Comment=".urlencode($this->CallingHomeComment)."&OverrideIP=".$this->CallingHomeOverrideIP, "r");
|
||||
|
||||
|
||||
|
||||
|
||||
//debug($this->CallingHomeServerURL."?ReflectorName=".$this->ReflectorName."&ReflectorUptime=".$this->ServiceUptime."&ReflectorHash=".$this->CallingHomeHash."&DashboardURL=".$this->CallingHomeDashboardURL."&Country=".urlencode($this->CallingHomeCountry)."&Comment=".urlencode($this->CallingHomeComment));
|
||||
}
|
||||
|
||||
public function ReadInterlinkFile() {
|
||||
@ -402,6 +420,7 @@ class xReflector {
|
||||
<country>'.$this->CallingHomeCountry.'</country>
|
||||
<comment>'.$this->CallingHomeComment.'</comment>
|
||||
<ip>'.$this->CallingHomeOverrideIP.'</ip>
|
||||
<reflectorversion>'.$this->Version.'</reflectorversion>
|
||||
</reflector>';
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,9 @@ class Station {
|
||||
private $Suffix;
|
||||
private $CallsignOnly;
|
||||
private $Peer;
|
||||
private $OnModule;
|
||||
|
||||
public function __construct($Callsign, $Via, $Peer, $LastHeardTime) {
|
||||
public function __construct($Callsign, $Via, $Peer, $LastHeardTime, $OnModule) {
|
||||
$this->Callsign = trim($Callsign);
|
||||
$this->Via = trim($Via);
|
||||
$this->Peer = trim($Peer);
|
||||
@ -23,6 +24,7 @@ class Station {
|
||||
|
||||
$tmp = explode(" ", $Callsign);
|
||||
$this->CallsignOnly = $tmp[0];
|
||||
$this->OnModule = $OnModule;
|
||||
}
|
||||
|
||||
public function GetCallsign() { return $this->Callsign; }
|
||||
@ -31,6 +33,7 @@ class Station {
|
||||
public function GetLastHeardTime() { return $this->LastHeardTime; }
|
||||
public function GetSuffix() { return $this->Suffix; }
|
||||
public function GetCallsignOnly() { return $this->CallsignOnly; }
|
||||
public function GetModule() { return $this->OnModule; }
|
||||
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ $PageOptions = array();
|
||||
|
||||
$PageOptions['ContactEmail'] = 'your_email'; // Support E-Mail address
|
||||
|
||||
$PageOptions['DashboardVersion'] = '2.3.1'; // Dashboard Version
|
||||
$PageOptions['DashboardVersion'] = '2.3.7'; // Dashboard Version
|
||||
|
||||
$PageOptions['PageRefreshActive'] = true; // Activate automatic refresh
|
||||
$PageOptions['PageRefreshDelay'] = '10000'; // Page refresh time in miliseconds
|
||||
@ -33,6 +33,7 @@ $PageOptions['PeerPage']['LimitTo'] = 99; // Numb
|
||||
$PageOptions['PeerPage']['IPModus'] = 'ShowFullIP'; // See possible options above
|
||||
$PageOptions['PeerPage']['MasqueradeCharacter'] = '*'; // Character used for masquerade
|
||||
|
||||
$PageOptions['LastHeardPage']['LimitTo'] = 39; // Number of stations to show
|
||||
|
||||
$PageOptions['ModuleNames'] = array(); // Module nomination
|
||||
$PageOptions['ModuleNames']['A'] = 'Int.';
|
||||
@ -47,7 +48,7 @@ $PageOptions['MetaAuthor'] = 'LX1IQ';
|
||||
$PageOptions['MetaRevisit'] = 'After 30 Days'; // Meta Tag Values, usefull for Search Engine
|
||||
$PageOptions['MetaRobots'] = 'index,follow'; // Meta Tag Values, usefull for Search Engine
|
||||
|
||||
|
||||
$PageOptions['UserPage']['ShowFilter'] = true; // Show Filter on Users page
|
||||
|
||||
$Service['PIDFile'] = '/var/log/xlxd.pid';
|
||||
$Service['XMLFile'] = '/var/log/xlxd.xml';
|
||||
|
@ -1,3 +1,23 @@
|
||||
<?php
|
||||
|
||||
$Result = @fopen($CallingHome['ServerURL']."?do=GetReflectorList", "r");
|
||||
|
||||
$INPUT = "";
|
||||
|
||||
if ($Result) {
|
||||
|
||||
while (!feof ($Result)) {
|
||||
$INPUT .= fgets ($Result, 1024);
|
||||
}
|
||||
|
||||
$XML = new ParseXML();
|
||||
$Reflectorlist = $XML->GetElement($INPUT, "reflectorlist");
|
||||
$Reflectors = $XML->GetAllElements($Reflectorlist, "reflector");
|
||||
}
|
||||
|
||||
fclose($Result);
|
||||
?>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<tr class="table-center">
|
||||
<th class="col-md-1">#</th>
|
||||
@ -22,15 +42,28 @@ for ($i=0;$i<$Reflector->PeerCount();$i++) {
|
||||
|
||||
echo '
|
||||
<tr class="table-center">
|
||||
<td>'.($i+1).'</td>
|
||||
<td>'.$Reflector->Peers[$i]->GetCallSign().'</td>
|
||||
<td>'.($i+1).'</td>';
|
||||
|
||||
$Name = $Reflector->Peers[$i]->GetCallSign();
|
||||
$URL = '';
|
||||
|
||||
for ($j=1;$j<count($Reflectors);$j++) {
|
||||
if ($Name === $XML->GetElement($Reflectors[$j], "name")) {
|
||||
$URL = $XML->GetElement($Reflectors[$j], "dashboardurl");
|
||||
}
|
||||
}
|
||||
if ($Result && (trim($URL) != "")) {
|
||||
echo '<td><a href="'.$URL.'" target="_blank" class="listinglink" title="Visit the Dashboard of '.$Name.'" style="text-decoration:none;color:#000000;">'.$Name.'</a></td>';
|
||||
} else {
|
||||
echo '<td>'.$Name.'</td>';
|
||||
}
|
||||
echo '
|
||||
<td>'.date("d.m.Y H:i", $Reflector->Peers[$i]->GetLastHeardTime()).'</td>
|
||||
<td>'.FormatSeconds(time()-$Reflector->Peers[$i]->GetConnectTime()).' s</td>
|
||||
<td>'.$Reflector->Peers[$i]->GetProtocol().'</td>
|
||||
<td>'.$Reflector->Peers[$i]->GetLinkedModule().'</td>';
|
||||
if ($PageOptions['PeerPage']['IPModus'] != 'HideIP') {
|
||||
echo '
|
||||
<td>';
|
||||
echo '<td>';
|
||||
$Bytes = explode(".", $Reflector->Peers[$i]->GetIP());
|
||||
if ($Bytes !== false && count($Bytes) == 4) {
|
||||
switch ($PageOptions['PeerPage']['IPModus']) {
|
||||
@ -42,8 +75,7 @@ for ($i=0;$i<$Reflector->PeerCount();$i++) {
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
echo '
|
||||
</tr>';
|
||||
echo '</tr>';
|
||||
if ($i == $PageOptions['PeerPage']['LimitTo']) { $i = $Reflector->PeerCount()+1; }
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ for ($i=0;$i<$Reflector->NodeCount();$i++) {
|
||||
case 'C' : echo '2m'; break;
|
||||
case 'D' : echo 'Dongle'; break;
|
||||
case 'G' : echo 'Internet-Gateway'; break;
|
||||
default :
|
||||
default : echo '';
|
||||
}
|
||||
}
|
||||
echo '</td>
|
||||
|
@ -1,6 +1,86 @@
|
||||
<?php
|
||||
|
||||
if (!isset($_SESSION['FilterCallSign'])) {
|
||||
$_SESSION['FilterCallSign'] = null;
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['FilterModule'])) {
|
||||
$_SESSION['FilterModule'] = null;
|
||||
}
|
||||
|
||||
if (isset($_POST['do'])) {
|
||||
if ($_POST['do'] == 'SetFilter') {
|
||||
|
||||
if (isset($_POST['txtSetCallsignFilter'])) {
|
||||
$_POST['txtSetCallsignFilter'] = trim($_POST['txtSetCallsignFilter']);
|
||||
if ($_POST['txtSetCallsignFilter'] == "") {
|
||||
$_SESSION['FilterCallSign'] = null;
|
||||
}
|
||||
else {
|
||||
$_SESSION['FilterCallSign'] = $_POST['txtSetCallsignFilter'];
|
||||
if (strpos($_SESSION['FilterCallSign'], "*") === false) {
|
||||
$_SESSION['FilterCallSign'] = "*".$_SESSION['FilterCallSign']."*";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['txtSetModuleFilter'])) {
|
||||
$_POST['txtSetModuleFilter'] = trim($_POST['txtSetModuleFilter']);
|
||||
if ($_POST['txtSetModuleFilter'] == "") {
|
||||
$_SESSION['FilterModule'] = null;
|
||||
}
|
||||
else {
|
||||
$_SESSION['FilterModule'] = $_POST['txtSetModuleFilter'];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['do'])) {
|
||||
if ($_GET['do'] == "resetfilter") {
|
||||
$_SESSION['FilterModule'] = null;
|
||||
$_SESSION['FilterCallSign'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<table class="table table-striped table-hover">
|
||||
<?php
|
||||
if ($PageOptions['UserPage']['ShowFilter']) {
|
||||
echo '
|
||||
<tr>
|
||||
<th colspan="8">
|
||||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<form name="frmFilterCallSign" method="post" action="./index.php">
|
||||
<input type="hidden" name="do" value="SetFilter" />
|
||||
<input type="text" class="FilterField" value="'.$_SESSION['FilterCallSign'].'" name="txtSetCallsignFilter" placeholder="Callsign" onfocus="SuspendPageRefresh();" onblur="setTimeout(ReloadPage, '.$PageOptions['PageRefreshDelay'].');" />
|
||||
<input type="submit" value="Apply" class="FilterSubmit" />
|
||||
</form>
|
||||
</td>';
|
||||
if (($_SESSION['FilterModule'] != null) || ($_SESSION['FilterCallSign'] != null)) {
|
||||
echo '
|
||||
<td><a href="./index.php?do=resetfilter" class="smalllink">Disable filters</a></td>';
|
||||
}
|
||||
echo '
|
||||
<td align="right" style="padding-right:3px;">
|
||||
<form name="frmFilterModule" method="post" action="./index.php">
|
||||
<input type="hidden" name="do" value="SetFilter" />
|
||||
<input type="text" class="FilterField" value="'.$_SESSION['FilterModule'].'" name="txtSetModuleFilter" placeholder="Module" onfocus="SuspendPageRefresh();" onblur="setTimeout(ReloadPage, '.$PageOptions['PageRefreshDelay'].');" />
|
||||
<input type="submit" value="Apply" class="FilterSubmit" />
|
||||
</form>
|
||||
</td>
|
||||
</table>
|
||||
</th>
|
||||
</tr>';
|
||||
}
|
||||
?>
|
||||
<tr class="table-center">
|
||||
<th class="col-md-1">#</th>
|
||||
<th class="col-md-1">Flag</th>
|
||||
@ -15,36 +95,59 @@
|
||||
|
||||
$Reflector->LoadFlags();
|
||||
for ($i=0;$i<$Reflector->StationCount();$i++) {
|
||||
echo '
|
||||
<tr class="table-center">
|
||||
<td>';
|
||||
echo ($i==0 ? '<img src="./img/radio-waves-hi.png" alt="">' : $i+1);
|
||||
|
||||
|
||||
echo '</td>
|
||||
<td>';
|
||||
|
||||
list ($Flag, $Name) = $Reflector->GetFlag($Reflector->Stations[$i]->GetCallSign());
|
||||
if (file_exists("./img/flags/".$Flag.".png")) {
|
||||
echo '<a href="#" class="tip"><img src="./img/flags/'.$Flag.'.png" class="table-flag" alt="'.$Name.'"><span>'.$Name.'</span></a>';
|
||||
}
|
||||
echo '</td>
|
||||
<td><a href="https://www.qrz.com/db/'.$Reflector->Stations[$i]->GetCallsignOnly().'" class="pl" target="_blank">'.$Reflector->Stations[$i]->GetCallsignOnly().'</a></td>
|
||||
<td>'.$Reflector->Stations[$i]->GetSuffix().'</td>
|
||||
<td><a href="http://www.aprs.fi/'.$Reflector->Stations[$i]->GetCallsignOnly().'" class="pl" target="_blank"><img src="./img/sat.png" alt=""></a></td>
|
||||
<td>'.$Reflector->Stations[$i]->GetVia();
|
||||
if ($Reflector->Stations[$i]->GetPeer() != $Reflector->GetReflectorName()) {
|
||||
echo ' / '.$Reflector->Stations[$i]->GetPeer();
|
||||
}
|
||||
echo '</td>
|
||||
<td>'.@date("d.m.Y H:i", $Reflector->Stations[$i]->GetLastHeardTime()).'</td>
|
||||
<td>';
|
||||
if ($Reflector->Stations[$i]->GetPeer() == $Reflector->GetReflectorName()) {
|
||||
echo trim($Reflector->GetModuleOfNode($Reflector->Stations[$i]->GetVia()));
|
||||
}
|
||||
echo '</td>
|
||||
$ShowThisStation = true;
|
||||
if ($PageOptions['UserPage']['ShowFilter']) {
|
||||
$CS = true;
|
||||
if ($_SESSION['FilterCallSign'] != null) {
|
||||
if (!fnmatch($_SESSION['FilterCallSign'], $Reflector->Stations[$i]->GetCallSign(), FNM_CASEFOLD)) {
|
||||
$CS = false;
|
||||
}
|
||||
}
|
||||
$MO = true;
|
||||
if ($_SESSION['FilterModule'] != null) {
|
||||
if (trim(strtolower($_SESSION['FilterModule'])) != strtolower($Reflector->Stations[$i]->GetModule())) {
|
||||
$MO = false;
|
||||
}
|
||||
}
|
||||
|
||||
$ShowThisStation = ($CS && $MO);
|
||||
}
|
||||
|
||||
if ($ShowThisStation) {
|
||||
|
||||
echo '
|
||||
<tr class="table-center">
|
||||
<td>';
|
||||
if ($i == 0 && $Reflector->Stations[$i]->GetLastHeardTime() > (time() - 60)) {
|
||||
echo '<img src="./img/tx.gif" style="margin-top:3px;" height="20"/>';
|
||||
} else {
|
||||
echo($i + 1);
|
||||
}
|
||||
|
||||
|
||||
echo '</td>
|
||||
<td>';
|
||||
|
||||
list ($Flag, $Name) = $Reflector->GetFlag($Reflector->Stations[$i]->GetCallSign());
|
||||
if (file_exists("./img/flags/" . $Flag . ".png")) {
|
||||
echo '<a href="#" class="tip"><img src="./img/flags/' . $Flag . '.png" class="table-flag" alt="' . $Name . '"><span>' . $Name . '</span></a>';
|
||||
}
|
||||
echo '</td>
|
||||
<td><a href="https://www.qrz.com/db/' . $Reflector->Stations[$i]->GetCallsignOnly() . '" class="pl" target="_blank">' . $Reflector->Stations[$i]->GetCallsignOnly() . '</a></td>
|
||||
<td>' . $Reflector->Stations[$i]->GetSuffix() . '</td>
|
||||
<td><a href="http://www.aprs.fi/' . $Reflector->Stations[$i]->GetCallsignOnly() . '" class="pl" target="_blank"><img src="./img/sat.png" alt=""></a></td>
|
||||
<td>' . $Reflector->Stations[$i]->GetVia();
|
||||
if ($Reflector->Stations[$i]->GetPeer() != $Reflector->GetReflectorName()) {
|
||||
echo ' / ' . $Reflector->Stations[$i]->GetPeer();
|
||||
}
|
||||
echo '</td>
|
||||
<td>' . @date("d.m.Y H:i", $Reflector->Stations[$i]->GetLastHeardTime()) . '</td>
|
||||
<td>' . $Reflector->Stations[$i]->GetModule() . '</td>
|
||||
</tr>';
|
||||
if ($i == 39) { $i = $Reflector->StationCount()+1; }
|
||||
}
|
||||
if ($i == $PageOptions['LastHeardPage']['LimitTo']) {
|
||||
$i = $Reflector->StationCount() + 1;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -56,11 +159,16 @@ for ($i=0;$i<$Reflector->StationCount();$i++) {
|
||||
<?php
|
||||
|
||||
$Modules = $Reflector->GetModules();
|
||||
sort($Modules, SORT_STRING);
|
||||
echo '<tr>';
|
||||
for ($i=0;$i<count($Modules);$i++) {
|
||||
|
||||
if (isset($PageOptions['ModuleNames'][$Modules[$i]])) {
|
||||
echo '<th>'.$PageOptions['ModuleNames'][$Modules[$i]].' '.$Modules[$i].'</th>';
|
||||
echo '<th>'.$PageOptions['ModuleNames'][$Modules[$i]];
|
||||
if (trim($PageOptions['ModuleNames'][$Modules[$i]]) != "") {
|
||||
echo '<br />';
|
||||
}
|
||||
echo $Modules[$i].'</th>';
|
||||
}
|
||||
else {
|
||||
echo '
|
||||
@ -71,20 +179,17 @@ for ($i=0;$i<count($Modules);$i++) {
|
||||
|
||||
echo '</tr><tr>';
|
||||
|
||||
$GlobalPositions = array();
|
||||
|
||||
for ($i=0;$i<count($Modules);$i++) {
|
||||
|
||||
$Users = $Reflector->GetCallSignsInModules($Modules[$i]);
|
||||
$Users = $Reflector->GetNodesInModulesByID($Modules[$i]);
|
||||
echo '<td><table class="table table-hover">';
|
||||
|
||||
$UserCheckedArray = array();
|
||||
|
||||
for ($j=0;$j<count($Users);$j++) {
|
||||
if (in_array($Users[$j], $UserCheckedArray)) {
|
||||
$CurrentPositions = array_keys($UserCheckedArray,$Users[$j]);
|
||||
$Displayname = $Users[$j].'-'.$Reflector->GetSuffixOfRepeater($Users[$j], $Modules[$i], max($CurrentPositions)+1);
|
||||
}
|
||||
else {
|
||||
$Displayname = $Users[$j].'-'.$Reflector->GetSuffixOfRepeater($Users[$j], $Modules[$i]);
|
||||
}
|
||||
$Displayname = $Reflector->GetCallsignAndSuffixByID($Users[$j]);
|
||||
echo '
|
||||
<tr>
|
||||
<td><a href="http://www.aprs.fi/'.$Displayname.'" class="pl" target="_blank">'.$Displayname.'</a> </td>
|
||||
@ -99,4 +204,4 @@ echo '</tr>';
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user