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);
|
2005-05-23 19:05:44 +00:00
|
|
|
if (!post_str('action', true)) {
|
|
|
|
if (!get_str('action', true)){
|
|
|
|
error_page("You must specify an action...");
|
2005-04-20 21:11:20 +00:00
|
|
|
} else {
|
2007-11-12 20:57:15 +00:00
|
|
|
$action = get_str('action');
|
2005-04-20 21:11:20 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$action = post_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'));
|
|
|
|
$forum = BoincForum::lookup_id($thread->forum);
|
2005-02-12 09:50:13 +00:00
|
|
|
|
2007-11-12 20:57:15 +00:00
|
|
|
if (!$logged_in_user->prefs->privilege(S_MODERATOR)) {
|
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
|
|
|
}
|
|
|
|
|
2007-11-12 20:57:15 +00:00
|
|
|
if ($action=="hide") {
|
|
|
|
$cat = post_int("category"); // TODO - store this somewhere
|
|
|
|
$result = hide_thread($thread, $forum);
|
2005-04-20 21:11:20 +00:00
|
|
|
} elseif ($action=="unhide"){
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = unhide_thread($thread, $forum);
|
2005-04-20 21:11:20 +00:00
|
|
|
} elseif ($action=="sticky"){
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("sticky=1");
|
2005-04-20 21:11:20 +00:00
|
|
|
} elseif ($action=="desticky"){
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("sticky=0");
|
2006-11-10 17:09:09 +00:00
|
|
|
} elseif ($action == "lock") {
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("locked=1");
|
2006-11-10 17:09:09 +00:00
|
|
|
} elseif ($action == "unlock") {
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("locked=0");
|
2006-06-16 23:53:56 +00:00
|
|
|
} elseif ($action=="move"){
|
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);
|
2006-06-16 23:53:56 +00:00
|
|
|
} elseif ($action=="title"){
|
|
|
|
$title = post_str('newtitle');
|
2007-11-12 20:57:15 +00:00
|
|
|
$result = $thread->update("title='$title'");
|
2005-02-12 09:50:13 +00:00
|
|
|
} else {
|
2006-06-16 23:53:56 +00:00
|
|
|
error_page("Unknown action ");
|
2005-02-12 09:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($result) {
|
2005-05-23 19:05:44 +00:00
|
|
|
if (post_str('reason', true)){
|
2007-01-01 21:18:49 +00:00
|
|
|
send_thread_moderation_email($thread, post_str("reason"),$action);
|
|
|
|
} else {
|
|
|
|
send_thread_moderation_email($thread, "None Given",$action);
|
2005-02-12 09:50:13 +00:00
|
|
|
}
|
2007-11-12 20:57:15 +00:00
|
|
|
header('Location: forum_thread.php?id='.$thread->id);
|
2005-02-12 09:50:13 +00:00
|
|
|
} else {
|
2006-06-16 23:53:56 +00:00
|
|
|
error_page("Moderation failed");
|
2005-02-12 09:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|