From e7972fca64eeb49d0b03c5e99b41f08d974dedc7 Mon Sep 17 00:00:00 2001 From: CT2JAY Date: Mon, 13 Mar 2017 14:31:31 +0000 Subject: [PATCH] Fix database compatibility with DMR-MARC and BrandMeister network --- include/functions.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/functions.php b/include/functions.php index a81bc6c..22e2e63 100644 --- a/include/functions.php +++ b/include/functions.php @@ -805,13 +805,13 @@ function getName($callsign) { $callsign = substr($callsign,0,strpos($callsign,"-")); } $delimiter =" "; - exec("egrep -m1 '".$callsign.$delimiter."' ".DMRIDDATPATH, $output); - if (count($output) == 0) { - $delimiter = "\t"; - exec("egrep -m1 '".$callsign.$delimiter."' ".DMRIDDATPATH, $output); - } + exec("sed -e 's/[[:space:]]\+/ /g' ".DMRIDDATPATH ." | grep -m1 '".$callsign.$delimiter."'" , $output); +// if (count($output) == 0) { +// $delimiter = "\t"; +// exec("egrep -m1 '".$callsign.$delimiter."' ".DMRIDDATPATH, $output); +// } if (count($output) !== 0) { - $name = substr($output[0], strpos($output[0],$delimiter)+1); + $name = preg_replace('/[\x00-\x1F\x7F-\xA0\xAD]/u', '', substr($output[0], strpos($output[0],$delimiter)+1)); $name = substr($name, strpos($name,$delimiter)+1); $fp = fopen($TMP_CALL_NAME .'.TMP', 'a');