adding possibility to switch between DMRplus and BrandMeister-Network, see switching-networks.md
This commit is contained in:
parent
c2c27b36f4
commit
bf8e180ee9
6 changed files with 150 additions and 2 deletions
|
@ -38,6 +38,19 @@ function getFirmwareVersion() {
|
|||
echo $firmware;
|
||||
}
|
||||
|
||||
function setDMRNetwork($network) {
|
||||
$fp = fopen('/tmp/DMRNetwork.txt', 'w');
|
||||
fwrite($fp, $network);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
function getDMRNetwork() {
|
||||
$fp = fopen('/tmp/DMRNetwork.txt', 'r');
|
||||
$network = fread($fp, filesize("/tmp/DMRNetwork.txt"));
|
||||
fclose($fp);
|
||||
return $network;
|
||||
}
|
||||
|
||||
function getDMRMasterState() {
|
||||
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
|
||||
$logLines = explode("\n", `egrep -h "(DMR, Logged into the master successfully)|(DMR, Closing DMR Network)" $logPath`);
|
||||
|
|
13
index.php
13
index.php
|
@ -46,7 +46,12 @@ include "version.php";
|
|||
echo "Hotspot";
|
||||
}
|
||||
?>:</small> <?php echo getCallsign($mmdvmconfigs) ?></h1>
|
||||
<h4>MMDVMHost by G4KLX Version: <?php echo getMMDVMHostVersion() ?><br>Firmware: <?php echo getFirmwareVersion() ?></h4>
|
||||
<h4>MMDVMHost by G4KLX Version: <?php echo getMMDVMHostVersion() ?><br>Firmware: <?php echo getFirmwareVersion() ?>
|
||||
<?php
|
||||
if (strlen(getDMRNetwork()) > 0 ) {
|
||||
echo "<br>DMR-Network: ".getDMRNetwork();
|
||||
}
|
||||
?></h4>
|
||||
<?php
|
||||
if (LOGO !== "") {
|
||||
?>
|
||||
|
@ -64,6 +69,12 @@ if (defined("ENABLEMANAGEMENT")) {
|
|||
<button onclick="window.location.href='./scripts/halt.php'" type="button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-off" aria-hidden="true"></span> ShutDown System</button>
|
||||
<?php
|
||||
}
|
||||
if (defined("ENABLENETWORKSWITCHING")) {
|
||||
?>
|
||||
<button onclick="window.location.href='./scripts/switchnetwork.php?network=DMRPLUS'" type="button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> DMRplus</button>
|
||||
<button onclick="window.location.href='./scripts/switchnetwork.php?network=BRANDMEISTER'" type="button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-fire" aria-hidden="true"></span> BrandMeister</button>
|
||||
<?php
|
||||
}
|
||||
checkSetup();
|
||||
// Here you can feel free to disable info-sections by commenting out with // before include
|
||||
include "include/txinfo.php";
|
||||
|
|
99
scripts/switchnetwork.php
Normal file
99
scripts/switchnetwork.php
Normal file
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
//ea4gkq
|
||||
$time = microtime();
|
||||
$time = explode(' ', $time);
|
||||
$time = $time[1] + $time[0];
|
||||
$start = $time;
|
||||
|
||||
// do not touch this includes!!! Never ever!!!
|
||||
include "../config/config.php";
|
||||
include "../include/tools.php";
|
||||
include "../include/functions.php";
|
||||
include "../include/init.php";
|
||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
header('WWW-Authenticate: Basic realm="Dashboard"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!';
|
||||
exit;
|
||||
} else {
|
||||
if ($_SERVER['PHP_AUTH_USER'] == SWITCHNETWORKUSER && $_SERVER['PHP_AUTH_PW'] == SWITCHNETWORKPW) {
|
||||
$fileName = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
|
||||
<!-- Das neueste kompilierte und minimierte CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
|
||||
<!-- Optionales Theme -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
|
||||
<!-- Das neueste kompilierte und minimierte JavaScript -->
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||
<title><?php echo getCallsign($mmdvmconfigs) ?> - MMDVM-Dashboard by DG9VH</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
<h1><small>MMDVM-Dashboard by DG9VH for <?php
|
||||
if (getConfigItem("General", "Duplex", $mmdvmconfigs) == "1") {
|
||||
echo "Repeater";
|
||||
} else {
|
||||
echo "Hotspot";
|
||||
}
|
||||
?>:</small> <?php echo getCallsign($mmdvmconfigs) ?></h1>
|
||||
<h4>MMDVMHost by G4KLX Version: <?php echo getMMDVMHostVersion() ?></h4>
|
||||
<button onclick="window.location.href='../index.php'" type="button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-home" aria-hidden="true"></span> Home</button>
|
||||
|
||||
</script>
|
||||
</div>
|
||||
<?php
|
||||
checkSetup();
|
||||
include "../include/sysinfo.php";
|
||||
if ($_GET['network'] == "DMRPLUS") {
|
||||
setDMRNetwork("DMRplus");
|
||||
exec( "sudo cp ".MMDVMINIPATH."/DMRPLUS.ini ".MMDVMINIPATH."/".MMDVMINIFILENAME );
|
||||
exec( "sudo killall MMDVMHost");
|
||||
sleep(1);
|
||||
exec( "sudo ".MMDVMHOSTPATH."/MMDVMHost ".MMDVMINIPATH."/".MMDVMINIFILENAME." > /dev/null 2>&1 &" );
|
||||
// exec( "sudo killall MMDVMHost && sudo ".MMDVMHOSTPATH."/MMDVMHost ".MMDVMINIPATH."/".MMDVMINIFILENAME." &");
|
||||
// exec( "sudo /etc/init.d/start_mmdvm restart ");
|
||||
}
|
||||
if ($_GET['network'] == "BRANDMEISTER") {
|
||||
setDMRNetwork("BrandMeister");
|
||||
exec( "sudo cp ".MMDVMINIPATH."/BRANDMEISTER.ini ".MMDVMINIPATH."/".MMDVMINIFILENAME );
|
||||
exec( "sudo killall MMDVMHost");
|
||||
sleep(1);
|
||||
exec( "sudo ".MMDVMHOSTPATH."/MMDVMHost ".MMDVMINIPATH."/".MMDVMINIFILENAME." > /dev/null 2>&1 &" );
|
||||
// exec( "sudo killall MMDVMHost && sudo ".MMDVMHOSTPATH."/MMDVMHost ".MMDVMINIPATH."/".MMDVMINIFILENAME." &" );
|
||||
}
|
||||
?>
|
||||
<div class="alert alert-info" role="alert">Switching network to <b><?php echo getDMRNetwork() ?></b><br>Restarting in new selected network in progress</div>
|
||||
|
||||
<div class="panel panel-info">
|
||||
|
||||
<?php
|
||||
|
||||
$datum = date("d-m-Y");
|
||||
$uhrzeit = date("H:i:s");
|
||||
echo "Last Update $datum, $uhrzeit";
|
||||
$time = microtime();
|
||||
$time = explode(' ', $time);
|
||||
$time = $time[1] + $time[0];
|
||||
$finish = $time;
|
||||
$total_time = round(($finish - $start), 4);
|
||||
echo '<!--Page generated in '.$total_time.' seconds.-->';
|
||||
} else {
|
||||
|
||||
header('WWW-Authenticate: Basic realm="Dashboard"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?> | get your own at: <a href="https://github.com/dg9vh/MMDVMHost-Dashboard">https://github.com/dg9vh/MMDVMHost-Dashboard</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
13
setup.php
13
setup.php
|
@ -143,6 +143,19 @@ include "include/tools.php";
|
|||
<span class="input-group-addon" id="TEMPERATUREHIGHLEVEL" style="width: 300px">Warning temperature</span>
|
||||
<input type="text" value="<?php echo constant("TEMPERATUREHIGHLEVEL") ?>" name="TEMPERATUREHIGHLEVEL" class="form-control" placeholder="60" aria-describedby="TEMPERATUREHIGHLEVEL" required data-fv-notempty-message="Value is required">
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="ENABLENETWORKSWITCHING" style="width: 300px">Enable Network-Switching-Function</span>
|
||||
<div class="panel-body"><input type="checkbox" name="ENABLENETWORKSWITCHING" <?php if (constant("ENABLENETWORKSWITCHING")) echo "checked" ?>></div>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="SWITCHNETWORKUSER" style="width: 300px">Username for switching networks:</span>
|
||||
<input type="text" value="<?php echo constant("SWITCHNETWORKUSER") ?>" name="SWITCHNETWORKUSER" class="form-control" placeholder="username" aria-describedby="SWITCHNETWORKUSER">
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="SWITCHNETWORKPW" style="width: 300px">Password for switching networks:</span>
|
||||
<input type="text" value="<?php echo constant("SWITCHNETWORKPW") ?>" name="SWITCHNETWORKPW" class="form-control" placeholder="password" aria-describedby="SWITCHNETWORKPW">
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="ENABLEMANAGEMENT" style="width: 300px">Enable Management-Functions below</span>
|
||||
<div class="panel-body"><input type="checkbox" name="ENABLEMANAGEMENT" <?php if (constant("ENABLEMANAGEMENT")) echo "checked" ?>></div>
|
||||
|
|
12
switching-networks.md
Normal file
12
switching-networks.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Switching Networks
|
||||
To make switching networks possible you have to fulfill following conditions:
|
||||
1. add www-user to the sudoers file to be able to execute following commands: cp, killall, MMDVMHost
|
||||
2. create two ini-files, one with the name DMRPLUS.ini and the other with the name BRANDMEISTER.ini within the same directory where your MMDVM.ini resists, that contains the configurations for the corresponding networks.
|
||||
|
||||
## Security Hint
|
||||
It is absolutely not recommended to put ALL into the sudoers line! The commands above are heavy enougth!
|
||||
It is strictly recommended to not make the Dashboard public available, if you are using the advanced management functions and the network switching!
|
||||
|
||||
## For Better Handling Of Heardlists
|
||||
If you want to have only those contacts listed in the last-head-lists that where active in the corresponding network your system is logged in,
|
||||
you can configure your .INI-Files to use separate LOG-Prefixes like BM-MMDVM and DMRPLUS-MMDVM for example.
|
|
@ -1,3 +1,3 @@
|
|||
<?php
|
||||
define("VERSION", "20161028-1");
|
||||
define("VERSION", "20161102-1");
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue