diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index 92b7eaa..8aa9c1a 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -1036,6 +1036,16 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { 'type' => $this->sccpvalues['allow']['type']); } break; + + case 'sccp_ntp_timezone': + $tz_id = $value; + $TZdata = $this-> extconfigs->getextConfig('sccp_timezone',$tz_id); + if (!empty($TZdata)){ + $save_settings[] = array('keyword' => 'tzoffset', 'data' => ($TZdata['offset']/60), + 'seq' => '98', + 'type' => '2'); + } + break; } } if (!empty($save_settings)) { @@ -1746,9 +1756,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { switch ($dkey) { case 'dateTimeSetting': $xnode = &$xml_node->$dkey; - $xnode->name = $this->sccpvalues['ntp_timezone']['data']; + $tz_id = $this->sccpvalues['ntp_timezone']['data']; + $TZdata = $this-> extconfigs->getextConfig('sccp_timezone',$tz_id); + if (empty($TZdata)){ + $TZdata = array('offset' => '0', 'daylight' => ''); + } + $xnode->name = $tz_id; $xnode->dateTemplate = $this->sccpvalues['dateformat']['data']; - $xnode->timeZone = $this->sccpvalues['ntp_timezone']['data']; + $xnode->timeZone = $tz_id.((empty($TZdata['daylight']))? '': '/'.$TZdata['daylight']); + if ($this->sccpvalues['ntp_config_enabled']['data'] == 'yes') { $xnode->ntps->ntp->name = $this->sccpvalues['ntp_server']['data']; $xnode->ntps->ntp->ntpMode = $this->sccpvalues['ntp_server_mode']['data']; diff --git a/Sccp_manager.inc/extconfigs.class.php b/Sccp_manager.inc/extconfigs.class.php index a0e936e..4f17c0e 100644 --- a/Sccp_manager.inc/extconfigs.class.php +++ b/Sccp_manager.inc/extconfigs.class.php @@ -23,7 +23,23 @@ class extconfigs { case 'sccpDefaults': $result = $this->sccpDefaults; break; - + case 'sccp_timezone': + $result = $this->cisco_timezone; + break; + case 'cisco_time': + $result = array(); + foreach ($this->cisco_timezone as $key => $value) { + $result[] = array('id'=> ($value['offset']/60) ,'val'=>$key.((empty($value['daylight']))? '': '/'.$value['daylight'])); + } + break; + + case 'cisco_timezone': + $result = array(); + foreach ($this->cisco_timezone as $key => $value) { + $result[] = array('id'=> $key ,'val'=>$key.((empty($value['daylight']))? '': '/'.$value['daylight'])); +// $result[$key] =$key.((empty($value['daylight']))? '': '/'.$value['daylight']); + } + break; default: return array('noId'); break; @@ -114,72 +130,75 @@ class extconfigs { ); private $cisco_timezone = array( - 'Dateline' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Samoa' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Hawaiian' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Alaskan' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Pacific' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Mountain' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'US Mountain' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Central' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Mexico' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Canada Central' => array('offset' => '-12', 'time' => 'Standard Time'), - 'SA Pacific' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Eastern' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'US Eastern' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Atlantic' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'SA Western' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Newfoundland' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'South America' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'SA Eastern' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Mid-Atlantic' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Azores' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'GMT' => array('offset' => '00', 'time' => 'Standard/Daylight Time'), - 'Greenwich' => array('offset' => '00', 'time' => 'Standard Time'), - 'W. Europe' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'GTB' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Egypt' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'E. Europe' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Romance' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Central Europe' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'South Africa' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Jerusalem' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Saudi Arabia' => array('offset' => '-12', 'time' => 'Standard Time'), + 'Dateline' => array('offset' => '-720', 'daylight' => ''), + 'Samoa' => array('offset' => '-660', 'daylight' => ''), + 'Hawaiian' => array('offset' => '-600', 'daylight' => ''), + 'Alaskan' => array('offset' => '-540', 'daylight' => 'Daylight Time'), + 'Pacific' => array('offset' => '-480', 'daylight' => 'Daylight Time'), + 'Mountain' => array('offset' => '-420', 'daylight' => 'Daylight Time'), + 'US Mountain' => array('offset' => '-420', 'daylight' => ''), + 'Central' => array('offset' => '-360', 'daylight' => 'Daylight Time'), + 'Mexico' => array('offset' => '-360', 'daylight' => 'Daylight Time'), + 'Canada Central' => array('offset' => '-360', 'daylight' => ''), + 'SA Pacific' => array('offset' => '-300', 'daylight' => ''), + 'Eastern' => array('offset' => '-300', 'daylight' => 'Daylight Time'), + 'US Eastern' => array('offset' => '-300', 'daylight' => ''), + 'Atlantic' => array('offset' => '-240', 'daylight' => 'Daylight Time'), + 'SA Western' => array('offset' => '-240', 'daylight' => ''), + 'Pacific SA' => array('offset' => '-240', 'daylight' => ''), + 'Newfoundland' => array('offset' => '-210', 'daylight' => 'Daylight Time'), + 'E. South America' => array('offset' => '-180', 'daylight' => 'Daylight Time'), + 'SA Eastern' => array('offset' => '-180', 'daylight' => ''), + 'Pacific SA' => array('offset' => '-180', 'daylight' => 'Daylight Time'), + 'Mid-Atlantic' => array('offset' => '-120', 'daylight' => 'Daylight Time'), + 'Azores' => array('offset' => '-060', 'daylight' => 'Daylight Time'), + 'GMT' => array('offset' => '00', 'daylight' => 'Daylight Time'), + 'Greenwich' => array('offset' => '00', 'daylight' => ''), + 'W. Europe' => array('offset' => '60', 'daylight' => 'Daylight Time'), + 'GTB' => array('offset' => '60', 'daylight' => 'Daylight Time'), + 'Egypt' => array('offset' => '60', 'daylight' => 'Daylight Time'), + 'E. Europe' => array('offset' => '60', 'daylight' => 'Daylight Time'), + 'Romance' => array('offset' => '120', 'daylight' => 'Daylight Time'), + 'Central Europe' => array('offset' => '120', 'daylight' => 'Daylight Time'), + 'South Africa' => array('offset' => '120', 'daylight' => ''), + 'Jerusalem' => array('offset' => '120', 'daylight' => 'Daylight Time'), + 'Saudi Arabia' => array('offset' => '180', 'daylight' => ''), /* Russion Regions */ - 'Russian/Kaliningrad' => array('offset' => '02', 'time' => 'Standard/Daylight Time'), - 'Russian/Moscow' => array('offset' => '03', 'time' => 'Standard/Daylight Time'), - 'Russian/St.Peterburg' => array('offset' => '03', 'time' => 'Standard/Daylight Time'), - 'Russian/Samara' => array('offset' => '04', 'time' => 'Standard/Daylight Time'), - 'Russian/Novosibirsk' => array('offset' => '07', 'time' => 'Standard/Daylight Time'), - 'Russian/Ekaterinburg' => array('offset' => '07', 'time' => 'Standard/Daylight Time'), - 'Russian/Irkutsk' => array('offset' => '08', 'time' => 'Standard/Daylight Time'), - 'Russian/Yakutsk' => array('offset' => '09', 'time' => 'Standard/Daylight Time'), - 'Russian/Khabarovsk' => array('offset' => '10', 'time' => 'Standard/Daylight Time'), - 'Russian/Vladivostok' => array('offset' => '10', 'time' => 'Standard/Daylight Time'), - 'Russian/Sakhalin' => array('offset' => '11', 'time' => 'Standard/Daylight Time'), - 'Russian/Magadan' => array('offset' => '11', 'time' => 'Standard/Daylight Time'), - 'Russian/Kamchatka' => array('offset' => '12', 'time' => 'Standard/Daylight Time'), + 'Russian/Kaliningrad' => array('offset' => '120', 'daylight' => ''), + 'Russian/Moscow' => array('offset' => '180', 'daylight' => ''), + 'Russian/St.Peterburg' => array('offset' => '180', 'daylight' => ''), + 'Russian/Samara' => array('offset' => '240', 'daylight' => ''), + 'Russian/Novosibirsk' => array('offset' => '300', 'daylight' => ''), + 'Russian/Ekaterinburg' => array('offset' => '300', 'daylight' => ''), + 'Russian/Irkutsk' => array('offset' => '480', 'daylight' => ''), + 'Russian/Yakutsk' => array('offset' => '540', 'daylight' => ''), + 'Russian/Khabarovsk' => array('offset' => '600', 'daylight' => ''), + 'Russian/Vladivostok' => array('offset' => '600', 'daylight' => ''), + 'Russian/Sakhalin' => array('offset' => '660', 'daylight' => ''), + 'Russian/Magadan' => array('offset' => '660', 'daylight' => ''), + 'Russian/Kamchatka' => array('offset' => '720', 'daylight' => ''), /* EnD - Russion Regions */ - 'Iran' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Caucasus' => array('offset' => '-12', 'time' => 'Standard/Daylight Time'), - 'Arabian' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Afghanistan' => array('offset' => '-12', 'time' => 'Standard Time'), - 'West Asia' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Central Asia' => array('offset' => '-12', 'time' => 'Standard Time'), - 'SE Asia' => array('offset' => '-12', 'time' => 'Standard Time'), - 'China' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Taipei' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Tokyo' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Cen. Australia' => array('offset' => '10', 'time' => 'Standard/Daylight Time'), - 'AUS Central' => array('offset' => '-12', 'time' => 'Standard Time'), - 'E. Australia' => array('offset' => '-12', 'time' => 'Standard Time'), - 'AUS Eastern' => array('offset' => '10', 'time' => 'Standard/Daylight Time'), - 'West Pacific' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Tasmania' => array('offset' => '10', 'time' => 'Standard/Daylight Time'), - 'Central Pacific' => array('offset' => '-12', 'time' => 'Standard Time'), - 'Fiji' => array('offset' => '-12', 'time' => 'Standard Time'), - 'New Zealand' => array('offset' => '10', 'time' => 'Standard/Daylight Time') + 'Iran' => array('offset' => '210', 'daylight' => 'Daylight Time'), + 'Caucasus' => array('offset' => '240', 'daylight' => 'Daylight Time'), + 'Arabian' => array('offset' => '240', 'daylight' => ''), + 'Afghanistan' => array('offset' => '270', 'daylight' => ''), + 'West Asia' => array('offset' => '300', 'daylight' => ''), + 'India' => array('offset' => '330', 'daylight' => ''), + 'Central Asia' => array('offset' => '360', 'daylight' => ''), + 'SE Asia' => array('offset' => '420', 'daylight' => ''), + 'China' => array('offset' => '480', 'daylight' => ''), + 'Taipei' => array('offset' => '480', 'daylight' => ''), + 'Tokyo' => array('offset' => '540', 'daylight' => ''), + 'Cen. Australia' => array('offset' => '570', 'daylight' => 'Daylight Time'), + 'AUS Central' => array('offset' => '570', 'daylight' => ''), + 'E. Australia' => array('offset' => '600', 'daylight' => ''), + 'AUS Eastern' => array('offset' => '600', 'daylight' => 'Daylight Time'), + 'West Pacific' => array('offset' => '600', 'daylight' => ''), + 'Tasmania' => array('offset' => '600', 'daylight' => 'Daylight Time'), + 'Central Pacific' => array('offset' => '660', 'daylight' => ''), + 'Fiji' => array('offset' => '720', 'daylight' => ''), + 'New Zealand' => array('offset' => '720', 'daylight' => 'Daylight Time') ); } \ No newline at end of file diff --git a/conf/sccpgeneral.xml.v11 b/conf/sccpgeneral.xml.v11 index ebb3637..460dce4 100644 --- a/conf/sccpgeneral.xml.v11 +++ b/conf/sccpgeneral.xml.v11 @@ -283,6 +283,7 @@ and open the template in the editor. Base Version before all crash :-) ntp_timezone + sccp-custom diff --git a/install.php b/install.php index ae6c364..63b5459 100644 --- a/install.php +++ b/install.php @@ -11,7 +11,6 @@ global $version; global $srvinterface; - $class = "\\FreePBX\\Modules\\Sccp_manager\\srvinterface"; if(!class_exists($class,false)) { include(__DIR__."/Sccp_manager.inc/srvinterface.class.php"); @@ -603,6 +602,71 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_comatable) { return true; } +function Setup_RealTime() { + global $amp_conf; + outn("
  • " . _("Pre config RealTime") . "
  • "); + $cnf_int = \FreePBX::Config(); + $cnf_wr = \FreePBX::WriteConfig(); + $cnf_read = \FreePBX::LoadConfig(); + $def_config =array('sccpdevice' => 'mysql,sccp,sccpdeviceconfig','sccpline' => ' mysql,sccp,sccpline'); + $def_bd_config = array('dbhost' => $amp_conf['AMPDBHOST'], 'dbname' => $amp_conf['AMPDBNAME'], + 'dbuser' => $amp_conf['AMPDBUSER'], 'dbpass' => $amp_conf['AMPDBPASS'], + 'dbport' => '3306', 'dbsock' => '/var/lib/mysql/mysql.sock'); + $def_bd_sec = 'sccp'; + + $dir = $cnf_int->get('ASTETCDIR'); + + $res_conf_old = ''; + $res_conf = ''; + $ext_conf = ''; + if (file_exists($dir. '/extconfig.conf')) { + $ext_conf = $cnf_read->getConfig('extconfig.conf'); + } + + if (!empty($ext_conf)) { + $tmp = array(); + if (!empty($ext_conf['settings']['sccpdevice'])) { + $tmp = explode(',', $ext_conf['settings']['sccpdevice']); + $def_config['sccpdevice']=$ext_conf['settings']['sccpdevice']; + } + if (!empty($ext_conf['settings']['sccpline'])) { + if (empty($tmp)){ + $tmp = explode(',', $ext_conf['settings']['sccpline']); + $tmp[2] ='sccpdevice'; + $def_config['sccpdevice']= implode(',', $tmp); + } + $def_config['sccpline']=$ext_conf['settings']['sccpline']; + } + if (!empty($tmp)){ + $def_bd_sec = $tmp[1]; + } + } + $ext_conf['settings']['sccpdevice'] = $def_config['sccpdevice']; + $ext_conf['settings']['sccpline'] = $def_config['sccpline']; + + if (file_exists($dir. '/res_mysql.conf')) { + $res_conf = $cnf_read->getConfig('res_mysql.conf'); + if (empty($res_conf[$def_bd_sec])) { + $res_conf[$def_bd_sec] = $def_bd_config; + } + $cnf_wr -> writeConfig('res_mysql.conf', $res_conf,false); + } + if (file_exists($dir. '/res_config_mysql.conf')) { + $res_conf = $cnf_read->getConfig('res_config_mysql.conf'); + if (empty($res_conf_old[$def_bd_sec])) { + $res_conf[$def_bd_sec] = $def_bd_config; + } + $cnf_wr -> writeConfig('res_config_mysql.conf', $res_conf,false); + } + if (empty($res_conf)) { + $res_conf[$def_bd_sec] = $def_bd_config; + $res_conf['general']['dbsock'] = $res_conf[$def_bd_sec]['dbsock']; + $cnf_wr -> writeConfig('res_config_mysql.conf', $res_conf,false); + } + $cnf_wr -> writeConfig('extconfig.conf', $ext_conf,false); + +} + CheckSCCPManagerDBTables($table_req); CheckPermissions(); CheckAsteriskVersion(); @@ -615,6 +679,7 @@ InstallDB_fillsccpdevmodel(); InstallDB_updateSccpDevice(); InstallDB_createButtonConfigTrigger(); InstallDB_CreateSccpDeviceConfigView($sccp_comatable); +Setup_RealTime(); outn("
    "); // $ss->save_submit($request); diff --git a/views/formShow.php b/views/formShow.php index 78feeb8..3fec33b 100644 --- a/views/formShow.php +++ b/views/formShow.php @@ -27,10 +27,20 @@ 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", "D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA"); $mysql_table = array("sccpdevice","sccpdeviceconfig"); -$time_zone_name = timezone_identifiers_list(); +//$time_zone_name = timezone_identifiers_list(); +//$time_zone = array("-12", "-11", "-10", "-09", "-08", "-07", "-06", "-05", "-04", "-03", "-02", "-01", "00", +// "01","02","03","04","05","06","07","08","09","10","11","12"); +$time_zone = array('-12' => 'GTM -12', '-11' => 'GTM -11', '-10' => 'GTM -10', '-09' => 'GTM -9', + '-08' => 'GTM -8', '-07' => 'GTM -7', '-06' => 'GTM -6', '-05' => 'GTM -5', + '-04' => 'GTM -4', '-03' => 'GTM -3', '-02' => 'GTM -2', '-01' => 'GTM -1', + '00' => 'GTM time', '01' => 'GTM +1', '02' => 'GTM +2', '03' => 'GTM +3', + '04' => 'GTM +4', '05' => 'GTM +5', '06' => 'GTM +6', '07' => 'GTM +7', + '08' => 'GTM +8', '09' => 'GTM +9', '10' => 'GTM +10', '11'=> 'GTM +11', '12' => 'GTM +12'); + +$time_zone_name = \FreePBX::Sccp_manager()-> extconfigs-> getextConfig('cisco_timezone'); +//$time_zone = \FreePBX::Sccp_manager()-> extconfigs-> getextConfig('cisco_time'); +//$system_time_zone = \FreePBX::Sccp_manager()->getSysnemTimeZone(); -$time_zone = array("-12", "-11", "-10", "-09", "-08", "-07", "-06", "-05", "-04", "-03", "-02", "-01", "00", - "01","02","03","04","05","06","07","08","09","10","11","12"); if (\FreePBX::Modules()->checkStatus("soundlang")) { $syslangs = \FreePBX::Soundlang()->getLanguages(); if (!is_array($syslangs)) { @@ -51,9 +61,7 @@ $extension_list = \FreePBX::Sccp_manager()->dbinterface->get_db_SccpTableData("H $extension_list[]=array(model=>'none', vendor=>'CISCO', dns=>'0'); $items = $itm -> children(); -//print_r($sofkey_list); -//print_r($syslangs); -//print_r($moh_list); + if ($h_show==1) { $sec_class =''; if (!empty($items ->class)){ @@ -284,7 +292,7 @@ foreach ($items as $child) { echo ''; } - + /* * Input element Select SLD - Date format * SLZ - Time Zone @@ -293,7 +301,7 @@ foreach ($items as $child) { * SLK - System KeySet */ - if ($child['type'] == 'SLD' || $child['type'] == 'SLM'|| $child['type'] == 'SLK'|| $child['type'] == 'SLZ' || $child['type'] == 'SLZN') { + if ($child['type'] == 'SLD' || $child['type'] == 'SLM'|| $child['type'] == 'SLK' ) { // $value = $child -> select; $res_n = (string)$child ->name; $res_id = $npref.$res_n; @@ -304,21 +312,16 @@ foreach ($items as $child) { if ($child['type'] == 'SLD') { $select_opt= $day_format; } -// if ($child['type'] == 'SLT') { -// $select_opt= $tftp_lang; -// } + if ($child['type'] == 'SLM') { $select_opt= $moh_list; } if ($child['type'] == 'SLK') { $select_opt= $sofkey_list; } - if ($child['type'] == 'SLZ') { - $select_opt= $time_zone; - } - if ($child['type'] == 'SLZN') { - $select_opt= $time_zone_name; - } +// if ($child['type'] == 'SLZ') { +// $select_opt= $time_zone; +// } echo ''; @@ -359,10 +362,12 @@ foreach ($items as $child) { * Input element Select SLS - System Language */ - if ($child['type'] == 'SLS' || $child['type'] == 'SLT' || $child['type'] == 'SLA') { + if ($child['type'] == 'SLS' || $child['type'] == 'SLT' || $child['type'] == 'SLA' || $child['type'] == 'SLZ' || $child['type'] == 'SLZN') { // $value = $child -> select; $res_n = (string)$child ->name; $res_id = $npref.$res_n; + $child->value =''; + if ($child['type'] == 'SLS') { $select_opt= $syslangs; @@ -370,6 +375,13 @@ foreach ($items as $child) { if ($child['type'] == 'SLT') { $select_opt= $tftp_lang; } + if ($child['type'] == 'SLZN') { + $select_opt= $time_zone_name; + } + if ($child['type'] == 'SLZ') { + $select_opt= $time_zone; +// $child->value = ($system_time_zone[offset]/60); + } if ($child['type'] == 'SLA') { $select_opt =''; @@ -390,6 +402,18 @@ foreach ($items as $child) { $child->class = 'form-control'; } + if (!empty($fvalues[$res_n])) { + if (!empty($fvalues[$res_n]['data'])) { + $child->value = $fvalues[$res_n]['data']; + } + } + + if (empty($child->value)){ + if (!empty($child->default)){ + $child->value = $child->default; + } + } + echo ''; ?>
    @@ -401,17 +425,19 @@ foreach ($items as $child) {
    class . '" id="' . $res_id . '">'; - if (!empty($fvalues[$res_n])) { - if (!empty($fvalues[$res_n]['data'])) { - $child->value = $fvalues[$res_n]['data']; - } - } foreach ($select_opt as $key => $val) { - echo ''; + echo '>' . $opt_val. ''; } ?>
    diff --git a/views/server.setting.php b/views/server.setting.php index f5729d5..30fffed 100644 --- a/views/server.setting.php +++ b/views/server.setting.php @@ -13,9 +13,8 @@ // print_r($this->srvinterface->getCoreSCCPVersion()); // $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK'); // print_r('
    '); -// print_r($this->srvinterface->get_comatable_sccp()); +// print_r(timezone_identifiers_list()); // print_r('
    '); - ?>