From 1e96df6e9580015a69bee12d0563f6d67bae4003 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Fri, 14 Mar 2025 15:19:49 -0700 Subject: [PATCH] Change $setting to $settings (#7318) * Change $setting to $settings * Update app_defaults.php * Update fax_queue.php * Update xml_cdr.php * Update email_queue.php * Update transcribe.php * Update send.php * Update fax_queue.php * Update fax_send.php * Update app_defaults.php * Update email_queue.php * Update app_defaults.php * Update app_defaults.php * Update app_defaults.php * Update app_defaults.php * Update app_defaults.php * Update app_defaults.php * Update app_defaults.php * Update app_defaults.php * Update app_defaults.php * Update app_defaults.php * Update app_defaults.php --- app/access_controls/app_defaults.php | 2 +- app/call_centers/app_defaults.php | 4 +- app/conference_controls/app_defaults.php | 2 +- app/conference_profiles/app_defaults.php | 2 +- app/dialplans/app_defaults.php | 2 +- app/email_queue/resources/command/send.php | 7 ++- .../resources/functions/transcribe.php | 48 +++++++++---------- .../resources/jobs/email_queue.php | 15 +++--- .../resources/service/email_queue.php | 15 +++--- app/extensions/app_defaults.php | 8 ++-- app/fax/fax_emails.php | 23 ++++----- app/fax_queue/resources/job/fax_queue.php | 19 ++++---- app/fax_queue/resources/job/fax_send.php | 21 ++++---- app/fax_queue/resources/service/fax_queue.php | 19 ++++---- app/modules/app_defaults.php | 4 +- app/music_on_hold/app_defaults.php | 8 ++-- app/number_translations/app_defaults.php | 4 +- app/phrases/app_defaults.php | 16 +++---- app/recordings/app_defaults.php | 14 +++--- app/voicemail_greetings/app_defaults.php | 4 +- app/voicemails/app_defaults.php | 12 ++--- app/xml_cdr/resources/service/xml_cdr.php | 7 +-- 22 files changed, 117 insertions(+), 139 deletions(-) diff --git a/app/access_controls/app_defaults.php b/app/access_controls/app_defaults.php index e400eaa42b..d3ceda0e8a 100644 --- a/app/access_controls/app_defaults.php +++ b/app/access_controls/app_defaults.php @@ -33,7 +33,7 @@ if ($num_rows == 0) { //set the directory - $xml_dir = $setting->get('switch','conf').'/autoload_configs'; + $xml_dir = $settings->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'; diff --git a/app/call_centers/app_defaults.php b/app/call_centers/app_defaults.php index 6265e9e756..60bcd960b3 100644 --- a/app/call_centers/app_defaults.php +++ b/app/call_centers/app_defaults.php @@ -93,8 +93,8 @@ if ($domains_processed == 1) { //add the recording path if needed if ($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']; + if (file_exists($settings->get('switch','recordings').'/'.$row['domain_name'].'/'.$row['queue_greeting'])) { + $queue_greeting_path = $settings->get('switch','recordings').'/'.$row['domain_name'].'/'.$row['queue_greeting']; } else { $queue_greeting_path = trim($row['queue_greeting']); diff --git a/app/conference_controls/app_defaults.php b/app/conference_controls/app_defaults.php index edefd36e7b..853e39370d 100644 --- a/app/conference_controls/app_defaults.php +++ b/app/conference_controls/app_defaults.php @@ -32,7 +32,7 @@ if ($num_rows == 0) { //set the directory - $xml_dir = $setting->get('switch','conf').'/autoload_configs'; + $xml_dir = $settings->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'; diff --git a/app/conference_profiles/app_defaults.php b/app/conference_profiles/app_defaults.php index 3ddccfc0ab..fc62fbd944 100644 --- a/app/conference_profiles/app_defaults.php +++ b/app/conference_profiles/app_defaults.php @@ -32,7 +32,7 @@ if ($num_rows == 0) { //set the directory - $xml_dir = $setting->get('switch','conf').'/autoload_configs'; + $xml_dir = $settings->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'; diff --git a/app/dialplans/app_defaults.php b/app/dialplans/app_defaults.php index 923e13f8d8..f2433e61ac 100644 --- a/app/dialplans/app_defaults.php +++ b/app/dialplans/app_defaults.php @@ -143,7 +143,7 @@ //add not found dialplan to inbound routes /* if ($domains_processed == 1) { - if (is_readable($setting->get('switch','dialplan'))) { + if (is_readable($settings->get('switch','dialplan'))) { $sql = "select count(*) from v_dialplans "; $sql .= "where dialplan_uuid = 'ea5339de-1982-46ca-9695-c35176165314' "; $num_rows = $database->select($sql, null, 'column'); diff --git a/app/email_queue/resources/command/send.php b/app/email_queue/resources/command/send.php index 9909afb196..503319371f 100644 --- a/app/email_queue/resources/command/send.php +++ b/app/email_queue/resources/command/send.php @@ -153,10 +153,9 @@ unset($parameters); //get the email queue settings - $setting = new settings(["domain_uuid" => $domain_uuid]); - $smtp_from = $setting->get('email', 'smtp_from'); - $smtp_from_name = $setting->get('email', 'smtp_from_name', $smtp_from); - $save_response = $setting->get('email_queue', 'save_response'); + $smtp_from = $settings->get('email', 'smtp_from'); + $smtp_from_name = $settings->get('email', 'smtp_from_name', $smtp_from); + $save_response = $settings->get('email_queue', 'save_response'); //debug information if (!empty($debug) && $debug == 'true') { diff --git a/app/email_queue/resources/functions/transcribe.php b/app/email_queue/resources/functions/transcribe.php index c93a0fccab..a954401530 100644 --- a/app/email_queue/resources/functions/transcribe.php +++ b/app/email_queue/resources/functions/transcribe.php @@ -9,16 +9,16 @@ if (!function_exists('transcribe')) { } //get the email queue settings - $setting = new settings(['category' => 'voicemail']); + $settings = new settings(['category' => 'voicemail']); //transcription variables - $transcribe_provider = $setting->get('voicemail', 'transcribe_provider'); - $transcribe_language = $setting->get('voicemail', 'transcribe_language'); + $transcribe_provider = $settings->get('voicemail', 'transcribe_provider'); + $transcribe_language = $settings->get('voicemail', 'transcribe_language'); //transcribe - watson if ($transcribe_provider == 'watson') { - $api_key = $setting->get('voicemail', 'watson_key'); - $api_url = $setting->get('voicemail', 'watson_url'); + $api_key = $settings->get('voicemail', 'watson_key'); + $api_url = $settings->get('voicemail', 'watson_url'); if ($file_extension == "mp3") { $content_type = 'audio/mp3'; @@ -29,7 +29,7 @@ if (!function_exists('transcribe')) { if (isset($api_key) && $api_key != '') { //start output buffer - ob_start(); + ob_start(); $out = fopen('php://output', 'w'); //create the curl resource @@ -118,11 +118,11 @@ if (!function_exists('transcribe')) { //transcribe - google if ($transcribe_provider == 'google') { - $api_key = $setting->get('voicemail', 'google_key'); - $api_url = $setting->get('voicemail', 'google_url'); - $application_credentials = $setting->get('voicemail', 'google_application_credentials'); - $transcribe_language = $setting->get('voicemail', 'transcribe_language'); - $transcribe_alternate_language = $setting->get('voicemail', 'transcribe_alternate_language'); + $api_key = $settings->get('voicemail', 'google_key'); + $api_url = $settings->get('voicemail', 'google_url'); + $application_credentials = $settings->get('voicemail', 'google_application_credentials'); + $transcribe_language = $settings->get('voicemail', 'transcribe_language'); + $transcribe_alternate_language = $settings->get('voicemail', 'transcribe_alternate_language'); if (!isset($transcribe_language) && empty($transcribe_language)) { $transcribe_language = 'en-US'; @@ -136,7 +136,7 @@ if (!function_exists('transcribe')) { if ($file_extension == "wav") { $content_type = 'audio/wav'; } - + //version 1 if (substr($api_url, 0, 32) == 'https://speech.googleapis.com/v1') { if (isset($api_key) && $api_key != '') { @@ -195,8 +195,8 @@ if (!function_exists('transcribe')) { //transcribe - azure if ($transcribe_provider == 'azure') { - $api_key = $setting->get('voicemail', 'azure_key'); - $api_url = $setting->get('voicemail', 'azure_server_region'); + $api_key = $settings->get('voicemail', 'azure_key'); + $api_url = $settings->get('voicemail', 'azure_server_region'); if (empty($transcribe_language)) { $transcribe_language = 'en-US'; @@ -241,8 +241,8 @@ if (!function_exists('transcribe')) { // transcribe - custom // Works with self-hostable transcription service at https://github.com/AccelerateNetworks/an-transcriptions if ($transcribe_provider == 'custom') { - $api_key = $setting->get('voicemail', 'api_key'); - $api_url = $setting->get('voicemail', 'transcription_server'); + $api_key = $settings->get('voicemail', 'api_key'); + $api_url = $settings->get('voicemail', 'transcription_server'); if (empty($transcribe_language)) { $transcribe_language = 'en-US'; @@ -322,9 +322,9 @@ if (!function_exists('transcribe')) { // openai_url // openai_model if ($transcribe_provider == 'openai') { - $api_key = $setting->get('voicemail', 'openai_key'); - $api_url = $setting->get('voicemail', 'openai_url'); - $api_voice_model = $setting->get('voicemail', 'openai_model'); + $api_key = $settings->get('voicemail', 'openai_key'); + $api_url = $settings->get('voicemail', 'openai_url'); + $api_voice_model = $settings->get('voicemail', 'openai_model'); if (empty($api_url)) { $api_url = "https://api.openai.com/v1/audio/transcriptions"; @@ -339,7 +339,7 @@ if (!function_exists('transcribe')) { $full_file_name = $file_path.'/'.$file_name ; //start output buffer - ob_start(); + ob_start(); $out = fopen('php://output', 'w'); //create the curl resource @@ -366,7 +366,7 @@ if (!function_exists('transcribe')) { //execute the curl with the options $http_content = curl_exec($ch); - + //return the error if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); @@ -380,9 +380,9 @@ if (!function_exists('transcribe')) { $debug = ob_get_clean(); echo $debug; - + $ob = json_decode($http_content, true); - + $message = $ob['text']; return array( 'provider' => $transcribe_provider, @@ -396,5 +396,5 @@ if (!function_exists('transcribe')) { } } - + ?> diff --git a/app/email_queue/resources/jobs/email_queue.php b/app/email_queue/resources/jobs/email_queue.php index 0167e54796..6059092861 100755 --- a/app/email_queue/resources/jobs/email_queue.php +++ b/app/email_queue/resources/jobs/email_queue.php @@ -69,11 +69,8 @@ exit; } -//get the email queue settings - $setting = new settings(["category" => "email_queue"]); - //email queue enabled - if ($setting->get('email_queue', 'enabled') != 'true') { + if ($settings->get('email_queue', 'enabled') != 'true') { echo "Email Queue is disabled in Default Settings\n"; exit; } @@ -102,20 +99,20 @@ } //get the call center settings - $interval = $setting->get('email_queue', 'interval'); + $interval = $settings->get('email_queue', 'interval'); //set the defaults if (!is_numeric($interval)) { $interval = 30; } //set the email queue limit - if (!empty($setting->get('email_queue', 'limit'))) { - $email_queue_limit = $setting->get('email_queue', 'limit'); + if (!empty($settings->get('email_queue', 'limit'))) { + $email_queue_limit = $settings->get('email_queue', 'limit'); } else { $email_queue_limit = '30'; } - if (!empty($setting->get('email_queue', 'debug'))) { - $debug = $setting->get('email_queue', 'debug'); + if (!empty($settings->get('email_queue', 'debug'))) { + $debug = $settings->get('email_queue', 'debug'); } //get the messages waiting in the email queue diff --git a/app/email_queue/resources/service/email_queue.php b/app/email_queue/resources/service/email_queue.php index 684dbc7b8e..24d4d01674 100644 --- a/app/email_queue/resources/service/email_queue.php +++ b/app/email_queue/resources/service/email_queue.php @@ -82,11 +82,8 @@ exit; } -//get the email queue settings - $setting = new settings(["category" => "email_queue"]); - //email queue enabled - if ($setting->get('email_queue', 'enabled') != 'true') { + if ($settings->get('email_queue', 'enabled') != 'true') { echo "Email Queue is disabled in Default Settings\n"; exit; } @@ -115,20 +112,20 @@ } //get the call center settings - $interval = $setting->get('email_queue', 'interval'); + $interval = $settings->get('email_queue', 'interval'); //set the defaults if (!is_numeric($interval)) { $interval = 30; } //set the email queue limit - if (!empty($setting->get('email_queue', 'limit'))) { - $email_queue_limit = $setting->get('email_queue', 'limit'); + if (!empty($settings->get('email_queue', 'limit'))) { + $email_queue_limit = $settings->get('email_queue', 'limit'); } else { $email_queue_limit = '30'; } - if (!empty($setting->get('email_queue', 'debug'))) { - $debug = $setting->get('email_queue', 'debug'); + if (!empty($settings->get('email_queue', 'debug'))) { + $debug = $settings->get('email_queue', 'debug'); } //get the messages waiting in the email queue diff --git a/app/extensions/app_defaults.php b/app/extensions/app_defaults.php index c4884a9819..8fbb6a00d6 100644 --- a/app/extensions/app_defaults.php +++ b/app/extensions/app_defaults.php @@ -28,9 +28,9 @@ if ($domains_processed == 1) { //create the directory - if (!empty($setting->get('switch','extensions'))) { - if (!is_dir($setting->get('switch','extensions'))) { - mkdir($setting->get('switch','extensions'), 0770, false); + if (!empty($settings->get('switch','extensions'))) { + if (!is_dir($settings->get('switch','extensions'))) { + mkdir($settings->get('switch','extensions'), 0770, false); } } @@ -106,4 +106,4 @@ } -?> \ No newline at end of file +?> diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index 8a52178671..2929879f0a 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2015-2024 + Portions created by the Initial Developer are Copyright (C) 2015-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -78,37 +78,34 @@ if (!empty($result) && @sizeof($result) != 0) { $fax_accountcode = $row["accountcode"]; $fax_toll_allow = $row["fax_toll_allow"]; - //get event socket connection parameters - $setting = new settings(["database" => $database, "domain_uuid" => $domain_uuid]); - //send the domain name to the command line output if (!empty($fax_email_connection_host) && !empty($fax_email_connection_username)) { echo "Domain Name: ".$domain_name."\n"; } //get the cover font - $fax_cover_font_default =$setting->get('fax','cover_font'); - $fax_cover_font = $setting->get('fax','cover_font'); + $fax_cover_font_default =$settings->get('fax','cover_font'); + $fax_cover_font = $settings->get('fax','cover_font'); if(empty($fax_cover_font)) { $fax_cover_font = $fax_cover_font_default; } //get the allowed file extensions - $fax_allowed_extension_default = arr_to_map($setting->get('fax','allowed_extension')); + $fax_allowed_extension_default = arr_to_map($settings->get('fax','allowed_extension')); if($fax_allowed_extension_default == false){ $tmp = array('.pdf', '.tiff', '.tif'); $fax_allowed_extension_default = arr_to_map($tmp); } - $fax_allowed_extension = arr_to_map($setting->get('fax','allowed_extension')); + $fax_allowed_extension = arr_to_map($settings->get('fax','allowed_extension')); if($fax_allowed_extension == false) { $fax_allowed_extension = $fax_allowed_extension_default; } //set needed variables - $fax_page_size = $setting->get('fax','page_size'); - $fax_resolution = $setting->get('fax','resolution'); - $fax_header = $setting->get('fax','cover_header'); - $fax_footer = $setting->get('fax','cover_footer'); + $fax_page_size = $settings->get('fax','page_size'); + $fax_resolution = $settings->get('fax','resolution'); + $fax_header = $settings->get('fax','cover_header'); + $fax_footer = $settings->get('fax','cover_footer'); $fax_sender = $fax_caller_id_name; //open account connection @@ -221,7 +218,7 @@ if (!empty($result) && @sizeof($result) != 0) { } // set fax directory (used for pdf creation - cover and/or attachments) - $fax_dir = $setting->get('switch','storage').'/fax'.(($domain_name != '') ? '/'.$domain_name : null); + $fax_dir = $settings->get('switch','storage').'/fax'.(($domain_name != '') ? '/'.$domain_name : null); //handle attachments (if any) $emailed_files = Array(); diff --git a/app/fax_queue/resources/job/fax_queue.php b/app/fax_queue/resources/job/fax_queue.php index b08ffcde96..fc42f067ad 100644 --- a/app/fax_queue/resources/job/fax_queue.php +++ b/app/fax_queue/resources/job/fax_queue.php @@ -56,31 +56,28 @@ return $exists; } -//get the email queue settings - $setting = new settings(["category" => "fax_queue"]); - //set the fax queue interval - if (!empty($setting->get('fax_queue', 'interval'))) { - $fax_queue_interval = $setting->get('fax_queue', 'interval'); + if (!empty($settings->get('fax_queue', 'interval'))) { + $fax_queue_interval = $settings->get('fax_queue', 'interval'); } else { $fax_queue_interval = '30'; } //set the fax queue limit - if (!empty($setting->get('fax_queue', 'limit'))) { - $fax_queue_limit = $setting->get('fax_queue', 'limit'); + if (!empty($settings->get('fax_queue', 'limit'))) { + $fax_queue_limit = $settings->get('fax_queue', 'limit'); } else { $fax_queue_limit = '30'; } - if (!empty($setting->get('fax_queue', 'debug'))) { - $debug = $setting->get('fax_queue', 'debug'); + if (!empty($settings->get('fax_queue', 'debug'))) { + $debug = $settings->get('fax_queue', 'debug'); } //set the fax queue retry interval - if (!empty($setting->get('fax_queue', 'retry_interval'))) { - $fax_retry_interval = $setting->get('fax_queue', 'retry_interval'); + if (!empty($settings->get('fax_queue', 'retry_interval'))) { + $fax_retry_interval = $settings->get('fax_queue', 'retry_interval'); } else { $fax_retry_interval = '180'; diff --git a/app/fax_queue/resources/job/fax_send.php b/app/fax_queue/resources/job/fax_send.php index 515364fa40..0f5ffbc0c7 100644 --- a/app/fax_queue/resources/job/fax_send.php +++ b/app/fax_queue/resources/job/fax_send.php @@ -184,22 +184,19 @@ } unset($parameters); -//get the email queue settings - $setting = new settings(["domain_uuid" => $domain_uuid]); - //prepare the smtp from and from name variables - $email_from = $setting->get('fax','smtp_from'); - $email_from_name = $setting->get('fax','smtp_from_name'); + $email_from = $settings->get('fax','smtp_from'); + $email_from_name = $settings->get('fax','smtp_from_name'); if (empty($email_from)) { - $email_from = $setting->get('email','smtp_from'); + $email_from = $settings->get('email','smtp_from'); } if (empty($email_from_name)) { - $email_from_name = $setting->get('email','smtp_from_name'); + $email_from_name = $settings->get('email','smtp_from_name'); } //prepare the variables to send the fax $email_from_address = $email_from; - $retry_limit = $setting->get('fax_queue','retry_limit'); + $retry_limit = $settings->get('fax_queue','retry_limit'); //prepare the fax retry count if (!isset($fax_retry_count)) { @@ -252,7 +249,7 @@ if ($fax_retry_count == 0) { //use default settings or domain settings (defaults to t38) $fax_options = ''; - foreach($setting->get('fax','variable') as $variable) { + foreach($settings->get('fax','variable') as $variable) { $fax_options .= $variable.","; } } @@ -283,7 +280,7 @@ else { //try the user definable method again $fax_options = ''; - foreach($setting->get('fax','variable') as $variable) { + foreach($settings->get('fax','variable') as $variable) { $fax_options .= $variable.","; } } @@ -298,7 +295,7 @@ //check to see if the destination number is local $local_destination = false; - if ($setting->get('fax_queue','prefer_local', false)) { + if ($settings->get('fax_queue','prefer_local', false)) { $sql = "select count(destination_uuid) "; $sql .= "from v_destinations "; $sql .= "where ("; @@ -463,7 +460,7 @@ //send the email if (!empty($fax_email_address) && file_exists($fax_file)) { //get the language code - $language_code = $setting->get('domain','language'); + $language_code = $settings->get('domain','language'); //get the template subcategory if (isset($fax_relay) && $fax_relay == 'true') { diff --git a/app/fax_queue/resources/service/fax_queue.php b/app/fax_queue/resources/service/fax_queue.php index db9eb1e654..d7df42ab3f 100644 --- a/app/fax_queue/resources/service/fax_queue.php +++ b/app/fax_queue/resources/service/fax_queue.php @@ -103,31 +103,28 @@ file_put_contents($pid_file, getmypid()); } -//get the fax queue settings - $setting = new settings(["category" => "fax_queue"]); - //set the fax queue interval - if (!empty($setting->get('fax_queue', 'interval'))) { - $fax_queue_interval = $setting->get('fax_queue', 'interval'); + if (!empty($settings->get('fax_queue', 'interval'))) { + $fax_queue_interval = $settings->get('fax_queue', 'interval'); } else { $fax_queue_interval = '30'; } //set the fax queue limit - if (!empty($setting->get('fax_queue', 'limit'))) { - $fax_queue_limit = $setting->get('fax_queue', 'limit'); + if (!empty($settings->get('fax_queue', 'limit'))) { + $fax_queue_limit = $settings->get('fax_queue', 'limit'); } else { $fax_queue_limit = '30'; } - if (!empty($setting->get('fax_queue', 'debug'))) { - $debug = $setting->get('fax_queue', 'debug'); + if (!empty($settings->get('fax_queue', 'debug'))) { + $debug = $settings->get('fax_queue', 'debug'); } //set the fax queue retry interval - if (!empty($setting->get('fax_queue', 'retry_interval'))) { - $fax_retry_interval = $setting->get('fax_queue', 'retry_interval'); + if (!empty($settings->get('fax_queue', 'retry_interval'))) { + $fax_retry_interval = $settings->get('fax_queue', 'retry_interval'); } else { $fax_retry_interval = '180'; diff --git a/app/modules/app_defaults.php b/app/modules/app_defaults.php index bce5db02d7..70771fb38e 100644 --- a/app/modules/app_defaults.php +++ b/app/modules/app_defaults.php @@ -57,8 +57,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 (!empty($setting->get('switch','mod'))) { - $module->dir = $setting->get('switch','mod'); + if (!empty($settings->get('switch','mod'))) { + $module->dir = $settings->get('switch','mod'); $module->get_modules(); $module->synch(); $module->xml(); diff --git a/app/music_on_hold/app_defaults.php b/app/music_on_hold/app_defaults.php index bd9bf7f0e1..710b6342af 100644 --- a/app/music_on_hold/app_defaults.php +++ b/app/music_on_hold/app_defaults.php @@ -27,13 +27,13 @@ if ($domains_processed == 1) { //set the directory - if (!empty($setting->get('switch','conf'))) { - $xml_dir = $setting->get('switch','conf').'/autoload_configs'; + if (!empty($settings->get('switch','conf'))) { + $xml_dir = $settings->get('switch','conf').'/autoload_configs'; $xml_file = $xml_dir."/local_stream.conf"; } //rename the file - if (!empty($setting->get('switch','conf'))) { + if (!empty($settings->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 (!empty($setting->get('switch','conf'))) { + if (!empty($settings->get('switch','conf'))) { $sql = "select count(music_on_hold_uuid) from v_music_on_hold; "; $num_rows = $database->select($sql, null, 'column'); unset($sql); diff --git a/app/number_translations/app_defaults.php b/app/number_translations/app_defaults.php index 3ccd87b9fe..5c2ecab04c 100644 --- a/app/number_translations/app_defaults.php +++ b/app/number_translations/app_defaults.php @@ -45,9 +45,9 @@ } //check for existing configuration - if (!empty($setting->get('switch','conf')) && file_exists($setting->get('switch','conf')."/autoload_configs/translate.conf.xml")) { + if (!empty($settings->get('switch','conf')) && file_exists($settings->get('switch','conf')."/autoload_configs/translate.conf.xml")) { //import existing data - $xml = file_get_contents($setting->get('switch','conf')."/autoload_configs/translate.conf.xml"); + $xml = file_get_contents($settings->get('switch','conf')."/autoload_configs/translate.conf.xml"); //convert the xml string to an xml object $xml = simplexml_load_string($xml); diff --git a/app/phrases/app_defaults.php b/app/phrases/app_defaults.php index e2b0f79571..b72fd08e67 100644 --- a/app/phrases/app_defaults.php +++ b/app/phrases/app_defaults.php @@ -28,9 +28,9 @@ if ($domains_processed == 1) { //create phrases folder and add include line in xml for each language found /* - if (!empty($setting->get('switch','languages'))) { - if (is_readable($setting->get('switch','languages'))) { - $conf_lang_folders = glob($setting->get('switch','languages')."/*"); + if (!empty($settings->get('switch','languages'))) { + if (is_readable($settings->get('switch','languages'))) { + $conf_lang_folders = glob($settings->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($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') == 'base64') { + if (!empty($settings->get('recordings','storage_type')) && $settings->get('recordings','storage_type') == 'base64') { $sql = "select phrase_detail_uuid, phrase_detail_data "; $sql .= "from v_phrase_details where phrase_detail_function = 'play-file' "; $result = $database->select($sql, null, 'all'); @@ -73,8 +73,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, $setting->get('switch','recordings').'/'.$domain_name) > 0) { - $phrase_detail_data = str_replace($setting->get('switch','recordings').'/'.$domain_name.'/', '', $phrase_detail_data); + if (substr_count($phrase_detail_data, $settings->get('switch','recordings').'/'.$domain_name) > 0) { + $phrase_detail_data = str_replace($settings->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.")"; @@ -98,7 +98,7 @@ if ($domains_processed == 1) { } //if not base64, revert base64 phrases to standard method - else if (!empty($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') != 'base64') { + else if (!empty($settings->get('recordings','storage_type')) && $settings->get('recordings','storage_type') != 'base64') { $sql = "select phrase_detail_uuid, phrase_detail_data "; $sql .= "from v_phrase_details where "; $sql .= "phrase_detail_function = 'execute' "; @@ -112,7 +112,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 = $setting->get('switch','recordings').'/'.$domain_name.'/'.$phrase_detail_data; + $phrase_detail_data = $settings->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'; diff --git a/app/recordings/app_defaults.php b/app/recordings/app_defaults.php index 284b3aff7e..6d35521081 100644 --- a/app/recordings/app_defaults.php +++ b/app/recordings/app_defaults.php @@ -25,9 +25,9 @@ */ //if the recordings directory doesn't exist then create it - 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); + if (!empty($settings->get('switch','recordings')) && !empty($domain_name)) { + if (!is_readable($settings->get('switch','recordings')."/".$domain_name)) { + mkdir($settings->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($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') == 'base64') { + if (!empty($settings->get('recordings','storage_type')) && $settings->get('recordings','storage_type') == 'base64') { //get recordings without base64 in db $sql = "select recording_uuid, domain_uuid, recording_filename "; $sql .= "from v_recordings "; @@ -50,7 +50,7 @@ $recording_filename = $row['recording_filename']; //set recording directory - $recording_directory = $setting->get('switch','recordings').'/'.$domain_name; + $recording_directory = $settings->get('switch','recordings').'/'.$domain_name; //encode recording file (if exists) if (file_exists($recording_directory.'/'.$recording_filename)) { @@ -77,7 +77,7 @@ unset($sql, $result, $row); } //if not base64, decode to local files, remove base64 data from db - else if (!empty($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') != 'base64') { + else if (!empty($settings->get('recordings','storage_type')) && $settings->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 "; @@ -92,7 +92,7 @@ $recording_base64 = $row['recording_base64']; //set recording directory - $recording_directory = $setting->get('switch','recordings').'/'.$domain_name; + $recording_directory = $settings->get('switch','recordings').'/'.$domain_name; //remove local file, if any if (file_exists($recording_directory.'/'.$recording_filename)) { diff --git a/app/voicemail_greetings/app_defaults.php b/app/voicemail_greetings/app_defaults.php index 244172c14d..c25d15cd6b 100644 --- a/app/voicemail_greetings/app_defaults.php +++ b/app/voicemail_greetings/app_defaults.php @@ -68,8 +68,8 @@ if ($domains_processed == 1) { unset($sql, $result, $row); //get settings - $voicemail_storage_type = $setting->get('voicemail','storage_type'); - $switch_storage = $setting->get('switch','storage'); + $voicemail_storage_type = $settings->get('voicemail','storage_type'); + $switch_storage = $settings->get('switch','storage'); //if base64, populate from existing greeting files, then remove if (!empty($voicemail_storage_type) && $voicemail_storage_type == 'base64') { diff --git a/app/voicemails/app_defaults.php b/app/voicemails/app_defaults.php index 0897b7cb4f..7532a6c230 100644 --- a/app/voicemails/app_defaults.php +++ b/app/voicemails/app_defaults.php @@ -36,18 +36,18 @@ if ($domains_processed == 1) { unset($sql, $parameters); if (!empty($voicemails) && is_array($voicemails)) { foreach($voicemails as $row) { - 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); + if (!empty($settings->get('switch','voicemail')) && !empty($row['voicemail_id']) && is_numeric($row['voicemail_id'])) { + if (!file_exists($settings->get('switch','voicemail')."/default/".$row['domain_name']."/".$row['voicemail_id'])) { + mkdir($settings->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($setting->get('switch','conf')) ? $setting->get('switch','conf') : '/etc/freeswitch'; + $switch_configuration_dir = !empty($settings->get('switch','conf')) ? $settings->get('switch','conf') : '/etc/freeswitch'; $switch_languages_dir_initial = $switch_configuration_dir.'/lang'; - $switch_languages_dir_current = $setting->get('switch','languages') ?? ''; + $switch_languages_dir_current = $settings->get('switch','languages') ?? ''; $switch_languages_dir_correct = $switch_configuration_dir.'/languages'; //ensure switch using languages (not lang) folder @@ -124,4 +124,4 @@ if ($domains_processed == 1) { } -?> \ No newline at end of file +?> diff --git a/app/xml_cdr/resources/service/xml_cdr.php b/app/xml_cdr/resources/service/xml_cdr.php index 7714335df0..b39fd75333 100644 --- a/app/xml_cdr/resources/service/xml_cdr.php +++ b/app/xml_cdr/resources/service/xml_cdr.php @@ -80,11 +80,8 @@ exit; } -//get the settings - $setting = new settings(); - //get cdr settings - //$interval = $setting->get('xml_cdr', '$interval'); + //$interval = $settings->get('xml_cdr', '$interval'); //make sure the /var/run/fusionpbx directory exists if (!file_exists('/var/run/fusionpbx')) { @@ -119,7 +116,7 @@ $cdr = new xml_cdr; //get the cdr record - $xml_cdr_dir = $setting->get('switch', 'log').'/xml_cdr'; + $xml_cdr_dir = $settings->get('switch', 'log').'/xml_cdr'; //loop through while (true) {