diff --git a/include/functions.php b/include/functions.php index db0fadf..20e9123 100644 --- a/include/functions.php +++ b/include/functions.php @@ -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`); diff --git a/index.php b/index.php index 6653483..476f064 100644 --- a/index.php +++ b/index.php @@ -46,7 +46,12 @@ include "version.php"; echo "Hotspot"; } ?>: -

MMDVMHost by G4KLX Version:
Firmware:

+

MMDVMHost by G4KLX Version:
Firmware: + 0 ) { + echo "
DMR-Network: ".getDMRNetwork(); + } + ?>

@@ -64,6 +69,12 @@ if (defined("ENABLEMANAGEMENT")) { + + + + + + + + + + + + + + + + + <?php echo getCallsign($mmdvmconfigs) ?> - MMDVM-Dashboard by DG9VH + + + + + /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." &" ); +} +?> + + +
+ +'; + } 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: https://github.com/dg9vh/MMDVMHost-Dashboard +
+ + diff --git a/setup.php b/setup.php index 3c0f2ef..00e5416 100644 --- a/setup.php +++ b/setup.php @@ -143,6 +143,19 @@ include "include/tools.php"; Warning temperature " name="TEMPERATUREHIGHLEVEL" class="form-control" placeholder="60" aria-describedby="TEMPERATUREHIGHLEVEL" required data-fv-notempty-message="Value is required"> +
+ Enable Network-Switching-Function +
>
+
+
+ Username for switching networks: + " name="SWITCHNETWORKUSER" class="form-control" placeholder="username" aria-describedby="SWITCHNETWORKUSER"> +
+
+ Password for switching networks: + " name="SWITCHNETWORKPW" class="form-control" placeholder="password" aria-describedby="SWITCHNETWORKPW"> +
+
Enable Management-Functions below
>
diff --git a/switching-networks.md b/switching-networks.md new file mode 100644 index 0000000..d9f639a --- /dev/null +++ b/switching-networks.md @@ -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. \ No newline at end of file diff --git a/version.php b/version.php index 6bed1cd..bf6259f 100644 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@