From b272cbe68c10e25b5f57efdde2122a3e52be2441 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 18 Jan 2017 10:59:40 +0100 Subject: [PATCH] Strip SSIDs etc. for QRZ and name lookups --- include/functions.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/functions.php b/include/functions.php index 1270f82..fa57025 100644 --- a/include/functions.php +++ b/include/functions.php @@ -443,11 +443,13 @@ function getLastHeard($logLines, $onlyLast) { foreach ($heardList as $listElem) { if ( ($listElem[1] == "D-Star") || ($listElem[1] == "YSF") || ($listElem[1] == "P25") || (startsWith($listElem[1], "DMR")) ) { if(!(array_search($listElem[2]."#".$listElem[1].$listElem[4], $heardCalls) > -1)) { + // Generate a canonicalized call for QRZ and name lookups + $call_canon = preg_replace('/\s+\w$/', '', $listElem[2]); array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[4]); if (defined("ENABLEXTDLOOKUP")) { if ($listElem[2] !== "??????????") { //$listElem[3] = "Dummy"; //Should speed up this function - time-issue! - $listElem[3] = getName($listElem[2]); //Should speed up this function - time-issue! + $listElem[3] = getName($call_canon); //Should speed up this function - time-issue! } else { $listElem[3] = "---"; } @@ -455,9 +457,9 @@ function getLastHeard($logLines, $onlyLast) { if ($listElem[2] !== "??????????") { if (!is_numeric($listElem[2])) { if (defined("SHOWQRZ")) { - $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; + $listElem[2] = "".str_replace("0","Ø",$listElem[2]).""; } else { - $listElem[2] = "".$listElem[2].""; + $listElem[2] = "".$listElem[2].""; } } else { $listElem[2] = "".$listElem[2]."";