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. --- create_thread.php | 68 +++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 35 deletions(-) (limited to 'create_thread.php') diff --git a/create_thread.php b/create_thread.php index 4598ce2..534b0ab 100644 --- a/create_thread.php +++ b/create_thread.php @@ -1,63 +1,61 @@ - + - + - Create a thread - cflip.net forum - + Create a thread - cflip.net forum + - +

Create a new thread

signed in to create a thread.'); -} +include_once 'includes/Session.php'; +if (!Session::get()->is_signed_in()) { + trigger_error('You must be signed in to create a thread.'); + exit(); +} ?> -
" method="post"> -
-
-
+" method="post"> +
+
+
'; + if (count($categories) == 0) { + echo 'There are no categories to post to!'; + } else { + echo '
'; + foreach ($categories as $category) { + echo ''; } + + echo '
'; + } ?> -
-
- +
+
+
Date: Sat, 24 Apr 2021 19:40:50 -0600 Subject: Remove all uses of db_inc.php This method of importing the database login every time wasn't very good. Now everything uses the new Database singleton class. --- create_thread.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'create_thread.php') diff --git a/create_thread.php b/create_thread.php index 534b0ab..2ed323d 100644 --- a/create_thread.php +++ b/create_thread.php @@ -20,10 +20,10 @@ if (!Session::get()->is_signed_in()) {

Date: Sun, 25 Apr 2021 17:47:41 -0600 Subject: Reload page after submitting a reply to a thread --- create_thread.php | 1 - 1 file changed, 1 deletion(-) (limited to 'create_thread.php') diff --git a/create_thread.php b/create_thread.php index 2ed323d..6fb7df9 100644 --- a/create_thread.php +++ b/create_thread.php @@ -56,7 +56,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { $thread_id = create_thread($thread_subject, $thread_cat); create_post($post_content, $thread_id, $thread_cat); - header("Location: viewthread.php?id=" . $thread_id); } } -- cgit v1.2.3