diff --git a/app/fax/app_languages.php b/app/fax/app_languages.php index 3c0b67caeb..d99820ca23 100644 --- a/app/fax/app_languages.php +++ b/app/fax/app_languages.php @@ -81,7 +81,7 @@ $text['title-inbox']['ru-ru'] = "Входящий"; $text['title-inbox']['sv-se'] = "Inbox"; $text['title-inbox']['uk-ua'] = ""; -$text['title-sent_faxes']['en-us'] = "Sent Faxes"; +$text['title-sent_faxes']['en-us'] = "Sent"; $text['title-sent_faxes']['ar-eg'] = ""; $text['title-sent_faxes']['de-at'] = "Gesendete Faxe"; //copied from de-de $text['title-sent_faxes']['de-ch'] = "Gesendete Faxe"; //copied from de-de @@ -2061,7 +2061,7 @@ $text['label-copy']['ru-ru'] = "Copy"; $text['label-copy']['sv-se'] = "Copy"; $text['label-copy']['uk-ua'] = "Copy"; -$text['header-sent_faxes']['en-us'] = "Sent Faxes"; +$text['header-sent_faxes']['en-us'] = "Sent"; $text['header-sent_faxes']['ar-eg'] = ""; $text['header-sent_faxes']['de-at'] = "Gesendete Faxe"; //copied from de-de $text['header-sent_faxes']['de-ch'] = "Gesendete Faxe"; //copied from de-de diff --git a/app/fax/fax.php b/app/fax/fax.php index d3e6a39c0c..83aa6f2327 100644 --- a/app/fax/fax.php +++ b/app/fax/fax.php @@ -227,7 +227,7 @@ echo " ".$text['label-sent']."  "; } if (permission_exists('fax_log_view')) { - echo " ".$text['label-log'].""; + echo " ".$text['label-log'].""; } if (permission_exists('fax_active_view') && isset($_SESSION['fax']['send_mode']['text']) && $_SESSION['fax']['send_mode']['text'] == 'queue') { echo " ".$text['label-active'].""; diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index 359f790c1c..235ea5b2c8 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -87,6 +87,31 @@ //get the http post values and set them as php variables if (count($_POST) > 0) { + + //process the http post data by submitted action + if ($_POST['action'] != '' && is_uuid($fax_uuid)) { + $array[0]['checked'] = 'true'; + $array[0]['uuid'] = $fax_uuid; + + switch ($_POST['action']) { + case 'copy': + if (permission_exists('fax_extension_copy')) { + $obj = new fax; + $obj->copy($array); + } + break; + case 'delete': + if (permission_exists('fax_extension_delete')) { + $obj = new fax; + $obj->delete($array); + } + break; + } + + header('Location: fax.php'); + exit; + } + //set the variables $fax_name = $_POST["fax_name"]; $fax_extension = $_POST["fax_extension"]; @@ -462,7 +487,7 @@ echo " function toggle_advanced(advanced_id) {\n"; echo " $('#'+advanced_id).toggle();\n"; echo " if ($('#'+advanced_id).is(':visible')) {\n"; - echo " $('#page').animate({scrollTop: $('#'+advanced_id).offset().top - 80}, 'slow');\n"; + echo " $('html, body').animate({scrollTop: $('#'+advanced_id).offset().top - 80}, 'slow');\n"; echo " }\n"; echo " }\n"; echo " function add_sender() {\n"; @@ -472,28 +497,36 @@ echo " }\n"; echo "\n"; -//fax extension form - echo "
\n"; +//show the content + echo "\n"; + + 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'],'link'=>'fax.php']); + $button_margin = 'margin-left: 15px;'; + if (permission_exists('fax_extension_copy') && $action == "update") { + echo button::create(['type'=>'submit','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'name'=>'action','value'=>'copy','style'=>$button_margin,'onclick'=>"if (!confirm('".$text['confirm-copy']."')) { this.blur(); return false; }"]); + unset($button_margin); + } + if (permission_exists('fax_extension_delete') && $action == "update") { + echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'action','value'=>'delete','style'=>$button_margin,'onclick'=>"if (!confirm('".$text['confirm-delete']."')) { this.blur(); return false; }"]); + unset($button_margin); + } + echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;']); + echo "
\n"; + echo "
\n"; + echo "
\n"; echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; if (!permission_exists('fax_extension_delete')) { echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; echo "
".$text['header-fax_server_settings']."

