diff --git a/app/fax/app_config.php b/app/fax/app_config.php index 0eee20c45c..ce51680e56 100644 --- a/app/fax/app_config.php +++ b/app/fax/app_config.php @@ -217,6 +217,51 @@ $apps[$x]['permissions'][$y]['groups'][] = "admin"; $apps[$x]['permissions'][$y]['groups'][] = "user"; $apps[$x]['permissions'][$y]['groups'][] = "fax"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "fax_extension"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $apps[$x]['permissions'][$y]['groups'][] = "fax"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "fax_accountcode"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $apps[$x]['permissions'][$y]['groups'][] = "fax"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "fax_destination_number"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $apps[$x]['permissions'][$y]['groups'][] = "fax"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "fax_prefix"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $apps[$x]['permissions'][$y]['groups'][] = "fax"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "fax_caller_id_name"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $apps[$x]['permissions'][$y]['groups'][] = "fax"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "fax_caller_id_number"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $apps[$x]['permissions'][$y]['groups'][] = "fax"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "fax_forward_number"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $apps[$x]['permissions'][$y]['groups'][] = "fax"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "fax_toll_allow"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $apps[$x]['permissions'][$y]['groups'][] = "fax"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "fax_send_channels"; + //$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + //$apps[$x]['permissions'][$y]['groups'][] = "admin"; + //$apps[$x]['permissions'][$y]['groups'][] = "fax"; //default settings $y=0; diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index c669bb30a0..0a999e3b99 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.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) 2008-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2024 the Initial Developer. All Rights Reserved. Contributor(s): @@ -118,7 +118,7 @@ $fax_accountcode = $_POST["accountcode"]; $fax_destination_number = $_POST["fax_destination_number"]; $fax_prefix = $_POST["fax_prefix"]; - $fax_email = implode(',',array_filter($_POST["fax_email"])); + $fax_email = implode(',',array_filter($_POST["fax_email"] ?? [])); $fax_email_connection_type = $_POST["fax_email_connection_type"]; $fax_email_connection_host = $_POST["fax_email_connection_host"]; $fax_email_connection_port = $_POST["fax_email_connection_port"]; @@ -222,9 +222,9 @@ clearstatcache(); //process the data - if (count($_POST) > 0 && empty($_POST["persistformvar"])) { + if (!empty($_POST) && empty($_POST["persistformvar"])) { - $msg = ''; + //get the fax_uuid if ($action == "update" && is_uuid($_POST["fax_uuid"]) && permission_exists('fax_extension_edit')) { $fax_uuid = $_POST["fax_uuid"]; } @@ -238,7 +238,8 @@ } //check for all required data - if (empty($fax_extension)) { $msg .= "".$text['confirm-ext']."
\n"; } + $msg = ''; + if (permission_exists('fax_extension') && empty($fax_extension)) { $msg .= "".$text['confirm-ext']."
\n"; } if (empty($fax_name)) { $msg .= "".$text['confirm-fax']."
\n"; } if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; @@ -267,8 +268,8 @@ if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { $php_bin = 'php.exe'; } - elseif (file_exists(PHP_BINDIR."/php5")) { - $php_bin = 'php5'; + elseif (file_exists(PHP_BINDIR."/php5")) { + $php_bin = 'php5'; } else { $php_bin = 'php'; @@ -316,12 +317,22 @@ if (is_array($array) && @sizeof($array) != 0) { //add common columns to array $array['fax'][0]['domain_uuid'] = $_SESSION['domain_uuid']; - $array['fax'][0]['fax_extension'] = $fax_extension; - $array['fax'][0]['accountcode'] = $fax_accountcode; - $array['fax'][0]['fax_destination_number'] = $fax_destination_number; - $array['fax'][0]['fax_prefix'] = $fax_prefix; + if (permission_exists('fax_extension')) { + $array['fax'][0]['fax_extension'] = $fax_extension; + } + if (permission_exists('fax_accountcode')) { + $array['fax'][0]['accountcode'] = $fax_accountcode; + } + if (permission_exists('fax_destination_number')) { + $array['fax'][0]['fax_destination_number'] = $fax_destination_number; + } + if (permission_exists('fax_prefix')) { + $array['fax'][0]['fax_prefix'] = $fax_prefix; + } $array['fax'][0]['fax_name'] = $fax_name; - $array['fax'][0]['fax_email'] = $fax_email; + if (permission_exists('fax_email')) { + $array['fax'][0]['fax_email'] = $fax_email; + } if (permission_exists('fax_extension_advanced') && function_exists("imap_open") && file_exists("fax_files_remote.php")) { $array['fax'][0]['fax_email_connection_type'] = $fax_email_connection_type; $array['fax'][0]['fax_email_connection_host'] = $fax_email_connection_host; @@ -335,16 +346,26 @@ $array['fax'][0]['fax_email_outbound_subject_tag'] = $fax_email_outbound_subject_tag; $array['fax'][0]['fax_email_outbound_authorized_senders'] = $fax_email_outbound_authorized_senders; } - $array['fax'][0]['fax_caller_id_name'] = $fax_caller_id_name; - $array['fax'][0]['fax_caller_id_number'] = $fax_caller_id_number; - $array['fax'][0]['fax_toll_allow'] = $fax_toll_allow; - if ($action == "add" && !empty($fax_forward_number)) { - $array['fax'][0]['fax_forward_number'] = $fax_forward_number; + if (permission_exists('fax_caller_id_name')) { + $array['fax'][0]['fax_caller_id_name'] = $fax_caller_id_name; } - if ($action == "update") { - $array['fax'][0]['fax_forward_number'] = !empty($fax_forward_number) ? $fax_forward_number : null; + if (permission_exists('fax_caller_id_number')) { + $array['fax'][0]['fax_caller_id_number'] = $fax_caller_id_number; + } + if (permission_exists('fax_toll_allow')) { + $array['fax'][0]['fax_toll_allow'] = $fax_toll_allow; + } + if (permission_exists('fax_forward_number')) { + if ($action == "add" && !empty($fax_forward_number)) { + $array['fax'][0]['fax_forward_number'] = $fax_forward_number; + } + if ($action == "update") { + $array['fax'][0]['fax_forward_number'] = !empty($fax_forward_number) ? $fax_forward_number : null; + } + } + if (permission_exists('fax_send_channels')) { + $array['fax'][0]['fax_send_channels'] = strlen($fax_send_channels) != 0 ? $fax_send_channels : null; } - $array['fax'][0]['fax_send_channels'] = strlen($fax_send_channels) != 0 ? $fax_send_channels : null; $array['fax'][0]['fax_description'] = $fax_description; //execute @@ -512,9 +533,17 @@ echo "
\n"; echo "
".$text['header-fax_server_settings']."
\n"; echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'fax.php']); if ($action == "update") { $button_margin = 'margin-left: 15px;'; + if (permission_exists('fax_extension_advanced')) { + $button_margin = 'margin-left: 15px;'; + if (function_exists("imap_open") && file_exists("fax_files_remote.php")) { + echo button::create(['type'=>'button','label'=>$text['button-advanced'],'icon'=>'tools','style'=>($button_margin ?? null),'onclick'=>"toggle_advanced('advanced_email_connection');"]); + } + unset($button_margin); + } if (permission_exists('fax_extension_copy')) { echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'name'=>'btn_copy','style'=>($button_margin ?? null),'onclick'=>"modal_open('modal-copy','btn_copy');"]); unset($button_margin); @@ -524,6 +553,7 @@ unset($button_margin); } } + echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;']); echo "
\n"; echo "
\n"; @@ -539,34 +569,18 @@ } echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; - if (!permission_exists('fax_extension_delete')) { - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - } - else { //admin, superadmin, etc - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - + if (permission_exists('fax_extension')) { echo "\n"; echo "\n"; echo "\n"; + } + if (permission_exists('fax_accountcode')) { echo "\n"; echo "\n"; echo "\n"; + } + if (permission_exists('fax_destination_number')) { echo "\n"; echo "\n"; echo "\n"; + } + if (permission_exists('fax_prefix')) { echo "\n"; echo "\n"; echo "\n"; + } + if (permission_exists('fax_email')) { echo "\n"; echo "\n"; echo "
\n"; + echo " ".$text['label-name']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "".$text['description-name']."\n"; + echo "
\n"; - echo " ".$text['label-email']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['description-email']."\n"; - echo "
\n"; - echo " ".$text['label-name']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo "".$text['description-name']."\n"; - echo "
\n"; echo " ".$text['label-extension']."\n"; @@ -577,7 +591,9 @@ echo "".$text['description-extension']."\n"; echo "
\n"; echo " ".$text['label-accountcode']."\n"; @@ -589,7 +605,9 @@ echo $text['description-accountcode']."\n"; echo "
\n"; echo " ".$text['label-destination-number']."\n"; @@ -600,7 +618,9 @@ echo " ".$text['description-destination-number']."\n"; echo "
\n"; echo " ".$text['label-fax_prefix']."\n"; @@ -611,7 +631,9 @@ echo " ".$text['description-fax_prefix']."\n"; echo "
\n"; echo " ".$text['label-email']."\n"; @@ -631,15 +653,13 @@ echo " \n"; echo "
\n"; - echo " ".$text['description-email']."\n"; - if (permission_exists('fax_extension_advanced') && function_exists("imap_open") && file_exists("fax_files_remote.php")) { - echo "

