function cleanup_thread($thread) { $posts = BoincPost::enum("thread={$thread->id}"); foreach ($posts as $post) { $post->delete(); } $thread->delete(); }
} $userid = get_int("userid", true); $user = BoincUser::lookup_id($userid); if (!$user) { xml_error(ERR_DB_NOT_FOUND); } if ($method == "user_posts") { $count = get_int("count", true); if (!$count || $count <= 0 || $count > 50) { $count = 10; } $length = get_int("contentlength", true); if ($length == null || $length <= 0) { $length = 0; } $posts = BoincPost::enum("user={$userid} ORDER BY timestamp DESC LIMIT {$count}"); $realcount = BoincPost::count("user={$userid}"); echo "<rpc_response>\n"; echo "<count>{$realcount}</count>\n"; echo "<posts>\n"; foreach ($posts as $post) { $thread = BoincThread::lookup_id($post->thread); echo "<post>\n"; echo " <id>{$post->id}</id>\n"; echo " <threadid>{$post->thread}</threadid>\n"; echo " <threadtitle><![CDATA[" . $thread->title . "]]></threadtitle>\n"; echo " <timestamp>{$post->timestamp}</timestamp>\n"; if ($length > 0) { echo " <content><![CDATA[" . substr($post->content, 0, $length) . "]]></content>\n"; } else { echo " <content><![CDATA[" . $post->content . "]]></content>\n";
define('SCALAR', 0.9); set_time_limit(0); echo date(DATE_RFC822), ": Starting\n"; $now = time(); $threads = BoincThread::enum(); foreach ($threads as $thread) { $is_helpdesk = false; $forum = BoincForum::lookup_id($thread->forum); if ($forum && $forum->parent_type == 0) { $category = BoincCategory::lookup_id($forum->category); if ($category && $category->is_helpdesk) { $is_helpdesk = true; } } if ($is_helpdesk) { $diff = ($now - $thread->create_time) / 86400; $activity = ($thread->sufferers + 1) / $diff; echo "thread {$thread->id} helpdesk {$diff} {$activity}\n"; } else { $posts = BoincPost::enum("thread={$thread->id}"); $activity = 0; foreach ($posts as $post) { $diff = $now - $post->timestamp; $diff /= 7 * 86400; $activity += pow(2, -$diff); } echo "thread {$thread->id} forum {$activity}\n"; } $thread->update("activity={$activity}"); } echo date(DATE_RFC822), ": Finished\n";
function remove($team) { $forum = BoincForum::lookup("parent_type=1 and category={$team->id}"); if (!$forum) { error_page("not found"); } // delete threads and posts // $threads = BoincThread::enum("forum={$forum->id}"); foreach ($threads as $thread) { $posts = BoincPost::enum("thread={$thread->id}"); foreach ($posts as $post) { $post->delete(); } $thread->delete(); } $forum->delete(); page_head("Message board removed"); page_tail(); }
$threads = BoincThread::enum("{$clause} and status=0 and hidden=0 and sticky=0 order by create_time desc limit {$nitems}"); // Get unix time that last modification was made to the news source // $create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT'; // Now construct header // header("Expires: " . gmdate('D, d M Y H:i:s', time() + 86400) . " GMT"); header("Last-Modified: " . $create_date); header("Content-Type: application/xml"); // Create channel header and open XML content // $description = PROJECT . ": {$forum->description}"; if ($user) { $description .= " (posts by {$user->name})"; } $channel_image = URL_BASE . "rss_image.gif"; $language = "en-us"; echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n\t<rss version=\"2.0\">\n\t<channel>\n\t<title>" . $description . "</title>\n\t<link>" . URL_BASE . "</link>\n\t<description>" . $description . "</description>\n\t<copyright>" . COPYRIGHT_HOLDER . "</copyright>\n\t<lastBuildDate>" . $create_date . "</lastBuildDate>\n\t<language>" . $language . "</language>\n\t<image>\n\t\t<url>" . $channel_image . "</url>\n\t\t<title>" . PROJECT . "</title>\n\t\t<link>" . URL_BASE . "</link>\n\t</image>\n"; // write news items // foreach ($threads as $thread) { $post_date = gmdate('D, d M Y H:i:s', $thread->create_time) . ' GMT'; $unique_url = URL_BASE . "forum_thread.php?id=" . $thread->id; $clause2 = $userid ? "and user={$userid}" : ""; $posts = BoincPost::enum("thread={$thread->id} {$clause2} order by timestamp limit 1"); $post = $posts[0]; echo "<item>\n\t<title>" . strip_tags($thread->title) . "</title>\n\t<link>{$unique_url}</link>\n\t<guid isPermaLink=\"true\">{$unique_url}</guid>\n\t<description>" . substr(strip_tags($post->content), 0, 255) . " . . .</description>\n\t<pubDate>{$post_date}</pubDate>\n</item>\n"; } // Close XML content // echo "\n\t</channel>\n\t</rss>\n";
function remove($team) { $forum = BoincForum::lookup("parent_type=1 and category={$team->id}"); if (!$forum) { error_page("message board not found"); } // delete threads and posts // $threads = BoincThread::enum("forum={$forum->id}"); foreach ($threads as $thread) { $posts = BoincPost::enum("thread={$thread->id}"); foreach ($posts as $post) { $post->delete(); } $thread->delete(); } $forum->delete(); page_head(tra("Message board removed")); echo "<p>" . tra("Your team's message board has been removed. You may now %1create a new one%2.", "<a href=team_forum.php?teamid={$team->id}&cmd=manage>", "</a>") . "</p>"; page_tail(); }
$teamid = $logged_in_user->teamid; if ($teamid) { $team = BoincTeam::lookup_id($teamid); if ($team) { $show_team = true; if (is_team_admin($logged_in_user, $team)) { $show_team_hidden = true; } } else { $teamid = 0; } } } } page_head(tra("Posts by %1", $user->name)); $posts = BoincPost::enum("user={$userid} order by id desc limit 10000"); $n = 0; start_table(); $options = get_output_options($logged_in_user); $show_next = false; foreach ($posts as $post) { $thread = BoincThread::lookup_id($post->thread); if (!$thread) { continue; } $forum = BoincForum::lookup_id($thread->forum); if (!$forum) { continue; } if (!$show_all) { if ($forum->parent_type == 1) {
} $hide = true; $count = 10; $user = lookup_user_id($userid); $logged_in_user = get_logged_in_user(false); if ($logged_in_user = get_logged_in_user(false)) { BoincForumPrefs::lookup($logged_in_user); if ($user->id == $logged_in_user->id || $logged_in_user->prefs->privilege(0)) { $hide = false; } } page_head("Posts by {$user->name}"); if ($hide) { $posts = BoincPost::enum("user={$userid} and hidden=0 order by id desc limit {$offset},{$count}"); } else { $posts = BoincPost::enum("user={$userid} order by id desc limit {$offset},{$count}"); } $n = 0; start_table(); $options = get_output_options($logged_in_user); foreach ($posts as $post) { $thread = BoincThread::lookup_id($post->thread); if (!$thread) { continue; } $forum = BoincForum::lookup_id($thread->forum); if (!$forum) { continue; } show_post_and_context($post, $thread, $forum, $options, $n + $offset + 1); $n++;