"; exit(); } $_GET['id'] = stripslashes(strip_tags($_GET['id'])); $sort_style = $_GET['sort']; $filter_min = $_GET['filter']; if ($filter_min == NULL || $filter_min < -2 || $filter_min > 2) { $filter_min = -2; } $thread = getThread($_GET['id']); incThreadViews($thread->id); $forum = getForum($thread->forum); $category = getCategory($forum->category); $logged_in_user = get_logged_in_user(false); // TODO: Make these more specific. if ($category->is_helpdesk) { page_head('Help Desk', $logged_in_user); $sort_style = 'rating-high'; } else { page_head('Forum', $logged_in_user); } // TODO: Constant for default sort style and filter values. if ($sort_style == NULL) { $sort_style = "date-old"; } $is_subscribed = false; if ($logged_in_user) { $result = mysql_query("SELECT * FROM subscriptions WHERE userid = " . $logged_in_user->id . " AND threadid = " . $thread->id); if ($result) { $is_subscribed = (mysql_num_rows($result) > 0); } } show_forum_title($forum, $thread, $category->is_helpdesk); echo "
"; if (!$category->is_helpdesk) { echo ""; } echo "\n
"; $link = "id; if ($category->is_helpdesk) { $link = $link . "&helpdesk=1#input>Answer this question"; } else { $link = $link . "#input>Reply to this thread"; } echo $link, "
"; if ($is_subscribed) { if ($category->is_helpdesk) { echo "You are subscribed to this question. "; } else { echo "You are subscribed to this thread. "; } echo "id>Click here to unsubscribe."; } else { if ($category->is_helpdesk) { echo "id>Subscribe to this question"; } else { echo "id>Subscribe to this thread"; } } echo "
Sort / Filter "; show_combo_from_array("sort", $thread_sort_styles, $sort_style); show_combo_from_array("filter", $thread_filter_styles, $filter_min); echo "\n
\n
\n"; if ($category->is_helpdesk) { $headings = array("Author", "Question"); } else { $headings = array("Author", "Message"); } start_forum_table($headings); show_posts($thread, $sort_style, $filter_min, true, true, $category->is_helpdesk); end_forum_table(); echo "

"; $link = "id; if ($category->is_helpdesk) { $link = $link . "&helpdesk=1#input>Answer this question"; } else { $link = $link . "#input>Reply to this thread"; } echo $link, "
\n

"; page_tail(); ?>