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
|
|
|
|
2003-07-18 21:38:51 +00:00
|
|
|
/* sanitize variable */
|
2003-08-14 00:56:20 +00:00
|
|
|
if (empty($_GET['id'])) {
|
|
|
|
// TODO: Standard error page
|
|
|
|
echo "No thread was specified.<br>";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2003-07-18 21:38:51 +00:00
|
|
|
$_GET['id'] = stripslashes(strip_tags($_GET['id']));
|
|
|
|
|
2003-07-30 00:51:44 +00:00
|
|
|
$sort_style = $_GET['sort'];
|
|
|
|
$filter_min = $_GET['filter'];
|
|
|
|
|
|
|
|
if ($filter_min == NULL || $filter_min < -2 || $filter_min > 2) {
|
|
|
|
$filter_min = -2;
|
|
|
|
}
|
|
|
|
|
2003-07-18 21:38:51 +00:00
|
|
|
$thread = getThread($_GET['id']);
|
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
|
|
|
|
2003-08-13 22:08:12 +00:00
|
|
|
if ($category->is_helpdesk) {
|
2004-09-04 23:37:49 +00:00
|
|
|
if (!$sort_style) {
|
|
|
|
$sort_style = getSortStyle($logged_in_user,"answer");
|
|
|
|
} else {
|
|
|
|
setSortStyle($logged_in_user,"answer", $sort_style);
|
|
|
|
}
|
2004-09-05 19:26:27 +00:00
|
|
|
page_head(PROJECT.': Questions and problems');
|
2003-08-01 20:30:25 +00:00
|
|
|
} else {
|
2004-09-04 23:37:49 +00:00
|
|
|
if (!$sort_style) {
|
|
|
|
$sort_style = getSortStyle($logged_in_user,"thread");
|
|
|
|
} else {
|
|
|
|
setSortStyle($logged_in_user,"thread", $sort_style);
|
|
|
|
}
|
2004-09-05 19:26:27 +00:00
|
|
|
page_head(PROJECT.': Message boards');
|
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
|
|
|
|
2003-08-13 22:08:12 +00:00
|
|
|
echo "
|
2004-06-01 22:12:41 +00:00
|
|
|
<form action=forum_thread.php>
|
2003-12-07 19:29:56 +00:00
|
|
|
<input type=hidden name=id value=", $thread->id, ">
|
2003-08-01 20:30:25 +00:00
|
|
|
<table width=100% cellspacing=0 cellpadding=0>
|
2003-12-07 19:29:56 +00:00
|
|
|
<tr>
|
|
|
|
<td align=left>
|
2003-08-13 22:08:12 +00:00
|
|
|
";
|
|
|
|
|
2004-05-30 21:47:11 +00:00
|
|
|
$link = "<a href=forum_reply.php?thread=" . $thread->id;
|
2003-08-22 19:09:32 +00:00
|
|
|
if ($category->is_helpdesk) {
|
|
|
|
$link = $link . "&helpdesk=1#input>Answer this question";
|
|
|
|
} else {
|
2003-08-13 22:08:12 +00:00
|
|
|
$link = $link . "#input>Reply to this thread";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $link, "</a><br>";
|
|
|
|
|
2003-07-26 00:19:41 +00:00
|
|
|
if ($is_subscribed) {
|
2003-08-13 22:08:12 +00:00
|
|
|
if ($category->is_helpdesk) {
|
2003-12-07 19:29:56 +00:00
|
|
|
echo "You are subscribed to this question. ";
|
2003-08-01 20:30:25 +00:00
|
|
|
} else {
|
2003-12-07 19:29:56 +00:00
|
|
|
echo "You are subscribed to this thread. ";
|
2003-08-01 20:30:25 +00:00
|
|
|
}
|
2004-05-30 21:47:11 +00:00
|
|
|
echo "<a href=forum_subscribe.php?action=unsubscribe&thread=$thread->id>Click here to unsubscribe</a>.";
|
2003-07-26 00:19:41 +00:00
|
|
|
} else {
|
2003-08-13 22:08:12 +00:00
|
|
|
if ($category->is_helpdesk) {
|
2004-05-30 21:47:11 +00:00
|
|
|
echo "<a href=forum_subscribe.php?action=subscribe&thread=$thread->id>Subscribe to this question</a>";
|
2003-08-01 20:30:25 +00:00
|
|
|
} else {
|
2004-05-30 21:47:11 +00:00
|
|
|
echo "<a href=forum_subscribe.php?action=subscribe&thread=$thread->id>Subscribe to this thread</a>";
|
2003-08-01 20:30:25 +00:00
|
|
|
}
|
2003-07-26 00:19:41 +00:00
|
|
|
}
|
2003-08-13 22:08:12 +00:00
|
|
|
|
|
|
|
echo "</td>";
|
2003-08-22 19:09:32 +00:00
|
|
|
|
2003-12-08 01:19:49 +00:00
|
|
|
echo "<td align=right style=\"border:0px\">";
|
|
|
|
if ($category->is_helpdesk) {
|
2004-09-04 23:37:49 +00:00
|
|
|
show_select_from_array("sort", $answer_sort_styles, $sort_style);
|
2003-12-08 01:19:49 +00:00
|
|
|
} else {
|
2003-12-10 00:54:17 +00:00
|
|
|
echo "Sort ";
|
2003-12-08 01:19:49 +00:00
|
|
|
show_select_from_array("sort", $thread_sort_styles, $sort_style);
|
2003-12-10 00:54:17 +00:00
|
|
|
//show_select_from_array("filter", $thread_filter_styles, $filter_min);
|
2003-08-13 22:08:12 +00:00
|
|
|
}
|
2003-12-08 01:19:49 +00:00
|
|
|
echo "<input type=submit value=OK>\n</td>";
|
2003-08-13 22:08:12 +00:00
|
|
|
|
|
|
|
echo "</tr>\n</table>\n</form>\n";
|
|
|
|
|
|
|
|
if ($category->is_helpdesk) {
|
|
|
|
$headings = array("Author", "Question");
|
|
|
|
} else {
|
|
|
|
$headings = array("Author", "Message");
|
|
|
|
}
|
|
|
|
|
2003-11-30 21:05:57 +00:00
|
|
|
start_forum_table($headings);
|
2003-08-13 22:08:12 +00:00
|
|
|
show_posts($thread, $sort_style, $filter_min, true, true, $category->is_helpdesk);
|
|
|
|
end_forum_table();
|
|
|
|
|
|
|
|
echo "<p>";
|
|
|
|
|
2004-05-30 21:47:11 +00:00
|
|
|
$link = "<a href=forum_reply.php?thread=" . $thread->id;
|
2003-08-22 19:09:32 +00:00
|
|
|
if ($category->is_helpdesk) {
|
|
|
|
$link = $link . "&helpdesk=1#input>Answer this question";
|
|
|
|
} else {
|
2003-08-13 22:08:12 +00:00
|
|
|
$link = $link . "#input>Reply to this thread";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $link, "</a><br>\n</p>";
|
|
|
|
|
2003-08-15 01:01:00 +00:00
|
|
|
page_tail();
|
2003-07-21 22:02:20 +00:00
|
|
|
?>
|