summaryrefslogtreecommitdiff
path: root/thread.php
diff options
context:
space:
mode:
Diffstat (limited to 'thread.php')
-rw-r--r--thread.php17
1 files changed, 4 insertions, 13 deletions
diff --git a/thread.php b/thread.php
index 9c43217..3a65114 100644
--- a/thread.php
+++ b/thread.php
@@ -19,24 +19,15 @@ if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
<body>
<?php include_once 'templates/header.php';?>
<h1><?php echo $current->subject; ?></h1>
- created by <b><?php echo '$current->user->name'; ?></b>
+ created by <b><?php echo $current->author->name; ?></b>
in <b><?php echo $current->category->name; ?></b>
<abbr title="<?php echo date('M d, Y g:ia', strtotime($current->date_created));?>">3 days ago</abbr>
<hr>
<?php
- include_once 'includes/functions_display.php';
+ $posts = $current->get_posts($dbc);
- $sql = "SELECT post_id, post_content, post_date, post_author, user_id, user_name FROM posts LEFT JOIN users ON post_author = user_id WHERE post_thread = " . mysqli_real_escape_string($dbc, $_GET['id']);
- $result = mysqli_query($dbc, $sql);
-
- if (!$result) {
- die('Error trying to display posts: ' . mysqli_error($dbc));
- }
-
- if (mysqli_num_rows($result) == 0) {
- echo '<section>This thread has no posts</section>';
- } else {
- display_posts($dbc, $_GET['id'], $result);
+ foreach ($posts as $post) {
+ $post->display_content();
}
?>
</body>