diff --git a/include/functions.php b/include/functions.php index 96cdfff..ec02cc7 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,14 +1,12 @@ -1)) { - array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[3]); - array_push($lastHeard, $listElem); + if ( ($listElem[1] == "D-Star") || (startsWith($listElem[1], "DMR")) ) { + if(!(array_search($listElem[2]."#".$listElem[1].$listElem[3], $heardCalls) > -1)) { + array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[3]); + array_push($lastHeard, $listElem); + } } } return $lastHeard; } - -//getLastHeard(); ?> \ No newline at end of file diff --git a/include/tools.php b/include/tools.php index f6f858b..c4d7c0e 100644 --- a/include/tools.php +++ b/include/tools.php @@ -24,4 +24,8 @@ function format_time($seconds) { } return $uptimeString; } + +function startsWith($haystack, $needle) { + return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; +} ?> \ No newline at end of file