From 0406eeb14f024a209a9a4ecaa6b47e6384c3baba Mon Sep 17 00:00:00 2001 From: fusionate Date: Mon, 29 May 2023 22:25:48 +0000 Subject: [PATCH] Fax Server: Updates for PHP 8.1 --- app/fax/fax.php | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/fax/fax.php b/app/fax/fax.php index c095c9c355..426d3b21f3 100644 --- a/app/fax/fax.php +++ b/app/fax/fax.php @@ -47,14 +47,14 @@ $text = $language->get(); //get posted data - if (is_array($_POST['fax_servers'])) { + if (!empty($_POST['fax_servers']) && is_array($_POST['fax_servers'])) { $action = $_POST['action']; $search = $_POST['search']; $fax_servers = $_POST['fax_servers']; } //process the http post data by action - if ($action != '' && is_array($fax_servers) && @sizeof($fax_servers) != 0) { + if (!empty($action) && !empty($fax_servers) && is_array($fax_servers) && @sizeof($fax_servers) != 0) { switch ($action) { case 'copy': if (permission_exists('fax_extension_copy')) { @@ -75,8 +75,8 @@ } //get order and order by - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? null; + $order = $_GET["order"] ?? null; //add the search if (isset($_GET["search"])) { @@ -84,7 +84,7 @@ } //get record counts - if (permission_exists('fax_extension_view_all') && $_GET['show'] == 'all') { + if (permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] == 'all') { //count the fax extensions $sql = "select count(f.fax_uuid) from v_fax as f "; if (isset($search)) { @@ -148,15 +148,15 @@ //prepare paging $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; - $param = $search ? "search=".$search : null; - $param .= permission_exists('fax_extension_view_all') && $_GET['show'] == 'all' ? ($search ? '&' : '?')."show=all" : null; - $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; + $param = !empty($search) ? "search=".$search : null; + $param .= permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] == 'all' ? (!empty($search) ? '&' : '?')."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; //get fax extensions - if (permission_exists('fax_extension_view_all') && $_GET['show'] == 'all') { + if (permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] == 'all') { //show all fax extensions $sql = "select f.fax_uuid, f.domain_uuid, fax_extension, fax_prefix, fax_name, fax_email, fax_description "; $sql .= "from v_fax as f "; @@ -244,16 +244,16 @@ if (permission_exists('fax_extension_delete') && $result) { 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_extension_view_all') && $_GET['show'] != 'all') { - echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all'.($search ? '&search='.urlencode($search) : null)]); + if (permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] != 'all') { + echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all'.(!empty($search) ? '&search='.urlencode($search) : null)]); } echo "