Add download function

WIP - debug with ringtones
This commit is contained in:
steve-lad 2021-07-12 16:32:57 +02:00
parent 6e26428b1d
commit 2ffe4028e6
3 changed files with 23 additions and 6 deletions

View file

@ -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();

View file

@ -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;
}

View file

@ -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)</a></span>|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) {