From 0f0f847af4c9ffe8138c802086bda7eb15f9baef Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 27 Dec 2012 02:54:57 +0100 Subject: [PATCH] minor fixes for logging and user editing and searching --- includes/pages/admin_free.php | 1 + includes/pages/admin_user.php | 8 +++++--- templates/admin_free.html | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php index d6f4b7a0..88a96965 100644 --- a/includes/pages/admin_free.php +++ b/includes/pages/admin_free.php @@ -57,6 +57,7 @@ function admin_free() { return template_render('../templates/admin_free.html', array ( 'search' => $search, 'angeltypes' => html_select_key('angeltype', 'angeltype', $angel_types, $_REQUEST['angeltype']), + 'confirmed_only' => isset($_REQUEST['confirmed_only'])? 'checked' : '', 'table' => $table, 'link' => page_link_to('admin_free') )); diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 8d900c1b..f4902e1c 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -103,9 +103,10 @@ function admin_user() { if (isset ($_REQUEST['submit_user_angeltypes'])) { $selected_angel_types = array_intersect($_REQUEST['selected_angel_types'], array_keys($angel_types)); - $accepted_angel_types = array_diff(array_intersect($_REQUEST['accepted_angel_types'], array_keys($angel_types)), $nonrestricted_angel_types); + $accepted_angel_types = array_unique(array_diff(array_intersect($_REQUEST['accepted_angel_types'], array_keys($angel_types)), $nonrestricted_angel_types)); if (in_array("admin_user_angeltypes", $privileges)) - $selected_angel_types = array_merge($selected_angel_types, $accepted_angel_types); + $selected_angel_types = array_merge((array) $selected_angel_types, $accepted_angel_types); + $selected_angel_types = array_unique($selected_angel_types); // Assign angel-types sql_start_transaction(); @@ -227,10 +228,11 @@ function admin_user() { case 'delete' : if ($user['UID'] != $id) { + $nickname = sql_select("SELECT `Nick` FROM `User` WHERE `UID` = '" . sql_escape($id) . "' LIMIT 1"); sql_query("DELETE FROM `User` WHERE `UID`=" . sql_escape($id) . " LIMIT 1"); sql_query("DELETE FROM `UserGroups` WHERE `uid`=" . sql_escape($id)); sql_query("UPDATE `ShiftEntry` SET `UID`=0, `Comment`=NULL WHERE `UID`=" . sql_escape($id)); - engelsystem_log("Deleted user " . $user_source['Nick']); + engelsystem_log("Deleted user " . $nickname[0]['Nick']); $html .= success("Benutzer gelöscht!", true); } else { $html .= error("Du kannst Dich nicht selber löschen!", true); diff --git a/templates/admin_free.html b/templates/admin_free.html index 35ac1afa..ef1dccf0 100644 --- a/templates/admin_free.html +++ b/templates/admin_free.html @@ -1,6 +1,6 @@

- Search Angel: %angeltypes% + Search Angel: %angeltypes%