Correct getExtConfig method
sccp_lang did not accept index arg
This commit is contained in:
parent
c271dbf3c2
commit
95cd7b4d9b
|
@ -174,24 +174,23 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function showGroup($group_name, $show_Header, $form_prefix = 'sccp', $form_values = array()) {
|
public function showGroup($group_name, $show_Header, $form_prefix = 'sccp', $form_values = array()) {
|
||||||
$htmlret = "";
|
|
||||||
if (empty($form_values)) {
|
if (empty($form_values)) {
|
||||||
$form_values = $this->sccpvalues;
|
$form_values = $this->sccpvalues;
|
||||||
}
|
}
|
||||||
if ((array) $this->xml_data) {
|
if ((array) $this->xml_data) {
|
||||||
foreach ($this->xml_data->xpath('//page_group[@name="' . $group_name . '"]') as $item) {
|
foreach ($this->xml_data->xpath('//page_group[@name="' . $group_name . '"]') as $item) {
|
||||||
$htmlret .= load_view(__DIR__ . '/views/formShow.php', array(
|
$htmlret = load_view(__DIR__ . '/views/formShow.php', array(
|
||||||
'itm' => $item,
|
'itm' => $item,
|
||||||
'h_show' => $show_Header,
|
'h_show' => $show_Header,
|
||||||
'form_prefix' => $form_prefix,
|
'form_prefix' => $form_prefix,
|
||||||
'fvalues' => $form_values,
|
'fvalues' => $form_values,
|
||||||
'tftp_lang' => $this->tftpLang,
|
'tftp_lang' => $this->tftpLang,
|
||||||
'metainfo' => $this->sccp_metainfo,
|
'metainfo' => $this->sccp_metainfo
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$htmlret .= load_view(__DIR__ . '/views/formShowError.php');
|
$htmlret = load_view(__DIR__ . '/views/formShowError.php');
|
||||||
}
|
}
|
||||||
return $htmlret;
|
return $htmlret;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +200,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function initVarfromDefs() {
|
public function initVarfromDefs() {
|
||||||
foreach ($this->extconfigs->getextConfig('sccpDefaults') as $key => $value) {
|
foreach ($this->extconfigs->getExtConfig('sccpDefaults') as $key => $value) {
|
||||||
if (empty($this->sccpvalues[$key])) {
|
if (empty($this->sccpvalues[$key])) {
|
||||||
$this->sccpvalues[$key] = array('keyword' => $key, 'data' => $value, 'type' => '0', 'seq' => '0');
|
$this->sccpvalues[$key] = array('keyword' => $key, 'data' => $value, 'type' => '0', 'seq' => '0');
|
||||||
}
|
}
|
||||||
|
@ -593,7 +592,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
case 'name':
|
case 'name':
|
||||||
if (!empty($get_settings[$hdr_prefix . 'mac'])) {
|
if (!empty($get_settings[$hdr_prefix . 'mac'])) {
|
||||||
$value = $get_settings[$hdr_prefix . 'mac'];
|
$value = $get_settings[$hdr_prefix . 'mac'];
|
||||||
$value = strtoupper(str_replace(array('.', '-', ':'), '', $value)); // Delete mac Seporated from string
|
$value = strtoupper(str_replace(array('.', '-', ':'), '', $value)); // Delete mac separators from string
|
||||||
$value = sprintf("%012s", $value);
|
$value = sprintf("%012s", $value);
|
||||||
if ($hw_prefix == 'VG') {
|
if ($hw_prefix == 'VG') {
|
||||||
$value = $hw_prefix . $value . '0';
|
$value = $hw_prefix . $value . '0';
|
||||||
|
@ -605,8 +604,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
break;
|
break;
|
||||||
case 'phonecodepage':
|
case 'phonecodepage':
|
||||||
$value = 'null';
|
$value = 'null';
|
||||||
|
// TODO: getExtConfig(sccp_lang ....) does not accept any additional arguments and will return an array
|
||||||
if (!empty($get_settings[$hdr_prefix . 'devlang'])) {
|
if (!empty($get_settings[$hdr_prefix . 'devlang'])) {
|
||||||
$lang_data = $this->extconfigs->getextConfig('sccp_lang', $get_settings[$hdr_prefix . 'devlang']);
|
$lang_data = $this->extconfigs->getExtConfig('sccp_lang', $get_settings[$hdr_prefix . 'devlang']);
|
||||||
if (!empty($lang_data)) {
|
if (!empty($lang_data)) {
|
||||||
$value = $lang_data['codepage'];
|
$value = $lang_data['codepage'];
|
||||||
}
|
}
|
||||||
|
@ -922,7 +922,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
|
if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
|
||||||
$filename = $dir . DIRECTORY_SEPARATOR . $value . DIRECTORY_SEPARATOR . $this->SCCP_LANG_DICTIONARY;
|
$filename = $dir . DIRECTORY_SEPARATOR . $value . DIRECTORY_SEPARATOR . $this->SCCP_LANG_DICTIONARY;
|
||||||
if (file_exists($filename)) {
|
if (file_exists($filename)) {
|
||||||
$lang_ar = $this->extconfigs->getextConfig('sccp_lang');
|
$lang_ar = $this->extconfigs->getExtConfig('sccp_lang');
|
||||||
foreach ($lang_ar as $lang_key => $lang_value) {
|
foreach ($lang_ar as $lang_key => $lang_value) {
|
||||||
if ($lang_value['locale'] == $value) {
|
if ($lang_value['locale'] == $value) {
|
||||||
$result[$lang_key] = $value;
|
$result[$lang_key] = $value;
|
||||||
|
@ -942,11 +942,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
|
|
||||||
private function initializeTFtpLanguagePath() {
|
private function initializeTFtpLanguagePath() {
|
||||||
$dir = $this->sccppath["tftp_lang_path"];
|
$dir = $this->sccppath["tftp_lang_path"];
|
||||||
foreach ($this->extconfigs->getextConfig('sccp_lang') as $lang_key => $lang_value) {
|
foreach ($this->extconfigs->getExtConfig('sccp_lang') as $lang_key => $lang_value) {
|
||||||
$filename = $dir . DIRECTORY_SEPARATOR . $lang_value['locale'];
|
$filename = $dir . DIRECTORY_SEPARATOR . $lang_value['locale'];
|
||||||
if (!file_exists($filename)) {
|
if (!file_exists($filename)) {
|
||||||
if (!mkdir($filename, 0777, true)) {
|
if (!mkdir($filename, 0777, true)) {
|
||||||
die('Error create lang dir');
|
die('Error creating tftp language directory');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1131,7 +1131,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
$model_information = $this->getSccpModelInformation($get = "all", $validate = false); // Get All
|
$model_information = $this->getSccpModelInformation($get = "all", $validate = false); // Get All
|
||||||
}
|
}
|
||||||
|
|
||||||
$lang_data = $this->extconfigs->getextConfig('sccp_lang');
|
$lang_data = $this->extconfigs->getExtConfig('sccp_lang');
|
||||||
$data_value['tftp_path'] = $this->sccppath["tftp_path"];
|
$data_value['tftp_path'] = $this->sccppath["tftp_path"];
|
||||||
|
|
||||||
$this->xmlinterface->create_default_XML($this->sccppath["tftp_path_store"], $data_value, $model_information, $lang_data);
|
$this->xmlinterface->create_default_XML($this->sccppath["tftp_path_store"], $data_value, $model_information, $lang_data);
|
||||||
|
@ -1195,7 +1195,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
$data_value[$key] = $value['data'];
|
$data_value[$key] = $value['data'];
|
||||||
}
|
}
|
||||||
//Get Cisco Code only Old Device
|
//Get Cisco Code only Old Device
|
||||||
$data_value['ntp_timezone_id'] = $this->extconfigs->getextConfig('sccp_timezone', $data_value['ntp_timezone']); // Old Cisco Device
|
$data_value['ntp_timezone_id'] = $this->extconfigs->getExtConfig('sccp_timezone', $data_value['ntp_timezone']); // Old Cisco Device
|
||||||
// $data_value['ntp_timezone_id'] = $data_value['ntp_timezone']; // New Cisco Device !
|
// $data_value['ntp_timezone_id'] = $data_value['ntp_timezone']; // New Cisco Device !
|
||||||
// $data_value['ntp_timezone_id'] = // SPA Cisco Device !
|
// $data_value['ntp_timezone_id'] = // SPA Cisco Device !
|
||||||
$data_value['server_if_list'] = $this->getIpInformation('ip4');
|
$data_value['server_if_list'] = $this->getIpInformation('ip4');
|
||||||
|
@ -1210,7 +1210,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$lang_data = $this->extconfigs->getextConfig('sccp_lang');
|
$lang_data = $this->extconfigs->getExtConfig('sccp_lang');
|
||||||
if (!$sccp_native) {
|
if (!$sccp_native) {
|
||||||
return $this->xmlinterface->create_SEP_SIP_XML($this->sccppath["tftp_path_store"], $data_value, $dev_config, $dev_id, $lang_data);
|
return $this->xmlinterface->create_SEP_SIP_XML($this->sccppath["tftp_path_store"], $data_value, $dev_config, $dev_id, $lang_data);
|
||||||
}
|
}
|
||||||
|
@ -1310,8 +1310,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
$this->sccp_conf_init['general'][$key] = explode(';', $content);
|
$this->sccp_conf_init['general'][$key] = explode(';', $content);
|
||||||
break;
|
break;
|
||||||
case "devlang":
|
case "devlang":
|
||||||
$lang_data = $this->extconfigs->getextConfig('sccp_lang', $value['data']);
|
|
||||||
|
$lang_data = $this->extconfigs->getExtConfig('sccp_lang', $value['data']);
|
||||||
if (!empty($lang_data)) {
|
if (!empty($lang_data)) {
|
||||||
|
// TODO: getExtConfig(sccp_lang ....) does not accept any additional arguments and will return an array
|
||||||
|
// TODO: will always get here, but lang_data['codepage'] will be empty as not a valid key
|
||||||
$this->sccp_conf_init['general']['phonecodepage'] = $lang_data['codepage'];
|
$this->sccp_conf_init['general']['phonecodepage'] = $lang_data['codepage'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1343,7 +1346,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// ----- It is a very bad idea to add an external configuration file "sccp_custom.conf" !!!!
|
// ----- It is a very bad idea to add an external configuration file "sccp_custom.conf" !!!!
|
||||||
|
// TODO: Should only rewrite the general section - if users have extensions, this may overwrite
|
||||||
|
// Should read first and then rewrite all existing sections.
|
||||||
$this->cnf_wr->writeConfig('sccp.conf', $this->sccp_conf_init);
|
$this->cnf_wr->writeConfig('sccp.conf', $this->sccp_conf_init);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,18 @@ class extconfigs
|
||||||
'about' => 'Default Settings and Enums ver: ' . $Ver);
|
'about' => 'Default Settings and Enums ver: ' . $Ver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getextConfig($id = '', $index = '') {
|
public function getExtConfig($id = '', $index = '') {
|
||||||
|
$result = array();
|
||||||
switch ($id) {
|
switch ($id) {
|
||||||
case 'keyset':
|
case 'keyset':
|
||||||
$result = $this->keysetdefault;
|
$result = $this->keysetdefault;
|
||||||
break;
|
break;
|
||||||
case 'sccp_lang':
|
case 'sccp_lang':
|
||||||
$result = $this->cisco_language;
|
if (empty($index)) {
|
||||||
|
return $this->cisco_language; // return language array
|
||||||
|
} elseif (!empty($this->cisco_language[$index])) {
|
||||||
|
return $this->cisco_language[$index]; // return the matched value
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'sccpDefaults':
|
case 'sccpDefaults':
|
||||||
$result = $this->sccpDefaults;
|
$result = $this->sccpDefaults;
|
||||||
|
@ -268,8 +273,8 @@ class extconfigs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($base_config["tftp_path"])) {
|
if (empty($base_config["tftp_path"])) {
|
||||||
if (file_exists($this->getextConfig('sccpDefaults', "tftp_path"))) {
|
if (file_exists($this->getExtConfig('sccpDefaults', "tftp_path"))) {
|
||||||
$base_config["tftp_path"] = $this->getextConfig('sccpDefaults', "tftp_path");
|
$base_config["tftp_path"] = $this->getExtConfig('sccpDefaults', "tftp_path");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($base_config["tftp_path"])) {
|
if (empty($base_config["tftp_path"])) {
|
||||||
|
|
|
@ -255,7 +255,7 @@ trait ajaxHelper {
|
||||||
if (!empty($request['id'])) {
|
if (!empty($request['id'])) {
|
||||||
$id_name = preg_replace('/[^A-Za-z0-9]/', '', $request['id']);
|
$id_name = preg_replace('/[^A-Za-z0-9]/', '', $request['id']);
|
||||||
$this->sccp_conf_init[$id_name]['type'] = "softkeyset";
|
$this->sccp_conf_init[$id_name]['type'] = "softkeyset";
|
||||||
foreach ($this->extconfigs->getextConfig('keyset') as $keyl => $vall) {
|
foreach ($this->extconfigs->getExtConfig('keyset') as $keyl => $vall) {
|
||||||
if (!empty($request[$keyl])) {
|
if (!empty($request[$keyl])) {
|
||||||
$this->sccp_conf_init[$id_name][$keyl] = $request[$keyl];
|
$this->sccp_conf_init[$id_name][$keyl] = $request[$keyl];
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ trait ajaxHelper {
|
||||||
foreach ($this->aminterface->sccp_list_keysets() as $keyl => $vall) {
|
foreach ($this->aminterface->sccp_list_keysets() as $keyl => $vall) {
|
||||||
$result[$i]['softkeys'] = $keyl;
|
$result[$i]['softkeys'] = $keyl;
|
||||||
if ($keyl == 'default') {
|
if ($keyl == 'default') {
|
||||||
foreach ($this->extconfigs->getextConfig('keyset') as $key => $value) {
|
foreach ($this->extconfigs->getExtConfig('keyset') as $key => $value) {
|
||||||
$result[$i][$key] = str_replace(',', '<br>', $value);
|
$result[$i][$key] = str_replace(',', '<br>', $value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -509,7 +509,7 @@ trait ajaxHelper {
|
||||||
|
|
||||||
case 'ntp_timezone':
|
case 'ntp_timezone':
|
||||||
$tz_id = $value;
|
$tz_id = $value;
|
||||||
$TZdata = $this->extconfigs->getextConfig('sccp_timezone', $tz_id);
|
$TZdata = $this->extconfigs->getExtConfig('sccp_timezone', $tz_id);
|
||||||
if (!empty($TZdata)) {
|
if (!empty($TZdata)) {
|
||||||
$value = $TZdata['offset']/60;
|
$value = $TZdata['offset']/60;
|
||||||
if (!($this->sccpvalues['tzoffset']['data'] == $value)) {
|
if (!($this->sccpvalues['tzoffset']['data'] == $value)) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
$keymultiselect = array('AllRight' =>'>>', 'Right' => '>', 'AllLeft' => '<<', 'Left' => '<');
|
$keymultiselect = array('AllRight' =>'>>', 'Right' => '>', 'AllLeft' => '<<', 'Left' => '<');
|
||||||
|
|
||||||
// ------------------------------------- Key Set Value ---------------------------------------------------------
|
// ------------------------------------- Key Set Value ---------------------------------------------------------
|
||||||
$keysetarray = $this->extconfigs->getextConfig('keyset');
|
$keysetarray = $this->extconfigs->getExtConfig('keyset');
|
||||||
|
|
||||||
/*$keysetarray1 = array('onhook' => array('redial','newcall','cfwdall','dnd','pickup','gpickup','private'),
|
/*$keysetarray1 = array('onhook' => array('redial','newcall','cfwdall','dnd','pickup','gpickup','private'),
|
||||||
'connected' => array('hold','endcall','park','vidmode','select','cfwdall','cfwdbusy','idivert'),
|
'connected' => array('hold','endcall','park','vidmode','select','cfwdall','cfwdbusy','idivert'),
|
||||||
|
|
|
@ -31,16 +31,14 @@ if (empty($form_prefix)) {
|
||||||
$day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA",
|
$day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA",
|
||||||
"D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
|
"D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
|
||||||
$mysql_table = array("sccpdevice","sccpdeviceconfig");
|
$mysql_table = array("sccpdevice","sccpdeviceconfig");
|
||||||
//$time_zone_name = timezone_identifiers_list();
|
|
||||||
$time_zone = array('-12' => 'GMT -12', '-11' => 'GMT -11', '-10' => 'GMT -10', '-09' => 'GMT -9',
|
$timeZoneOffsetList = array('-12' => 'GMT -12', '-11' => 'GMT -11', '-10' => 'GMT -10', '-09' => 'GMT -9',
|
||||||
'-08' => 'GMT -8', '-07' => 'GMT -7', '-06' => 'GMT -6', '-05' => 'GMT -5',
|
'-08' => 'GMT -8', '-07' => 'GMT -7', '-06' => 'GMT -6', '-05' => 'GMT -5',
|
||||||
'-04' => 'GMT -4', '-03' => 'GMT -3', '-02' => 'GMT -2', '-01' => 'GMT -1',
|
'-04' => 'GMT -4', '-03' => 'GMT -3', '-02' => 'GMT -2', '-01' => 'GMT -1',
|
||||||
'00' => 'GMT', '01' => 'GMT +1', '02' => 'GMT +2', '03' => 'GMT +3',
|
'00' => 'GMT', '01' => 'GMT +1', '02' => 'GMT +2', '03' => 'GMT +3',
|
||||||
'04' => 'GMT +4', '05' => 'GMT +5', '06' => 'GMT +6', '07' => 'GMT +7',
|
'04' => 'GMT +4', '05' => 'GMT +5', '06' => 'GMT +6', '07' => 'GMT +7',
|
||||||
'08' => 'GMT +8', '09' => 'GMT +9', '10' => 'GMT +10', '11'=> 'GMT +11', '12' => 'GMT +12');
|
'08' => 'GMT +8', '09' => 'GMT +9', '10' => 'GMT +10', '11'=> 'GMT +11', '12' => 'GMT +12');
|
||||||
|
|
||||||
|
|
||||||
$time_zone_name = array();
|
|
||||||
$extension_list = array();
|
$extension_list = array();
|
||||||
$sofkey_list = array();
|
$sofkey_list = array();
|
||||||
$model_list = array();
|
$model_list = array();
|
||||||
|
@ -440,7 +438,7 @@ foreach ($items as $child) {
|
||||||
$select_opt= $dialplan_list;
|
$select_opt= $dialplan_list;
|
||||||
}
|
}
|
||||||
// if ($child['type'] == 'SLZ') {
|
// if ($child['type'] == 'SLZ') {
|
||||||
// $select_opt= $time_zone;
|
// $select_opt= $timeZoneOffsetList;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
echo '<!-- Begin '.$child->label.' -->';
|
echo '<!-- Begin '.$child->label.' -->';
|
||||||
|
@ -500,7 +498,7 @@ foreach ($items as $child) {
|
||||||
$select_opt= $tftp_lang;
|
$select_opt= $tftp_lang;
|
||||||
}
|
}
|
||||||
if ($child['type'] == 'SLZ') {
|
if ($child['type'] == 'SLZ') {
|
||||||
$select_opt= $time_zone;
|
$select_opt= $timeZoneOffsetList;
|
||||||
// $child->value = ($system_time_zone[offset]/60);
|
// $child->value = ($system_time_zone[offset]/60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ $def_val = null;
|
||||||
$dev_id = null;
|
$dev_id = null;
|
||||||
$sccp_codec = $this->getCodecs('audio', true);
|
$sccp_codec = $this->getCodecs('audio', true);
|
||||||
$video_codecs = $this->getCodecs('video', true);
|
$video_codecs = $this->getCodecs('video', true);
|
||||||
$sccp_disalow_def = $this->extconfigs->getextConfig('sccpDefaults', 'disallow');
|
$sccp_disalow_def = $this->extconfigs->getExtConfig('sccpDefaults', 'disallow');
|
||||||
$sccp_disalow = $sccp_disalow_def;
|
$sccp_disalow = $sccp_disalow_def;
|
||||||
|
|
||||||
if (!empty($_REQUEST['id'])) {
|
if (!empty($_REQUEST['id'])) {
|
||||||
|
|
|
@ -119,7 +119,7 @@ if ($mysql_info['Value'] <= '2000') {
|
||||||
|
|
||||||
// Check Time Zone compatibility
|
// Check Time Zone compatibility
|
||||||
$conf_tz = $this->sccpvalues['ntp_timezone']['data'];
|
$conf_tz = $this->sccpvalues['ntp_timezone']['data'];
|
||||||
$cisco_tz = $this->extconfigs->getextConfig('sccp_timezone', $conf_tz);
|
$cisco_tz = $this->extconfigs->getExtConfig('sccp_timezone', $conf_tz);
|
||||||
if ($cisco_tz['offset'] == 0) {
|
if ($cisco_tz['offset'] == 0) {
|
||||||
if (!empty($conf_tz)) {
|
if (!empty($conf_tz)) {
|
||||||
$tmp_dt = new DateTime(null, new DateTimeZone($conf_tz));
|
$tmp_dt = new DateTime(null, new DateTimeZone($conf_tz));
|
||||||
|
|
Loading…
Reference in a new issue