Merge master into use_javascript_for_phrase_edit

This commit is contained in:
Tim Fry 2024-12-11 20:18:31 -04:00
commit 90bc61d2d0
24 changed files with 382 additions and 215 deletions

View File

@ -209,6 +209,9 @@
}
require_once "resources/header.php";
//set the back button
$_SESSION['call_forward_back'] = $_SERVER['PHP_SELF'];
//show the content
if ($is_included) {
echo "<div class='action_bar sub'>\n";

View File

@ -533,13 +533,16 @@
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
//save the back button location using referer
$back_destination = "window.location.href='" . ($_SESSION['call_forward_back'] ?? "/app/call_forward/call_forward.php") . "'";
//show the content
echo "<form method='post' name='frm' id='frm'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-call_forward']."</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','onclick'=>'history.back();']);
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','onclick'=>$back_destination]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;']);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";

View File

@ -468,8 +468,8 @@ $text['label-domain']['zh-cn'] = "领域";
$text['label-domain']['ja-jp'] = "ドメイン";
$text['label-domain']['ko-kr'] = "도메인";
$text['label-destination']['en-us'] = "Dest";
$text['label-destination']['en-gb'] = "Dest";
$text['label-destination']['en-us'] = "Destination";
$text['label-destination']['en-gb'] = "Destination";
$text['label-destination']['ar-eg'] = "الوجهة";
$text['label-destination']['de-at'] = "Ziel";
$text['label-destination']['de-ch'] = "Ziel";
@ -546,8 +546,8 @@ $text['label-codec']['zh-cn'] = "读/写编解码器";
$text['label-codec']['ja-jp'] = "読み取り/書き込みコーデック";
$text['label-codec']['ko-kr'] = "읽기/쓰기 코덱";
$text['label-cid-number']['en-us'] = "CID Number";
$text['label-cid-number']['en-gb'] = "CID Number";
$text['label-cid-number']['en-us'] = "Caller Number";
$text['label-cid-number']['en-gb'] = "Caller Number";
$text['label-cid-number']['ar-eg'] = "رقم CID";
$text['label-cid-number']['de-at'] = "Anrufer Nummer";
$text['label-cid-number']['de-ch'] = "Anrufer Nummer";
@ -572,8 +572,8 @@ $text['label-cid-number']['zh-cn'] = "来电号码";
$text['label-cid-number']['ja-jp'] = "CID番号";
$text['label-cid-number']['ko-kr'] = "CID 번호";
$text['label-cid-name']['en-us'] = "CID Name";
$text['label-cid-name']['en-gb'] = "CID Name";
$text['label-cid-name']['en-us'] = "Caller Name";
$text['label-cid-name']['en-gb'] = "Caller Name";
$text['label-cid-name']['ar-eg'] = "اسم CID";
$text['label-cid-name']['de-at'] = "Anrufer Name";
$text['label-cid-name']['de-ch'] = "Anrufer Name";
@ -650,6 +650,33 @@ $text['label-eavesdrop']['zh-cn'] = "窃听";
$text['label-eavesdrop']['ja-jp'] = "盗聴";
$text['label-eavesdrop']['ko-kr'] = "엿듣다";
$text['label-duration']['en-us'] = "Duration";
$text['label-duration']['en-gb'] = "Duration";
$text['label-duration']['ar-eg'] = "المدة";
$text['label-duration']['de-at'] = "Dauer";
$text['label-duration']['de-ch'] = "Dauer";
$text['label-duration']['de-de'] = "Dauer";
$text['label-duration']['el-gr'] = "Διάρκεια";
$text['label-duration']['es-cl'] = "Duración";
$text['label-duration']['es-mx'] = "Duración";
$text['label-duration']['fr-ca'] = "Durée";
$text['label-duration']['fr-fr'] = "Durée";
$text['label-duration']['he-il'] = "משך השיחה";
$text['label-duration']['it-it'] = "Durata";
$text['label-duration']['ka-ge'] = "ხანგრძლივობა";
$text['label-duration']['nl-nl'] = "Duur";
$text['label-duration']['pl-pl'] = "Czas trwania";
$text['label-duration']['pt-br'] = "Duração";
$text['label-duration']['pt-pt'] = "Duração";
$text['label-duration']['ro-ro'] = "Durată";
$text['label-duration']['ru-ru'] = "Продолжительность";
$text['label-duration']['sv-se'] = "Samtalstid";
$text['label-duration']['uk-ua'] = "Тривалість";
$text['label-duration']['tr-tr'] = "Süre";
$text['label-duration']['zh-cn'] = "期间";
$text['label-duration']['ja-jp'] = "間隔";
$text['label-duration']['ko-kr'] = "지속";
$text['description-2']['en-us'] = "Use this to view all extensions and monitor and interact with active calls.";
$text['description-2']['en-gb'] = "Use this to view all extensions and monitor and interact with active calls.";
$text['description-2']['ar-eg'] = "استخدم هذا لعرض جميع الملحقات ومراقبة المكالمات النشطة والتفاعل معها.";

View File

