2005-02-12 09:50:13 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// 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/>.
|
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
|
|
|
|
2011-02-09 22:11:34 +00:00
|
|
|
check_get_args(array("action", "thread", "tnow", "ttok"));
|
|
|
|
|
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:10:37 +00:00
|
|
|
$new_title = post_str('newtitle');
|
2008-12-14 22:18:49 +00:00
|
|
|
$title = BoincDb::escape_string($new_title);
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("title='$title'");
|
2008-07-27 02:10:37 +00:00
|
|
|
$action_name = "renamed from '$thread->title' to '$new_title'";
|
2008-07-06 22:30:10 +00:00
|
|
|
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
|
|
|
?>
|