\n"; - echo " \n"; - if (permission_exists('fax_extension_copy') && $action == "update") { - echo " \n"; - } - echo " \n"; - echo "
\n"; + echo "\n"; echo " ".$text['label-email']."\n"; echo "\n"; + echo "\n"; echo " \n"; echo "
\n"; echo " ".$text['description-email']."\n"; @@ -504,10 +537,10 @@ else { //admin, superadmin, etc echo "
\n"; + echo "\n"; echo " ".$text['label-name']."\n"; echo "\n"; + echo "\n"; echo " \n"; echo "
\n"; echo "".$text['description-name']."\n"; @@ -579,9 +612,9 @@ echo "
\n"; echo " ".$text['description-email']."\n"; - echo "
\n"; if (permission_exists('fax_extension_advanced') && function_exists("imap_open") && file_exists("fax_files_remote.php")) { - echo "\n"; + echo "

\n"; + echo button::create(['type'=>'button','label'=>$text['button-advanced'],'icon'=>'tools','onclick'=>"toggle_advanced('advanced_email_connection');"]); } echo "
\n"; echo "\n"; @@ -661,7 +694,7 @@ } unset($available_users); echo " "; - echo " \n"; + 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"; @@ -824,7 +857,6 @@ echo " \n"; } echo " \n"; - echo " \n"; echo " \n"; echo " "; echo ""; @@ -834,8 +866,15 @@ echo "
\n"; - echo "".$text['label-advanced_settings']."

"; - echo $text['description-advanced_settings']."

"; + echo "
\n"; + echo "
".$text['label-advanced_settings']."
\n"; + echo "
\n"; + echo "
\n"; + echo "
\n"; + echo "
\n"; + + echo $text['description-advanced_settings']."\n"; + echo "

\n"; echo "\n"; echo " "; @@ -868,7 +907,7 @@ echo " ".$text['label-email_connection_server']."\n"; echo "\n"; echo "
\n"; - echo "  : "; + echo "  : "; echo "\n"; echo "
\n"; echo " ".$text['description-email_connection_server']."\n"; @@ -1017,15 +1056,10 @@ echo "
\n"; - echo " "; - echo " "; - echo " "; - echo " "; - echo "
\n"; - echo " "; - echo " "; - echo ""; - echo "
"; + echo " \n"; + echo " \n"; + echo "\n"; + echo "

\n"; echo "
\n"; } @@ -1034,4 +1068,4 @@ //show the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/fax/fax_files.php b/app/fax/fax_files.php index fe9cfa825d..d02319e22d 100644 --- a/app/fax/fax_files.php +++ b/app/fax/fax_files.php @@ -44,8 +44,33 @@ $text = $language->get(); //get variables used to control the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_REQUEST["order_by"]; + $order = $_REQUEST["order"]; + +//get the http post data + if (is_array($_POST['fax_files'])) { + $action = $_POST['action']; + $fax_uuid = $_POST['fax_uuid']; + $box = $_POST['box']; + $fax_files = $_POST['fax_files']; + } + +//process the http post data by action + if ($action != '' && is_array($fax_files) && @sizeof($fax_files) != 0) { + switch ($action) { + case 'delete': + if (permission_exists('fax_file_delete')) { + $obj = new fax; + $obj->fax_uuid = $fax_uuid; + $obj->box = $box; + $obj->delete_files($fax_files); + } + break; + } + + header('Location: fax_files.php?orderby='.$order_by.'&order='.$order.'&id='.$fax_uuid.'&box='.$box); + exit; + } //get fax extension if (is_uuid($_GET["id"])) { @@ -164,7 +189,7 @@ } //prepare to page the results - $sql = "select count(*) from v_fax_files "; + $sql = "select count(fax_file_uuid) from v_fax_files "; $sql .= "where fax_uuid = :fax_uuid "; $sql .= "and domain_uuid = :domain_uuid "; if ($_REQUEST['box'] == 'inbox') { @@ -181,66 +206,79 @@ //prepare to page the results $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $param = "&id=".$fax_uuid."&box=".$_GET['box']."&order_by=".$_GET['order_by']."&order=".$_GET['order']; - $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); + $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; + list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); + list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); $offset = $rows_per_page * $page; //get the list - $sql = str_replace('count(*)', '*', $sql); + $sql = str_replace('count(fax_file_uuid)', '*', $sql); $sql .= order_by($order_by, $order, 'fax_date', 'desc'); $sql .= limit_offset($rows_per_page, $offset); $database = new database; $fax_files = $database->select($sql, $parameters, 'all'); - unset($sql, $parameters, $num_rows); + unset($sql, $parameters); -//include header +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + +//include the header if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) { - $document['title'] = $text['title-inbox'].": ".escape($fax_name)." (".escape($fax_extension).")"; + $document['title'] = escape($fax_name)." [".escape($fax_extension)."]: ".$text['title-inbox']; } if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) { - $document['title'] = $text['title-sent_faxes'].": ".escape($fax_name)." (".escape($fax_extension).")"; + $document['title'] = escape($fax_name)." [".escape($fax_extension)."]: ".$text['title-sent_faxes']; } require_once "resources/header.php"; -//show the header - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; +//show the content + echo "
\n"; + echo "
"; if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) { - echo " ".$text['header-inbox'].": ".escape($fax_name)." (".escape($fax_extension).")\n"; + echo "".escape($fax_name)." [".escape($fax_extension)."]: ".$text['header-inbox']." (".$num_rows.")"; } if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) { - echo " ".$text['header-sent_faxes'].": ".escape($fax_name)." (".escape($fax_extension).")\n"; + echo "".escape($fax_name)." [".escape($fax_extension)."]: ".$text['header-sent_faxes']." (".$num_rows.")"; } - echo "
\n"; - echo " \n"; - echo "
\n"; - echo "
\n"; + echo " \n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'fax.php']); + if (permission_exists('fax_file_delete') && $fax_files) { + echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]); + } + if ($paging_controls_mini != '') { + echo "".$paging_controls_mini."\n"; + } + echo "
\n"; + echo "
\n"; + echo "\n"; -//show the table and content - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; -//show the fax files - echo "\n"; - echo "\n"; + echo "
\n"; + echo "\n"; + if (permission_exists('fax_file_delete')) { + echo " \n"; + } echo th_order_by('fax_caller_id_name', $text['label-fax_caller_id_name'], $order_by, $order, "&id=".$fax_uuid."&box=".$_GET['box']."&page=".$_GET['page']); echo th_order_by('fax_caller_id_number', $text['label-fax_caller_id_number'], $order_by, $order, "&id=".$fax_uuid."&box=".$_GET['box']."&page=".$_GET['page']); if ($_REQUEST['box'] == 'sent') { echo th_order_by('fax_destination', $text['label-fax_destination'], $order_by, $order, "&id=".$fax_uuid."&box=".$_GET['box']."&page=".$_GET['page']); } - echo "\n"; + echo "\n"; echo "\n"; echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order, "&id=".$fax_uuid."&box=".$_GET['box']."&page=".$_GET['page']); - echo "\n"; echo "\n"; + if (is_array($fax_files) && @sizeof($fax_files) != 0) { - foreach($fax_files as $row) { + $x = 0; + foreach ($fax_files as $row) { $file = basename($row['fax_file_path']); if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") { $file_name = substr($file, 0, (strlen($file) -4)); @@ -321,24 +359,27 @@ exec($cmd_tif2pdf); @unlink($dir_fax_temp.'/'.$file_name."_temp.tif"); } - echo ""; - echo "\n"; - echo " \n"; - echo " \n"; - if ($_REQUEST['box'] == 'sent') { - echo " \n"; - } - echo " \n"; - echo " \n"; + if (permission_exists('fax_file_delete')) { + echo " \n"; + } + echo " \n"; + echo " \n"; + if ($_REQUEST['box'] == 'sent') { + echo " \n"; + } + echo " \n"; + echo " \n"; - echo " \n"; - echo " \n"; + $fax_date = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("F d Y H:i", $row['fax_epoch']) : date("F d Y H:i", $row['fax_epoch']); + echo " \n"; echo "\n"; - $c = ($c) ? 0 : 1; + $x++; } } - unset($fax_files, $row); - -//show the paging controls - echo "
\n"; + echo " \n"; + echo " ".$text['table-file']."".$text['table-file']."".$text['table-view']." 
".escape($row['fax_caller_id_name'])." ".escape(format_phone($row['fax_caller_id_number']))." ".escape(format_phone($row['fax_destination']))." \n"; + if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) { - echo " \n"; + $list_row_url = "fax_files.php?id=".urlencode($fax_uuid)."&a=download&type=fax_inbox&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file); } if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) { - echo " \n"; + $list_row_url = "fax_files.php?id=".urlencode($fax_uuid)."&a=download&type=fax_sent&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file); } - echo " $file_name"; - echo " "; - echo " \n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " ".escape($row['fax_caller_id_name'])." ".escape(format_phone($row['fax_caller_id_number']))." ".escape(format_phone($row['fax_destination']))." ".$file_name."".$fax_date." "; - if (permission_exists('fax_file_delete')) { - echo "$v_link_label_delete"; - } - echo " ".$fax_date." 
"; - echo "

"; + unset($fax_files); + echo "\n"; + echo "
\n"; echo "
".$paging_controls."
\n"; - echo "

"; + echo "\n"; + echo "
\n"; + //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/fax/fax_log_view.php b/app/fax/fax_log_view.php index 26dac3bc3b..1b11ec10ee 100644 --- a/app/fax/fax_log_view.php +++ b/app/fax/fax_log_view.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-2019 + Portions created by the Initial Developer are Copyright (C) 2008-2020 the Initial Developer. All Rights Reserved. Contributor(s): @@ -50,6 +50,25 @@ $fax_uuid = $_REQUEST["fax_uuid"]; } +//process the http post data by submitted action + if ($_POST['action'] != '' && is_uuid($fax_log_uuid) && is_uuid($fax_uuid)) { + $array[0]['checked'] = 'true'; + $array[0]['uuid'] = $fax_log_uuid; + + switch ($_POST['action']) { + case 'delete': + if (permission_exists('fax_log_delete')) { + $obj = new fax; + $obj->fax_uuid = $fax_uuid; + $obj->delete_logs($array); + } + break; + } + + header('Location: fax_logs.php?id='.urlencode($fax_uuid)); + exit; + } + //pre-populate the form if (is_uuid($fax_log_uuid) && is_uuid($fax_uuid)) { $sql = "select * from v_fax_logs "; @@ -83,13 +102,27 @@ unset($sql, $parameters, $row); } +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + //show the header + $document['title'] = $text['title-fax_logs']; require_once "resources/header.php"; //show the content - echo "
"; - echo "".$text['title-fax_log']."\n"; - echo "

\n"; + echo "
\n"; + + echo "
\n"; + echo "
".$text['title-fax_log']."
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'fax_logs.php?id='.urlencode($fax_uuid)]); + if (permission_exists('fax_log_delete')) { + echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'action','value'=>'delete','style'=>'margin-left: 15px;','onclick'=>"if (!confirm('".$text['confirm-delete']."')) { this.blur(); return false; }"]); + } + echo "
\n"; + echo "
\n"; + echo "
\n"; echo "\n"; @@ -186,9 +219,13 @@ echo "
"; echo "

