Ver código fonte

Update functions.php

FusionPBX 5 anos atrás
pai
commit
8ba0d9f7e1
1 arquivos alterados com 11 adições e 9 exclusões
  1. 11 9
      resources/functions.php

+ 11 - 9
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);
+					}
 				}
 			}
 		}