\n"; - echo button::create(['type'=>'button','label'=>$text['button-advanced'],'icon'=>'tools','onclick'=>"toggle_advanced('advanced_email_connection');"]); - } echo "
\n"; + echo " ".$text['description-email']."\n"; echo "\n"; echo "\n"; + } + if (permission_exists('fax_caller_id_name')) { echo "\n"; echo "\n"; echo " ".$text['label-caller-id-name']."\n"; @@ -650,7 +670,9 @@ echo "".$text['description-caller-id-name']."\n"; echo "\n"; echo "\n"; + } + if (permission_exists('fax_caller_id_number')) { echo "\n"; echo "\n"; echo " ".$text['label-caller-id-number']."\n"; @@ -661,7 +683,9 @@ echo "".$text['description-caller-id-number']."\n"; echo "\n"; echo "\n"; + } + if (permission_exists('fax_forward_number')) { echo "\n"; echo "\n"; echo " ".$text['label-forward']."\n"; @@ -672,7 +696,9 @@ echo "".$text['description-forward-number']."\n"; echo "\n"; echo "\n"; - + } + + if (permission_exists('fax_toll_allow')) { echo "\n"; echo "\n"; echo " ".$text['label-toll_allow']."\n"; @@ -683,45 +709,47 @@ echo "".$text['description-toll_allow']."\n"; echo "\n"; echo "\n"; + } - if (permission_exists('fax_user_view')) { - if ($action == "update") { - echo " "; - echo " ".$text['label-user-list'].""; - echo " "; + if (permission_exists('fax_user_view')) { + if ($action == "update") { + echo " "; + echo " ".$text['label-user-list'].""; + echo " "; - if (!empty($fax_users) && is_array($fax_users) && @sizeof($fax_users) != 0) { - echo " \n"; - foreach ($fax_users as $field) { - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - } - echo "
".escape($field['username'])."\n"; - echo " $v_link_label_delete\n"; - echo "
\n"; - echo "
\n"; + if (!empty($fax_users) && is_array($fax_users) && @sizeof($fax_users) != 0) { + echo " \n"; + foreach ($fax_users as $field) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; } - unset($fax_users); - if (!empty($available_users) && is_array($available_users) && @sizeof($available_users) != 0) { - echo " "; - echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]); - echo "
\n"; - echo " ".$text['description-user-add']."\n"; - echo "
\n"; - unset($available_users); - } - echo " "; - echo " "; + echo "
".escape($field['username'])."\n"; + echo " $v_link_label_delete\n"; + echo "
\n"; + echo "
\n"; } + unset($fax_users); + if (!empty($available_users) && is_array($available_users) && @sizeof($available_users) != 0) { + echo " "; + echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]); + echo "
\n"; + echo " ".$text['description-user-add']."\n"; + echo "
\n"; + unset($available_users); + } + echo " "; + echo " "; } + } + if (permission_exists('fax_send_channels')) { echo "\n"; echo "\n"; echo " ".$text['label-fax_send_channels']."\n"; @@ -732,32 +760,23 @@ echo " ".$text['description-fax_send_channels']."\n"; echo "\n"; echo "\n"; - - echo "\n"; - echo "\n"; - echo " ".$text['label-description']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo "".$text['description-info']."\n"; - echo "\n"; - echo "\n"; } + echo "\n"; + echo "\n"; + echo " ".$text['label-description']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "".$text['description-info']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; echo " \n"; echo "
"; if ($action == "update") { - if (!permission_exists('fax_extension_delete')) { - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - } echo " \n"; echo " \n"; } @@ -974,4 +993,5 @@ //show the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> +