diff --git a/sccpManClasses/extconfigs.class.php b/sccpManClasses/extconfigs.class.php index 8a6f397..481803f 100644 --- a/sccpManClasses/extconfigs.class.php +++ b/sccpManClasses/extconfigs.class.php @@ -265,20 +265,24 @@ class extconfigs 'wallpapers' => 'tftproot' ), 'def' => array('templates' => 'tftproot', + 'firmware' => '', 'settings' => '', 'locales' => '', - 'firmware' => '', 'languages' => 'tftproot', 'dialplan' => '', - 'softkey' => '' + 'softkey' => '', + 'ringtones' => '', + 'wallpapers' => '' ) ); $base_tree = array('tftp_templates_path' => 'templates', + 'tftp_firmware_path' => 'firmware', 'tftp_store_path' => 'settings', 'tftp_lang_path' => 'languages', - 'tftp_firmware_path' => 'firmware', 'tftp_dialplan_path' => 'dialplan', - 'tftp_softkey_path' => 'softkey' + 'tftp_softkey_path' => 'softkey', + 'tftp_ringtones_path' => 'ringtones', + 'tftp_wallpapers_path' => 'wallpapers' ); $baseConfig = array(); diff --git a/sccpManTraits/ajaxHelper.php b/sccpManTraits/ajaxHelper.php index 2a9753c..9f59784 100644 --- a/sccpManTraits/ajaxHelper.php +++ b/sccpManTraits/ajaxHelper.php @@ -387,7 +387,6 @@ trait ajaxHelper { } function handleSubmit($request, $validateonly = false) { - dbug('',$request); $hdr_prefix = 'sccp_'; $hdr_arprefix = 'sccp-ar_'; $save_settings = array(); @@ -555,7 +554,7 @@ trait ajaxHelper { $save_settings[] = array('status' => true); $this->createDefaultSccpXml(); - + $this->getFilesFromProvisioner(); return $save_settings; } diff --git a/sccpManTraits/helperFunctions.php b/sccpManTraits/helperFunctions.php index 92825ff..82bfa0c 100644 --- a/sccpManTraits/helperFunctions.php +++ b/sccpManTraits/helperFunctions.php @@ -259,6 +259,20 @@ trait helperfunctions { $dom->save($filename); } + public function getFilesFromProvisioner() { + + $provisionerUrl = "https://github.com/dkgroot/provision_sccp/raw/master/tftpboot/"; + // Ringtones + $ringDir = 'ringtones/'; + $ringList = 'ringlist.xml'; + $xmlData = simplexml_load_file("{$provisionerUrl}{$ringDir}{$ringList}"); + //preg_match_all("|>([0-9a-z]+.xml)|U", $availableFiles, $out); + foreach ($xmlData as $child) { + $fileToSave = str_replace("\\","/",(string)$child->FileName); + file_put_contents("{$this->sccppath['tftp_path']}/{$fileToSave}",file_get_contents("{$provisionerUrl}{$fileToSave}")); + } + } + public function initVarfromXml() { if ((array) $this->xml_data) { foreach ($this->xml_data->xpath('//page_group') as $item) {