Adjust the provisioning for the new filename {$mac} syntax.
This commit is contained in:
@@ -285,14 +285,14 @@ include "resources/classes/template.php";
|
|||||||
|
|
||||||
//if $file is not provided then look for a default file that exists
|
//if $file is not provided then look for a default file that exists
|
||||||
if (strlen($file) == 0) {
|
if (strlen($file) == 0) {
|
||||||
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{v_mac}")) {
|
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{\$mac}")) {
|
||||||
$file = "{v_mac}";
|
$file = "{\$mac}";
|
||||||
}
|
}
|
||||||
elseif (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{v_mac}.xml")) {
|
elseif (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{\$mac}.xml")) {
|
||||||
$file = "{v_mac}.xml";
|
$file = "{\$mac}.xml";
|
||||||
}
|
}
|
||||||
elseif (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{v_mac}.cfg")) {
|
elseif (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{\$mac}.cfg")) {
|
||||||
$file = "{v_mac}.cfg";
|
$file = "{\$mac}.cfg";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "file not found";
|
echo "file not found";
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ else {
|
|||||||
|
|
||||||
//prepare the files
|
//prepare the files
|
||||||
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
|
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
|
||||||
$file_contents = str_replace("{v_mac}", $device_mac_address, $file_contents);
|
$file_contents = str_replace("{\$mac}", $device_mac_address, $file_contents);
|
||||||
$file_contents = str_replace("{v_label}", $device_label, $file_contents);
|
$file_contents = str_replace("{v_label}", $device_label, $file_contents);
|
||||||
$file_contents = str_replace("{v_firmware_version}", $device_firmware_version, $file_contents);
|
$file_contents = str_replace("{v_firmware_version}", $device_firmware_version, $file_contents);
|
||||||
$file_contents = str_replace("{domain_time_zone}", $device_time_zone, $file_contents);
|
$file_contents = str_replace("{domain_time_zone}", $device_time_zone, $file_contents);
|
||||||
@@ -208,7 +208,7 @@ else {
|
|||||||
//replace the dynamic provision variables that are defined in 'default settings' and 'domain settings';
|
//replace the dynamic provision variables that are defined in 'default settings' and 'domain settings';
|
||||||
//example: category=provision, subcategory=sip_transport, name=var, value=tls - used in the template as {v_sip_transport}
|
//example: category=provision, subcategory=sip_transport, name=var, value=tls - used in the template as {v_sip_transport}
|
||||||
foreach($_SESSION['provision'] as $key=>$value) {
|
foreach($_SESSION['provision'] as $key=>$value) {
|
||||||
$file_contents = str_replace('{v_'.$key.'}', $value['var'], $file_contents);
|
$file_contents = str_replace('{$'.$key.'}', $value['var'], $file_contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
//create a mac address with back slashes for backwards compatability
|
//create a mac address with back slashes for backwards compatability
|
||||||
@@ -263,14 +263,14 @@ else {
|
|||||||
$file_contents = str_replace("{v_line".$i."_user_password}", "", $file_contents);
|
$file_contents = str_replace("{v_line".$i."_user_password}", "", $file_contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
//replace {v_mac} in the file name
|
//replace {$mac} in the file name
|
||||||
if ($device_vendor == "aastra" || $device_vendor == "cisco") {
|
if ($device_vendor == "aastra" || $device_vendor == "cisco") {
|
||||||
//upper case the mac address for aastra phones
|
//upper case the mac address for aastra phones
|
||||||
$file_name = str_replace("{v_mac}", strtoupper($device_mac_address), $file_name);
|
$file_name = str_replace("{\$mac}", strtoupper($device_mac_address), $file_name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//all other phones
|
//all other phones
|
||||||
$file_name = str_replace("{v_mac}", $device_mac_address, $file_name);
|
$file_name = str_replace("{\$mac}", $device_mac_address, $file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//write the configuration to the directory
|
//write the configuration to the directory
|
||||||
|
|||||||
Reference in New Issue
Block a user