Exemplo n.º 1
0
}
$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 ($temp_sort_style) {
    $sort_style = $temp_sort_style;
} else {
    if ($sort_style) {
        $forum_style = 0;
        // this is deprecated
        if ($logged_in_user) {
            $logged_in_user->prefs->thread_sorting = $sort_style;
            $logged_in_user->prefs->update("thread_sorting={$sort_style}");
        } else {
Exemplo n.º 2
0
$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}");