diff --git a/app/voicemail_greetings/voicemail_greeting_edit.php b/app/voicemail_greetings/voicemail_greeting_edit.php index 0e832d5be7..858e2c5106 100644 --- a/app/voicemail_greetings/voicemail_greeting_edit.php +++ b/app/voicemail_greetings/voicemail_greeting_edit.php @@ -41,8 +41,13 @@ $language = new text; $text = $language->get(); +//set the variables + $domain_uuid = $_SESSION['domain_uuid']; + $domain_name = $_SESSION['domain_name']; + $user_uuid = $_SESSION['user_uuid']; + //add the settings object - $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]); + $settings = new settings(["domain_uuid" => $domain_uuid, "user_uuid" => $user_uuid]); //as long as the class exists, enable speech using default settings $speech_enabled = class_exists('speech') && $settings->get('speech', 'enabled', false); @@ -63,6 +68,7 @@ if ($speech_enabled && !empty($speech_engine)) { $speech = new speech($settings); $voices = $speech->get_voices(); + $greeting_format = $speech->get_format(); //$speech_models = $speech->get_models(); //$translate_enabled = $speech->get_translate_enabled(); //$language_enabled = $speech->get_language_enabled(); @@ -156,9 +162,8 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $sql .= "from v_voicemail_greetings where domain_uuid = :domain_uuid "; $sql .= "and voicemail_id = :voicemail_id "; $sql .= "order by greeting_id asc "; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $parameters['domain_uuid'] = $domain_uuid; $parameters['voicemail_id'] = $voicemail_id; - $database = new database; $rows = $database->select($sql, $parameters, 'all'); $greeting_ids = array(); if (!empty($rows) && is_array($rows)) { @@ -172,7 +177,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $greeting_format = $greeting_format ?? 'wav'; //build the setting object and get the recording path - $greeting_path = $settings->get('switch', 'voicemail').'/default/'.$_SESSION['domain_name'].'/'.$voicemail_id.'/'; + $greeting_path = $settings->get('switch', 'voicemail').'/default/'.$domain_name.'/'.$voicemail_id.'/'; if ($action == 'add') { //find the next available greeting id @@ -193,7 +198,6 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { if ($speech_enabled && !empty($greeting_voice) && !empty($greeting_message)) { $speech->audio_path = $greeting_path; $speech->audio_filename = $greeting_filename; - $speech->audio_format = $greeting_format; //$speech->audio_model = $greeting_model ?? ''; $speech->audio_voice = $greeting_voice; //$speech->audio_language = $greeting_language; @@ -226,7 +230,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { //build data array $array['voicemail_greetings'][0]['voicemail_greeting_uuid'] = $voicemail_greeting_uuid; - $array['voicemail_greetings'][0]['domain_uuid'] = $_SESSION['domain_uuid']; + $array['voicemail_greetings'][0]['domain_uuid'] = $domain_uuid; $array['voicemail_greetings'][0]['voicemail_id'] = $voicemail_id; $array['voicemail_greetings'][0]['greeting_id'] = $greeting_id; $array['voicemail_greetings'][0]['greeting_name'] = $greeting_name; @@ -236,7 +240,6 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $array['voicemail_greetings'][0]['greeting_description'] = $greeting_description; //execute query - $database = new database; $database->app_name = 'voicemail_greetings'; $database->app_uuid = 'e4b4fbee-9e4d-8e46-3810-91ba663db0c2'; $database->save($array); @@ -254,17 +257,12 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { } //pre-populate the form - if ( - $action == 'update' && - !empty($voicemail_greeting_uuid) && is_uuid($voicemail_greeting_uuid) && - (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true") - ) { + if ($action == 'update' && !empty($voicemail_greeting_uuid) && is_uuid($voicemail_greeting_uuid) && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) { $sql = "select * from v_voicemail_greetings "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and voicemail_greeting_uuid = :voicemail_greeting_uuid "; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $parameters['domain_uuid'] = $domain_uuid; $parameters['voicemail_greeting_uuid'] = $voicemail_greeting_uuid; - $database = new database; $row = $database->select($sql, $parameters, 'row'); if (is_array($row) && @sizeof($row) != 0) { $greeting_id = $row["greeting_id"]; @@ -421,7 +419,6 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { echo "\n"; } - echo "\n"; echo "\n"; echo " ".$text['label-description']."\n";