diff --git a/ajax.php b/ajax.php index 3063da0..ddf87d6 100644 --- a/ajax.php +++ b/ajax.php @@ -8,232 +8,232 @@ include "include/functions.php"; $mmdvmconfigs = getMMDVMConfig(); if (!defined("MMDVMLOGPREFIX")) - define("MMDVMLOGPREFIX", getConfigItem("Log", "FileRoot", $mmdvmconfigs)); + define("MMDVMLOGPREFIX", getConfigItem("Log", "FileRoot", $mmdvmconfigs)); if (!defined("TIMEZONE")) - define("TIMEZONE", "UTC"); + define("TIMEZONE", "UTC"); $logLinesMMDVM = getMMDVMLog(); $reverseLogLinesMMDVM = $logLinesMMDVM; array_multisort($reverseLogLinesMMDVM,SORT_DESC); if ($_GET['section'] == "mode") { - $mode = getActualMode(getLastHeard($reverseLogLinesMMDVM, TRUE), $mmdvmconfigs); - echo $mode; + $mode = getActualMode(getLastHeard($reverseLogLinesMMDVM, TRUE), $mmdvmconfigs); + echo $mode; } if ($_GET['section'] == "lastHeard") { - $lastHeard = getLastHeard($reverseLogLinesMMDVM, FALSE); - echo '{"data": '.json_encode($lastHeard)."}"; + $lastHeard = getLastHeard($reverseLogLinesMMDVM, FALSE); + echo '{"data": '.json_encode($lastHeard)."}"; } if ($_GET['section'] == "localTx") { - $localTXList = getHeardList($reverseLogLinesMMDVM, FALSE); - $lastHeard = Array(); - for ($i = 0; $i < count($localTXList); $i++) { - $listElem = $localTXList[$i]; - if (defined("ENABLEXTDLOOKUP")) { - if ($listElem[6] == "RF" && ($listElem[1]=="D-Star" || startsWith($listElem[1], "DMR") || $listElem[1]=="YSF" || $listElem[1]=="P25")) { - $listElem[3] = getName($listElem[2]); - if ($listElem[2] !== "??????????") { - if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { - $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; - } else { - $listElem[2] = "".$listElem[2].""; - } - } else { - $listElem[2] = "".$listElem[2].""; - } - } - array_push($lastHeard, $listElem); - } - } else { - if ($listElem[5] == "RF" && ($listElem[1]=="D-Star" || startsWith($listElem[1], "DMR") || $listElem[1]=="YSF" || $listElem[1]=="P25")) { - if ($listElem[2] !== "??????????") { - if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { - $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; - } else { - $listElem[2] = "".$listElem[2].""; - } - } else { - $listElem[2] = "".$listElem[2].""; - } - } - array_push($lastHeard, $listElem); - } - } - } - echo '{"data": '.json_encode($lastHeard)."}"; + $localTXList = getHeardList($reverseLogLinesMMDVM, FALSE); + $lastHeard = Array(); + for ($i = 0; $i < count($localTXList); $i++) { + $listElem = $localTXList[$i]; + if (defined("ENABLEXTDLOOKUP")) { + if ($listElem[6] == "RF" && ($listElem[1]=="D-Star" || startsWith($listElem[1], "DMR") || $listElem[1]=="YSF" || $listElem[1]=="P25")) { + $listElem[3] = getName($listElem[2]); + if ($listElem[2] !== "??????????") { + if (!is_numeric($listElem[2])) { + if (constant("SHOWQRZ")) { + $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; + } else { + $listElem[2] = "".$listElem[2].""; + } + } else { + $listElem[2] = "".$listElem[2].""; + } + } + array_push($lastHeard, $listElem); + } + } else { + if ($listElem[5] == "RF" && ($listElem[1]=="D-Star" || startsWith($listElem[1], "DMR") || $listElem[1]=="YSF" || $listElem[1]=="P25")) { + if ($listElem[2] !== "??????????") { + if (!is_numeric($listElem[2])) { + if (constant("SHOWQRZ")) { + $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; + } else { + $listElem[2] = "".$listElem[2].""; + } + } else { + $listElem[2] = "".$listElem[2].""; + } + } + array_push($lastHeard, $listElem); + } + } + } + echo '{"data": '.json_encode($lastHeard)."}"; } if ($_GET['section'] == "sysinfo") { - $cputemp = NULL; - $cpufreq = NULL; - if (file_exists ("/sys/class/thermal/thermal_zone0/temp")) { - exec("cat /sys/class/thermal/thermal_zone0/temp", $cputemp); - $cputemp = $cputemp[0] / 1000; - } - showLapTime("cputemp"); - if (file_exists ("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq")) { - exec("cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", $cpufreq); - $cpufreq = $cpufreq[0] / 1000; - } - showLapTime("cpufreq"); + $cputemp = NULL; + $cpufreq = NULL; + if (file_exists ("/sys/class/thermal/thermal_zone0/temp")) { + exec("cat /sys/class/thermal/thermal_zone0/temp", $cputemp); + $cputemp = $cputemp[0] / 1000; + } + showLapTime("cputemp"); + if (file_exists ("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq")) { + exec("cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", $cpufreq); + $cpufreq = $cpufreq[0] / 1000; + } + showLapTime("cpufreq"); - if (defined("TEMPERATUREALERT") && $cputemp > TEMPERATUREHIGHLEVEL && $cputemp !== NULL) { + if (defined("TEMPERATUREALERT") && $cputemp > TEMPERATUREHIGHLEVEL && $cputemp !== NULL) { ?> - + makeLayer('LYR1',x,y,200,100,'red',1,1); + $y) $cpu[$x] = round($y / $total * 100, 1); - $cpuusage = round($cpu['user'] + $cpu['sys'], 2); - showLapTime("cpuusage"); + $output = shell_exec('cat /proc/loadavg'); + $sysload = substr($output,0,strpos($output," "))*100; + showLapTime("sysload"); + $stat1 = file('/proc/stat'); + sleep(1); + $stat2 = file('/proc/stat'); + $info1 = explode(" ", preg_replace("!cpu +!", "", $stat1[0])); + $info2 = explode(" ", preg_replace("!cpu +!", "", $stat2[0])); + $dif = array(); + $dif['user'] = $info2[0] - $info1[0]; + $dif['nice'] = $info2[1] - $info1[1]; + $dif['sys'] = $info2[2] - $info1[2]; + $dif['idle'] = $info2[3] - $info1[3]; + $total = array_sum($dif); + $cpu = array(); + foreach($dif as $x=>$y) $cpu[$x] = round($y / $total * 100, 1); + $cpuusage = round($cpu['user'] + $cpu['sys'], 2); + showLapTime("cpuusage"); - $output = shell_exec('grep -c processor /proc/cpuinfo'); - $cpucores = $output; + $output = shell_exec('grep -c processor /proc/cpuinfo'); + $cpucores = $output; - $output = shell_exec('cat /proc/uptime'); - $uptime = format_time(substr($output,0,strpos($output," "))); - $idletime = format_time((substr($output,strpos($output," ")))/$cpucores); - showLapTime("idletime"); + $output = shell_exec('cat /proc/uptime'); + $uptime = format_time(substr($output,0,strpos($output," "))); + $idletime = format_time((substr($output,strpos($output," ")))/$cpucores); + showLapTime("idletime"); - if (defined("SHOWPOWERSTATE")) { - $pinStatus = trim(shell_exec("gpio -g read ".POWERONLINEPIN)); // Pin 18 - } - //returns 0 = low; 1 = high + if (defined("SHOWPOWERSTATE")) { + $pinStatus = trim(shell_exec("gpio -g read ".POWERONLINEPIN)); // Pin 18 + } + //returns 0 = low; 1 = high ?> - - - Power - - CPU-Temperature - - CPU-Frequency - - System-Load - CPU-Usage - Uptime - Idle - - - - - - °C - - MHz - - % - + + + Power + + CPU-Temperature + + CPU-Frequency + + System-Load + CPU-Usage + Uptime + Idle + + + + + + °C + + MHz + + % + -
= 30 and $cpuusage < 60) - echo "progress-bar-warning"; - if ($cpuusage >= 60) - echo "progress-bar-danger"; +
= 30 and $cpuusage < 60) + echo "progress-bar-warning"; + if ($cpuusage >= 60) + echo "progress-bar-danger"; ?>" role="progressbar" aria-valuenow="" aria-valuemin="0" aria-valuemax="100" style="width: %;">%
- - - - - + + + + + diff --git a/credits.php b/credits.php index 9a0a616..17f6995 100644 --- a/credits.php +++ b/credits.php @@ -1,37 +1,37 @@ - - - - - - - - - - - - - MMDVM-Dashboard by DG9VH - Credits - - - -
-

I think, after all the time this dashboard is developed mainly by myself, it is time to say "Thank you" to all those, wo delivered some ideas or code into this project.

-

This are explicit named following persons:

-
    -
  • df2et
  • -
  • dg1tal
  • -
  • ayasystems
  • -
  • on3yh
  • -
  • g0wfv
  • -
  • dg0cco
  • -
  • sa7bnt
  • -
  • and some others...
  • -
-

Those, who felt forgotten, feel free to comit a change into github of this file.

-

Many thanks to you all!

-

Best 73, Kim, DG9VH

-
- - + + + + + + + + + + + + + MMDVM-Dashboard by DG9VH - Credits + + + +
+

I think, after all the time this dashboard is developed mainly by myself, it is time to say "Thank you" to all those, wo delivered some ideas or code into this project.

+

This are explicit named following persons:

+
    +
  • df2et
  • +
  • dg1tal
  • +
  • ayasystems
  • +
  • on3yh
  • +
  • g0wfv
  • +
  • dg0cco
  • +
  • sa7bnt
  • +
  • and some others...
  • +
+

Those, who felt forgotten, feel free to comit a change into github of this file.

+

Many thanks to you all!

+

Best 73, Kim, DG9VH

+
+ + diff --git a/include/disk.php b/include/disk.php index 6e4ee12..076afa1 100644 --- a/include/disk.php +++ b/include/disk.php @@ -1,60 +1,60 @@
-
Disk Use
- -
- - - - - - - - - - - - +
Disk Use
+ +
+
File SystemMount PointUseFreeUsedTotal
+ + + + + + + + + + + 'N.A', - 'used' => 'N.A', - 'free' => 'N.A', - 'percent_used' => 0, - 'mount' => 'N.A', - 'filesystem' => 'N.A', - ); - } else { - $mounted_points = array(); - $key = 0; - foreach ($df as $mounted) { - list($filesystem, $type, $total, $used, $free, $percent, $mount) = explode(',', $mounted); - if ((strpos($type, 'tmpfs') !== false) && (strpos($mount, '/mnt/ramdisk') === false)) - continue; - ?> - - - - - - - - - 'N.A', + 'used' => 'N.A', + 'free' => 'N.A', + 'percent_used' => 0, + 'mount' => 'N.A', + 'filesystem' => 'N.A', + ); + } else { + $mounted_points = array(); + $key = 0; + foreach ($df as $mounted) { + list($filesystem, $type, $total, $used, $free, $percent, $mount) = explode(',', $mounted); + if ((strpos($type, 'tmpfs') !== false) && (strpos($mount, '/mnt/ramdisk') === false)) + continue; + ?> + + + + + + + + + - -
File SystemMount PointUseFreeUsedTotal
%
%
-
+ + +
diff --git a/include/functions.php b/include/functions.php index 24d6541..0905381 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,199 +1,199 @@ &1", $output); - if (!startsWith(substr($output[0],18,8),"20")) { - showLapTime("getMMDVMHostVersion"); - return getMMDVMHostFileVersion(); - } else { - showLapTime("getMMDVMHostVersion"); - return substr($output[0],18,8)." (compiled ".getMMDVMHostFileVersion().")"; - } + // returns creation-time or version of MMDVMHost as version-number + $filename = MMDVMHOSTPATH."/MMDVMHost"; + exec($filename." -v 2>&1", $output); + if (!startsWith(substr($output[0],18,8),"20")) { + showLapTime("getMMDVMHostVersion"); + return getMMDVMHostFileVersion(); + } else { + showLapTime("getMMDVMHostVersion"); + return substr($output[0],18,8)." (compiled ".getMMDVMHostFileVersion().")"; + } } function getMMDVMHostFileVersion() { - // returns creation-time of MMDVMHost as version-number - $filename = MMDVMHOSTPATH."/MMDVMHost"; - if (file_exists($filename)) { - showLapTime("getMMDVMHostFileVersion"); - return date("d M Y", filectime($filename)); - } + // returns creation-time of MMDVMHost as version-number + $filename = MMDVMHOSTPATH."/MMDVMHost"; + if (file_exists($filename)) { + showLapTime("getMMDVMHostFileVersion"); + return date("d M Y", filectime($filename)); + } } function getFirmwareVersion() { - $logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; - $logLines = explode("\n", `grep "MMDVM protocol version" $logPath`); - $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 (strlen($firmware) > 0) { - $fp = fopen('/tmp/MMDVMFirmware.txt', 'w'); - fwrite($fp, $firmware); - fclose($fp); - } else { - $fp = fopen('/tmp/MMDVMFirmware.txt', 'r'); - $contents = fread($fp, filesize("/tmp/MMDVMFirmware.txt")); - $firmware = $contents; - } - echo $firmware; + $logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; + $logLines = explode("\n", `grep "MMDVM protocol version" $logPath`); + $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 (strlen($firmware) > 0) { + $fp = fopen('/tmp/MMDVMFirmware.txt', 'w'); + fwrite($fp, $firmware); + fclose($fp); + } else { + $fp = fopen('/tmp/MMDVMFirmware.txt', 'r'); + $contents = fread($fp, filesize("/tmp/MMDVMFirmware.txt")); + $firmware = $contents; + } + echo $firmware; } function setDMRNetwork($network) { - $fp = fopen('../config/DMRNetwork.txt', 'w'); - fwrite($fp, $network); - fclose($fp); + $fp = fopen('../config/DMRNetwork.txt', 'w'); + fwrite($fp, $network); + fclose($fp); } function getDMRNetwork() { - $fp = fopen('config/DMRNetwork.txt', 'r'); - $network = fread($fp, filesize("config/DMRNetwork.txt")); - fclose($fp); - return $network; + $fp = fopen('config/DMRNetwork.txt', 'r'); + $network = fread($fp, filesize("config/DMRNetwork.txt")); + fclose($fp); + return $network; } function getDMRNetwork2() { - $fp = fopen('../config/DMRNetwork.txt', 'r'); - $network = fread($fp, filesize("../config/DMRNetwork.txt")); - fclose($fp); - return $network; + $fp = fopen('../config/DMRNetwork.txt', 'r'); + $network = fread($fp, filesize("../config/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`); - $state = -1; - foreach($logLines as $logLine) { - if (strpos($logLine, "successfully") > 0) { - $state = 1; - } - if (strpos($logLine, "Closing") > 0) { - $state = 0; - } - } - if ($state >= 0) { - $fp = fopen('/tmp/DMRMasterState.txt', 'w'); - fwrite($fp, $state); - fclose($fp); - } else { - $fp = fopen('/tmp/DMRMasterState.txt', 'r'); - $contents = fread($fp, filesize("/tmp/DMRMasterState.txt")); - $state = $contents; - } - return $state; + $logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; + $logLines = explode("\n", `egrep -h "(DMR, Logged into the master successfully)|(DMR, Closing DMR Network)" $logPath`); + $state = -1; + foreach($logLines as $logLine) { + if (strpos($logLine, "successfully") > 0) { + $state = 1; + } + if (strpos($logLine, "Closing") > 0) { + $state = 0; + } + } + if ($state >= 0) { + $fp = fopen('/tmp/DMRMasterState.txt', 'w'); + fwrite($fp, $state); + fclose($fp); + } else { + $fp = fopen('/tmp/DMRMasterState.txt', 'r'); + $contents = fread($fp, filesize("/tmp/DMRMasterState.txt")); + $state = $contents; + } + return $state; } function getMMDVMConfig() { - // loads MMDVM.ini into array for further use - $conf = array(); - if ($configs = fopen(MMDVMINIPATH."/".MMDVMINIFILENAME, 'r')) { - while ($config = fgets($configs)) { - array_push($conf, trim ( $config, " \t\n\r\0\x0B")); - } - fclose($configs); - } - return $conf; + // loads MMDVM.ini into array for further use + $conf = array(); + if ($configs = fopen(MMDVMINIPATH."/".MMDVMINIFILENAME, 'r')) { + while ($config = fgets($configs)) { + array_push($conf, trim ( $config, " \t\n\r\0\x0B")); + } + fclose($configs); + } + return $conf; } function getYSFGatewayConfig() { - // loads YSFGateway.ini into array for further use - $conf = array(); - if ($configs = fopen(YSFGATEWAYINIPATH."/".YSFGATEWAYINIFILENAME, 'r')) { - while ($config = fgets($configs)) { - array_push($conf, trim ( $config, " \t\n\r\0\x0B")); - } - fclose($configs); - } - showLapTime("getYSFGatewayConfig"); - return $conf; + // loads YSFGateway.ini into array for further use + $conf = array(); + if ($configs = fopen(YSFGATEWAYINIPATH."/".YSFGATEWAYINIFILENAME, 'r')) { + while ($config = fgets($configs)) { + array_push($conf, trim ( $config, " \t\n\r\0\x0B")); + } + fclose($configs); + } + showLapTime("getYSFGatewayConfig"); + return $conf; } function getCallsign($mmdvmconfigs) { - // returns Callsign from MMDVM-config - return getConfigItem("General", "Callsign", $mmdvmconfigs); + // returns Callsign from MMDVM-config + return getConfigItem("General", "Callsign", $mmdvmconfigs); } function getConfigItem($section, $key, $configs) { - // retrieves the corresponding config-entry within a [section] - $sectionpos = array_search("[" . $section . "]", $configs) + 1; - $len = count($configs); - while(startsWith($configs[$sectionpos],$key."=") === false && $sectionpos <= ($len) ) { - if (startsWith($configs[$sectionpos],"[")) { - return null; - } - $sectionpos++; - } - return substr($configs[$sectionpos], strlen($key) + 1); + // retrieves the corresponding config-entry within a [section] + $sectionpos = array_search("[" . $section . "]", $configs) + 1; + $len = count($configs); + while(startsWith($configs[$sectionpos],$key."=") === false && $sectionpos <= ($len) ) { + if (startsWith($configs[$sectionpos],"[")) { + return null; + } + $sectionpos++; + } + return substr($configs[$sectionpos], strlen($key) + 1); } function getEnabled ($mode, $mmdvmconfigs) { - // returns enabled/disabled-State of mode - return getConfigItem($mode, "Enable", $mmdvmconfigs); + // returns enabled/disabled-State of mode + return getConfigItem($mode, "Enable", $mmdvmconfigs); } function showMode($mode, $mmdvmconfigs) { - // shows if mode is enabled or not. + // shows if mode is enabled or not. ?> "> "-53") $rssi = "
S9+40dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-63") $rssi = "
S9+30dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-73") $rssi = "
S9+20dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-83") $rssi = "
S9+10dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-93") $rssi = "
S9 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-99") $rssi = "
S8 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-105") $rssi = "
S7 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-111") $rssi = "
S6 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-117") $rssi = "
S5 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-123") $rssi = "
S4 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-129") $rssi = "
S3 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-135") $rssi = "
S2 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-141") $rssi = "
S1 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - } - $ber = substr($loss, 5); - $loss = ""; - } else { - $loss = strtok($loss, " "); - if (array_key_exists(4,$lineTokens)) { - $ber = substr($lineTokens[4], 5); - } - if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") { - $rssiString = substr($lineTokens[5], 6); - $rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); - if ($rssiAvg > "-53") $rssi = "
S9+40dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-63") $rssi = "
S9+30dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-73") $rssi = "
S9+20dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-83") $rssi = "
S9+10dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-93") $rssi = "
S9 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-99") $rssi = "
S8 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-105") $rssi = "
S7 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-111") $rssi = "
S6 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-117") $rssi = "
S5 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-123") $rssi = "
S4 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-129") $rssi = "
S3 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-135") $rssi = "
S2 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - else if ($rssiAvg > "-141") $rssi = "
S1 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; - } - } + // if RF-Packet, no LOSS would be reported, so BER is in LOSS position + // and RSSI in BER position + if (startsWith($loss,"BER")) { + if (substr($ber, 6) != "-0/-0/-0 dBm") { + $rssiString = substr($ber, 6); + $rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); + if ($rssiAvg > "-53") $rssi = "
S9+40dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-63") $rssi = "
S9+30dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-73") $rssi = "
S9+20dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-83") $rssi = "
S9+10dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-93") $rssi = "
S9 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-99") $rssi = "
S8 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-105") $rssi = "
S7 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-111") $rssi = "
S6 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-117") $rssi = "
S5 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-123") $rssi = "
S4 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-129") $rssi = "
S3 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-135") $rssi = "
S2 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-141") $rssi = "
S1 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + } + $ber = substr($loss, 5); + $loss = ""; + } else { + $loss = strtok($loss, " "); + if (array_key_exists(4,$lineTokens)) { + $ber = substr($lineTokens[4], 5); + } + if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") { + $rssiString = substr($lineTokens[5], 6); + $rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); + if ($rssiAvg > "-53") $rssi = "
S9+40dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-63") $rssi = "
S9+30dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-73") $rssi = "
S9+20dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-83") $rssi = "
S9+10dB ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-93") $rssi = "
S9 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-99") $rssi = "
S8 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-105") $rssi = "
S7 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-111") $rssi = "
S6 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-117") $rssi = "
S5 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-123") $rssi = "
S4 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-129") $rssi = "
S3 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-135") $rssi = "
S2 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + else if ($rssiAvg > "-141") $rssi = "
S1 ($rssiAvg dBm)(min/max/avg)
$rssiString
"; + } + } - if (strpos($logLine,"ended RF data") || strpos($logLine,"ended network")) { - switch (substr($logLine, 27, strpos($logLine,",") - 27)) { - case "DMR Slot 1": - $ts1duration = "SMS"; - break; - case "DMR Slot 2": - $ts2duration = "SMS"; - break; - } - } else { - switch (substr($logLine, 27, strpos($logLine,",") - 27)) { - case "D-Star": - $dstarduration = $duration; - $dstarloss = $loss; - $dstarber = $ber; - $dstarrssi = $rssi; - break; - case "DMR Slot 1": - $ts1duration = $duration; - $ts1loss = $loss; - $ts1ber = $ber; - $ts1rssi = $rssi; - break; - case "DMR Slot 2": - $ts2duration = $duration; - $ts2loss = $loss; - $ts2ber = $ber; - $ts2rssi = $rssi; - break; - case "YSF": - $ysfduration = $duration; - $ysfloss = $loss; - $ysfber = $ber; - $ysfrssi = $rssi; - break; - case "P25": - $p25duration = $duration; - $p25loss = $loss; - $p25ber = $ber; - $p25rssi = $rssi; - break; - } - } - } + if (strpos($logLine,"ended RF data") || strpos($logLine,"ended network")) { + switch (substr($logLine, 27, strpos($logLine,",") - 27)) { + case "DMR Slot 1": + $ts1duration = "SMS"; + break; + case "DMR Slot 2": + $ts2duration = "SMS"; + break; + } + } else { + switch (substr($logLine, 27, strpos($logLine,",") - 27)) { + case "D-Star": + $dstarduration = $duration; + $dstarloss = $loss; + $dstarber = $ber; + $dstarrssi = $rssi; + break; + case "DMR Slot 1": + $ts1duration = $duration; + $ts1loss = $loss; + $ts1ber = $ber; + $ts1rssi = $rssi; + break; + case "DMR Slot 2": + $ts2duration = $duration; + $ts2loss = $loss; + $ts2ber = $ber; + $ts2rssi = $rssi; + break; + case "YSF": + $ysfduration = $duration; + $ysfloss = $loss; + $ysfber = $ber; + $ysfrssi = $rssi; + break; + case "P25": + $p25duration = $duration; + $p25loss = $loss; + $p25ber = $ber; + $p25rssi = $rssi; + break; + } + } + } - $timestamp = substr($logLine, 3, 19); - $mode = substr($logLine, 27, strpos($logLine,",") - 27); - $callsign2 = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6); - $callsign = $callsign2; - if (strpos($callsign2,"/") > 0) { - $callsign = substr($callsign2, 0, strpos($callsign2,"/")); - } - $callsign = trim($callsign); + $timestamp = substr($logLine, 3, 19); + $mode = substr($logLine, 27, strpos($logLine,",") - 27); + $callsign2 = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6); + $callsign = $callsign2; + if (strpos($callsign2,"/") > 0) { + $callsign = substr($callsign2, 0, strpos($callsign2,"/")); + } + $callsign = trim($callsign); - $id =""; - if ($mode == "D-Star") { - $id = substr($callsign2, strpos($callsign2,"/") + 1); - } + $id =""; + if ($mode == "D-Star") { + $id = substr($callsign2, strpos($callsign2,"/") + 1); + } - $target = substr($logLine, strpos($logLine, "to") + 3); - $source = "RF"; - if (strpos($logLine,"network") > 0 ) { - $source = "Net"; - } + $target = substr($logLine, strpos($logLine, "to") + 3); + $source = "RF"; + if (strpos($logLine,"network") > 0 ) { + $source = "Net"; + } - switch ($mode) { - case "D-Star": - $duration = $dstarduration; - $loss = $dstarloss; - $ber = $dstarber; - $rssi = $dstarrssi; - break; - case "DMR Slot 1": - $duration = $ts1duration; - $loss = $ts1loss; - $ber = $ts1ber; - $rssi = $ts1rssi; - break; - case "DMR Slot 2": - $duration = $ts2duration; - $loss = $ts2loss; - $ber = $ts2ber; - $rssi = $ts2rssi; - break; - case "YSF": - $duration = $ysfduration; - $loss = $ysfloss; - $ber = $ysfber; - $rssi = $ysfrssi; - break; - case "P25": - $duration = $p25duration; - $loss = $p25loss; - $ber = $p25ber; - $rssi = $p25rssi; - break; - } + switch ($mode) { + case "D-Star": + $duration = $dstarduration; + $loss = $dstarloss; + $ber = $dstarber; + $rssi = $dstarrssi; + break; + case "DMR Slot 1": + $duration = $ts1duration; + $loss = $ts1loss; + $ber = $ts1ber; + $rssi = $ts1rssi; + break; + case "DMR Slot 2": + $duration = $ts2duration; + $loss = $ts2loss; + $ber = $ts2ber; + $rssi = $ts2rssi; + break; + case "YSF": + $duration = $ysfduration; + $loss = $ysfloss; + $ber = $ysfber; + $rssi = $ysfrssi; + break; + case "P25": + $duration = $p25duration; + $loss = $p25loss; + $ber = $p25ber; + $rssi = $p25rssi; + break; + } - // Callsign or ID should be less than 11 chars long, otherwise it could be errorneous - if ( strlen($callsign) < 11 ) { - $name = ""; - if (defined("ENABLEXTDLOOKUP")) { - array_push($heardList, array(convertTimezone($timestamp), $mode, $callsign, $name, $id, $target, $source, $duration, $loss, $ber, $rssi)); - } else { - array_push($heardList, array(convertTimezone($timestamp), $mode, $callsign, $id, $target, $source, $duration, $loss, $ber, $rssi)); - } - $duration = ""; - $loss =""; - $ber = ""; - $rssi = ""; - if ($onlyLast && count($heardList )> 4) { - return $heardList; - } - } - } - return $heardList; + // Callsign or ID should be less than 11 chars long, otherwise it could be errorneous + if ( strlen($callsign) < 11 ) { + $name = ""; + if (defined("ENABLEXTDLOOKUP")) { + array_push($heardList, array(convertTimezone($timestamp), $mode, $callsign, $name, $id, $target, $source, $duration, $loss, $ber, $rssi)); + } else { + array_push($heardList, array(convertTimezone($timestamp), $mode, $callsign, $id, $target, $source, $duration, $loss, $ber, $rssi)); + } + $duration = ""; + $loss =""; + $ber = ""; + $rssi = ""; + if ($onlyLast && count($heardList )> 4) { + return $heardList; + } + } + } + return $heardList; } function getLastHeard($logLines, $onlyLast) { - //returns last heard list from log - $lastHeard = array(); - $heardCalls = array(); - $heardList = getHeardList($logLines, $onlyLast); - $counter = 0; - foreach ($heardList as $listElem) { - if ( ($listElem[1] == "D-Star") || ($listElem[1] == "YSF") || ($listElem[1] == "P25") || (startsWith($listElem[1], "DMR")) ) { - if(!(array_search($listElem[2]."#".$listElem[1].$listElem[4], $heardCalls) > -1)) { - array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[4]); - if (defined("ENABLEXTDLOOKUP")) { - if ($listElem[2] !== "??????????") { - //$listElem[3] = "Dummy"; //Should speed up this function - time-issue! - $listElem[3] = getName($listElem[2]); //Should speed up this function - time-issue! - } else { - $listElem[3] = "---"; - } - } - if ($listElem[2] !== "??????????") { - if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { - $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; - } else { - $listElem[2] = "".$listElem[2].""; - } - } else { - $listElem[2] = "".$listElem[2].""; - } - } - array_push($lastHeard, $listElem); - $counter++; - } - } - } - return $lastHeard; + //returns last heard list from log + $lastHeard = array(); + $heardCalls = array(); + $heardList = getHeardList($logLines, $onlyLast); + $counter = 0; + foreach ($heardList as $listElem) { + if ( ($listElem[1] == "D-Star") || ($listElem[1] == "YSF") || ($listElem[1] == "P25") || (startsWith($listElem[1], "DMR")) ) { + if(!(array_search($listElem[2]."#".$listElem[1].$listElem[4], $heardCalls) > -1)) { + array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[4]); + if (defined("ENABLEXTDLOOKUP")) { + if ($listElem[2] !== "??????????") { + //$listElem[3] = "Dummy"; //Should speed up this function - time-issue! + $listElem[3] = getName($listElem[2]); //Should speed up this function - time-issue! + } else { + $listElem[3] = "---"; + } + } + if ($listElem[2] !== "??????????") { + if (!is_numeric($listElem[2])) { + if (constant("SHOWQRZ")) { + $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; + } else { + $listElem[2] = "".$listElem[2].""; + } + } else { + $listElem[2] = "".$listElem[2].""; + } + } + array_push($lastHeard, $listElem); + $counter++; + } + } + } + return $lastHeard; } function getActualMode($metaLastHeard, $mmdvmconfigs) { - // returns mode of repeater actual working in - $listElem = $metaLastHeard[0]; - $timestamp = new DateTime($listElem[0],new DateTimeZone(TIMEZONE)); - - $mode = $listElem[1]; - if (startsWith($mode, "DMR")) { - $mode = "DMR"; - } - if (defined("ENABLEXTDLOOKUP") && $listElem[7] == null || !defined("ENABLEXTDLOOKUP") && $listElem[6] == null) { - return "".$mode.""; - } else { - $now = new DateTime('NOW',new DateTimeZone(TIMEZONE)); - $hangtime = getConfigItem("General", "ModeHang", $mmdvmconfigs); + // returns mode of repeater actual working in + $listElem = $metaLastHeard[0]; + $timestamp = new DateTime($listElem[0],new DateTimeZone(TIMEZONE)); + + $mode = $listElem[1]; + if (startsWith($mode, "DMR")) { + $mode = "DMR"; + } + if (defined("ENABLEXTDLOOKUP") && $listElem[7] == null || !defined("ENABLEXTDLOOKUP") && $listElem[6] == null) { + return "".$mode.""; + } else { + $now = new DateTime('NOW',new DateTimeZone(TIMEZONE)); + $hangtime = getConfigItem("General", "ModeHang", $mmdvmconfigs); - if ($hangtime != "") { - $timestamp->add(new DateInterval('PT' . $hangtime . 'S')); - } else { - $source = $listElem[6]; - if ($source === "Network") { - $hangtime = getConfigItem("General", "NetModeHang", $mmdvmconfigs); - } else { - $hangtime = getConfigItem("General", "RFModeHang", $mmdvmconfigs); - } - $timestamp->add(new DateInterval('PT' . $hangtime . 'S')); - } - if ($now->format('U') > $timestamp->format('U')) { - return "idle"; - } else { - return "".$mode.""; - } - } + if ($hangtime != "") { + $timestamp->add(new DateInterval('PT' . $hangtime . 'S')); + } else { + $source = $listElem[6]; + if ($source === "Network") { + $hangtime = getConfigItem("General", "NetModeHang", $mmdvmconfigs); + } else { + $hangtime = getConfigItem("General", "RFModeHang", $mmdvmconfigs); + } + $timestamp->add(new DateInterval('PT' . $hangtime . 'S')); + } + if ($now->format('U') > $timestamp->format('U')) { + return "idle"; + } else { + return "".$mode.""; + } + } } function getDSTARLinks() { - // returns link-states of all D-Star-modules - if (filesize(LINKLOGPATH."/Links.log") == 0) { - return "not linked"; - } - $out = ""; - if ($linkLog = fopen(LINKLOGPATH."/Links.log",'r')) { - while ($linkLine = fgets($linkLog)) { - $linkDate = " "; - $protocol = " "; - $linkType = " "; - $linkSource = " "; - $linkDest = " "; - $linkDir = " "; + // returns link-states of all D-Star-modules + if (filesize(LINKLOGPATH."/Links.log") == 0) { + return "not linked"; + } + $out = "
"; + if ($linkLog = fopen(LINKLOGPATH."/Links.log",'r')) { + while ($linkLine = fgets($linkLog)) { + $linkDate = " "; + $protocol = " "; + $linkType = " "; + $linkSource = " "; + $linkDest = " "; + $linkDir = " "; // Reflector-Link, sample: -// 2011-09-22 02:15:06: DExtra link - Type: Repeater Rptr: DB0LJ B Refl: XRF023 A Dir: Outgoing +// 2011-09-22 02:15:06: DExtra link - Type: Repeater Rptr: DB0LJ B Refl: XRF023 A Dir: Outgoing // 2012-04-03 08:40:07: DPlus link - Type: Dongle Rptr: DB0ERK B Refl: REF006 D Dir: Outgoing // 2012-04-03 08:40:07: DCS link - Type: Repeater Rptr: DB0ERK C Refl: DCS001 C Dir: Outgoing - if(preg_match_all('/^(.{19}).*(D[A-Za-z]*).*Type: ([A-Za-z]*).*Rptr: (.{8}).*Refl: (.{8}).*Dir: (.{8})/',$linkLine,$linx) > 0){ - $linkDate = $linx[1][0]; - $protocol = $linx[2][0]; - $linkType = $linx[3][0]; - $linkSource = $linx[4][0]; - $linkDest = $linx[5][0]; - $linkDir = $linx[6][0]; - } + if(preg_match_all('/^(.{19}).*(D[A-Za-z]*).*Type: ([A-Za-z]*).*Rptr: (.{8}).*Refl: (.{8}).*Dir: (.{8})/',$linkLine,$linx) > 0){ + $linkDate = $linx[1][0]; + $protocol = $linx[2][0]; + $linkType = $linx[3][0]; + $linkSource = $linx[4][0]; + $linkDest = $linx[5][0]; + $linkDir = $linx[6][0]; + } // CCS-Link, sample: -// 2013-03-30 23:21:53: CCS link - Rptr: PE1AGO C Remote: PE1KZU Dir: Incoming - if(preg_match_all('/^(.{19}).*(CC[A-Za-z]*).*Rptr: (.{8}).*Remote: (.{8}).*Dir: (.{8})/',$linkLine,$linx) > 0){ - $linkDate = $linx[1][0]; - $protocol = $linx[2][0]; - $linkType = $linx[2][0]; - $linkSource = $linx[3][0]; - $linkDest = $linx[4][0]; - $linkDir = $linx[5][0]; - } +// 2013-03-30 23:21:53: CCS link - Rptr: PE1AGO C Remote: PE1KZU Dir: Incoming + if(preg_match_all('/^(.{19}).*(CC[A-Za-z]*).*Rptr: (.{8}).*Remote: (.{8}).*Dir: (.{8})/',$linkLine,$linx) > 0){ + $linkDate = $linx[1][0]; + $protocol = $linx[2][0]; + $linkType = $linx[2][0]; + $linkSource = $linx[3][0]; + $linkDest = $linx[4][0]; + $linkDir = $linx[5][0]; + } // Dongle-Link, sample: -// 2011-09-24 07:26:59: DPlus link - Type: Dongle User: DC1PIA Dir: Incoming +// 2011-09-24 07:26:59: DPlus link - Type: Dongle User: DC1PIA Dir: Incoming // 2012-03-14 21:32:18: DPlus link - Type: Dongle User: DC1PIA Dir: Incoming - if(preg_match_all('/^(.{19}).*(D[A-Za-z]*).*Type: ([A-Za-z]*).*User: (.{6,8}).*Dir: (.*)$/',$linkLine,$linx) > 0){ - $linkDate = $linx[1][0]; - $protocol = $linx[2][0]; - $linkType = $linx[3][0]; - $linkSource = " "; - $linkDest = $linx[4][0]; - $linkDir = $linx[5][0]; - } - $out .= ""; - } - } - $out .= "
" . $linkSource . " " . $protocol . "-link to " . $linkDest . " " . $linkDir . "
"; + if(preg_match_all('/^(.{19}).*(D[A-Za-z]*).*Type: ([A-Za-z]*).*User: (.{6,8}).*Dir: (.*)$/',$linkLine,$linx) > 0){ + $linkDate = $linx[1][0]; + $protocol = $linx[2][0]; + $linkType = $linx[3][0]; + $linkSource = " "; + $linkDest = $linx[4][0]; + $linkDir = $linx[5][0]; + } + $out .= "" . $linkSource . " " . $protocol . "-link to " . $linkDest . " " . $linkDir . ""; + } + } + $out .= ""; - fclose($linkLog); - return $out; + fclose($linkLog); + return $out; } function getActualLink($logLines, $mode) { - // returns actual link state of specific mode + // returns actual link state of specific mode //M: 2016-05-02 07:04:10.504 D-Star link status set to "Verlinkt zu DCS002 S" //M: 2016-04-03 16:16:18.638 DMR Slot 2, received network voice header from 4000 to 2625094 //M: 2016-04-03 19:30:03.099 DMR Slot 2, received network voice header from 4020 to 2625094 - switch ($mode) { - case "D-Star": - if (isProcessRunning(IRCDDBGATEWAY)) { - return getDSTARLinks(); - } else { - return "ircddbgateway not running!"; - } - break; - case "DMR Slot 1": - foreach ($logLines as $logLine) { - if(strpos($logLine,"unable to decode the network CSBK")) { - continue; - } else if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 1") { - $to = ""; - if (strpos($logLine,"to")) { - $to = trim(substr($logLine, strpos($logLine,"to") + 3)); - } - if ($to !== "") { - return $to; - } - } - } - return "not linked"; - break; - case "DMR Slot 2": - foreach ($logLines as $logLine) { - if(strpos($logLine,"unable to decode the network CSBK")) { - continue; - } else if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") { - $to = ""; - if (strpos($logLine,"to")) { - $to = trim(substr($logLine, strpos($logLine,"to") + 3)); - } - if ($to !== "") { - return $to; - } - } - } - return "not linked"; - break; - case "YSF": + switch ($mode) { + case "D-Star": + if (isProcessRunning(IRCDDBGATEWAY)) { + return getDSTARLinks(); + } else { + return "ircddbgateway not running!"; + } + break; + case "DMR Slot 1": + foreach ($logLines as $logLine) { + if(strpos($logLine,"unable to decode the network CSBK")) { + continue; + } else if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 1") { + $to = ""; + if (strpos($logLine,"to")) { + $to = trim(substr($logLine, strpos($logLine,"to") + 3)); + } + if ($to !== "") { + return $to; + } + } + } + return "not linked"; + break; + case "DMR Slot 2": + foreach ($logLines as $logLine) { + if(strpos($logLine,"unable to decode the network CSBK")) { + continue; + } else if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") { + $to = ""; + if (strpos($logLine,"to")) { + $to = trim(substr($logLine, strpos($logLine,"to") + 3)); + } + if ($to !== "") { + return $to; + } + } + } + return "not linked"; + break; + case "YSF": // 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122 // 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 // M: 2016-09-25 16:08:05.811 Connect to 62829 has been requested by DG9VH // M: 2016-10-01 17:52:36.586 Automatic connection to 62829 - if (isProcessRunning("YSFGateway")) { - foreach($logLines as $logLine) { - $to = ""; - if (strpos($logLine,"Connect to")) { - $to = substr($logLine, 38, 5); - } - if (strpos($logLine,"Automatic connection to")) { - $to = substr($logLine, 51, 5); - } - if ($to !== "") { - return $to; - } - if (strpos($logLine,"Starting YSFGateway")) { - $to = -1; - } - if (strpos($logLine,"DISCONNECT Reply")) { - $to = -1; - } - } - return -1; - break; - } else { - return -2; - break; - } + if (isProcessRunning("YSFGateway")) { + foreach($logLines as $logLine) { + $to = ""; + if (strpos($logLine,"Connect to")) { + $to = substr($logLine, 38, 5); + } + if (strpos($logLine,"Automatic connection to")) { + $to = substr($logLine, 51, 5); + } + if ($to !== "") { + return $to; + } + if (strpos($logLine,"Starting YSFGateway")) { + $to = -1; + } + if (strpos($logLine,"DISCONNECT Reply")) { + $to = -1; + } + } + return -1; + break; + } else { + return -2; + break; + } - } - return "something went wrong!"; + } + return "something went wrong!"; } function getActualReflector($logLines, $mode) { - // returns actual link state of specific mode + // returns actual link state of specific mode //M: 2016-05-02 07:04:10.504 D-Star link status set to "Verlinkt zu DCS002 S" //M: 2016-04-03 16:16:18.638 DMR Slot 2, received network voice header from 4000 to 2625094 //M: 2016-04-03 19:30:03.099 DMR Slot 2, received network voice header from 4020 to 2625094 - foreach ($logLines as $logLine) { - if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") { - $from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6); + foreach ($logLines as $logLine) { + if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") { + $from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6); - if (strlen($from) == 4 && startsWith($from,"4")) { - if ($from == "4000") { - return "Reflector not linked"; - } else { - return "Reflector ".$from; - } - } - $source = "RF"; - if (strpos($logLine,"network") > 0 ) { - $source = "Net"; - } + if (strlen($from) == 4 && startsWith($from,"4")) { + if ($from == "4000") { + return "Reflector not linked"; + } else { + return "Reflector ".$from; + } + } + $source = "RF"; + if (strpos($logLine,"network") > 0 ) { + $source = "Net"; + } - if ( $source == "RF") { - $to = substr($logLine, strpos($logLine, "to") + 3); - if (strlen($to) < 6 && startsWith($to, "4")) { - return "Reflector ".$to." (not cfmd)"; - } - } - } - } - return "Reflector not linked"; + if ( $source == "RF") { + $to = substr($logLine, strpos($logLine, "to") + 3); + if (strlen($to) < 6 && startsWith($to, "4")) { + return "Reflector ".$to." (not cfmd)"; + } + } + } + } + return "Reflector not linked"; } function getActiveYSFReflectors() { - $reflectorlist = Array(); - $file = fopen(YSFHOSTSPATH."/".YSFHOSTSFILENAME, 'r'); - if ($file) { - while (($line = fgetcsv($file, 1000, ";")) !== FALSE) { - array_push($reflectorlist, array($line[1], $line[2], $line[0], $line[5])); - } - } - fclose($file); - return $reflectorlist; + $reflectorlist = Array(); + $file = fopen(YSFHOSTSPATH."/".YSFHOSTSFILENAME, 'r'); + if ($file) { + while (($line = fgetcsv($file, 1000, ";")) !== FALSE) { + array_push($reflectorlist, array($line[1], $line[2], $line[0], $line[5])); + } + } + fclose($file); + return $reflectorlist; } function getYSFReflectorById($id, $reflectors) { - if ($id ==-1) { - return "not linked"; - } else if ($id == -2 ) { - return "YSFGateway not running"; - } else { - foreach($reflectors as $reflector) { - if ($reflector[2] === $id) { - return $reflector[0]; - } - } - } + if ($id ==-1) { + return "not linked"; + } else if ($id == -2 ) { + return "YSFGateway not running"; + } else { + foreach($reflectors as $reflector) { + if ($reflector[2] === $id) { + return $reflector[0]; + } + } + } } /* function getNames($delimiter) { - if (!isset($_SESSION['dmrIDs'])) { - $dmrIDs = Array(); - $file = fopen(DMRIDDATPATH, 'r'); - if ($file) { - while (($line = fgetcsv($file, 1000, $delimiter)) !== FALSE) { - array_push($dmrIDs, array('id'=>$line[0], 'callsign'=>$line[1], 'name'=>$line[2])); - } - } - $_SESSION['dmrIDs'] = $dmrIDs; - } + if (!isset($_SESSION['dmrIDs'])) { + $dmrIDs = Array(); + $file = fopen(DMRIDDATPATH, 'r'); + if ($file) { + while (($line = fgetcsv($file, 1000, $delimiter)) !== FALSE) { + array_push($dmrIDs, array('id'=>$line[0], 'callsign'=>$line[1], 'name'=>$line[2])); + } + } + $_SESSION['dmrIDs'] = $dmrIDs; + } } function getName($callsign) { - $dmrIDs = $_SESSION['dmrIDs']; - $key = array_search("$callsign", array_column($dmrIDs, 'callsign')); - //return $key; - $dmrID = $_SESSION['dmrIDs'][$key]; - //var_dump($dmrID); - return $dmrID['name']; + $dmrIDs = $_SESSION['dmrIDs']; + $key = array_search("$callsign", array_column($dmrIDs, 'callsign')); + //return $key; + $dmrID = $_SESSION['dmrIDs'][$key]; + //var_dump($dmrID); + return $dmrID['name']; } function getName($callsign) { -// var_dump($_SESSION['dmrIDs']); - foreach ($_SESSION['dmrIDs'] as $dmrID) { - if ($dmrID[1] == $callsign) { - return $dmrID[2]; - } - } - return "---"; +// var_dump($_SESSION['dmrIDs']); + foreach ($_SESSION['dmrIDs'] as $dmrID) { + if ($dmrID[1] == $callsign) { + return $dmrID[2]; + } + } + return "---"; } */ function getName($callsign) { - if (is_numeric($callsign)) { - return "---"; - } + if (is_numeric($callsign)) { + return "---"; + } - if (file_exists(DMRIDDATPATH)) { - $callsign = trim($callsign); - if (strpos($callsign,"-")) { - $callsign = substr($callsign,0,strpos($callsign,"-")); - } - $delimiter =" "; - exec("grep -P '".$callsign.$delimiter."' ".DMRIDDATPATH, $output); - if (count($output) == 0) { - $delimiter = "\t"; - exec("grep -P '".$callsign.$delimiter."' ".DMRIDDATPATH, $output); - } - if (count($output) !== 0) { - $name = substr($output[0], strpos($output[0],$delimiter)+1); - $name = substr($name, strpos($name,$delimiter)+1); - return $name; - } else - return "---"; - } else { - return "DMRIDs.dat not correct!"; - } + if (file_exists(DMRIDDATPATH)) { + $callsign = trim($callsign); + if (strpos($callsign,"-")) { + $callsign = substr($callsign,0,strpos($callsign,"-")); + } + $delimiter =" "; + exec("grep -P '".$callsign.$delimiter."' ".DMRIDDATPATH, $output); + if (count($output) == 0) { + $delimiter = "\t"; + exec("grep -P '".$callsign.$delimiter."' ".DMRIDDATPATH, $output); + } + if (count($output) !== 0) { + $name = substr($output[0], strpos($output[0],$delimiter)+1); + $name = substr($name, strpos($name,$delimiter)+1); + return $name; + } else + return "---"; + } else { + return "DMRIDs.dat not correct!"; + } } ?> diff --git a/include/init.php b/include/init.php index 9a190a0..ba76f44 100644 --- a/include/init.php +++ b/include/init.php @@ -2,9 +2,9 @@ //Some basic inits $mmdvmconfigs = getMMDVMConfig(); if (!defined("MMDVMLOGPREFIX")) - define("MMDVMLOGPREFIX", getConfigItem("Log", "FileRoot", $mmdvmconfigs)); + define("MMDVMLOGPREFIX", getConfigItem("Log", "FileRoot", $mmdvmconfigs)); if (!defined("TIMEZONE")) - define("TIMEZONE", "UTC"); + define("TIMEZONE", "UTC"); $logLinesMMDVM = getMMDVMLog(); showLapTime("getMMDVMLog"); //getNames(" "); @@ -19,12 +19,12 @@ showLapTime("getLastHeard"); //$_SESSION['lastHeard'] = $lastHeard; if (defined("ENABLEYSFGATEWAY")) { - $logLinesYSFGateway = getYSFGatewayLog(); - showLapTime("getYSFGatewayLog"); - $reverseLogLinesYSFGateway = $logLinesYSFGateway; - array_multisort($reverseLogLinesYSFGateway,SORT_DESC); - showLapTime("array_multisort"); - $activeYSFReflectors = getActiveYSFReflectors(); - showLapTime("getActiveYSFReflectors"); + $logLinesYSFGateway = getYSFGatewayLog(); + showLapTime("getYSFGatewayLog"); + $reverseLogLinesYSFGateway = $logLinesYSFGateway; + array_multisort($reverseLogLinesYSFGateway,SORT_DESC); + showLapTime("array_multisort"); + $activeYSFReflectors = getActiveYSFReflectors(); + showLapTime("getActiveYSFReflectors"); } ?> diff --git a/include/lh.php b/include/lh.php index 4307524..6e50b4c 100644 --- a/include/lh.php +++ b/include/lh.php @@ -1,74 +1,74 @@ - -
- -
Last Heard List of today's callsigns.
- -
- - - - - - - - - - - - - - - - - - -"; - echo""; - echo""; - if ($listElem[2] !== "??????????") { - if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { - echo""; - } else { - echo""; - } - } else { - echo""; - } - } - if (defined("ENABLEXTDLOOKUP")) { - echo ""; - } - echo""; - echo""; - if ($listElem[5] == "RF"){ - echo ""; - }else{ - echo""; - } - if ($listElem[6] == null) { - echo''; - } else if ($listElem[6] == "SMS") { - echo''; - } else { - echo""; - echo""; - echo""; - } - echo"\n"; - } -?> - -
Time (UTC)ModeCallsignNameDSTAR-IDTargetSourceDur (s)LossBER
$listElem[0]$listElem[1]".str_replace("0","Ø",$listElem[2])."".$listElem[2]."".$listElem[2]."".getName($listElem[2])."$listElem[3]$listElem[4]RF$listElem[5]transmittingsending or receiving SMS$listElem[6]$listElem[7]$listElem[8]
-
-
- + +
+ +
Last Heard List of today's callsigns.
+ +
+ + + + + + + + + + + + + + + + + + +"; + echo""; + echo""; + if ($listElem[2] !== "??????????") { + if (!is_numeric($listElem[2])) { + if (constant("SHOWQRZ")) { + echo""; + } else { + echo""; + } + } else { + echo""; + } + } + if (defined("ENABLEXTDLOOKUP")) { + echo ""; + } + echo""; + echo""; + if ($listElem[5] == "RF"){ + echo ""; + }else{ + echo""; + } + if ($listElem[6] == null) { + echo''; + } else if ($listElem[6] == "SMS") { + echo''; + } else { + echo""; + echo""; + echo""; + } + echo"\n"; + } +?> + +
Time (UTC)ModeCallsignNameDSTAR-IDTargetSourceDur (s)LossBER
$listElem[0]$listElem[1]".str_replace("0","Ø",$listElem[2])."".$listElem[2]."".$listElem[2]."".getName($listElem[2])."$listElem[3]$listElem[4]RF$listElem[5]transmittingsending or receiving SMS$listElem[6]$listElem[7]$listElem[8]
+
+
+ diff --git a/include/lh_ajax.php b/include/lh_ajax.php index b45406f..fe75b10 100644 --- a/include/lh_ajax.php +++ b/include/lh_ajax.php @@ -1,59 +1,59 @@ - -
- -
Last Heard List of today's callsigns.
- -
- - - - - - - - - - - - - - - - - -
Time ()ModeCallsignNameDSTAR-IDTargetSourceDur (s)LossBER
-
-
- + +
+ +
Last Heard List of today's callsigns.
+ +
+ + + + + + + + + + + + + + + + + +
Time ()ModeCallsignNameDSTAR-IDTargetSourceDur (s)LossBER
+
+
+ diff --git a/include/localtx.php b/include/localtx.php index 2553e03..3913dd6 100644 --- a/include/localtx.php +++ b/include/localtx.php @@ -1,77 +1,77 @@ - -
- -
Today's local transmissions
- -
- - - - - - - - - - - - - - - - - - - -"; - echo""; - echo""; - if ($listElem[2] !== "??????????") { - if (!is_numeric($listElem[2])) { - if (constant("SHOWQRZ")) { - echo""; - } else { - echo""; - } - } else { - echo""; - } - } - if (defined("ENABLEXTDLOOKUP")) { - echo ""; - } - echo""; - echo""; - echo""; - if ($listElem[6] == null) { - echo''; - } else if ($listElem[7] == "SMS") { - echo''; - } else { - echo""; - echo""; - echo""; - } - echo"\n"; - } -} - -?> - -
Time (UTC)ModeCallsignNameDSTAR-IDTargetSourceDur (s)LossBERRSSI
$listElem[0]$listElem[1]".str_replace("0","Ø",$listElem[2])."".$listElem[2]."".$listElem[2]."$listElem[3]$listElem[4]$listElem[5]$listElem[6]in TXsending or receiving SMS$listElem[7]$listElem[8]$listElem[9]
-
-
- + +
+ +
Today's local transmissions
+ +
+ + + + + + + + + + + + + + + + + + + +"; + echo""; + echo""; + if ($listElem[2] !== "??????????") { + if (!is_numeric($listElem[2])) { + if (constant("SHOWQRZ")) { + echo""; + } else { + echo""; + } + } else { + echo""; + } + } + if (defined("ENABLEXTDLOOKUP")) { + echo ""; + } + echo""; + echo""; + echo""; + if ($listElem[6] == null) { + echo''; + } else if ($listElem[7] == "SMS") { + echo''; + } else { + echo""; + echo""; + echo""; + } + echo"\n"; + } +} + +?> + +
Time (UTC)ModeCallsignNameDSTAR-IDTargetSourceDur (s)LossBERRSSI
$listElem[0]$listElem[1]".str_replace("0","Ø",$listElem[2])."".$listElem[2]."".$listElem[2]."$listElem[3]$listElem[4]$listElem[5]$listElem[6]in TXsending or receiving SMS$listElem[7]$listElem[8]$listElem[9]
+
+
+ diff --git a/include/localtx_ajax.php b/include/localtx_ajax.php index 8ab6e36..a14284d 100644 --- a/include/localtx_ajax.php +++ b/include/localtx_ajax.php @@ -1,61 +1,61 @@ - -
- -
Today's local transmissions
- -
- - - - - - - - - - - - - - - - - - -
Time ()ModeCallsignNameDSTAR-IDTargetSourceDur (s)LossBERRSSI
-
-
- + +
+ +
Today's local transmissions
+ +
+ + + + + + + + + + + + + + + + + + +
Time ()ModeCallsignNameDSTAR-IDTargetSourceDur (s)LossBERRSSI
+
+
+ diff --git a/include/modes.php b/include/modes.php index 1ab5d20..bd76a75 100644 --- a/include/modes.php +++ b/include/modes.php @@ -1,19 +1,19 @@ -
- -
Enabled Modes
- -
- - - - - - - - - - - -
-
-
+
+ +
Enabled Modes
+ +
+ + + + + + + + + + + +
+
+
diff --git a/include/repeaterinfo.php b/include/repeaterinfo.php index 5b49a63..7d34ccd 100644 --- a/include/repeaterinfo.php +++ b/include/repeaterinfo.php @@ -1,98 +1,98 @@ -
- -
Repeater Info
- -
- - - - - - - - -"; - echo""; - echo""; - echo""; - echo""; - echo""; - echo"\n"; -?> - - - -
Current ModeD-Star linked toYSF linked toDMR TS1 last linked toDMR TS2 last linked to
".getActualMode($lastHeard, $mmdvmconfigs)."".getActualLink($reverseLogLinesMMDVM, "D-Star")."".getYSFReflectorById(getActualLink($reverseLogLinesYSFGateway, "YSF"), $activeYSFReflectors)."".getActualLink($reverseLogLinesMMDVM, "DMR Slot 1")."".getActualLink($reverseLogLinesMMDVM, "DMR Slot 2")."/". getActualReflector($reverseLogLinesMMDVM, "DMR Slot 2") ."
- - - - - - - - - - - - - - - -"; - echo""; - echo""; - echo""; - if (getEnabled("System Fusion Network", $mmdvmconfigs) == 1) { - echo""; - } - if (getEnabled("DMR", $mmdvmconfigs) == 1) { - echo""; - if (getEnabled("DMR Network", $mmdvmconfigs) == 1) { - echo" - - - - -
LocationTX-Freq.RX-Freq.YSFGatewayDMR CCDMR-MasterTS1TS2
".getConfigItem("Info", "Location", $mmdvmconfigs)."".getMHZ(getConfigItem("Info", "TXFrequency", $mmdvmconfigs))."".getMHZ(getConfigItem("Info", "RXFrequency", $mmdvmconfigs))."".getConfigItem("System Fusion Network", "GwyAddress", $mmdvmconfigs)."".getConfigItem("DMR", "ColorCode", $mmdvmconfigs).""; - if (getDMRMasterState()) { - echo ""; - } else { - echo ""; - } - echo getConfigItem("DMR Network", "Address", $mmdvmconfigs); - if (strlen(getDMRNetwork()) > 0 ) { - echo " (".getDMRNetwork().")"; - } -?> - - enabled'; - } else { - echo 'label-default">disabled'; - } - ?>enabled'; - } else { - echo 'label-default">disabled'; - } - ?>
-
-
-
+
+ +
Repeater Info
+ +
+ + + + + + + + +"; + echo""; + echo""; + echo""; + echo""; + echo""; + echo"\n"; +?> + + + +
Current ModeD-Star linked toYSF linked toDMR TS1 last linked toDMR TS2 last linked to
".getActualMode($lastHeard, $mmdvmconfigs)."".getActualLink($reverseLogLinesMMDVM, "D-Star")."".getYSFReflectorById(getActualLink($reverseLogLinesYSFGateway, "YSF"), $activeYSFReflectors)."".getActualLink($reverseLogLinesMMDVM, "DMR Slot 1")."".getActualLink($reverseLogLinesMMDVM, "DMR Slot 2")."/". getActualReflector($reverseLogLinesMMDVM, "DMR Slot 2") ."
+ + + + + + + + + + + + + + + +"; + echo""; + echo""; + echo""; + if (getEnabled("System Fusion Network", $mmdvmconfigs) == 1) { + echo""; + } + if (getEnabled("DMR", $mmdvmconfigs) == 1) { + echo""; + if (getEnabled("DMR Network", $mmdvmconfigs) == 1) { + echo" + + + + +
LocationTX-Freq.RX-Freq.YSFGatewayDMR CCDMR-MasterTS1TS2
".getConfigItem("Info", "Location", $mmdvmconfigs)."".getMHZ(getConfigItem("Info", "TXFrequency", $mmdvmconfigs))."".getMHZ(getConfigItem("Info", "RXFrequency", $mmdvmconfigs))."".getConfigItem("System Fusion Network", "GwyAddress", $mmdvmconfigs)."".getConfigItem("DMR", "ColorCode", $mmdvmconfigs).""; + if (getDMRMasterState()) { + echo ""; + } else { + echo ""; + } + echo getConfigItem("DMR Network", "Address", $mmdvmconfigs); + if (strlen(getDMRNetwork()) > 0 ) { + echo " (".getDMRNetwork().")"; + } +?> + + enabled'; + } else { + echo 'label-default">disabled'; + } + ?>enabled'; + } else { + echo 'label-default">disabled'; + } + ?>
+
+
+
diff --git a/include/sysinfo.php b/include/sysinfo.php index 81f1bfb..ab55b18 100644 --- a/include/sysinfo.php +++ b/include/sysinfo.php @@ -1,180 +1,180 @@ TEMPERATUREHIGHLEVEL && $cputemp !== NULL) { + if (defined("TEMPERATUREALERT") && $cputemp > TEMPERATUREHIGHLEVEL && $cputemp !== NULL) { ?> - + makeLayer('LYR1',x,y,200,100,'red',1,1); + $y) $cpu[$x] = round($y / $total * 100, 1); - $cpuusage = round($cpu['user'] + $cpu['sys'], 2); - showLapTime("cpuusage"); + $output = shell_exec('cat /proc/loadavg'); + $sysload = substr($output,0,strpos($output," "))*100; + showLapTime("sysload"); + $stat1 = file('/proc/stat'); + sleep(1); + $stat2 = file('/proc/stat'); + $info1 = explode(" ", preg_replace("!cpu +!", "", $stat1[0])); + $info2 = explode(" ", preg_replace("!cpu +!", "", $stat2[0])); + $dif = array(); + $dif['user'] = $info2[0] - $info1[0]; + $dif['nice'] = $info2[1] - $info1[1]; + $dif['sys'] = $info2[2] - $info1[2]; + $dif['idle'] = $info2[3] - $info1[3]; + $total = array_sum($dif); + $cpu = array(); + foreach($dif as $x=>$y) $cpu[$x] = round($y / $total * 100, 1); + $cpuusage = round($cpu['user'] + $cpu['sys'], 2); + showLapTime("cpuusage"); - $output = shell_exec('grep -c processor /proc/cpuinfo'); - $cpucores = $output; + $output = shell_exec('grep -c processor /proc/cpuinfo'); + $cpucores = $output; - $output = shell_exec('cat /proc/uptime'); - $uptime = format_time(substr($output,0,strpos($output," "))); - $idletime = format_time((substr($output,strpos($output," ")))/$cpucores); - showLapTime("idletime"); + $output = shell_exec('cat /proc/uptime'); + $uptime = format_time(substr($output,0,strpos($output," "))); + $idletime = format_time((substr($output,strpos($output," ")))/$cpucores); + showLapTime("idletime"); - if (defined("SHOWPOWERSTATE")) { - $pinStatus = trim(shell_exec("gpio -g read ".POWERONLINEPIN)); // Pin 18 - } - //returns 0 = low; 1 = high + if (defined("SHOWPOWERSTATE")) { + $pinStatus = trim(shell_exec("gpio -g read ".POWERONLINEPIN)); // Pin 18 + } + //returns 0 = low; 1 = high ?>
System Info
-
- - - - - - - - - - - - - - - - - - - - - - - - - + + + + +
PowerCPU-TemperatureCPU-FrequencySystem-LoadCPU-UsageUptimeIdle
°C MHz % +
+ + + + + + + + + + + + + + + + + + + + + + + + + - - - - -
PowerCPU-TemperatureCPU-FrequencySystem-LoadCPU-UsageUptimeIdle
°C MHz % -
= 30 and $cpuusage < 60) - echo "progress-bar-warning"; - if ($cpuusage >= 60) - echo "progress-bar-danger"; +
= 30 and $cpuusage < 60) + echo "progress-bar-warning"; + if ($cpuusage >= 60) + echo "progress-bar-danger"; ?>" role="progressbar" aria-valuenow="" aria-valuemin="0" aria-valuemax="100" style="width: %;">%
-
-
+
+
diff --git a/include/sysinfo_ajax.php b/include/sysinfo_ajax.php index a06119b..211d091 100644 --- a/include/sysinfo_ajax.php +++ b/include/sysinfo_ajax.php @@ -1,29 +1,29 @@ -
- -
System Info
- -
- -
-
-
- +
+ +
System Info
+ +
+ +
+
+
+ diff --git a/include/tools.php b/include/tools.php index a08c820..3660be8 100644 --- a/include/tools.php +++ b/include/tools.php @@ -1,115 +1,115 @@ 0) { - $uptimeString .= $days; - $uptimeString .= (($days == 1) ? " day" : " days"); - } - if ($hours > 0) { - $uptimeString .= (($days > 0) ? ", " : "") . $hours; - $uptimeString .= (($hours == 1) ? " hr" : " hrs"); - } - if ($mins > 0) { - $uptimeString .= (($days > 0 || $hours > 0) ? ", " : "") . $mins; - $uptimeString .= (($mins == 1) ? " min" : " mins"); - } - if ($secs > 0) { - $uptimeString .= (($days > 0 || $hours > 0 || $mins > 0) ? ", " : "") . $secs; - $uptimeString .= (($secs == 1) ? " s" : " s"); - } - return $uptimeString; + if ($days > 0) { + $uptimeString .= $days; + $uptimeString .= (($days == 1) ? " day" : " days"); + } + if ($hours > 0) { + $uptimeString .= (($days > 0) ? ", " : "") . $hours; + $uptimeString .= (($hours == 1) ? " hr" : " hrs"); + } + if ($mins > 0) { + $uptimeString .= (($days > 0 || $hours > 0) ? ", " : "") . $mins; + $uptimeString .= (($mins == 1) ? " min" : " mins"); + } + if ($secs > 0) { + $uptimeString .= (($days > 0 || $hours > 0 || $mins > 0) ? ", " : "") . $secs; + $uptimeString .= (($secs == 1) ? " s" : " s"); + } + return $uptimeString; } function startsWith($haystack, $needle) { - return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; + return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; } function getMHZ($freq) { - return substr($freq,0,3) . "." . substr($freq,3,6) . " MHz"; + return substr($freq,0,3) . "." . substr($freq,3,6) . " MHz"; } function isProcessRunning($processname) { - exec("pgrep " . $processname, $pids); - if(empty($pids)) { - // process not running! - return false; - } else { - // process running! - return true; - } + exec("pgrep " . $processname, $pids); + if(empty($pids)) { + // process not running! + return false; + } else { + // process running! + return true; + } } function createConfigLines() { - $out =""; - foreach($_GET as $key=>$val) { - if($key != "cmd") { - $out .= "define(\"$key\", \"$val\");"."\n"; - } - } - return $out; + $out =""; + foreach($_GET as $key=>$val) { + if($key != "cmd") { + $out .= "define(\"$key\", \"$val\");"."\n"; + } + } + return $out; } function getSize($filesize, $precision = 2) { - $units = array('', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'); - foreach ($units as $idUnit => $unit) { - if ($filesize > 1024) - $filesize /= 1024; - else - break; - } - return round($filesize, $precision).' '.$units[$idUnit].'B'; + $units = array('', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'); + foreach ($units as $idUnit => $unit) { + if ($filesize > 1024) + $filesize /= 1024; + else + break; + } + return round($filesize, $precision).' '.$units[$idUnit].'B'; } function checkSetup() { - $el = error_reporting(); - error_reporting(E_ERROR | E_WARNING | E_PARSE); - if (defined(DISTRIBUTION)) { + $el = error_reporting(); + error_reporting(E_ERROR | E_WARNING | E_PARSE); + if (defined(DISTRIBUTION)) { ?> - - + + setTimezone(new DateTimeZone(TIMEZONE)); - return $date->format('Y-m-d H:i:s'); + $date = new DateTime($timestamp); + $date->setTimezone(new DateTimeZone(TIMEZONE)); + return $date->format('Y-m-d H:i:s'); } ?> diff --git a/include/txinfo.php b/include/txinfo.php index a607379..7cb60d1 100644 --- a/include/txinfo.php +++ b/include/txinfo.php @@ -1,71 +1,71 @@ -
- -
Currently TXing
- -
- - - - - - - - - - - - - - - - - -
Time ()ModeCallsignNameDSTAR-IDTargetSourceTX-Time
-
-
- +
+ +
Currently TXing
+ +
+ + + + + + + + + + + + + + + + + +
Time ()ModeCallsignNameDSTAR-IDTargetSourceTX-Time
+
+
+ diff --git a/include/ysfgatewayinfo.php b/include/ysfgatewayinfo.php index 7cea544..9699526 100644 --- a/include/ysfgatewayinfo.php +++ b/include/ysfgatewayinfo.php @@ -1,66 +1,66 @@ - -
- -
YSFGateway-Infos
- - - - ">YSFGateway Process is down! - -
">YSFGateway Process is running
-
-
- -
YSFReflectors reported active
- -
- - - 0) { - ?> - - - - - - - - - - -"; - echo ""; - for ($i = 0; $i < 4; $i++) { - echo""; - } - echo "\n"; - $counter++; - } - } -?> - -
No.NameDescriptionIDConnections
$counter$reflector[$i]
-
-
- - + +
+ +
YSFGateway-Infos
+ + + + ">YSFGateway Process is down! + +
">YSFGateway Process is running
+
+
+ +
YSFReflectors reported active
+ +
+ + + 0) { + ?> + + + + + + + + + + +"; + echo ""; + for ($i = 0; $i < 4; $i++) { + echo""; + } + echo "\n"; + $counter++; + } + } +?> + +
No.NameDescriptionIDConnections
$counter$reflector[$i]
+
+
+ + diff --git a/index.php b/index.php index 8d6a0a1..940ee61 100644 --- a/index.php +++ b/index.php @@ -1,149 +1,149 @@ - - - - - - - - - - - - - - - - - - - <?php echo getCallsign($mmdvmconfigs) ?> - MMDVM-Dashboard by DG9VH - - - - - - - - - - - - -
-setTimezone(new DateTimeZone(TIMEZONE)); -echo "MMDVMHost-Dashboard V ".VERSION." | Last Reload ".$lastReload->format('Y-m-d, H:i:s')." (".TIMEZONE.")"; -/*$time = microtime(); -$time = explode(' ', $time); -$time = $time[1] + $time[0]; -$finish = $time; -$total_time = round(($finish - $start), 4);*/ -echo ''; -?> | -stop refreshing'; -} else { - echo 'start refreshing'; -} -?> - | get your own at: https://github.com/dg9vh/MMDVMHost-Dashboard | Credits -
- - - - + + + + + + + + + + + + + + + + + + + <?php echo getCallsign($mmdvmconfigs) ?> - MMDVM-Dashboard by DG9VH + + + + + + + + + + + + +
+setTimezone(new DateTimeZone(TIMEZONE)); +echo "MMDVMHost-Dashboard V ".VERSION." | Last Reload ".$lastReload->format('Y-m-d, H:i:s')." (".TIMEZONE.")"; +/*$time = microtime(); +$time = explode(' ', $time); +$time = $time[1] + $time[0]; +$finish = $time; +$total_time = round(($finish - $start), 4);*/ +echo ''; +?> | +stop refreshing'; +} else { + echo 'start refreshing'; +} +?> + | get your own at: https://github.com/dg9vh/MMDVMHost-Dashboard | Credits +
+ + + + diff --git a/scripts/halt.php b/scripts/halt.php index b6ef6dd..4160718 100644 --- a/scripts/halt.php +++ b/scripts/halt.php @@ -14,8 +14,8 @@ if (!isset($_SERVER['PHP_AUTH_USER']) && HALTUSER !== "" && HALTPW !== "") { echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!'; exit; } else { - if ($_SERVER['PHP_AUTH_USER'] == HALTUSER && $_SERVER['PHP_AUTH_PW'] == HALTPW) { - $fileName = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; + if ($_SERVER['PHP_AUTH_USER'] == HALTUSER && $_SERVER['PHP_AUTH_PW'] == HALTPW) { + $fileName = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; ?> @@ -37,9 +37,9 @@ if (!isset($_SERVER['PHP_AUTH_USER']) && HALTUSER !== "" && HALTPW !== "") { -
+
'; - } else { + } 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/scripts/reboot.php b/scripts/reboot.php index 4676e2a..4be2ed4 100644 --- a/scripts/reboot.php +++ b/scripts/reboot.php @@ -14,8 +14,8 @@ if (!isset($_SERVER['PHP_AUTH_USER']) && REBOOTUSER !== "" && REBOOTPW !== "") { echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!'; exit; } else { - if ($_SERVER['PHP_AUTH_USER'] == REBOOTUSER && $_SERVER['PHP_AUTH_PW'] == REBOOTPW) { - $fileName = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; + if ($_SERVER['PHP_AUTH_USER'] == REBOOTUSER && $_SERVER['PHP_AUTH_PW'] == REBOOTPW) { + $fileName = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; ?> @@ -38,9 +38,9 @@ if (!isset($_SERVER['PHP_AUTH_USER']) && REBOOTUSER !== "" && REBOOTPW !== "") {