Change tftp_path names
Change for clarity
This commit is contained in:
parent
fb9ea64134
commit
3a03815daf
|
@ -884,12 +884,12 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
$this->sccppath = array(
|
$this->sccppath = array(
|
||||||
'asterisk' => $this->sccpvalues['asterisk_etc_path']['data'],
|
'asterisk' => $this->sccpvalues['asterisk_etc_path']['data'],
|
||||||
'tftp_path' => $this->sccpvalues['tftp_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_store_path' => $this->sccpvalues['tftp_store_path']['data'],
|
||||||
'tftp_lang_path' => $this->sccpvalues['tftp_lang_path']['data'],
|
'tftp_lang_path' => $this->sccpvalues['tftp_lang_path']['data'],
|
||||||
'tftp_firmware_path' => $this->sccpvalues['tftp_firmware_path']['data'],
|
'tftp_firmware_path' => $this->sccpvalues['tftp_firmware_path']['data'],
|
||||||
'tftp_dialplan' => $this->sccpvalues['tftp_dialplan']['data'],
|
'tftp_dialplan_path' => $this->sccpvalues['tftp_dialplan_path']['data'],
|
||||||
'tftp_softkey' => $this->sccpvalues['tftp_softkey']['data']
|
'tftp_softkey_path' => $this->sccpvalues['tftp_softkey_path']['data']
|
||||||
);
|
);
|
||||||
|
|
||||||
$read_config = $this->cnf_read->getConfig('sccp.conf');
|
$read_config = $this->cnf_read->getConfig('sccp.conf');
|
||||||
|
@ -925,8 +925,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getDialPlanList() {
|
function getDialPlanList() {
|
||||||
$dir = $this->sccppath["tftp_dialplan"] . '/dial*.xml';
|
$dir = $this->sccppath["tftp_dialplan_path"] . '/dial*.xml';
|
||||||
$base_len = strlen($this->sccppath["tftp_dialplan"]) + 1;
|
$base_len = strlen($this->sccppath["tftp_dialplan_path"]) + 1;
|
||||||
$res = glob($dir);
|
$res = glob($dir);
|
||||||
$dp_list = array();
|
$dp_list = array();
|
||||||
foreach ($res as $key => $value) {
|
foreach ($res as $key => $value) {
|
||||||
|
@ -937,7 +937,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDialPlan($get_file) {
|
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)) {
|
if (file_exists($file)) {
|
||||||
|
|
||||||
$fileContents = file_get_contents($file);
|
$fileContents = file_get_contents($file);
|
||||||
|
@ -951,7 +951,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
|
|
||||||
function deleteDialPlan($get_file) {
|
function deleteDialPlan($get_file) {
|
||||||
if (!empty($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)) {
|
if (file_exists($file)) {
|
||||||
$res = unlink($file);
|
$res = unlink($file);
|
||||||
}
|
}
|
||||||
|
@ -961,7 +961,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
|
|
||||||
function saveDialPlan($get_settings) {
|
function saveDialPlan($get_settings) {
|
||||||
|
|
||||||
$confDir = $this->sccppath["tftp_dialplan"];
|
$confDir = $this->sccppath["tftp_dialplan_path"];
|
||||||
return $this->xmlinterface->saveDialPlan($confDir, $get_settings);
|
return $this->xmlinterface->saveDialPlan($confDir, $get_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1123,7 +1123,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
if (!$sccp_native) {
|
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_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 = '') {
|
function deleteSccpDeviceXML($dev_id = '') {
|
||||||
|
@ -1265,7 +1265,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
$file_ext = array('.loads', '.sbn', '.bin', '.zup');
|
$file_ext = array('.loads', '.sbn', '.bin', '.zup');
|
||||||
// $dir = $this->sccppath["tftp_path"];
|
// $dir = $this->sccppath["tftp_path"];
|
||||||
$dir = $this->sccppath['tftp_firmware_path'];
|
$dir = $this->sccppath['tftp_firmware_path'];
|
||||||
$dir_tepl = $this->sccppath['tftp_templates'];
|
$dir_tepl = $this->sccppath['tftp_templates_path'];
|
||||||
|
|
||||||
$search_mode = '';
|
$search_mode = '';
|
||||||
if (!empty($this->sccpvalues['tftp_rewrite'])) {
|
if (!empty($this->sccpvalues['tftp_rewrite'])) {
|
||||||
|
|
|
@ -270,12 +270,12 @@ class extconfigs
|
||||||
'softkey' => ''
|
'softkey' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
$base_tree = array('tftp_templates' => 'templates',
|
$base_tree = array('tftp_templates_path' => 'templates',
|
||||||
'tftp_store_path' => 'settings',
|
'tftp_store_path' => 'settings',
|
||||||
'tftp_lang_path' => 'languages',
|
'tftp_lang_path' => 'languages',
|
||||||
'tftp_firmware_path' => 'firmware',
|
'tftp_firmware_path' => 'firmware',
|
||||||
'tftp_dialplan' => 'dialplan',
|
'tftp_dialplan_path' => 'dialplan',
|
||||||
'tftp_softkey' => 'softkey'
|
'tftp_softkey_path' => 'softkey'
|
||||||
);
|
);
|
||||||
|
|
||||||
$base_config = array();
|
$base_config = array();
|
||||||
|
@ -333,9 +333,9 @@ class extconfigs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Need to add index.cnf, after setting defaults correctly
|
// 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/';
|
$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) {
|
foreach (glob($src_path . '*.*_template') as $filename) {
|
||||||
copy($filename, $dst_path . basename($filename));
|
copy($filename, $dst_path . basename($filename));
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,10 +136,16 @@ class xmlinterface
|
||||||
'phoneServices' => 'null', 'certHash' => 'null',
|
'phoneServices' => 'null', 'certHash' => 'null',
|
||||||
'deviceSecurityMode' => '1');
|
'deviceSecurityMode' => '1');
|
||||||
|
|
||||||
$data_path = $dev_config['tftp_templates'];
|
$data_path = $dev_config['tftp_templates_path'];
|
||||||
if (empty($data_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'])) {
|
if (!empty($dev_config['nametemplate'])) {
|
||||||
$xml_template = "{$data_path}/{$dev_config['nametemplate']}";
|
$xml_template = "{$data_path}/{$dev_config['nametemplate']}";
|
||||||
} else {
|
} else {
|
||||||
|
@ -577,7 +583,7 @@ class xmlinterface
|
||||||
case 'softKeyFile':
|
case 'softKeyFile':
|
||||||
case 'dialTemplate': // Доработать !
|
case 'dialTemplate': // Доработать !
|
||||||
$xml_ext_file = '';
|
$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';
|
$tmp_key = ($dkey == 'softKeyFile') ? 'softkeyset' : '_dialrules';
|
||||||
if (!empty($dev_config[$tmp_key])) {
|
if (!empty($dev_config[$tmp_key])) {
|
||||||
$xml_ext_file = (($dkey == 'softKeyFile') ? 'softkey' . $dev_config[$tmp_key] . '.xml' : $dev_config[$tmp_key] . '.xml');
|
$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 (empty($config[$name])) {
|
||||||
if ($name == 'default') {
|
if ($name == 'default') {
|
||||||
$typeSoft = $confDir["tftp_templates"] . '/SIPDefaultSoftKey.xml_template';
|
$typeSoft = $confDir["tftp_templates_path"] . '/SIPDefaultSoftKey.xml_template';
|
||||||
if (file_exists($typeSoft)) {
|
if (file_exists($typeSoft)) {
|
||||||
$file = $confDir["tftp_softkey"] . '/softkey' . $name . '.xml';
|
$file = $confDir["tftp_softkey_path"] . '/softkey' . $name . '.xml';
|
||||||
if (!copy($typeSoft, $file)) {
|
if (!copy($typeSoft, $file)) {
|
||||||
return array('error' => 'Access error' . $name);
|
return array('error' => 'Access error' . $name);
|
||||||
}
|
}
|
||||||
|
@ -736,7 +742,7 @@ class xmlinterface
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$xmlstr = "<softKeyCfg>\n";
|
$xmlstr = "<softKeyCfg>\n";
|
||||||
$xmlstr .= "<versionStamp>" . time() . "</versionStamp>\n";
|
$xmlstr .= "<versionStamp>" . time() . "</versionStamp>\n";
|
||||||
$typeSoft = $confDir["tftp_templates"] . '/SIPTypeSoftKey.xml_template';
|
$typeSoft = $confDir["tftp_templates_path"] . '/SIPTypeSoftKey.xml_template';
|
||||||
$read_soft = "";
|
$read_soft = "";
|
||||||
if (file_exists($typeSoft)) {
|
if (file_exists($typeSoft)) {
|
||||||
$f_read = fopen($typeSoft, 'r');
|
$f_read = fopen($typeSoft, 'r');
|
||||||
|
@ -758,7 +764,7 @@ class xmlinterface
|
||||||
|
|
||||||
$xmlstr .= '</softKeyCfg>';
|
$xmlstr .= '</softKeyCfg>';
|
||||||
if (empty($errors)) {
|
if (empty($errors)) {
|
||||||
$file = $confDir["tftp_softkey"] . '/softkey' . $name . '.xml';
|
$file = $confDir["tftp_softkey_path"] . '/softkey' . $name . '.xml';
|
||||||
file_put_contents($file, $xmlstr);
|
file_put_contents($file, $xmlstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue