mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user