function cleanup_orphan_threads() { $threads = BoincThread::enum(""); foreach ($threads as $thread) { $forum = BoincForum::lookup_id($thread->forum); if (!$forum) { cleanup_thread($thread); } } }
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(); }
} 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);
// See the GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see <http://www.gnu.org/licenses/>. $cli_only = true; require_once "../inc/util_ops.inc"; require_once "../inc/forum_db.inc"; define('MAX_REWARD', 4096); 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;
// You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see <http://www.gnu.org/licenses/>. // // This file was modified by contributors of "BOINC Web Tweak" project. // 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'; $id = get_int("id"); $sort_style = get_int("sort", true); $start = get_int("start", true); if (!$start) { $start = 0; } $forum = BoincForum::lookup_id($id); $user = get_logged_in_user(false); if (!is_forum_visible_to_user($forum, $user)) { error_page("Not visible"); } BoincForumPrefs::lookup($user); 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 { if (isset($_COOKIE['sorting'])) { list($sort_style, $thread_style) = explode("|", $_COOKIE['sorting']); } } } else {
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}"); }
} page_head("Post deleted"); if (BoincThread::lookup_id($thread->id)) { echo "Post successfully deleted.\n <p>\n <a href=forum_thread.php?id={$thread->id}>Return to thread</a>\n "; } else { echo "Post and thread successfully deleted.\n <p>\n <a href=forum_forum.php?id={$forum->id}>Return to forum</a>\n "; } page_tail(); exit; } elseif ($action == "move") { $destid = post_int('threadid'); $new_thread = BoincThread::lookup_id($destid); if (!$new_thread) { error_page("No such thread"); } $new_forum = BoincForum::lookup_id($new_thread->forum); if ($forum->parent_type != $new_forum->parent_type) { error_page(tra("Can't move to different category type")); } if ($forum->parent_type != 0) { if ($forum->category != $new_forum->category) { error_page(tra("Can't move to different category")); } } $result = move_post($post, $thread, $forum, $new_thread, $new_forum); $explanation = "Old thread: {$thread->title}\n" . secure_url_base() . "forum_thread.php?id={$thread->id}\nNew thread: {$new_thread->title}\n" . secure_url_base() . "forum_thread.php?id={$new_thread->id}&postid={$post->id}\n"; $explanation .= mod_comment(); $action_name = "moved to another thread"; } elseif ($action == "banish_user") { $auth = false; if (defined("MODERATORS_CAN_BANISH") && $user->prefs->privilege(S_MODERATOR)) {
$action_name = "made non-sticky"; break; case "lock": $result = $thread->update("locked=1"); $action_name = "locked"; break; case "unlock": $result = $thread->update("locked=0"); $action_name = "unlocked"; break; case "move": if ($forum->parent_type != 0) { error_page("No"); } $fid = post_int('forumid'); $new_forum = BoincForum::lookup_id($fid); $result = move_thread($thread, $forum, $new_forum); $action_name = "moved from {$forum->title} to {$new_forum->title}"; break; case "title": $new_title = post_str('newtitle'); $title = BoincDb::escape_string($new_title); $result = $thread->update("title='{$title}'"); $action_name = "renamed from '{$thread->title}' to '{$new_title}'"; break; default: error_page("Unknown action"); } if (!$result) { error_page("Moderation failed"); }
} 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);
} check_get_args(array()); $user = get_logged_in_user(false); page_head(tra("Questions and answers")); echo "<p>" . tra("Talk live via Skype with a volunteer, in any of several languages. Go to %1BOINC Online Help%2.", "<a href=\"http://boinc.berkeley.edu/help.php\">", "</a>") . "</p>"; show_forum_header($user); $categories = BoincCategory::enum("is_helpdesk=1 order by orderID"); $first = true; foreach ($categories as $category) { if ($first) { $first = false; show_forum_title($category, null, null); echo "<p>"; show_mark_as_read_button($user); start_forum_table(array(tra("Topic"), tra("Questions"), tra("Last post"))); } if (strlen($category->name)) { echo "\n <tr class=\"subtitle\">\n <td class=\"category\" colspan=\"4\">", $category->name, "</td>\n </tr>\n "; } $forums = BoincForum::enum("parent_type=0 and category={$category->id} order by orderID"); $i = 1; foreach ($forums as $forum) { $j = $i % 2; $i++; echo "\n <tr class=\"row{$j}\">\n <td>\n <a href=\"forum_forum.php?id={$forum->id}\">{$forum->title}</a>\n <br><small>", $forum->description, "</small>\n </td>\n <td class=\"numbers\">", $forum->threads, "</td>\n <td class=\"lastpost\">", time_diff_str($forum->timestamp, time()), "</td>\n </tr>\n "; } } echo "\n </table>\n</p>\n"; page_tail(); $cvs_version_tracker[] = "\$Id\$"; //Generated automatically - do not edit
page_head(tra("Forum search")); start_table(); echo "<form action=\"forum_search_action.php\" method=\"post\">"; row1(tra("Search query")); row2(tra("Search for keywords:") . "<br />\n <span class=\"smalltext\">" . tra("Posts that contain all the specified words will be displayed") . "</span>", "<input type=\"text\" style=\"width: 290px\" name=\"search_keywords\" size=\"30\" /><br />\n <span class=\"smalltext\">" . tra("For example: \"screensaver freeze\"") . "</span>"); row2(tra("Search for author ID:") . "<br />\n <span class=\"smalltext\">" . tra("Only posts by this author will be displayed") . "</span>", "<input type=\"text\" style=\"width: 150px\" name=\"search_author\" size=\"10\" /><br />\n <span class=\"smalltext\">" . tra("For example: \"43214\"") . "</span>"); row1(tra("Search options")); row2(tra("Search limits") . "<br />\n <span class=\"smalltext\">" . tra("Search at most this many days back in time") . "</span>", "<select name=\"search_max_time\">\n <option value=\"1\">" . tra("1 day") . "</option>\n <option value=\"3\">" . tra("%1 days", "3") . "</option>\n <option value=\"7\">" . tra("%1 days", "7") . "</option>\n <option value=\"15\">" . tra("%1 days", "15") . "</option>\n <option value=\"30\" selected>" . tra("%1 days", "30") . "</option>\n <option value=\"90\">" . tra("%1 months", "3") . "</option>\n <option value=\"180\">" . tra("%1 months", "6") . "</option>\n <option value=\"365\">" . tra("1 year") . "</option>\n <option value=\"0\">" . tra("no limit") . "</option>\n </select>"); $forumid = null; if (get_str("forumid", true)) { $forumid = get_str("forumid"); } $forumlist = "<option value=\"-1\">" . tra("All") . "</option>"; $categories = BoincCategory::enum(); foreach ($categories as $category) { $forums = BoincForum::enum("parent_type=0 and category={$category->id}"); foreach ($forums as $forum) { if ($forum->id == $forumid) { $forumlist .= "<option selected value=\"" . $forum->id . "\">" . $forum->title . "</option>"; } else { $forumlist .= "<option value=\"" . $forum->id . "\">" . $forum->title . "</option>"; } } } row2(tra("Forum") . "<br />\n <span class=\"smalltext\">" . tra("Only display posts from this forum") . "</span>", '<select name="search_forum">' . $forumlist . '</select'); $sortlist = null; foreach ($thread_sort_styles as $id => $style) { if ($id == CREATE_TIME_NEW) { $sortlist .= "<option selected value=\"" . $id . "\">" . $style . "</option>"; } else { $sortlist .= "<option value=\"" . $id . "\">" . $style . "</option>";
switch ($action) { case 'hide': case 'lock': echo "<input type=hidden name=action value={$action}>"; row2("", tra("Select the reason category, or write a longer description of why you're hiding or locking the thread; then press OK.")); row2(tra("Category"), "<select name=\"category\">\n <option value=\"1\">" . tra("Obscene") . "</option>\n <option value=\"2\">" . tra("Flame/Hate mail") . "</option>\n <option value=\"3\">" . tra("Commercial spam") . "</option>\n <option value=\"4\">" . tra("Other") . "</option>\n </select>"); break; case 'move': if ($forum->parent_type != 0) { error_page("Nope"); } echo "<input type=hidden name=action value=move>"; $selectbox = '<select name="forumid">'; $categories = BoincCategory::enum(); foreach ($categories as $category) { $forums = BoincForum::enum("category={$category->id}"); foreach ($forums as $f) { $selectbox .= '<option value="' . $f->id . '">' . $f->title . '</option>'; } } $selectbox .= '</option>'; row2(tra("Current forum"), $forum->title); row2(tra("Destination forum"), $selectbox); break; case 'title': echo "<input type=hidden name=action value=title>"; row2(tra("New title:"), "<input size=80 name=\"newtitle\" value=\"" . htmlspecialchars($thread->title) . "\">"); break; case 'delete': echo "<input type=hidden name=action value=delete>"; echo "Are you sure you want to delete this thread and all its posts?\n This action cannot be undone.\n <input type=submit value=Yes>\n ";