From 122f0bb0a2d45594f05df26e4dd60a0a148039c7 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 2 Jan 2016 16:22:19 -0700 Subject: [PATCH] Remove the + from the format_phone function. --- resources/functions.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/resources/functions.php b/resources/functions.php index bd3b8bc406..b0b0ff5c78 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -835,13 +835,16 @@ function format_string ($format, $data) { //get the format and use it to format the phone number function format_phone($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); + $phone_number = trim($phone_number, "+"); + if (is_numeric($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); + } } } return $phone_number;