2005-02-12 09:50:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("../inc/db.inc");
|
|
|
|
require_once("../inc/user.inc");
|
|
|
|
require_once("../inc/profile.inc");
|
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/image.inc");
|
|
|
|
require_once("../inc/forum.inc");
|
|
|
|
|
|
|
|
|
|
|
|
db_init();
|
|
|
|
$user = get_logged_in_user();
|
|
|
|
$user = getForumPreferences($user);
|
|
|
|
|
2005-02-17 11:43:49 +00:00
|
|
|
if (!post_str('action')) {
|
2005-04-20 21:11:20 +00:00
|
|
|
if (!get_str('action')){
|
|
|
|
echo "You must specify an action...";
|
|
|
|
exit();
|
|
|
|
} else {
|
|
|
|
$action = get_str('action');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$action = post_str('action');
|
2005-02-12 09:50:13 +00:00
|
|
|
}
|
2005-04-20 21:11:20 +00:00
|
|
|
|
|
|
|
$thread = getThread(get_int('thread'));
|
2005-02-17 11:43:49 +00:00
|
|
|
if (!$thread){
|
|
|
|
// TODO: Standard error page
|
|
|
|
echo "Invalid thread ID.<br>";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2005-02-12 09:50:13 +00:00
|
|
|
|
|
|
|
if (!isSpecialUser($user,0)) {
|
|
|
|
// Can't moderate without being moderator
|
|
|
|
echo "You are not authorized to moderate this post.";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2005-04-20 21:11:20 +00:00
|
|
|
if ($action=="hide"){
|
2005-02-17 11:43:49 +00:00
|
|
|
$result=mysql_query("update thread set hidden = ".post_int("category")." where id=".$thread->id);
|
2005-02-12 09:50:13 +00:00
|
|
|
echo mysql_error();
|
2005-04-20 21:11:20 +00:00
|
|
|
} elseif ($action=="unhide"){
|
2005-02-12 09:50:13 +00:00
|
|
|
$result=mysql_query("update thread set hidden = 0 where id=".$thread->id);
|
|
|
|
echo mysql_error();
|
2005-04-20 21:11:20 +00:00
|
|
|
} elseif ($action=="sticky"){
|
|
|
|
$result=mysql_query("update thread set sticky = 1 where id=".$thread->id);
|
|
|
|
echo mysql_error();
|
|
|
|
} elseif ($action=="desticky"){
|
|
|
|
$result=mysql_query("update thread set sticky = 0 where id=".$thread->id);
|
|
|
|
echo mysql_error();
|
2005-02-12 09:50:13 +00:00
|
|
|
/*} elseif ($_POST['action']=="move"){
|
|
|
|
if (getThread($_POST['threadid'])){
|
2005-02-13 21:33:02 +00:00
|
|
|
$result=mysql_query("update post set thread = ".intval($_POST['threadid'])." where id=".$post->id);
|
|
|
|
echo mysql_error();
|
|
|
|
//TODO: correct the number of posts in this thread
|
|
|
|
//TODO: correct the number of posts in destination thread
|
2005-02-12 09:50:13 +00:00
|
|
|
} else {
|
2005-02-13 21:33:02 +00:00
|
|
|
echo "Destination not found, please check and try again.";
|
|
|
|
exit();
|
2005-02-12 09:50:13 +00:00
|
|
|
}*/
|
|
|
|
} else {
|
|
|
|
echo "Unknown action ";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
echo mysql_error();
|
2005-02-17 11:43:49 +00:00
|
|
|
if (post_str('reason')){
|
|
|
|
send_thread_moderation_email(lookup_user_id($post->user),$thread, post_str("reason"));
|
2005-02-12 09:50:13 +00:00
|
|
|
}
|
|
|
|
header('Location: forum_thread.php?id='.$thread->id);
|
|
|
|
} else {
|
|
|
|
page_head("Moderation update");
|
|
|
|
echo "Couldn't moderate the thread.<br>\n";
|
|
|
|
echo mysql_error();
|
|
|
|
page_tail();
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|