diff options
Diffstat (limited to 'viewthread.php')
-rw-r--r-- | viewthread.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/viewthread.php b/viewthread.php index ae08090..cc2d221 100644 --- a/viewthread.php +++ b/viewthread.php @@ -34,11 +34,10 @@ in <b><?= $current->category->name; ?></b> <?php include_once('includes/model/User.php'); -if (isset($_SESSION['signed_in'])) { - $user = new User(); - $user->get_by_id($_SESSION['user_id'], $dbc); +if (Session::get()->is_signed_in()) { + $user = Session::get()->get_current_user(); - if ($user->level > 0) { + if ($user->level == USER_LEVEL_MODERATOR) { echo ' <form action="moderate.php" method="post"> <p> @@ -75,6 +74,8 @@ foreach ($posts as $post) { </body> </html> <?php +include_once 'includes/functions_post.php'; + if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (!isset($_SESSION['signed_in'])) { echo 'You must be <a href="signin.php">signed in</a> to reply to this thread.'; @@ -87,7 +88,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (empty($post_content) or !$post_content) { echo 'Thread subject cannot be empty'; } else { - insert_post($dbc, $post_content, $current->id, $user_id, $current->category->id); + create_post($post_content, $current->id, $current->category->id); } } ?> |