Zeile 1 | Zeile 1 |
---|
<?php /** * MyBB 1.4
|
<?php /** * MyBB 1.4
|
* Copyright � 2008 MyBB Group, All Rights Reserved
| * Copyright © 2008 MyBB Group, All Rights Reserved
|
* * Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* * Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: class_moderation.php 4368 2009-05-08 10:30:37Z Tomm $
| * $Id: class_moderation.php 4544 2009-11-27 20:11:25Z RyanGordon $
|
*/
class Moderation
| */
class Moderation
|
Zeile 228 | Zeile 228 |
---|
$pids = implode(',', $pids); $db->delete_query("posts", "pid IN ($pids)"); $db->delete_query("attachments", "pid IN ($pids)");
|
$pids = implode(',', $pids); $db->delete_query("posts", "pid IN ($pids)"); $db->delete_query("attachments", "pid IN ($pids)");
|
| $db->delete_query("reportedposts", "pid IN ($pids)");
|
} // Get thread info $query = get_thread($tid);
| } // Get thread info $query = get_thread($tid);
|
Zeile 321 | Zeile 322 |
---|
continue; } $tid_list[] = $thread['tid'];
|
continue; } $tid_list[] = $thread['tid'];
|
| update_thread_counters($tid, array("unapprovedposts" => "-1"));
|
$forum = get_forum($thread['fid']);
| $forum = get_forum($thread['fid']);
|
Zeile 483 | Zeile 486 |
---|
// Delete the post $db->delete_query("posts", "pid='$pid'");
|
// Delete the post $db->delete_query("posts", "pid='$pid'");
|
| // Remove any reports attached to this post $db->delete_query("reportedposts", "pid='$pid'");
|
$num_unapproved_posts = $num_approved_posts = 0; // Update unapproved post count
| $num_unapproved_posts = $num_approved_posts = 0; // Update unapproved post count
|
Zeile 566 | Zeile 572 |
---|
else { $message .= "[hr]{$post['message']}";
|
else { $message .= "[hr]{$post['message']}";
|
}
| }
|
if($post['visible'] == 1 && $post['threadvisible'] == 1) {
| if($post['visible'] == 1 && $post['threadvisible'] == 1) {
|
Zeile 580 | Zeile 586 |
---|
--$forum_counters[$post['fid']]['num_posts']; // Subtract 1 from user's post count if($post['usepostcounts'] != 0)
|
--$forum_counters[$post['fid']]['num_posts']; // Subtract 1 from user's post count if($post['usepostcounts'] != 0)
|
{
| {
|
// Update post count of the user of the merged posts $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid='{$post['uid']}'");
|
// Update post count of the user of the merged posts $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid='{$post['uid']}'");
|
}
| }
|
} elseif($post['visible'] == 0) {
| } elseif($post['visible'] == 0) {
|
Zeile 595 | Zeile 601 |
---|
--$thread_counters[$post['tid']]['unapprovedposts']; // Subtract 1 unapproved post from post's forum --$forum_counters[$post['fid']]['unapprovedposts'];
|
--$thread_counters[$post['tid']]['unapprovedposts']; // Subtract 1 unapproved post from post's forum --$forum_counters[$post['fid']]['unapprovedposts'];
|
}
| }
|
} }
| } }
|
Zeile 635 | Zeile 641 |
---|
update_thread_data($tid); } }
|
update_thread_data($tid); } }
|
| update_thread_data($mastertid); update_forum_lastpost($fid);
|
if(is_array($forum_counters))
|
if(is_array($forum_counters))
|
{
| {
|
foreach($forum_counters as $fid => $counters) { $updated_forum_stats = array(
| foreach($forum_counters as $fid => $counters) { $updated_forum_stats = array(
|
Zeile 652 | Zeile 662 |
---|
return true; }
|
return true; }
|
|
|
/** * Move/copy thread *
| /** * Move/copy thread *
|
Zeile 682 | Zeile 692 |
---|
case "redirect": // move (and leave redirect) thread $arguments = array("tid" => $tid, "new_fid" => $new_fid); $plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);
|
case "redirect": // move (and leave redirect) thread $arguments = array("tid" => $tid, "new_fid" => $new_fid); $plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);
|
if($thread['visible'] == 1) { $num_threads++; $num_posts = $thread['replies']+1; } else {
| if($thread['visible'] == 1) { $num_threads++; $num_posts = $thread['replies']+1; } else {
|
$num_unapproved_threads++; // Implied forum unapproved count for unapproved threads $num_unapproved_posts = $thread['replies']+1;
| $num_unapproved_threads++; // Implied forum unapproved count for unapproved threads $num_unapproved_posts = $thread['replies']+1;
|
Zeile 903 | Zeile 913 |
---|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE tid='$tid'
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE tid='$tid'
|
GROUP BY u.uid
| GROUP BY u.uid, p.visible
|
ORDER BY posts DESC "); while($posters = $db->fetch_array($query))
| ORDER BY posts DESC "); while($posters = $db->fetch_array($query))
|
Zeile 936 | Zeile 946 |
---|
update_forum_counters($new_fid, $update_array);
if($method != "copy")
|
update_forum_counters($new_fid, $update_array);
if($method != "copy")
|
{
| {
|
$update_array = array( "threads" => "-{$num_threads}", "unapprovedthreads" => "-{$num_unapproved_threads}",
| $update_array = array( "threads" => "-{$num_threads}", "unapprovedthreads" => "-{$num_unapproved_threads}",
|
Zeile 983 | Zeile 993 |
---|
{ $query = $db->simple_select("threads", "*", "tid='{$tid}'"); $thread = $db->fetch_array($query);
|
{ $query = $db->simple_select("threads", "*", "tid='{$tid}'"); $thread = $db->fetch_array($query);
|
}
| }
|
$pollsql = ''; if($mergethread['poll'])
| $pollsql = ''; if($mergethread['poll'])
|
Zeile 1013 | Zeile 1023 |
---|
"replyto" => 0 ); $db->update_query("posts", $sqlarray, "tid='{$mergetid}'");
|
"replyto" => 0 ); $db->update_query("posts", $sqlarray, "tid='{$mergetid}'");
|
|
|
$pollsql['subject'] = $subject; $db->update_query("threads", $pollsql, "tid='{$tid}'"); $sqlarray = array(
| $pollsql['subject'] = $subject; $db->update_query("threads", $pollsql, "tid='{$tid}'"); $sqlarray = array(
|
Zeile 1043 | Zeile 1053 |
---|
{ // If new thread is unapproved, implied counter comes in to effect if($thread['visible'] == 0)
|
{ // If new thread is unapproved, implied counter comes in to effect if($thread['visible'] == 0)
|
{ $updated_stats = array(
| { $updated_stats = array(
|
"unapprovedposts" => '+'.($mergethread['replies']+$mergethread['unapprovedposts'])
|
"unapprovedposts" => '+'.($mergethread['replies']+$mergethread['unapprovedposts'])
|
);
| );
|
} else {
| } else {
|
Zeile 1059 | Zeile 1069 |
---|
} return true; }
|
} return true; }
|
|
|
/** * Split posts into a new/existing thread *
| /** * Split posts into a new/existing thread *
|
Zeile 1075 | Zeile 1085 |
---|
function split_posts($pids, $tid, $moveto, $newsubject, $destination_tid=0) { global $db, $thread, $plugins;
|
function split_posts($pids, $tid, $moveto, $newsubject, $destination_tid=0) { global $db, $thread, $plugins;
|
|
|
$tid = intval($tid); $moveto = intval($moveto); $newtid = intval($destination_tid);
| $tid = intval($tid); $moveto = intval($moveto); $newtid = intval($destination_tid);
|
Zeile 1138 | Zeile 1148 |
---|
LEFT JOIN ".TABLE_PREFIX."threads t ON (p.tid=t.tid) LEFT JOIN ".TABLE_PREFIX."attachments a ON (a.pid=p.pid) WHERE p.pid IN ($pids_list)
|
LEFT JOIN ".TABLE_PREFIX."threads t ON (p.tid=t.tid) LEFT JOIN ".TABLE_PREFIX."attachments a ON (a.pid=p.pid) WHERE p.pid IN ($pids_list)
|
GROUP BY p.pid
| GROUP BY p.pid, p.tid, p.fid, p.visible, p.uid, t.visible, t.replies, t.unapprovedposts,t.attachmentcount
|
");
// Move the selected posts over
| ");
// Move the selected posts over
|
Zeile 1183 | Zeile 1193 |
---|
// Add 1 to the new thread's replies ++$thread_counters[$newtid]['replies'];
|
// Add 1 to the new thread's replies ++$thread_counters[$newtid]['replies'];
|
|
|
if($moveto != $post['fid']) { // Only need to change forum info if the old forum is different from new forum // Subtract 1 from the old forum's posts if(!isset($forum_counters[$post['fid']]['posts']))
|
if($moveto != $post['fid']) { // Only need to change forum info if the old forum is different from new forum // Subtract 1 from the old forum's posts if(!isset($forum_counters[$post['fid']]['posts']))
|
{
| {
|
$forum_counters[$post['fid']]['posts'] = $forum_cache[$post['fid']]['posts'];
|
$forum_counters[$post['fid']]['posts'] = $forum_cache[$post['fid']]['posts'];
|
}
| }
|
--$forum_counters[$post['fid']]['posts']; // Add 1 to the new forum's posts if(!isset($forum_counters[$moveto]['posts']))
| --$forum_counters[$post['fid']]['posts']; // Add 1 to the new forum's posts if(!isset($forum_counters[$moveto]['posts']))
|
Zeile 1199 | Zeile 1209 |
---|
$forum_counters[$moveto]['posts'] = $forum_cache[$moveto]['posts']; } ++$forum_counters[$moveto]['posts'];
|
$forum_counters[$moveto]['posts'] = $forum_cache[$moveto]['posts']; } ++$forum_counters[$moveto]['posts'];
|
}
| }
|
} elseif($post['visible'] == 0)
| } elseif($post['visible'] == 0)
|
Zeile 1214 | Zeile 1224 |
---|
// Add 1 to the new thread's unapproved posts ++$thread_counters[$newtid]['unapprovedposts'];
|
// Add 1 to the new thread's unapproved posts ++$thread_counters[$newtid]['unapprovedposts'];
|
|
|
if($moveto != $post['fid']) { // Only need to change forum info if the old forum is different from new forum
| if($moveto != $post['fid']) { // Only need to change forum info if the old forum is different from new forum
|
Zeile 1260 | Zeile 1270 |
---|
$change = '+'.$change; // add the addition operator for query } $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum{$change} WHERE uid='{$uid}'");
|
$change = '+'.$change; // add the addition operator for query } $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum{$change} WHERE uid='{$uid}'");
|
}
| }
|
}
// Update thread counters
| }
// Update thread counters
|
Zeile 1275 | Zeile 1285 |
---|
$newthread = $db->fetch_array($query); $sqlarray = array( "subject" => $newsubject,
|
$newthread = $db->fetch_array($query); $sqlarray = array( "subject" => $newsubject,
|
"replyto" => 0
| "replyto" => 0
|
); $db->update_query("posts", $sqlarray, "pid='{$newthread['pid']}'"); }
| ); $db->update_query("posts", $sqlarray, "pid='{$newthread['pid']}'"); }
|
Zeile 1306 | Zeile 1316 |
---|
update_first_post($tid); } }
|
update_first_post($tid); } }
|
| update_thread_data($newtid);
|
update_first_post($newtid);
// Update forum counters
| update_first_post($newtid);
// Update forum counters
|
Zeile 1341 | Zeile 1353 |
---|
$newforum = get_forum($moveto);
$total_posts = $total_unapproved_posts = $total_threads = $total_unapproved_threads = 0;
|
$newforum = get_forum($moveto);
$total_posts = $total_unapproved_posts = $total_threads = $total_unapproved_threads = 0;
|
$query = $db->simple_select("threads", "fid, visible, replies, unapprovedposts", "tid IN ($tid_list)");
| $query = $db->simple_select("threads", "fid, visible, replies, unapprovedposts, tid", "tid IN ($tid_list)");
|
while($thread = $db->fetch_array($query)) { $forum = get_forum($thread['fid']);
| while($thread = $db->fetch_array($query)) { $forum = get_forum($thread['fid']);
|