diff --git a/core/users/users.php b/core/users/users.php index 27ddc69c01..9b44048f9a 100644 --- a/core/users/users.php +++ b/core/users/users.php @@ -47,10 +47,10 @@ $text = $language->get(); //get the http post data - if (is_array($_POST['users'])) { - $action = $_POST['action']; - $search = $_POST['search']; - $users = $_POST['users']; + if (!empty($_POST['users'])) { + $action = $_POST['action'] ?? ''; + $search = $_POST['search'] ?? ''; + $users = $_POST['users'] ?? ''; } //check to see if contact details are in the view @@ -69,7 +69,7 @@ unset($parameters); //process the http post data by action - if ($action != '' && is_array($users) && @sizeof($users) != 0) { + if (!empty($action) && is_array($users) && @sizeof($users) != 0) { switch ($action) { case 'copy': if (permission_exists('user_add')) { @@ -96,11 +96,19 @@ } //get order and order by - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? ''; + $order = $_GET["order"] ?? ''; + +//set additional variables + $context = !empty($_GET["context"]) ? $_GET["context"] : ''; + $search = !empty($_GET["search"]) ? $_GET["search"] : ''; + $show = !empty($_GET["show"]) ? $_GET["show"] : ''; + +//set from session variables + $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; //add the search string - if (isset($_GET["search"])) { + if (!empty($search)) { $search = strtolower($_GET["search"]); $sql_search = " ("; $sql_search .= " lower(username) like :search "; @@ -114,7 +122,7 @@ //get the count $sql = "select count(*) from view_users "; - if ($_GET['show'] == "all" && permission_exists('user_all')) { + if ($show == "all" && permission_exists('user_all')) { if (isset($sql_search)) { $sql .= "where ".$sql_search; } @@ -124,7 +132,7 @@ } else { $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - if (isset($sql_search)) { + if (!empty($sql_search)) { $sql .= "and ".$sql_search; } $parameters['domain_uuid'] = $domain_uuid; @@ -140,8 +148,8 @@ //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('user_all')) ? "&show=all" : null; - $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; + $param .= ($show == 'all' && permission_exists('user_all')) ? "&show=all" : null; + $page = !empty($_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; @@ -153,7 +161,7 @@ } $sql .= "cast(user_enabled as text) "; $sql .= "from view_users "; - if ($_GET['show'] == "all" && permission_exists('user_all')) { + if ($show == "all" && permission_exists('user_all')) { if (isset($sql_search)) { $sql .= "where ".$sql_search; } @@ -208,7 +216,7 @@ } echo "