From 7c3f2e348c015ea93563d866f89ec8cea9159ea0 Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Sat, 24 Apr 2021 09:40:20 -0600 Subject: Refactoring part 2 Starting to move some functionality such as the session and database connection into singleton classes to manage them. Functions for modifying posts and threads are being put in one place as well. --- moderate.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'moderate.php') diff --git a/moderate.php b/moderate.php index afeefa1..3b8d05d 100644 --- a/moderate.php +++ b/moderate.php @@ -1,25 +1,22 @@ get_by_id($_SESSION['user_id'], $dbc); - if ($user->level > 0) { + $user = Session::get()->get_current_user(); + + if ($user->level == USER_LEVEL_MODERATOR) { if (strcasecmp($delete, "on") == 0) { - delete_thread($dbc, $thread_id); + $thread = new Thread(); + $thread->get_from_database($thread_id, $dbc); + delete_thread($thread); header("Location: /"); exit(); -- cgit v1.2.3