"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
"; //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/fax/fax_logs.php b/app/fax/fax_logs.php index 47ddaa36ba..77d3b725a9 100644 --- a/app/fax/fax_logs.php +++ b/app/fax/fax_logs.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-2019 + Portions created by the Initial Developer are Copyright (C) 2008-2020 the Initial Developer. All Rights Reserved. Contributor(s): @@ -43,38 +43,52 @@ $language = new text; $text = $language->get(); +//get the fax_uuid + $fax_uuid = $_REQUEST["id"]; + //get variables used to control the order $order_by = $_GET["order_by"]; $order = $_GET["order"]; -//get the fax_uuid - $fax_uuid = $_GET["id"]; +//get the http post data + if (is_array($_POST['fax_logs'])) { + $action = $_POST['action']; + $fax_logs = $_POST['fax_logs']; + } -//additional includes - $document['title'] = $text['title-fax_logs']; - require_once "resources/header.php"; +//process the http post data by action + if ($action != '' && is_array($fax_logs) && @sizeof($fax_logs) != 0) { + switch ($action) { + case 'delete': + if (permission_exists('fax_log_delete')) { + $obj = new fax; + $obj->fax_uuid = $fax_uuid; + $obj->delete_logs($fax_logs); + } + break; + } -//show the content - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
".$text['title-fax_logs']."\n"; - echo " "; - echo " \n"; - echo "
\n"; - echo "
"; - echo " ".$text['description-fax_log']."

\n"; - echo "
\n"; + header('Location: fax_logs.php?id='.urlencode($fax_uuid)); + exit; + } + +//add the search string + $search = strtolower($_GET["search"]); + if (strlen($search) > 0) { + $sql_search = " and ("; + $sql_search .= " lower(fax_result_text) like :search "; + $sql_search .= " or lower(fax_file) like :search "; + $sql_search .= " or lower(fax_local_station_id) like :search "; + $sql_search .= " or fax_date::text like :search "; + $sql_search .= ") "; + $parameters['search'] = '%'.$search.'%'; + } //prepare to page the results - $sql = "select count(*) from v_fax_logs "; + $sql = "select count(fax_log_uuid) from v_fax_logs "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and fax_uuid = :fax_uuid "; + $sql .= $sql_search; $parameters['domain_uuid'] = $domain_uuid; $parameters['fax_uuid'] = $fax_uuid; $database = new database; @@ -82,30 +96,67 @@ //prepare to page the results $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; - $param = "&id=".$fax_uuid."&order_by=".$order_by."&order=".$order; + $param = "&id=".$fax_uuid."&order_by=".$order_by."&order=".$order."&search=".$search; if (isset($_GET['page'])) { - $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); + $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; + list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); + list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); $offset = $rows_per_page * $page; } //get the list - $sql = str_replace('count(*)', '*', $sql); + $sql = str_replace('count(fax_log_uuid)', '*', $sql); $sql .= order_by($order_by, $order, 'fax_epoch', 'desc'); $sql .= limit_offset($rows_per_page, $offset); $database = new database; $fax_logs = $database->select($sql, $parameters, 'all'); - unset($sql, $parameters, $num_rows); + unset($sql, $parameters); -//set the row style - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); -//show the fax logs - echo "\n"; - echo "\n"; +//include the header + $document['title'] = $text['title-fax_logs']; + require_once "resources/header.php"; + +//show the content + echo "
\n"; + echo "
".$text['title-fax_logs']." (".$num_rows.")
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'fax.php']); + if (permission_exists('fax_log_delete') && $fax_logs) { + echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'style'=>'margin-left: 15px;','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]); + } + echo button::create(['type'=>'button','label'=>$text['button-refresh'],'icon'=>$_SESSION['theme']['button_icon_refresh'],'style'=>'margin-left: 15px;','link'=>'fax_logs.php']); + echo "\n"; + echo ""; + echo ""; + echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]); + echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'fax_logs.php?id='.$fax_uuid,'style'=>($search == '' ? 'display: none;' : null)]); + if ($paging_controls_mini != '') { + echo "".$paging_controls_mini."\n"; + } + echo " \n"; + echo "
\n"; + echo "
\n"; + echo "
\n"; + + echo $text['description-fax_log']."\n"; + echo "

\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "
\n"; + echo "\n"; + if (permission_exists('fax_log_delete')) { + echo " \n"; + } + echo th_order_by('fax_epoch', $text['label-fax_date'], $order_by, $order, null, null, "&id=".$fax_uuid); echo th_order_by('fax_success', $text['label-fax_success'], $order_by, $order, null, null, "&id=".$fax_uuid); echo th_order_by('fax_result_code', $text['label-fax_result_code'], $order_by, $order, null, null, "&id=".$fax_uuid); echo th_order_by('fax_result_text', $text['label-fax_result_text'], $order_by, $order, null, null, "&id=".$fax_uuid); @@ -122,56 +173,60 @@ //echo th_order_by('fax_retry_limit', $text['label-fax_retry_limit'], $order_by, $order); //echo th_order_by('fax_retry_sleep', $text['label-fax_retry_sleep'], $order_by, $order); echo th_order_by('fax_uri', $text['label-fax_destination'], $order_by, $order, null, null, "&id=".$fax_uuid); - echo th_order_by('fax_epoch', $text['label-fax_date'], $order_by, $order, null, null, "&id=".$fax_uuid); //echo th_order_by('fax_epoch', $text['label-fax_epoch'], $order_by, $order); - echo "\n"; + if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + echo " \n"; + } echo "\n"; if (is_array($fax_logs) && @sizeof($fax_logs) != 0) { - foreach($fax_logs as $row) { - //$fax_date = date("j M Y", $row['fax_date'].' 00:00:00'); - $fax_date = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("j M Y g:i:sa", $row['fax_epoch']) : date("j M Y H:i:s", $row['fax_epoch']); - - $tr_link = "href='fax_log_view.php?id=".$row['fax_log_uuid']."&fax_uuid=".$fax_uuid."'"; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - //echo " \n"; - //echo " \n"; - //echo " \n"; - //echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - //echo " \n"; - //echo " \n"; - echo " \n"; - echo " \n"; - //echo " \n"; - echo " \n"; if (permission_exists('fax_log_delete')) { - echo "".$v_link_label_delete.""; + echo " \n"; + } + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + //echo " \n"; + //echo " \n"; + //echo " \n"; + //echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + //echo " \n"; + //echo " \n"; + echo " \n"; + //echo " \n"; + if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + echo " \n"; } - echo "\n"; echo "\n"; - if ($c==0) { $c=1; } else { $c=0; } + $x++; } } - unset($fax_logs, $row); + unset($fax_logs); - echo "
\n"; + echo " \n"; + echo " "; - echo " \n"; - echo " 
".$row['fax_success']." ".$row['fax_result_code']." ".$row['fax_result_text']." ".basename($row['fax_file'])." ".$row['fax_ecm_used']." ".$row['fax_local_station_id']." ".$row['fax_document_transferred_pages']." ".$row['fax_document_total_pages']." ".$row['fax_image_resolution']." ".$row['fax_image_size']." ".$row['fax_bad_rows']." ".$row['fax_transfer_rate']." ".$row['fax_retry_attempts']." ".$row['fax_retry_limit']." ".$row['fax_retry_sleep']." ".basename($row['fax_uri'])." ".$fax_date." ".$row['fax_epoch']." "; - echo "".$v_link_label_view.""; + $x = 0; + foreach ($fax_logs as $row) { + $list_row_url = "fax_log_view.php?id=".urlencode($row['fax_log_uuid'])."&fax_uuid=".$fax_uuid; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " ".($_SESSION['domain']['time_format']['text'] == '12h' ? date("j M Y g:i:sa", $row['fax_epoch']) : date("j M Y H:i:s", $row['fax_epoch']))." ".$row['fax_success']." ".$row['fax_result_code']." ".$row['fax_result_text']." ".basename($row['fax_file'])." ".$row['fax_ecm_used']." ".$row['fax_local_station_id']." ".$row['fax_document_transferred_pages']." ".$row['fax_document_total_pages']." ".$row['fax_image_resolution']." ".$row['fax_image_size']." ".$row['fax_bad_rows']." ".$row['fax_transfer_rate']." ".$row['fax_retry_attempts']." ".$row['fax_retry_limit']." ".$row['fax_retry_sleep']." ".basename($row['fax_uri'])." ".$row['fax_epoch']." \n"; + echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]); + echo "
"; - echo "

"; - echo "
".$paging_controls."
"; - echo "

"; + echo "\n"; + echo "
\n"; + echo "
".$paging_controls."
\n"; + echo "\n"; + echo "\n"; + echo "\n"; //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 885423f5fe..b75790a67e 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.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-2019 + Portions created by the Initial Developer are Copyright (C) 2008-2020 the Initial Developer. All Rights Reserved. Contributor(s): @@ -689,14 +689,14 @@ if (!function_exists('fax_split_dtmf')) { else { if (!$included) { //nothing to send, redirect the browser - message::add($text['message-invalid-fax'], 'negative'); + message::add($text['message-invalid-fax'], 'negative', 4000); header("Location: fax_send.php?id=".$fax_uuid); exit; } } //preview, if requested - if (($_REQUEST['submit'] != '') && ($_REQUEST['submit'] == $text['button-preview'])) { + if (($_REQUEST['submit'] != '') && ($_REQUEST['submit'] == 'preview')) { unset($file_type); if (file_exists($dir_fax_temp.'/'.$fax_instance_uuid.'.pdf')) { $file_type = 'pdf'; @@ -905,29 +905,23 @@ if (!$included) { echo ""; - //fax extension form - echo "
\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo "\n"; - echo "
\n"; - echo " ".$text['header-new_fax']."\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo "
\n"; + //show the content + echo "\n"; + + echo "
\n"; + echo "
".$text['header-new_fax']."
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'fax.php']); + echo button::create(['type'=>'submit','label'=>$text['button-preview'],'name'=>'submit','value'=>'preview','icon'=>'eye']); + echo button::create(['type'=>'submit','label'=>$text['button-send'],'name'=>'submit','value'=>'send','icon'=>'paper-plane','style'=>'margin-left: 15px;']); + echo "
\n"; + echo "
\n"; + echo "
\n"; + + echo $text['description-2']." ".(if_group('superadmin') ? $text['description-3'] : null)."\n"; + echo "

