Fix vars in strings

This commit is contained in:
Christopher Cookman 2024-12-05 17:37:19 -07:00
parent 8e6d7b7e14
commit 39ac99c600

View file

@ -82,7 +82,8 @@
namespace FreePBX\modules; namespace FreePBX\modules;
class Sccp_manager extends \FreePBX_Helpers implements \BMO { class Sccp_manager extends \FreePBX_Helpers implements \BMO
{
/* Field Values for type seq */ /* Field Values for type seq */
private $pagedata = null; private $pagedata = null;
private $sccp_driver_ver = '11.4'; // Ver fore SCCP.CLASS.PHP 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\ajaxHelper; // TODO should migrate this to child class
use \FreePBX\modules\Sccp_Manager\sccpManTraits\bmoFunctions; use \FreePBX\modules\Sccp_Manager\sccpManTraits\bmoFunctions;
public function __construct($freepbx = null) { public function __construct($freepbx = null)
{
if ($freepbx == null) { if ($freepbx == null) {
throw new Exception("Not given a FreePBX Object"); 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 * 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. // load xml data - moved from Construct to simplify Construct.
// TODO: This is static data so only load first time. Left as is for dbug. // 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) { 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/formShowSysDefs.php', array( $htmlret = load_view(
__DIR__ . '/views/formShowSysDefs.php',
array(
'itm' => $item, 'itm' => $item,
'h_show' => $show_Header, 'h_show' => $show_Header,
'form_prefix' => $form_prefix, 'form_prefix' => $form_prefix,
@ -201,14 +206,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* Load config vars from base array * Load config vars from base array
*/ */
public function updateTimeZone() { public function updateTimeZone()
{
// Get latest FreePBX time $timeZoneOffsetList - need to reflect standard/summer time etc // Get latest FreePBX time $timeZoneOffsetList - need to reflect standard/summer time etc
$freepbxTZ = \date_default_timezone_get(); $freepbxTZ = \date_default_timezone_get();
$this->sccpvalues['ntp_timezone']['data'] = $freepbxTZ; $this->sccpvalues['ntp_timezone']['data'] = $freepbxTZ;
$TZdata = $this->extconfigs->getExtConfig('sccp_timezone', $freepbxTZ); $TZdata = $this->extconfigs->getExtConfig('sccp_timezone', $freepbxTZ);
if (!empty($TZdata)) { if (!empty($TZdata)) {
// TODO: Is this correct (storing in hours not minutes) // TODO: Is this correct (storing in hours not minutes)
$this->sccpvalues['tzoffset']['data'] = $TZdata['offset']/60; $this->sccpvalues['tzoffset']['data'] = $TZdata['offset'] / 60;
} }
$this->dbinterface->write('sccpsettings', [$this->sccpvalues['tzoffset'], $this->sccpvalues['ntp_timezone']], 'update'); $this->dbinterface->write('sccpsettings', [$this->sccpvalues['tzoffset'], $this->sccpvalues['ntp_timezone']], 'update');
//$this->saveSccpSettings([$this->sccpvalues['tzoffset'], $this->sccpvalues['ntp_timezone']]); //$this->saveSccpSettings([$this->sccpvalues['tzoffset'], $this->sccpvalues['ntp_timezone']]);
@ -218,7 +224,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* Show form information - General * Show form information - General
*/ */
public function settingsShowPage() { public function settingsShowPage()
{
$this->checkTftpMapping(); $this->checkTftpMapping();
$request = $_REQUEST; $request = $_REQUEST;
$action = !empty($request['action']) ? $request['action'] : ''; $action = !empty($request['action']) ? $request['action'] : '';
@ -255,13 +262,14 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
); );
// If view is set to simple, remove the ntp, codec and advanced tabs // If view is set to simple, remove the ntp, codec and advanced tabs
if (isset($this->sccpvalues['displayconfig']['data']) && ($this->sccpvalues['displayconfig']['data'] == 'sccpsimple')) { if (isset($this->sccpvalues['displayconfig']['data']) && ($this->sccpvalues['displayconfig']['data'] == 'sccpsimple')) {
unset($this->pagedata['sccpntp'], $this->pagedata['sccpcodec'], $this->pagedata['sccpadv'] ); unset($this->pagedata['sccpntp'], $this->pagedata['sccpcodec'], $this->pagedata['sccpadv']);
} }
$this->processPageData(); $this->processPageData();
return $this->pagedata; return $this->pagedata;
} }
public function infoServerShowPage() { public function infoServerShowPage()
{
$request = $_REQUEST; $request = $_REQUEST;
$action = !empty($request['action']) ? $request['action'] : ''; $action = !empty($request['action']) ? $request['action'] : '';
$this->pagedata = array( $this->pagedata = array(
@ -274,7 +282,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $this->pagedata; return $this->pagedata;
} }
public function advServerShowPage() { public function advServerShowPage()
{
$request = $_REQUEST; $request = $_REQUEST;
$action = !empty($request['action']) ? $request['action'] : ''; $action = !empty($request['action']) ? $request['action'] : '';
$inputform = !empty($request['tech_hardware']) ? $request['tech_hardware'] : ''; $inputform = !empty($request['tech_hardware']) ? $request['tech_hardware'] : '';
@ -311,7 +320,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $this->pagedata; return $this->pagedata;
} }
public function phoneShowPage() { public function phoneShowPage()
{
$request = $_REQUEST; $request = $_REQUEST;
$action = !empty($request['action']) ? $request['action'] : ''; $action = !empty($request['action']) ? $request['action'] : '';
$inputform = !empty($request['tech_hardware']) ? $request['tech_hardware'] : ''; $inputform = !empty($request['tech_hardware']) ? $request['tech_hardware'] : '';
@ -381,7 +391,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $this->pagedata; return $this->pagedata;
} }
public function processPageData() { public function processPageData()
{
foreach ($this->pagedata as &$page) { foreach ($this->pagedata as &$page) {
// own version of load_view - simplifies passing variables as in object context // own version of load_view - simplifies passing variables as in object context
ob_start(); 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 // get Model Buttons info
$res = array(); $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'), 'devstate' => array('name' => 'Coffee', 'value' => 'coffee'),
'monitor' => array('name' => 'Record Calls', 'value' => '') '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); $max_btn = (!empty($get_settings['buttonscount']) ? $get_settings['buttonscount'] : 60);
for ($it = 0; $it < $max_btn; $it++) { for ($it = 0; $it < $max_btn; $it++) {
if (!empty($get_settings["button${it}_type"])) { if (!empty($get_settings["button{$it}_type"])) {
$btn_t = $get_settings["button${it}_type"]; $btn_t = $get_settings["button{$it}_type"];
$btn_n = ''; $btn_n = '';
$btn_opt = ''; $btn_opt = '';
if ($it == 0) { if ($it == 0) {
@ -418,9 +431,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
} }
switch ($btn_t) { switch ($btn_t) {
case 'feature': 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_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; $btn_opt = $btn_f;
if (!empty($def_feature[$btn_f]['value'])) { if (!empty($def_feature[$btn_f]['value'])) {
if (empty($get_settings['button' . $it . '_fvalue'])) { if (empty($get_settings['button' . $it . '_fvalue'])) {
@ -444,46 +457,46 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
} }
} }
$btn_t = 'speeddial'; $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)); $db_res = $this->dbinterface->getSccpDeviceTableData('SccpExtension', array('name' => $btn_opt));
$btn_n = $db_res[0]['label']; $btn_n = $db_res[0]['label'];
$btn_opt .= ',' . $btn_opt . $this->hint_context['default']; $btn_opt .= ',' . $btn_opt . $this->hint_context['default'];
break; break;
case 'speeddial': case 'speeddial':
if (!empty($get_settings["button${it}_input"])) { if (!empty($get_settings["button{$it}_input"])) {
$btn_n = $get_settings["button${it}_input"]; $btn_n = $get_settings["button{$it}_input"];
} }
if (!empty($get_settings["button${it}_phone"])) { if (!empty($get_settings["button{$it}_phone"])) {
$btn_opt = $get_settings["button${it}_phone"]; $btn_opt = $get_settings["button{$it}_phone"];
if (empty($btn_n)) { if (empty($btn_n)) {
$btn_n = $btn_opt; $btn_n = $btn_opt;
} }
} }
if (!empty($get_settings["button${it}_hint"])) { if (!empty($get_settings["button{$it}_hint"])) {
if ($get_settings["button${it}_hint"] == "hint") { if ($get_settings["button{$it}_hint"] == "hint") {
if (empty($btn_n)) { if (empty($btn_n)) {
$btn_t = 'line'; $btn_t = 'line';
$btn_n = $get_settings["button${it}_hline"] . '!silent'; $btn_n = $get_settings["button{$it}_hline"] . '!silent';
$btn_opt = ''; $btn_opt = '';
} else { } else {
// $btn_opt .= ',' . $get_settings['button' . $it . '_hline'] . $this->hint_context['default']; // $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; break;
case 'adv.line': case 'adv.line':
$btn_t = 'line'; $btn_t = 'line';
$btn_n = (string) $get_settings["button${it}_line"]; $btn_n = (string) $get_settings["button{$it}_line"];
$btn_n .= '@' . (string) $get_settings["button${it}_advline"]; $btn_n .= '@' . (string) $get_settings["button{$it}_advline"];
$btn_opt = (string) $get_settings["button${it}_advopt"]; $btn_opt = (string) $get_settings["button{$it}_advopt"];
break; break;
case 'line': case 'line':
case 'silent': case 'silent':
if (isset($get_settings["button${it}_line"])) { if (isset($get_settings["button{$it}_line"])) {
$btn_n = (string) $get_settings["button${it}_line"]; $btn_n = (string) $get_settings["button{$it}_line"];
if ($it > 0) { if ($it > 0) {
if ($btn_t == 'silent') { if ($btn_t == 'silent') {
$btn_n .= '!silent'; $btn_n .= '!silent';
@ -507,7 +520,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $res; return $res;
} }
function handleRoamingUsers($get_settings, $validateonly = false) { function handleRoamingUsers($get_settings, $validateonly = false)
{
$hdr_prefix = 'sccp_ru_'; $hdr_prefix = 'sccp_ru_';
$hdr_arprefix = 'sccp_ru-ar_'; $hdr_arprefix = 'sccp_ru-ar_';
@ -582,16 +596,17 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return array('status' => true, 'search' => '?display=sccp_phone', 'hash' => 'general'); return array('status' => true, 'search' => '?display=sccp_phone', 'hash' => 'general');
} }
public function getCodecs($type, $showDefaults = false) { public function getCodecs($type, $showDefaults = false)
{
$allSupported = array(); $allSupported = array();
$sccpCodec = array_fill_keys(array('alaw', 'ulaw', 'g722', 'g723', 'g726', 'g729', 'gsm', 'h264', 'h263', 'h261'),0); $sccpCodec = array_fill_keys(array('alaw', 'ulaw', 'g722', 'g723', 'g726', 'g729', 'gsm', 'h264', 'h263', 'h261'), 0);
// First see if have any site defaults // First see if have any site defaults
$val = $this->sccpvalues['allow']['data']; $val = $this->sccpvalues['allow']['data'];
if (empty($val)) { if (empty($val)) {
// No site defaults so return chan-sccp defaults // No site defaults so return chan-sccp defaults
$val = $this->sccpvalues['allow']['systemdefault']; $val = $this->sccpvalues['allow']['systemdefault'];
} }
$siteCodecs = array_fill_keys(explode(';',$val), 1); $siteCodecs = array_fill_keys(explode(';', $val), 1);
switch ($type) { switch ($type) {
case 'audio': case 'audio':
$fpbxCodecs = $this->FreePBX->Codecs->getAudio(); $fpbxCodecs = $this->FreePBX->Codecs->getAudio();
@ -612,8 +627,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
// These have value set to 1 // These have value set to 1
$enabledCodecs = array_intersect_key($siteCodecs, $sccpCodec, $fpbxCodecs); $enabledCodecs = array_intersect_key($siteCodecs, $sccpCodec, $fpbxCodecs);
// These have value set to 0 // These have value set to 0
$allSupported = array_intersect_key($sccpCodec,$fpbxCodecs); $allSupported = array_intersect_key($sccpCodec, $fpbxCodecs);
$disabledCodecs = array_diff_key($allSupported,$enabledCodecs); $disabledCodecs = array_diff_key($allSupported, $enabledCodecs);
$codecs = array_merge($enabledCodecs, $disabledCodecs); $codecs = array_merge($enabledCodecs, $disabledCodecs);
return $codecs; return $codecs;
@ -624,7 +639,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* return finds Language pack * return finds Language pack
*/ */
private function findInstLangs() { private function findInstLangs()
{
//locales and country tones are installed in the tftp_lang_path //locales and country tones are installed in the tftp_lang_path
//Available packs from provisioner are in masterFilesStructure.xml in tftpRoot Path //Available packs from provisioner are in masterFilesStructure.xml in tftpRoot Path
@ -648,7 +664,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$simpleXmlArr = $tftpBootXml->xpath("//Directory[@name='languages']//DirectoryPath[contains(.,'languages/')]"); $simpleXmlArr = $tftpBootXml->xpath("//Directory[@name='languages']//DirectoryPath[contains(.,'languages/')]");
array_shift($simpleXmlArr); // First element is the parent directory array_shift($simpleXmlArr); // First element is the parent directory
foreach ($simpleXmlArr as $rowIn) { foreach ($simpleXmlArr as $rowIn) {
$tmpArr = explode('/',(string)$rowIn); $tmpArr = explode('/', (string)$rowIn);
array_pop($tmpArr); //last element is empty array_pop($tmpArr); //last element is empty
$result[$pack]['available'][] = array_pop($tmpArr); $result[$pack]['available'][] = array_pop($tmpArr);
} }
@ -661,7 +677,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$simpleXmlArr = $tftpBootXml->xpath("//Directory[@name='countries']//DirectoryPath[contains(.,'countries/')]"); $simpleXmlArr = $tftpBootXml->xpath("//Directory[@name='countries']//DirectoryPath[contains(.,'countries/')]");
array_shift($simpleXmlArr); // First element is the parent directory array_shift($simpleXmlArr); // First element is the parent directory
foreach ($simpleXmlArr as $rowIn) { foreach ($simpleXmlArr as $rowIn) {
$tmpArr = explode('/',(string)$rowIn); $tmpArr = explode('/', (string)$rowIn);
array_pop($tmpArr); //last element is empty array_pop($tmpArr); //last element is empty
$result[$pack]['available'][] = array_pop($tmpArr); $result[$pack]['available'][] = array_pop($tmpArr);
} }
@ -669,7 +685,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
break; break;
} }
foreach (array_diff(scandir($searchDir),array('.', '..')) as $subDir) { foreach (array_diff(scandir($searchDir), array('.', '..')) as $subDir) {
if (is_dir($searchDir . DIRECTORY_SEPARATOR . $subDir)) { if (is_dir($searchDir . DIRECTORY_SEPARATOR . $subDir)) {
$filename = $searchDir . DIRECTORY_SEPARATOR . $subDir . DIRECTORY_SEPARATOR . $fileToFind; $filename = $searchDir . DIRECTORY_SEPARATOR . $subDir . DIRECTORY_SEPARATOR . $fileToFind;
if (file_exists($filename)) { if (file_exists($filename)) {
@ -686,7 +702,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* Check tftp/xml file path and permissions * Check tftp/xml file path and permissions
*/ */
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 $langKey => $langValueArr) { foreach ($this->extconfigs->getExtConfig('sccp_lang') as $langKey => $langValueArr) {
$localeDir = $this->sccppath["tftp_lang_path"] . DIRECTORY_SEPARATOR . $langValueArr['locale']; $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 * Check file paths and permissions
*/ */
function initializeSccpPath() { function initializeSccpPath()
{
$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'],
@ -730,7 +748,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* Soft Key * Soft Key
*/ */
function createSccpXmlSoftkey() { function createSccpXmlSoftkey()
{
foreach ($this->aminterface->sccp_list_keysets() as $keyl => $vall) { foreach ($this->aminterface->sccp_list_keysets() as $keyl => $vall) {
$this->xmlinterface->create_xmlSoftkeyset($this->sccp_conf_init, $this->sccppath, $keyl); $this->xmlinterface->create_xmlSoftkeyset($this->sccp_conf_init, $this->sccppath, $keyl);
} }
@ -740,7 +759,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* DialPlan * DialPlan
*/ */
function getDialPlanList() { function getDialPlanList()
{
$dir = $this->sccppath["tftp_dialplan_path"] . '/dial*.xml'; $dir = $this->sccppath["tftp_dialplan_path"] . '/dial*.xml';
$base_len = strlen($this->sccppath["tftp_dialplan_path"]) + 1; $base_len = strlen($this->sccppath["tftp_dialplan_path"]) + 1;
$res = glob($dir); $res = glob($dir);
@ -750,7 +770,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $res; return $res;
} }
function getDialPlan($get_file) { function getDialPlan($get_file)
{
$file = $this->sccppath["tftp_dialplan_path"] . '/' . $get_file . '.xml'; $file = $this->sccppath["tftp_dialplan_path"] . '/' . $get_file . '.xml';
if (file_exists($file)) { if (file_exists($file)) {
@ -763,7 +784,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $res; return $res;
} }
function deleteDialPlan($get_file) { function deleteDialPlan($get_file)
{
$file = $this->sccppath["tftp_dialplan_path"] . '/' . $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);
@ -771,7 +793,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $res; return $res;
} }
function saveDialPlan($get_settings) { function saveDialPlan($get_settings)
{
$confDir = $this->sccppath["tftp_dialplan_path"]; $confDir = $this->sccppath["tftp_dialplan_path"];
return $this->xmlinterface->saveDialPlan($confDir, $get_settings); 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 * Update buttons Labels on mysql DB
*/ */
private function updateSccpButtons($hw_list = array()) { private function updateSccpButtons($hw_list = array())
{
$save_buttons = array(); $save_buttons = array();
$button_list = array(); $button_list = array();
@ -821,7 +845,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
/* /*
* Save Config Value to mysql DB * Save Config Value to mysql DB
*/ */
/* /*
private function saveSccpSettings($save_value = array()) { private function saveSccpSettings($save_value = array()) {
if (empty($save_value)) { if (empty($save_value)) {
@ -836,7 +860,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* Create XMLDefault.cnf.xml * Create XMLDefault.cnf.xml
*/ */
function createDefaultSccpXml() { function createDefaultSccpXml()
{
$data_value = array(); $data_value = array();
foreach ($this->sccpvalues as $key => $value) { foreach ($this->sccpvalues as $key => $value) {
$data_value[$key] = $value['data']; $data_value[$key] = $value['data'];
@ -858,7 +883,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* Create (SEP) dev_ID.cnf.xml * Create (SEP) dev_ID.cnf.xml
*/ */
function createSccpDeviceXML(string $dev_id) { function createSccpDeviceXML(string $dev_id)
{
$sccp_native = true; $sccp_native = true;
$data_value = array(); $data_value = array();
@ -871,7 +897,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$sccp_native = false; $sccp_native = false;
$tmp_bind = $this->getSipConfig(); $tmp_bind = $this->getSipConfig();
$dev_ext_config = $this->dbinterface->getSccpDeviceTableData("SccpDevice", array('name' => $dev_id, 'fields' => 'sip_ext')); $dev_ext_config = $this->dbinterface->getSccpDeviceTableData("SccpDevice", array('name' => $dev_id, 'fields' => 'sip_ext'));
if (empty($dev_ext_config)){ if (empty($dev_ext_config)) {
// TODO: Placeholder. Have no associated sip line so cannot generate SEP Xml for SIP. // TODO: Placeholder. Have no associated sip line so cannot generate SEP Xml for SIP.
// Need to return and inform user // Need to return and inform user
return false; return false;
@ -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); 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)) { if (empty($dev_id)) {
return false; return false;
} }
@ -953,11 +980,17 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
} }
} }
private function createSccpBackup() { private function createSccpBackup()
{
global $amp_conf; global $amp_conf;
$dir_info = array(); $dir_info = array();
$backup_files = array($amp_conf['ASTETCDIR'] . '/sccp', $amp_conf['ASTETCDIR'] . '/extensions', $amp_conf['ASTETCDIR'] . '/extconfig', $backup_files = array(
$amp_conf['ASTETCDIR'] . '/res_config_mysql', $amp_conf['ASTETCDIR'] . '/res_mysql'); $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_ext = array('.conf', '_additional.conf', '_custom.conf');
$backup_info = $this->sccppath["tftp_path"] . '/sccp_dir.info'; $backup_info = $this->sccppath["tftp_path"] . '/sccp_dir.info';
@ -1003,7 +1036,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
unlink($result); unlink($result);
return $filename; 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); $modelList = $this->dbinterface->getModelInfoFromDb($get, $format_list, $filter);
if (!$validate) { if (!$validate) {
@ -1071,7 +1105,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $modelList; return $modelList;
} }
function getHintInformation($filter = array()) { function getHintInformation($filter = array())
{
$res = array(); $res = array();
$default_hint = '@ext-local'; $default_hint = '@ext-local';
@ -1114,4 +1149,3 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
} }
} }
?>