diff --git a/app/devices/device_vendor_functions.php b/app/devices/device_vendor_functions.php index cd1c6efdf2..9d518621e9 100644 --- a/app/devices/device_vendor_functions.php +++ b/app/devices/device_vendor_functions.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) 2016-2022 + Portions created by the Initial Developer are Copyright (C) 2016-2023 the Initial Developer. All Rights Reserved. Contributor(s): @@ -47,14 +47,14 @@ $text = $language->get(); //get the http post data - if (is_array($_POST['vendor_functions'])) { + if (!empty($_POST['vendor_functions']) && is_array($_POST['vendor_functions'])) { $action = $_POST['action']; $device_vendor_uuid = $_POST['device_vendor_uuid']; $vendor_functions = $_POST['vendor_functions']; } //process the http post data by action - if ($action != '' && is_array($vendor_functions) && @sizeof($vendor_functions) != 0) { + if (!empty($action) && !empty($vendor_functions) && is_array($vendor_functions) && @sizeof($vendor_functions) != 0) { switch ($action) { case 'toggle': if (permission_exists('device_vendor_function_edit')) { @@ -77,8 +77,8 @@ } //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; //prepare to page the results $sql = "select count(*) from v_device_vendor_functions "; @@ -125,7 +125,7 @@ } $parameters['device_vendor_uuid'] = $device_vendor_uuid; $sql .= order_by($order_by, $order, 'type', 'asc'); - $sql .= limit_offset($rows_per_page, $offset); + $sql .= limit_offset($rows_per_page, $offset ?? null); $database = new database; $vendor_functions = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); @@ -152,7 +152,7 @@ if (permission_exists('device_vendor_function_delete') && $vendor_functions) { 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 ($paging_controls_mini != '') { + if (!empty($paging_controls_mini)) { echo "".$paging_controls_mini."\n"; } echo " \n"; @@ -170,7 +170,7 @@ echo "\n"; if (permission_exists('device_vendor_function_add') || permission_exists('device_vendor_function_edit') || permission_exists('device_vendor_function_delete')) { echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; } echo th_order_by('type', $text['label-type'], $order_by, $order); @@ -179,7 +179,7 @@ echo "".$text['label-groups']."\n"; echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('device_vendor_function_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('device_vendor_function_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo "  \n"; } echo "\n"; @@ -255,7 +255,7 @@ } echo " \n"; echo " ".escape($row['description'])."\n"; - if (permission_exists('device_vendor_function_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('device_vendor_function_edit') && !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-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; @@ -268,7 +268,7 @@ echo "\n"; echo "
\n"; - echo "
".$paging_controls."
\n"; + echo "
".($paging_controls ?? '')."
\n"; echo "\n"; echo "\n"; @@ -290,4 +290,4 @@ echo "\n"; -?> +?> \ No newline at end of file