From d6eecca9d942b49e9afb0f0aed190bff1fa7c613 Mon Sep 17 00:00:00 2001 From: LX3JL Date: Wed, 27 Jan 2016 15:56:41 +0100 Subject: [PATCH] extra callsign checking The dashboard filter out log entries with callsigns with less than 3 characters --- dashboard/index.php | 48 +++++------------ dashboard/pgs/class.reflector.php | 86 ++++++++++++------------------- 2 files changed, 46 insertions(+), 88 deletions(-) mode change 100755 => 100644 dashboard/index.php mode change 100755 => 100644 dashboard/pgs/class.reflector.php diff --git a/dashboard/index.php b/dashboard/index.php old mode 100755 new mode 100644 index cd007a7..927286e --- a/dashboard/index.php +++ b/dashboard/index.php @@ -1,26 +1,4 @@ . -// ---------------------------------------------------------------------------- $FILE = "/var/log/xlxd.xml"; @@ -55,10 +33,10 @@ if (intval($ServiceName) !== 0) { $AllNodesString = $XML->GetElement($FILECONTENT, $LinkedNodesName); $tmpNodes = $XML->GetAllElements($AllNodesString, "NODE"); -for ($i=0;$iGetElement($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); -} +} $AllStationsString = $XML->GetElement($FILECONTENT, $LinkedUsersName); $tmpStations = $XML->GetAllElements($AllStationsString, "STATION"); @@ -78,18 +56,18 @@ for ($i=0;$i @@ -100,13 +78,13 @@ for ($i=0;$i Users / ModulesRepeaters / NodesD-Star liveCCS live - + -
 
XLX vGetElement($FILECONTENT, "Version"); ?> - Dashboard v2.0.4  
+
 
XLX vGetElement($FILECONTENT, "Version"); ?> - Dashboard v2.0.5  
- + - +?> + - +
- - + + diff --git a/dashboard/pgs/class.reflector.php b/dashboard/pgs/class.reflector.php old mode 100755 new mode 100644 index 97da2d6..f64e8e9 --- a/dashboard/pgs/class.reflector.php +++ b/dashboard/pgs/class.reflector.php @@ -1,39 +1,17 @@ . -// ---------------------------------------------------------------------------- class xReflector { - + public $Nodes = null; public $Stations = null; private $Flagarray = null; private $Flagfile = null; - + public function __construct() { $this->Nodes = array(); $this->Stations = array(); } - + public function SetFlagFile($Flagfile) { if (file_exists($Flagfile) && (is_readable($Flagfile))) { $this->Flagfile = $Flagfile; @@ -41,7 +19,7 @@ class xReflector { } return false; } - + public function LoadFlags() { if ($this->Flagfile != null) { $this->Flagarray = array(); @@ -51,17 +29,17 @@ class xReflector { while(!feof($handle)) { $row = fgets($handle,1024); $tmp = explode(";", $row); - + if (isset($tmp[0])) { $this->Flagarray[$i]['Country'] = $tmp[0]; } else { $this->Flagarray[$i]['Country'] = 'Undefined'; } if (isset($tmp[1])) { $this->Flagarray[$i]['ISO'] = $tmp[1]; } else { $this->Flagarray[$i]['ISO'] = "Undefined"; } $this->Flagarray[$i]['DXCC'] = array(); - if (isset($tmp[2])) { + if (isset($tmp[2])) { $tmp2 = explode("-", $tmp[2]); for ($j=0;$jFlagarray[$i]['DXCC'][] = $tmp2[$j]; } } - $i++; + $i++; } fclose($handle); } @@ -69,17 +47,17 @@ class xReflector { } return false; } - + public function AddNode($NodeObject) { if (is_object($NodeObject)) { $this->Nodes[] = $NodeObject; } } - + public function NodeCount() { return count($this->Nodes); } - + public function GetNode($ArrayIndex) { if (isset($this->Nodes[$ArrayIndex])) { return $this->Nodes[$ArrayIndex]; @@ -89,41 +67,43 @@ class xReflector { public function AddStation($StationObject, $AllowDouble = false) { if (is_object($StationObject)) { - + if ($AllowDouble) { $this->Stations[] = $StationObject; } else { $FoundStationInList = false; $i = 0; - + $tmp = explode(" ", $StationObject->GetCallsign()); $RealCallsign = trim($tmp[0]); - + while (!$FoundStationInList && $i<$this->StationCount()) { if ($this->Stations[$i]->GetCallsignOnly() == $RealCallsign) { $FoundStationInList = true; } $i++; } - + if (!$FoundStationInList) { - $this->Stations[] = $StationObject; + if (strlen(trim($RealCallsign)) > 3) { + $this->Stations[] = $StationObject; + } } - + } } } - + public function GetSuffixOfRepeater($Repeater) { $suffix = ""; $found = false; $i = 0; while (!$found && $i < $this->NodeCount()) { - + if (strpos($this->Nodes[$i]->GetCallSign(), $Repeater) !== false) { - - + + $suffix = $this->Nodes[$i]->GetSuffix(); $found = true; } @@ -131,18 +111,18 @@ class xReflector { } return $suffix; } - + public function StationCount() { return count($this->Stations); } - + public function GetStation($ArrayIndex) { if (isset($this->Stations[$ArrayIndex])) { return $this->Stations[$ArrayIndex]; } return false; } - + public function GetFlag($Callsign) { $Image = ""; $FoundFlag = false; @@ -151,7 +131,7 @@ class xReflector { $j = 0; $Prefix = substr($Callsign, 0, $Letters); while (($j < count($this->Flagarray)) && (!$FoundFlag)) { - + $z = 0; while (($z < count($this->Flagarray[$j]['DXCC'])) && (!$FoundFlag)) { if (trim($Prefix) == trim($this->Flagarray[$j]['DXCC'][$z])) { @@ -164,9 +144,9 @@ class xReflector { } $Letters++; } - + if (!$FoundFlag) { - $Prefix = substr($Callsign, 0, 1); + $Prefix = substr($Callsign, 0, 1); if ($Prefix == 'N') { $Image = "us"; } if ($Prefix == 'K') { $Image = "us"; } if ($Prefix == 'W') { $Image = "us"; } @@ -176,7 +156,7 @@ class xReflector { } return strtolower($Image); } - + public function GetModules() { $out = array(); for ($i=0;$i<$this->NodeCount();$i++) { @@ -194,17 +174,17 @@ class xReflector { } return $out; } - + public function GetCallSignsInModules($Module) { $out = array(); for ($i=0;$i<$this->NodeCount();$i++) { if ($this->Nodes[$i]->GetLinkedModule() == $Module) { $out[] = $this->Nodes[$i]->GetCallsign(); - } + } } return $out; } - + } -?> +?> \ No newline at end of file