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 4330 2009-03-16 02:17:06Z Tikitiki $
| * $Id: class_moderation.php 4736 2010-01-23 23:18:59Z Huji $
|
*/
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_threads++; // Implied forum unapproved count for unapproved threads
|
Zeile 742 | Zeile 752 |
---|
"uid" => $thread['uid'], "username" => $db->escape_string($thread['username']), "dateline" => $thread['dateline'],
|
"uid" => $thread['uid'], "username" => $db->escape_string($thread['username']), "dateline" => $thread['dateline'],
|
| "firstpost" => $thread['firstpost'],
|
"lastpost" => $thread['lastpost'], "lastposteruid" => $thread['lastposteruid'], "lastposter" => $db->escape_string($thread['lastposter']),
| "lastpost" => $thread['lastpost'], "lastposteruid" => $thread['lastposteruid'], "lastposter" => $db->escape_string($thread['lastposter']),
|
Zeile 903 | Zeile 914 |
---|
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 1026 | Zeile 1037 |
---|
$db->update_query("threadsubscriptions", $sqlarray, "tid='{$mergetid}'"); update_first_post($tid);
|
$db->update_query("threadsubscriptions", $sqlarray, "tid='{$mergetid}'"); update_first_post($tid);
|
$arguments = array("mergetid" => $tid, "tid" => $tid, "subject" => $subject);
| $arguments = array("mergetid" => $mergetid, "tid" => $tid, "subject" => $subject);
|
$plugins->run_hooks("class_moderation_merge_threads", $arguments);
$this->delete_thread($mergetid);
| $plugins->run_hooks("class_moderation_merge_threads", $arguments);
$this->delete_thread($mergetid);
|
Zeile 1091 | Zeile 1102 |
---|
$pids = array_map('intval', $pids);
$pids_list = implode(',', $pids);
|
$pids = array_map('intval', $pids);
$pids_list = implode(',', $pids);
|
| // Get the icon for the first split post $query = $db->simple_select("posts", "icon", "pid=".intval($pids[0])); $icon = $db->fetch_array($query);
|
if($destination_tid == 0) {
| if($destination_tid == 0) {
|
Zeile 1101 | Zeile 1116 |
---|
$query = array( "fid" => $moveto, "subject" => $newsubject,
|
$query = array( "fid" => $moveto, "subject" => $newsubject,
|
"icon" => intval($thread['icon']),
| "icon" => intval($icon['icon']),
|
"uid" => intval($thread['uid']), "username" => $db->escape_string($thread['username']), "dateline" => intval($thread['dateline']),
| "uid" => intval($thread['uid']), "username" => $db->escape_string($thread['username']), "dateline" => intval($thread['dateline']),
|
Zeile 1115 | Zeile 1130 |
---|
$forum_counters[$moveto]['threads'] = $forum_cache[$moveto]['threads']; ++$forum_counters[$moveto]['threads'];
|
$forum_counters[$moveto]['threads'] = $forum_cache[$moveto]['threads']; ++$forum_counters[$moveto]['threads'];
|
}
| }
|
// Get attachment counts for each post /*$query = $db->simple_select("attachments", "COUNT(aid) as count, pid", "pid IN ($pids_list)");
| // Get attachment counts for each post /*$query = $db->simple_select("attachments", "COUNT(aid) as count, pid", "pid IN ($pids_list)");
|
Zeile 1138 | Zeile 1153 |
---|
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 1158 | Zeile 1173 |
---|
if($forum_cache[$post['fid']]['usepostcounts'] == 1 && $forum_cache[$moveto]['usepostcounts'] == 0) { // Moving into a forum that doesn't count post counts
|
if($forum_cache[$post['fid']]['usepostcounts'] == 1 && $forum_cache[$moveto]['usepostcounts'] == 0) { // Moving into a forum that doesn't count post counts
|
if(!isset($user_counters[$post['uid']])) { $user_counters[$post['uid']] = 0; }
| if(!isset($user_counters[$post['uid']])) { $user_counters[$post['uid']] = 0; }
|
--$user_counters[$post['uid']]; } elseif($forum_cache[$post['fid']]['usepostcounts'] == 0 && $forum_cache[$moveto]['usepostcounts'] == 1)
| --$user_counters[$post['uid']]; } elseif($forum_cache[$post['fid']]['usepostcounts'] == 0 && $forum_cache[$moveto]['usepostcounts'] == 1)
|
Zeile 1172 | Zeile 1187 |
---|
$user_counters[$post['uid']] = 0; } ++$user_counters[$post['uid']];
|
$user_counters[$post['uid']] = 0; } ++$user_counters[$post['uid']];
|
}
| }
|
// Subtract 1 from the old thread's replies if(!isset($thread_counters[$post['tid']]['replies']))
| // Subtract 1 from the old thread's replies if(!isset($thread_counters[$post['tid']]['replies']))
|
Zeile 1183 | Zeile 1198 |
---|
// 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 1214 |
---|
$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 1229 |
---|
// 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 1275 |
---|
$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 1290 |
---|
$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 1321 |
---|
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 1358 |
---|
$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']);
|