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 5145 2010-07-30 21:30:51Z RyanGordon $
| * $Id: class_moderation.php 5828 2012-05-08 16:06:16Z Tomm $
|
*/
class Moderation
| */
class Moderation
|
Zeile 453 | Zeile 453 |
---|
{ 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 605 | Zeile 605 |
---|
} } }
|
} } }
|
// 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");
| $query2 = $db->simple_select("attachments", "COUNT(aid) as count", "pid IN({$pidin}) AND visible='1'"); $attachment_count = $db->fetch_field($query2, "count");
|
Zeile 753 | Zeile 749 |
---|
$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'], "lastpost" => $thread['lastpost'], "lastposteruid" => $thread['lastposteruid'], "lastposter" => $db->escape_string($thread['lastposter']),
| "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']),
|
"views" => 0, "replies" => 0, "closed" => "moved|$tid", "sticky" => $thread['sticky'],
|
"views" => 0, "replies" => 0, "closed" => "moved|$tid", "sticky" => $thread['sticky'],
|
"visible" => $thread['visible'],
| "visible" => intval($thread['visible']),
|
"notes" => '' ); $redirect_tid = $db->insert_query("threads", $threadarray);
| "notes" => '' ); $redirect_tid = $db->insert_query("threads", $threadarray);
|
Zeile 798 | Zeile 794 |
---|
"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 991 | Zeile 987 |
---|
if($forum['usepostcounts'] == 1 && $newforum['usepostcounts'] == 0 && $posters['visible'] == 1) { $pcount = "-{$posters['posts']}";
|
if($forum['usepostcounts'] == 1 && $newforum['usepostcounts'] == 0 && $posters['visible'] == 1) { $pcount = "-{$posters['posts']}";
|
}
| }
|
else if($forum['usepostcounts'] == 0 && $newforum['userpostcounts'] == 1 && $posters['visible'] == 1)
|
else if($forum['usepostcounts'] == 0 && $newforum['userpostcounts'] == 1 && $posters['visible'] == 1)
|
{
| {
|
$pcount = "+{$posters['posts']}";
|
$pcount = "+{$posters['posts']}";
|
}
| }
|
if(!empty($pcount)) { $db->update_query("users", array("postnum" => "postnum{$pcount}"), "uid='{$posters['uid']}'", 1, true); }
|
if(!empty($pcount)) { $db->update_query("users", array("postnum" => "postnum{$pcount}"), "uid='{$posters['uid']}'", 1, true); }
|
}
| }
|
// Update forum counts $update_array = array(
| // Update forum counts $update_array = array(
|
Zeile 1011 | Zeile 1007 |
---|
"unapprovedposts" => "+{$num_unapproved_posts}" ); update_forum_counters($new_fid, $update_array);
|
"unapprovedposts" => "+{$num_unapproved_posts}" ); update_forum_counters($new_fid, $update_array);
|
|
|
if($method != "copy") { $update_array = array(
| if($method != "copy") { $update_array = array(
|
Zeile 1068 | Zeile 1064 |
---|
$pollsql['poll'] = $mergethread['poll']; $sqlarray = array( "tid" => $tid,
|
$pollsql['poll'] = $mergethread['poll']; $sqlarray = array( "tid" => $tid,
|
);
| );
|
$db->update_query("polls", $sqlarray, "tid='".intval($mergethread['tid'])."'"); } else
|
$db->update_query("polls", $sqlarray, "tid='".intval($mergethread['tid'])."'"); } else
|
{
| {
|
$query = $db->simple_select("threads", "*", "poll='{$mergethread['poll']}' AND tid != '{$mergetid}'"); $pollcheck = $db->fetch_array($query); if(!$pollcheck['poll'])
|
$query = $db->simple_select("threads", "*", "poll='{$mergethread['poll']}' AND tid != '{$mergetid}'"); $pollcheck = $db->fetch_array($query); if(!$pollcheck['poll'])
|
{
| {
|
$db->delete_query("polls", "pid='{$mergethread['poll']}'"); $db->delete_query("pollvotes", "pid='{$mergethread['poll']}'");
|
$db->delete_query("polls", "pid='{$mergethread['poll']}'"); $db->delete_query("pollvotes", "pid='{$mergethread['poll']}'");
|
} }
$subject = $db->escape_string($subject);
$sqlarray = array(
| } }
$subject = $db->escape_string($subject);
$sqlarray = array(
|
"tid" => $tid, "fid" => $thread['fid'], "replyto" => 0,
|
"tid" => $tid, "fid" => $thread['fid'], "replyto" => 0,
|
"visible" => $mergethread['visible'], );
| );
|
$db->update_query("posts", $sqlarray, "tid='{$mergetid}'");
$pollsql['subject'] = $subject;
| $db->update_query("posts", $sqlarray, "tid='{$mergetid}'");
$pollsql['subject'] = $subject;
|
Zeile 1101 | Zeile 1096 |
---|
$sqlarray = array( "tid" => $tid, );
|
$sqlarray = array( "tid" => $tid, );
|
$db->update_query("threadsubscriptions", $sqlarray, "tid='{$mergetid}'");
| // Update the thread ratings $new_numrating = $thread['numratings'] + $mergethread['numratings']; $new_threadrating = $thread['totalratings'] + $mergethread['totalratings'];
$sqlarray = array( "numratings" => $new_numrating, "totalratings" => $new_threadrating );
$db->update_query("threads", $sqlarray, "tid = '{$tid}'");
// Check if we have a thread subscription already for our new thread $subscriptions = array( $tid => array(), $mergetid => array() );
$query = $db->simple_select("threadsubscriptions", "tid, uid", "tid='{$mergetid}' OR tid='{$tid}'"); while($subscription = $db->fetch_array($query)) { $subscriptions[$subscription['tid']][] = $subscription['uid']; }
// Update any subscriptions for the merged thread if(is_array($subscriptions[$mergetid])) { $update_users = array(); foreach($subscriptions[$mergetid] as $user) { if(!in_array($user, $subscriptions[$tid])) { // User doesn't have a $tid subscription $update_users[] = $user; } } if(!empty($update_users)) { $update_array = array( "tid" => $tid );
$update_users = implode(",", $update_users); $db->update_query("threadsubscriptions", $update_array, "tid = '{$mergetid}' AND uid IN ({$update_users})"); } } // Remove source thread subscriptions $db->delete_query("threadsubscriptions", "tid = '{$mergetid}'");
|
update_first_post($tid);
$arguments = array("mergetid" => $mergetid, "tid" => $tid, "subject" => $subject);
| update_first_post($tid);
$arguments = array("mergetid" => $mergetid, "tid" => $tid, "subject" => $subject);
|
Zeile 1202 | Zeile 1247 |
---|
$pids_list = implode(',', $pids);
// Get the icon for the first split post
|
$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);
| $query = $db->simple_select("posts", "icon, visible", "pid=".intval($pids[0])); $post_info = $db->fetch_array($query);
$icon = $post_info['icon']; $visible = $post_info['visible'];
|
if($destination_tid == 0) {
| if($destination_tid == 0) {
|
Zeile 1214 | Zeile 1262 |
---|
$query = array( "fid" => $moveto, "subject" => $newsubject,
|
$query = array( "fid" => $moveto, "subject" => $newsubject,
|
"icon" => intval($icon['icon']),
| "icon" => intval($icon),
|
"uid" => intval($thread['uid']), "username" => $db->escape_string($thread['username']), "dateline" => intval($thread['dateline']), "lastpost" => intval($thread['lastpost']), "lastposter" => $db->escape_string($thread['lastposter']), "replies" => count($pids)-1,
|
"uid" => intval($thread['uid']), "username" => $db->escape_string($thread['username']), "dateline" => intval($thread['dateline']), "lastpost" => intval($thread['lastpost']), "lastposter" => $db->escape_string($thread['lastposter']), "replies" => count($pids)-1,
|
"visible" => 1,
| "visible" => intval($visible),
|
"notes" => '' ); $newtid = $db->insert_query("threads", $query); $forum_counters[$moveto]['threads'] = $forum_cache[$moveto]['threads'];
|
"notes" => '' ); $newtid = $db->insert_query("threads", $query); $forum_counters[$moveto]['threads'] = $forum_cache[$moveto]['threads'];
|
++$forum_counters[$moveto]['threads'];
| $forum_counters[$moveto]['unapprovedthreads'] = $forum_cache[$moveto]['unapprovedthreads']; if($visible) { ++$forum_counters[$moveto]['threads']; } else { // Unapproved thread? ++$forum_counters[$moveto]['unapprovedthreads']; }
|
}
// Get attachment counts for each post
| }
// Get attachment counts for each post
|
Zeile 1480 | Zeile 1537 |
---|
}
$query1 = $db->query("
|
}
$query1 = $db->query("
|
SELECT COUNT(p.pid) AS posts, u.uid
| SELECT COUNT(p.pid) AS posts, p.visible, u.uid
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
WHERE tid='{$thread['tid']}'
| WHERE p.tid = '{$thread['tid']}'
|
GROUP BY u.uid ORDER BY posts DESC ");
| GROUP BY u.uid ORDER BY posts DESC ");
|
Zeile 1516 | Zeile 1573 |
---|
$query = $db->simple_select("threads", "tid, prefix", "tid IN ($tid_list) AND prefix != 0"); while($thread = $db->fetch_array($query)) {
|
$query = $db->simple_select("threads", "tid, prefix", "tid IN ($tid_list) AND prefix != 0"); while($thread = $db->fetch_array($query)) {
|
$query = $db->simple_select("threadprefixes", "COUNT(*) as num_prefixes", "(CONCAT(',',forums,',') LIKE '%,$new_fid,%' OR forums='-1') AND pid='".$thread['prefix']."'");
| $query = $db->simple_select("threadprefixes", "COUNT(*) as num_prefixes", "(CONCAT(',',forums,',') LIKE '%,$moveto,%' OR forums='-1') AND pid='".$thread['prefix']."'");
|
if($db->fetch_field($query, "num_prefixes") == 0) { $sqlarray = array(
| if($db->fetch_field($query, "num_prefixes") == 0) { $sqlarray = array(
|
Zeile 2074 | Zeile 2131 |
---|
$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);
|