code beautifying

This commit is contained in:
dg9vh 2016-06-05 19:00:37 +00:00
parent 84f7066820
commit 77893ce5a9

View file

@ -15,7 +15,7 @@ function getMMDVMHostFileVersion() {
// returns creation-time of MMDVMHost as version-number // returns creation-time of MMDVMHost as version-number
$filename = MMDVMHOSTPATH."/MMDVMHost"; $filename = MMDVMHOSTPATH."/MMDVMHost";
if (file_exists($filename)) { if (file_exists($filename)) {
return date("d M y", filectime($filename)); return date("d M y", filectime($filename));
} }
} }
@ -76,7 +76,7 @@ function showMode($mode, $mmdvmconfigs) {
} }
} }
} else { } else {
echo "label-default"; echo "label-default";
} }
?>"><?php echo $mode ?></span></td> ?>"><?php echo $mode ?></span></td>
<?php <?php
@ -174,11 +174,11 @@ function getHeardList($logLines) {
$ts2loss = $loss; $ts2loss = $loss;
$ts2ber = $ber; $ts2ber = $ber;
break; break;
case "YSF": case "YSF":
$ysfduration = $duration; $ysfduration = $duration;
$ysfloss = $loss; $ysfloss = $loss;
$ysfber = $ber; $ysfber = $ber;
break; break;
} }
} }
} }
@ -202,7 +202,7 @@ function getHeardList($logLines) {
if (strpos($logLine,"network") > 0 ) { if (strpos($logLine,"network") > 0 ) {
$source = "Network"; $source = "Network";
} }
switch ($mode) { switch ($mode) {
case "D-Star": case "D-Star":
$duration = $dstarduration; $duration = $dstarduration;
@ -260,9 +260,6 @@ function getLastHeard($logLines) {
function getActualMode($metaLastHeard, $mmdvmconfigs) { function getActualMode($metaLastHeard, $mmdvmconfigs) {
// returns mode of repeater actual working in // returns mode of repeater actual working in
//$lastHeard = $metaLastHeard;
//array_multisort($lastHeard,SORT_DESC);
//$listElem = $lastHeard[0];
$listElem = $metaLastHeard[0]; $listElem = $metaLastHeard[0];
$timestamp = new DateTime($listElem[0]); $timestamp = new DateTime($listElem[0]);
$mode = $listElem[1]; $mode = $listElem[1];
@ -342,7 +339,6 @@ function getActualLink($logLines, $mode) {
//M: 2016-05-02 07:04:10.504 D-Star link status set to "Verlinkt zu DCS002 S" //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 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 //M: 2016-04-03 19:30:03.099 DMR Slot 2, received network voice header from 4020 to 2625094
//array_multisort($logLines,SORT_DESC);
switch ($mode) { switch ($mode) {
case "D-Star": case "D-Star":
if (isProcessRunning(IRCDDBGATEWAY)) { if (isProcessRunning(IRCDDBGATEWAY)) {
@ -354,7 +350,7 @@ function getActualLink($logLines, $mode) {
case "DMR Slot 1": case "DMR Slot 1":
foreach ($logLines as $logLine) { foreach ($logLines as $logLine) {
if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 1") { if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 1") {
$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));
} }
@ -368,7 +364,7 @@ function getActualLink($logLines, $mode) {
case "DMR Slot 2": case "DMR Slot 2":
foreach ($logLines as $logLine) { foreach ($logLines as $logLine) {
if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") { if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") {
$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));
} }
@ -391,8 +387,8 @@ function getActualReflector($logLines, $mode) {
//array_multisort($logLines,SORT_DESC); //array_multisort($logLines,SORT_DESC);
foreach ($logLines as $logLine) { foreach ($logLines as $logLine) {
if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") { if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") {
$from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6); $from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6);
if (strlen($from) == 4 && startsWith($from,"4")) { if (strlen($from) == 4 && startsWith($from,"4")) {
if ($from == "4000") { if ($from == "4000") {
@ -401,7 +397,7 @@ function getActualReflector($logLines, $mode) {
return "Reflector ".$from; return "Reflector ".$from;
} }
} }
} }
} }
return "Reflector not linked"; return "Reflector not linked";
} }