authenticator); BoincForumPrefs::lookup($user); $post = BoincPost::lookup_id(get_int('id')); $thread = BoincThread::lookup_id($post->thread); $forum = BoincForum::lookup_id($thread->forum); if (!is_moderator($user, $forum)) { error_page("You are not authorized to moderate this post."); } // See if "action" is provided - either through post or get if (!post_str('action', true)) { if (!get_str('action', true)){ error_page("You must specify an action..."); } else { $action = get_str('action'); } } else { $action = post_str('action'); } $explanation = null; if ($action=="hide"){ $result = hide_post($post, $thread, $forum); $action_name = "hidden"; $explanation = hide_explanation(); } elseif ($action=="unhide"){ $result = unhide_post($post, $thread, $forum); $action_name = "unhidden"; } elseif ($action=="move"){ $destid = post_int('threadid'); $new_thread = BoincThread::lookup_id($destid); $new_forum = BoincForum::lookup_id($new_thread->forum); if ($forum->parent_type != $new_forum->parent_type) { error_page("Can't move to different category type"); } if ($forum->parent_type != 0) { if ($forum->category != $new_forum->category) { error_page("Can't move to different category"); } } $result = move_post($post, $thread, $forum, $new_thread, $new_forum); $explanation = "Old thread: $thread->title ".URL_BASE."forum_thread.php?id=$thread->id New thread: $new_thread->title ".URL_BASE."forum_thread.php?id=$new_thread->id#$post->id "; $explanation .= mod_comment(); $action_name = "moved to another thread"; } elseif ($action=="banish_user"){ if (!$user->prefs->privilege(S_ADMIN)) { // Can't banish without being administrator error_page("Not admin"); } $userid = post_int('userid'); $user = BoincUser::lookup_id($userid); if (!$user) { error_page("no user"); } BoincForumPrefs::lookup($user); $duration = post_int('duration'); if ($duration == -1) { $t = 2147483647; // Maximum integer value } else { $t = time() + $duration; } $reason = post_str("reason", true); $result = $user->prefs->update("banished_until=$t"); page_head("Banishment"); if ($result) { echo "User ".$user->name." has been banished."; send_banish_email($forum, $user, $t, $reason); } else { echo "DB failure"; } page_tail(); exit(); } else { error_page("Unknown action "); } if (!$result) { error_page("Action failed: possible database problem"); } send_moderation_email($forum, $post, $thread, $explanation, $action_name); header('Location: forum_thread.php?id='.$thread->id); $cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit ?>