2003-07-18 21:38:51 +00:00
|
|
|
<?php
|
|
|
|
require_once('../include.php');
|
|
|
|
require_once('forum.inc');
|
|
|
|
require_once('../util.inc');
|
|
|
|
|
2003-07-24 22:56:20 +00:00
|
|
|
if (!empty($_GET['thread']) && !empty($_POST['content'])) {
|
|
|
|
$_GET['thread'] = stripslashes(strip_tags($_GET['thread']));
|
|
|
|
|
|
|
|
if (!empty($_GET['post'])) {
|
|
|
|
$parent_post = $_GET['post'];
|
|
|
|
} else {
|
|
|
|
$parent_post = NULL;
|
|
|
|
}
|
2003-07-18 21:38:51 +00:00
|
|
|
|
|
|
|
//$user = getUserByAuth($_SESSION['authenticator']);
|
|
|
|
$user = get_logged_in_user(true);
|
|
|
|
|
2003-07-24 22:56:20 +00:00
|
|
|
$thread = getThread($_GET['thread']);
|
|
|
|
$thread->reply($user->id, $_POST['content'], $parent_post);
|
2003-07-18 21:38:51 +00:00
|
|
|
|
|
|
|
header('Location: thread.php?id='.$thread->id);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($_SESSION['authenticator']))
|
2003-07-24 22:56:20 +00:00
|
|
|
get_logged_in_user(true, '../');
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2003-07-24 22:56:20 +00:00
|
|
|
|
2003-07-18 21:38:51 +00:00
|
|
|
doHeader('Forum');
|
|
|
|
|
2003-07-24 22:56:20 +00:00
|
|
|
if (!empty($_GET['post'])) {
|
|
|
|
$postId = $_GET['post'];
|
|
|
|
} else {
|
|
|
|
$postId = -1;
|
|
|
|
}
|
|
|
|
$thread = getThread($_GET['thread']);
|
2003-07-18 21:38:51 +00:00
|
|
|
$forum = getForum($thread->forum);
|
2003-07-24 22:56:20 +00:00
|
|
|
|
|
|
|
$logged_in_user = get_logged_in_user(true);
|
|
|
|
|
2003-07-18 21:38:51 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<span class="title"><?php echo $thread->title ?></span>
|
|
|
|
<br><a href="index.php"><?php echo $cfg['sitename'] ?> Forum</a> -> <a href="forum.php?id=<?php echo $forum->id ?>"><?php echo $forum->title ?></a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p style="text-align:center">
|
|
|
|
<table class="content" border="0" cellpadding="5" cellspacing="0" width="100%">
|
|
|
|
<tr>
|
|
|
|
<th style="width: 150px">Author</th>
|
|
|
|
<th>Message</th>
|
|
|
|
</tr>
|
|
|
|
<?php
|
2003-07-24 22:56:20 +00:00
|
|
|
if ($post != -1) {
|
|
|
|
|
|
|
|
}
|
2003-07-18 21:38:51 +00:00
|
|
|
$posts = $thread->getPosts();
|
|
|
|
while ($post = getNextPost($posts)):
|
|
|
|
$user = getUser($post->user);
|
|
|
|
?>
|
|
|
|
<tr style="vertical-align:top">
|
|
|
|
<td>
|
|
|
|
<p style="font-weight:bold">
|
2003-07-24 22:56:20 +00:00
|
|
|
<?php if ($user->has_profile) { ?>
|
2003-07-18 21:38:51 +00:00
|
|
|
<a href="../view_profile.php?userid=<?php echo $post->user ?>"><?php echo $user->name ?></a>
|
2003-07-24 22:56:20 +00:00
|
|
|
<?php } else { echo $user->name; } ?>
|
2003-07-18 21:38:51 +00:00
|
|
|
</p>
|
|
|
|
<p style="font-size:8pt">
|
|
|
|
Joined: <?php echo date('M j, Y', $user->create_time) ?>
|
|
|
|
<br>Posts: <?php echo $user->posts ?>
|
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
<td>
|
2003-07-24 22:56:20 +00:00
|
|
|
<p style="font-size:8pt">Posted: <?php echo date('D M j, Y g:i a', $post->timestamp) ?></p>
|
|
|
|
<p><?php echo nl2br(stripslashes($post->content)) ?></p>
|
|
|
|
</td>
|
|
|
|
<?php if ($post->id == $postId) {
|
|
|
|
show_message_row($thread, $post);
|
|
|
|
} ?>
|
|
|
|
|
|
|
|
<?php endwhile;
|
|
|
|
|
|
|
|
if ($postId == -1) {
|
|
|
|
show_message_row($thread, $post);
|
|
|
|
} ?>
|
2003-07-18 21:38:51 +00:00
|
|
|
</table>
|
2003-07-24 22:56:20 +00:00
|
|
|
</p>
|
2003-07-18 21:38:51 +00:00
|
|
|
|
|
|
|
<?php
|
|
|
|
doFooter();
|
|
|
|
?>
|
2003-07-24 22:56:20 +00:00
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
function show_message_row($thread, $post = NULL) {
|
|
|
|
global $logged_in_user;
|
|
|
|
|
|
|
|
echo "
|
|
|
|
<a name=\"input\"></a>
|
|
|
|
<tr class = \"row1\" style=\"vertical-align:top\">
|
|
|
|
<td>
|
|
|
|
<p style=\"font-weight:bold\">
|
|
|
|
";
|
|
|
|
|
|
|
|
if ($logged_in_user->has_profile) {
|
|
|
|
echo "<a href=\"../view_profile.php?userid=", $logged_in_user->id, "\">", $logged_in_user->name, "</a>";
|
|
|
|
} else {
|
|
|
|
echo $logged_in_user->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "
|
|
|
|
</p>
|
|
|
|
<p style=\"font-size:8pt\">
|
|
|
|
Joined: ", date('M j, Y', $logged_in_user->create_time), "
|
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<p style=\"font-size:8pt\">Your Message</p>
|
|
|
|
<form action='reply.php?thread=", $thread->id;
|
|
|
|
|
|
|
|
if ($post) {
|
|
|
|
echo "&post=", $post->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "' method=\"post\">
|
|
|
|
<textarea name=\"content\" rows=\"12\" cols=\"54\"></textarea><p>
|
|
|
|
<input type=\"submit\" value=\"Post reply\"></p>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
|
|
|
|
echo "</td></tr>";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|