2003-07-18 21:38:51 +00:00
|
|
|
<?php
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once('../inc/forum.inc');
|
|
|
|
require_once('../inc/util.inc');
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2004-12-27 03:42:11 +00:00
|
|
|
db_init();
|
|
|
|
|
2005-04-28 09:32:22 +00:00
|
|
|
$threadid = get_int('id');
|
|
|
|
$sort_style = get_str('sort', true);
|
|
|
|
$filter = get_str('filter', true);
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2004-10-25 22:04:15 +00:00
|
|
|
if ($filter != "false"){
|
|
|
|
$filter = true;
|
|
|
|
} else {
|
|
|
|
$filter = false;
|
2003-07-30 00:51:44 +00:00
|
|
|
}
|
|
|
|
|
2005-04-28 09:32:22 +00:00
|
|
|
$thread = getThread($threadid);
|
2005-03-23 03:04:56 +00:00
|
|
|
if (!$thread) {
|
2005-04-28 09:32:22 +00:00
|
|
|
error_page("No such thread found");
|
2005-03-23 03:04:56 +00:00
|
|
|
}
|
2003-08-14 00:56:20 +00:00
|
|
|
incThreadViews($thread->id);
|
2003-07-18 21:38:51 +00:00
|
|
|
|
|
|
|
$forum = getForum($thread->forum);
|
2003-08-13 22:08:12 +00:00
|
|
|
$category = getCategory($forum->category);
|
|
|
|
|
|
|
|
$logged_in_user = get_logged_in_user(false);
|
2004-09-04 23:37:49 +00:00
|
|
|
$logged_in_user = getForumPreferences($logged_in_user);
|
2004-01-19 01:12:53 +00:00
|
|
|
|
2005-01-09 21:52:22 +00:00
|
|
|
$title = cleanup_title($thread->title);
|
2003-08-13 22:08:12 +00:00
|
|
|
if ($category->is_helpdesk) {
|
2005-01-09 09:33:06 +00:00
|
|
|
if (!$sort_style) {
|
|
|
|
$sort_style = getSortStyle($logged_in_user,"answer");
|
|
|
|
} else {
|
|
|
|
setSortStyle($logged_in_user,"answer", $sort_style);
|
|
|
|
}
|
2005-01-18 19:56:18 +00:00
|
|
|
page_head($title);
|
2003-08-01 20:30:25 +00:00
|
|
|
} else {
|
2005-01-09 09:33:06 +00:00
|
|
|
if (!$sort_style) {
|
|
|
|
$sort_style = getSortStyle($logged_in_user,"thread");
|
|
|
|
} else {
|
|
|
|
setSortStyle($logged_in_user,"thread", $sort_style);
|
|
|
|
}
|
|
|
|
if ($logged_in_user->jump_to_unread){
|
2005-01-18 19:56:18 +00:00
|
|
|
page_head($title, 'jumpToUnread();');
|
2005-03-10 11:29:55 +00:00
|
|
|
echo "<link href=\"forum_forum.php?id=".$forum->id."\" rel=\"up\" title=\"".$forum->title."\">";
|
2005-01-09 09:33:06 +00:00
|
|
|
} else {
|
2005-01-18 19:56:18 +00:00
|
|
|
page_head($title);
|
2005-03-10 11:29:55 +00:00
|
|
|
echo "<link href=\"forum_forum.php?id=".$forum->id."\" rel=\"up\" title=\"".$forum->title."\">";
|
2005-01-09 09:33:06 +00:00
|
|
|
}
|
2003-08-01 20:30:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Constant for default sort style and filter values.
|
|
|
|
if ($sort_style == NULL) {
|
2003-12-08 07:36:43 +00:00
|
|
|
$sort_style = "timestamp";
|
2003-08-01 20:30:25 +00:00
|
|
|
}
|
|
|
|
|
2003-07-26 00:19:41 +00:00
|
|
|
$is_subscribed = false;
|
|
|
|
|
|
|
|
if ($logged_in_user) {
|
2003-12-07 19:29:56 +00:00
|
|
|
$result = mysql_query("SELECT * FROM subscriptions WHERE userid = " . $logged_in_user->id . " AND threadid = " . $thread->id);
|
2003-07-26 00:19:41 +00:00
|
|
|
if ($result) {
|
2003-08-13 22:08:12 +00:00
|
|
|
$is_subscribed = (mysql_num_rows($result) > 0);
|
2003-07-26 00:19:41 +00:00
|
|
|
}
|
|
|
|
}
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2003-12-07 19:29:56 +00:00
|
|
|
show_forum_title($forum, $thread, $category->is_helpdesk);
|
2003-08-22 19:09:32 +00:00
|
|
|
|
2005-04-28 09:32:22 +00:00
|
|
|
if (($thread->hidden) && (!isSpecialUser($logged_in_user,0))) {
|
|
|
|
/* If the user logged in is a moderator, show him the
|
|
|
|
+ * thread if he goes so far as to name it by ID like this.
|
|
|
|
+ * Otherwise, hide the thread.
|
|
|
|
+ */
|
|
|
|
error_page("This thread has been hidden for administrative purposes");
|
2003-08-13 22:08:12 +00:00
|
|
|
} else {
|
2005-02-13 21:33:02 +00:00
|
|
|
|
|
|
|
echo "
|
|
|
|
<form action=\"forum_thread.php\">
|
|
|
|
<input type=\"hidden\" name=\"id\" value=\"", $thread->id, "\">
|
|
|
|
<table width=\"100%\" cellspacing=0 cellpadding=0>
|
|
|
|
<tr>
|
|
|
|
<td align=\"left\">
|
|
|
|
";
|
|
|
|
|
|
|
|
$link = "<a href=\"forum_reply.php?thread=" . $thread->id;
|
|
|
|
if ($category->is_helpdesk) {
|
|
|
|
$link = $link . "&helpdesk=1#input\">Answer this question";
|
|
|
|
} else {
|
|
|
|
$link = $link . "#input\">Reply to this thread";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $link, "</a><br>";
|
|
|
|
|
|
|
|
if ($is_subscribed) {
|
|
|
|
if ($category->is_helpdesk) {
|
|
|
|
echo "You are subscribed to this question. ";
|
|
|
|
} else {
|
|
|
|
echo "You are subscribed to this thread. ";
|
|
|
|
}
|
|
|
|
echo "<a href=\"forum_subscribe.php?action=unsubscribe&thread=$thread->id\">Click here to unsubscribe</a>.";
|
|
|
|
} else {
|
|
|
|
if ($category->is_helpdesk) {
|
|
|
|
echo "<a href=\"forum_subscribe.php?action=subscribe&thread=$thread->id\">Subscribe to this question</a>";
|
|
|
|
} else {
|
|
|
|
echo "<a href=\"forum_subscribe.php?action=subscribe&thread=$thread->id\">Subscribe to this thread</a>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isSpecialUser($logged_in_user,0)){ //If logged in users is moderator
|
2005-04-20 21:11:20 +00:00
|
|
|
echo "<br /><a href=\"forum_moderate_thread.php?action=hide&thread=$thread->id\">Delete this thread</a>";
|
|
|
|
if($thread->sticky)
|
|
|
|
{ echo "<br /><a href=\"forum_moderate_thread_action.php?action=desticky&thread=$thread->id\">De-sticky this thread</a>"; }
|
|
|
|
else
|
|
|
|
{ echo "<br /><a href=\"forum_moderate_thread_action.php?action=sticky&thread=$thread->id\">Make this thread sticky</a>"; }
|
2005-02-13 21:33:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo "</td>";
|
|
|
|
|
|
|
|
echo "<td align=right style=\"border:0px\">";
|
|
|
|
if ($category->is_helpdesk) {
|
|
|
|
show_select_from_array("sort", $answer_sort_styles, $sort_style);
|
|
|
|
} else {
|
|
|
|
echo "Sort ";
|
|
|
|
show_select_from_array("sort", $thread_sort_styles, $sort_style);
|
|
|
|
//show_select_from_array("filter", $thread_filter_styles, $filter_min);
|
|
|
|
}
|
|
|
|
echo "<input type=submit value=OK>\n</td>";
|
|
|
|
|
|
|
|
echo "</tr>\n</table>\n</form>\n";
|
|
|
|
|
|
|
|
if ($category->is_helpdesk) {
|
|
|
|
$headings = array("Author", "Question");
|
|
|
|
} else {
|
|
|
|
$headings = array("Author", "Message");
|
|
|
|
}
|
|
|
|
|
|
|
|
start_forum_table($headings);
|
|
|
|
show_posts($thread, $sort_style, $filter, true, true, $category->is_helpdesk);
|
|
|
|
end_forum_table();
|
|
|
|
|
|
|
|
echo "<p>";
|
|
|
|
|
|
|
|
$link = "<a href=\"forum_reply.php?thread=" . $thread->id;
|
|
|
|
if ($category->is_helpdesk) {
|
|
|
|
$link = $link . "&helpdesk=1#input\">Answer this question";
|
|
|
|
} else {
|
|
|
|
$link = $link . "#input\">Reply to this thread";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $link, "</a><br>\n</p>";
|
|
|
|
show_forum_title($forum, $thread, $category->is_helpdesk);
|
2003-08-13 22:08:12 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-08-15 01:01:00 +00:00
|
|
|
page_tail();
|
2003-07-21 22:02:20 +00:00
|
|
|
?>
|