makes switchRefl. only working on DMRplus-Network, not on BM because options-line in MMDVM.ini is not supported by BrandMeister

This commit is contained in:
dg9vh 2017-03-28 20:20:10 +00:00
parent 3c11027861
commit 8fa0bce46c
3 changed files with 16 additions and 21 deletions

View file

@ -858,23 +858,8 @@ function getGitVersion(){
} }
} }
function getDMRReflectors($network) { function getDMRReflectors() {
$refls = array(); $data = file_get_contents("http://ham-dmr.de/reflector.db");
switch ($network) {
case "DMRPLUS":
$refls = getDMRReflectorsFromURL("http://ham-dmr.de/reflector.db");
break;
case "BRANDMEISTER":
$refls = getDMRReflectorsFromURL("http://185.79.71.94/reflector.db");
break;
}
return $refls;
}
function getDMRReflectorsFromURL($url) {
$data = file_get_contents($url);
$rows = explode("\n",$data); $rows = explode("\n",$data);
$refls = array(); $refls = array();
foreach($rows as $row) { foreach($rows as $row) {
@ -882,4 +867,14 @@ function getDMRReflectorsFromURL($url) {
} }
return $refls; return $refls;
} }
function getBrandMeisterDMRMasterList() {
$data = file_get_contents("http://185.79.71.94/dmr/dmrmaster.php");
$rows = explode("\n",$data);
$masters = array();
foreach($rows as $row) {
$masters[] = str_getcsv($row,"@",'');
}
return $masters;
}
?> ?>

View file

@ -135,15 +135,15 @@ if (defined("ENABLENETWORKSWITCHING")) {
<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>&nbsp;<?php echo _("BrandMeister"); ?></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>&nbsp;<?php echo _("BrandMeister"); ?></button>
<?php <?php
} }
if (defined("ENABLEREFLECTORSWITCHING") && (getEnabled("DMR Network", $mmdvmconfigs) == 1)) { if (defined("ENABLEREFLECTORSWITCHING") && (getEnabled("DMR Network", $mmdvmconfigs) == 1) && !recursive_array_search(gethostbyname(getConfigItem("DMR Network", "Address", $mmdvmconfigs)),getBrandMeisterDMRMasterList()) ) {
$reflectors = getDMRReflectors("DMRPLUS"); $reflectors = getDMRReflectors();
?> ?>
<form method = "get" action ="./scripts/switchreflector.php" class="form-inline" role="form"> <form method = "get" action ="./scripts/switchreflector.php" class="form-inline" role="form">
<div class="form-group"> <div class="form-group">
<select id="reflector" name="reflector" class="form-control" style="width: 80px;"> <select id="reflector" name="reflector" class="form-control" style="width: 80px;">
<?php <?php
foreach ($reflectors as $reflector) { foreach ($reflectors as $reflector) {
if (strlen($reflector[1])>0) if (isset($reflector[1]))
echo'<option value="'.$reflector[0].'">'.$reflector[1].'</option>'; echo'<option value="'.$reflector[0].'">'.$reflector[1].'</option>';
} }
?> ?>

View file

@ -1,3 +1,3 @@
<?php <?php
define("VERSION", "20170323-2 (".getGitVersion().")"); define("VERSION", "20170328-1 (".getGitVersion().")");
?> ?>