Added modes-info and MMDVMHost-Version

This commit is contained in:
dg9vh 2016-05-09 22:39:47 +02:00
parent 60e82d8c91
commit 84e4e56188
4 changed files with 71 additions and 3 deletions

View file

@ -1,9 +1,10 @@
<?php
date_default_timezone_set('UTC');
define("REPEATERCALLSIGN", "DG9VH");
define("MMDVMLOGPATH", "/mnt/ramdisk/"); // hint: add trailing / !!!
define("MMDVMLOGPREFIX", "MMDVM");
define("MMDVMLOGFILE", MMDVMLOGPATH . MMDVMLOGPREFIX . "-" . date("Y-m-d") . ".log");
define("MMDVMINIPATH", "/opt/mmdvm/"); // hint: add trailing / !!!
define("MMDVMHOSTPATH", "/opt/mmdvm/"); // hint: add trailing / !!!
// enter exact path to your log files.
// If your Linux is a MARYLAND-DSTAR-Image, this paths would work.

View file

@ -1,4 +1,51 @@
<?php
function getMMDVMHostVersion() {
$filename = MMDVMHOSTPATH . "MMDVMHost";
if (file_exists($filename)) {
return date("Y-m-d", filectime($filename));
}
}
function getMMDVMConfig() {
$mmdvmconfigs = array();
if ($configs = fopen(MMDVMINIPATH."MMDVM.ini", 'r')) {
while ($config = fgets($configs)) {
array_push($mmdvmconfigs, substr($config, 0, -1));
}
fclose($configs);
}
return $mmdvmconfigs;
}
function getCallsign($mmdvmconfigs) {
foreach ($mmdvmconfigs as $config) {
$pos = strpos($config, "Callsign");
if ($pos !== false) {
return substr($config, 9);
}
}
}
function getEnabled ($mode, $mmdvmconfigs) {
$modepos = array_search($mode,$mmdvmconfigs);
while(strpos($mmdvmconfigs[$modepos],"Enable") === false ) {
$modepos++;
}
return substr($mmdvmconfigs[$modepos], 7);
}
function showMode($mode, $mmdvmconfigs) {
?>
<td><span class="label <?php
if (getEnabled("[" . $mode . "]", $mmdvmconfigs) == 1) {
echo "label-success"; } else {
echo "label-danger";
}
?>"><?php echo $mode ?></span></td>
<?php
}
function getLog() {
// Open Logfile and copy loglines into LogLines-Array()
$logLines = array();
@ -256,5 +303,6 @@ function getActualLink($logLines, $mode) {
}
//Some basic inits
$mmdvmconfigs = getMMDVMConfig();
$logLines = getLog();
?>

17
include/modes.php Normal file
View file

@ -0,0 +1,17 @@
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">Enabled Modes</div>
<!-- Tabelle -->
<table class="table">
<tr>
<?php showMode("DMR", $mmdvmconfigs);?>
<?php showMode("DMR Network", $mmdvmconfigs);?>
<?php showMode("D-Star", $mmdvmconfigs);?>
<?php showMode("D-Star Network", $mmdvmconfigs);?>
<?php showMode("System Fusion", $mmdvmconfigs);?>
<?php showMode("System Fusion Network", $mmdvmconfigs);?>
</tr>
</table>
</div>

View file

@ -21,15 +21,17 @@ include "include/functions.php";
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<!-- Das neueste kompilierte und minimierte JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<title><?php echo REPEATERCALLSIGN?> - MMDVM-Dashboard by DG9VH</title>
<title><?php echo getCallsign($mmdvmconfigs) ?> - MMDVM-Dashboard by DG9VH</title>
</head>
<body>
<div class="page-header">
<h1><small>MMDVM-Dashboard by DG9VH for Repeater:</small> <?php echo REPEATERCALLSIGN?></h1>
<h1><small>MMDVM-Dashboard by DG9VH for Repeater:</small> <?php echo getCallsign($mmdvmconfigs) ?></h1>
<h4>MMDVMHost v<?php echo getMMDVMHostVersion() ?> by G4KLX</h4>
</div>
<?php
include "include/sysinfo.php";
include "include/repeaterinfo.php";
include "include/modes.php";
include "include/lh.php";
?>
<div class="panel panel-info">