1
0
mirror of https://github.com/ShaYmez/xlxd.git synced 2025-06-17 04:52:25 -04:00

Merge pull request #47 from lamaral/db2-update

Dashboard 2 updates for xlxd 2.x.x
This commit is contained in:
LX1IQ 2017-08-29 19:41:28 +02:00 committed by GitHub
commit 6633a59a22
9 changed files with 404 additions and 214 deletions

View File

@ -6,8 +6,16 @@
* The dashboard is based of the Bootstrap dashboard template. * 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/functions.php")) {
if (file_exists("./pgs/config.inc.php")) { require_once("./pgs/config.inc.php"); } else { die("config.inc.php does not exist."); } 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('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");
@ -29,26 +37,25 @@ if ($CallingHome['Active']) {
if (!file_exists($CallingHome['HashFile'])) { if (!file_exists($CallingHome['HashFile'])) {
$Hash = CreateCode(16); $Hash = CreateCode(16);
$LastSync = 0; $LastSync = 0;
$Ressource = @fopen($CallingHome['HashFile'],"w"); $Ressource = @fopen($CallingHome['HashFile'], "w");
if ($Ressource) { if ($Ressource) {
@fwrite($Ressource, "<?php\n"); @fwrite($Ressource, "<?php\n");
@fwrite($Ressource, "\n".'$LastSync = 0;'); @fwrite($Ressource, "\n" . '$LastSync = 0;');
@fwrite($Ressource, "\n".'$Hash = "'.$Hash.'";'); @fwrite($Ressource, "\n" . '$Hash = "' . $Hash . '";');
@fwrite($Ressource, "\n\n".'?>'); @fwrite($Ressource, "\n\n" . '?>');
@fclose($Ressource); @fclose($Ressource);
@exec("chmod 777 ".$CallingHome['HashFile']); @exec("chmod 777 " . $CallingHome['HashFile']);
$CallHomeNow = true; $CallHomeNow = true;
} }
} } else {
else {
include($CallingHome['HashFile']); include($CallingHome['HashFile']);
if ($LastSync < (time() - $CallingHome['PushDelay'])) { if ($LastSync < (time() - $CallingHome['PushDelay'])) {
$Ressource = @fopen($CallingHome['HashFile'],"w"); $Ressource = @fopen($CallingHome['HashFile'], "w");
if ($Ressource) { if ($Ressource) {
@fwrite($Ressource, "<?php\n"); @fwrite($Ressource, "<?php\n");
@fwrite($Ressource, "\n".'$LastSync = '.time().';'); @fwrite($Ressource, "\n" . '$LastSync = ' . time() . ';');
@fwrite($Ressource, "\n".'$Hash = "'.$Hash.'";'); @fwrite($Ressource, "\n" . '$Hash = "' . $Hash . '";');
@fwrite($Ressource, "\n\n".'?>'); @fwrite($Ressource, "\n\n" . '?>');
@fclose($Ressource); @fclose($Ressource);
} }
$CallHomeNow = true; $CallHomeNow = true;
@ -62,25 +69,25 @@ if ($CallingHome['Active']) {
$Reflector->PrepareReflectorXML(); $Reflector->PrepareReflectorXML();
$Reflector->CallHome(); $Reflector->CallHome();
} }
} } else {
else {
$Hash = ""; $Hash = "";
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<?php echo $PageOptions['MetaDescription']; ?>" /> <meta name="description" content="<?php echo $PageOptions['MetaDescription']; ?>"/>
<meta name="keywords" content="<?php echo $PageOptions['MetaKeywords']; ?>" /> <meta name="keywords" content="<?php echo $PageOptions['MetaKeywords']; ?>"/>
<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']; ?>"/>
<link rel="icon" href="./favicon.ico" type="image/vnd.microsoft.icon"> <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="icon" href="./favicon.ico" type="image/vnd.microsoft.icon">
<!-- Bootstrap core CSS --> <!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/bootstrap.min.css" rel="stylesheet">
@ -104,28 +111,31 @@ else {
function ReloadPage() { function ReloadPage() {
document.location.href = "./index.php'; document.location.href = "./index.php';
if (isset($_GET['show'])) { if (isset($_GET['show'])) {
echo '?show='.$_GET['show']; echo '?show=' . $_GET['show'];
} }
echo '"; echo '";
}'; }';
if (!isset($_GET['show']) || (($_GET['show'] != 'liveircddb') && ($_GET['show'] != 'reflectors') && ($_GET['show'] != 'interlinks'))) { if (!isset($_GET['show']) || (($_GET['show'] != 'liveircddb') && ($_GET['show'] != 'reflectors') && ($_GET['show'] != 'interlinks'))) {
echo ' echo '
setTimeout(ReloadPage, '.$PageOptions['PageRefreshDelay'].');'; setTimeout(ReloadPage, ' . $PageOptions['PageRefreshDelay'] . ');';
} }
echo ' echo '
</script>'; </script>';
} }
if (!isset($_GET['show'])) $_GET['show'] = ""; if (!isset($_GET['show'])) $_GET['show'] = "";
?> ?>
</head> </head>
<body> <body>
<?php if (file_exists("./tracking.php")) { include_once("tracking.php"); }?> <?php if (file_exists("./tracking.php")) {
<nav class="navbar navbar-inverse navbar-fixed-top"> include_once("tracking.php");
} ?>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid"> <div class="container-fluid">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <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="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
@ -135,64 +145,84 @@ else {
</div> </div>
<div id="navbar" class="navbar-collapse collapse"> <div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right"> <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"><?php echo $Reflector->GetVersion(); ?> - Dashboard
<li class="navbar-info">Service uptime: <?php echo FormatSeconds($Reflector->GetServiceUptime()); ?></li> v<?php echo $PageOptions['DashboardVersion']; ?></li>
<li class="navbar-info">Service
uptime: <?php echo FormatSeconds($Reflector->GetServiceUptime()); ?></li>
</ul> </ul>
</div> </div>
</div> </div>
</nav> </nav>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-sm-3 col-md-2 sidebar"> <div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-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'] == "users") || ($_GET['show'] == "")) ? ' class="active"' : ''; ?>><a
<li<?php echo ($_GET['show'] == "repeaters") ? ' class="active"' : ''; ?>><a href="./index.php?show=repeaters">Repeaters / Nodes (<?php echo $Reflector->NodeCount(); ?>)</a></li> href="./index.php">Users / Modules</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'] == "repeaters") ? ' class="active"' : ''; ?>><a
<li<?php echo ($_GET['show'] == "reflectors") ? ' class="active"' : ''; ?>><a href="./index.php?show=reflectors">Reflectorlist</a></li> href="./index.php?show=repeaters">Repeaters / Nodes (<?php echo $Reflector->NodeCount(); ?>
<li<?php echo ($_GET['show'] == "liveircddb") ? ' class="active"' : ''; ?>><a href="./index.php?show=liveircddb">D-Star live</a></li> )</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>
</div> </div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<?php <?php
if ($CallingHome['Active']) { if ($CallingHome['Active']) {
if (!is_readable($CallingHome['HashFile']) && (!is_writeable($CallingHome['HashFile']))) { if (!is_readable($CallingHome['HashFile']) && (!is_writeable($CallingHome['HashFile']))) {
echo ' echo '
<div class="error"> <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>'; </div>';
} }
} }
switch ($_GET['show']) { switch ($_GET['show']) {
case 'users' : require_once("./pgs/users.php"); break; case 'users' :
case 'repeaters' : require_once("./pgs/repeaters.php"); break; require_once("./pgs/users.php");
case 'liveircddb' : require_once("./pgs/liveircddb.php"); break; break;
case 'peers' : require_once("./pgs/peers.php"); break; case 'repeaters' :
case 'reflectors' : require_once("./pgs/reflectors.php"); break; require_once("./pgs/repeaters.php");
default : require_once("./pgs/users.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> </div>
<footer class="footer"> <footer class="footer">
<div class="container"> <div class="container">
<p><a href="mailto:<?php echo $PageOptions['ContactEmail']; ?>"><?php echo $PageOptions['ContactEmail']; ?></a></p> <p><a href="mailto:<?php echo $PageOptions['ContactEmail']; ?>"><?php echo $PageOptions['ContactEmail']; ?></a>
</p>
</div> </div>
</footer> </footer>
<!-- Bootstrap core JavaScript <!-- Bootstrap core JavaScript
================================================== --> ================================================== -->
<!-- Placed at the end of the document so the pages load faster --> <!-- 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 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>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="js/bootstrap.min.js"></script> <script src="js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="js/ie10-viewport-bug-workaround.js"></script> <script src="js/ie10-viewport-bug-workaround.js"></script>
</body> </body>
</html> </html>

View File

@ -10,8 +10,9 @@ class Node {
private $LastHeardTime; private $LastHeardTime;
private $Suffix; private $Suffix;
private $Prefix; 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; $this->IP = $IP;
@ -34,8 +35,8 @@ class Node {
$this->Prefix = ""; $this->Prefix = "";
} }
$this->LinkedModule = trim($LinkedModule); $this->LinkedModule = trim($LinkedModule);
$this->RandomID = $RandomID;
} }
public function GetFullCallsign() { return $this->FullCallsign; } public function GetFullCallsign() { return $this->FullCallsign; }
@ -47,6 +48,8 @@ class Node {
public function GetLastHeardTime() { return $this->LastHeardTime; } public function GetLastHeardTime() { return $this->LastHeardTime; }
public function GetSuffix() { return $this->Suffix; } public function GetSuffix() { return $this->Suffix; }
public function GetPrefix() { return $this->Prefix; } public function GetPrefix() { return $this->Prefix; }
public function GetRandomID() { return $this->RandomID; }
} }
?> ?>

View File

@ -24,9 +24,6 @@ class ParseXML {
return $Elements; return $Elements;
} }
} }
?> ?>

View File

@ -59,14 +59,14 @@ class xReflector {
$tmpNodes = $XML->GetAllElements($AllNodesString, "NODE"); $tmpNodes = $XML->GetAllElements($AllNodesString, "NODE");
for ($i=0;$i<count($tmpNodes);$i++) { 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); $this->AddNode($Node);
} }
$AllStationsString = $XML->GetElement($this->XMLContent, $LinkedUsersName); $AllStationsString = $XML->GetElement($this->XMLContent, $LinkedUsersName);
$tmpStations = $XML->GetAllElements($AllStationsString, "STATION"); $tmpStations = $XML->GetAllElements($AllStationsString, "STATION");
for ($i=0;$i<count($tmpStations);$i++) { 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); $this->AddStation($Station, false);
} }
@ -230,6 +230,19 @@ class xReflector {
return $suffix; 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() { public function StationCount() {
return count($this->Stations); return count($this->Stations);
} }
@ -264,7 +277,6 @@ class xReflector {
} }
$Letters--; $Letters--;
} }
return array(strtolower($Image), $Name); return array(strtolower($Image), $Name);
} }
@ -287,6 +299,7 @@ class xReflector {
} }
public function GetModuleOfNode($Node) { public function GetModuleOfNode($Node) {
die("FUNCTION DEPRECATED...");
$Node = trim(str_replace(" ", "-", $Node)); $Node = trim(str_replace(" ", "-", $Node));
$Node = trim(str_replace(" ", "-", $Node)); $Node = trim(str_replace(" ", "-", $Node));
$Node = trim(str_replace(" ", "-", $Node)); $Node = trim(str_replace(" ", "-", $Node));
@ -314,6 +327,16 @@ class xReflector {
return $out; 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) { public function SetCallingHome($CallingHomeVariables, $Hash) {
if (!isset($CallingHomeVariables['Active'])) { $CallingHomeVariables['Active'] = false; } if (!isset($CallingHomeVariables['Active'])) { $CallingHomeVariables['Active'] = false; }
@ -345,11 +368,6 @@ class xReflector {
public function PushCallingHome() { 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"); $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() { public function ReadInterlinkFile() {
@ -402,6 +420,7 @@ class xReflector {
<country>'.$this->CallingHomeCountry.'</country> <country>'.$this->CallingHomeCountry.'</country>
<comment>'.$this->CallingHomeComment.'</comment> <comment>'.$this->CallingHomeComment.'</comment>
<ip>'.$this->CallingHomeOverrideIP.'</ip> <ip>'.$this->CallingHomeOverrideIP.'</ip>
<reflectorversion>'.$this->Version.'</reflectorversion>
</reflector>'; </reflector>';
} }

View File

@ -8,8 +8,9 @@ class Station {
private $Suffix; private $Suffix;
private $CallsignOnly; private $CallsignOnly;
private $Peer; private $Peer;
private $OnModule;
public function __construct($Callsign, $Via, $Peer, $LastHeardTime) { public function __construct($Callsign, $Via, $Peer, $LastHeardTime, $OnModule) {
$this->Callsign = trim($Callsign); $this->Callsign = trim($Callsign);
$this->Via = trim($Via); $this->Via = trim($Via);
$this->Peer = trim($Peer); $this->Peer = trim($Peer);
@ -23,6 +24,7 @@ class Station {
$tmp = explode(" ", $Callsign); $tmp = explode(" ", $Callsign);
$this->CallsignOnly = $tmp[0]; $this->CallsignOnly = $tmp[0];
$this->OnModule = $OnModule;
} }
public function GetCallsign() { return $this->Callsign; } public function GetCallsign() { return $this->Callsign; }
@ -31,6 +33,7 @@ class Station {
public function GetLastHeardTime() { return $this->LastHeardTime; } public function GetLastHeardTime() { return $this->LastHeardTime; }
public function GetSuffix() { return $this->Suffix; } public function GetSuffix() { return $this->Suffix; }
public function GetCallsignOnly() { return $this->CallsignOnly; } public function GetCallsignOnly() { return $this->CallsignOnly; }
public function GetModule() { return $this->OnModule; }
} }

View File

@ -16,7 +16,7 @@ $PageOptions = array();
$PageOptions['ContactEmail'] = 'your_email'; // Support E-Mail address $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['PageRefreshActive'] = true; // Activate automatic refresh
$PageOptions['PageRefreshDelay'] = '10000'; // Page refresh time in miliseconds $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']['IPModus'] = 'ShowFullIP'; // See possible options above
$PageOptions['PeerPage']['MasqueradeCharacter'] = '*'; // Character used for masquerade $PageOptions['PeerPage']['MasqueradeCharacter'] = '*'; // Character used for masquerade
$PageOptions['LastHeardPage']['LimitTo'] = 39; // Number of stations to show
$PageOptions['ModuleNames'] = array(); // Module nomination $PageOptions['ModuleNames'] = array(); // Module nomination
$PageOptions['ModuleNames']['A'] = 'Int.'; $PageOptions['ModuleNames']['A'] = 'Int.';
@ -47,7 +48,7 @@ $PageOptions['MetaAuthor'] = 'LX1IQ';
$PageOptions['MetaRevisit'] = 'After 30 Days'; // Meta Tag Values, usefull for Search Engine $PageOptions['MetaRevisit'] = 'After 30 Days'; // Meta Tag Values, usefull for Search Engine
$PageOptions['MetaRobots'] = 'index,follow'; // 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['PIDFile'] = '/var/log/xlxd.pid';
$Service['XMLFile'] = '/var/log/xlxd.xml'; $Service['XMLFile'] = '/var/log/xlxd.xml';

View File

@ -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"> <table class="table table-striped table-hover">
<tr class="table-center"> <tr class="table-center">
<th class="col-md-1">#</th> <th class="col-md-1">#</th>
@ -22,15 +42,28 @@ for ($i=0;$i<$Reflector->PeerCount();$i++) {
echo ' echo '
<tr class="table-center"> <tr class="table-center">
<td>'.($i+1).'</td> <td>'.($i+1).'</td>';
<td>'.$Reflector->Peers[$i]->GetCallSign().'</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&nbsp;'.$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>'.date("d.m.Y H:i", $Reflector->Peers[$i]->GetLastHeardTime()).'</td>
<td>'.FormatSeconds(time()-$Reflector->Peers[$i]->GetConnectTime()).' s</td> <td>'.FormatSeconds(time()-$Reflector->Peers[$i]->GetConnectTime()).' s</td>
<td>'.$Reflector->Peers[$i]->GetProtocol().'</td> <td>'.$Reflector->Peers[$i]->GetProtocol().'</td>
<td>'.$Reflector->Peers[$i]->GetLinkedModule().'</td>'; <td>'.$Reflector->Peers[$i]->GetLinkedModule().'</td>';
if ($PageOptions['PeerPage']['IPModus'] != 'HideIP') { if ($PageOptions['PeerPage']['IPModus'] != 'HideIP') {
echo ' echo '<td>';
<td>';
$Bytes = explode(".", $Reflector->Peers[$i]->GetIP()); $Bytes = explode(".", $Reflector->Peers[$i]->GetIP());
if ($Bytes !== false && count($Bytes) == 4) { if ($Bytes !== false && count($Bytes) == 4) {
switch ($PageOptions['PeerPage']['IPModus']) { switch ($PageOptions['PeerPage']['IPModus']) {
@ -42,8 +75,7 @@ for ($i=0;$i<$Reflector->PeerCount();$i++) {
} }
echo '</td>'; echo '</td>';
} }
echo ' echo '</tr>';
</tr>';
if ($i == $PageOptions['PeerPage']['LimitTo']) { $i = $Reflector->PeerCount()+1; } if ($i == $PageOptions['PeerPage']['LimitTo']) { $i = $Reflector->PeerCount()+1; }
} }

View File

@ -49,7 +49,7 @@ for ($i=0;$i<$Reflector->NodeCount();$i++) {
case 'C' : echo '2m'; break; case 'C' : echo '2m'; break;
case 'D' : echo 'Dongle'; break; case 'D' : echo 'Dongle'; break;
case 'G' : echo 'Internet-Gateway'; break; case 'G' : echo 'Internet-Gateway'; break;
default : default : echo '';
} }
} }
echo '</td> echo '</td>

View File

@ -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="row">
<div class="col-md-9"> <div class="col-md-9">
<table class="table table-striped table-hover"> <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"> <tr class="table-center">
<th class="col-md-1">#</th> <th class="col-md-1">#</th>
<th class="col-md-1">Flag</th> <th class="col-md-1">Flag</th>
@ -15,36 +95,59 @@
$Reflector->LoadFlags(); $Reflector->LoadFlags();
for ($i=0;$i<$Reflector->StationCount();$i++) { for ($i=0;$i<$Reflector->StationCount();$i++) {
$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 ' echo '
<tr class="table-center"> <tr class="table-center">
<td>'; <td>';
echo ($i==0 ? '<img src="./img/radio-waves-hi.png" alt="">' : $i+1); 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> echo '</td>
<td>'; <td>';
list ($Flag, $Name) = $Reflector->GetFlag($Reflector->Stations[$i]->GetCallSign()); list ($Flag, $Name) = $Reflector->GetFlag($Reflector->Stations[$i]->GetCallSign());
if (file_exists("./img/flags/".$Flag.".png")) { 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 '<a href="#" class="tip"><img src="./img/flags/' . $Flag . '.png" class="table-flag" alt="' . $Name . '"><span>' . $Name . '</span></a>';
} }
echo '</td> 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><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>' . $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><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(); <td>' . $Reflector->Stations[$i]->GetVia();
if ($Reflector->Stations[$i]->GetPeer() != $Reflector->GetReflectorName()) { if ($Reflector->Stations[$i]->GetPeer() != $Reflector->GetReflectorName()) {
echo ' / '.$Reflector->Stations[$i]->GetPeer(); 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> echo '</td>
<td>' . @date("d.m.Y H:i", $Reflector->Stations[$i]->GetLastHeardTime()) . '</td>
<td>' . $Reflector->Stations[$i]->GetModule() . '</td>
</tr>'; </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 <?php
$Modules = $Reflector->GetModules(); $Modules = $Reflector->GetModules();
sort($Modules, SORT_STRING);
echo '<tr>'; echo '<tr>';
for ($i=0;$i<count($Modules);$i++) { for ($i=0;$i<count($Modules);$i++) {
if (isset($PageOptions['ModuleNames'][$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 { else {
echo ' echo '
@ -71,20 +179,17 @@ for ($i=0;$i<count($Modules);$i++) {
echo '</tr><tr>'; echo '</tr><tr>';
$GlobalPositions = array();
for ($i=0;$i<count($Modules);$i++) { for ($i=0;$i<count($Modules);$i++) {
$Users = $Reflector->GetCallSignsInModules($Modules[$i]); $Users = $Reflector->GetNodesInModulesByID($Modules[$i]);
echo '<td><table class="table table-hover">'; echo '<td><table class="table table-hover">';
$UserCheckedArray = array(); $UserCheckedArray = array();
for ($j=0;$j<count($Users);$j++) { for ($j=0;$j<count($Users);$j++) {
if (in_array($Users[$j], $UserCheckedArray)) { $Displayname = $Reflector->GetCallsignAndSuffixByID($Users[$j]);
$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]);
}
echo ' echo '
<tr> <tr>
<td><a href="http://www.aprs.fi/'.$Displayname.'" class="pl" target="_blank">'.$Displayname.'</a> </td> <td><a href="http://www.aprs.fi/'.$Displayname.'" class="pl" target="_blank">'.$Displayname.'</a> </td>