Эх сурвалжийг харах

Devices: Prevent duplicate username within domain (if device assigned to a domain) or globally (if domain set to Global).

Functions: Added is_mac() and format_mac() functions.
Nate Jones 10 жил өмнө
parent
commit
6cd24e7b22
1 өөрчлөгдсөн 18 нэмэгдсэн , 0 устгасан
  1. 18 0
      resources/functions.php

+ 18 - 0
resources/functions.php

@@ -1266,4 +1266,22 @@ function number_pad($number,$n) {
 		}
 	}
 
+//mac detection
+	if (!function_exists('is_mac')) {
+		function is_mac($str) {
+			return (preg_match('/([a-fA-F0-9]{2}[:|\-]?){6}/', $str) == 1) ? true : false;
+		}
+	}
+
+//format mac address
+	if (!function_exists('format_mac')) {
+		function format_mac($str, $delim = '-', $case = 'lower') {
+			if (is_mac($str)) {
+				$str = join($delim, str_split($str, 2));
+				$str = ($case == 'upper') ? strtoupper($str) : strtolower($str);
+			}
+			return $str;
+		}
+	}
+
 ?>