2005-01-18 13:00:38 +00:00
|
|
|
<?php
|
2007-09-30 11:17:11 +00:00
|
|
|
|
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-28 17:40:28 +00:00
|
|
|
function mod_comment() {
|
|
|
|
$x = "";
|
|
|
|
$reason = post_str('reason', true);
|
|
|
|
if ($reason){
|
|
|
|
$x .= "
|
|
|
|
Moderator comment: $reason
|
|
|
|
";
|
|
|
|
}
|
|
|
|
return $x;
|
|
|
|
}
|
|
|
|
|
|
|
|
function hide_explanation() {
|
|
|
|
$x = "\nYour post was categorized as ";
|
|
|
|
switch (post_int("category", true)) {
|
|
|
|
case 1: $x .= "Obscene"; break;
|
|
|
|
case 2: $x .= "Flame/Hate mail"; break;
|
|
|
|
case 3: $x .= "Commercial spam"; break;
|
|
|
|
case 4: $x .= "Double post"; break;
|
|
|
|
case 5: $x .= "User Request"; break;
|
|
|
|
default: $x .= "Other"; break;
|
|
|
|
}
|
|
|
|
$x .= mod_comment();
|
|
|
|
return $x;
|
|
|
|
}
|
|
|
|
|
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'));
|
2008-03-07 04:54:01 +00:00
|
|
|
if (!$post) error_page("no such post");
|
2007-11-15 22:51:05 +00:00
|
|
|
$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
|
|
|
|
2007-11-28 17:40:28 +00:00
|
|
|
$explanation = null;
|
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);
|
2007-11-28 17:40:28 +00:00
|
|
|
$action_name = "hidden";
|
|
|
|
$explanation = hide_explanation();
|
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);
|
2007-11-28 17:40:28 +00:00
|
|
|
$action_name = "unhidden";
|
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);
|
2008-03-07 04:54:01 +00:00
|
|
|
if (!$new_thread) error_page("No such thread");
|
2007-11-12 20:57:15 +00:00
|
|
|
$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);
|
2007-11-28 17:40:28 +00:00
|
|
|
$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";
|
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-28 17:40:28 +00:00
|
|
|
error_page("Not admin");
|
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-11-28 17:40:28 +00:00
|
|
|
if (!$result) {
|
|
|
|
error_page("Action failed: possible database problem");
|
2007-09-30 11:17:11 +00:00
|
|
|
}
|
2005-01-18 13:00:38 +00:00
|
|
|
|
2007-11-28 17:40:28 +00:00
|
|
|
send_moderation_email($forum, $post, $thread, $explanation, $action_name);
|
|
|
|
|
|
|
|
header('Location: forum_thread.php?id='.$thread->id);
|
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
|
|
|
?>
|