diff --git a/ajax.php b/ajax.php index 414eb65..8d14dff 100644 --- a/ajax.php +++ b/ajax.php @@ -46,7 +46,7 @@ if ($_GET['section'] == "ysflink") { $reverseLogLinesYSFGateway = $logLinesYSFGateway; rsort($reverseLogLinesYSFGateway); $activeYSFReflectors = getActiveYSFReflectors(); - $link = getYSFReflectorById(getActualLink($reverseLogLinesYSFGateway, "YSF"), $activeYSFReflectors); + $link = getActualLink($reverseLogLinesYSFGateway, "YSF"); echo $link; } diff --git a/include/functions.php b/include/functions.php index f5bcaa2..8372769 100644 --- a/include/functions.php +++ b/include/functions.php @@ -662,7 +662,7 @@ function getDSTARLinks() { $linkDest = $linx[4][0]; $linkDir = $linx[5][0]; } - $out .= "" . $linkSource . " " . $protocol . "-link to " . $linkDest . " " . $linkDir .""; + $out .= "" . $linkSource . " " . $protocol . "-link to " . $linkDest . " " . $linkDir . ""; } } $out .= ""; @@ -757,19 +757,19 @@ function getActualLink($logLines, $mode) { foreach($logLines as $logLine) { $to = ""; if (strpos($logLine,"Disconnect has been requested")) { - $to = -1; + return _("not linked"); } if (strpos($logLine,"Connect to")) { - $to = substr($logLine, 38, 5); + $to = substr($logLine, 47, 16); } - if (strpos($logLine,"Reverting connection")) { - $to = substr($logLine, 51, 5); - } - if (strpos($logLine,"The ID of this repeater is")) { - $to = -1; - } - if (strpos($logLine,"Automatic connection to")) { - $to = substr($logLine, 51, 5); + //if (strpos($logLine,"Reverting connection")) { + // $to = substr($logLine, 51, 5); + //} + //if (strpos($logLine,"The ID of this repeater is")) { + // $to = -1; + //} + if (strpos($logLine,"Automatic (re-)connection to")) { + $to = substr($logLine, 65, 16); } if ($to !== "") { $fp = fopen('/tmp/YSFState.txt', 'w'); @@ -779,7 +779,7 @@ function getActualLink($logLines, $mode) { } } } else { - return -2; + return _("YSFGateway not running"); } if (file_exists('/tmp/YSFState.txt')) { $fp = fopen('/tmp/YSFState.txt', 'r'); @@ -788,10 +788,10 @@ function getActualLink($logLines, $mode) { if (count($contents)>0){ return $contents; } else { - return -1; + return _("not linked"); } } else { - return -1; + return _("not linked"); } break; } @@ -867,20 +867,6 @@ function getActiveYSFReflectors() { 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[3] === $id) { - return $reflector[0]; - } - } - } -} - function getName($callsign) { if (defined("USESQLITE")) { return resolveNameFromDB($callsign); diff --git a/include/repeaterinfo.php b/include/repeaterinfo.php index 81866f9..aa0fe70 100644 --- a/include/repeaterinfo.php +++ b/include/repeaterinfo.php @@ -37,7 +37,7 @@ echo"".getActualLink($reverseLogLinesMMDVM, "D-Star").""; } if (getEnabled("System Fusion", $mmdvmconfigs) == 1) { - echo"".getYSFReflectorById(getActualLink($reverseLogLinesYSFGateway, "YSF"), $activeYSFReflectors).""; + echo"".getActualLink($reverseLogLinesYSFGateway, "YSF").""; } if (getEnabled("DMR", $mmdvmconfigs) == 1) { if (getConfigItem("DMR Network", "Slot1", $mmdvmconfigs) == "1") {