@ -88,10 +88,8 @@
}
$num_rows = @sizeof($rows);
//if the connnection is available then run it and return the results
if (!$event_socket) {
$msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
@ -103,172 +101,203 @@
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
return;
}
else {
//create token
$object = new token;
$token = $object->create('/app/calls_active/calls_active_inc.php');
//create token
$object = new token;
$token = $object->create('/app/calls_active/calls_active_inc.php');
//show content
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
echo " <div class='actions'>\n";
echo " <span id='refresh_state'>".button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'sync-alt fa-spin','onclick'=>'refresh_stop()'])."</span>";
if (permission_exists('call_active_eavesdrop') && !empty($_SESSION['user']['extensions'])) {
if (sizeof($_SESSION['user']['extensions']) > 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".(($_REQUEST['eavesdrop_dest'] == '') ? $_SESSION['user']['extension'][0]['destination'] : escape($_REQUEST['eavesdrop_dest']))."\">\n";
echo " <i class='fas fa-headphones' style='margin-left: 15px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle'></i>\n";
echo " <select class='formfld' style='margin-right: 5px;' align='absmiddle' onchange=\"document.getElementById('eavesdrop_dest').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();'>\n";
if (is_array($_SESSION['user']['extensions'])) {
foreach ($_SESSION['user']['extensions'] as $user_extension) {
echo " <option value='".escape($user_extension)."' ".(($_REQUEST['eavesdrop_dest'] == $user_extension) ? "selected" : null).">".escape($user_extension)."</option>\n";
}
//add the style
echo "<style>\n";
echo " /* Small screens: Hide columns with class 'hide-small' */\n";
echo " @media (max-width: 600px) {\n";
echo " .hide-small {\n";
echo " display: none;\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " /* Medium screens: Hide columns with class 'hide-medium' */\n";
echo "@media (max-width: 1023px) and (min-width: 601px) {\n";
echo " .hide-medium {\n";
echo " display: none;\n";
echo " }\n";
echo " }\n";
echo "\n";
echo "</style>\n";
//show the content
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
echo " <div class='actions'>\n";
echo " <span id='refresh_state'>".button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'sync-alt fa-spin','onclick'=>'refresh_stop()'])."</span>";
if (permission_exists('call_active_eavesdrop') && !empty($_SESSION['user']['extensions'])) {
if (sizeof($_SESSION['user']['extensions']) > 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".(($_REQUEST['eavesdrop_dest'] == '') ? $_SESSION['user']['extension'][0]['destination'] : escape($_REQUEST['eavesdrop_dest']))."\">\n";
echo " <i class='fas fa-headphones' style='margin-left: 15px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle'></i>\n";
echo " <select class='formfld' style='margin-right: 5px;' align='absmiddle' onchange=\"document.getElementById('eavesdrop_dest').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();'>\n";
if (is_array($_SESSION['user']['extensions'])) {
foreach ($_SESSION['user']['extensions'] as $user_extension) {
echo " <option value='".escape($user_extension)."' ".(($_REQUEST['eavesdrop_dest'] == $user_extension) ? "selected" : null).">".escape($user_extension)."</option>\n";
}
}
echo " </select>\n";
}
else if (sizeof($_SESSION['user']['extensions']) == 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".escape($_SESSION['user']['extension'][0]['destination'])."\">\n";
}
}
if (permission_exists('call_active_hangup') && $rows) {
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','id'=>'btn_delete','onclick'=>"refresh_stop(); modal_open('modal-hangup','btn_hangup');"]);
}
if (permission_exists('call_active_all')) {
if ($show == "all") {
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'calls_active.php','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'calls_active.php?show=all','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
}
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if (permission_exists('call_active_hangup') && $rows) {
echo modal::create(['id'=>'modal-hangup','type'=>'general','message'=>$text['confirm-hangups'],'actions'=>button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'check','id'=>'btn_hangup','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('hangup'); list_form_submit('form_list');"])]);
}
echo $text['description']."\n";
echo "<br /><br />\n";
//show the results
echo "<div id='cmd_reponse'></div>\n";
echo "<form id='form_list' method='post' action='calls_exec.php'>\n";
echo "<input type='hidden' id='action' name='action' value=''>\n";
echo "<div class='card'>\n";
echo " <table class='list'>\n";
echo " <tr class='list-header'>\n";
if (permission_exists('call_active_hangup')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='if (this.checked) { refresh_stop(); } else { refresh_start(); } list_all_toggle();' ".(empty($rows) ? "style='visibility: hidden;'" : null).">\n";
echo " </th>\n";
}
echo " <th class='hide-small'>".$text['label-profile']."</th>\n";
//echo" <th>".$text['label-created']."</th>\n";
echo " <th>".$text['label-duration']."</th>\n";
if ($show == 'all') {
echo " <th>".$text['label-domain']."</th>\n";
}
//echo " <th>".$text['label-number']."</th>\n";
echo " <th class='hide-small'>".$text['label-cid-name']."</th>\n";
echo " <th>".$text['label-cid-number']."</th>\n";
echo " <th>".$text['label-destination']."</th>\n";
echo " <th class='hide-small hide-medium'>".$text['label-app']."</th>\n";
echo " <th class='hide-small hide-medium'>".$text['label-codec']."</th>\n";
echo " <th class='hide-small hide-medium'>".$text['label-secure']."</th>\n";
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
echo " <th>&nbsp;</th>\n";
}
echo " </tr>\n";
if (is_array($rows)) {
$x = 0;
foreach ($rows as $row) {
//set the php variables
foreach ($row as $key => $value) {
$$key = $value;
}
//get the sip profile
$name_array = explode("/", $name);
$sip_profile = $name_array[1];
$sip_uri = $name_array[2];
//get the number
//$temp_array = explode("@", $sip_uri);
//$tmp_number = $temp_array[0];
//$tmp_number = str_replace("sip:", "", $tmp_number);
//remove the '+' because it breaks the call recording
$cid_num = str_replace("+", "", $cid_num);
//replace gateway uuid with name
if (is_array($_SESSION['gateways']) && sizeof($_SESSION['gateways']) > 0) {
foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) {
$application_data = str_replace($gateway_uuid, $gateway_name, $application_data);
}
echo " </select>\n";
}
else if (sizeof($_SESSION['user']['extensions']) == 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".escape($_SESSION['user']['extension'][0]['destination'])."\">\n";
//convert $created to a UNIX timestamp
$created_timestamp = strtotime($created);
//get the current timestamp
$now = time();
//calculate elapsed seconds
$elapsed_seconds = $now - $created_timestamp;
//convert seconds to hours, minutes, and seconds
$hours = floor($elapsed_seconds / 3600);
$minutes = floor(($elapsed_seconds % 3600) / 60);
$seconds = $elapsed_seconds % 60;
//format the elapsed time as HH:MM:SS
$elapsed_time = sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds);
//reduce too long app data
if(strlen($application_data) > 80) {
$application_data = substr($application_data, 0, 80) . '...';
}
}
if (permission_exists('call_active_hangup') && $rows) {
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','id'=>'btn_delete','onclick'=>"refresh_stop(); modal_open('modal-hangup','btn_hangup');"]);
}
if (permission_exists('call_active_all')) {
if ($show == "all") {
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'calls_active.php','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
//send the html
echo " <tr class='list-row'>\n";
if (permission_exists('call_active_hangup')) {
echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='calls[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (this.checked) { refresh_stop(); } else { document.getElementById('checkbox_all').checked = false; }\">\n";
echo " <input type='hidden' name='calls[$x][uuid]' value='".escape($uuid)."' />\n";
echo " </td>\n";
}
else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'calls_active.php?show=all','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
echo " <td class='hide-small'>".escape($sip_profile)."&nbsp;</td>\n";
//echo " <td>".escape($created)."&nbsp;</td>\n";
echo " <td>".escape($elapsed_time)."</td>\n";
if ($show == 'all') {
echo " <td>".escape($domain_name)."&nbsp;</td>\n";
}
}
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if (permission_exists('call_active_hangup') && $rows) {
echo modal::create(['id'=>'modal-hangup','type'=>'general','message'=>$text['confirm-hangups'],'actions'=>button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'check','id'=>'btn_hangup','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('hangup'); list_form_submit('form_list');"])]);
}
echo $text['description']."\n";
echo "<br /><br />\n";
//show the results
echo "<div id='cmd_reponse'></div>\n";
echo "<form id='form_list' method='post' action='calls_exec.php'>\n";
echo "<input type='hidden' id='action' name='action' value=''>\n";
echo "<div class='card'>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
if (permission_exists('call_active_hangup')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='if (this.checked) { refresh_stop(); } else { refresh_start(); } list_all_toggle();' ".(empty($rows) ? "style='visibility: hidden;'" : null).">\n";
echo " </th>\n";
}
echo " <th>".$text['label-profile']."</th>\n";
echo " <th>".$text['label-created']."</th>\n";
if ($show == 'all') {
echo " <th>".$text['label-domain']."</th>\n";
}
echo " <th>".$text['label-number']."</th>\n";
echo " <th>".$text['label-cid-name']."</th>\n";
echo " <th>".$text['label-cid-number']."</th>\n";
echo " <th>".$text['label-destination']."</th>\n";
echo " <th>".$text['label-app']."</th>\n";
echo " <th>".$text['label-codec']."</th>\n";
echo " <th>".$text['label-secure']."</th>\n";
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
echo " <th>&nbsp;</th>\n";
}
echo "</tr>\n";
if (is_array($rows)) {
$x = 0;
foreach ($rows as $row) {
//set the php variables
foreach ($row as $key => $value) {
$$key = $value;
}
//get the sip profile
$name_array = explode("/", $name);
$sip_profile = $name_array[1];
$sip_uri = $name_array[2];
//get the number
$temp_array = explode("@", $sip_uri);
$tmp_number = $temp_array[0];
$tmp_number = str_replace("sip:", "", $tmp_number);
//remove the '+' because it breaks the call recording
$cid_num = str_replace("+", "", $cid_num);
//replace gateway uuid with name
if (is_array($_SESSION['gateways']) && sizeof($_SESSION['gateways']) > 0) {
foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) {
$application_data = str_replace($gateway_uuid, $gateway_name, $application_data);
}
}
// reduce too long app data
if(strlen($application_data) > 512) {
$application_data = substr($application_data, 0, 512) . '...';
}
//send the html
echo "<tr class='list-row'>\n";
if (permission_exists('call_active_hangup')) {
echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='calls[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (this.checked) { refresh_stop(); } else { document.getElementById('checkbox_all').checked = false; }\">\n";
echo " <input type='hidden' name='calls[$x][uuid]' value='".escape($uuid)."' />\n";
echo " </td>\n";
}
echo " <td>".escape($sip_profile)."&nbsp;</td>\n";
echo " <td>".escape($created)."&nbsp;</td>\n";
if ($show == 'all') {
echo " <td>".escape($domain_name)."&nbsp;</td>\n";
}
echo " <td>".escape($tmp_number)."&nbsp;</td>\n";
echo " <td>".escape($cid_name)."&nbsp;</td>\n";
echo " <td>".escape($cid_num)."&nbsp;</td>\n";
echo " <td>".escape($dest)."&nbsp;</td>\n";
echo " <td>".(!empty($application) ? escape($application).":".escape($application_data) : null)."&nbsp;</td>\n";
echo " <td>".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)."&nbsp;</td>\n";
echo " <td>".escape($secure)."&nbsp;</td>\n";
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
echo " <td class='button right' style='padding-right: 0;'>\n";
//eavesdrop
if (permission_exists('call_active_eavesdrop') && $callstate == 'ACTIVE' && !empty($_SESSION['user']['extensions']) && !in_array($cid_num, $_SESSION['user']['extensions'])) {
echo button::create(['type'=>'button','label'=>$text['label-eavesdrop'],'icon'=>'headphones','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-eavesdrop']."')) { eavesdrop_call('".escape($cid_num)."','".escape($uuid)."'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
//hangup
if (permission_exists('call_active_hangup')) {
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-hangup']."')) { list_self_check('checkbox_".$x."'); list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
echo "</td>\n";
}
echo "</tr>\n";
//unset the domain name
unset($domain_name);
//increment counter
$x++;
//echo " <td>".escape($tmp_number)."&nbsp;</td>\n";
echo " <td class='hide-small'>".escape($cid_name)."&nbsp;</td>\n";
echo " <td>".escape($cid_num)."&nbsp;</td>\n";
echo " <td>".escape($dest)."&nbsp;</td>\n";
echo " <td class='hide-small hide-medium' style='max-width: 200px; word-wrap: break-word;'>".(!empty($application) ? escape($application).":".escape($application_data) : null)."&nbsp;</td>\n";
echo " <td class='hide-small hide-medium'>".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)."&nbsp;</td>\n";
echo " <td class='hide-small hide-medium'>".escape($secure)."&nbsp;</td>\n";
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
echo " <td class='button right' style='padding-right: 0;'>\n";
//eavesdrop
if (permission_exists('call_active_eavesdrop') && $callstate == 'ACTIVE' && !empty($_SESSION['user']['extensions']) && !in_array($cid_num, $_SESSION['user']['extensions'])) {
echo button::create(['type'=>'button','label'=>$text['label-eavesdrop'],'icon'=>'headphones','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-eavesdrop']."')) { eavesdrop_call('".escape($cid_num)."','".escape($uuid)."'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
//hangup
if (permission_exists('call_active_hangup')) {
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-hangup']."')) { list_self_check('checkbox_".$x."'); list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
echo " </td>\n";
}
unset($rows);
}
echo " </tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
//unset the domain name
unset($domain_name);
//increment counter
$x++;
}
}
echo " </table>\n";
echo "</div>\n";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
?>

View File

@ -167,6 +167,10 @@
$y++;
$apps[$x]['permissions'][$y]['name'] = "destination_local";
$y++;
$apps[$x]['permissions'][$y]['name'] = "destination_email";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
//default settings
$y = 0;
@ -397,6 +401,10 @@
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the description.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_email";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select whether to send email notifications of incoming SMS/MMS messages";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';

View File

@ -1162,6 +1162,33 @@ $text['label-destination_conditions']['zh-cn'] = "状况";
$text['label-destination_conditions']['ja-jp'] = "条件";
$text['label-destination_conditions']['ko-kr'] = "정황";
$text['label-destination_email']['en-us'] = "Email Notifications";
$text['label-destination_email']['en-gb'] = "Email Notifications";
$text['label-destination_email']['ar-eg'] = "إشعارات البريد الإلكتروني";
$text['label-destination_email']['de-at'] = "E-Mail-Benachrichtigungen";
$text['label-destination_email']['de-ch'] = "E-Mail-Benachrichtigungen";
$text['label-destination_email']['de-de'] = "E-Mail-Benachrichtigungen";
$text['label-destination_email']['el-gr'] = "Ειδοποιήσεις μέσω ηλεκτρονικού ταχυδρομείου";
$text['label-destination_email']['es-cl'] = "Notificaciones por correo electrónico";
$text['label-destination_email']['es-mx'] = "Notificaciones por correo electrónico";
$text['label-destination_email']['fr-ca'] = "Notifications par courriel";
$text['label-destination_email']['fr-fr'] = "Notifications par e-mail";
$text['label-destination_email']['he-il'] = "התראות דוא\"ל";
$text['label-destination_email']['it-it'] = "Notifiche via email";
$text['label-destination_email']['ka-ge'] = "ელ.ფოსტით შეტყობინებები";
$text['label-destination_email']['nl-nl'] = "E-mailmeldingen";
$text['label-destination_email']['pl-pl'] = "Powiadomienia e-mail";
$text['label-destination_email']['pt-br'] = "Notificações por e-mail";
$text['label-destination_email']['pt-pt'] = "Notificações por e-mail";
$text['label-destination_email']['ro-ro'] = "Notificări prin e-mail";
$text['label-destination_email']['ru-ru'] = "Уведомления по электронной почте";
$text['label-destination_email']['sv-se'] = "E-postmeddelanden";
$text['label-destination_email']['uk-ua'] = "Повідомлення електронною поштою";
$text['label-destination_email']['tr-tr'] = "E-posta Bildirimleri";
$text['label-destination_email']['zh-cn'] = "邮件通知";
$text['label-destination_email']['ja-jp'] = "メール通知";
$text['label-destination_email']['ko-kr'] = "이메일 알림";
$text['option-caller_id_number']['en-us'] = "Caller ID Number";
$text['option-caller_id_number']['en-gb'] = "Caller ID Number";
$text['option-caller_id_number']['ar-eg'] = "رقم المتصل";
@ -2352,6 +2379,33 @@ $text['description-usage']['zh-cn'] = "设置目的地的使用方式。";
$text['description-usage']['ja-jp'] = "宛先の使用方法を設定します。";
$text['description-usage']['ko-kr'] = "대상이 사용되는 방식을 설정합니다.";
$text['description-destination_email']['en-us'] = "Choose whether to send SMS and MMS messages to User's email";
$text['description-destination_email']['en-gb'] = "Choose whether to send SMS and MMS messages to User's email";
$text['description-destination_email']['ar-eg'] = "اختر ما إذا كنت ترغب في إرسال رسائل SMS و MMS إلى بريد المستخدم الإلكتروني";
$text['description-destination_email']['de-at'] = "Wählen Sie, ob SMS- und MMS-Nachrichten an die E-Mail des Benutzers gesendet werden sollen";
$text['description-destination_email']['de-ch'] = "Wählen Sie, ob SMS- und MMS-Nachrichten an die E-Mail des Benutzers gesendet werden sollen";
$text['description-destination_email']['de-de'] = "Wählen Sie, ob SMS- und MMS-Nachrichten an die E-Mail des Benutzers gesendet werden sollen";
$text['description-destination_email']['el-gr'] = "Επιλέξτε αν θέλετε να στείλετε μηνύματα SMS και MMS στο email του χρήστη";
$text['description-destination_email']['es-cl'] = "Elija si desea enviar mensajes SMS y MMS al correo electrónico del usuario";
$text['description-destination_email']['es-mx'] = "Elija si desea enviar mensajes SMS y MMS al correo electrónico del usuario";
$text['description-destination_email']['fr-ca'] = "Choisissez si vous souhaitez envoyer des messages SMS et MMS à l'email de l'utilisateur";
$text['description-destination_email']['fr-fr'] = "Choisissez si vous souhaitez envoyer des messages SMS et MMS à l'email de l'utilisateur";
$text['description-destination_email']['he-il'] = "בחר אם לשלוח הודעות SMS ו-MMS לדוא\"ל של המשתמש";
$text['description-destination_email']['it-it'] = "Scegli se inviare messaggi SMS e MMS all'email dell'utente";
$text['description-destination_email']['ka-ge'] = "აირჩიეთ, გსურთ თუ არა SMS და MMS შეტყობინებების გაგზავნა მომხმარებლის ელ.ფოსტაზე";
$text['description-destination_email']['nl-nl'] = "Kies of je SMS- en MMS-berichten naar de e-mail van de gebruiker wilt sturen";
$text['description-destination_email']['pl-pl'] = "Wybierz, czy chcesz wysłać wiadomości SMS i MMS na adres e-mail użytkownika";
$text['description-destination_email']['pt-br'] = "Escolha se deseja enviar mensagens SMS e MMS para o e-mail do usuário";
$text['description-destination_email']['pt-pt'] = "Escolha se deseja enviar mensagens SMS e MMS para o e-mail do usuário";
$text['description-destination_email']['ro-ro'] = "Alegeți dacă doriți să trimiteți mesaje SMS și MMS la adresa de e-mail a utilizatorului";
$text['description-destination_email']['ru-ru'] = "Выберите, хотите ли вы отправлять SMS и MMS сообщения на электронную почту пользователя";
$text['description-destination_email']['sv-se'] = "Välj om du vill skicka SMS- och MMS-meddelanden till användarens e-post";
$text['description-destination_email']['uk-ua'] = "Виберіть, чи хочете ви надсилати SMS і MMS повідомлення на електронну пошту користувача";
$text['description-destination_email']['tr-tr'] = "Kullanıcının e-posta adresine SMS ve MMS mesajları gönderilip gönderilmeyeceğini seçin";
$text['description-destination_email']['zh-cn'] = "选择是否将SMS和MMS消息发送到用户的电子邮件";
$text['description-destination_email']['ja-jp'] = "ユーザーのメールにSMSおよびMMSメッセージを送信するかどうかを選択してください";
$text['description-destination_email']['ko-kr'] = "사용자 이메일로 SMS 및 MMS 메시지를 보낼지 선택하세요";
$text['billing-warning']['en-us'] = "If you are using fusionpbx billing application, make sure to add accountcode and carrier variables.";
$text['billing-warning']['en-gb'] = "If you are using fusionpbx billing application, make sure to add accountcode and carrier variables.";
$text['billing-warning']['ar-eg'] = "إذا كنت تستخدم تطبيق فواتير الدمج، تأكد من إضافة رمز الحساب والمتغيرات الناقلة.";

View File

@ -130,6 +130,7 @@
$destination_type_text = $_POST["destination_type_text"] ?? null;
$destination_type_emergency = $_POST["destination_type_emergency"] ?? null;
$destination_carrier = $_POST["destination_carrier"] ?? null;
$destination_email = $_POST["destination_email"];
//sanitize the destination conditions
if (!empty($destination_conditions)) {
@ -314,6 +315,9 @@
if (!permission_exists('destination_domain')) {
$domain_uuid = $row["domain_uuid"] ?? null;
}
if (!permission_exists('destination_email')) {
$destination_email = $row["destination_email"] ?? null;
}
}
unset($row);
@ -1090,6 +1094,7 @@
$array['destinations'][$x]["destination_distinctive_ring"] = $destination_distinctive_ring;
}
$array['destinations'][$x]["destination_record"] = $destination_record;
$array['destinations'][$x]["destination_email"] = $destination_email;
if (!empty($destination_ringback) && $ringbacks->valid($destination_ringback)) {
$array['destinations'][$x]["destination_ringback"] = $destination_ringback;
}
@ -1270,6 +1275,7 @@
$destination_order = $destination_order ?? '';
$destination_enabled = $destination_enabled ?? '';
$destination_description = $destination_description ?? '';
$destination_email = $destination_email ?? '';
$select_style = $select_style ?? '';
//pre-populate the form
@ -1316,6 +1322,7 @@
$destination_order = $row["destination_order"];
$destination_enabled = $row["destination_enabled"];
$destination_description = $row["destination_description"];
$destination_email = $row["destination_email"];
}
unset($sql, $parameters, $row);
}
@ -1815,6 +1822,34 @@
echo "</tr>\n";
}
//destination email
if (permission_exists('destination_email') && permission_exists('message_view')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_email']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='destination_email'>\n";
echo " <option value=''></option>\n";
if (!empty($destination_email) && $destination_email == "true") {
echo " <option value='true' selected='selected'>".$text['option-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['option-true']."</option>\n";
}
if (!empty($destination_email) && $destination_email == "false") {
echo " <option value='false' selected='selected'>".$text['option-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['option-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-destination_email']."\n";
echo "</td>\n";
echo "</tr>\n";
}
//users
if (permission_exists('user_edit')) {
echo "<tr id='tr_user'>\n";

View File

@ -402,7 +402,7 @@ if (!class_exists('destinations')) {
}
}
//application: hangup
if (!empty($data['application'])) {
if (!empty($data['application']) && $data['application'] === 'hangup') {
$select_value = str_replace("transfer", $data['application'], $select_value);
}
}

3
app/email_queue/resources/jobs/email_queue.php Normal file → Executable file
View File

@ -138,9 +138,8 @@
//process the messages
if (is_array($email_queue) && @sizeof($email_queue) != 0) {
$which_php = exec('which php');
foreach($email_queue as $row) {
$command = $which_php." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php ";
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php ";
$command .= "'action=send&email_queue_uuid=".$row["email_queue_uuid"]."&hostname=".$hostname."'";
if (isset($debug)) {
//run process inline to see debug info

17
app/email_queue/resources/jobs/email_send.php Normal file → Executable file
View File

@ -49,12 +49,20 @@
//check to see if the process is running
if (file_exists($file)) {
$pid = file_get_contents($file);
if (posix_getsid($pid) === false) {
//process is not running
$exists = false;
if (function_exists('posix_getsid')) {
//check if the process is running
$pid = posix_getsid($pid);
if ($pid === null || $pid === 0) {
//process is not running
$exists = false;
}
else {
//process is running
$exists = true;
}
}
else {
//process is running
//file exists assume the pid is running
$exists = true;
}
}
@ -571,4 +579,3 @@
//fwrite($esl, $content);
//fclose($esl);

View File

@ -51,7 +51,7 @@
if (file_exists($file)) {
$pid = file_get_contents($file);
if (function_exists('posix_getsid')) {
if (posix_getsid($pid) === false) {
if (posix_getsid($pid) === false) {
//process is not running
$exists = false;
}
@ -95,12 +95,12 @@
}
//make sure the /var/run/fusionpbx directory exists
if (!file_exists('/var/run/fusionpbx')) {
$result = mkdir('/var/run/fusionpbx', 0777, true);
if (!$result) {
die('Failed to create /var/run/fusionpbx');
}
}
if (!file_exists('/var/run/fusionpbx')) {
$result = mkdir('/var/run/fusionpbx', 0777, true);
if (!$result) {
die('Failed to create /var/run/fusionpbx');
}
}
//create the process id file if the process doesn't exist
if (!$pid_exists) {
@ -152,7 +152,7 @@
//process the messages
if (is_array($email_queue) && @sizeof($email_queue) != 0) {
foreach($email_queue as $row) {
$command = exec('which php')." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php ";
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php ";
$command .= "'action=send&email_queue_uuid=".$row["email_queue_uuid"]."&hostname=".$hostname."'";
if (isset($debug)) {
//run process inline to see debug info
@ -162,7 +162,7 @@
}
else {
//starts process rapidly doesn't wait for previous process to finish (used for production)
$handle = popen($command." > /dev/null &", 'r');
$handle = popen($command." > /dev/null &", 'r');
echo "'$handle'; " . gettype($handle) . "\n";
$read = fread($handle, 2096);
echo $read;

View File

@ -1061,6 +1061,9 @@
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
//set the back button
$_SESSION['call_forward_back'] = $_SERVER['PHP_SELF'] . "?id=$extension_uuid";
//begin the page content
require_once "resources/header.php";
if ($action == "update") {

View File

@ -151,7 +151,7 @@
//process the messages
if (is_array($fax_queue) && @sizeof($fax_queue) != 0) {
foreach($fax_queue as $row) {
$command = exec('which php')." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php ";
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php ";
$command .= "'action=send&fax_queue_uuid=".$row["fax_queue_uuid"]."&hostname=".$hostname."&debug=true'";
if (isset($debug)) {
//run process inline to see debug info

View File

@ -181,7 +181,7 @@
//process the messages
if (is_array($fax_queue) && @sizeof($fax_queue) != 0) {
foreach($fax_queue as $row) {
$command = exec('which php')." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php ";
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php ";
$command .= "'action=send&fax_queue_uuid=".$row["fax_queue_uuid"]."&hostname=".$hostname."'";
if (isset($debug)) {
//run process inline to see debug info

View File

@ -228,7 +228,7 @@
$apps[$x]['default_settings'][$y]['default_setting_category'] = "provision";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "yealink_cid_source";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "2";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "4";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "The type of SIP header(s) to carry the caller ID; 0-FROM, 1-PAI 2-PAI-FROM (default), 3-PRID-PAI-FROM, 4-PAI-RPID-FROM, 5-RPID-FROM, 6-Preference";
$y++;

View File

@ -79,7 +79,7 @@ class authentication {
}
//check if contacts app exists
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/contacts/') ? true : false;
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/contacts/') ? true : false;
//use the authentication plugins
foreach ($_SESSION['authentication']['methods'] as $name) {

View File

@ -171,7 +171,7 @@ class plugin_database {
$user_authorized = false;
//check if contacts app exists
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/contacts/') ? true : false;
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/contacts/') ? true : false;
//check the username and password if they don't match then redirect to the login
$sql = "select ";

View File

@ -404,7 +404,7 @@ class plugin_email {
unset($_POST['authentication_code']);
//check if contacts app exists
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/contacts/') ? true : false;
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/contacts/') ? true : false;
//get the user details
if ($auth_valid) {
@ -522,4 +522,4 @@ class plugin_email {
}
}
?>
?>

View File

@ -328,7 +328,7 @@ class plugin_totp {
unset($_POST['authentication_code']);
//check if contacts app exists
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/contacts/') ? true : false;
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/contacts/') ? true : false;
//get the user details
if ($auth_valid) {
@ -440,4 +440,4 @@ class plugin_totp {
}
}
?>
?>

View File

@ -61,7 +61,7 @@ if ($_SESSION['contact_auth']['source'] == 'google') {
if (isset($_REQUEST['signout'])) {
unset($_SESSION['contact_auth']['token']);
message::add($text['message-google_signed_out']);
header("Location: https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue=".(($_SERVER["HTTPS"] == "on") ? "https" : "http")."://".$_SERVER['HTTP_HOST'].PROJECT_PATH."/app/contacts/".$_SESSION['contact_auth']['referer']);
header("Location: https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue=".(($_SERVER["HTTPS"] == "on") ? "https" : "http")."://".$_SERVER['HTTP_HOST'].PROJECT_PATH."/core/contacts/".$_SESSION['contact_auth']['referer']);
exit;
}
@ -117,4 +117,4 @@ else {
exit;
}
?>
?>

View File

@ -963,10 +963,10 @@
}
};
if (search) {
xhttp.open("GET", "/app/contacts/contact_json.php?search="+search, true);
xhttp.open("GET", "/core/contacts/contact_json.php?search="+search, true);
}
else {
xhttp.open("GET", "/app/contacts/contact_json.php", true);
xhttp.open("GET", "/core/contacts/contact_json.php", true);
}
xhttp.send();
}

View File

@ -241,10 +241,10 @@
}
};
if (search) {
xhttp.open("GET", "/app/contacts/contact_json.php?search="+search, true);
xhttp.open("GET", "/core/contacts/contact_json.php?search="+search, true);
}
else {
xhttp.open("GET", "/app/contacts/contact_json.php", true);
xhttp.open("GET", "/core/contacts/contact_json.php", true);
}
xhttp.send();
}

View File

@ -5,7 +5,7 @@ $array['dashboard'][$x]['dashboard_uuid'] = '3b0cbb2f-733d-4646-8332-7d108808f2f
$array['dashboard'][$x]['dashboard_name'] = 'Contacts';
$array['dashboard'][$x]['dashboard_path'] = 'dashboard/icon';
$array['dashboard'][$x]['dashboard_icon'] = 'fa-regular fa-address-card';
$array['dashboard'][$x]['dashboard_url'] = '/app/contacts/contacts.php';
$array['dashboard'][$x]['dashboard_url'] = '/core/contacts/contacts.php';
$array['dashboard'][$x]['dashboard_target'] = 'self';
$array['dashboard'][$x]['dashboard_width'] = '';
$array['dashboard'][$x]['dashboard_height'] = '';

View File

@ -1082,7 +1082,7 @@ if (!class_exists('menu')) {
$user_graphic = "<i class='".$this->settings->get('theme', 'body_header_icon_user', 'fa-solid fa-user-circle')."'></i>";
//overwrite user graphic with image from session, if exists
if ($this->settings->get('theme', 'body_header_user_image', true) == true && !empty($_SESSION['user']['contact_image']) && is_uuid($_SESSION['user']['contact_image'])) {
$user_graphic = "<span style=\"display: inline-block; vertical-align: middle; width: 15px; height: 15px; border-radius: 50%; margin-top: -2px; background-image: url('".PROJECT_PATH."/app/contacts/contact_attachment.php?id=".$_SESSION['user']['contact_image']."&action=download&sid=".session_id()."'); background-repeat: no-repeat; background-size: cover; background-position: center;\"></span>";
$user_graphic = "<span style=\"display: inline-block; vertical-align: middle; width: 15px; height: 15px; border-radius: 50%; margin-top: -2px; background-image: url('".PROJECT_PATH."/core/contacts/contact_attachment.php?id=".$_SESSION['user']['contact_image']."&action=download&sid=".session_id()."'); background-repeat: no-repeat; background-size: cover; background-position: center;\"></span>";
}
$html .= " <li class='nav-item'>\n";
$html .= " <a class='nav-link header_user d-block d-sm-none' href='show:usermenu' title=\"".$_SESSION['username']."\" style='border-top: 1px solid ".($this->settings->get('theme', 'menu_sub_background_color') ?? 'rgba(0,0,0,0.90)')."' data-toggle='collapse' data-target='#main_navbar' onclick=\"event.preventDefault(); $('#body_header_user_menu').toggleFadeSlide();\">".($user_graphic ?? null)."<span style='margin-left: 7px;'>".escape($_SESSION['username'])."</span></a>";
@ -1126,7 +1126,7 @@ if (!class_exists('menu')) {
$html .= "<div id='body_header_user_menu'>\n";
$html .= " <div class='row m-0'>\n";
if (!empty($_SESSION['user']['contact_image']) && is_uuid($_SESSION['user']['contact_image'])) {
$html .= " <div class='col-5 col-sm-6 p-0' style=\"min-width: 130px; background-image: url('".PROJECT_PATH."/app/contacts/contact_attachment.php?id=".$_SESSION['user']['contact_image']."&action=download&sid=".session_id()."'); background-repeat: no-repeat; background-size: cover; background-position: center;\"></div>\n";
$html .= " <div class='col-5 col-sm-6 p-0' style=\"min-width: 130px; background-image: url('".PROJECT_PATH."/core/contacts/contact_attachment.php?id=".$_SESSION['user']['contact_image']."&action=download&sid=".session_id()."'); background-repeat: no-repeat; background-size: cover; background-position: center;\"></div>\n";
}
else {
$html .= " <div class='col-5 col-sm-6 p-0 pt-1' style=\"min-width: 130px; cursor: help;\" title=\"".$this->text['label-primary-contact-attachment-image']."\"><i class='fa-solid fa-user-circle fa-8x' style='opacity: 0.1;'></i></div>\n";
@ -1165,30 +1165,29 @@ if (!class_exists('menu')) {
public function menu_vertical($menu_array) {
//set defaults
$menu_side_state = $this->settings->get('theme', 'menu_side_state', 'contracted');
$menu_side_state_style = $menu_side_state !== 'expanded' ? 'display: none;' : '';
$menu_side_state_class = $menu_side_state !== 'hidden' ? 'hide-sm-up ' : '';
//menu brand image and/or text
$html = " <div id='menu_side_control_container'>\n";
$html .= " <div class='menu_side_control_state' style='float: right; $menu_side_state_style'>\n";
$html .= " <div class='menu_side_control_state' style='float: right; ".($menu_side_state != 'expanded' ? "display: none;" : null)."'>\n";
if ($this->settings->get('theme', 'menu_brand_type') != 'none') {
$html .= " <a class='menu_side_item_main menu_side_contract' onclick='menu_side_contract();' style='height: 60px; padding: 19px 16px 8px 16px !important; $menu_side_state_style'><i class='fa-solid fa-bars fa-fw'></i></a>";
$html .= " <a class='menu_side_item_main menu_side_contract' onclick='menu_side_contract();' style='height: 60px; padding: 19px 16px 8px 16px !important; ".($menu_side_state != 'expanded' ? "display: none;" : null)."'><i class='fa-solid fa-bars fa-fw'></i></a>";
}
$html .= " </div>\n";
$menu_brand_text = escape($this->settings->get('theme', 'menu_brand_text', 'FusionPBX'));
switch ($this->settings->get('theme', 'menu_brand_type', '')) {
case 'none':
$html .= "<a class='menu_side_item_main menu_side_contract' onclick='menu_side_contract();' style='$menu_side_state_style height: 60px; min-width: ".intval($this->settings->get('theme', 'menu_side_width_contracted', 60))."px;' title=\"".$this->text['theme-label-contract_menu']."\"><i class='fa-solid fa-bars fa-fw' style='z-index: 99800; padding-left: 1px; padding-top: 11px;'></i></a>";
$html .= "<a class='menu_side_item_main menu_side_expand' onclick='menu_side_expand();' style='$menu_side_state_style height: 60px;' title=\"".$this->text['theme-label-expand_menu']."\"><i class='fa-solid fa-bars fa-fw' style='z-index: 99800; padding-left: 1px; padding-top: 11px;'></i></a>";
$html .= "<a class='menu_side_item_main menu_side_contract' onclick='menu_side_contract();' style='".($menu_side_state != 'expanded' ? "display: none;" : null)." height: 60px; min-width: ".intval($this->settings->get('theme', 'menu_side_width_contracted', 60))."px;' title=\"".$this->text['theme-label-contract_menu']."\"><i class='fa-solid fa-bars fa-fw' style='z-index: 99800; padding-left: 1px; padding-top: 11px;'></i></a>";
$html .= "<a class='menu_side_item_main menu_side_expand' onclick='menu_side_expand();' style='".($menu_side_state == 'expanded' ? "display: none;" : null)." height: 60px;' title=\"".$this->text['theme-label-expand_menu']."\"><i class='fa-solid fa-bars fa-fw' style='z-index: 99800; padding-left: 1px; padding-top: 11px;'></i></a>";
break;
case 'text':
$html .= "<a class='menu_brand_text' style='$menu_side_state_style' href='".PROJECT_PATH."/'>".escape($menu_brand_text)."</a>\n";
$html .= "<a class='menu_side_item_main menu_side_expand' style='height: 60px; padding-top: 19px; $menu_side_state_style' onclick='menu_side_expand();' title=\"".$this->text['theme-label-expand_menu']."\"><i class='fa-solid fa-bars fa-fw' style='z-index: 99800; padding-left: 1px;'></i></a>";
$html .= "<a class='menu_brand_text' style='".($menu_side_state != 'expanded' ? "display: none;" : null)."' href='".PROJECT_PATH."/'>".escape($menu_brand_text)."</a>\n";
$html .= "<a class='menu_side_item_main menu_side_expand' style='height: 60px; padding-top: 19px; ".($menu_side_state == 'expanded' ? "display: none;" : null)."' onclick='menu_side_expand();' title=\"".$this->text['theme-label-expand_menu']."\"><i class='fa-solid fa-bars fa-fw' style='z-index: 99800; padding-left: 1px;'></i></a>";
break;
case 'image_text':
$menu_brand_image_contracted = $this->settings->get('theme', 'menu_side_brand_image_contracted', PROJECT_PATH.'/themes/default/images/logo_side_contracted.png');
$html .= "<a class='menu_brand_image' href='".PROJECT_PATH."/'>";
$html .= "<img id='menu_brand_image_contracted' style='$menu_side_state_style' src='".escape($menu_brand_image_contracted)."' title=\"".escape($menu_brand_text)."\">";
$html .= "<span id='menu_brand_image_expanded' class='menu_brand_text' style='$menu_side_state_style'>".escape($menu_brand_text)."</span>";
$html .= "<img id='menu_brand_image_contracted' style='".($menu_side_state == 'expanded' ? "display: none;" : null)."' src='".escape($menu_brand_image_contracted)."' title=\"".escape($menu_brand_text)."\">";
$html .= "<span id='menu_brand_image_expanded' class='menu_brand_text' style='".($menu_side_state != 'expanded' ? "display: none;" : null)."'>".escape($menu_brand_text)."</span>";
$html .= "</a>\n";
break;
case 'image':
@ -1196,8 +1195,8 @@ if (!class_exists('menu')) {
$menu_brand_image_contracted = $this->settings->get('theme', 'menu_side_brand_image_contracted', PROJECT_PATH.'/themes/default/images/logo_side_contracted.png');
$menu_brand_image_expanded = $this->settings->get('theme', 'menu_side_brand_image_expanded', PROJECT_PATH.'/themes/default/images/logo_side_expanded.png');
$html .= "<a class='menu_brand_image' href='".PROJECT_PATH."/'>";
$html .= "<img id='menu_brand_image_contracted' style='$menu_side_state_style' src='".escape($menu_brand_image_contracted)."' title=\"".escape($menu_brand_text)."\">";
$html .= "<img id='menu_brand_image_expanded' style='$menu_side_state_style' src='".escape($menu_brand_image_expanded)."' title=\"".escape($menu_brand_text)."\">";
$html .= "<img id='menu_brand_image_contracted' style='".($menu_side_state == 'expanded' ? "display: none;" : null)."' src='".escape($menu_brand_image_contracted)."' title=\"".escape($menu_brand_text)."\">";
$html .= "<img id='menu_brand_image_expanded' style='".($menu_side_state != 'expanded' ? "display: none;" : null)."' src='".escape($menu_brand_image_expanded)."' title=\"".escape($menu_brand_text)."\">";
$html .= "</a>\n";
break;
}
@ -1208,12 +1207,12 @@ if (!class_exists('menu')) {
$menu_target = ($menu_item_main['menu_item_category'] == 'external') ? '_blank' : '';
$html .= " <a class='menu_side_item_main' ".(!empty($menu_item_main['menu_item_link']) ? "href='".$menu_item_main['menu_item_link']."' target='".$menu_target."'" : "onclick=\"menu_side_expand(); menu_side_item_toggle('".$menu_item_main['menu_item_uuid']."');\"")." title=\"".$menu_item_main['menu_language_title']."\">";
if (is_array($menu_item_main['menu_items']) && sizeof($menu_item_main['menu_items']) != 0 && $this->settings->get('theme', 'menu_side_item_main_sub_icons', true) === true) {
$html .= " <div class='menu_side_item_main_sub_icons' style='float: right; margin-right: -1px; $menu_side_state_style'><i id='sub_arrow_".$menu_item_main['menu_item_uuid']."' class='sub_arrows ".$this->settings->get('theme', 'menu_side_item_main_sub_icon_expand', 'fa-solid fa-chevron-down')." fa-xs'></i></div>\n";
$html .= " <div class='menu_side_item_main_sub_icons' style='float: right; margin-right: -1px; ".($menu_side_state != 'expanded' ? "display: none;" : null)."'><i id='sub_arrow_".$menu_item_main['menu_item_uuid']."' class='sub_arrows ".$this->settings->get('theme', 'menu_side_item_main_sub_icon_expand', 'fa-solid fa-chevron-down')." fa-xs'></i></div>\n";
}
if (!empty($menu_item_main['menu_item_icon']) && substr($menu_item_main['menu_item_icon'], 0, 3) == 'fa-') { // font awesome icon
$html .= "<i class='menu_side_item_icon ".$menu_item_main['menu_item_icon']." fa-fw' style='z-index: 99800; margin-right: 8px;'></i>";
}
$html .= "<span class='menu_side_item_title' style='$menu_side_state_style'>".$menu_item_main['menu_language_title']."</span>";
$html .= "<span class='menu_side_item_title' style='".($menu_side_state != 'expanded' ? "display: none;" : null)."'>".$menu_item_main['menu_language_title']."</span>";
$html .= "</a>\n";
//sub menu items
if (is_array($menu_item_main['menu_items']) && sizeof($menu_item_main['menu_items']) != 0) {
@ -1229,7 +1228,7 @@ if (!class_exists('menu')) {
}
}
$html .= " <a class='menu_side_item_sub' ".($menu_item_sub['menu_item_category'] == 'external' ? "target='_blank'" : null)." href='".$menu_item_sub['menu_item_link']."'>";
$html .= "<span class='menu_side_item_title' style='$menu_side_state_style'>".$menu_item_sub['menu_language_title']."</span>";
$html .= "<span class='menu_side_item_title' style='".($menu_side_state != 'expanded' ? "display: none;" : null)."'>".$menu_item_sub['menu_language_title']."</span>";
$html .= $menu_sub_icon."</a>\n";
}
$html .= " </div>\n";
@ -1259,7 +1258,7 @@ if (!class_exists('menu')) {
$html .= "<div id='body_header_user_menu'>\n";
$html .= " <div class='row m-0'>\n";
if (!empty($_SESSION['user']['contact_image']) && is_uuid($_SESSION['user']['contact_image'])) {
$html .= " <div class='col-5 col-sm-6 p-0' style=\"min-width: 130px; background-image: url('".PROJECT_PATH."/app/contacts/contact_attachment.php?id=".$_SESSION['user']['contact_image']."&action=download&sid=".session_id()."'); background-repeat: no-repeat; background-size: cover; background-position: center;\"></div>\n";
$html .= " <div class='col-5 col-sm-6 p-0' style=\"min-width: 130px; background-image: url('".PROJECT_PATH."/core/contacts/contact_attachment.php?id=".$_SESSION['user']['contact_image']."&action=download&sid=".session_id()."'); background-repeat: no-repeat; background-size: cover; background-position: center;\"></div>\n";
}
else {
$html .= " <div class='col-5 col-sm-6 p-0 pt-1' style=\"min-width: 130px; cursor: help;\" title=\"".$this->text['label-primary-contact-attachment-image']."\"><i class='fa-solid fa-user-circle fa-8x' style='opacity: 0.1;'></i></div>\n";
@ -1308,7 +1307,7 @@ if (!class_exists('menu')) {
//overwrite user graphic with image from session, if exists
if ($this->settings->get('theme', 'body_header_user_image', true) === true && !empty($_SESSION['user']['contact_image']) && is_uuid($_SESSION['user']['contact_image'])) {
$user_graphic_size = str_replace(['px','%'], '', intval($this->settings->get('theme', 'body_header_user_image_size', 18)));
$user_graphic = "<span style=\"display: inline-block; vertical-align: middle; width: ".$user_graphic_size."px; height: ".$user_graphic_size."px; border-radius: 50%; margin-right: 7px; margin-top: ".($user_graphic_size > 18 ? '-'.(ceil(($user_graphic_size - 18) / 2) - 4) : '-4')."px; background-image: url('".PROJECT_PATH."/app/contacts/contact_attachment.php?id=".$_SESSION['user']['contact_image']."&action=download&sid=".session_id()."'); background-repeat: no-repeat; background-size: cover; background-position: center;\"></span>";
$user_graphic = "<span style=\"display: inline-block; vertical-align: middle; width: ".$user_graphic_size."px; height: ".$user_graphic_size."px; border-radius: 50%; margin-right: 7px; margin-top: ".($user_graphic_size > 18 ? '-'.(ceil(($user_graphic_size - 18) / 2) - 4) : '-4')."px; background-image: url('".PROJECT_PATH."/core/contacts/contact_attachment.php?id=".$_SESSION['user']['contact_image']."&action=download&sid=".session_id()."'); background-repeat: no-repeat; background-size: cover; background-position: center;\"></span>";
}
$html .= "<span style='display: inline-block; padding-right: 20px; font-size: 90%;'>\n";
$html .= " <a href='show:usermenu' title=\"".$_SESSION['username']."\" onclick=\"event.preventDefault(); $('#body_header_user_menu').toggleFadeSlide();\">".($user_graphic ?? null)."<span class='d-none d-sm-inline'>".escape($_SESSION['username'])."</span></a>";