Merge pull request #1 from dg9vh/master

Merge Changes of DG9VH to DC7JZB
This commit is contained in:
Mario , DC7JZB 2020-07-18 21:16:51 +02:00 committed by GitHub
commit df1b6e99b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 117 additions and 59 deletions

View file

@ -86,6 +86,10 @@ if ($_GET['section'] == "localTx") {
$listElem = $localTXList[$i]; $listElem = $localTXList[$i];
// Generate a canonicalized call for QRZ and name lookups // Generate a canonicalized call for QRZ and name lookups
$call_canon = preg_replace('/\s+\w$/', '', $listElem[2]); $call_canon = preg_replace('/\s+\w$/', '', $listElem[2]);
//remove suffix used sometimes in YSF (es: -FT2 , -991)
if (strpos($call_canon,"-")!=false) {
$call_canon = substr($call_canon, 0, strpos($call_canon, "-"));
}
if (defined("ENABLEXTDLOOKUP")) { if (defined("ENABLEXTDLOOKUP")) {
$listElem[11] =""; $listElem[11] ="";
if ($listElem[6] == "RF" && ($listElem[1]=="D-Star" || startsWith($listElem[1], "DMR") || $listElem[1]=="YSF" || $listElem[1]=="P25" || $listElem[1]=="NXDN")) { if ($listElem[6] == "RF" && ($listElem[1]=="D-Star" || startsWith($listElem[1], "DMR") || $listElem[1]=="YSF" || $listElem[1]=="P25" || $listElem[1]=="NXDN")) {
@ -219,11 +223,11 @@ if ($_GET['section'] == "sysinfo") {
showLapTime("cpuusage"); showLapTime("cpuusage");
$output = shell_exec('grep -c processor /proc/cpuinfo'); $output = shell_exec('grep -c processor /proc/cpuinfo');
$cpucores = $output; $cpucores = intval($output);
$output = shell_exec('cat /proc/uptime'); $output = shell_exec('cat /proc/uptime');
$uptime = format_time(substr($output,0,strpos($output," "))); $uptime = format_time(substr($output,0,strpos($output," ")));
$idletime = format_time((substr($output,strpos($output," ")))/$cpucores); $idletime = format_time(doubleval((substr($output,strpos($output," "))))/$cpucores);
showLapTime("idletime"); showLapTime("idletime");
if (defined("SHOWPOWERSTATE")) { if (defined("SHOWPOWERSTATE")) {

Binary file not shown.

View file

@ -58,7 +58,9 @@ function getFirmwareVersion() {
$firmware = "n/a"; $firmware = "n/a";
if (count($logLines) >= 2) { if (count($logLines) >= 2) {
$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); $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 (0 === strpos($firmware, 'MMDVM')) { if (0 === strpos($firmware, 'MMDVM_HS_Dual_Hat')) {
$firmware = preg_replace('/GitID #([0-9A-Fa-f]{7})/', 'GitID #<a href="http://www.github.com/juribeparada/MMDVM_HS/commit/$1" target=\"_blank\">$1</a>', $firmware);
} else if (0 === strpos($firmware, 'MMDVM')) {
$firmware = preg_replace('/GitID #([0-9A-Fa-f]{7})/', 'GitID #<a href="http://www.github.com/g4klx/MMDVM/commit/$1" target=\"_blank\">$1</a>', $firmware); $firmware = preg_replace('/GitID #([0-9A-Fa-f]{7})/', 'GitID #<a href="http://www.github.com/g4klx/MMDVM/commit/$1" target=\"_blank\">$1</a>', $firmware);
} else if (0 === strpos($firmware, 'ZUMspot')) { } else if (0 === strpos($firmware, 'ZUMspot')) {
$firmware = preg_replace('/GitID #([0-9A-Fa-f]{7})/', 'GitID #<a href="http://www.github.com/juribeparada/MMDVM_HS/commit/$1" target=\"_blank\">$1</a>', $firmware); $firmware = preg_replace('/GitID #([0-9A-Fa-f]{7})/', 'GitID #<a href="http://www.github.com/juribeparada/MMDVM_HS/commit/$1" target=\"_blank\">$1</a>', $firmware);
@ -163,6 +165,7 @@ function getDMRId ($mmdvmconfigs) {
// returns DMRId from MMDVM-Config // returns DMRId from MMDVM-Config
return getConfigItem("General", "Id", $mmdvmconfigs); return getConfigItem("General", "Id", $mmdvmconfigs);
} }
function getConfigItem($section, $key, $configs) { function getConfigItem($section, $key, $configs) {
// retrieves the corresponding config-entry within a [section] // retrieves the corresponding config-entry within a [section]
$sectionpos = array_search("[" . $section . "]", $configs) + 1; $sectionpos = array_search("[" . $section . "]", $configs) + 1;
@ -226,7 +229,7 @@ function showMode($mode, $mmdvmconfigs) {
function getMMDVMLog() { function getMMDVMLog() {
// Open Logfile and copy loglines into LogLines-Array() // Open Logfile and copy loglines into LogLines-Array()
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; $logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
$logLines = explode("\n", `egrep -h "from|end|watchdog|lost" $logPath`); $logLines = explode("\n", `egrep -h "end|watchdog|lost" $logPath`);
return $logLines; return $logLines;
} }
@ -249,6 +252,7 @@ function getYSFGatewayLog() {
// M: 2016-04-29 00:15:00.013 D-Star, received network header from DG9VH /ZEIT to CQCQCQ via DCS002 S // M: 2016-04-29 00:15:00.013 D-Star, received network header from DG9VH /ZEIT to CQCQCQ via DCS002 S
// M: 2016-04-29 19:43:21.839 DMR Slot 2, received network voice header from DL1ESZ to TG 9 // M: 2016-04-29 19:43:21.839 DMR Slot 2, received network voice header from DL1ESZ to TG 9
// M: 2016-04-30 14:57:43.072 DMR Slot 2, received RF voice header from DG9VH to 5000 // M: 2016-04-30 14:57:43.072 DMR Slot 2, received RF voice header from DG9VH to 5000
// M: 2019-12-09 18:56:46.947 DMR Slot 1, received RF voice header from 2625094 to TG 26266
// M: 2016-09-16 09:14:12.886 P25, received RF from DF2ET to TG10100 // M: 2016-09-16 09:14:12.886 P25, received RF from DF2ET to TG10100
// M: 2017-02-13 15:53:30.990 DMR Slot 2, Embedded Talker Alias Header // M: 2017-02-13 15:53:30.990 DMR Slot 2, Embedded Talker Alias Header
// M: 2017-02-13 15:53:30.991 0000: 04 00 5E 49 57 38 44 59 94 *..^IW8DY.* // M: 2017-02-13 15:53:30.991 0000: 04 00 5E 49 57 38 44 59 94 *..^IW8DY.*
@ -361,6 +365,32 @@ function getHeardList($logLines, $onlyLast) {
} }
$ber = substr($loss, 5); $ber = substr($loss, 5);
$loss = ""; $loss = "";
} else if (startsWith($loss,"RSSI:")) { //for short RF packets and "X" button requests, BER sometimes in not showed. RSSI is in BER position
$loss="";
$ber = "";
$rssiString = substr($lineTokens[3], 6);
if (constant("RSSI") == "min") $rssiVal = preg_replace('/(-\d+)\/-\d+\/-\d+ dBm/', "\\1", $rssiString);
else if (constant("RSSI") == "max") $rssiVal = preg_replace('/-\d+\/(-\d+)\/-\d+ dBm/', "\\1", $rssiString);
else if (constant("RSSI") == "avg") $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString);
else if (constant("RSSI") == "all") $rssiVal = $rssiString;
else $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString);
if (constant("RSSI") != "all") {
if ($rssiVal > "-53") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9<sup> +40dB</sup> ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-63") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9<sup> +30dB</sup> ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-73") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9<sup> +20dB</sup> ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-83") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9<sup> +10dB</sup> ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-93") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9 ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-99") $rssi = "<img src=\"images/3.png\" \> <div class=\"tooltip2\">S8 ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-105") $rssi = "<img src=\"images/3.png\" \> <div class=\"tooltip2\">S7 ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-111") $rssi = "<img src=\"images/2.png\" \> <div class=\"tooltip2\">S6 ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-117") $rssi = "<img src=\"images/2.png\" \> <div class=\"tooltip2\">S5 ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-123") $rssi = "<img src=\"images/1.png\" \> <div class=\"tooltip2\">S4 ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-129") $rssi = "<img src=\"images/1.png\" \> <div class=\"tooltip2\">S3 ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-135") $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S2 ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
else if ($rssiVal > "-141") $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S1 ($rssiVal dBm)<span class=\"tooltip2text\">(min/max/avg)<br>$rssiString</span></div>";
} else {
$rssi = $rssiVal;
}
} else { } else {
$loss = strtok($loss, " "); $loss = strtok($loss, " ");
if (array_key_exists(4,$lineTokens)) { if (array_key_exists(4,$lineTokens)) {
@ -468,8 +498,9 @@ function getHeardList($logLines, $onlyLast) {
$id=""; $id="";
} }
$target = substr($logLine, $topos + 3); $target = substr($logLine, $topos + 3);
if (strpos($target,",") > 0)
$target = substr($target, 0, strpos($target,","));
$target = preg_replace('/\s/', '&nbsp;', $target); $target = preg_replace('/\s/', '&nbsp;', $target);
if (defined("RESOLVETGS")) { if (defined("RESOLVETGS")) {
$target = $target." ".getTGName($target); $target = $target." ".getTGName($target);
@ -553,6 +584,10 @@ function getLastHeard($logLines, $onlyLast) {
if(!(array_search($listElem[2]."#".$listElem[1].$listElem[4], $heardCalls) > -1)) { if(!(array_search($listElem[2]."#".$listElem[1].$listElem[4], $heardCalls) > -1)) {
// Generate a canonicalized call for QRZ and name lookups // Generate a canonicalized call for QRZ and name lookups
$call_canon = preg_replace('/\s+\w$/', '', $listElem[2]); $call_canon = preg_replace('/\s+\w$/', '', $listElem[2]);
//remove suffix used sometimes in YSF (es: -FT2 , -991)
if (strpos($call_canon,"-")!=false) {
$call_canon = substr($call_canon, 0, strpos($call_canon, "-"));
}
array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[4]); array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[4]);
if (defined("ENABLEXTDLOOKUP")) { if (defined("ENABLEXTDLOOKUP")) {
if ($listElem[2] !== "??????????") { if ($listElem[2] !== "??????????") {
@ -693,6 +728,7 @@ function getActualLink($logLines, $mode) {
$to = ""; $to = "";
if (strpos($logLine,"to")) { if (strpos($logLine,"to")) {
$to = trim(substr($logLine, strpos($logLine,"to") + 3)); $to = trim(substr($logLine, strpos($logLine,"to") + 3));
$to = substr($to, 0, strpos($to,","));
} }
if ($to !== "") { if ($to !== "") {
$fp = fopen('/tmp/DMR1State.txt', 'w'); $fp = fopen('/tmp/DMR1State.txt', 'w');
@ -723,6 +759,9 @@ function getActualLink($logLines, $mode) {
$to = ""; $to = "";
if (strpos($logLine,"to")) { if (strpos($logLine,"to")) {
$to = trim(substr($logLine, strpos($logLine,"to") + 3)); $to = trim(substr($logLine, strpos($logLine,"to") + 3));
$to = trim(substr($logLine, strpos($logLine,"to") + 3));
$to = substr($to, 0, strpos($to,","));
} }
if ($to !== "") { if ($to !== "") {
$fp = fopen('/tmp/DMR2State.txt', 'w'); $fp = fopen('/tmp/DMR2State.txt', 'w');
@ -753,7 +792,6 @@ function getActualLink($logLines, $mode) {
//M: 2018-06-04 11:04:22.202 No connection startup //M: 2018-06-04 11:04:22.202 No connection startup
//M: 2018-06-04 11:04:24.005 Linked to IT C4FM Piemonte //M: 2018-06-04 11:04:24.005 Linked to IT C4FM Piemonte
if (isProcessRunning("YSFGateway")) { if (isProcessRunning("YSFGateway")) {
foreach($logLines as $logLine) { foreach($logLines as $logLine) {
$to = ""; $to = "";
@ -773,6 +811,26 @@ function getActualLink($logLines, $mode) {
return $to; return $to;
} }
} }
if ( ($to == "") && file_exists('/tmp/YSFState.txt')) { // reflector is in yesterday's log
$logPath2 = YSFGATEWAYLOGPATH."/".YSFGATEWAYLOGPREFIX."-".date('Y-m-d',strtotime(date('Y-m-d').' -1 day')).".log"; //open yesterday's log
$logLines2 = explode("\n", `egrep -h "Linked to" $logPath2`);
$to = "";
foreach($logLines2 as $logLine) {
if ($logLine!=='') {
$to = substr($logLine, 37, 16);
if ($to == "MMDVM" )
continue;
}
}
if ($to !== "") {
$fp = fopen('/tmp/YSFState.txt', 'w');
fwrite($fp, $to);
fclose($fp);
return $to;
}
}
} else { } else {
return _("YSFGateway not running"); return _("YSFGateway not running");
} }

View file

@ -47,7 +47,7 @@ $(document).ready(function(){
var lastHeardT = $('#lastHeard').dataTable( { var lastHeardT = $('#lastHeard').dataTable( {
"language": <?php echo DATATABLESTRANSLATION; ?>, "language": <?php echo DATATABLESTRANSLATION; ?>,
"aaSorting": [[0,'desc']], "aaSorting": [[0,'desc']],
<?php $request = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}/{$_SERVER['REQUEST_URI']}"; <?php $request = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}/{$_SERVER['REQUEST_URI']}";
if (strpos($request,"index.php")> 0) { if (strpos($request,"index.php")> 0) {
$request = substr($request,0,strpos($request,"index.php")); $request = substr($request,0,strpos($request,"index.php"));
} }

View file

@ -45,7 +45,7 @@ $(document).ready(function(){
"language": <?php echo DATATABLESTRANSLATION; ?>, "language": <?php echo DATATABLESTRANSLATION; ?>,
"aaSorting": [[0,'desc']], "aaSorting": [[0,'desc']],
<?php $request = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}/{$_SERVER['REQUEST_URI']}"; <?php $request = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}/{$_SERVER['REQUEST_URI']}";
if (strpos($request,"index.php")> 0) { if (strpos($request,"index.php")> 0) {
$request = substr($request,0,strpos($request,"index.php")); $request = substr($request,0,strpos($request,"index.php"));
} }

View file

@ -73,18 +73,11 @@ function getSize($filesize, $precision = 2) {
function checkSetup() { function checkSetup() {
$el = error_reporting(); $el = error_reporting();
error_reporting(E_ERROR | E_WARNING | E_PARSE); error_reporting(E_ERROR | E_WARNING | E_PARSE);
if (defined(DISTRIBUTION)) {
?>
<div class="alert alert-danger" role="alert"><?php echo _("You are using an old config.php. Please configure your Dashboard by calling <a href=\"setup.php\">setup.php</a>!"); ?></div>
<?php
} else {
if (file_exists ("setup.php") && ! defined("DISABLESETUPWARNING")) { if (file_exists ("setup.php") && ! defined("DISABLESETUPWARNING")) {
?> ?>
<div class="alert alert-danger" role="alert"><?php echo _("You forgot to remove setup.php in root-directory of your dashboard or you forgot to configure it! Please delete the file or configure your Dashboard by calling <a href=\"setup.php\">setup.php</a>!"); ?></div> <div class="alert alert-danger" role="alert"><?php echo _("You forgot to remove setup.php in root-directory of your dashboard or you forgot to configure it! Please delete the file or configure your Dashboard by calling <a href=\"setup.php\">setup.php</a>!"); ?></div>
<?php <?php
} }
}
error_reporting($el); error_reporting($el);
} }

View file

@ -38,7 +38,7 @@ This short howto describes step-by-step how to install the MMDVMHost-Dashboard o
If you use a Raspian Stretch use: If you use a Raspian Stretch use:
>sudo apt-get install php7.0-common php7.0-cgi php >sudo apt-get install php7.3-common php7.3-cgi php
if you want to use the sqlite3-database based resolving of the operator-names you need following, too Raspian Wheezy and Raspbian Jessie: if you want to use the sqlite3-database based resolving of the operator-names you need following, too Raspian Wheezy and Raspbian Jessie:

View file

@ -14,15 +14,18 @@ if (!defined("MMDVMLOGPREFIX"))
if (!defined("TIMEZONE")) if (!defined("TIMEZONE"))
define("TIMEZONE", "UTC"); define("TIMEZONE", "UTC");
$logLinesMMDVM = getShortMMDVMLog(); $logLinesMMDVM = getShortMMDVMLog();
// echo"<!--";
// var_dump($logLinesMMDVM);
// echo"-->";
$reverseLogLinesMMDVM = $logLinesMMDVM; $reverseLogLinesMMDVM = $logLinesMMDVM;
array_multisort($reverseLogLinesMMDVM,SORT_DESC); array_multisort($reverseLogLinesMMDVM,SORT_DESC);
$lastHeard = getLastHeard($reverseLogLinesMMDVM, True); $lastHeard = getLastHeard($reverseLogLinesMMDVM, True);
$counter = 0; $counter = 0;
foreach ($lastHeard as $listElem) { foreach ($lastHeard as $listElem) {
$counter +=1; $counter +=1;
echo"<!--"; // echo"<!--";
var_dump($listElem); // var_dump($listElem);
echo"-->"; // echo"-->";
if (defined("ENABLEXTDLOOKUP") && $listElem[7] == null || !defined("ENABLEXTDLOOKUP") && $listElem[6] == null) { if (defined("ENABLEXTDLOOKUP") && $listElem[7] == null || !defined("ENABLEXTDLOOKUP") && $listElem[6] == null) {
echo "<tr>"; echo "<tr>";
echo"<td nowrap>$listElem[0]</td>"; echo"<td nowrap>$listElem[0]</td>";

View file

@ -1,3 +1,3 @@
<?php <?php
define("VERSION", "20180604-1 (".getGitVersion().")"); define("VERSION", "20200605-1 (".getGitVersion().")");
?> ?>