function show_title($forum, $thread) { switch ($forum->parent_type) { case 0: $category = BoincCategory::lookup_id($forum->category); show_forum_title($category, $forum, $thread); break; case 1: show_team_forum_title($forum, $thread); break; } }
function create_category($orderID, $name, $is_helpdesk) { $q = "(orderID, lang, name, is_helpdesk) values ({$orderID}, 1, '{$name}', {$is_helpdesk})"; $db = BoincDB::get(); $result = $db->insert("category", $q); if (!$result) { $cat = BoincCategory::lookup("name='{$name}' and is_helpdesk={$is_helpdesk}"); if ($cat) { return $cat->id; } echo "can't create category\n"; echo $db->base_error(); exit; } return $db->insert_id(); }
// 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; $diff /= 7 * 86400; $activity += pow(2, -$diff);
$d = $forum->description; if (!strlen($d)) { $d = tra("Discussion among members of %1", $team->name); } break; } $j = $i % 2; echo "\n <tr class=\"row{$j}\">\n <td>\n <a href=\"forum_forum.php?id={$forum->id}\">{$t}</a>\n <br><span class=\"smalltext\">{$d}</span>\n </td>\n <td class=\"numbers\">{$forum->threads}</td>\n <td class=\"numbers\">{$forum->posts}</td>\n <td class=\"lastpost\">" . time_diff_str($forum->timestamp, time()) . "</td>\n </tr>"; } page_head(tra("%1 Message boards", PROJECT)); show_forum_header($user); if (FORUM_QA_MERGED_MODE === true) { $categories = BoincCategory::enum("true order by orderID"); } else { echo "<p>" . tra("If you have a question or problem, please use the %1Questions & Answers%2 section of the message boards.", "<a href=\"forum_help_desk.php\">", "</a>") . "</p>"; $categories = BoincCategory::enum("is_helpdesk=0 order by orderID"); } $first = true; foreach ($categories as $category) { if ($first) { $first = false; echo "<p>"; show_forum_title($category, NULL, NULL); echo "<p>"; show_mark_as_read_button($user); start_forum_table(array(tra("Topic"), tra("Threads"), tra("Posts"), tra("Last post"))); } if (strlen($category->name)) { echo ' <tr class="subtitle"> <td class="category" colspan="4">' . $category->name . '</td>
while (1) { echo "Enter the email address of admin account to appear as poster: "; $x = trim(fgets($stdin)); $user = BoincUser::lookup("email_addr='{$x}'"); 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 {
require_once '../inc/forum.inc'; check_get_args(array("forumid")); 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>";