From d21620d441e5dc3597abc5446e060c40f10cd87c Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 10 Jan 2017 20:38:44 +0100 Subject: [PATCH 1/4] Fix if(constant, "SHOWQRZ") error --- ajax.php | 4 ++-- include/functions.php | 2 +- include/lh.php | 2 +- include/localtx.php | 2 +- txinfo.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ajax.php b/ajax.php index ddf87d6..c7b47fa 100644 --- a/ajax.php +++ b/ajax.php @@ -32,7 +32,7 @@ if ($_GET['section'] == "localTx") { $listElem[3] = getName($listElem[2]); if ($listElem[2] !== "??????????") { if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { + if (defined("SHOWQRZ")) { $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; } else { $listElem[2] = "".$listElem[2].""; @@ -47,7 +47,7 @@ if ($_GET['section'] == "localTx") { if ($listElem[5] == "RF" && ($listElem[1]=="D-Star" || startsWith($listElem[1], "DMR") || $listElem[1]=="YSF" || $listElem[1]=="P25")) { if ($listElem[2] !== "??????????") { if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { + if (defined("SHOWQRZ")) { $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; } else { $listElem[2] = "".$listElem[2].""; diff --git a/include/functions.php b/include/functions.php index 0905381..2be0e12 100644 --- a/include/functions.php +++ b/include/functions.php @@ -436,7 +436,7 @@ function getLastHeard($logLines, $onlyLast) { } if ($listElem[2] !== "??????????") { if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { + if (defined("SHOWQRZ")) { $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; } else { $listElem[2] = "".$listElem[2].""; diff --git a/include/lh.php b/include/lh.php index 6e50b4c..1574dee 100644 --- a/include/lh.php +++ b/include/lh.php @@ -36,7 +36,7 @@ for ($i = 0; ($i < $totalLH); $i++) { echo"$listElem[1]"; if ($listElem[2] !== "??????????") { if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { + if (defined("SHOWQRZ")) { echo"".str_replace("0","Ø",$listElem[2]).""; } else { echo"".$listElem[2].""; diff --git a/include/localtx.php b/include/localtx.php index 3913dd6..16e8aa2 100644 --- a/include/localtx.php +++ b/include/localtx.php @@ -41,7 +41,7 @@ for ($i = 0; $i < count($localTXList); $i++) { echo"$listElem[1]"; if ($listElem[2] !== "??????????") { if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { + if (defined("SHOWQRZ")) { echo"".str_replace("0","Ø",$listElem[2]).""; } else { echo"".$listElem[2].""; diff --git a/txinfo.php b/txinfo.php index 372cde6..290ff00 100644 --- a/txinfo.php +++ b/txinfo.php @@ -27,7 +27,7 @@ foreach ($lastHeard as $listElem) { echo"$listElem[1]"; /*if ($listElem[2] !== "??????????") { if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { + if (defined("SHOWQRZ")) { echo"".str_replace("0","Ø",$listElem[2]).""; } else { echo"".$listElem[2].""; From 78e39950f57ff9f184fc96f81be297eb210a756a Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 10 Jan 2017 21:04:23 +0100 Subject: [PATCH 2/4] Fix missing firmware info error --- include/functions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/functions.php b/include/functions.php index 2be0e12..e0e255d 100644 --- a/include/functions.php +++ b/include/functions.php @@ -25,8 +25,11 @@ function getMMDVMHostFileVersion() { function getFirmwareVersion() { $logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; $logLines = explode("\n", `grep "MMDVM protocol version" $logPath`); - $firmware = substr($logLines[count($logLines)-2], strpos($logLines[count($logLines)-2], "description")+13, strlen($logLines[count($logLines)-2])-strpos($logLines[count($logLines)-2], "description")+13); - if (strlen($firmware) > 0) { + $firmware = "n/a"; + if (count($logLines) >= 2) { + $firmware = substr($logLines[count($logLines)-2], strpos($logLines[count($logLines)-2], "description")+13, strlen($logLines[count($logLines)-2])-strpos($logLines[count($logLines)-2], "description")+13); + } + if ($firmware != "n/a") { $fp = fopen('/tmp/MMDVMFirmware.txt', 'w'); fwrite($fp, $firmware); fclose($fp); From 2d5a5db58be9da978d2a55242e7752b10f4a122b Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 10 Jan 2017 21:14:15 +0100 Subject: [PATCH 3/4] Fix DMRnetwork error --- include/functions.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/include/functions.php b/include/functions.php index e0e255d..a430f2d 100644 --- a/include/functions.php +++ b/include/functions.php @@ -48,16 +48,24 @@ function setDMRNetwork($network) { } function getDMRNetwork() { - $fp = fopen('config/DMRNetwork.txt', 'r'); - $network = fread($fp, filesize("config/DMRNetwork.txt")); - fclose($fp); + $filename = 'config/DMRNetwork.txt'; + $network = ''; + if (file_exists($filename)) { + $fp = fopen($filename, 'r'); + $network = fread($fp, filesize("config/DMRNetwork.txt")); + fclose($fp); + } return $network; } function getDMRNetwork2() { - $fp = fopen('../config/DMRNetwork.txt', 'r'); - $network = fread($fp, filesize("../config/DMRNetwork.txt")); - fclose($fp); + $filename = '../config/DMRNetwork.txt'; + $network = ''; + if (file_exists($filename)) { + $fp = fopen('../config/DMRNetwork.txt', 'r'); + $network = fread($fp, filesize("../config/DMRNetwork.txt")); + fclose($fp); + } return $network; } From c843235facf5c9a11336fcff33a020fa9e77f917 Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 10 Jan 2017 21:16:22 +0100 Subject: [PATCH 4/4] Add forgotten variable names --- include/functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/functions.php b/include/functions.php index a430f2d..5578832 100644 --- a/include/functions.php +++ b/include/functions.php @@ -52,7 +52,7 @@ function getDMRNetwork() { $network = ''; if (file_exists($filename)) { $fp = fopen($filename, 'r'); - $network = fread($fp, filesize("config/DMRNetwork.txt")); + $network = fread($fp, filesize($filename)); fclose($fp); } return $network; @@ -62,8 +62,8 @@ function getDMRNetwork2() { $filename = '../config/DMRNetwork.txt'; $network = ''; if (file_exists($filename)) { - $fp = fopen('../config/DMRNetwork.txt', 'r'); - $network = fread($fp, filesize("../config/DMRNetwork.txt")); + $fp = fopen($filename, 'r'); + $network = fread($fp, filesize($filename)); fclose($fp); } return $network;