2016-01-01 07:42:52 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$FILE = "/var/log/xlxd.xml";
|
2016-02-04 06:21:42 -05:00
|
|
|
$PID = "/var/log/xlxd.pid";
|
2016-01-01 07:42:52 -05:00
|
|
|
|
2016-03-04 04:57:08 -05:00
|
|
|
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."); }
|
|
|
|
|
2016-01-01 07:42:52 -05:00
|
|
|
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");
|
2016-02-11 12:51:12 -05:00
|
|
|
if (!class_exists('Peer')) require_once("./pgs/class.peer.php");
|
2016-01-01 07:42:52 -05:00
|
|
|
|
|
|
|
if (!@file_exists($FILE) && (!@is_readable($FILE))) die("xlxd.xml does not exist or is not readable");
|
|
|
|
|
|
|
|
$handle = fopen($FILE, 'r');
|
|
|
|
$FILECONTENT = fread($handle, filesize($FILE));
|
|
|
|
fclose($handle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$XML = new ParseXML();
|
|
|
|
$Reflector = new xReflector();
|
|
|
|
$Reflector->SetFlagFile("./pgs/country.csv");
|
|
|
|
|
|
|
|
$ServiceName = substr($FILECONTENT, strpos($FILECONTENT, "<XLX")+4, 3);
|
2016-02-18 13:50:03 -05:00
|
|
|
if (is_numeric($ServiceName)) {
|
2016-02-11 12:51:12 -05:00
|
|
|
$LinkedPeersName = "XLX".$ServiceName." linked peers";
|
2016-01-01 07:42:52 -05:00
|
|
|
$LinkedNodesName = "XLX".$ServiceName." linked nodes";
|
|
|
|
$LinkedUsersName = "XLX".$ServiceName." heard users";
|
|
|
|
}
|
|
|
|
|
|
|
|
$AllNodesString = $XML->GetElement($FILECONTENT, $LinkedNodesName);
|
|
|
|
$tmpNodes = $XML->GetAllElements($AllNodesString, "NODE");
|
|
|
|
|
2016-01-27 09:56:41 -05:00
|
|
|
for ($i=0;$i<count($tmpNodes);$i++) {
|
2016-01-01 07:42:52 -05:00
|
|
|
$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'));
|
|
|
|
$Reflector->AddNode($Node);
|
2016-01-27 09:56:41 -05:00
|
|
|
}
|
2016-01-01 07:42:52 -05:00
|
|
|
|
|
|
|
$AllStationsString = $XML->GetElement($FILECONTENT, $LinkedUsersName);
|
|
|
|
$tmpStations = $XML->GetAllElements($AllStationsString, "STATION");
|
|
|
|
|
|
|
|
for ($i=0;$i<count($tmpStations);$i++) {
|
2016-02-11 12:51:12 -05:00
|
|
|
$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'));
|
2016-01-01 07:42:52 -05:00
|
|
|
$Reflector->AddStation($Station, false);
|
|
|
|
}
|
|
|
|
|
2016-02-11 12:51:12 -05:00
|
|
|
$AllPeersString = $XML->GetElement($FILECONTENT, $LinkedPeersName);
|
|
|
|
$tmpPeers = $XML->GetAllElements($AllPeersString, "PEER");
|
|
|
|
for ($i=0;$i<count($tmpPeers);$i++) {
|
|
|
|
$Peer = new Peer($XML->GetElement($tmpPeers[$i], 'Callsign'), $XML->GetElement($tmpPeers[$i], 'IP'), $XML->GetElement($tmpPeers[$i], 'LinkedModule'), $XML->GetElement($tmpPeers[$i], 'Protocol'), $XML->GetElement($tmpPeers[$i], 'ConnectTime'), $XML->GetElement($tmpPeers[$i], 'LastHeardTime'));
|
|
|
|
$Reflector->AddPeer($Peer, false);
|
|
|
|
}
|
2016-01-01 07:42:52 -05:00
|
|
|
|
|
|
|
?><!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
|
|
<title>XLX Reflector Dashboard</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href="./css/layout.css">
|
2016-03-04 04:57:08 -05:00
|
|
|
<link rel="icon" href="./favicon.ico" type="image/vnd.microsoft.icon"><?php
|
|
|
|
|
|
|
|
if ($PageOptions['PageRefreshActive']) {
|
|
|
|
echo '
|
2016-01-01 07:42:52 -05:00
|
|
|
<script>
|
2016-01-27 09:56:41 -05:00
|
|
|
|
2016-01-01 07:42:52 -05:00
|
|
|
function ReloadPage() {
|
2016-03-04 04:57:08 -05:00
|
|
|
document.location.href = "./index.php';
|
|
|
|
if (isset($_GET['show'])) {
|
|
|
|
echo '?show='.$_GET['show'];
|
|
|
|
}
|
|
|
|
echo '";
|
|
|
|
}';
|
|
|
|
|
|
|
|
if (!isset($_GET['show']) || (($_GET['show'] != 'liveircddb') && ($_GET['show'] != 'liveccs'))) {
|
2016-01-01 07:42:52 -05:00
|
|
|
echo '
|
2016-03-04 04:57:08 -05:00
|
|
|
setTimeout(ReloadPage, '.$PageOptions['PageRefreshDelay'].');';
|
|
|
|
}
|
|
|
|
echo '
|
|
|
|
|
|
|
|
</script>';
|
|
|
|
}
|
|
|
|
?>
|
2016-01-01 07:42:52 -05:00
|
|
|
</head>
|
|
|
|
<body>
|
2016-02-11 12:51:12 -05:00
|
|
|
<div id="top"><img src="./img/header.jpg" alt="XLX Multiprotocol Gateway Reflector" style="margin-top:15px;" />
|
2016-03-04 04:57:08 -05:00
|
|
|
<br /> XLX<?php echo $ServiceName; ?> v<?php echo $XML->GetElement($FILECONTENT, "Version"); ?> - Dashboard v<?php echo $PageOptions['DashboardVersion']; ?> / Service uptime: <?php
|
2016-02-11 12:51:12 -05:00
|
|
|
if (file_exists($PID) && is_readable($PID)) {
|
|
|
|
echo FormatSeconds(time()-filectime($PID));
|
|
|
|
}
|
|
|
|
?></div>
|
2016-01-01 07:42:52 -05:00
|
|
|
<div id="menubar">
|
|
|
|
<div id="menu">
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
2016-02-11 12:51:12 -05:00
|
|
|
<td><a href="./index.php" class="menulink">Users / Modules</a></td><td><a href="./index.php?show=repeaters" class="menulink">Repeaters / Nodes (<?php echo $Reflector->NodeCount(); ?>)</a></td><td><a href="./index.php?show=peers" class="menulink">Peers (<?php echo $Reflector->PeerCount(); ?>)</a></td><td><a href="./index.php?show=liveircddb" class="menulink">D-Star live</a></td><td><a href="./index.php?show=liveccs" class="menulink">CCS live</a></td>
|
2016-01-01 07:42:52 -05:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="content" align="center">
|
2016-01-27 09:56:41 -05:00
|
|
|
|
2016-01-01 07:42:52 -05:00
|
|
|
<?php
|
|
|
|
if (!isset($_GET['show'])) $_GET['show'] = "";
|
|
|
|
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 'liveccs' : require_once("./pgs/liveccs.php"); break;
|
2016-02-11 12:51:12 -05:00
|
|
|
case 'peers' : require_once("./pgs/peers.php"); break;
|
2016-01-01 07:42:52 -05:00
|
|
|
default : require_once("./pgs/users.php");
|
|
|
|
}
|
|
|
|
|
2016-01-27 09:56:41 -05:00
|
|
|
?>
|
|
|
|
|
2016-03-04 04:57:08 -05:00
|
|
|
<div style="width:100%;text-align:center;margin-top:50px;"><a href="mailto:<?php echo $PageOptions['ContactEmail']; ?>" style="font-family:verdana;color:#000000;font-size:12pt;text-decoration:none;"><?php echo $PageOptions['ContactEmail']; ?></a></div>
|
2016-01-27 09:56:41 -05:00
|
|
|
|
2016-01-01 07:42:52 -05:00
|
|
|
</div>
|
2016-01-27 09:56:41 -05:00
|
|
|
|
|
|
|
|
2016-01-01 07:42:52 -05:00
|
|
|
</body>
|
|
|
|
</html>
|