2005-02-12 09:50:13 +00:00
|
|
|
<?php
|
2007-11-14 16:03:47 +00:00
|
|
|
|
2005-02-12 09:50:13 +00:00
|
|
|
require_once("../inc/forum.inc");
|
2006-07-01 20:03:48 +00:00
|
|
|
require_once("../inc/forum_email.inc");
|
2005-02-12 09:50:13 +00:00
|
|
|
|
2007-11-12 20:57:15 +00:00
|
|
|
$logged_in_user = get_logged_in_user();
|
|
|
|
check_tokens($logged_in_user->authenticator);
|
|
|
|
BoincForumPrefs::lookup($logged_in_user);
|
2008-02-02 17:01:57 +00:00
|
|
|
$action = post_str('action', true);
|
|
|
|
if (!$action) {
|
|
|
|
$action = get_str('action');
|
2005-02-12 09:50:13 +00:00
|
|
|
}
|
2005-04-20 21:11:20 +00:00
|
|
|
|
2007-11-12 20:57:15 +00:00
|
|
|
$thread = BoincThread::lookup_id(get_int('thread'));
|
2008-02-02 17:01:57 +00:00
|
|
|
if (!$thread) error_page("no thread");
|
2007-11-12 20:57:15 +00:00
|
|
|
$forum = BoincForum::lookup_id($thread->forum);
|
2008-02-02 17:01:57 +00:00
|
|
|
if (!$forum) error_page("no forum");
|
2005-02-12 09:50:13 +00:00
|
|
|
|
2007-11-15 22:51:05 +00:00
|
|
|
if (!is_moderator($logged_in_user, $forum)) {
|
2006-06-16 23:53:56 +00:00
|
|
|
error_page("You are not authorized to moderate this post.");
|
2005-02-12 09:50:13 +00:00
|
|
|
}
|
|
|
|
|
2008-07-06 22:30:10 +00:00
|
|
|
$explanation = "";
|
|
|
|
$cat = post_int("category", true);
|
|
|
|
if ($cat) {
|
|
|
|
$explanation .= "Reason: ";
|
|
|
|
switch ($cat) {
|
|
|
|
case 1: $explanation .= "obscene"; break;
|
|
|
|
case 2: $explanation .= "flame/hate mail"; break;
|
|
|
|
case 3: $explanation .= "commercial spam"; break;
|
|
|
|
case 4: $explanation .= "other"; break;
|
|
|
|
}
|
|
|
|
$explanation .= "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$comment = post_str('reason', true);
|
|
|
|
if ($comment) {
|
|
|
|
$explanation .= "Moderator comment: $comment\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($action) {
|
|
|
|
case "hide":
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = hide_thread($thread, $forum);
|
2008-07-06 22:30:10 +00:00
|
|
|
$action_name = "hidden";
|
|
|
|
break;
|
|
|
|
case "unhide":
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = unhide_thread($thread, $forum);
|
2008-07-06 22:30:10 +00:00
|
|
|
$action_name = "unhidden";
|
|
|
|
break;
|
|
|
|
case "sticky":
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("sticky=1");
|
2008-07-06 22:30:10 +00:00
|
|
|
$action_name = "made sticky";
|
|
|
|
break;
|
|
|
|
case "desticky":
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("sticky=0");
|
2008-07-06 22:30:10 +00:00
|
|
|
$action_name = "made non-sticky";
|
|
|
|
break;
|
|
|
|
case "lock":
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("locked=1");
|
2008-07-06 22:30:10 +00:00
|
|
|
$action_name = "locked";
|
|
|
|
break;
|
|
|
|
case "unlock":
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("locked=0");
|
2008-07-06 22:30:10 +00:00
|
|
|
$action_name = "unlocked";
|
|
|
|
break;
|
|
|
|
case "move":
|
2007-11-15 22:51:05 +00:00
|
|
|
if ($forum->parent_type != 0) error_page("No");
|
2007-11-12 20:57:15 +00:00
|
|
|
$fid = post_int('forumid');
|
|
|
|
$new_forum = BoincForum::lookup_id($fid);
|
|
|
|
$result = move_thread($thread, $forum, $new_forum);
|
2008-07-06 22:30:10 +00:00
|
|
|
$action_name = "moved from $forum->title to $new_forum->title";
|
|
|
|
break;
|
|
|
|
case "title":
|
2008-07-27 02:08:35 +00:00
|
|
|
$title = process_user_text(post_str('newtitle'));
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("title='$title'");
|
2008-07-06 22:30:10 +00:00
|
|
|
$action_name = "renamed from '$thread->title' to '$title'";
|
|
|
|
break;
|
|
|
|
default:
|
2006-06-16 23:53:56 +00:00
|
|
|
error_page("Unknown action ");
|
2005-02-12 09:50:13 +00:00
|
|
|
}
|
|
|
|
|
2008-07-06 22:30:10 +00:00
|
|
|
if (!$result) {
|
2006-06-16 23:53:56 +00:00
|
|
|
error_page("Moderation failed");
|
2005-02-12 09:50:13 +00:00
|
|
|
}
|
|
|
|
|
2008-07-06 22:30:10 +00:00
|
|
|
$reason = post_str('reason', true);
|
|
|
|
if (!$reason) $reason = "None given";
|
|
|
|
send_thread_moderation_email(
|
|
|
|
$forum, $thread, $reason, $action_name, $explanation
|
|
|
|
);
|
|
|
|
header('Location: forum_thread.php?id='.$thread->id);
|
|
|
|
|
2005-02-12 09:50:13 +00:00
|
|
|
?>
|