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 @@