some code cleanup
This commit is contained in:
parent
d269ad0811
commit
9099b4d744
11 changed files with 54 additions and 161 deletions
|
@ -4,10 +4,8 @@
|
|||
<!-- Tabelle -->
|
||||
<div class="table-responsive">
|
||||
<table id="diskuse" class="table table-condensed table-striped table-hover">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th class="w10p filesystem">Filesystem</th>
|
||||
<th class="w20p">Mount</th>
|
||||
<th>Use</th>
|
||||
|
@ -17,18 +15,12 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
|
||||
//include "./functions.php";
|
||||
try{
|
||||
|
||||
try{
|
||||
$datas = array();
|
||||
|
||||
if (!(exec('/bin/df -T | awk -v c=`/bin/df -T | grep -bo "Type" | awk -F: \'{print $2}\'` \'{print substr($0,c);}\' | tail -n +2 | awk \'{print $1","$2","$3","$4","$5","$6","$7}\'', $df)))
|
||||
{
|
||||
if (!(exec('/bin/df -T | awk -v c=`/bin/df -T | grep -bo "Type" | awk -F: \'{print $2}\'` \'{print substr($0,c);}\' | tail -n +2 | awk \'{print $1","$2","$3","$4","$5","$6","$7}\'', $df))) {
|
||||
$datas[] = array(
|
||||
'total' => 'N.A',
|
||||
'used' => 'N.A',
|
||||
|
@ -37,22 +29,14 @@ if (!(exec('/bin/df -T | awk -v c=`/bin/df -T | grep -bo "Type" | awk -F: \'{pri
|
|||
'mount' => 'N.A',
|
||||
'filesystem' => 'N.A',
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$mounted_points = array();
|
||||
$key = 0;
|
||||
|
||||
foreach ($df as $mounted)
|
||||
{
|
||||
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;
|
||||
|
||||
|
||||
?>
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $filesystem ?></td>
|
||||
<td><?php echo $mount ?></td>
|
||||
|
@ -61,27 +45,16 @@ else
|
|||
<td><?php echo getSize($used * 1024) ?></td>
|
||||
<td><?php echo getSize($total * 1024) ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
$key++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,6 @@ function getConfigItem($section, $key, $configs) {
|
|||
}
|
||||
$sectionpos++;
|
||||
}
|
||||
|
||||
return substr($configs[$sectionpos], strlen($key) + 1);
|
||||
}
|
||||
|
||||
|
@ -109,26 +108,9 @@ function showMode($mode, $mmdvmconfigs) {
|
|||
<?php
|
||||
}
|
||||
|
||||
/*
|
||||
function getMMDVMLog() {
|
||||
// Open Logfile and copy loglines into LogLines-Array()
|
||||
$logLines = array();
|
||||
if ($log = fopen(MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log", 'r')) {
|
||||
while ($logLine = fgets($log)) {
|
||||
if (!strpos($logLine, "Debug") && !strpos($logLine,"Received a NAK") && !startsWith($logLine,"I:") && !startsWith($logLine,"E:")) {
|
||||
array_push($logLines, $logLine);
|
||||
}
|
||||
}
|
||||
fclose($log);
|
||||
}
|
||||
return $logLines;
|
||||
}
|
||||
*/
|
||||
|
||||
function getMMDVMLog() {
|
||||
// Open Logfile and copy loglines into LogLines-Array()
|
||||
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
|
||||
|
||||
$logLines = explode("\n", `grep M: $logPath`);
|
||||
return $logLines;
|
||||
}
|
||||
|
@ -136,31 +118,13 @@ function getMMDVMLog() {
|
|||
function getShortMMDVMLog() {
|
||||
// Open Logfile and copy loglines into LogLines-Array()
|
||||
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
|
||||
|
||||
$logLines = explode("\n", `tail -n100 $logPath`);
|
||||
return $logLines;
|
||||
}
|
||||
|
||||
/*
|
||||
function getYSFGatewayLog() {
|
||||
// Open Logfile and copy loglines into LogLines-Array()
|
||||
$logLines = array();
|
||||
if ($log = fopen(YSFGATEWAYLOGPATH."/".YSFGATEWAYLOGPREFIX."-".date("Y-m-d").".log", 'r')) {
|
||||
while ($logLine = fgets($log)) {
|
||||
if (startsWith($logLine,"D:")) {
|
||||
array_push($logLines, $logLine);
|
||||
}
|
||||
}
|
||||
fclose($log);
|
||||
}
|
||||
return $logLines;
|
||||
}
|
||||
*/
|
||||
|
||||
function getYSFGatewayLog() {
|
||||
// Open Logfile and copy loglines into LogLines-Array()
|
||||
$logPath = YSFGATEWAYLOGPATH."/".YSFGATEWAYLOGPREFIX."-".date("Y-m-d").".log";
|
||||
|
||||
$logLines = explode("\n", `grep D: $logPath`);
|
||||
return $logLines;
|
||||
}
|
||||
|
@ -171,7 +135,6 @@ function getYSFGatewayLog() {
|
|||
// 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
|
||||
function getHeardList($logLines, $onlyLast) {
|
||||
//array_multisort($logLines,SORT_DESC);
|
||||
$heardList = array();
|
||||
$ts1duration = "";
|
||||
$ts1loss = "";
|
||||
|
@ -202,7 +165,6 @@ function getHeardList($logLines, $onlyLast) {
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(strpos($logLine,"end of") || strpos($logLine,"watchdog has expired") || strpos($logLine,"ended RF data") || strpos($logLine,"ended network")) {
|
||||
$lineTokens = explode(", ",$logLine);
|
||||
if (array_key_exists(2,$lineTokens)) {
|
||||
|
@ -327,10 +289,7 @@ function getLastHeard($logLines, $onlyLast) {
|
|||
array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[3]);
|
||||
array_push($lastHeard, $listElem);
|
||||
$counter++;
|
||||
}/*
|
||||
if ($counter == LHLINES) {
|
||||
return $lastHeard;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
return $lastHeard;
|
||||
|
@ -479,8 +438,6 @@ function getActualReflector($logLines, $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
|
||||
//array_multisort($logLines,SORT_DESC);
|
||||
|
||||
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);
|
||||
|
@ -556,5 +513,4 @@ function getName($callsign) {
|
|||
$name = substr($name, strpos($name,$delimiter)+1);
|
||||
return $name;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -56,7 +56,6 @@ for ($i = 0; ($i < $totalLH); $i++) {
|
|||
}
|
||||
echo"</tr>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -32,7 +32,6 @@ $localTXList = getHeardList($reverseLogLinesMMDVM);
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$counter = 0;
|
||||
for ($i = 0; $i < count($localTXList); $i++) {
|
||||
$listElem = $localTXList[$i];
|
||||
if ($listElem[5] == "RF" && ($listElem[1]=="D-Star" || startsWith($listElem[1], "DMR") || $listElem[1]=="YSF")) {
|
||||
|
@ -56,12 +55,10 @@ for ($i = 0; $i < count($localTXList); $i++) {
|
|||
echo"<td nowrap>$listElem[8]</td>";
|
||||
}
|
||||
echo"</tr>\n";
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<div class="panel panel-default">
|
||||
<!-- Standard-Panel-Inhalt -->
|
||||
<div class="panel-heading">Enabled Modes</div>
|
||||
|
||||
|
||||
<!-- Tabelle -->
|
||||
<table class="table">
|
||||
<tr>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<div class="panel panel-default">
|
||||
<!-- Standard-Panel-Inhalt -->
|
||||
<div class="panel-heading">Repeater Info</div>
|
||||
|
||||
<!-- Tabelle -->
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
|
|
|
@ -111,15 +111,11 @@
|
|||
<th>Power</th>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ($cputemp !== NULL) {
|
||||
?>
|
||||
<th>CPU-Temperature</th>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ($cpufreq !== NULL) {
|
||||
?>
|
||||
<th>CPU-Frequency</th>
|
||||
|
@ -138,15 +134,11 @@
|
|||
<td><?php if ($pinStatus == POWERONLINESTATE ) {echo "online";} else {echo "on battery";} ?></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ($cputemp !== NULL) {
|
||||
?>
|
||||
<td><?php echo $cputemp; ?> °C</td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ($cpufreq !== NULL) {
|
||||
?>
|
||||
<td><?php echo $cpufreq; ?> MHz</td>
|
||||
|
|
|
@ -22,21 +22,6 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody id="txline">
|
||||
<!--<tr >
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<?php
|
||||
if (defined("ENABLEXTDLOOKUP")) {
|
||||
?>
|
||||
<td></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>-->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
12
index.php
12
index.php
|
@ -5,7 +5,6 @@ $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!!!
|
||||
include "config/config.php";
|
||||
include "include/tools.php";
|
||||
|
@ -18,7 +17,6 @@ include "version.php";
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.6,maximum-scale=1, user-scalable=yes">
|
||||
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">-->
|
||||
<?php
|
||||
if (!isset($_GET['stoprefresh'])) {
|
||||
?>
|
||||
|
@ -28,11 +26,11 @@ include "version.php";
|
|||
?>
|
||||
<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/3.3.6/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
|
||||
<!-- Optionales Theme -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css">
|
||||
<!-- Das neueste kompilierte und minimierte JavaScript -->
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/latest/js/bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
|
||||
<style>
|
||||
|
@ -40,8 +38,6 @@ include "version.php";
|
|||
white-space:nowrap
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<title><?php echo getCallsign($mmdvmconfigs) ?> - MMDVM-Dashboard by DG9VH</title>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -90,13 +86,11 @@ $total_time = round(($finish - $start), 4);
|
|||
echo '<!--Page generated in '.$total_time.' seconds.-->';
|
||||
?> |
|
||||
<?php
|
||||
|
||||
if (!isset($_GET['stoprefresh'])) {
|
||||
echo '<a href="?stoprefresh">stop refreshing</a>';
|
||||
} else {
|
||||
echo '<a href=".">start refreshing</a>';
|
||||
}
|
||||
|
||||
?>
|
||||
| get your own at: <a href="https://github.com/dg9vh/MMDVMHost-Dashboard">https://github.com/dg9vh/MMDVMHost-Dashboard</a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue