#28 finnished logging

This commit is contained in:
Philip Häusler 2012-12-27 02:07:49 +01:00
parent 74098af09d
commit 12fb781946
1 changed files with 9 additions and 16 deletions

View File

@ -110,10 +110,13 @@ function admin_user() {
// Assign angel-types // Assign angel-types
sql_start_transaction(); sql_start_transaction();
sql_query("DELETE FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user_source['UID'])); sql_query("DELETE FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user_source['UID']));
$user_angel_type_info = array();
if (!empty($selected_angel_types)) { if (!empty($selected_angel_types)) {
$SQL = "INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`) VALUES "; $SQL = "INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`) VALUES ";
foreach ($selected_angel_types as $selected_angel_type_id) foreach ($selected_angel_types as $selected_angel_type_id) {
$SQL .= "(${user_source['UID']}, ${selected_angel_type_id}),"; $SQL .= "(" . $user_source['UID'] . ", " . $selected_angel_type_id . "),";
$user_angel_type_info[] = $angel_types[$selected_angel_type_id] . (in_array($selected_angel_type_id, $accepted_angel_types) ? ' (confirmed)' : '');
}
// remove superfluous comma // remove superfluous comma
$SQL = substr($SQL, 0, -1); $SQL = substr($SQL, 0, -1);
sql_query($SQL); sql_query($SQL);
@ -125,16 +128,6 @@ function admin_user() {
} }
sql_stop_transaction(); sql_stop_transaction();
foreach ($selected_angel_types as $selected_angel_type_id) {
if (sql_num_query("SELECT * FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user_source['UID']) . " AND `angeltype_id`=" . sql_escape($selected_angel_type_id) . " LIMIT 1") == 0) {
if (in_array("admin_user_angeltypes", $privileges)) {
sql_query("INSERT INTO `UserAngelTypes` SET `confirm_user_id`=" . sql_escape($user['UID']) . ", `user_id`=" . sql_escape($user_source['UID']) . ", `angeltype_id`=" . sql_escape($selected_angel_type_id));
} else {
sql_query("INSERT INTO `UserAngelTypes` SET `user_id`=" . sql_escape($user_source['UID']) . ", `angeltype_id`=" . sql_escape($selected_angel_type_id));
}
}
}
engelsystem_log("Set angeltypes of " . $user_source['Nick'] . " to: " . join(", ", $user_angel_type_info)); engelsystem_log("Set angeltypes of " . $user_source['Nick'] . " to: " . join(", ", $user_angel_type_info));
success("Angeltypes saved."); success("Angeltypes saved.");
redirect(page_link_to('admin_user') . '&id=' . $user_source['UID']); redirect(page_link_to('admin_user') . '&id=' . $user_source['UID']);