diff --git a/core/users/user_setting_delete.php b/core/users/user_setting_delete.php index 641cae46d3..52a021d600 100644 --- a/core/users/user_setting_delete.php +++ b/core/users/user_setting_delete.php @@ -38,26 +38,29 @@ else { $language = new text; $text = $language->get(); -//get the variables - if (count($_GET)>0) { - $id = check_str($_GET["id"]); - $user_uuid = check_str($_GET["user_uuid"]); - } +//delete user settings + $user_setting_uuids = $_REQUEST["id"]; + $user_uuid = check_str($_REQUEST["user_uuid"]); -//delete the record - if (strlen($id) > 0) { - //delete user_setting + if (sizeof($user_setting_uuids) > 0) { + foreach ($user_setting_uuids as $user_setting_uuid) { $sql = "delete from v_user_settings "; - $sql .= "where user_uuid = '$user_uuid' "; - $sql .= "and user_setting_uuid = '$id' "; + $sql .= "where user_uuid = '".$user_uuid."' "; + $sql .= "and user_setting_uuid = '".$user_setting_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - unset($sql); + unset ($prep_statement, $sql); + } + // set message + $_SESSION["message"] = $text['message-delete'].": ".sizeof($user_setting_uuids); + } + else { + // set message + $_SESSION["message"] = $text['message-delete_failed']; + $_SESSION["message_mood"] = "negative"; } -//redirect the user - $_SESSION["message"] = $text['message-delete']; - header("Location: usersupdate.php?id=".$user_uuid); - return; + header("Location: usersupdate.php?id=".check_str($_REQUEST["user_uuid"])); + exit; ?> \ No newline at end of file diff --git a/core/users/user_settings.php b/core/users/user_settings.php index ce255112fb..a47f0cde5d 100644 --- a/core/users/user_settings.php +++ b/core/users/user_settings.php @@ -34,15 +34,12 @@ else { exit; } +//toggle setting enabled + if (sizeof($_REQUEST) > 1) { + $user_uuid = check_str($_REQUEST["user_id"]); + $user_setting_uuids = $_REQUEST["id"]; + $enabled = check_str($_REQUEST['enabled']); -if (sizeof($_REQUEST) > 1) { - - $action = check_str($_REQUEST["action"]); - $user_uuid = check_str($_REQUEST["user_id"]); - $user_setting_uuids = $_REQUEST["id"]; - $enabled = check_str($_REQUEST['enabled']); - - //change enabled value if ($user_uuid != '' && sizeof($user_setting_uuids) == 1 && $enabled != '') { $sql = "update v_user_settings set "; $sql .= "user_setting_enabled = '".$enabled."' "; @@ -56,35 +53,7 @@ if (sizeof($_REQUEST) > 1) { header("Location: usersupdate.php?id=".$user_uuid); exit; } - - //delete user settings - if ($action == 'delete' && permission_exists('user_setting_delete')) { - //add multi-lingual support - $language = new text; - $text = $language->get(); - - if (sizeof($user_setting_uuids) > 0) { - foreach ($user_setting_uuids as $user_setting_uuid) { - $sql = "delete from v_user_settings "; - $sql .= "where user_setting_uuid = '".$user_setting_uuid."' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset ($prep_statement, $sql); - } - // set message - $_SESSION["message"] = $text['message-delete'].": ".sizeof($user_setting_uuids); - } - else { - // set message - $_SESSION["message"] = $text['message-delete_failed']; - $_SESSION["message_mood"] = "negative"; - } - - header("Location: usersupdate.php?id=".check_str($_REQUEST["user_uuid"])); - exit; - } - -} //REQUEST + } //include the paging require_once "resources/paging.php"; @@ -94,8 +63,7 @@ if (sizeof($_REQUEST) > 1) { $order = check_str($_GET["order"]); //show the content - echo "
"; - echo ""; + echo ""; echo ""; //prepare to page the results @@ -187,7 +155,7 @@ if (sizeof($_REQUEST) > 1) { echo "".$v_link_label_add.""; } if (permission_exists('user_setting_delete')) { - echo "".$v_link_label_delete.""; + echo "".$v_link_label_delete.""; } echo "\n"; echo "\n"; @@ -246,7 +214,7 @@ if (sizeof($_REQUEST) > 1) { echo "$v_link_label_edit"; } if (permission_exists('user_setting_delete')) { - echo "$v_link_label_delete"; + echo "$v_link_label_delete"; } echo " \n"; echo "\n"; @@ -267,7 +235,7 @@ if (sizeof($_REQUEST) > 1) { echo "$v_link_label_add"; } if (permission_exists('user_setting_delete') && $result_count > 0) { - echo "".$v_link_label_delete.""; + echo "".$v_link_label_delete.""; } echo " \n"; echo " \n";