From 39b8852f15393947b67f2178f1b1831a9d82b4c9 Mon Sep 17 00:00:00 2001 From: dg9vh Date: Thu, 13 Oct 2016 19:34:29 +0000 Subject: [PATCH] print version of MMDVM or DVMEGA in headline behind MMDVMHost-Version --- include/functions.php | 25 ++++++++++++++++++++++--- index.php | 2 +- version.php | 2 +- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/include/functions.php b/include/functions.php index a5d9682..bb5065f 100644 --- a/include/functions.php +++ b/include/functions.php @@ -22,6 +22,22 @@ 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) { + $fp = fopen('/tmp/MMDVMFirmware.txt', 'w'); + fwrite($fp, $firmware); + fclose($fp); + } else { + $fp = fopen('/tmp/MMDVMFirmware.txt', 'r'); + $contents = fread($fp, filesize("/tmp/MMDVMFirmware.txt")); + $firmware = $contents; + } + echo $firmware; +} + function getMMDVMConfig() { // loads MMDVM.ini into array for further use $conf = array(); @@ -601,9 +617,12 @@ function getName($callsign) { $delimiter = "\t"; exec("grep -P '".$callsign.$delimiter."' ".DMRIDDATPATH, $output); } - $name = substr($output[0], strpos($output[0],$delimiter)+1); - $name = substr($name, strpos($name,$delimiter)+1); - return $name; + if (count($output) !== 0) { + $name = substr($output[0], strpos($output[0],$delimiter)+1); + $name = substr($name, strpos($name,$delimiter)+1); + return $name; + } else + return "---"; } else { return "DMRIDs.dat not correct!"; } diff --git a/index.php b/index.php index d6105f5..e018bc5 100644 --- a/index.php +++ b/index.php @@ -46,7 +46,7 @@ include "version.php"; echo "Hotspot"; } ?>: -

MMDVMHost by G4KLX Version:

+

MMDVMHost by G4KLX Version: , Firmware:

diff --git a/version.php b/version.php index 424de07..3e4d0ba 100644 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@