diff --git a/app/fax_queue/fax_queue.php b/app/fax_queue/fax_queue.php index 301ab4d5c6..6c38d759ef 100644 --- a/app/fax_queue/fax_queue.php +++ b/app/fax_queue/fax_queue.php @@ -59,7 +59,7 @@ } //process the http post data by action - if ($action != '' && is_array($fax_queue) && @sizeof($fax_queue) != 0) { + if (!empty($action) && !empty($fax_queue) && is_array($fax_queue) && @sizeof($fax_queue) != 0) { switch ($action) { case 'copy': @@ -96,15 +96,15 @@ } //get order and order by - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? null; + $order = $_GET["order"] ?? null; //get the count $sql = "select count(fax_queue_uuid) "; $sql .= "from v_fax_queue as q "; - if ($_GET['show'] == "all" && permission_exists('fax_queue_all')) { + if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('fax_queue_all')) { //show faxes for all domains $sql .= "where true "; } @@ -141,14 +141,14 @@ $parameters['fax_status'] = $_GET["fax_status"]; } $database = new database; - $num_rows = $database->select($sql, $parameters, 'column'); + $num_rows = $database->select($sql, $parameters ?? null, 'column'); unset($sql, $parameters); //prepare to page the results $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; - $param = $search ? "&search=".$search : null; - $param = ($_GET['show'] == 'all' && permission_exists('fax_queue_all')) ? "&show=all" : null; - $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; + $param = !empty($search) ? "&search=".$search : null; + $param = (!empty($_GET['show']) && $_GET['show'] == 'all' && permission_exists('fax_queue_all')) ? "&show=all" : 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; @@ -180,7 +180,7 @@ $sql .= "q.fax_accountcode, \n"; $sql .= "q.fax_command \n"; $sql .= "from v_fax_queue as q, v_domains as d \n"; - if ($_GET['show'] == "all" && permission_exists('fax_queue_all')) { + if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('fax_queue_all')) { //show faxes for all domains $sql .= "where true \n"; } @@ -249,7 +249,7 @@ echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display:none;','onclick'=>"modal_open('modal-delete','btn_delete');"]); } if (permission_exists('fax_queue_all')) { - if ($_GET['show'] == 'all') { + if (!empty($_GET['show']) && $_GET['show'] == 'all') { echo " \n"; } else { @@ -260,14 +260,14 @@ echo " \n"; - echo ""; + echo ""; echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']); if ($paging_controls_mini != '') { echo "".$paging_controls_mini."\n"; @@ -290,16 +290,16 @@ echo "