print version of MMDVM or DVMEGA in headline behind MMDVMHost-Version

This commit is contained in:
dg9vh 2016-10-13 19:34:29 +00:00
parent a803615177
commit 39b8852f15
3 changed files with 24 additions and 5 deletions

View file

@ -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!";
}

View file

@ -46,7 +46,7 @@ include "version.php";
echo "Hotspot";
}
?>:</small> <?php echo getCallsign($mmdvmconfigs) ?></h1>
<h4>MMDVMHost by G4KLX Version: <?php echo getMMDVMHostVersion() ?></h4>
<h4>MMDVMHost by G4KLX Version: <?php echo getMMDVMHostVersion() ?>, Firmware: <?php echo getFirmwareVersion() ?></h4>
<?php
if (LOGO !== "") {
?>

View file

@ -1,3 +1,3 @@
<?php
define("VERSION", "20161013-2");
define("VERSION", "20161013-3");
?>