diff --git a/app/fax/fax_files.php b/app/fax/fax_files.php index 925d053aa7..00bb4a0dc5 100644 --- a/app/fax/fax_files.php +++ b/app/fax/fax_files.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) 2018-2022 + Portions created by the Initial Developer are Copyright (C) 2018-2023 the Initial Developer. All Rights Reserved. Contributor(s): @@ -47,11 +47,11 @@ $text = $language->get(); //get variables used to control the order - $order_by = $_REQUEST["order_by"]; - $order = $_REQUEST["order"]; + $order_by = $_REQUEST["order_by"] ?? null; + $order = $_REQUEST["order"] ?? null; //get the http post data - if (is_array($_POST['fax_files'])) { + if (!empty($_POST['fax_files']) && is_array($_POST['fax_files'])) { $action = $_POST['action']; $fax_uuid = $_POST['fax_uuid']; $box = $_POST['box']; @@ -59,7 +59,7 @@ } //process the http post data by action - if ($action != '' && is_array($fax_files) && @sizeof($fax_files) != 0) { + if (!empty($action) && !empty($fax_files) && is_array($fax_files) && @sizeof($fax_files) != 0) { switch ($action) { case 'delete': if (permission_exists('fax_file_delete')) { @@ -76,7 +76,7 @@ } //get fax extension - if (is_uuid($_GET["id"])) { + if (!empty($_GET["id"]) && is_uuid($_GET["id"])) { $fax_uuid = $_GET["id"]; if (permission_exists('fax_extension_view_domain')) { //show all fax extensions @@ -117,7 +117,7 @@ $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name']; //download the fax - if ($_GET['a'] == "download") { + if (!empty($_GET['a']) && $_GET['a'] == "download") { //sanitize the values that are used in the file name and path $fax_extension = preg_replace('/[^0-9]/', '', $_GET['ext']); @@ -215,8 +215,8 @@ //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 = is_numeric($_GET['page']) ? $_GET['page'] : 0; + $param = "&id=".$fax_uuid."&box=".$_GET['box'].(!empty($_GET['order_by']) ? "&order_by=".$_GET['order_by'] : null).(!empty($_GET['order']) ? "&order=".$_GET['order'] : null); + $page = !empty($_GET['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; @@ -314,19 +314,19 @@ echo "\n"; if (permission_exists('fax_file_delete')) { echo " \n"; - echo " \n"; + echo " \n"; 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']); + echo th_order_by('fax_caller_id_name', $text['label-fax_caller_id_name'], $order_by, $order, "&id=".$fax_uuid."&box=".$_GET['box']."&page=".$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=".$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 th_order_by('fax_destination', $text['label-fax_destination'], $order_by, $order, "&id=".$fax_uuid."&box=".$_GET['box']."&page=".$page); } if (permission_exists('fax_download_view')) { echo "".$text['table-file']."\n"; } echo "".$text['table-view']."\n"; - echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order, "&id=".$fax_uuid."&box=".$_GET['box']."&page=".$_GET['page']); + echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order, "&id=".$fax_uuid."&box=".$_GET['box']."&page=".$page); echo "\n"; if (is_array($fax_files) && @sizeof($fax_files) != 0) { @@ -365,7 +365,7 @@ $dir_fax = $dir_fax_sent; } } - if ($dir_fax != '') { + if (!empty($dir_fax)) { chdir($dir_fax); //get fax resolution (ppi, W & H) $resp = exec("tiffinfo ".$file_name.".tif | grep 'Resolution:'"); @@ -460,4 +460,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file