Use boolean in conditional statement
This commit is contained in:
parent
f86214f61e
commit
ebaf1f909f
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
//add the settings object
|
||||
$settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', 'false');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', false);
|
||||
$transcribe_engine = $settings->get('transcribe', 'engine', '');
|
||||
|
||||
//set additional variables
|
||||
|
|
@ -161,7 +161,7 @@
|
|||
unset($sql, $parameters);
|
||||
|
||||
//detect if any transcriptions available
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($call_recordings) && is_array($call_recordings)) {
|
||||
if ($transcribe_enabled && !empty($transcribe_engine) && !empty($call_recordings) && is_array($call_recordings)) {
|
||||
$transcriptions_exists = false;
|
||||
foreach ($call_recordings as $row) {
|
||||
if (!empty($row['call_recording_transcription'])) { $transcriptions_exists = true; }
|
||||
|
|
@ -199,7 +199,7 @@
|
|||
if (permission_exists('call_recording_download') && !empty($call_recordings)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'id'=>'btn_download','name'=>'btn_download','style'=>'display: none;','collapse'=>'hide-xs','onclick'=>"list_action_set('download'); list_form_submit('form_list');"]);
|
||||
}
|
||||
if (permission_exists('call_recording_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($call_recordings)) {
|
||||
if (permission_exists('call_recording_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && !empty($call_recordings)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-transcribe'],'icon'=>'quote-right','id'=>'btn_transcribe','name'=>'btn_transcribe','style'=>'display: none;','collapse'=>'hide-xs','onclick'=>"list_action_set('transcribe'); list_form_submit('form_list');"]);
|
||||
}
|
||||
if (permission_exists('call_recording_delete') && !empty($call_recordings)) {
|
||||
|
|
@ -314,7 +314,7 @@
|
|||
if (permission_exists('call_recording_download')) {
|
||||
echo button::create(['type'=>'button','title'=>$text['label-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>'download.php?id='.urlencode($row['call_recording_uuid']).'&binary']);
|
||||
}
|
||||
if (permission_exists('call_recording_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true) {
|
||||
if (permission_exists('call_recording_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && $transcriptions_exists === true) {
|
||||
echo button::create(['type'=>'button','title'=>$text['label-transcription'],'icon'=>'quote-right','style'=>(empty($row['call_recording_transcription']) ? 'visibility:hidden;' : null),'onclick'=>"document.getElementById('transcription_".$row['call_recording_uuid']."').style.display = document.getElementById('transcription_".$row['call_recording_uuid']."').style.display == 'none' ? 'table-row' : 'none'; this.blur(); return false;"]);
|
||||
}
|
||||
}
|
||||
|
|
@ -329,7 +329,7 @@
|
|||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
if (permission_exists('call_recording_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($row['call_recording_transcription'])) {
|
||||
if (permission_exists('call_recording_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && !empty($row['call_recording_transcription'])) {
|
||||
echo "<tr style='display: none;'><td></td></tr>\n"; // dummy row to maintain same background color for transcription row
|
||||
echo "<tr id='transcription_".$row['call_recording_uuid']."' class='list-row' style='display: none;'>\n";
|
||||
echo " <td style='padding: 10px 20px 15px 20px;' colspan='".$col_count."'>\n";
|
||||
|
|
|
|||
|
|
@ -152,11 +152,11 @@ if (!class_exists('call_recordings')) {
|
|||
|
||||
//add the settings object
|
||||
$settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', 'false');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', false);
|
||||
$transcribe_engine = $settings->get('transcribe', 'engine', '');
|
||||
|
||||
//transcribe multiple recordings
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && is_array($records) && @sizeof($records) != 0) {
|
||||
if ($transcribe_enabled && !empty($transcribe_engine) && is_array($records) && @sizeof($records) != 0) {
|
||||
//add the transcribe object
|
||||
$transcribe = new transcribe($settings);
|
||||
|
||||
|
|
|
|||
|
|
@ -55,13 +55,13 @@
|
|||
|
||||
//add the settings object
|
||||
$settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
|
||||
$speech_enabled = $settings->get('speech', 'enabled', 'false');
|
||||
$speech_enabled = $settings->get('speech', 'enabled', false);
|
||||
$speech_engine = $settings->get('speech', 'engine', '');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', 'false');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', false);
|
||||
$transcribe_engine = $settings->get('transcribe', 'engine', '');
|
||||
|
||||
//add the speech object and get the voices and languages arrays
|
||||
if ($speech_enabled == 'true' && !empty($speech_engine)) {
|
||||
if ($speech_enabled && !empty($speech_engine)) {
|
||||
$speech = new speech($settings);
|
||||
$voices = $speech->get_voices();
|
||||
//$speech_models = $speech->get_models();
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
}
|
||||
|
||||
//add the transcribe object and get the languages arrays
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine)) {
|
||||
if ($transcribe_enabled && !empty($transcribe_engine)) {
|
||||
$transcribe = new transcribe($settings);
|
||||
//$transcribe_models = $transcribe->get_models();
|
||||
//$translate_enabled = $transcribe->get_translate_enabled();
|
||||
|
|
@ -199,7 +199,7 @@
|
|||
|
||||
//determine whether to create the recording
|
||||
$create_recording = false;
|
||||
if ($speech_enabled == 'true' && !empty($recording_voice) && !empty($recording_message)) {
|
||||
if ($speech_enabled && !empty($recording_voice) && !empty($recording_message)) {
|
||||
if ($action == 'add') {
|
||||
$create_recording = true;
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@
|
|||
}
|
||||
|
||||
//audio to text - get the transcription from the audio file
|
||||
if ($transcribe_enabled == 'true' && empty($recording_message)) {
|
||||
if ($transcribe_enabled && empty($recording_message)) {
|
||||
$transcribe->audio_path = $recording_path;
|
||||
$transcribe->audio_filename = $recording_filename;
|
||||
$recording_message = $transcribe->transcribe();
|
||||
|
|
@ -243,7 +243,7 @@
|
|||
$array['recordings'][0]['recording_uuid'] = $recording_uuid;
|
||||
$array['recordings'][0]['recording_filename'] = $recording_filename;
|
||||
$array['recordings'][0]['recording_name'] = $recording_name;
|
||||
if ($speech_enabled == 'true' || $transcribe_enabled == 'true') {
|
||||
if ($speech_enabled || $transcribe_enabled) {
|
||||
$array['recordings'][0]['recording_voice'] = $recording_voice;
|
||||
$array['recordings'][0]['recording_message'] = $recording_message;
|
||||
}
|
||||
|
|
@ -341,7 +341,7 @@
|
|||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
if ($speech_enabled == 'true' || $transcribe_enabled == 'true') {
|
||||
if ($speech_enabled || $transcribe_enabled) {
|
||||
//models
|
||||
if (!empty($models)) {
|
||||
echo "<tr>\n";
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@
|
|||
|
||||
//add the settings object
|
||||
$settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
|
||||
$speech_enabled = $settings->get('speech', 'enabled', 'false');
|
||||
$speech_enabled = $settings->get('speech', 'enabled', false);
|
||||
$speech_engine = $settings->get('speech', 'engine', '');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', 'false');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', false);
|
||||
$transcribe_engine = $settings->get('transcribe', 'engine', '');
|
||||
$storage_type = $settings->get('voicemail', 'storage_type', '');
|
||||
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
$language_enabled = false;
|
||||
|
||||
//add the speech object and get the voices and languages arrays
|
||||
if ($speech_enabled == 'true' && !empty($speech_engine)) {
|
||||
if ($speech_enabled && !empty($speech_engine)) {
|
||||
$speech = new speech($settings);
|
||||
$voices = $speech->get_voices();
|
||||
//$speech_models = $speech->get_models();
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
}
|
||||
|
||||
//add the transcribe object and get the languages arrays
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine)) {
|
||||
if ($transcribe_enabled && !empty($transcribe_engine)) {
|
||||
$transcribe = new transcribe($settings);
|
||||
//$transcribe_models = $transcribe->get_models();
|
||||
//$translate_enabled = $transcribe->get_translate_enabled();
|
||||
|
|
@ -184,7 +184,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
|||
$greeting_filename = 'greeting_'.$greeting_id.'.'.$greeting_format;
|
||||
|
||||
//text to audio - make a new audio file from the message
|
||||
if ($speech_enabled == 'true' && !empty($greeting_voice) && !empty($greeting_message)) {
|
||||
if ($speech_enabled && !empty($greeting_voice) && !empty($greeting_message)) {
|
||||
$speech->audio_path = $greeting_path;
|
||||
$speech->audio_filename = $greeting_filename;
|
||||
$speech->audio_format = $greeting_format;
|
||||
|
|
@ -207,7 +207,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
|||
}
|
||||
|
||||
//audio to text - get the transcription from the audio file
|
||||
if ($transcribe_enabled == 'true' && empty($greeting_voice) && empty($greeting_message)) {
|
||||
if ($transcribe_enabled && empty($greeting_voice) && empty($greeting_message)) {
|
||||
$transcribe->audio_path = $greeting_path;
|
||||
$transcribe->audio_filename = $greeting_filename;
|
||||
$greeting_message = $transcribe->transcribe();
|
||||
|
|
@ -310,7 +310,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
|||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($speech_enabled == 'true' || $transcribe_enabled == 'true') {
|
||||
if ($speech_enabled || $transcribe_enabled) {
|
||||
//models
|
||||
if (!empty($models) && is_array($models)) {
|
||||
echo "<tr>\n";
|
||||
|
|
|
|||
|
|
@ -1028,12 +1028,12 @@
|
|||
|
||||
//add the settings object
|
||||
$settings = new settings(["domain_uuid" => $this->domain_uuid, "user_uuid" => $this->user_uuid]);
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', 'false');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', false);
|
||||
$transcribe_engine = $settings->get('transcribe', 'engine', '');
|
||||
$switch_voicemail = $settings->get('switch', 'voicemail', '/var/lib/freeswitch/storage/voicemail');
|
||||
|
||||
//transcribe multiple recordings
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine)) {
|
||||
if ($transcribe_enabled && !empty($transcribe_engine)) {
|
||||
|
||||
//get voicemail message base64
|
||||
$sql = "select message_base64 from v_voicemail_messages where voicemail_message_uuid = :voicemail_message_uuid ";
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@
|
|||
|
||||
//add the settings object
|
||||
$settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', 'false');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', false);
|
||||
$transcribe_engine = $settings->get('transcribe', 'engine', '');
|
||||
|
||||
//set the back button url
|
||||
|
|
@ -151,7 +151,7 @@
|
|||
// no return, exit
|
||||
exit;
|
||||
case 'transcribe':
|
||||
if (permission_exists('voicemail_message_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) {
|
||||
if (permission_exists('voicemail_message_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) {
|
||||
$messages_transcribed = 0;
|
||||
foreach ($voicemail_messages as $voicemail_message) {
|
||||
if (!empty($voicemail_message['checked']) && $voicemail_message['checked'] == 'true' && is_uuid($voicemail_message['uuid']) && is_uuid($voicemail_message['voicemail_uuid'])) {
|
||||
|
|
@ -304,7 +304,7 @@
|
|||
if ($message['message_status'] != 'saved') {
|
||||
$new_messages++;
|
||||
}
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($message['message_transcription'])) {
|
||||
if ($transcribe_enabled && !empty($transcribe_engine) && !empty($message['message_transcription'])) {
|
||||
$transcriptions_exists = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -326,7 +326,7 @@
|
|||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>$_SESSION['back'][$_SERVER['PHP_SELF']]]);
|
||||
$margin_left = false;
|
||||
if (permission_exists('voicemail_message_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && $num_rows) {
|
||||
if (permission_exists('voicemail_message_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && $num_rows) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-transcribe'],'icon'=>'quote-right','id'=>'btn_transcribe','name'=>'btn_transcribe','collapse'=>'hide-xs','style'=>'display: none; margin-left: 15px;','onclick'=>"list_action_set('transcribe'); list_form_submit('form_list');"]);
|
||||
$margin_left = true;
|
||||
}
|
||||
|
|
@ -458,7 +458,7 @@
|
|||
}
|
||||
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'].' '.$text['label-message'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.escape($row['voicemail_message_uuid']),'onclick'=>"recording_play('".escape($row['voicemail_message_uuid'])."','".$row['voicemail_id'].'|'.$row['voicemail_uuid']."','message');"]);
|
||||
echo button::create(['type'=>'button','title'=>$text['label-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>"voicemail_messages.php?action=download&id=".urlencode($row['voicemail_id'])."&voicemail_uuid=".escape($row['voicemail_uuid'])."&uuid=".escape($row['voicemail_message_uuid'])."&t=bin&r=".uuid(),'onclick'=>"$(this).closest('tr').children('td').css('font-weight','normal');"]);
|
||||
if (!empty($row['message_transcription']) || ($transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true)) {
|
||||
if (!empty($row['message_transcription']) || ($transcribe_enabled && !empty($transcribe_engine) && $transcriptions_exists === true)) {
|
||||
echo button::create(['type'=>'button','title'=>$text['label-transcription'],'icon'=>'quote-right','style'=>(empty($row['message_transcription']) ? 'visibility:hidden;' : null),'onclick'=>(!empty($bold) ? "mark_saved('".$row['voicemail_message_uuid']."', '".$row['voicemail_uuid']."');" : null)."document.getElementById('transcription_".$row['voicemail_message_uuid']."').style.display = document.getElementById('transcription_".$row['voicemail_message_uuid']."').style.display == 'none' ? 'table-row' : 'none'; this.blur(); return false;"]);
|
||||
}
|
||||
echo " </td>\n";
|
||||
|
|
@ -467,7 +467,7 @@
|
|||
echo " <td class='right no-wrap hide-sm-dn' style='".$bold."'>".escape($row['file_size_label'])."</td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
if (!empty($row['message_transcription']) || ($transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true)) {
|
||||
if (!empty($row['message_transcription']) || ($transcribe_enabled && !empty($transcribe_engine) && $transcriptions_exists === true)) {
|
||||
echo "<tr style='display: none;'><td></td></tr>\n"; // dummy row to maintain same background color for transcription row
|
||||
echo "<tr id='transcription_".$row['voicemail_message_uuid']."' class='list-row' style='display: none;'>\n";
|
||||
echo " <td style='padding: 10px 20px 15px 20px;' colspan='".$col_count."'>\n";
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@
|
|||
echo th_order_by('voicemail_file', $text['label-voicemail_file_attached'], $order_by, $order, null, "class='center hide-md-dn'");
|
||||
echo th_order_by('voicemail_local_after_email', $text['label-voicemail_local_after_email'], $order_by, $order, null, "class='center hide-md-dn'");
|
||||
if (permission_exists('voicemail_transcription_enabled') && ($_SESSION['transcribe']['enabled']['boolean'] ?? '') == "true") {
|
||||
echo th_order_by('voicemail_transcription_enabled', $text['label-voicemail_transcribe_enabled'], $order_by, $order);
|
||||
echo th_order_by('voicemail_transcription_enabled', $text['label-voicemail_UU'], $order_by, $order);
|
||||
}
|
||||
if (permission_exists('voicemail_message_view') || permission_exists('voicemail_greeting_view')) {
|
||||
echo "<th>".$text['label-tools']."</th>\n";
|
||||
|
|
|
|||
|
|
@ -43,8 +43,10 @@
|
|||
|
||||
//add the settings object
|
||||
$settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', 'false');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', false);
|
||||
$transcribe_engine = $settings->get('transcribe', 'engine', '');
|
||||
$call_log_enabled = $settings->get('cdr', 'call_log_enabled', false);
|
||||
$summary_style = $settings->get('cdr', 'summary_style', 'horizontal');
|
||||
|
||||
//get the http values and set them to a variable
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
|
|
@ -88,7 +90,7 @@
|
|||
if (
|
||||
!empty($_GET['action']) &&
|
||||
$_GET['action'] == 'transcribe' &&
|
||||
$transcribe_enabled == 'true' &&
|
||||
$transcribe_enabled &&
|
||||
!empty($transcribe_engine) &&
|
||||
empty($record_transcription) &&
|
||||
!empty($record_path) &&
|
||||
|
|
@ -174,7 +176,7 @@
|
|||
}
|
||||
|
||||
//get the cdr log from the database
|
||||
if ($_SESSION['cdr']['call_log_enabled']['boolean'] == 'true') {
|
||||
if ($call_log_enabled) {
|
||||
$sql = "select * from v_xml_cdr_logs ";
|
||||
if (permission_exists('xml_cdr_all')) {
|
||||
$sql .= "where xml_cdr_uuid = :xml_cdr_uuid ";
|
||||
|
|
@ -380,10 +382,10 @@
|
|||
echo "<td width='30%' align='left' valign='top' nowrap='nowrap'><b>".$text['title2']."</b><br><br></td>\n";
|
||||
echo "<td width='70%' align='right' valign='top'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'xml_cdr.php'.(!empty($_SESSION['xml_cdr']['last_query']) ? '?'.urlencode($_SESSION['xml_cdr']['last_query']) : null)]);
|
||||
if ($_SESSION['cdr']['call_log_enabled']['boolean'] == 'true' && isset($log_content) && !empty($log_content)) {
|
||||
if ($call_log_enabled && isset($log_content) && !empty($log_content)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-call_log'],'icon'=>$_SESSION['theme']['button_icon_search'],'style'=>'margin-left: 15px;','link'=>'xml_cdr_log.php?id='.$uuid]);
|
||||
}
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && empty($record_transcription)) {
|
||||
if ($transcribe_enabled && !empty($transcribe_engine) && empty($record_transcription)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-transcribe'],'icon'=>'quote-right','id'=>'btn_transcribe','name'=>'btn_transcribe','collapse'=>'hide-xs','style'=>'margin-left: 15px;','onclick'=>"window.location.href='?id=".$uuid."&action=transcribe';"]);
|
||||
}
|
||||
echo "</td>\n";
|
||||
|
|
@ -405,7 +407,7 @@
|
|||
echo "</table>\n";
|
||||
|
||||
//show the call summary - vertical
|
||||
if ($_SESSION['cdr']['summary_style']['text'] == 'vertical') {
|
||||
if ($summary_style == 'vertical') {
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
|
|
@ -427,7 +429,7 @@
|
|||
}
|
||||
|
||||
//show the call summary - horizontal
|
||||
if ($_SESSION['cdr']['summary_style']['text'] == 'horizontal') {
|
||||
if ($summary_style == 'horizontal') {
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<th>".$text['label-direction']."</th>\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue