From 195b81faa0e60876dd925aec22281fbbbea52fda Mon Sep 17 00:00:00 2001 From: fusionate Date: Mon, 29 May 2023 22:28:00 +0000 Subject: [PATCH] Fax - Logs: Updates for PHP 8.1 --- app/fax/fax_logs.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/app/fax/fax_logs.php b/app/fax/fax_logs.php index 0b0f4b3254..f1b2bb0103 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-2020 + Portions created by the Initial Developer are Copyright (C) 2008-2023 the Initial Developer. All Rights Reserved. Contributor(s): @@ -50,17 +50,17 @@ $fax_uuid = $_REQUEST["id"]; //get variables used to control the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? null; + $order = $_GET["order"] ?? null; //get the http post data - if (is_array($_POST['fax_logs'])) { + if (!empty($_POST['fax_logs']) && is_array($_POST['fax_logs'])) { $action = $_POST['action']; $fax_logs = $_POST['fax_logs']; } //process the http post data by action - if ($action != '' && is_array($fax_logs) && @sizeof($fax_logs) != 0) { + if (!empty($action) && !empty($fax_logs) && is_array($fax_logs) && @sizeof($fax_logs) != 0) { switch ($action) { case 'delete': if (permission_exists('fax_log_delete')) { @@ -76,13 +76,14 @@ } //add the search string - $search = strtolower($_GET["search"]); + $search = strtolower($_GET["search"] ?? ''); if (!empty($search)) { $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 .= " or fax_uri::text like :search "; $sql_search .= ") "; $parameters['search'] = '%'.$search.'%'; } @@ -91,7 +92,7 @@ $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; + $sql .= $sql_search ?? ''; $parameters['domain_uuid'] = $domain_uuid; $parameters['fax_uuid'] = $fax_uuid; $database = new database; @@ -110,7 +111,7 @@ //get the list $sql = str_replace('count(fax_log_uuid)', '*', $sql); $sql .= order_by($order_by, $order, 'fax_epoch', 'desc'); - $sql .= limit_offset($rows_per_page, $offset); + $sql .= limit_offset($rows_per_page, $offset ?? 0); $database = new database; $fax_logs = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -137,7 +138,7 @@ 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 != '') { + if (!empty($paging_controls_mini)) { echo "".$paging_controls_mini."\n"; } echo " \n"; @@ -160,7 +161,7 @@ echo "\n"; if (permission_exists('fax_log_delete')) { echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; } echo th_order_by('fax_epoch', $text['label-fax_date'], $order_by, $order, null, null, "&id=".$fax_uuid); @@ -181,7 +182,7 @@ //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_epoch'], $order_by, $order); - if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (!empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo "  \n"; } echo "\n"; @@ -197,7 +198,7 @@ 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']))." \n"; + echo " ".(!empty($_SESSION['domain']['time_format']['text']) && $_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']))." \n"; echo " ".$row['fax_success']." \n"; echo " ".$row['fax_result_code']." \n"; echo " ".$row['fax_result_text']." \n"; @@ -215,7 +216,7 @@ //echo " ".$row['fax_retry_sleep']." \n"; echo " ".basename($row['fax_uri'])." \n"; //echo " ".$row['fax_epoch']." \n"; - if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (!empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]); echo " \n"; @@ -228,7 +229,7 @@ echo "\n"; echo "
\n"; - echo "
".$paging_controls."
\n"; + echo "
".($paging_controls ?? '')."
\n"; echo "\n"; echo "\n"; echo "\n";