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 "
\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; if (permission_exists('fax_queue_add') || permission_exists('fax_queue_edit') || permission_exists('fax_queue_delete')) { echo " \n"; } - if ($_GET['show'] == 'all' && permission_exists('fax_queue_all')) { + if (!empty($_GET['show']) && $_GET['show'] == 'all' && permission_exists('fax_queue_all')) { echo th_order_by('domain_name', $text['label-domain'], $order_by, $order); } //echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order); @@ -315,7 +315,7 @@ echo th_order_by('fax_retry_date', $text['label-fax_retry_date'], $order_by, $order); echo th_order_by('fax_notify_date', $text['label-fax_notify_date'], $order_by, $order); echo th_order_by('fax_retry_count', $text['label-fax_retry_count'], $order_by, $order); - if (permission_exists('fax_queue_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('fax_queue_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo " \n"; } echo "\n"; @@ -333,7 +333,7 @@ echo " \n"; echo " \n"; } - if ($_GET['show'] == 'all' && permission_exists('fax_queue_all')) { + if (!empty($_GET['show']) && $_GET['show'] == 'all' && permission_exists('fax_queue_all')) { echo " \n"; } echo " \n"; @@ -348,7 +348,7 @@ echo " \n"; echo " \n"; echo " \n"; - if (permission_exists('fax_queue_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('fax_queue_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo " \n"; @@ -368,4 +368,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/fax_queue/fax_queue_edit.php b/app/fax_queue/fax_queue_edit.php index c77af2cf85..67cf080093 100644 --- a/app/fax_queue/fax_queue_edit.php +++ b/app/fax_queue/fax_queue_edit.php @@ -18,7 +18,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2022 + Portions created by the Initial Developer are Copyright (C) 2022-2023 the Initial Developer. All Rights Reserved. */ @@ -44,7 +44,7 @@ $text = $language->get(); //action add or update - if (is_uuid($_REQUEST["id"])) { + if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; $fax_queue_uuid = $_REQUEST["id"]; $id = $_REQUEST["id"]; @@ -54,8 +54,8 @@ } //get http post variables and set them to php variables - if (is_array($_POST)) { - $fax_uuid = $_POST["fax_uuid"]; + if (!empty($_POST) && is_array($_POST)) { + //$fax_uuid = $_POST["fax_uuid"]; $fax_date = $_POST["fax_date"]; $hostname = $_POST["hostname"]; $fax_caller_id_name = $_POST["fax_caller_id_name"]; @@ -66,7 +66,7 @@ $fax_file = $_POST["fax_file"]; $fax_status = $_POST["fax_status"]; $fax_retry_date = $_POST["fax_retry_date"]; - $fax_notify_date = $_POST["fax_notify_date"]; + $fax_notify_date = $_POST["fax_notify_date"] ?? null; $fax_retry_count = $_POST["fax_retry_count"]; $fax_accountcode = $_POST["fax_accountcode"]; $fax_command = $_POST["fax_command"]; @@ -84,7 +84,7 @@ } //process the http post data by submitted action - if ($_POST['action'] != '' && !empty($_POST['action'])) { + if (!empty($_POST['action'])) { //prepare the array(s) //send the array to the database class @@ -190,7 +190,7 @@ } //pre-populate the form - if (is_array($_GET) && $_POST["persistformvar"] != "true") { + if (!empty($_GET) && is_array($_GET) && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) { $sql = "select "; $sql .= " fax_uuid, "; $sql .= " fax_date, "; @@ -244,7 +244,7 @@ //show the content echo "\n"; - echo "\n"; + echo "\n"; echo "
\n"; echo "
".$text['title-fax_queue']."
\n"; @@ -293,7 +293,7 @@ echo " ".$text['label-fax_date']."\n"; echo "\n"; echo "
\n"; @@ -304,7 +304,7 @@ echo " ".$text['label-hostname']."\n"; echo "\n"; echo "\n"; @@ -315,7 +315,7 @@ echo " ".$text['label-fax_caller_id_name']."\n"; echo "\n"; echo "\n"; @@ -326,7 +326,7 @@ echo " ".$text['label-fax_caller_id_number']."\n"; echo "\n"; echo "\n"; @@ -337,7 +337,7 @@ echo " ".$text['label-fax_number']."\n"; echo "\n"; echo "\n"; @@ -348,7 +348,7 @@ echo " ".$text['label-fax_prefix']."\n"; echo "\n"; echo "\n"; @@ -359,7 +359,7 @@ echo " ".$text['label-fax_email_address']."\n"; echo "\n"; echo "\n"; @@ -370,7 +370,7 @@ echo " ".$text['label-fax_file']."\n"; echo "\n"; echo "\n"; @@ -382,12 +382,12 @@ echo "\n"; echo "\n"; echo "\n"; @@ -410,7 +410,7 @@ echo " ".$text['label-fax_notify_date']."\n"; echo "\n"; echo "\n"; @@ -421,7 +421,7 @@ echo " ".$text['label-fax_retry_count']."\n"; echo "\n"; echo "\n"; @@ -432,7 +432,7 @@ echo " ".$text['label-fax_accountcode']."\n"; echo "\n"; echo "\n"; @@ -443,7 +443,7 @@ echo " ".$text['label-fax_command']."\n"; echo "\n"; echo "\n"; @@ -459,4 +459,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file
\n"; - echo " \n"; + echo " \n"; echo "  
".escape($row['domain_name'])."".escape($row['fax_date_formatted'])."".escape($row['fax_retry_date_formatted'])." ".escape($row['fax_retry_time_formatted'])."".escape($row['fax_notify_date_formatted'])." ".escape($row['fax_notify_time_formatted'])."".escape($row['fax_retry_count'])."\n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_date']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-hostname']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_caller_id_name']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_caller_id_number']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_number']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_prefix']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_email_address']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_file']."\n"; echo "
\n"; echo " \n"; echo "
\n"; echo $text['description-fax_status']."\n"; @@ -399,7 +399,7 @@ echo " ".$text['label-fax_retry_date']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_retry_date']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_notify_date']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_retry_count']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_accountcode']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-fax_command']."\n"; echo "