Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: class_moderation.php 5523 2011-07-28 10:59:29Z Tomm $
| * $Id$
|
*/
class Moderation
| */
class Moderation
|
Zeile 237 | Zeile 237 |
---|
$db->delete_query("polls", "tid='$tid'"); $db->delete_query("pollvotes", "pid='".$thread['poll']."'"); $db->delete_query("threadsread", "tid='$tid'");
|
$db->delete_query("polls", "tid='$tid'"); $db->delete_query("pollvotes", "pid='".$thread['poll']."'"); $db->delete_query("threadsread", "tid='$tid'");
|
| $db->delete_query("threadratings", "tid='$tid'");
|
$updated_counters = array( "posts" => "-{$num_approved_posts}",
| $updated_counters = array( "posts" => "-{$num_approved_posts}",
|
Zeile 453 | Zeile 454 |
---|
{ global $db, $cache, $plugins;
|
{ global $db, $cache, $plugins;
|
$plugins->run_hooks_by_ref("class_moderation_delete_post_start", $pid);
| $pid = $plugins->run_hooks("class_moderation_delete_post_start", $pid);
|
// Get pid, uid, fid, tid, visibility, forum post count status of post $pid = intval($pid); $query = $db->query("
| // Get pid, uid, fid, tid, visibility, forum post count status of post $pid = intval($pid); $query = $db->query("
|
Zeile 545 | Zeile 546 |
---|
"); $num_unapproved_posts = $num_approved_posts = 0; $message = '';
|
"); $num_unapproved_posts = $num_approved_posts = 0; $message = '';
|
| $threads = array();
|
while($post = $db->fetch_array($query)) {
|
while($post = $db->fetch_array($query)) {
|
| $threads[$post['tid']] = $post['tid'];
|
if($first == 1) { // all posts will be merged into this one $masterpid = $post['pid'];
| if($first == 1) { // all posts will be merged into this one $masterpid = $post['pid'];
|
Zeile 605 | Zeile 608 |
---|
} } }
|
} } }
|
// Get lastpost pid to check if we're merging a post that is on the lastpost info $query = $db->simple_select("posts", "pid", "tid = '{$post['tid']}'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => '1')); $lastpostpid = $db->fetch_field($query, 'pid'); $query2 = $db->simple_select("attachments", "COUNT(aid) as count", "pid IN({$pidin}) AND visible='1'"); $attachment_count = $db->fetch_field($query2, "count"); $db->update_query("threads", array("attachmentcount" => $attachment_count), "tid = '{$mastertid}'");
| |
// Update the message $mergepost = array( "message" => $db->escape_string($message), ); $db->update_query("posts", $mergepost, "pid = '{$masterpid}'");
|
// Update the message $mergepost = array( "message" => $db->escape_string($message), ); $db->update_query("posts", $mergepost, "pid = '{$masterpid}'");
|
|
|
// Delete the extra posts $db->delete_query("posts", "pid IN({$pidin}) AND pid != '{$masterpid}'"); // Update pid for attachments
|
// Delete the extra posts $db->delete_query("posts", "pid IN({$pidin}) AND pid != '{$masterpid}'"); // Update pid for attachments
|
|
|
$mergepost2 = array( "pid" => $masterpid, );
| $mergepost2 = array( "pid" => $masterpid, );
|
Zeile 660 | Zeile 654 |
---|
if(is_array($thread_counters)) { foreach($thread_counters as $tid => $counters)
|
if(is_array($thread_counters)) { foreach($thread_counters as $tid => $counters)
|
{
| {
|
$db->update_query("threads", $counters, "tid='{$tid}'");
|
$db->update_query("threads", $counters, "tid='{$tid}'");
|
|
|
update_thread_data($tid);
|
update_thread_data($tid);
|
} }
| } }
|
update_thread_data($mastertid);
|
update_thread_data($mastertid);
|
|
|
update_forum_lastpost($fid);
|
update_forum_lastpost($fid);
|
| foreach($threads as $tid) { $count = array(); // Attachment count $query = $db->query(" SELECT COUNT(aid) AS attachment_count FROM ".TABLE_PREFIX."attachments a LEFT JOIN ".TABLE_PREFIX."posts p ON (a.pid=p.pid) WHERE p.tid='$tid' "); $count['attachmentcount'] = $db->fetch_field($query, "attachment_count"); if(!$count['attachmentcount']) { $count['attachmentcount'] = 0; }
update_thread_counters($tid, $count); }
|
if(is_array($forum_counters)) {
| if(is_array($forum_counters)) {
|
Zeile 709 | Zeile 723 |
---|
$newforum = get_forum($new_fid); $fid = $thread['fid']; $forum = get_forum($fid);
|
$newforum = get_forum($new_fid); $fid = $thread['fid']; $forum = get_forum($fid);
|
|
|
$num_threads = $num_unapproved_threads = $num_posts = $num_unapproved_threads = 0; switch($method) {
| $num_threads = $num_unapproved_threads = $num_posts = $num_unapproved_threads = 0; switch($method) {
|
Zeile 720 | Zeile 734 |
---|
if($thread['visible'] == 1) { $num_threads++;
|
if($thread['visible'] == 1) { $num_threads++;
|
$num_posts = $thread['replies']+1; }
| $num_posts = $thread['replies']+1; }
|
else { $num_unapproved_threads++;
| else { $num_unapproved_threads++;
|
Zeile 733 | Zeile 747 |
---|
$db->delete_query("threads", "closed='moved|$tid' AND fid='$new_fid'"); $changefid = array(
|
$db->delete_query("threads", "closed='moved|$tid' AND fid='$new_fid'"); $changefid = array(
|
"fid" => $new_fid,
| "fid" => $new_fid,
|
); $db->update_query("threads", $changefid, "tid='$tid'"); $db->update_query("posts", $changefid, "tid='$tid'");
| ); $db->update_query("threads", $changefid, "tid='$tid'"); $db->update_query("posts", $changefid, "tid='$tid'");
|
Zeile 753 | Zeile 767 |
---|
$threadarray = array( "fid" => $thread['fid'],
|
$threadarray = array( "fid" => $thread['fid'],
|
"subject" => $db->escape_string($thread['subject']), "icon" => $thread['icon'], "uid" => $thread['uid'], "username" => $db->escape_string($thread['username']), "dateline" => $thread['dateline'],
| "subject" => $db->escape_string($thread['subject']), "icon" => $thread['icon'], "uid" => $thread['uid'], "username" => $db->escape_string($thread['username']), "dateline" => $thread['dateline'],
|
"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 765 | Zeile 779 |
---|
"replies" => 0, "closed" => "moved|$tid", "sticky" => $thread['sticky'],
|
"replies" => 0, "closed" => "moved|$tid", "sticky" => $thread['sticky'],
|
"visible" => $thread['visible'],
| "visible" => intval($thread['visible']),
|
"notes" => '' ); $redirect_tid = $db->insert_query("threads", $threadarray); if($redirect_expire)
|
"notes" => '' ); $redirect_tid = $db->insert_query("threads", $threadarray); if($redirect_expire)
|
{
| {
|
$this->expire_thread($redirect_tid, $redirect_expire); }
| $this->expire_thread($redirect_tid, $redirect_expire); }
|
Zeile 782 | Zeile 796 |
---|
} break; case "copy":// copy thread
|
} break; case "copy":// copy thread
|
|
|
$threadarray = array( "fid" => $new_fid, "subject" => $db->escape_string($thread['subject']),
| $threadarray = array( "fid" => $new_fid, "subject" => $db->escape_string($thread['subject']),
|
Zeile 798 | Zeile 812 |
---|
"replies" => $thread['replies'], "closed" => $thread['closed'], "sticky" => $thread['sticky'],
|
"replies" => $thread['replies'], "closed" => $thread['closed'], "sticky" => $thread['sticky'],
|
"visible" => $thread['visible'],
| "visible" => intval($thread['visible']),
|
"unapprovedposts" => $thread['unapprovedposts'], "attachmentcount" => $thread['attachmentcount'], "prefix" => $thread['prefix'],
| "unapprovedposts" => $thread['unapprovedposts'], "attachmentcount" => $thread['attachmentcount'], "prefix" => $thread['prefix'],
|
Zeile 808 | Zeile 822 |
---|
if($thread['visible'] == 1) { ++$num_threads;
|
if($thread['visible'] == 1) { ++$num_threads;
|
$num_posts = $thread['replies']+1;
| $num_posts = $thread['replies']+1;
|
// Fetch count of unapproved posts in this thread $query = $db->simple_select("posts", "COUNT(pid) AS unapproved", "tid='{$thread['tid']}' AND visible=0"); $num_unapproved_posts = $db->fetch_field($query, "unapproved");
| // Fetch count of unapproved posts in this thread $query = $db->simple_select("posts", "COUNT(pid) AS unapproved", "tid='{$thread['tid']}' AND visible=0"); $num_unapproved_posts = $db->fetch_field($query, "unapproved");
|
Zeile 904 | Zeile 918 |
---|
{ $attachment_array = array( 'pid' => $pid,
|
{ $attachment_array = array( 'pid' => $pid,
|
'posthash' => $db->escape_string($attachment['posthash']),
| |
'uid' => $attachment['uid'], 'filename' => $db->escape_string($attachment['filename']), 'filetype' => $attachment['filetype'],
| 'uid' => $attachment['uid'], 'filename' => $db->escape_string($attachment['filename']), 'filetype' => $attachment['filetype'],
|
Zeile 1199 | Zeile 1212 |
---|
{ $updated_stats = array( "unapprovedposts" => '-'.($mergethread['replies']+1+$mergethread['unapprovedposts'])
|
{ $updated_stats = array( "unapprovedposts" => '-'.($mergethread['replies']+1+$mergethread['unapprovedposts'])
|
); } else
| ); } else
|
{ $updated_stats = array( "posts" => '-'.($mergethread['replies']+1),
| { $updated_stats = array( "posts" => '-'.($mergethread['replies']+1),
|
Zeile 1273 | Zeile 1286 |
---|
"lastpost" => intval($thread['lastpost']), "lastposter" => $db->escape_string($thread['lastposter']), "replies" => count($pids)-1,
|
"lastpost" => intval($thread['lastpost']), "lastposter" => $db->escape_string($thread['lastposter']), "replies" => count($pids)-1,
|
"visible" => $visible,
| "visible" => intval($visible),
|
"notes" => '' ); $newtid = $db->insert_query("threads", $query);
| "notes" => '' ); $newtid = $db->insert_query("threads", $query);
|
Zeile 1322 | Zeile 1335 |
---|
"replyto" => 0 ); $db->update_query("posts", $sqlarray, "pid IN ($pids_list)");
|
"replyto" => 0 ); $db->update_query("posts", $sqlarray, "pid IN ($pids_list)");
|
| $db->update_query("reportedposts", array('tid' => $newtid), "pid IN ($pids_list)");
|
// Get posts being merged while($post = $db->fetch_array($original_posts_query))
| // Get posts being merged while($post = $db->fetch_array($original_posts_query))
|
Zeile 1397 | Zeile 1411 |
---|
{ $forum_counters[$post['fid']]['unapprovedposts'] = $forum_cache[$post['fid']]['unapprovedposts']; }
|
{ $forum_counters[$post['fid']]['unapprovedposts'] = $forum_cache[$post['fid']]['unapprovedposts']; }
|
--$forum_counters[$post['fid']]['posts'];
| --$forum_counters[$post['fid']]['unapprovedposts'];
|
// Add 1 to the new forum's unapproved posts if(!isset($forum_counters[$moveto]['unapprovedposts'])) {
| // Add 1 to the new forum's unapproved posts if(!isset($forum_counters[$moveto]['unapprovedposts'])) {
|
Zeile 1517 | Zeile 1531 |
---|
$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", "tid IN ($tid_list)");
| $query = $db->simple_select("threads", "fid, visible, replies, unapprovedposts, tid", "tid IN ($tid_list) AND closed NOT LIKE 'moved|%'");
|
while($thread = $db->fetch_array($query)) { $forum = get_forum($thread['fid']);
| while($thread = $db->fetch_array($query)) { $forum = get_forum($thread['fid']);
|
Zeile 1545 | Zeile 1559 |
---|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE p.tid = '{$thread['tid']}'
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE p.tid = '{$thread['tid']}'
|
GROUP BY u.uid
| GROUP BY p.visible, u.uid
|
ORDER BY posts DESC "); while($posters = $db->fetch_array($query1))
| ORDER BY posts DESC "); while($posters = $db->fetch_array($query1))
|
Zeile 2135 | Zeile 2149 |
---|
$tids = array_map('intval', $tids); $tids_csv = implode(',', $tids);
|
$tids = array_map('intval', $tids); $tids_csv = implode(',', $tids);
|
$update_thread = array('prefix' => $prefix);
| $update_thread = array('prefix' => intval($prefix));
|
$db->update_query('threads', $update_thread, "tid IN ({$tids_csv})"); $arguments = array('tids' => $tids, 'prefix' => $prefix);
| $db->update_query('threads', $update_thread, "tid IN ({$tids_csv})"); $arguments = array('tids' => $tids, 'prefix' => $prefix);
|