Use settings class for app_defaults.php

This commit is contained in:
FusionPBX
2023-09-16 00:22:12 -06:00
committed by GitHub
parent 81b92075a9
commit c6d966395e
17 changed files with 44 additions and 228 deletions

View File

@@ -28,9 +28,9 @@ if ($domains_processed == 1) {
//create phrases folder and add include line in xml for each language found
/*
if (!empty($_SESSION['switch']['languages']['dir'])) {
if (is_readable($_SESSION['switch']['languages']['dir'])) {
$conf_lang_folders = glob($_SESSION['switch']['languages']['dir']."/*");
if (!empty($setting->get('switch','languages'))) {
if (is_readable($setting->get('switch','languages'))) {
$conf_lang_folders = glob($setting->get('switch','languages')."/*");
foreach ($conf_lang_folders as $conf_lang_folder) {
//create phrases folder, if necessary
if (!file_exists($conf_lang_folder."/phrases/")) {
@@ -65,7 +65,7 @@ if ($domains_processed == 1) {
*/
//if base64, convert existing incompatible phrases
if (!empty($_SESSION['recordings']['storage_type']['text']) && $_SESSION['recordings']['storage_type']['text'] == 'base64') {
if (!empty($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') == 'base64') {
$sql = "select phrase_detail_uuid, phrase_detail_data ";
$sql .= "from v_phrase_details where phrase_detail_function = 'play-file' ";
$database = new database;
@@ -74,8 +74,8 @@ if ($domains_processed == 1) {
foreach ($result as $index => &$row) {
$phrase_detail_uuid = $row['phrase_detail_uuid'];
$phrase_detail_data = $row['phrase_detail_data'];
if (substr_count($phrase_detail_data, $_SESSION['switch']['recordings']['dir'].'/'.$domain_name) > 0) {
$phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/', '', $phrase_detail_data);
if (substr_count($phrase_detail_data, $setting->get('switch','recordings').'/'.$domain_name) > 0) {
$phrase_detail_data = str_replace($setting->get('switch','recordings').'/'.$domain_name.'/', '', $phrase_detail_data);
}
//update function and data to be base64 compatible
$phrase_detail_data = "lua(streamfile.lua ".$phrase_detail_data.")";
@@ -100,7 +100,7 @@ if ($domains_processed == 1) {
}
//if not base64, revert base64 phrases to standard method
else if (!empty($_SESSION['recordings']['storage_type']) && $_SESSION['recordings']['storage_type']['text'] != 'base64') {
else if (!empty($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') != 'base64') {
$sql = "select phrase_detail_uuid, phrase_detail_data ";
$sql .= "from v_phrase_details where ";
$sql .= "phrase_detail_function = 'execute' ";
@@ -115,7 +115,7 @@ if ($domains_processed == 1) {
$phrase_detail_data = str_replace('lua(streamfile.lua ', '', $phrase_detail_data);
$phrase_detail_data = str_replace(')', '', $phrase_detail_data);
if (substr_count($phrase_detail_data, '/') === 0) {
$phrase_detail_data = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/'.$phrase_detail_data;
$phrase_detail_data = $setting->get('switch','recordings').'/'.$domain_name.'/'.$phrase_detail_data;
}
$array['phrase_details'][$index]['phrase_detail_uuid'] = $phrase_detail_uuid;
$array['phrase_details'][$index]['phrase_detail_function'] = 'play-file';
@@ -142,7 +142,7 @@ if ($domains_processed == 1) {
//save_phrases_xml();
//delete the phrase from memcache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$fp = event_socket_create($setting->get('switch','event_socket_ip_address'), $setting->get('switch','event_socket_port'), $setting->get('switch','event_socket_password'));
if ($fp) {
//get phrase languages
$sql = "select distinct phrase_language from v_phrases order by phrase_language asc ";