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"; } echo "</post>\n"; } echo "</posts>\n"; echo "</rpc_response>\n"; } elseif ($method == "user_threads") {
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // 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/>. // This file allows people to subscribe to threads. // Whenever someone posts to the thread // the subscribers will receive a notification email require_once '../inc/forum.inc'; if (DISABLE_FORUMS) { error_page("Forums are disabled"); } check_get_args(array("action", "thread", "tnow", "ttok")); $action = get_str('action'); $threadid = get_int('thread'); $thread = BoincThread::lookup_id($threadid); $forum = BoincForum::lookup_id($thread->forum); 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 subscribe($forum, $thread, $user) {
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // 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/>. // // This file was modified by contributors of "BOINC Web Tweak" project. // Use this file you can post a reply to a thread. // Both input (form) and action take place here. require_once '../inc/forum_email.inc'; require_once '../inc/forum.inc'; require_once '../inc/akismet.inc'; $logged_in_user = get_logged_in_user(true); BoincForumPrefs::lookup($logged_in_user); check_banished($logged_in_user); $thread = BoincThread::lookup_id(get_int('thread')); $forum = BoincForum::lookup_id($thread->forum); $sort_style = get_str('sort', true); $filter = get_str('filter', true); $content = post_str('content', true); $preview = post_str("preview", true); $parent_post_id = get_int('post', true); $parent_post = null; if ($parent_post_id) { $parent_post = BoincPost::lookup_id($parent_post_id); if ($parent_post->thread != $thread->id) { error_page("wrong thread"); } } else { $parent_post_id = 0; }
} elseif ($action == "delete") { $result = delete_post($post, $thread, $forum); if (!$result) { error_page("Can't delete post"); } 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();
} 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); continue; } if ($thread->hidden) { continue; } show_thread_and_context($thread, $user, $i++); } end_table(); } } page_tail(); flush(); BoincForumLogging::cleanup();