summaryrefslogtreecommitdiff
path: root/create_thread.php
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-06-05 11:18:10 -0600
committercflip <36554078+cflip@users.noreply.github.com>2021-06-05 11:18:10 -0600
commit24efe49bc2b545e3a3e46d7d6f2bd1166163e52b (patch)
treec1852447d06c062052def6fc89be2e2dece17c78 /create_thread.php
parent45acfc48b3dd80b945a1501edea9ad4faa700c0f (diff)
Move object related functions into their classes.
Some of the pages are still broken from this commit, but I plan to either rewrite or ignore them.
Diffstat (limited to 'create_thread.php')
-rw-r--r--create_thread.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/create_thread.php b/create_thread.php
index 976bd9f..3d1c530 100644
--- a/create_thread.php
+++ b/create_thread.php
@@ -21,10 +21,9 @@ if (!Session::get()->is_signed_in()) {
<input type="text" name="thread_subject"><br>
<label for="thread_cat">Category: </label><br>
<?php
- include_once './includes/functions_category.php';
include_once './includes/model/Category.php';
- $categories = get_all_categories();
+ $categories = Category::get_all_categories();
if (count($categories) == 0) {
trigger_error('There are no categories to post to!');
@@ -43,9 +42,9 @@ if (!Session::get()->is_signed_in()) {
<input type="submit" name="submit">
</form>
<?php
-include_once 'includes/functions_post.php';
-include_once 'includes/functions_thread.php';
-include_once 'includes/error.php';
+include_once './includes/model/Post.php';
+include_once './includes/model/Thread.php';
+include_once './includes/error.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$post_content = filter_input(INPUT_POST, 'post_content', FILTER_SANITIZE_STRING);
@@ -68,8 +67,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$errstr .= '</ul>';
trigger_error($errstr);
} else {
- $thread_id = create_thread($thread_subject, $thread_cat);
- create_post($post_content, $thread_id, $thread_cat);
+ $thread_id = Thread::create($thread_subject, $thread_cat);
+ Post::create($post_content, $thread_id, $thread_cat);
header("Location: viewthread.php?id=" . $thread_id);
}