From a08adce5333759cadd0f741967360d929d17034f Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 31 Jan 2020 21:20:21 -0700 Subject: [PATCH] Update functions.php --- resources/functions.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/resources/functions.php b/resources/functions.php index 42849e3508..d5b37d4f5b 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -720,15 +720,17 @@ function format_string ($format, $data) { //get the format and use it to format the phone number function format_phone($phone_number) { - $phone_number = trim($phone_number, ' +'); - if (is_numeric($phone_number)) { - if (isset($_SESSION["format"]["phone"])) foreach ($_SESSION["format"]["phone"] as &$format) { - $format_count = substr_count($format, 'x'); - $format_count = $format_count + substr_count($format, 'R'); - $format_count = $format_count + substr_count($format, 'r'); - if ($format_count == strlen($phone_number)) { - //format the number - $phone_number = format_string($format, $phone_number); + if (is_numeric(trim($phone_number, ' +'))) { + if (isset($_SESSION["format"]["phone"])) { + $phone_number = trim($phone_number, ' +'); + foreach ($_SESSION["format"]["phone"] as &$format) { + $format_count = substr_count($format, 'x'); + $format_count = $format_count + substr_count($format, 'R'); + $format_count = $format_count + substr_count($format, 'r'); + if ($format_count == strlen($phone_number)) { + //format the number + $phone_number = format_string($format, $phone_number); + } } } }