From 6e26428b1dd6bdc5007927976badaaebc751b4f9 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Mon, 12 Jul 2021 13:50:09 +0200 Subject: [PATCH] Update rewrite rules Add header with credits Add specific rule for sccp_manager Add correct fields to parse xml for sccpvalues Add new option to update files from @dkgroot/provision --- conf/mappingRulesHeader | 9 +++++++++ conf/sccpgeneral.xml.v433 | 10 +++++++++- contrib/rewrite.rules | 9 +-------- install.php | 5 +++-- sccpManTraits/ajaxHelper.php | 1 - sccpManTraits/helperFunctions.php | 6 +++--- 6 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 conf/mappingRulesHeader diff --git a/conf/mappingRulesHeader b/conf/mappingRulesHeader new file mode 100644 index 0000000..e31c4a6 --- /dev/null +++ b/conf/mappingRulesHeader @@ -0,0 +1,9 @@ +# +# TFTPd Mapping Rules for SCCP_Manager Provision +# +# This file is maintained by Sccp_Manager, and will be overwritten by the installer +# a copy of the original can be found at sccpManagerRewrite.rules.bu +# For any changes to this file to be effective, the tftp server will have to be restarted. +# +# The rules below are provided by dkgroot/provision project https://github.com/dkgroot/provision_sccp +# diff --git a/conf/sccpgeneral.xml.v433 b/conf/sccpgeneral.xml.v433 index c3a00f9..1398d3a 100644 --- a/conf/sccpgeneral.xml.v433 +++ b/conf/sccpgeneral.xml.v433 @@ -1226,6 +1226,14 @@ and open the template in the editor. Base Version before all crash :-) Say 'yes' if you need to create cisco default language directory in tftp path. + + getExternalData + + no + + + If this is set to yes, Sccp_manager will try to get data files from dkgroot/Provision (languages, ring tones, firmware etc). This is enabled at your own risk - Sccp_Manager cannot vouch for the security or accuracy of these files, and this option is included to assist in getting up to speed as rapidly as possible. + system_rouminguser @@ -1356,7 +1364,7 @@ and open the template in the editor. Base Version before all crash :-) sccp-custom - The ringtone that the phone will default to. Can be overridden in the phone. The files RINGLIST.XML provice the basic phone ring tones, while DISTINCTIVERINGLIST.XML defines the list of possible ring tones for your other line types. They, along with the actual 'raw' ringtones, are stored in the /tftpboot/ringtones directory with the rest of the config files. + The ringtone that the phone will default to. Can be overridden in the phone. The files RINGLIST.XML provides the basic phone ring tones, while DISTINCTIVERINGLIST.XML defines the list of possible ring tones for your other line types. They, along with the actual 'raw' ringtones, are stored in the /tftpboot/ringtones directory with the rest of the config files. diff --git a/contrib/rewrite.rules b/contrib/rewrite.rules index 7e55b22..f2c5a45 100644 --- a/contrib/rewrite.rules +++ b/contrib/rewrite.rules @@ -1,10 +1,5 @@ # -# TFTPd Rewrite for SCCP_Manager Custom remapping -# -# This file is maintained by Sccp_Manager, and will be overwritten by the installer -# a copy of the original can be found at sccpManagerRewrite.rules.bu -# For any changes to this file to be effective, the tftp server will have to be restarted. -# +# TFTPd Rewrite for SCCP_Manager Custom remaping # /firmware # /settings # /wallpapers @@ -179,8 +174,6 @@ ri ^(ATA030204SCCP090202A.zup)$ firmware/ata186/\1 # Sub-Directory Handling # settings -# Do not disable the first rule - this is required by sccp_manager -ri ^(.+\.tlzz)?$ settings/\1 #ri ^(.+\.tlv)?$ settings/\1 #ri ^\/(.+\.tlv)?$ settings/\1 #ri ^((.+\.cnf.xml)(\.enc)?(\.sgn)?)$ settings/\1 diff --git a/install.php b/install.php index 5128255..6eab166 100644 --- a/install.php +++ b/install.php @@ -858,8 +858,9 @@ function checkTftpServer() { if (file_exists("{$confDir}/sccpManagerRewrite.rules")) { rename("{$confDir}/sccpManagerRewrite.rules", "{$confDir}/sccpManagerRewrite.rules.bu"); } - copy($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/contrib/rewrite.rules',"{$confDir}/sccpManagerRewrite.rules"); - + copy($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/mappingRulesHeader',"{$confDir}/sccpManagerRewrite.rules"); + file_put_contents("{$confDir}/sccpManagerRewrite.rules", file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/contrib/rewrite.rules'), FILE_APPEND); + file_put_contents("{$confDir}/sccpManagerRewrite.rules", "\n# Do not disable this rule - this is required by sccp_manager\nri ^(.+\.tlzz)?$ settings/\\1", FILE_APPEND); // TODO: add option to use external server $remoteFileName = ".sccp_manager_installer_probe_sentinel_temp".mt_rand(0, 9999999); $remoteFileContent = "# This is a test file created by Sccp_Manager. It can be deleted without impact"; diff --git a/sccpManTraits/ajaxHelper.php b/sccpManTraits/ajaxHelper.php index d205cc3..2a9753c 100644 --- a/sccpManTraits/ajaxHelper.php +++ b/sccpManTraits/ajaxHelper.php @@ -541,7 +541,6 @@ trait ajaxHelper { $extSettings = $this->extconfigs->updateTftpStructure(array_merge($this->sccpvalues, $save_settings)); $save_settings = array_merge($save_settings, $extSettings); - dbug('saveSettingsAfter', $save_settings); if (!empty($save_settings)) { $this->saveSccpSettings($save_settings); $this->sccpvalues = $this->dbinterface->get_db_SccpSetting(); diff --git a/sccpManTraits/helperFunctions.php b/sccpManTraits/helperFunctions.php index 280e1c2..92825ff 100644 --- a/sccpManTraits/helperFunctions.php +++ b/sccpManTraits/helperFunctions.php @@ -280,7 +280,7 @@ trait helperfunctions { $tp = 1; } if (empty($this->sccpvalues[(string) $value->name])) { - $this->sccpvalues[(string) $value->name] = array('keyword' => (string) $value->name, 'data' => $datav, 'type' => $tp, 'seq' => $seq); + $this->sccpvalues[(string) $value->name] = array('keyword' => (string) $value->name, 'data' => $datav, 'type' => $tp, 'seq' => $seq, 'systemdefault' => ''); } } } @@ -291,7 +291,7 @@ trait helperfunctions { $datav = (string) $child->value; } if (empty($this->sccpvalues[(string) $child->name])) { - $this->sccpvalues[(string) $child->name] = array('keyword' => (string) $child->name, 'data' => $datav, 'type' => '2', 'seq' => $seq); + $this->sccpvalues[(string) $child->name] = array('keyword' => (string) $child->name, 'data' => $datav, 'type' => '2', 'seq' => $seq, 'systemdefault' => ''); } } if (in_array($child['type'], array('SLD', 'SLS', 'SLT', 'SL', 'SLM', 'SLZ', 'SLTZN', 'SLA'))) { @@ -301,7 +301,7 @@ trait helperfunctions { $datav = (string) $child->value; } if (empty($this->sccpvalues[(string) $child->name])) { - $this->sccpvalues[(string) $child->name] = array('keyword' => (string) $child->name, 'data' => $datav, 'type' => '2', 'seq' => $seq); + $this->sccpvalues[(string) $child->name] = array('keyword' => (string) $child->name, 'data' => $datav, 'type' => '2', 'seq' => $seq, 'systemdefault' => ''); } } }