From 3a03815dafad28818ecf9c0bca35cf53b3ed4c60 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Fri, 25 Jun 2021 06:52:43 +0200 Subject: [PATCH] Change tftp_path names Change for clarity --- Sccp_manager.class.php | 20 ++++++++++---------- sccpManClasses/extconfigs.class.php | 10 +++++----- sccpManClasses/xmlinterface.class.php | 20 +++++++++++++------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index c287bb3..e53bd13 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -884,12 +884,12 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $this->sccppath = array( 'asterisk' => $this->sccpvalues['asterisk_etc_path']['data'], 'tftp_path' => $this->sccpvalues['tftp_path']['data'], - 'tftp_templates' => $this->sccpvalues['tftp_templates']['data'], + 'tftp_templates_path' => $this->sccpvalues['tftp_templates_path']['data'], 'tftp_store_path' => $this->sccpvalues['tftp_store_path']['data'], 'tftp_lang_path' => $this->sccpvalues['tftp_lang_path']['data'], 'tftp_firmware_path' => $this->sccpvalues['tftp_firmware_path']['data'], - 'tftp_dialplan' => $this->sccpvalues['tftp_dialplan']['data'], - 'tftp_softkey' => $this->sccpvalues['tftp_softkey']['data'] + 'tftp_dialplan_path' => $this->sccpvalues['tftp_dialplan_path']['data'], + 'tftp_softkey_path' => $this->sccpvalues['tftp_softkey_path']['data'] ); $read_config = $this->cnf_read->getConfig('sccp.conf'); @@ -925,8 +925,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { */ function getDialPlanList() { - $dir = $this->sccppath["tftp_dialplan"] . '/dial*.xml'; - $base_len = strlen($this->sccppath["tftp_dialplan"]) + 1; + $dir = $this->sccppath["tftp_dialplan_path"] . '/dial*.xml'; + $base_len = strlen($this->sccppath["tftp_dialplan_path"]) + 1; $res = glob($dir); $dp_list = array(); foreach ($res as $key => $value) { @@ -937,7 +937,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } function getDialPlan($get_file) { - $file = $this->sccppath["tftp_dialplan"] . '/' . $get_file . '.xml'; + $file = $this->sccppath["tftp_dialplan_path"] . '/' . $get_file . '.xml'; if (file_exists($file)) { $fileContents = file_get_contents($file); @@ -951,7 +951,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { function deleteDialPlan($get_file) { if (!empty($get_file)) { - $file = $this->sccppath["tftp_dialplan"] . '/' . $get_file . '.xml'; + $file = $this->sccppath["tftp_dialplan_path"] . '/' . $get_file . '.xml'; if (file_exists($file)) { $res = unlink($file); } @@ -961,7 +961,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { function saveDialPlan($get_settings) { - $confDir = $this->sccppath["tftp_dialplan"]; + $confDir = $this->sccppath["tftp_dialplan_path"]; return $this->xmlinterface->saveDialPlan($confDir, $get_settings); } @@ -1123,7 +1123,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { if (!$sccp_native) { return $this->xmlinterface->create_SEP_SIP_XML($this->sccppath["tftp_store_path"], $data_value, $dev_config, $dev_id, $lang_data); } - return $this->xmlinterface->create_SEP_XML($this->sccppath["tftp_templates"], $data_value, $dev_config, $dev_id, $lang_data); + return $this->xmlinterface->create_SEP_XML($this->sccppath["tftp_templates_path"], $data_value, $dev_config, $dev_id, $lang_data); } function deleteSccpDeviceXML($dev_id = '') { @@ -1265,7 +1265,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $file_ext = array('.loads', '.sbn', '.bin', '.zup'); // $dir = $this->sccppath["tftp_path"]; $dir = $this->sccppath['tftp_firmware_path']; - $dir_tepl = $this->sccppath['tftp_templates']; + $dir_tepl = $this->sccppath['tftp_templates_path']; $search_mode = ''; if (!empty($this->sccpvalues['tftp_rewrite'])) { diff --git a/sccpManClasses/extconfigs.class.php b/sccpManClasses/extconfigs.class.php index 5937043..c0b01fa 100644 --- a/sccpManClasses/extconfigs.class.php +++ b/sccpManClasses/extconfigs.class.php @@ -270,12 +270,12 @@ class extconfigs 'softkey' => '' ); - $base_tree = array('tftp_templates' => 'templates', + $base_tree = array('tftp_templates_path' => 'templates', 'tftp_store_path' => 'settings', 'tftp_lang_path' => 'languages', 'tftp_firmware_path' => 'firmware', - 'tftp_dialplan' => 'dialplan', - 'tftp_softkey' => 'softkey' + 'tftp_dialplan_path' => 'dialplan', + 'tftp_softkey_path' => 'softkey' ); $base_config = array(); @@ -333,9 +333,9 @@ class extconfigs } } // TODO: Need to add index.cnf, after setting defaults correctly - if (!file_exists($base_config["tftp_templates"] . '/XMLDefault.cnf.xml_template')) { + if (!file_exists($base_config["tftp_templates_path"] . '/XMLDefault.cnf.xml_template')) { $src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/'; - $dst_path = $base_config["tftp_templates"] . '/'; + $dst_path = $base_config["tftp_templates_path"] . '/'; foreach (glob($src_path . '*.*_template') as $filename) { copy($filename, $dst_path . basename($filename)); } diff --git a/sccpManClasses/xmlinterface.class.php b/sccpManClasses/xmlinterface.class.php index 14464b8..aaa7257 100644 --- a/sccpManClasses/xmlinterface.class.php +++ b/sccpManClasses/xmlinterface.class.php @@ -136,10 +136,16 @@ class xmlinterface 'phoneServices' => 'null', 'certHash' => 'null', 'deviceSecurityMode' => '1'); - $data_path = $dev_config['tftp_templates']; + $data_path = $dev_config['tftp_templates_path']; if (empty($data_path)) { - die('Create_SEP_XML data_path not defined'); + die('Create_SEP_XML tftp_templates_path not defined'); } + + $store_path = $dev_config['tftp_store_path']; + if (empty($store_path)) { + die('Create_SEP_XML tftp_store_path not defined'); + } + if (!empty($dev_config['nametemplate'])) { $xml_template = "{$data_path}/{$dev_config['nametemplate']}"; } else { @@ -577,7 +583,7 @@ class xmlinterface case 'softKeyFile': case 'dialTemplate': // Доработать ! $xml_ext_file = ''; - $templet_path = (($dkey == 'softKeyFile') ? $dev_config['tftp_softkey'] : $dev_config['tftp_dialplan']); + $templet_path = (($dkey == 'softKeyFile') ? $dev_config['tftp_softkey_path'] : $dev_config['tftp_dialplan_path']); $tmp_key = ($dkey == 'softKeyFile') ? 'softkeyset' : '_dialrules'; if (!empty($dev_config[$tmp_key])) { $xml_ext_file = (($dkey == 'softKeyFile') ? 'softkey' . $dev_config[$tmp_key] . '.xml' : $dev_config[$tmp_key] . '.xml'); @@ -721,9 +727,9 @@ class xmlinterface { if (empty($config[$name])) { if ($name == 'default') { - $typeSoft = $confDir["tftp_templates"] . '/SIPDefaultSoftKey.xml_template'; + $typeSoft = $confDir["tftp_templates_path"] . '/SIPDefaultSoftKey.xml_template'; if (file_exists($typeSoft)) { - $file = $confDir["tftp_softkey"] . '/softkey' . $name . '.xml'; + $file = $confDir["tftp_softkey_path"] . '/softkey' . $name . '.xml'; if (!copy($typeSoft, $file)) { return array('error' => 'Access error' . $name); } @@ -736,7 +742,7 @@ class xmlinterface $errors = array(); $xmlstr = "\n"; $xmlstr .= "" . time() . "\n"; - $typeSoft = $confDir["tftp_templates"] . '/SIPTypeSoftKey.xml_template'; + $typeSoft = $confDir["tftp_templates_path"] . '/SIPTypeSoftKey.xml_template'; $read_soft = ""; if (file_exists($typeSoft)) { $f_read = fopen($typeSoft, 'r'); @@ -758,7 +764,7 @@ class xmlinterface $xmlstr .= ''; if (empty($errors)) { - $file = $confDir["tftp_softkey"] . '/softkey' . $name . '.xml'; + $file = $confDir["tftp_softkey_path"] . '/softkey' . $name . '.xml'; file_put_contents($file, $xmlstr); }