\n"; echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; echo "\n"; echo "\n"; echo "\n"; - echo " \n"; - echo " \n"; - echo " "; echo "
\n"; - echo " ".$text['description-2']." ".((if_group('superadmin')) ? $text['description-3'] : null)." \n"; - echo "

\n"; - echo "
\n"; @@ -1068,7 +1062,9 @@ if (!$included) { echo "\n"; for ($f = 1; $f <= 3; $f++) { echo " 1) ? "style='display: none;'" : null).">"; - echo "
"; + echo " "; + echo button::create(['type'=>'button','label'=>$text['button-clear'],'icon'=>$_SESSION['theme']['button_icon_reset'],'onclick'=>"reset_file_input('fax_files_".$f."'); document.getElementById('file_list_".$f."').innerHTML='';"]); + echo "
"; echo " "; echo "
\n"; } @@ -1139,22 +1135,17 @@ if (!$included) { echo "
\n"; - echo "
\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
"; + echo "

\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; - echo "
\n"; //show the footer require_once "resources/footer.php"; @@ -1184,4 +1175,4 @@ function showgrid($pdf) { } */ -?> +?> \ No newline at end of file diff --git a/app/fax/resources/classes/fax.php b/app/fax/resources/classes/fax.php index 32e9552472..5cca8bb139 100644 --- a/app/fax/resources/classes/fax.php +++ b/app/fax/resources/classes/fax.php @@ -39,6 +39,7 @@ if (!class_exists('fax')) { public $fax_extension; public $fax_forward_number; public $destination_number; + public $box; private $forward_prefix; /** @@ -61,10 +62,6 @@ if (!class_exists('fax')) { //assign private variables $this->app_name = 'fax'; $this->app_uuid = '24108154-4ac3-1db6-1551-4731703a4440'; - $this->permission_prefix = 'fax_extension_'; - $this->list_page = 'fax.php'; - $this->table = 'fax'; - $this->uuid_prefix = 'fax_'; } @@ -212,6 +209,13 @@ if (!class_exists('fax')) { * delete records */ public function delete($records) { + + //set private variables + $this->permission_prefix = 'fax_extension_'; + $this->list_page = 'fax.php'; + $this->table = 'fax'; + $this->uuid_prefix = 'fax_'; + if (permission_exists($this->permission_prefix.'delete')) { //add multi-lingual support @@ -305,10 +309,169 @@ if (!class_exists('fax')) { } } + public function delete_files($records) { + + //set private variables + $this->permission_prefix = 'fax_file_'; + $this->list_page = 'fax_files.php?id='.urlencode($this->fax_uuid).'&box='.urlencode($this->box); + $this->table = 'fax_files'; + $this->uuid_prefix = 'fax_file_'; + + if (permission_exists($this->permission_prefix.'delete')) { + + //add multi-lingual support + $language = new text; + $text = $language->get(); + + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: '.$this->list_page); + exit; + } + + //delete multiple records + if (is_array($records) && @sizeof($records) != 0) { + + //filter out unchecked fax files, build where clause for below + foreach ($records as $x => $record) { + if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + $uuids[] = "'".$record['uuid']."'"; + } + } + + //get necessary fax file details + if (is_array($uuids) && @sizeof($uuids) != 0) { + $sql = "select ".$this->uuid_prefix."uuid as uuid, fax_mode, fax_file_path, fax_file_type from v_".$this->table." "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $database = new database; + $rows = $database->select($sql, $parameters, 'all'); + if (is_array($rows) && @sizeof($rows) != 0) { + foreach ($rows as $row) { + if ($row['fax_mode'] == 'rx') { $fax_files[$row['uuid']]['folder'] = 'inbox'; } + if ($row['fax_mode'] == 'tx') { $fax_files[$row['uuid']]['folder'] = 'sent'; } + $fax_files[$row['uuid']]['path'] = $row['fax_file_path']; + $fax_files[$row['uuid']]['type'] = $row['fax_file_type']; + } + } + unset($sql, $parameters, $rows, $row); + } + + //delete fax file(s) + if (is_array($fax_files) && @sizeof($fax_files) != 0) { + foreach ($fax_files as $fax_file_uuid => $fax_file) { + if (substr_count($fax_file['path'], '/temp/') > 0) { + $fax_file['path'] = str_replace('/temp/', '/'.$fax_file['type'].'/', $fax_file['path']); + } + if (file_exists($fax_file['path'])) { + @unlink($fax_file['path']); + } + if ($fax_file['type'] == 'tif') { + $fax_file['path'] = str_replace('.tif', '.pdf', $fax_file['path']); + if (file_exists($fax_file['path'])) { + @unlink($fax_file['path']); + } + } + else if ($fax_file['type'] == 'pdf') { + $fax_file['path'] = str_replace('.pdf', '.tif', $fax_file['path']); + if (file_exists($fax_file['path'])) { + @unlink($fax_file['path']); + } + } + } + } + + //build the delete array + $x = 0; + foreach ($fax_files as $fax_file_uuid => $fax_file) { + $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $fax_file_uuid; + $array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid']; + $x++; + } + + //delete the checked rows + if (is_array($array) && @sizeof($array) != 0) { + + //execute delete + $database = new database; + $database->app_name = $this->app_name; + $database->app_uuid = $this->app_uuid; + $database->delete($array); + unset($array); + + //set message + message::add($text['message-delete']); + } + unset($records); + } + } + } + + public function delete_logs($records) { + + //set private variables + $this->permission_prefix = 'fax_log_'; + $this->list_page = 'fax_logs.php?id='.urlencode($this->fax_uuid); + $this->table = 'fax_logs'; + $this->uuid_prefix = 'fax_log_'; + + if (permission_exists($this->permission_prefix.'delete')) { + + //add multi-lingual support + $language = new text; + $text = $language->get(); + + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: '.$this->list_page); + exit; + } + + //delete multiple records + if (is_array($records) && @sizeof($records) != 0) { + + //filter out unchecked fax logs, build the delete array + foreach ($records as $x => $record) { + if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; + $array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid']; + } + } + + //delete the checked rows + if (is_array($array) && @sizeof($array) != 0) { + + //execute delete + $database = new database; + $database->app_name = $this->app_name; + $database->app_uuid = $this->app_uuid; + $database->delete($array); + unset($array); + + //set message + message::add($text['message-delete']); + } + unset($records); + } + } + } + /** * copy records */ public function copy($records) { + + //set private variables + $this->permission_prefix = 'fax_extension_'; + $this->list_page = 'fax.php'; + $this->table = 'fax'; + $this->uuid_prefix = 'fax_'; + if (permission_exists($this->permission_prefix.'copy')) { //add multi-lingual support