diff options
Diffstat (limited to 'viewthread.php')
-rw-r--r-- | viewthread.php | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/viewthread.php b/viewthread.php index 12b9429..eb1698d 100644 --- a/viewthread.php +++ b/viewthread.php @@ -1,5 +1,7 @@ <?php -include_once 'includes/model/Thread.php'; +include_once './includes/model/User.php'; +include_once './includes/model/Thread.php'; +include_once './includes/model/Post.php'; session_start(); @@ -18,28 +20,22 @@ if (!$current->has_value()) { ?> <!DOCTYPE html> <html lang="en"> -<head> - <title><?= $current->subject; ?> - cflip.net forum</title> - <link rel="stylesheet" href="styles/style.css"> -</head> -<body> -<?php include('includes/templates/header.php'); ?> -<h1><?= $current->subject; ?></h1> -created by <b><?= $current->author->name; ?></b> -in <b><?= $current->category->name; ?></b> -<abbr title="<?= date('M d, Y g:ia', strtotime($current->date_created)); ?>">3 days ago</abbr> -<?php -include_once './includes/model/User.php'; - -if (Session::get()->is_signed_in()) { - $user = Session::get()->get_current_user(); - - if ($user->level == USER_LEVEL_MODERATOR) { - echo ' + <head> + <title><?= $current->subject; ?> - cflip.net forum</title> + <link rel="stylesheet" href="styles/style.css"> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + </head> + <body> +<?php include_once 'includes/templates/header.php'; ?> + <h1><?= $current->subject; ?></h1> + created by <b><?= $current->author->name; ?></b> + in <b><?= $current->category->name; ?></b>, <?= date('M d, Y g:ia', strtotime($current->date_created)); ?> +<?php if (Session::get()->is_signed_in() and Session::get()->get_current_user()->level == USER_LEVEL_MODERATOR): ?> <form action="moderate.php" method="post"> <p> <b>Moderator Options</b> - <input type="hidden" name="id" value="' . $current->id . '"> + <input type="hidden" name="id" value="<?= $current->id ?>"> <input type="checkbox" id="delete" name="delete"> <label for="delete">Delete thread</label> <input type="checkbox" id="lock" name="lock"> @@ -49,22 +45,15 @@ if (Session::get()->is_signed_in()) { <input type="submit" value="Update thread"> </p> </form> - '; - } -} -?> -<hr> -<?php -include_once './includes/model/Post.php'; - -$posts = $current->get_posts(); - -foreach ($posts as $post) { +<?php endif ?> + <hr> +<?php +foreach ($current->get_posts() as $post) { echo $post->get_content(); -} +} ?> -<hr> -<h2>Reply to this thread</h2> + <hr> + <h2>Reply to this thread</h2> <?php include_once 'includes/error.php'; @@ -84,10 +73,10 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { } } ?> -<form method="post"> - <textarea name="post_content" rows="10" cols="50"></textarea> - <br> - <input type="submit" name="submit"> -</form> -</body> + <form method="post"> + <textarea name="post_content" rows="10" cols="50"></textarea> + <br> + <input type="submit" name="submit"> + </form> + </body> </html> |