Use settings class for app_defaults.php
This commit is contained in:
parent
81b92075a9
commit
c6d966395e
|
|
@ -34,7 +34,7 @@
|
|||
if ($num_rows == 0) {
|
||||
|
||||
//set the directory
|
||||
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
|
||||
$xml_dir = $setting->get('switch','conf').'/autoload_configs';
|
||||
$xml_file = $xml_dir."/acl.conf.xml";
|
||||
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/acl.conf';
|
||||
|
||||
|
|
@ -54,7 +54,6 @@
|
|||
$xml_string .= " <node type=\"allow\" cidr=\"192.168.0.0/16\"/>\n";
|
||||
$xml_string .= " </list>\n";
|
||||
$xml_string .= " <list name=\"providers\" default=\"deny\">\n";
|
||||
//$xml_string .= " <node type=\"allow\" domain=\"".$_SESSION['domain_name']."\"/>\n";
|
||||
$xml_string .= " </list>\n";
|
||||
$xml_string .= " </network-lists>\n";
|
||||
$xml_string .= "</configuration>\n";
|
||||
|
|
@ -159,7 +158,7 @@
|
|||
|
||||
//create the event socket connection
|
||||
if (!$fp) {
|
||||
$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'));
|
||||
}
|
||||
|
||||
//reload the acl
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ if ($domains_processed == 1) {
|
|||
|
||||
//add the recording path if needed
|
||||
if ($row['queue_greeting'] != '') {
|
||||
if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$row['domain_name'].'/'.$row['queue_greeting'])) {
|
||||
$queue_greeting_path = $_SESSION['switch']['recordings']['dir'].'/'.$row['domain_name'].'/'.$row['queue_greeting'];
|
||||
if (file_exists($setting->get('switch','recordings').'/'.$row['domain_name'].'/'.$row['queue_greeting'])) {
|
||||
$queue_greeting_path = $setting->get('switch','recordings').'/'.$row['domain_name'].'/'.$row['queue_greeting'];
|
||||
}
|
||||
else {
|
||||
$queue_greeting_path = trim($row['queue_greeting']);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
if ($num_rows == 0) {
|
||||
|
||||
//set the directory
|
||||
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
|
||||
$xml_dir = $setting->get('switch','conf').'/autoload_configs';
|
||||
$xml_file = $xml_dir."/conference.conf";
|
||||
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/conference.conf';
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
if ($num_rows == 0) {
|
||||
|
||||
//set the directory
|
||||
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
|
||||
$xml_dir = $setting->get('switch','conf').'/autoload_configs';
|
||||
$xml_file = $xml_dir."/conference.conf";
|
||||
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/conference.conf';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2010
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//if there are multiple domains then update the public dir path to include the domain
|
||||
if ($domains_processed == 1) {
|
||||
if (count($_SESSION["domains"]) > 1) {
|
||||
if (!empty($_SESSION['switch']['dialplan']['dir']) && is_dir($_SESSION['switch']['dialplan']['dir'].'/public')) {
|
||||
//clear out the old xml files
|
||||
$v_needle = '_v_';
|
||||
if($dh = opendir($_SESSION['switch']['dialplan']['dir'].'/public')) {
|
||||
$files = Array();
|
||||
while($file = readdir($dh)) {
|
||||
if($file != "." && $file != ".." && $file[0] != '.') {
|
||||
if(is_dir($dir . "/" . $file)) {
|
||||
//this is a directory
|
||||
} else {
|
||||
if (strpos($file, $v_needle) !== false && substr($file,-4) == '.xml') {
|
||||
unlink($_SESSION['switch']['dialplan']['dir'].'/public/'.$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if the public directory doesn't exist then create it
|
||||
if ($domains_processed == 1) {
|
||||
if (!empty($_SESSION['switch']['dialplan']['dir'])) {
|
||||
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public')) {
|
||||
mkdir($_SESSION['switch']['dialplan']['dir'].'/public', 0770, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if multiple domains then make sure that the dialplan/public/domain_name.xml file exists
|
||||
if (count($_SESSION["domains"]) > 1) {
|
||||
//make sure the public directory and xml file exist
|
||||
if (!empty($_SESSION['switch']['dialplan']['dir'])) {
|
||||
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public'.$_SESSION['domains'][$domain_uuid]['domain_name'])) {
|
||||
mkdir($_SESSION['switch']['dialplan']['dir'].'/public/'.$_SESSION['domains'][$domain_uuid]['domain_name'], 0770, false);
|
||||
}
|
||||
$file = $_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$domain_uuid]['domain_name'].".xml";
|
||||
if (!file_exists($file)) {
|
||||
$fout = fopen($file,"w");
|
||||
$xml = "<include>\n";
|
||||
$xml .= " <X-PRE-PROCESS cmd=\"include\" data=\"".$_SESSION['domains'][$domain_uuid]['domain_name']."/*.xml\"/>\n";
|
||||
$xml .= "</include>\n";
|
||||
fwrite($fout, $xml);
|
||||
fclose($fout);
|
||||
unset($xml,$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -151,7 +151,7 @@
|
|||
//add not found dialplan to inbound routes
|
||||
/*
|
||||
if ($domains_processed == 1) {
|
||||
if (is_readable($_SESSION['switch']['dialplan']['dir'])) {
|
||||
if (is_readable($setting->get('switch','dialplan'))) {
|
||||
$sql = "select count(*) from v_dialplans ";
|
||||
$sql .= "where dialplan_uuid = 'ea5339de-1982-46ca-9695-c35176165314' ";
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@
|
|||
if ($domains_processed == 1) {
|
||||
|
||||
//create the directory
|
||||
if (!empty($_SESSION['switch']['extensions']['dir'])) {
|
||||
if (!is_dir($_SESSION['switch']['extensions']['dir'])) {
|
||||
mkdir($_SESSION['switch']['extensions']['dir'], 0770, false);
|
||||
if (!empty($setting->get('switch','extensions'))) {
|
||||
if (!is_dir($setting->get('switch','extensions'))) {
|
||||
mkdir($setting->get('switch','extensions'), 0770, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@
|
|||
unset($sql, $modules, $index, $row);
|
||||
|
||||
//use the module class to get the list of modules from the db and add any missing modules
|
||||
if (isset($_SESSION['switch']['mod']['dir'])) {
|
||||
$module->dir = $_SESSION['switch']['mod']['dir'];
|
||||
if (!empty($setting->get('switch','mod'))) {
|
||||
$module->dir = $setting->get('switch','mod');
|
||||
$module->get_modules();
|
||||
$module->synch();
|
||||
$module->xml();
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@
|
|||
if ($domains_processed == 1) {
|
||||
|
||||
//set the directory
|
||||
if (isset($_SESSION["switch"]["conf"])) {
|
||||
$xml_dir = $_SESSION["switch"]["conf"].'/autoload_configs';
|
||||
if (!empty($setting->get('switch','conf'))) {
|
||||
$xml_dir = $setting->get('switch','conf').'/autoload_configs';
|
||||
$xml_file = $xml_dir."/local_stream.conf";
|
||||
}
|
||||
|
||||
//rename the file
|
||||
if (isset($_SESSION["switch"]["conf"])) {
|
||||
if (!empty($setting->get('switch','conf'))) {
|
||||
if (file_exists($xml_dir.'/local_stream.conf.xml')) {
|
||||
rename($xml_dir.'/local_stream.conf', $xml_dir.'/'.$xml_file);
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ if ($domains_processed == 1) {
|
|||
}
|
||||
|
||||
//add the music_on_hold list to the database
|
||||
if (isset($_SESSION["switch"]["conf"])) {
|
||||
if (!empty($setting->get('switch','conf'))) {
|
||||
$sql = "select count(music_on_hold_uuid) from v_music_on_hold; ";
|
||||
$database = new database;
|
||||
$num_rows = $database->select($sql, null, 'column');
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@
|
|||
$number_translation->xml = file_get_contents($xml_file);
|
||||
$number_translation->import();
|
||||
}
|
||||
|
||||
|
||||
//check for existing configuration
|
||||
if (!empty($_SESSION['switch']['conf']['dir']) && file_exists($_SESSION['switch']['conf']['dir']."/autoload_configs/translate.conf.xml")) {
|
||||
if (!empty($setting->get('switch','conf')) && file_exists($setting->get('switch','conf')."/autoload_configs/translate.conf.xml")) {
|
||||
//import existing data
|
||||
$xml = file_get_contents($_SESSION['switch']['conf']['dir']."/autoload_configs/translate.conf.xml");
|
||||
$xml = file_get_contents($setting->get('switch','conf')."/autoload_configs/translate.conf.xml");
|
||||
|
||||
//convert the xml string to an xml object
|
||||
$xml = simplexml_load_string($xml);
|
||||
|
|
|
|||
|
|
@ -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 ";
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@
|
|||
*/
|
||||
|
||||
//if the recordings directory doesn't exist then create it
|
||||
if (!empty($_SESSION['switch']['recordings']['dir']) && !empty($domain_name)) {
|
||||
if (!is_readable($_SESSION['switch']['recordings']['dir']."/".$domain_name)) {
|
||||
mkdir($_SESSION['switch']['recordings']['dir']."/".$domain_name."/archive", 0770, true);
|
||||
if (!empty($setting->get('switch','recordings')) && !empty($domain_name)) {
|
||||
if (!is_readable($setting->get('switch','recordings')."/".$domain_name)) {
|
||||
mkdir($setting->get('switch','recordings')."/".$domain_name."/archive", 0770, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
if ($domains_processed == 1) {
|
||||
|
||||
//if base64, populate from existing recording files, then remove
|
||||
if (!empty($_SESSION['recordings']['storage_type']) && $_SESSION['recordings']['storage_type']['text'] == 'base64') {
|
||||
if (!empty($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') == 'base64') {
|
||||
//get recordings without base64 in db
|
||||
$sql = "select recording_uuid, domain_uuid, recording_filename ";
|
||||
$sql .= "from v_recordings ";
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
$recording_filename = $row['recording_filename'];
|
||||
|
||||
//set recording directory
|
||||
$recording_directory = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name;
|
||||
$recording_directory = $setting->get('switch','recordings').'/'.$domain_name;
|
||||
|
||||
//encode recording file (if exists)
|
||||
if (file_exists($recording_directory.'/'.$recording_filename)) {
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
unset($sql, $result, $row);
|
||||
}
|
||||
//if not base64, decode to local files, remove base64 data from db
|
||||
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') {
|
||||
//get recordings with base64 in db
|
||||
$sql = "select recording_uuid, domain_uuid, recording_filename, recording_base64 ";
|
||||
$sql .= "from v_recordings ";
|
||||
|
|
@ -95,7 +95,7 @@
|
|||
$recording_base64 = $row['recording_base64'];
|
||||
|
||||
//set recording directory
|
||||
$recording_directory = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name;
|
||||
$recording_directory = $setting->get('switch','recordings').'/'.$domain_name;
|
||||
|
||||
//remove local file, if any
|
||||
if (file_exists($recording_directory.'/'.$recording_filename)) {
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@
|
|||
//save the sip profile xml
|
||||
save_sip_profile_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -221,8 +219,6 @@
|
|||
//save the sip profile xml
|
||||
save_sip_profile_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -121,8 +121,6 @@ if ($domains_processed == 1) {
|
|||
function set_country_vars($x) {
|
||||
require "resources/countries.php";
|
||||
|
||||
//$country_iso=$_SESSION['domain']['country']['iso_code'];
|
||||
|
||||
$sql = "select default_setting_value ";
|
||||
$sql .= "from v_default_settings ";
|
||||
$sql .= "where default_setting_name = 'iso_code' ";
|
||||
|
|
|
|||
|
|
@ -37,18 +37,18 @@ if ($domains_processed == 1) {
|
|||
unset($sql, $parameters);
|
||||
if (!empty($voicemails) && is_array($voicemails)) {
|
||||
foreach($voicemails as $row) {
|
||||
if (!empty($_SESSION['switch']['voicemail']['dir']) && !empty($row['voicemail_id']) && is_numeric($row['voicemail_id'])) {
|
||||
if (!file_exists($_SESSION['switch']['voicemail']['dir']."/default/".$row['domain_name']."/".$row['voicemail_id'])) {
|
||||
mkdir($_SESSION['switch']['voicemail']['dir']."/default/".$row['domain_name']."/".$row['voicemail_id'], 0770, true);
|
||||
if (!empty($setting->get('switch','voicemail')) && !empty($row['voicemail_id']) && is_numeric($row['voicemail_id'])) {
|
||||
if (!file_exists($setting->get('switch','voicemail')."/default/".$row['domain_name']."/".$row['voicemail_id'])) {
|
||||
mkdir($setting->get('switch','voicemail')."/default/".$row['domain_name']."/".$row['voicemail_id'], 0770, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//define initial, get current, define correct languages folder paths
|
||||
$switch_configuration_dir = !empty($_SESSION['switch']['conf']['dir']) ? $_SESSION['switch']['conf']['dir'] : '/etc/freeswitch';
|
||||
$switch_configuration_dir = !empty($setting->get('switch','conf')) ? $setting->get('switch','conf') : '/etc/freeswitch';
|
||||
$switch_languages_dir_initial = $switch_configuration_dir.'/lang';
|
||||
$switch_languages_dir_current = $_SESSION['switch']['languages']['dir'] ?? '';
|
||||
$switch_languages_dir_current = $setting->get('switch','languages') ?? '';
|
||||
$switch_languages_dir_correct = $switch_configuration_dir.'/languages';
|
||||
|
||||
//ensure switch using languages (not lang) folder
|
||||
|
|
@ -60,9 +60,6 @@ if ($domains_processed == 1) {
|
|||
|
||||
//update default setting value
|
||||
if (file_exists($switch_languages_dir_correct)) {
|
||||
//get the languages directory
|
||||
$_SESSION['switch']['languages']['dir'] = $switch_languages_dir_correct;
|
||||
|
||||
//update languages with the correct path
|
||||
$sql = "update v_default_settings ";
|
||||
$sql .= "set default_setting_value = '".$switch_languages_dir_correct."', ";
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@
|
|||
|
||||
//if there are no items in the menu then add the default menu
|
||||
if ($domains_processed == 1) {
|
||||
require_once "resources/classes/menu.php";
|
||||
$o = new menu;
|
||||
$o->menu_default();
|
||||
unset($o);
|
||||
$menu = new menu;
|
||||
$menu->menu_default();
|
||||
} //if
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -611,9 +611,6 @@ if (!class_exists('domains')) {
|
|||
$config_path = $config->find();
|
||||
$config->get();
|
||||
|
||||
//check for default settings
|
||||
$this->settings();
|
||||
|
||||
//get the list of installed apps from the core and app directories (note: GLOB_BRACE doesn't work on some systems)
|
||||
$config_list_1 = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/*/*/app_config.php");
|
||||
$config_list_2 = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/*/*/app_menu.php");
|
||||
|
|
@ -633,39 +630,6 @@ if (!class_exists('domains')) {
|
|||
$domains = $database->select($sql, null, 'all');
|
||||
unset($sql);
|
||||
|
||||
//get the domain_settings
|
||||
$sql = "select * from v_domain_settings ";
|
||||
$sql .= "where domain_setting_enabled = 'true' ";
|
||||
$database = new database;
|
||||
$domain_settings = $database->select($sql, null, 'all');
|
||||
unset($sql);
|
||||
|
||||
//get the default settings
|
||||
$sql = "select * from v_default_settings ";
|
||||
$sql .= "where default_setting_enabled = 'true' ";
|
||||
$sql .= "and default_setting_category <> 'switch' ";
|
||||
$database = new database;
|
||||
$database_default_settings = $database->select($sql, null, 'all');
|
||||
unset($sql);
|
||||
|
||||
//get the domain_uuid
|
||||
if (is_array($domains)) {
|
||||
foreach($domains as $row) {
|
||||
if (count($domains) == 1) {
|
||||
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
||||
$_SESSION["domain_name"] = $row['domain_name'];
|
||||
}
|
||||
else {
|
||||
if (!empty($domain_array[0]) && (lower_case($row['domain_name']) == lower_case($domain_array[0] ?? '') || lower_case($row['domain_name']) == lower_case('www.'.$domain_array[0] ?? ''))) {
|
||||
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
||||
$_SESSION["domain_name"] = $row['domain_name'];
|
||||
}
|
||||
$_SESSION['domains'][$row['domain_uuid']]['domain_uuid'] = $row['domain_uuid'];
|
||||
$_SESSION['domains'][$row['domain_uuid']]['domain_name'] = $row['domain_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//loop through all domains
|
||||
$domains_processed = 1;
|
||||
foreach ($domains as $domain) {
|
||||
|
|
@ -676,59 +640,8 @@ if (!class_exists('domains')) {
|
|||
//get the context
|
||||
$context = $domain_name;
|
||||
|
||||
//get the default settings - this needs to be done to reset the session values back to the defaults for each domain in the loop
|
||||
foreach($database_default_settings as $row) {
|
||||
if ($row['default_setting_enabled'] == 'true') {
|
||||
$name = $row['default_setting_name'];
|
||||
$category = $row['default_setting_category'];
|
||||
$subcategory = $row['default_setting_subcategory'];
|
||||
if (empty($subcategory)) {
|
||||
if ($name == "array") {
|
||||
$_SESSION[$category][] = $row['default_setting_value'];
|
||||
}
|
||||
else {
|
||||
$_SESSION[$category][$name] = $row['default_setting_value'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($name == "array") {
|
||||
$_SESSION[$category][$subcategory][] = $row['default_setting_value'];
|
||||
}
|
||||
else {
|
||||
$_SESSION[$category][$subcategory]['uuid'] = $row['default_setting_uuid'];
|
||||
$_SESSION[$category][$subcategory][$name] = $row['default_setting_value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//set the enabled settings as a session
|
||||
foreach ($domain_settings as $row) {
|
||||
if ($row['domain_setting_enabled'] == 'true') {
|
||||
$name = $row['domain_setting_name'];
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
if (empty($subcategory)) {
|
||||
//$$category[$name] = $row['domain_setting_value'];
|
||||
if ($name == "array") {
|
||||
$_SESSION[$category][] = $row['domain_setting_value'];
|
||||
}
|
||||
else {
|
||||
$_SESSION[$category][$name] = $row['domain_setting_value'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
//$$category[$subcategory][$name] = $row['domain_setting_value'];
|
||||
if ($name == "array") {
|
||||
$_SESSION[$category][$subcategory][] = $row['domain_setting_value'];
|
||||
}
|
||||
else {
|
||||
$_SESSION[$category][$subcategory][$name] = $row['domain_setting_value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//get the email queue settings
|
||||
$setting = new settings(["domain_uuid" => $domain_uuid]);
|
||||
|
||||
//get the list of installed apps from the core and mod directories and execute the php code in app_defaults.php
|
||||
$default_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_defaults.php");
|
||||
|
|
@ -740,10 +653,6 @@ if (!class_exists('domains')) {
|
|||
$domains_processed++;
|
||||
}
|
||||
|
||||
//clear the session variables
|
||||
unset($_SESSION['domain']);
|
||||
unset($_SESSION['switch']);
|
||||
|
||||
} //end upgrade method
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue