2005-01-18 13:00:38 +00:00
|
|
|
<?php
|
2007-09-30 11:17:11 +00:00
|
|
|
|
2007-11-12 20:57:15 +00:00
|
|
|
// When a moderator does something to a post, this page actually
|
|
|
|
// commits those changes to the database.
|
2005-01-18 13:00:38 +00:00
|
|
|
|
|
|
|
require_once("../inc/forum.inc");
|
2006-07-01 20:03:48 +00:00
|
|
|
require_once("../inc/forum_email.inc");
|
2006-06-16 23:53:56 +00:00
|
|
|
|
2007-11-12 20:57:15 +00:00
|
|
|
$user = get_logged_in_user();
|
|
|
|
check_tokens($user->authenticator);
|
|
|
|
BoincForumPrefs::lookup($user);
|
2007-11-15 22:51:05 +00:00
|
|
|
$post = BoincPost::lookup_id(get_int('id'));
|
|
|
|
$thread = BoincThread::lookup_id($post->thread);
|
|
|
|
$forum = BoincForum::lookup_id($thread->forum);
|
2006-06-16 23:53:56 +00:00
|
|
|
|
2007-11-15 22:51:05 +00:00
|
|
|
if (!is_moderator($user, $forum)) {
|
2006-06-16 23:53:56 +00:00
|
|
|
error_page("You are not authorized to moderate this post.");
|
2005-02-13 21:33:02 +00:00
|
|
|
}
|
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
// See if "action" is provided - either through post or get
|
2005-05-23 19:05:44 +00:00
|
|
|
if (!post_str('action', true)) {
|
|
|
|
if (!get_str('action', true)){
|
2007-11-12 20:57:15 +00:00
|
|
|
error_page("You must specify an action...");
|
2005-05-23 19:05:44 +00:00
|
|
|
} else {
|
2007-11-12 20:57:15 +00:00
|
|
|
$action = get_str('action');
|
2005-05-23 19:05:44 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$action = post_str('action');
|
2005-01-18 13:00:38 +00:00
|
|
|
}
|
2005-02-13 21:33:02 +00:00
|
|
|
|
2005-05-23 19:05:44 +00:00
|
|
|
if ($action=="hide"){
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = hide_post($post, $thread, $forum);
|
2005-05-23 19:05:44 +00:00
|
|
|
} elseif ($action=="unhide"){
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = unhide_post($post, $thread, $forum);
|
2005-05-23 19:05:44 +00:00
|
|
|
} elseif ($action=="move"){
|
2007-11-12 20:57:15 +00:00
|
|
|
$destid = post_int('threadid');
|
|
|
|
$new_thread = BoincThread::lookup_id($destid);
|
|
|
|
$new_forum = BoincForum::lookup_id($new_thread->forum);
|
2007-11-15 22:51:05 +00:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
}
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = move_post($post, $thread, $forum, $new_thread, $new_forum);
|
2006-08-08 20:32:37 +00:00
|
|
|
} elseif ($action=="banish_user"){
|
2007-11-12 20:57:15 +00:00
|
|
|
if (!$user->prefs->privilege(S_ADMIN)) {
|
2006-10-17 05:40:33 +00:00
|
|
|
// Can't banish without being administrator
|
2007-11-12 20:57:15 +00:00
|
|
|
error_page("You are not authorized to banish this user.");
|
2006-10-17 05:40:33 +00:00
|
|
|
}
|
2007-03-24 14:57:30 +00:00
|
|
|
$userid = post_int('userid');
|
2007-11-12 20:57:15 +00:00
|
|
|
$user = BoincUser::lookup_id($userid);
|
2006-08-08 20:32:37 +00:00
|
|
|
if (!$user) {
|
|
|
|
error_page("no user");
|
|
|
|
}
|
2007-11-12 20:57:15 +00:00
|
|
|
BoincForumPrefs::lookup($user);
|
2007-03-24 14:57:30 +00:00
|
|
|
$duration = post_int('duration');
|
|
|
|
if ($duration == -1) {
|
|
|
|
$t = 2147483647; // Maximum integer value
|
|
|
|
} else {
|
|
|
|
$t = time() + $duration;
|
|
|
|
}
|
|
|
|
$reason = post_str("reason", true);
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $user->prefs->update("banished_until=$t");
|
|
|
|
page_head("Banishment");
|
2006-08-08 20:32:37 +00:00
|
|
|
if ($result) {
|
2007-11-12 20:57:15 +00:00
|
|
|
echo "User ".$user->name." has been banished.";
|
2007-11-18 04:10:37 +00:00
|
|
|
send_banish_email($forum, $user, $t, $reason);
|
2006-08-08 20:32:37 +00:00
|
|
|
} else {
|
2007-11-12 20:57:15 +00:00
|
|
|
echo "DB failure";
|
2006-08-08 20:32:37 +00:00
|
|
|
}
|
|
|
|
page_tail();
|
|
|
|
exit();
|
2005-01-18 13:00:38 +00:00
|
|
|
} else {
|
2006-06-16 23:53:56 +00:00
|
|
|
error_page("Unknown action ");
|
2005-01-18 13:00:38 +00:00
|
|
|
}
|
|
|
|
|
2007-09-30 11:17:11 +00:00
|
|
|
switch (post_int("category", true)) {
|
2007-11-12 20:57:15 +00:00
|
|
|
case 1:
|
|
|
|
$mod_category = "Obscene";
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$mod_category = "Flame/Hate mail";
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$mod_category = "Commercial spam";
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
$mod_category = "Doublepost";
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
$mod_category = "User Request";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$mod_category = "Other";
|
|
|
|
break;
|
2007-09-30 11:17:11 +00:00
|
|
|
}
|
2005-01-18 13:00:38 +00:00
|
|
|
|
|
|
|
if ($result) {
|
2005-05-23 19:05:44 +00:00
|
|
|
if (post_str('reason', true)){
|
2007-11-18 04:10:37 +00:00
|
|
|
send_moderation_email($forum, $post, $thread, "Category: ".$mod_category."\n".post_str("reason"), $action);
|
2007-01-01 21:18:49 +00:00
|
|
|
} else {
|
2007-11-18 04:10:37 +00:00
|
|
|
send_moderation_email($forum, $post, $thread, "Category: ".$mod_category."\n"."None given", $action);
|
2005-01-18 13:00:38 +00:00
|
|
|
}
|
2007-11-12 20:57:15 +00:00
|
|
|
header('Location: forum_thread.php?id='.$thread->id);
|
2005-01-18 13:00:38 +00:00
|
|
|
} else {
|
2006-06-16 23:53:56 +00:00
|
|
|
error_page("Moderation failed");
|
2005-01-18 13:00:38 +00:00
|
|
|
}
|
|
|
|
|
2007-11-12 20:57:15 +00:00
|
|
|
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
|
2005-01-18 13:00:38 +00:00
|
|
|
?>
|