. // display the contents of a thread. require_once('../inc/util.inc'); require_once('../inc/forum.inc'); require_once('../inc/news.inc'); check_get_args(array("id", "sort", "nowrap", "filter")); $threadid = get_int('id'); $sort_style = get_int('sort', true); $nowrap = get_str('nowrap', true); $filter = get_str('filter', true); if ($filter != "false"){ $filter = true; } else { $filter = false; } $logged_in_user = get_logged_in_user(false); $tokens = ""; if ($logged_in_user) { BoincForumPrefs::lookup($logged_in_user); $tokens = url_tokens($logged_in_user->authenticator); } if ($threadid < 1) { error_page(tra("Invalid thread ID!")); } $thread = BoincThread::lookup_id($threadid); $forum = BoincForum::lookup_id($thread->forum); if (!$thread) { error_page("Bad thread ID"); } if (!is_forum_visible_to_user($forum, $logged_in_user)) { if ($logged_in_user) { remove_subscriptions_forum($logged_in_user->id, $forum->id); } error_page(tra("This forum is not visible to you.")); } if ($thread->hidden) { if (!is_moderator($logged_in_user, $forum)) { if ($logged_in_user) { remove_subscriptions_forum($logged_in_user->id, $thread->id); } error_page( tra("This thread has been hidden by moderators") ); } } $title = cleanup_title($thread->title); if (!$sort_style) { // get the sorting style from the user or a cookie if ($logged_in_user){ $sort_style = $logged_in_user->prefs->thread_sorting; } else if (array_key_exists('sorting', $_COOKIE)) { list($forum_style, $sort_style) = explode("|",$_COOKIE['sorting']); } } else { if ($logged_in_user){ $logged_in_user->prefs->thread_sorting = $sort_style; $logged_in_user->prefs->update("thread_sorting=$sort_style"); $forum_style = 0; // I guess this is deprecated } else if (array_key_exists('sorting', $_COOKIE)) { list($forum_style, $old_style) = explode("|", $_COOKIE['sorting']); } send_cookie('sorting', implode("|", array($forum_style, $sort_style)), true ); } if ($logged_in_user && $logged_in_user->prefs->jump_to_unread){ page_head($title, 'jumpToUnread();'); } else { page_head($title); } echo "id."\" rel=\"up\" title=\"".$forum->title."\">"; $is_subscribed = $logged_in_user && BoincSubscription::lookup($logged_in_user->id, $thread->id); show_forum_header($logged_in_user); echo "
"; switch ($forum->parent_type) { case 0: $category = BoincCategory::lookup_id($forum->category); show_forum_title($category, $forum, $thread); break; case 1: show_team_forum_title($forum, $thread); break; } if ($forum->parent_type == 0) { if ($category->is_helpdesk && !$thread->status){ if ($logged_in_user){ if ($thread->owner == $logged_in_user->id){ if ($thread->replies !=0) { // Show a "this question has been answered" to the author echo "
"; show_button( "forum_thread_status.php?id=$thread->id&action=set", tra("My question was answered"), tra("Click here if your question has been adequately answered") ); } } else { // and a "I also got this question" to everyone else echo "
"; show_button( "forum_thread_vote.php?id=$thread->id", tra("I've also got this question"), tra("I've also got this question") ); } } } } echo "
"; // Here is where the actual thread begins. $headings = array(array(tra("Author"),"authorcol"), array(tra("Message"),"")); start_forum_table($headings, "id=\"thread\" cellspacing=0"); show_posts( $thread, $forum, $sort_style, $filter, $logged_in_user, $nowrap, true ); end_table(); if ($reply_url) { show_button( $reply_url, tra("Post to thread"), tra("Add a new message to this thread") ); } echo "
"; switch ($forum->parent_type) { case 0: show_forum_title($category, $forum, $thread); break; case 1: show_team_forum_title($forum, $thread); break; } $thread->update("views=views+1"); page_tail(); $cvs_version_tracker[]="\$Id$"; ?>