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

Merge pull request #106 from narspt/patch-4

dashboard performance enhancement
This commit is contained in:
LX1IQ 2018-10-14 07:46:43 +02:00 committed by GitHub
commit 02a6bf07a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 36 deletions

View File

@ -6,6 +6,7 @@ class xReflector {
public $Stations = null; public $Stations = null;
public $Peers = null; public $Peers = null;
private $Flagarray = null; private $Flagarray = null;
private $Flagarray_DXCC = null;
private $Flagfile = null; private $Flagfile = null;
private $CallingHomeActive = null; private $CallingHomeActive = null;
private $CallingHomeHash = null; private $CallingHomeHash = null;
@ -125,6 +126,7 @@ class xReflector {
public function LoadFlags() { public function LoadFlags() {
if ($this->Flagfile != null) { if ($this->Flagfile != null) {
$this->Flagarray = array(); $this->Flagarray = array();
$this->Flagarray_DXCC = array();
$handle = fopen($this->Flagfile,"r"); $handle = fopen($this->Flagfile,"r");
if ($handle) { if ($handle) {
$i = 0; $i = 0;
@ -134,11 +136,12 @@ class xReflector {
if (isset($tmp[0])) { $this->Flagarray[$i]['Country'] = $tmp[0]; } else { $this->Flagarray[$i]['Country'] = 'Undefined'; } 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"; } if (isset($tmp[1])) { $this->Flagarray[$i]['ISO'] = $tmp[1]; } else { $this->Flagarray[$i]['ISO'] = "Undefined"; }
$this->Flagarray[$i]['DXCC'] = array(); //$this->Flagarray[$i]['DXCC'] = array();
if (isset($tmp[2])) { if (isset($tmp[2])) {
$tmp2 = explode("-", $tmp[2]); $tmp2 = explode("-", $tmp[2]);
for ($j=0;$j<count($tmp2);$j++) { for ($j=0;$j<count($tmp2);$j++) {
$this->Flagarray[$i]['DXCC'][] = $tmp2[$j]; //$this->Flagarray[$i]['DXCC'][] = $tmp2[$j];
$this->Flagarray_DXCC[ trim($tmp2[$j]) ] = $i;
} }
} }
$i++; $i++;
@ -256,24 +259,14 @@ class xReflector {
public function GetFlag($Callsign) { public function GetFlag($Callsign) {
$Image = ""; $Image = "";
$FoundFlag = false;
$Letters = 4; $Letters = 4;
$Name = ""; $Name = "";
while (($Letters >= 2) && (!$FoundFlag)) { while ($Letters >= 2) {
$j = 0; $Prefix = substr(trim($Callsign), 0, $Letters);
$Prefix = substr($Callsign, 0, $Letters); if (isset($this->Flagarray_DXCC[$Prefix])) {
while (($j < count($this->Flagarray)) && (!$FoundFlag)) { $Image = $this->Flagarray[ $this->Flagarray_DXCC[$Prefix] ]['ISO'];
$Name = $this->Flagarray[ $this->Flagarray_DXCC[$Prefix] ]['Country'];
$z = 0; break;
while (($z < count($this->Flagarray[$j]['DXCC'])) && (!$FoundFlag)) {
if (trim($Prefix) == trim($this->Flagarray[$j]['DXCC'][$z])) {
$Image = $this->Flagarray[$j]['ISO'];
$Name = $this->Flagarray[$j]['Country'];
$FoundFlag = true;
}
$z++;
}
$j++;
} }
$Letters--; $Letters--;
} }

View File

@ -6,6 +6,7 @@ class xReflector {
public $Stations = null; public $Stations = null;
public $Peers = null; public $Peers = null;
private $Flagarray = null; private $Flagarray = null;
private $Flagarray_DXCC = null;
private $Flagfile = null; private $Flagfile = null;
private $CallingHomeActive = null; private $CallingHomeActive = null;
private $CallingHomeHash = null; private $CallingHomeHash = null;
@ -125,6 +126,7 @@ class xReflector {
public function LoadFlags() { public function LoadFlags() {
if ($this->Flagfile != null) { if ($this->Flagfile != null) {
$this->Flagarray = array(); $this->Flagarray = array();
$this->Flagarray_DXCC = array();
$handle = fopen($this->Flagfile,"r"); $handle = fopen($this->Flagfile,"r");
if ($handle) { if ($handle) {
$i = 0; $i = 0;
@ -134,11 +136,12 @@ class xReflector {
if (isset($tmp[0])) { $this->Flagarray[$i]['Country'] = $tmp[0]; } else { $this->Flagarray[$i]['Country'] = 'Undefined'; } 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"; } if (isset($tmp[1])) { $this->Flagarray[$i]['ISO'] = $tmp[1]; } else { $this->Flagarray[$i]['ISO'] = "Undefined"; }
$this->Flagarray[$i]['DXCC'] = array(); //$this->Flagarray[$i]['DXCC'] = array();
if (isset($tmp[2])) { if (isset($tmp[2])) {
$tmp2 = explode("-", $tmp[2]); $tmp2 = explode("-", $tmp[2]);
for ($j=0;$j<count($tmp2);$j++) { for ($j=0;$j<count($tmp2);$j++) {
$this->Flagarray[$i]['DXCC'][] = $tmp2[$j]; //$this->Flagarray[$i]['DXCC'][] = $tmp2[$j];
$this->Flagarray_DXCC[ trim($tmp2[$j]) ] = $i;
} }
} }
$i++; $i++;
@ -256,24 +259,14 @@ class xReflector {
public function GetFlag($Callsign) { public function GetFlag($Callsign) {
$Image = ""; $Image = "";
$FoundFlag = false;
$Letters = 4; $Letters = 4;
$Name = ""; $Name = "";
while (($Letters >= 2) && (!$FoundFlag)) { while ($Letters >= 2) {
$j = 0; $Prefix = substr(trim($Callsign), 0, $Letters);
$Prefix = substr($Callsign, 0, $Letters); if (isset($this->Flagarray_DXCC[$Prefix])) {
while (($j < count($this->Flagarray)) && (!$FoundFlag)) { $Image = $this->Flagarray[ $this->Flagarray_DXCC[$Prefix] ]['ISO'];
$Name = $this->Flagarray[ $this->Flagarray_DXCC[$Prefix] ]['Country'];
$z = 0; break;
while (($z < count($this->Flagarray[$j]['DXCC'])) && (!$FoundFlag)) {
if (trim($Prefix) == trim($this->Flagarray[$j]['DXCC'][$z])) {
$Image = $this->Flagarray[$j]['ISO'];
$Name = $this->Flagarray[$j]['Country'];
$FoundFlag = true;
}
$z++;
}
$j++;
} }
$Letters--; $Letters--;
} }