Cleaning up the carpet

This commit is contained in:
dg9vh 2017-04-07 13:13:20 +00:00
parent 37feaac078
commit ebd7206b82
8 changed files with 0 additions and 420 deletions

View file

@ -47,16 +47,6 @@ if ($_GET['section'] == "lastHeard") {
}
echo '{"data": '.json_encode($lastHeard)."}";
}
/*
for ($i = 0; $i < count($localTXList); $i++) {
$listElem = $localTXList[$i];
if (defined("ENABLEXTDLOOKUP")) {
$listElem[11] ="";
} else {
$listElem[10] ="";
}
echo '{"data": '.json_encode($lastHeard)."}";
}*/
if ($_GET['section'] == "localTx") {
$localTXList = getHeardList($reverseLogLinesMMDVM, FALSE);
$lastHeard = Array();

View file

@ -434,14 +434,12 @@ function getHeardList($logLines, $onlyLast) {
$loss = $ts1loss;
$ber = $ts1ber;
$rssi = $ts1rssi;
// $alias = $ts1alias;
break;
case "DMR Slot 2":
$duration = $ts2duration;
$loss = $ts2loss;
$ber = $ts2ber;
$rssi = $ts2rssi;
// $alias = $ts2alias;
break;
case "YSF":
$duration = $ysfduration;
@ -750,39 +748,6 @@ function getYSFReflectorById($id, $reflectors) {
}
}
/*
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;
}
}
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'];
}
function getName($callsign) {
// 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 "---";
@ -810,10 +775,6 @@ function getName($callsign) {
}
$delimiter =" ";
exec("sed -e 's/[[:space:]]\+/ /g' ".DMRIDDATPATH ." | grep -m1 '".$callsign.$delimiter."'" , $output);
// if (count($output) == 0) {
// $delimiter = "\t";
// exec("egrep -m1 '".$callsign.$delimiter."' ".DMRIDDATPATH, $output);
// }
if (count($output) !== 0) {
$name = preg_replace('/[\x00-\x1F\x7F-\xA0\xAD]/u', '', substr($output[0], strpos($output[0],$delimiter)+1));
$name = substr($name, strpos($name,$delimiter)+1);
@ -845,8 +806,6 @@ function decodeAlias($logLine) {
$tok4 = encode(substr($logLine, 49, 2));
$tok5 = encode(substr($logLine, 52, 2));
$tok6 = encode(substr($logLine, 55, 2));
// https://github.com/g4klx/MMDVMHost/commit/bba5cbc0bad65f32dde6f673255a05534ebc13ab
// $tok7 = encode(dechex(hexdec(substr($logLine, 58, 2))/2));
$tok7 = encode(substr($logLine, 58, 2));
return $tok1.$tok2.$tok3.$tok4.$tok5.$tok6.$tok7;
}

View file

@ -7,18 +7,11 @@ if (!defined("TIMEZONE"))
define("TIMEZONE", "UTC");
$logLinesMMDVM = getMMDVMLog();
showLapTime("getMMDVMLog");
//getNames(" ");
showLapTime("getNames");
//$_SESSION['logLinesMMDVM'] = $logLinesMMDVM;
$reverseLogLinesMMDVM = $logLinesMMDVM;
//array_multisort($reverseLogLinesMMDVM,SORT_DESC);
rsort($reverseLogLinesMMDVM);
showLapTime("array_multisort");
//$_SESSION['reverseLogLinesMMDVM'] = $reverseLogLinesMMDVM;
$lastHeard = getLastHeard($reverseLogLinesMMDVM, FALSE);
showLapTime("getLastHeard");
//$_SESSION['lastHeard'] = $lastHeard;
if (defined("ENABLEYSFGATEWAY")) {
$logLinesYSFGateway = getYSFGatewayLog();
showLapTime("getYSFGatewayLog");

View file

@ -1,74 +0,0 @@
<?php
$totalLH = count($lastHeard);
?>
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">Last Heard List of today's <?php echo $totalLH; ?> callsigns.</div>
<!-- Tabelle -->
<div class="table-responsive">
<table id="lastHeard" class="table table-condensed table-striped table-hover">
<thead>
<tr>
<th>Time (UTC)</th>
<th>Mode</th>
<th>Callsign</th>
<?php
if (defined("ENABLEXTDLOOKUP")) {
?>
<th>Name</th>
<?php
}
?>
<th>DSTAR-ID</th>
<th>Target</th>
<th>Source</th>
<th>Dur (s)</th>
<th>Loss</th>
<th>BER</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; ($i < $totalLH); $i++) {
$listElem = $lastHeard[$i];
echo"<tr>";
echo"<td nowrap>$listElem[0]</td>";
echo"<td nowrap>$listElem[1]</td>";
if ($listElem[2] !== "??????????") {
if (!is_numeric($listElem[2])) {
if (defined("SHOWQRZ")) {
echo"<td nowrap><a target=\"_new\" href=\"https://qrz.com/db/$listElem[2]\">".str_replace("0","&Oslash;",$listElem[2])."</a></td>";
} else {
echo"<td nowrap><a target=\"_new\" href=\"http://dmr.darc.de/dmr-userreg.php?callsign=$listElem[2]\">".$listElem[2]."</td>";
}
} else {
echo"<td nowrap><a target=\"_new\" href=\"http://dmr.darc.de/dmr-userreg.php?usrid=$listElem[2]\">".$listElem[2]."</td>";
}
}
if (defined("ENABLEXTDLOOKUP")) {
echo "<td nowrap>".getName($listElem[2])."</td>";
}
echo"<td nowrap>$listElem[3]</td>";
echo"<td nowrap>$listElem[4]</td>";
if ($listElem[5] == "RF"){
echo "<td nowrap><span class=\"label label-success\">RF</span></td>";
}else{
echo"<td nowrap>$listElem[5]</td>";
}
if ($listElem[6] == null) {
echo'<td nowrap>transmitting</td><td></td><td></td>';
} else if ($listElem[6] == "SMS") {
echo'<td nowrap>sending or receiving SMS</td><td></td><td></td>';
} else {
echo"<td nowrap>$listElem[6]</td>";
echo"<td nowrap>$listElem[7]</td>";
echo"<td nowrap>$listElem[8]</td>";
}
echo"</tr>\n";
}
?>
</tbody>
</table>
</div>
</div>

View file

@ -1,77 +0,0 @@
<?php
$localTXList = getHeardList($reverseLogLinesMMDVM, FALSE);
//array_multisort($localTXList,SORT_DESC);
?>
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">Today's local transmissions</div>
<!-- Tabelle -->
<div class="table-responsive">
<table id="localTx" class="table table-condensed table-striped table-hover">
<thead>
<tr>
<th>Time (UTC)</th>
<th>Mode</th>
<th>Callsign</th>
<?php
if (defined("ENABLEXTDLOOKUP")) {
?>
<th>Name</th>
<?php
}
?>
<th>DSTAR-ID</th>
<th>Target</th>
<th>Source</th>
<th>Dur (s)</th>
<th>Loss</th>
<th>BER</th>
<th>RSSI</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i < count($localTXList); $i++) {
$listElem = $localTXList[$i];
if ($listElem[6] == "RF" && ($listElem[1]=="D-Star" || startsWith($listElem[1], "DMR") || $listElem[1]=="YSF" || $listElem[1]=="P25")) {
echo"<tr>";
echo"<td nowrap>$listElem[0]</td>";
echo"<td nowrap>$listElem[1]</td>";
if ($listElem[2] !== "??????????") {
if (!is_numeric($listElem[2])) {
if (defined("SHOWQRZ")) {
echo"<td nowrap><a target=\"_new\" href=\"https://qrz.com/db/$listElem[2]\">".str_replace("0","&Oslash;",$listElem[2])."</a></td>";
} else {
echo"<td nowrap><a target=\"_new\" href=\"http://dmr.darc.de/dmr-userreg.php?callsign=$listElem[2]\">".$listElem[2]."</td>";
}
} else {
echo"<td nowrap><a target=\"_new\" href=\"http://dmr.darc.de/dmr-userreg.php?usrid=$listElem[2]\">".$listElem[2]."</td>";
}
}
if (defined("ENABLEXTDLOOKUP")) {
echo "<td class=\"nowrap\">$listElem[3]</td>";
}
echo"<td nowrap>$listElem[4]</td>";
echo"<td nowrap>$listElem[5]</td>";
echo"<td nowrap>$listElem[6]</td>";
if ($listElem[6] == null) {
echo'<td nowrap>in TX</td><td></td><td></td>';
} else if ($listElem[7] == "SMS") {
echo'<td nowrap>sending or receiving SMS</td><td></td><td></td>';
} else {
echo"<td nowrap>$listElem[7]</td>";
echo"<td nowrap>$listElem[8]</td>";
echo"<td nowrap>$listElem[9]</td>";
}
echo"</tr>\n";
}
}
?>
</tbody>
</table>
</div>
</div>

View file

@ -1,180 +0,0 @@
<?php
$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) {
?>
<script>
function deleteLayer(id) {
if (document.getElementById && document.getElementById(id)) {
var theNode = document.getElementById(id);
theNode.parentNode.removeChild(theNode);
}
else if (document.all && document.all[id]) {
document.all[id].innerHTML='';
document.all[id].outerHTML='';
}
// OBSOLETE CODE FOR NETSCAPE 4
else if (document.layers && document.layers[id]) {
document.layers[id].visibility='hide';
delete document.layers[id];
}
}
function makeLayer(id,L,T,W,H,bgColor,visible,zIndex) {
if (document.getElementById) {
if (document.getElementById(id)) {
alert ('Layer with this ID already exists!');
return;
}
var ST = 'position:absolute; text-align:center;padding-top:20px;'
+'; left:'+L+'px'
+'; top:'+T+'px'
+'; width:'+W+'px'
+'; height:'+H+'px'
+'; clip:rect(0,'+W+','+H+',0)'
+'; visibility:'
+(null==visible || 1==visible ? 'visible':'hidden')
+(null==zIndex ? '' : '; z-index:'+zIndex)
+(null==bgColor ? '' : '; background-color:'+bgColor);
var LR = '<DIV id='+id+' style="'+ST+'">CPU-Temperature is very high!<br><input type="button" value="Close" onclick="deleteLayer(\'LYR1\')"></DIV>';
if (document.body) {
if (document.body.insertAdjacentHTML)
document.body.insertAdjacentHTML("BeforeEnd",LR);
else if (document.createElement && document.body.appendChild) {
var newNode = document.createElement('div');
newNode.setAttribute('id',id);
newNode.setAttribute('style',ST);
document.body.appendChild(newNode);
}
}
}
}
var audio = new Audio('sounds/alert.mp3');
audio.play();
var x = window.innerWidth/2-100;
var y = window.innerHeight/2-50;
makeLayer('LYR1',x,y,200,100,'red',1,1);
</script>
<?php
}
$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('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
?>
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">System Info</div>
<!-- Tabelle -->
<div class="table-responsive">
<table id="sysinfo" class="table table-condensed">
<tbody>
<tr>
<?php
if (defined("SHOWPOWERSTATE")) {
?>
<th>Power</th>
<?php
}
if ($cputemp !== NULL) {
?>
<th>CPU-Temperature</th>
<?php
}
if ($cpufreq !== NULL) {
?>
<th>CPU-Frequency</th>
<?php
}
?>
<th>System-Load</th>
<th>CPU-Usage</th>
<th>Uptime</th>
<th>Idle</th>
</tr>
<tr class="gatewayinfo">
<?php
if (defined("SHOWPOWERSTATE")) {
?>
<td><?php if ($pinStatus == POWERONLINESTATE ) {echo "online";} else {echo "on battery";} ?></td>
<?php
}
if ($cputemp !== NULL) {
?>
<td><?php echo $cputemp; ?> &deg;C</td>
<?php
}
if ($cpufreq !== NULL) {
?>
<td><?php echo $cpufreq; ?> MHz</td>
<?php
}
?>
<td><?php echo $sysload; ?> %</td>
<td>
<?php
if (defined("SHOWPROGRESSBARS")) {
?>
<div class="progress"><div class="progress-bar <?php
if ($cpuusage < 30)
echo "progress-bar-success";
if ($cpuusage >= 30 and $cpuusage < 60)
echo "progress-bar-warning";
if ($cpuusage >= 60)
echo "progress-bar-danger";
?>" role="progressbar" aria-valuenow="<?php echo $cpuusage; ?>" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $cpuusage; ?>%;"><?php echo $cpuusage; ?>%</div></div>
<?php
} else {
echo $cpuusage." %";
}
?>
</td>
<td><?php echo $uptime; ?></td>
<td><?php echo $idletime; ?></td>
</tr>
</tbody>
</table>
</div>
</div>

View file

@ -1,10 +1,4 @@
<?php
//session_start();
/*
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;*/
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// do not touch this includes!!! Never ever!!!
@ -43,7 +37,6 @@ include "version.php";
<!-- CSS for monospaced fonts in tables -->
<link rel="stylesheet" href="css/monospacetables.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>-->
<!-- Das neueste kompilierte und minimierte CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
<!-- Optionales Theme -->
@ -197,16 +190,9 @@ if (defined("ENABLEYSFGATEWAY")) {
?>
<div class="panel panel-info">
<?php
//$datum = date("Y-m-d");
//$uhrzeit = date("H:i:s");
$lastReload = new DateTime();
$lastReload->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 '<!--Page generated in '.getLapTime().' seconds.-->';
?> |
<?php

View file

@ -14,10 +14,6 @@ $logLinesMMDVM = getShortMMDVMLog();
$reverseLogLinesMMDVM = $logLinesMMDVM;
array_multisort($reverseLogLinesMMDVM,SORT_DESC);
$lastHeard = getLastHeard($reverseLogLinesMMDVM, True);
//$oldLastHeard = $_SESSION['lastHeard'];
/*echo"<!--";
var_dump($lastHeard);
echo"-->";*/
$counter = 0;
foreach ($lastHeard as $listElem) {
$counter +=1;
@ -28,21 +24,8 @@ foreach ($lastHeard as $listElem) {
echo "<tr>";
echo"<td nowrap>$listElem[0]</td>";
echo"<td nowrap>$listElem[1]</td>";
/*if ($listElem[2] !== "??????????") {
if (!is_numeric($listElem[2])) {
if (defined("SHOWQRZ")) {
echo"<td nowrap><a target=\"_new\" href=\"https://qrz.com/db/$listElem[2]\">".str_replace("0","&Oslash;",$listElem[2])."</a></td>";
} else {
echo"<td nowrap><a target=\"_new\" href=\"http://dmr.darc.de/dmr-userreg.php?callsign=$listElem[2]\">".$listElem[2]."</td>";
}
} else {
echo"<td nowrap><a target=\"_new\" href=\"http://dmr.darc.de/dmr-userreg.php?usrid=$listElem[2]\">".$listElem[2]."</td>";
}
}*/
echo"<td nowrap>$listElem[2]</td>";
if (defined("ENABLEXTDLOOKUP")) {
//echo "<td nowrap>".getName($listElem[2])."</td>";
echo"<td nowrap>$listElem[3]</td>";
if (defined("TALKERALIAS"))
echo"<td nowrap>$listElem[11]</td>";