Esempio n. 1
0
function create_forum($category, $orderID, $title, $description, $is_dev_blog = 0)
{
    $q = "(category, orderID, title, description, is_dev_blog) values ({$category}, {$orderID}, '{$title}', '{$description}', {$is_dev_blog})";
    $db = BoincDB::get();
    $result = $db->insert("forum", $q);
    if (!$result) {
        $forum = BoincForum::lookup("category={$category} and title='{$title}'");
        if ($forum) {
            return $forum->id;
        }
        echo "can't create forum\n";
        echo $db->base_error();
        exit;
    }
    return $db->insert_id();
}
Esempio n. 2
0
}
if ($user->id == $team->ping_user) {
    $get_from_db = true;
}
// Cache the team record, its forum record, its new members,
// its admins, and its member counts
$cache_args = "teamid={$teamid}";
if (!$get_from_db) {
    $cached_data = get_cached_data(TEAM_PAGE_TTL, $cache_args);
    if ($cached_data) {
        // We found some old but non-stale data, let's use it
        $team = unserialize($cached_data);
    } else {
        $get_from_db = true;
    }
}
if ($get_from_db) {
    $team->nusers = BoincUser::count("teamid={$teamid}");
    $team->nusers_worked = BoincUser::count("teamid={$teamid} and total_credit>0");
    $team->nusers_active = BoincUser::count("teamid={$teamid} and expavg_credit>0.1");
    $team->forum = BoincForum::lookup("parent_type=1 and category={$team->id}");
    $team->new_members = new_member_list($teamid);
    $team->admins = admin_list($teamid);
    $team->founder = BoincUser::lookup_id($team->userid);
    set_cached_data(TEAM_PAGE_TTL, serialize($team), $cache_args);
}
if (!$team) {
    error_page(tra("no such team"));
}
display_team_page($team, $user);
page_tail(true);
Esempio n. 3
0
function show_forum($team)
{
    $forum = BoincForum::lookup("parent_type=1 and category={$team->id}");
    if (!$forum) {
        error_page("team has no forum");
    }
    Header("Location: forum_forum.php?id={$forum->id}");
}
Esempio n. 4
0
    }
    if (strlen($category->name)) {
        echo '
            <tr class="subtitle">
            <td class="category" colspan="4">' . $category->name . '</td>
            </tr>
        ';
    }
    $forums = BoincForum::enum("parent_type=0 and category={$category->id} order by orderID");
    $i = 0;
    foreach ($forums as $forum) {
        show_forum_summary($forum, $i++);
    }
}
if ($user && $user->teamid) {
    $forum = BoincForum::lookup("parent_type=1 and category={$user->teamid}");
    if ($forum) {
        show_forum_summary($forum, $i++);
    }
}
end_table();
if ($user) {
    $subs = BoincSubscription::enum("userid={$user->id}");
    if (count($subs)) {
        echo "<p><span class=title>" . tra("Subscribed threads") . "</span><p>";
        show_thread_and_context_header();
        $i = 0;
        foreach ($subs as $sub) {
            $thread = BoincThread::lookup_id($sub->threadid);
            if (!$thread) {
                BoincSubscription::delete($user->id, $sub->threadid);
Esempio n. 5
0
    if (!$user) {
        echo "No such user\n";
        continue;
    }
    BoincForumPrefs::lookup($user);
    if (!$user->prefs->privilege(S_ADMIN)) {
        echo "User doesn't have admin privileges";
        continue;
    }
    break;
}
$category = BoincCategory::lookup("orderID=0 and is_helpdesk=0");
if (!$category) {
    die("can't find category");
}
$forum = BoincForum::lookup("parent_type=0 and title='{$forum_name}'");
if ($forum) {
    die("News forum already exists");
}
$now = time();
$forum_id = BoincForum::insert("(category, orderID, title, description, timestamp, is_dev_blog, parent_type) values ({$category->id}, -1, '{$forum_name}', '{$forum_desc}', {$now}, 1, 0)");
$forum = BoincForum::lookup_id($forum_id);
foreach (array_reverse($project_news) as $item) {
    $content = $item[1];
    if (isset($item[2])) {
        $title = $item[2];
    } else {
        $n = strpos($content, ". ");
        if ($n) {
            $title = substr($content, 0, $n);
        } else {