From b1599f70466c478e829bc98aea64e2a60fb05aff Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 10 Nov 2013 07:26:18 +0000 Subject: [PATCH] Adjust the provisioning for the new filename {$mac} syntax. --- app/provision/index.php | 12 ++++++------ app/provision/provision_write.php | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/provision/index.php b/app/provision/index.php index 11faaa95f4..f92bec7748 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -285,14 +285,14 @@ include "resources/classes/template.php"; //if $file is not provided then look for a default file that exists if (strlen($file) == 0) { - if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{v_mac}")) { - $file = "{v_mac}"; + if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{\$mac}")) { + $file = "{\$mac}"; } - elseif (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{v_mac}.xml")) { - $file = "{v_mac}.xml"; + elseif (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{\$mac}.xml")) { + $file = "{\$mac}.xml"; } - elseif (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{v_mac}.cfg")) { - $file = "{v_mac}.cfg"; + elseif (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/".$device_template ."/{\$mac}.cfg")) { + $file = "{\$mac}.cfg"; } else { echo "file not found"; diff --git a/app/provision/provision_write.php b/app/provision/provision_write.php index 77c76867e4..949f25eacc 100644 --- a/app/provision/provision_write.php +++ b/app/provision/provision_write.php @@ -197,7 +197,7 @@ else { //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 - $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_firmware_version}", $device_firmware_version, $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'; //example: category=provision, subcategory=sip_transport, name=var, value=tls - used in the template as {v_sip_transport} 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 @@ -263,14 +263,14 @@ else { $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") { //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 { //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