Fix vars in strings
This commit is contained in:
parent
8e6d7b7e14
commit
39ac99c600
|
@ -82,7 +82,8 @@
|
|||
|
||||
namespace FreePBX\modules;
|
||||
|
||||
class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||
class Sccp_manager extends \FreePBX_Helpers implements \BMO
|
||||
{
|
||||
/* Field Values for type seq */
|
||||
private $pagedata = null;
|
||||
private $sccp_driver_ver = '11.4'; // Ver fore SCCP.CLASS.PHP
|
||||
|
@ -106,7 +107,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
use \FreePBX\modules\Sccp_Manager\sccpManTraits\ajaxHelper; // TODO should migrate this to child class
|
||||
use \FreePBX\modules\Sccp_Manager\sccpManTraits\bmoFunctions;
|
||||
|
||||
public function __construct($freepbx = null) {
|
||||
public function __construct($freepbx = null)
|
||||
{
|
||||
if ($freepbx == null) {
|
||||
throw new Exception("Not given a FreePBX Object");
|
||||
}
|
||||
|
@ -160,7 +162,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Generate Input elements in Html Code from sccpgeneral.xml
|
||||
*/
|
||||
|
||||
public function showGroup($group_name, $show_Header, $form_prefix = 'sccp', $form_values = array(), $defButton = '') {
|
||||
public function showGroup($group_name, $show_Header, $form_prefix = 'sccp', $form_values = array(), $defButton = '')
|
||||
{
|
||||
|
||||
// load xml data - moved from Construct to simplify Construct.
|
||||
// TODO: This is static data so only load first time. Left as is for dbug.
|
||||
|
@ -179,7 +182,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
if ((array) $this->xml_data) {
|
||||
foreach ($this->xml_data->xpath('//page_group[@name="' . $group_name . '"]') as $item) {
|
||||
$htmlret = load_view(__DIR__ . '/views/formShowSysDefs.php', array(
|
||||
$htmlret = load_view(
|
||||
__DIR__ . '/views/formShowSysDefs.php',
|
||||
array(
|
||||
'itm' => $item,
|
||||
'h_show' => $show_Header,
|
||||
'form_prefix' => $form_prefix,
|
||||
|
@ -201,7 +206,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Load config vars from base array
|
||||
*/
|
||||
|
||||
public function updateTimeZone() {
|
||||
public function updateTimeZone()
|
||||
{
|
||||
// Get latest FreePBX time $timeZoneOffsetList - need to reflect standard/summer time etc
|
||||
$freepbxTZ = \date_default_timezone_get();
|
||||
$this->sccpvalues['ntp_timezone']['data'] = $freepbxTZ;
|
||||
|
@ -218,7 +224,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Show form information - General
|
||||
*/
|
||||
|
||||
public function settingsShowPage() {
|
||||
public function settingsShowPage()
|
||||
{
|
||||
$this->checkTftpMapping();
|
||||
$request = $_REQUEST;
|
||||
$action = !empty($request['action']) ? $request['action'] : '';
|
||||
|
@ -261,7 +268,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $this->pagedata;
|
||||
}
|
||||
|
||||
public function infoServerShowPage() {
|
||||
public function infoServerShowPage()
|
||||
{
|
||||
$request = $_REQUEST;
|
||||
$action = !empty($request['action']) ? $request['action'] : '';
|
||||
$this->pagedata = array(
|
||||
|
@ -274,7 +282,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $this->pagedata;
|
||||
}
|
||||
|
||||
public function advServerShowPage() {
|
||||
public function advServerShowPage()
|
||||
{
|
||||
$request = $_REQUEST;
|
||||
$action = !empty($request['action']) ? $request['action'] : '';
|
||||
$inputform = !empty($request['tech_hardware']) ? $request['tech_hardware'] : '';
|
||||
|
@ -311,7 +320,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $this->pagedata;
|
||||
}
|
||||
|
||||
public function phoneShowPage() {
|
||||
public function phoneShowPage()
|
||||
{
|
||||
$request = $_REQUEST;
|
||||
$action = !empty($request['action']) ? $request['action'] : '';
|
||||
$inputform = !empty($request['tech_hardware']) ? $request['tech_hardware'] : '';
|
||||
|
@ -381,7 +391,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $this->pagedata;
|
||||
}
|
||||
|
||||
public function processPageData() {
|
||||
public function processPageData()
|
||||
{
|
||||
foreach ($this->pagedata as &$page) {
|
||||
// own version of load_view - simplifies passing variables as in object context
|
||||
ob_start();
|
||||
|
@ -397,10 +408,12 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
*
|
||||
*/
|
||||
|
||||
function getPhoneButtons($get_settings, $ref_id = '', $ref_type = 'sccpdevice') {
|
||||
function getPhoneButtons($get_settings, $ref_id = '', $ref_type = 'sccpdevice')
|
||||
{
|
||||
// get Model Buttons info
|
||||
$res = array();
|
||||
$def_feature = array('parkinglot' => array('name' => 'P.slot', 'value' => 'default'),
|
||||
$def_feature = array(
|
||||
'parkinglot' => array('name' => 'P.slot', 'value' => 'default'),
|
||||
'devstate' => array('name' => 'Coffee', 'value' => 'coffee'),
|
||||
'monitor' => array('name' => 'Record Calls', 'value' => '')
|
||||
);
|
||||
|
@ -409,8 +422,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$max_btn = (!empty($get_settings['buttonscount']) ? $get_settings['buttonscount'] : 60);
|
||||
|
||||
for ($it = 0; $it < $max_btn; $it++) {
|
||||
if (!empty($get_settings["button${it}_type"])) {
|
||||
$btn_t = $get_settings["button${it}_type"];
|
||||
if (!empty($get_settings["button{$it}_type"])) {
|
||||
$btn_t = $get_settings["button{$it}_type"];
|
||||
$btn_n = '';
|
||||
$btn_opt = '';
|
||||
if ($it == 0) {
|
||||
|
@ -418,9 +431,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
switch ($btn_t) {
|
||||
case 'feature':
|
||||
$btn_f = $get_settings["button${it}_feature"];
|
||||
$btn_f = $get_settings["button{$it}_feature"];
|
||||
// $btn_opt = (empty($get_settings['button' . $it . '_fvalue'])) ? '' : $get_settings['button' . $it . '_fvalue'];
|
||||
$btn_n = (empty($get_settings["button${it}_flabel"])) ? $def_feature[$btn_f]['name'] : $get_settings["button${it}_flabel"];
|
||||
$btn_n = (empty($get_settings["button{$it}_flabel"])) ? $def_feature[$btn_f]['name'] : $get_settings["button{$it}_flabel"];
|
||||
$btn_opt = $btn_f;
|
||||
if (!empty($def_feature[$btn_f]['value'])) {
|
||||
if (empty($get_settings['button' . $it . '_fvalue'])) {
|
||||
|
@ -444,46 +457,46 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
}
|
||||
$btn_t = 'speeddial';
|
||||
$btn_opt = (string) $get_settings["button${it}_line"];
|
||||
$btn_opt = (string) $get_settings["button{$it}_line"];
|
||||
$db_res = $this->dbinterface->getSccpDeviceTableData('SccpExtension', array('name' => $btn_opt));
|
||||
$btn_n = $db_res[0]['label'];
|
||||
$btn_opt .= ',' . $btn_opt . $this->hint_context['default'];
|
||||
break;
|
||||
case 'speeddial':
|
||||
if (!empty($get_settings["button${it}_input"])) {
|
||||
$btn_n = $get_settings["button${it}_input"];
|
||||
if (!empty($get_settings["button{$it}_input"])) {
|
||||
$btn_n = $get_settings["button{$it}_input"];
|
||||
}
|
||||
if (!empty($get_settings["button${it}_phone"])) {
|
||||
$btn_opt = $get_settings["button${it}_phone"];
|
||||
if (!empty($get_settings["button{$it}_phone"])) {
|
||||
$btn_opt = $get_settings["button{$it}_phone"];
|
||||
if (empty($btn_n)) {
|
||||
$btn_n = $btn_opt;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($get_settings["button${it}_hint"])) {
|
||||
if ($get_settings["button${it}_hint"] == "hint") {
|
||||
if (!empty($get_settings["button{$it}_hint"])) {
|
||||
if ($get_settings["button{$it}_hint"] == "hint") {
|
||||
if (empty($btn_n)) {
|
||||
$btn_t = 'line';
|
||||
$btn_n = $get_settings["button${it}_hline"] . '!silent';
|
||||
$btn_n = $get_settings["button{$it}_hline"] . '!silent';
|
||||
$btn_opt = '';
|
||||
} else {
|
||||
// $btn_opt .= ',' . $get_settings['button' . $it . '_hline'] . $this->hint_context['default'];
|
||||
$btn_opt .= ',' . $get_settings["button${it}_hline"];
|
||||
$btn_opt .= ',' . $get_settings["button{$it}_hline"];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'adv.line':
|
||||
$btn_t = 'line';
|
||||
$btn_n = (string) $get_settings["button${it}_line"];
|
||||
$btn_n .= '@' . (string) $get_settings["button${it}_advline"];
|
||||
$btn_opt = (string) $get_settings["button${it}_advopt"];
|
||||
$btn_n = (string) $get_settings["button{$it}_line"];
|
||||
$btn_n .= '@' . (string) $get_settings["button{$it}_advline"];
|
||||
$btn_opt = (string) $get_settings["button{$it}_advopt"];
|
||||
|
||||
break;
|
||||
case 'line':
|
||||
case 'silent':
|
||||
if (isset($get_settings["button${it}_line"])) {
|
||||
$btn_n = (string) $get_settings["button${it}_line"];
|
||||
if (isset($get_settings["button{$it}_line"])) {
|
||||
$btn_n = (string) $get_settings["button{$it}_line"];
|
||||
if ($it > 0) {
|
||||
if ($btn_t == 'silent') {
|
||||
$btn_n .= '!silent';
|
||||
|
@ -507,7 +520,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $res;
|
||||
}
|
||||
|
||||
function handleRoamingUsers($get_settings, $validateonly = false) {
|
||||
function handleRoamingUsers($get_settings, $validateonly = false)
|
||||
{
|
||||
$hdr_prefix = 'sccp_ru_';
|
||||
$hdr_arprefix = 'sccp_ru-ar_';
|
||||
|
||||
|
@ -582,7 +596,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return array('status' => true, 'search' => '?display=sccp_phone', 'hash' => 'general');
|
||||
}
|
||||
|
||||
public function getCodecs($type, $showDefaults = false) {
|
||||
public function getCodecs($type, $showDefaults = false)
|
||||
{
|
||||
$allSupported = array();
|
||||
$sccpCodec = array_fill_keys(array('alaw', 'ulaw', 'g722', 'g723', 'g726', 'g729', 'gsm', 'h264', 'h263', 'h261'), 0);
|
||||
// First see if have any site defaults
|
||||
|
@ -624,7 +639,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* return finds Language pack
|
||||
*/
|
||||
|
||||
private function findInstLangs() {
|
||||
private function findInstLangs()
|
||||
{
|
||||
//locales and country tones are installed in the tftp_lang_path
|
||||
//Available packs from provisioner are in masterFilesStructure.xml in tftpRoot Path
|
||||
|
||||
|
@ -686,7 +702,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Check tftp/xml file path and permissions
|
||||
*/
|
||||
|
||||
private function initializeTFtpLanguagePath() {
|
||||
private function initializeTFtpLanguagePath()
|
||||
{
|
||||
//$dir = $this->sccppath["tftp_lang_path"];
|
||||
foreach ($this->extconfigs->getExtConfig('sccp_lang') as $langKey => $langValueArr) {
|
||||
$localeDir = $this->sccppath["tftp_lang_path"] . DIRECTORY_SEPARATOR . $langValueArr['locale'];
|
||||
|
@ -702,7 +719,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Check file paths and permissions
|
||||
*/
|
||||
|
||||
function initializeSccpPath() {
|
||||
function initializeSccpPath()
|
||||
{
|
||||
$this->sccppath = array(
|
||||
'asterisk' => $this->sccpvalues['asterisk_etc_path']['data'],
|
||||
'tftp_path' => $this->sccpvalues['tftp_path']['data'],
|
||||
|
@ -730,7 +748,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Soft Key
|
||||
*/
|
||||
|
||||
function createSccpXmlSoftkey() {
|
||||
function createSccpXmlSoftkey()
|
||||
{
|
||||
foreach ($this->aminterface->sccp_list_keysets() as $keyl => $vall) {
|
||||
$this->xmlinterface->create_xmlSoftkeyset($this->sccp_conf_init, $this->sccppath, $keyl);
|
||||
}
|
||||
|
@ -740,7 +759,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* DialPlan
|
||||
*/
|
||||
|
||||
function getDialPlanList() {
|
||||
function getDialPlanList()
|
||||
{
|
||||
$dir = $this->sccppath["tftp_dialplan_path"] . '/dial*.xml';
|
||||
$base_len = strlen($this->sccppath["tftp_dialplan_path"]) + 1;
|
||||
$res = glob($dir);
|
||||
|
@ -750,7 +770,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $res;
|
||||
}
|
||||
|
||||
function getDialPlan($get_file) {
|
||||
function getDialPlan($get_file)
|
||||
{
|
||||
$file = $this->sccppath["tftp_dialplan_path"] . '/' . $get_file . '.xml';
|
||||
if (file_exists($file)) {
|
||||
|
||||
|
@ -763,7 +784,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $res;
|
||||
}
|
||||
|
||||
function deleteDialPlan($get_file) {
|
||||
function deleteDialPlan($get_file)
|
||||
{
|
||||
$file = $this->sccppath["tftp_dialplan_path"] . '/' . $get_file . '.xml';
|
||||
if (file_exists($file)) {
|
||||
$res = unlink($file);
|
||||
|
@ -771,7 +793,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $res;
|
||||
}
|
||||
|
||||
function saveDialPlan($get_settings) {
|
||||
function saveDialPlan($get_settings)
|
||||
{
|
||||
|
||||
$confDir = $this->sccppath["tftp_dialplan_path"];
|
||||
return $this->xmlinterface->saveDialPlan($confDir, $get_settings);
|
||||
|
@ -781,7 +804,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Update buttons Labels on mysql DB
|
||||
*/
|
||||
|
||||
private function updateSccpButtons($hw_list = array()) {
|
||||
private function updateSccpButtons($hw_list = array())
|
||||
{
|
||||
|
||||
$save_buttons = array();
|
||||
$button_list = array();
|
||||
|
@ -836,7 +860,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Create XMLDefault.cnf.xml
|
||||
*/
|
||||
|
||||
function createDefaultSccpXml() {
|
||||
function createDefaultSccpXml()
|
||||
{
|
||||
$data_value = array();
|
||||
foreach ($this->sccpvalues as $key => $value) {
|
||||
$data_value[$key] = $value['data'];
|
||||
|
@ -858,7 +883,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Create (SEP) dev_ID.cnf.xml
|
||||
*/
|
||||
|
||||
function createSccpDeviceXML(string $dev_id) {
|
||||
function createSccpDeviceXML(string $dev_id)
|
||||
{
|
||||
|
||||
$sccp_native = true;
|
||||
$data_value = array();
|
||||
|
@ -931,7 +957,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $this->xmlinterface->create_SEP_XML($this->sccppath["tftp_templates_path"], $data_value, $dev_config, $dev_id);
|
||||
}
|
||||
|
||||
function deleteSccpDeviceXML($dev_id = '') {
|
||||
function deleteSccpDeviceXML($dev_id = '')
|
||||
{
|
||||
if (empty($dev_id)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -953,11 +980,17 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
}
|
||||
|
||||
private function createSccpBackup() {
|
||||
private function createSccpBackup()
|
||||
{
|
||||
global $amp_conf;
|
||||
$dir_info = array();
|
||||
$backup_files = array($amp_conf['ASTETCDIR'] . '/sccp', $amp_conf['ASTETCDIR'] . '/extensions', $amp_conf['ASTETCDIR'] . '/extconfig',
|
||||
$amp_conf['ASTETCDIR'] . '/res_config_mysql', $amp_conf['ASTETCDIR'] . '/res_mysql');
|
||||
$backup_files = array(
|
||||
$amp_conf['ASTETCDIR'] . '/sccp',
|
||||
$amp_conf['ASTETCDIR'] . '/extensions',
|
||||
$amp_conf['ASTETCDIR'] . '/extconfig',
|
||||
$amp_conf['ASTETCDIR'] . '/res_config_mysql',
|
||||
$amp_conf['ASTETCDIR'] . '/res_mysql'
|
||||
);
|
||||
$backup_ext = array('.conf', '_additional.conf', '_custom.conf');
|
||||
$backup_info = $this->sccppath["tftp_path"] . '/sccp_dir.info';
|
||||
|
||||
|
@ -1003,7 +1036,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
unlink($result);
|
||||
return $filename;
|
||||
}
|
||||
function getSccpModelInformation($get = "all", $validate = false, $format_list = "all", $filter = array()) {
|
||||
function getSccpModelInformation($get = "all", $validate = false, $format_list = "all", $filter = array())
|
||||
{
|
||||
$modelList = $this->dbinterface->getModelInfoFromDb($get, $format_list, $filter);
|
||||
|
||||
if (!$validate) {
|
||||
|
@ -1071,7 +1105,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $modelList;
|
||||
}
|
||||
|
||||
function getHintInformation($filter = array()) {
|
||||
function getHintInformation($filter = array())
|
||||
{
|
||||
$res = array();
|
||||
$default_hint = '@ext-local';
|
||||
|
||||
|
@ -1114,4 +1149,3 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue