Prechádzať zdrojové kódy

Add the format number to destinations list and adjust the function to only process numeric.

Mark Crane 10 rokov pred
rodič
commit
bd1df7d02b
1 zmenil súbory, kde vykonal 9 pridanie a 7 odobranie
  1. 9 7
      resources/functions.php

+ 9 - 7
resources/functions.php

@@ -771,13 +771,15 @@ 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);
+		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;