. // display the threads in a forum. require_once('../inc/util.inc'); require_once('../inc/time.inc'); require_once('../inc/forum.inc'); require_once('../inc/pm.inc'); check_get_args(array("id", "sort", "start")); $id = get_int("id"); $sort_style = get_int("sort", true); $start = get_int("start", true); if (!$start) $start = 0; $forum = BoincForum::lookup_id($id); if (!$forum) error_page("forum ID not found"); $user = get_logged_in_user(false); BoincForumPrefs::lookup($user); if (DISABLE_FORUMS && !is_admin($user)) { error_page("Forums are disabled"); } if (!is_forum_visible_to_user($forum, $user)) { if ($user) { remove_subscriptions_forum($user->id, $id); } error_page(tra("Not visible to you")); } if (!$sort_style) { // get the sort style either from the logged in user or a cookie if ($user){ $sort_style = $user->prefs->forum_sorting; } else { list($sort_style, $thread_style) = parse_forum_cookie(); } } else { // set the sort style if ($user){ $user->prefs->forum_sorting = $sort_style; $user->prefs->update("forum_sorting=$sort_style"); } else { list($old_style, $thread_style) = parse_forum_cookie(); send_cookie( 'sorting', implode("|", array($sort_style, $thread_style)), true ); } } switch ($forum->parent_type) { case 0: $category = BoincCategory::lookup_id($forum->category); if ($category->is_helpdesk) { page_head(tra("Questions and Answers").' : '.$forum->title); } else { page_head(tra("Message boards").' : '.$forum->title); } show_forum_header($user); show_forum_title($category, $forum, NULL); break; case 1: $team = BoincTeam::lookup_id($forum->category); page_head(tra("Team message board for %1", "id>$team->name")); show_forum_header($user); show_team_forum_title($forum); break; } echo '
"; show_forum($forum, $start, $sort_style, $user); echo "
".
tra("This message board is available as an %1RSS feed%2", "id&setup=1>", " ");
page_tail();
// This function shows the threads for the given forum
// Starting from $start,
// using the given $sort_style (as defined in forum.php)
// and using the features for the logged in user in $user.
//
function show_forum($forum, $start, $sort_style, $user) {
$page_nav = page_links(
"forum_forum.php?id=$forum->id&sort=$sort_style",
$forum->threads,
THREADS_PER_PAGE,
$start
);
echo $page_nav;
start_forum_table(array(
"",
tra("Threads"),
tra("Posts"),
tra("Author"),
tra("Views"),
"