2005-01-18 13:00:38 +00:00
|
|
|
<?php
|
2006-06-16 23:53:56 +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
|
|
|
require_once("../inc/forum_std.inc");
|
2005-01-18 13:00:38 +00:00
|
|
|
|
|
|
|
db_init();
|
2006-06-16 23:53:56 +00:00
|
|
|
|
|
|
|
$user = re_get_logged_in_user();
|
|
|
|
|
|
|
|
if (!$user->isSpecialUser(S_MODERATOR)) {
|
2005-02-13 21:33:02 +00:00
|
|
|
// Can't moderate without being moderator
|
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)){
|
|
|
|
error_page("You must specify an action...");
|
|
|
|
} else {
|
|
|
|
$action = get_str('action');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$action = post_str('action');
|
2005-01-18 13:00:38 +00:00
|
|
|
}
|
2005-02-13 21:33:02 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
$post = new Post(get_int('id'));
|
|
|
|
$thread = $post->getThread();
|
2005-01-18 13:00:38 +00:00
|
|
|
|
2005-05-23 19:05:44 +00:00
|
|
|
if ($action=="hide"){
|
2006-06-16 23:53:56 +00:00
|
|
|
$result = $post->hide();
|
|
|
|
if ($thread->getPostCount() == 0) {
|
|
|
|
$result = $thread->hide();
|
|
|
|
}
|
2005-05-23 19:05:44 +00:00
|
|
|
} elseif ($action=="unhide"){
|
2006-06-16 23:53:56 +00:00
|
|
|
$result = $post->unhide();
|
2005-05-23 19:05:44 +00:00
|
|
|
} elseif ($action=="move"){
|
2006-06-16 23:53:56 +00:00
|
|
|
$destination_thread = new Thread(post_int('threadid'));
|
|
|
|
$result = $post->move($destination_thread);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($result) {
|
2005-05-23 19:05:44 +00:00
|
|
|
if (post_str('reason', true)){
|
2006-06-16 23:53:56 +00:00
|
|
|
send_moderation_email($post, post_str("reason"));
|
2005-01-18 13:00:38 +00:00
|
|
|
}
|
2006-06-16 23:53:56 +00:00
|
|
|
header('Location: forum_thread.php?id='.$thread->getID());
|
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
|
|
|
}
|
|
|
|
|
|
|
|
?>
|