Update Sccp_manager.class.php

Remove unused methods
Substitute single line methods
Clean up page presentation (this changes the previous tab order)
This commit is contained in:
steve-lad 2021-06-02 16:31:38 +02:00
parent 4620df53c4
commit 7d641e3b2d

View file

@ -140,7 +140,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return;
}
$this->getSccpSettingFromDB(); // Overwrite Exist
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting(); // Overwrite Exist
// $this->getSccpSetingINI(false); // get from sccep.ini
$this->initializeSccpPath();
$this->initVarfromDefs();
@ -185,7 +185,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$htmlret .= load_view(__DIR__ . '/views/formShow.php', array(
'itm' => $item, 'h_show' => $heder_show,
'form_prefix' => $form_prefix, 'fvalues' => $form_values,
'tftp_lang' => $this->getTftpLang(), 'metainfo' => $this->sccp_metainfo));
'tftp_lang' => $this->tftpLang, 'metainfo' => $this->sccp_metainfo));
}
} else {
$htmlret .= load_view(__DIR__ . '/views/formShowError.php');
@ -269,8 +269,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$request = $_REQUEST;
$action = !empty($request['action']) ? $request['action'] : '';
if (!empty($this->sccpvalues['displayconfig'])) {
if (!empty($this->sccpvalues['displayconfig']['data']) && ($this->sccpvalues['displayconfig']['data'] == 'sccpsimple')) {
$this->pagedata = array(
"general" => array(
"name" => _("General SCCP Settings"),
@ -287,52 +285,23 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
"sccpinfo" => array(
"name" => _("SCCP info"),
"page" => 'views/server.info.php'
),
)
);
}
}
if (empty($this->pagedata)) {
//$driver = $this->FreePBX->Config->get_conf_setting('ASTSIPDRIVER');
$this->pagedata = array(
"general" => array(
"name" => _("General SCCP Settings"),
"page" => 'views/server.setting.php'
),
"sccpdevice" => array(
"name" => _("SCCP Device"),
"page" => 'views/server.device.php'
),
"sccpurl" => array(
"name" => _("SCCP Device URL"),
"page" => 'views/server.url.php'
),
"sccpntp" => array(
if (isset($this->sccpvalues['displayconfig']['data']) && ($this->sccpvalues['displayconfig']['data'] != 'sccpsimple')) {
$this->pagedata['sccpntp'] = array(
"name" => _("SCCP Time"),
"page" => 'views/server.datetime.php'
),
"sccpcodec" => array(
);
$this->pagedata['sccpcodec'] = array(
"name" => _("SCCP Codec"),
"page" => 'views/server.codec.php'
),
"sccpadv" => array(
);
$this->pagedata['sccpadv'] = array(
"name" => _("Advanced SCCP Settings"),
"page" => 'views/server.advanced.php'
),
"sccpinfo" => array(
"name" => _("SCCP info"),
"page" => 'views/server.info.php'
),
);
}
if (!empty($this->pagedata)) {
foreach ($this->pagedata as &$page) {
ob_start();
include($page['page']);
$page['content'] = ob_get_contents();
ob_end_clean();
}
}
$this->processPageData();
return $this->pagedata;
}
@ -345,14 +314,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
"page" => 'views/server.info.php'
),
);
foreach ($this->pagedata as &$page) {
ob_start();
include($page['page']);
$page['content'] = ob_get_contents();
ob_end_clean();
}
$this->processPageData();
return $this->pagedata;
}
@ -390,6 +352,12 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
}
break;
}
$this->processPageData();
}
return $this->pagedata;
}
public function processPageData() {
foreach ($this->pagedata as &$page) {
ob_start();
include($page['page']);
@ -398,9 +366,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
}
}
return $this->pagedata;
}
public function phoneShowPage() {
$request = $_REQUEST;
$action = !empty($request['action']) ? $request['action'] : '';
@ -838,8 +803,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
if (!empty($save_settings)) {
$this->saveSccpSettings($save_settings);
$this->getSccpSettingFromDB();
// $this->createDefaultSccpConfig();
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting();
}
$this->createDefaultSccpConfig(); // Rewrite Config.
$save_settings[] = array('status' => true);
@ -930,11 +894,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $save_settings;
}
public function getSccpSettingFromDB() {
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting();
return;
}
public function getMyConfig($var = null, $id = "noid") {
switch ($var) {
case "voicecodecs":
@ -1064,21 +1023,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return true;
}
function Sccp_manager_hookGet_config($engine) {
$this->debugdata($engine);
}
function Sccp_manager_get_config($engine) {
$this->debugdata($engine);
}
/**
* Retrieve Active Codecs
* return fiends Lag pack
*/
public function getTftpLang() {
return $this->tftpLang;
}
private function initTftpLang() {
$result = array();