Update dvswitch.sh

This commit is contained in:
RaspbianProyect by HP3ICC 2023-03-19 01:52:06 +00:00
parent 0e347452f6
commit 085dac7fab
1 changed files with 12 additions and 15 deletions

View File

@ -153,21 +153,15 @@ include_once $_SERVER['DOCUMENT_ROOT'].'/include/functions.php';
<?php <?php
$i = 0; $i = 0;
$a = 0; $a = 0;
$dmrCall = ""; $dmrCall = 0;
$dmrIDline = array(); $dmrIDline = file(DMRIDDATPATH."/DMRIds.dat");
$dmrID = fopen(DMRIDDATPATH."/DMRIds.dat", "r"); $countDMRId = count($dmrIDline);
while (!feof($dmrID)) {
$line = fgets($dmrID);
$line = trim($line," \t\n\r\0\x0B");
$dmrIDline[] = $line;
}
fclose($dmrID);
for ($i = 0; ($i <= 19); $i++) { //Last 20 calls for ($i = 0; ($i <= 19); $i++) { //Last 20 calls
if (isset($lastHeard[$i])) { if (isset($lastHeard[$i])) {
$listElem = $lastHeard[$i]; $listElem = $lastHeard[$i];
if ( $listElem[2] ) { if ( $listElem[2] ) {
$utc_time = $listElem[0]; $utc_time = $listElem[0];
$utc_tz = new DateTimeZone('Europe/Paris'); $utc_tz = new DateTimeZone('UTC');
$local_tz = new DateTimeZone(date_default_timezone_get ()); $local_tz = new DateTimeZone(date_default_timezone_get ());
$dt = new DateTime($utc_time, $utc_tz); $dt = new DateTime($utc_time, $utc_tz);
$dt->setTimeZone($local_tz); $dt->setTimeZone($local_tz);
@ -188,15 +182,18 @@ for ($i = 0; ($i <= 19); $i++) { //Last 20 calls
echo "<td align=\"left\">&nbsp;<a href=\"http://www.qrz.com/db/$listElem[2]\" target=\"_blank\"><b>$listElem[2]</b></a></td>"; echo "<td align=\"left\">&nbsp;<a href=\"http://www.qrz.com/db/$listElem[2]\" target=\"_blank\"><b>$listElem[2]</b></a></td>";
} }
} }
for ($a = 0; ($a < count($dmrIDline)); $a++) { $arr2 = strtoupper($listElem[2]);
if (strpos($dmrIDline[$a], $listElem[2]) != false) { for ($a = 0; ($a < $countDMRId); $a++) {
if (strpos($dmrIDline[$a], $arr2." ") != false) {
$arr = explode(" ", strtoupper($dmrIDline[$a])); $arr = explode(" ", strtoupper($dmrIDline[$a]));
if (($arr[1] != $dmrCall) && ($listElem[2] != $dmrCall)) { if ($arr[1] == $arr2) {
echo "<td align=\"left\" style=\"color:red; font-weight:bold;\">&nbsp;<b>$arr[2]</b></a></td>"; echo "<td align=\"left\" style=\"color:red; font-weight:bold;\">&nbsp;<b>$arr[2]</b></a></td>";
$dmrCall = $arr[1]; $dmrCall = 1;
break;
} }
} }
} }
if ($dmrCall == 0) { echo "<td align=\"left\" style=\"color:red; font-weight:bold;\">&nbsp;<b></b></a></td>"; }
if (strlen($listElem[4]) == 1) { $listElem[4] = str_pad($listElem[4], 8, " ", STR_PAD_LEFT); } if (strlen($listElem[4]) == 1) { $listElem[4] = str_pad($listElem[4], 8, " ", STR_PAD_LEFT); }
if ( substr($listElem[4], 0, 6) === 'CQCQCQ' ) { if ( substr($listElem[4], 0, 6) === 'CQCQCQ' ) {
echo "<td align=\"left\">&nbsp;<span style=\"color:#b5651d;font-weight:bold;\">$listElem[4]</span></td>"; echo "<td align=\"left\">&nbsp;<span style=\"color:#b5651d;font-weight:bold;\">$listElem[4]</span></td>";
@ -238,7 +235,7 @@ for ($i = 0; ($i <= 19); $i++) { //Last 20 calls
else { echo "<td style=\"background:#f33;color:#f9f9f9;\">$listElem[8]</td>"; } else { echo "<td style=\"background:#f33;color:#f9f9f9;\">$listElem[8]</td>"; }
} }
echo"</tr>\n"; echo"</tr>\n";
$dmrCall = ""; $dmrCall = 0;
} }
} }
} }