Zeile 254 | Zeile 254 |
---|
{ foreach($userposts as $uid => $subtract) {
|
{ foreach($userposts as $uid => $subtract) {
|
$update_array = array( "postnum" => "-{$subtract['num_posts']}", "threadnum" => "-{$subtract['num_threads']}", );
| $update_array = array();
if(isset($subtract['num_posts'])) { $update_array['postnum'] = "-{$subtract['num_posts']}"; }
if(isset($subtract['num_threads'])) { $update_array['threadnum'] = "-{$subtract['num_threads']}"; }
|
update_user_counters($uid, $update_array); } }
| update_user_counters($uid, $update_array); } }
|
Zeile 269 | Zeile 277 |
---|
$db->delete_query("posts", "pid IN ($pids)"); $db->delete_query("attachments", "pid IN ($pids)"); $db->delete_query("reportedcontent", "id IN ($pids) AND (type = 'post' OR type = '')");
|
$db->delete_query("posts", "pid IN ($pids)"); $db->delete_query("attachments", "pid IN ($pids)"); $db->delete_query("reportedcontent", "id IN ($pids) AND (type = 'post' OR type = '')");
|
}
| }
|
// Delete threads, redirects, subscriptions, polls, and poll votes $db->delete_query("threads", "tid='$tid'");
| // Delete threads, redirects, subscriptions, polls, and poll votes $db->delete_query("threads", "tid='$tid'");
|
Zeile 289 | Zeile 297 |
---|
"unapprovedposts" => "-{$num_unapproved_posts}", "deletedposts" => "-{$num_deleted_posts}" );
|
"unapprovedposts" => "-{$num_unapproved_posts}", "deletedposts" => "-{$num_deleted_posts}" );
|
|
|
if($thread['visible'] == 1) { $updated_counters['threads'] = -1;
| if($thread['visible'] == 1) { $updated_counters['threads'] = -1;
|
Zeile 309 | Zeile 317 |
---|
if($thread['visible'] == 1) { $updated_counters['posts'] = -1;
|
if($thread['visible'] == 1) { $updated_counters['posts'] = -1;
|
}
| }
|
elseif($thread['visible'] == -1) { $updated_counters['deletedposts'] = -1;
| elseif($thread['visible'] == -1) { $updated_counters['deletedposts'] = -1;
|
Zeile 326 | Zeile 334 |
---|
mark_reports($tid, 'thread');
$plugins->run_hooks("class_moderation_delete_thread", $tid);
|
mark_reports($tid, 'thread');
$plugins->run_hooks("class_moderation_delete_thread", $tid);
|
return true; }
| return true; }
|
/** * Delete a poll * * @param int $pid Poll id
|
/** * Delete a poll * * @param int $pid Poll id
|
* @return boolean
| * @return boolean
|
*/ function delete_poll($pid) { global $db, $plugins;
|
*/ function delete_poll($pid) { global $db, $plugins;
|
|
|
$pid = (int)$pid;
|
$pid = (int)$pid;
|
|
|
if(empty($pid)) { return false;
| if(empty($pid)) { return false;
|
Zeile 361 | Zeile 369 |
---|
/** * Approve one or more threads
|
/** * Approve one or more threads
|
* * @param array|int $tids Thread ID(s) * @return boolean
| * * @param array|int $tids Thread ID(s) * @return boolean
|
*/ function approve_threads($tids) {
| */ function approve_threads($tids) {
|
Zeile 372 | Zeile 380 |
---|
if(!is_array($tids)) { $tids = array($tids);
|
if(!is_array($tids)) { $tids = array($tids);
|
}
| }
|
if(empty($tids))
|
if(empty($tids))
|
{
| {
|
return false; }
|
return false; }
|
|
|
// Make sure we only have valid values $tids = array_map('intval', $tids);
|
// Make sure we only have valid values $tids = array_map('intval', $tids);
|
|
|
$tid_list = $forum_counters = $user_counters = $posts_to_approve = array();
|
$tid_list = $forum_counters = $user_counters = $posts_to_approve = array();
|
foreach($tids as $tid)
| $tids_list = implode(",", $tids); $query = $db->simple_select("threads", "*", "tid IN ($tids_list)");
while($thread = $db->fetch_array($query))
|
{
|
{
|
$thread = get_thread($tid); if(!$thread || $thread['visible'] == 1 || $thread['visible'] == -1)
| if($thread['visible'] == 1 || $thread['visible'] == -1)
|
{ continue; }
| { continue; }
|
Zeile 421 | Zeile 431 |
---|
if($forum['usepostcounts'] != 0) { // On approving thread restore user post counts
|
if($forum['usepostcounts'] != 0) { // On approving thread restore user post counts
|
$query = $db->simple_select("posts", "COUNT(pid) as posts, uid", "tid='{$tid}' AND (visible='1' OR pid='{$thread['firstpost']}') AND uid > 0 GROUP BY uid"); while($counter = $db->fetch_array($query))
| $query2 = $db->simple_select("posts", "COUNT(pid) as posts, uid", "tid='{$thread['tid']}' AND (visible='1' OR pid='{$thread['firstpost']}') AND uid > 0 GROUP BY uid"); while($counter = $db->fetch_array($query2))
|
{ $user_counters[$counter['uid']]['num_posts'] += $counter['posts']; }
| { $user_counters[$counter['uid']]['num_posts'] += $counter['posts']; }
|
Zeile 473 | Zeile 483 |
---|
foreach($forum_counters as $fid => $counters) { // Update stats
|
foreach($forum_counters as $fid => $counters) { // Update stats
|
$update_array = array(
| $update_array = array(
|
"threads" => "+{$counters['num_threads']}", "unapprovedthreads" => "-{$counters['num_threads']}", "posts" => "+{$counters['num_posts']}",
| "threads" => "+{$counters['num_threads']}", "unapprovedthreads" => "-{$counters['num_threads']}", "posts" => "+{$counters['num_posts']}",
|
Zeile 513 | Zeile 523 |
---|
if(!is_array($tids)) { $tids = array($tids);
|
if(!is_array($tids)) { $tids = array($tids);
|
}
| }
|
if(empty($tids)) { return false;
| if(empty($tids)) { return false;
|
Zeile 527 | Zeile 537 |
---|
$tid_moved_list = ""; $comma = ""; foreach($tids as $tid)
|
$tid_moved_list = ""; $comma = ""; foreach($tids as $tid)
|
{
| {
|
$tid_moved_list .= "{$comma}'moved|{$tid}'"; $comma = ","; }
|
$tid_moved_list .= "{$comma}'moved|{$tid}'"; $comma = ","; }
|
|
|
$forum_counters = $user_counters = $posts_to_unapprove = array();
|
$forum_counters = $user_counters = $posts_to_unapprove = array();
|
foreach($tids as $tid)
| $tids_list = implode(",", $tids); $query = $db->simple_select("threads", "*", "tid IN ($tids_list)");
while($thread = $db->fetch_array($query))
|
{
|
{
|
$thread = get_thread($tid);
| |
$forum = get_forum($thread['fid']);
if($thread['visible'] == 1 || $thread['visible'] == -1)
| $forum = get_forum($thread['fid']);
if($thread['visible'] == 1 || $thread['visible'] == -1)
|
Zeile 580 | Zeile 592 |
---|
// On unapproving thread update user post counts if($thread['visible'] == 1 && $forum['usepostcounts'] != 0) {
|
// On unapproving thread update user post counts if($thread['visible'] == 1 && $forum['usepostcounts'] != 0) {
|
$query = $db->simple_select("posts", "COUNT(pid) AS posts, uid", "tid='{$tid}' AND (visible='1' OR pid='{$thread['firstpost']}') AND uid > 0 GROUP BY uid"); while($counter = $db->fetch_array($query))
| $query2 = $db->simple_select("posts", "COUNT(pid) AS posts, uid", "tid='{$thread['tid']}' AND (visible='1' OR pid='{$thread['firstpost']}') AND uid > 0 GROUP BY uid"); while($counter = $db->fetch_array($query2))
|
{ $user_counters[$counter['uid']]['num_posts'] += $counter['posts']; }
| { $user_counters[$counter['uid']]['num_posts'] += $counter['posts']; }
|
Zeile 637 | Zeile 649 |
---|
}
if(!empty($user_counters))
|
}
if(!empty($user_counters))
|
{
| {
|
foreach($user_counters as $uid => $counters) { $update_array = array(
| foreach($user_counters as $uid => $counters) { $update_array = array(
|
Zeile 674 | Zeile 686 |
---|
if(!$post) { return false;
|
if(!$post) { return false;
|
}
| }
|
$forum = get_forum($post['fid']); // If post counts enabled in this forum and it hasn't already been unapproved, remove 1 if($forum['usepostcounts'] != 0 && $post['visible'] != -1 && $post['visible'] != 0 && $post['threadvisible'] != 0 && $post['threadvisible'] != -1) { update_user_counters($post['uid'], array('postnum' => "-1"));
|
$forum = get_forum($post['fid']); // If post counts enabled in this forum and it hasn't already been unapproved, remove 1 if($forum['usepostcounts'] != 0 && $post['visible'] != -1 && $post['visible'] != 0 && $post['threadvisible'] != 0 && $post['threadvisible'] != -1) { update_user_counters($post['uid'], array('postnum' => "-1"));
|
}
| }
|
if(!function_exists("remove_attachments")) { require MYBB_ROOT."inc/functions_upload.php"; }
|
if(!function_exists("remove_attachments")) { require MYBB_ROOT."inc/functions_upload.php"; }
|
|
|
// Remove attachments
|
// Remove attachments
|
remove_attachments($pid);
| remove_attachments($pid);
|
// Delete the post $db->delete_query("posts", "pid='$pid'");
| // Delete the post $db->delete_query("posts", "pid='$pid'");
|
Zeile 779 | Zeile 791 |
---|
LEFT JOIN ".TABLE_PREFIX."attachments a ON (a.pid=p.pid AND a.visible=1) WHERE p.pid IN($pidin) GROUP BY p.pid
|
LEFT JOIN ".TABLE_PREFIX."attachments a ON (a.pid=p.pid AND a.visible=1) WHERE p.pid IN($pidin) GROUP BY p.pid
|
ORDER BY p.dateline ASC
| ORDER BY p.dateline ASC, p.pid ASC
|
"); $message = ''; $threads = $forum_counters = $thread_counters = $user_counters = array();
| "); $message = ''; $threads = $forum_counters = $thread_counters = $user_counters = array();
|
Zeile 902 | Zeile 914 |
---|
{ // In some cases the first post of a thread changes // Therefore resync the visible field to make sure they're the same if they're not
|
{ // In some cases the first post of a thread changes // Therefore resync the visible field to make sure they're the same if they're not
|
$query = $db->simple_select("posts", "pid, uid, visible", "tid='{$thread['tid']}'", array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 1));
| $query = $db->simple_select("posts", "pid, uid, visible", "tid='{$thread['tid']}'", array('order_by' => 'dateline, pid', 'limit' => 1));
|
$new_firstpost = $db->fetch_array($query); if($thread['visible'] != $new_firstpost['visible']) {
| $new_firstpost = $db->fetch_array($query); if($thread['visible'] != $new_firstpost['visible']) {
|
Zeile 1171 | Zeile 1183 |
---|
'question' => $db->escape_string($poll['question']), 'dateline' => $poll['dateline'], 'options' => $db->escape_string($poll['options']),
|
'question' => $db->escape_string($poll['question']), 'dateline' => $poll['dateline'], 'options' => $db->escape_string($poll['options']),
|
'votes' => $poll['votes'],
| 'votes' => $db->escape_string($poll['votes']),
|
'numoptions' => $poll['numoptions'], 'numvotes' => $poll['numvotes'], 'timeout' => $poll['timeout'],
| 'numoptions' => $poll['numoptions'], 'numvotes' => $poll['numvotes'], 'timeout' => $poll['timeout'],
|
Zeile 1549 | Zeile 1561 |
---|
// In some cases the thread we may be merging with may cause us to have a new firstpost if it is an older thread // Therefore resync the visible field to make sure they're the same if they're not
|
// In some cases the thread we may be merging with may cause us to have a new firstpost if it is an older thread // Therefore resync the visible field to make sure they're the same if they're not
|
$query = $db->simple_select("posts", "pid, uid, visible", "tid='{$tid}'", array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 1));
| $query = $db->simple_select("posts", "pid, uid, visible", "tid='{$tid}'", array('order_by' => 'dateline, pid', 'limit' => 1));
|
$new_firstpost = $db->fetch_array($query); if($thread['visible'] != $new_firstpost['visible']) {
| $new_firstpost = $db->fetch_array($query); if($thread['visible'] != $new_firstpost['visible']) {
|
Zeile 1749 | Zeile 1761 |
---|
"replies" => "+{$mergethread['replies']}", "attachmentcount" => "+{$mergethread['attachmentcount']}", "unapprovedposts" => "+{$mergethread['unapprovedposts']}",
|
"replies" => "+{$mergethread['replies']}", "attachmentcount" => "+{$mergethread['attachmentcount']}", "unapprovedposts" => "+{$mergethread['unapprovedposts']}",
|
"deletedposts" => "+{$mergethread['unapprovedposts']}",
| |
"deletedposts" => "+{$mergethread['deletedposts']}" ); update_thread_counters($tid, $updated_stats);
| "deletedposts" => "+{$mergethread['deletedposts']}" ); update_thread_counters($tid, $updated_stats);
|
Zeile 1794 | Zeile 1805 |
---|
}
// Get the first split post
|
}
// Get the first split post
|
$query = $db->simple_select('posts', 'pid,uid,visible,icon,username,dateline', 'pid IN ('.$pids_list.')', array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 1));
| $query = $db->simple_select('posts', 'pid,uid,visible,icon,username,dateline', 'pid IN ('.$pids_list.')', array('order_by' => 'dateline, pid', 'limit' => 1));
|
$post_info = $db->fetch_array($query);
| $post_info = $db->fetch_array($query);
|
Zeile 1808 | Zeile 1819 |
---|
'unapprovedposts' => 0, 'deletedposts' => 0 );
|
'unapprovedposts' => 0, 'deletedposts' => 0 );
|
| $user_counters = array();
|
if($destination_tid == 0) {
| if($destination_tid == 0) {
|
Zeile 1896 | Zeile 1909 |
---|
'unapprovedposts' => 0, 'deletedposts' => 0, 'attachmentcount' => 0
|
'unapprovedposts' => 0, 'deletedposts' => 0, 'attachmentcount' => 0
|
); }
| ); }
|
if(!isset($forum_counters[$post['fid']])) { $forum_counters[$post['fid']] = array(
| if(!isset($forum_counters[$post['fid']])) { $forum_counters[$post['fid']] = array(
|
Zeile 1920 | Zeile 1933 |
---|
{ // Moving into a forum that doesn't count post counts --$user_counters[$post['uid']]['postnum'];
|
{ // Moving into a forum that doesn't count post counts --$user_counters[$post['uid']]['postnum'];
|
}
| }
|
// Subtract 1 from the old thread's replies --$thread_counters[$post['tid']]['replies']; } elseif($post['visible'] == 0)
|
// Subtract 1 from the old thread's replies --$thread_counters[$post['tid']]['replies']; } elseif($post['visible'] == 0)
|
{
| {
|
// Unapproved post // Subtract 1 from the old thread's unapproved posts --$thread_counters[$post['tid']]['unapprovedposts'];
| // Unapproved post // Subtract 1 from the old thread's unapproved posts --$thread_counters[$post['tid']]['unapprovedposts'];
|
Zeile 1942 | Zeile 1955 |
---|
if($post['threadvisible'] == 1 && $post['visible'] == 1) { --$forum_counters[$post['fid']]['posts'];
|
if($post['threadvisible'] == 1 && $post['visible'] == 1) { --$forum_counters[$post['fid']]['posts'];
|
}
| }
|
elseif($post['threadvisible'] == 0 || ($post['visible'] == 0 && $post['threadvisible'] == 1)) { --$forum_counters[$post['fid']]['unapprovedposts'];
| elseif($post['threadvisible'] == 0 || ($post['visible'] == 0 && $post['threadvisible'] == 1)) { --$forum_counters[$post['fid']]['unapprovedposts'];
|
Zeile 1960 | Zeile 1973 |
---|
{ // In some cases the first post of a thread changes // Therefore resync the visible field to make sure they're the same if they're not
|
{ // In some cases the first post of a thread changes // Therefore resync the visible field to make sure they're the same if they're not
|
$query = $db->simple_select("posts", "pid, visible, uid", "tid='{$post['tid']}'", array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 1));
| $query = $db->simple_select("posts", "pid, visible, uid", "tid='{$post['tid']}'", array('order_by' => 'dateline, pid', 'limit' => 1));
|
$new_firstpost = $db->fetch_array($query);
if(!isset($user_counters[$new_firstpost['uid']]))
| $new_firstpost = $db->fetch_array($query);
if(!isset($user_counters[$new_firstpost['uid']]))
|
Zeile 1987 | Zeile 2000 |
---|
elseif($new_firstpost['visible'] == -1) { --$thread_counters[$post['tid']]['deletedposts'];
|
elseif($new_firstpost['visible'] == -1) { --$thread_counters[$post['tid']]['deletedposts'];
|
}
| }
|
else { --$thread_counters[$post['tid']]['unapprovedposts'];
|
else { --$thread_counters[$post['tid']]['unapprovedposts'];
|
}
| }
|
if($post['threadvisible'] == 0 || ($new_firstpost['visible'] == 0 && $post['threadvisible'] == 1)) { --$forum_counters[$post['fid']]['unapprovedposts'];
| if($post['threadvisible'] == 0 || ($new_firstpost['visible'] == 0 && $post['threadvisible'] == 1)) { --$forum_counters[$post['fid']]['unapprovedposts'];
|
Zeile 2015 | Zeile 2028 |
---|
{ ++$thread_counters[$post['tid']]['deletedposts']; ++$forum_counters[$post['fid']]['deletedposts'];
|
{ ++$thread_counters[$post['tid']]['deletedposts']; ++$forum_counters[$post['fid']]['deletedposts'];
|
}
| }
|
else { ++$thread_counters[$post['tid']]['unapprovedposts'];
| else { ++$thread_counters[$post['tid']]['unapprovedposts'];
|
Zeile 2071 | Zeile 2084 |
---|
{ // Moving into a forum that does count post counts ++$user_counters[$post['uid']]['postnum'];
|
{ // Moving into a forum that does count post counts ++$user_counters[$post['uid']]['postnum'];
|
}
| }
|
// Add 1 to the new thread's replies ++$thread_counters[$newtid]['replies'];
| // Add 1 to the new thread's replies ++$thread_counters[$newtid]['replies'];
|
Zeile 2147 | Zeile 2160 |
---|
if($tid == $newtid) { // Update the subject of the first post in the new thread
|
if($tid == $newtid) { // Update the subject of the first post in the new thread
|
$query = $db->simple_select("posts", "pid", "tid='$newtid'", array('order_by' => 'dateline', 'limit' => 1));
| $query = $db->simple_select("posts", "pid", "tid='$newtid'", array('order_by' => 'dateline, pid', 'limit' => 1));
|
$newthread = $db->fetch_array($query); $sqlarray = array( "subject" => $newsubject,
| $newthread = $db->fetch_array($query); $sqlarray = array( "subject" => $newsubject,
|
Zeile 2163 | Zeile 2176 |
---|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (p.tid=t.tid) WHERE p.tid='{$tid}'
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (p.tid=t.tid) WHERE p.tid='{$tid}'
|
ORDER BY p.dateline ASC
| ORDER BY p.dateline ASC, p.pid ASC
|
LIMIT 1 "); $oldthread = $db->fetch_array($query);
| LIMIT 1 "); $oldthread = $db->fetch_array($query);
|
Zeile 2183 | Zeile 2196 |
---|
} update_thread_counters($tid, $counters); update_last_post($tid);
|
} update_thread_counters($tid, $counters); update_last_post($tid);
|
} }
| } }
|
// Update forum counters if(!empty($forum_counters))
| // Update forum counters if(!empty($forum_counters))
|
Zeile 2208 | Zeile 2221 |
---|
/** * Move multiple threads to new forum
|
/** * Move multiple threads to new forum
|
*
| *
|
* @param array $tids Thread IDs * @param int $moveto Destination forum * @return boolean
|
* @param array $tids Thread IDs * @param int $moveto Destination forum * @return boolean
|
| * * @deprecated Iterate over move_thread instead
|
*/ function move_threads($tids, $moveto) {
| */ function move_threads($tids, $moveto) {
|
Zeile 2760 | Zeile 2775 |
---|
$tid_list = implode(',', $tids);
// Get original subject
|
$tid_list = implode(',', $tids);
// Get original subject
|
$query = $db->simple_select("threads", "subject, tid", "tid IN ($tid_list)");
| $query = $db->query(" SELECT u.uid, u.username, t.tid, t.subject FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON t.uid=u.uid WHERE tid IN ($tid_list) ");
|
while($thread = $db->fetch_array($query)) { // Update threads and first posts with new subject
|
while($thread = $db->fetch_array($query)) { // Update threads and first posts with new subject
|
$subject = str_replace('{username}', $mybb->user['username'], $format); $subject = str_replace('{subject}', $thread['subject'], $subject); $new_subject = array( "subject" => $db->escape_string($subject)
| $find = array('{username}', 'author', '{subject}'); $replace = array($mybb->user['username'], $thread['username'], $thread['subject']);
$new_subject = str_ireplace($find, $replace, $format);
$args = array( 'thread' => &$thread, 'new_subject' => &$new_subject, );
$plugins->run_hooks("class_moderation_change_thread_subject_newsubject", $args);
$update_subject = array( "subject" => $db->escape_string($new_subject)
|
);
|
);
|
$db->update_query("threads", $new_subject, "tid='{$thread['tid']}'"); $db->update_query("posts", $new_subject, "tid='{$thread['tid']}' AND replyto='0'");
| $db->update_query("threads", $update_subject, "tid='{$thread['tid']}'"); $db->update_query("posts", $update_subject, "tid='{$thread['tid']}' AND replyto='0'");
|
}
$arguments = array("tids" => $tids, "format" => $format); $plugins->run_hooks("class_moderation_change_thread_subject", $arguments);
|
}
$arguments = array("tids" => $tids, "format" => $format); $plugins->run_hooks("class_moderation_change_thread_subject", $arguments);
|
return true; }
| return true; }
|
/** * Add thread expiry *
| /** * Add thread expiry *
|
Zeile 2789 | Zeile 2818 |
---|
function expire_thread($tid, $deletetime) { global $db, $plugins;
|
function expire_thread($tid, $deletetime) { global $db, $plugins;
|
|
|
$tid = (int)$tid;
if(empty($tid))
| $tid = (int)$tid;
if(empty($tid))
|
Zeile 2810 | Zeile 2839 |
---|
/** * Toggle post visibility (approved/unapproved)
|
/** * Toggle post visibility (approved/unapproved)
|
* * @param array $pids Post IDs
| * * @param array $pids Post IDs
|
* @return boolean true */ function toggle_post_visibility($pids)
| * @return boolean true */ function toggle_post_visibility($pids)
|
Zeile 2852 | Zeile 2881 |
---|
* @return boolean true */ function toggle_post_softdelete($pids)
|
* @return boolean true */ function toggle_post_softdelete($pids)
|
{ global $db;
// Make sure we only have valid values $pids = array_map('intval', $pids);
| { global $db;
// Make sure we only have valid values $pids = array_map('intval', $pids);
|
$pid_list = implode(',', $pids); $query = $db->simple_select("posts", 'pid, visible', "pid IN ($pid_list)");
| $pid_list = implode(',', $pids); $query = $db->simple_select("posts", 'pid, visible', "pid IN ($pid_list)");
|
Zeile 3494 | Zeile 3523 |
---|
$tid_list = $forum_counters = $user_counters = $posts_to_restore = array();
|
$tid_list = $forum_counters = $user_counters = $posts_to_restore = array();
|
foreach($tids as $tid)
| $tids_list = implode(",", $tids); $query = $db->simple_select("threads", "*", "tid IN ($tids_list)");
while($thread = $db->fetch_array($query))
|
{
|
{
|
$thread = get_thread($tid); if(!$thread || $thread['visible'] != -1)
| if($thread['visible'] != -1)
|
{ continue;
|
{ continue;
|
}
| }
|
$tid_list[] = $thread['tid'];
|
$tid_list[] = $thread['tid'];
|
|
|
$forum = get_forum($thread['fid']);
|
$forum = get_forum($thread['fid']);
|
|
|
if(!isset($forum_counters[$forum['fid']])) { $forum_counters[$forum['fid']] = array(
| if(!isset($forum_counters[$forum['fid']])) { $forum_counters[$forum['fid']] = array(
|
Zeile 3512 | Zeile 3543 |
---|
'num_threads' => 0, 'num_deleted_posts' => 0, 'num_unapproved_posts' => 0
|
'num_threads' => 0, 'num_deleted_posts' => 0, 'num_unapproved_posts' => 0
|
); }
| ); }
|
if(!isset($user_counters[$thread['uid']])) { $user_counters[$thread['uid']] = array( 'num_posts' => 0, 'num_threads' => 0 );
|
if(!isset($user_counters[$thread['uid']])) { $user_counters[$thread['uid']] = array( 'num_posts' => 0, 'num_threads' => 0 );
|
}
| }
|
++$forum_counters[$forum['fid']]['num_threads']; $forum_counters[$forum['fid']]['num_posts'] += $thread['replies']+1; // Remove implied visible from count $forum_counters[$forum['fid']]['num_deleted_posts'] += $thread['replies']+$thread['unapprovedposts']+1;
| ++$forum_counters[$forum['fid']]['num_threads']; $forum_counters[$forum['fid']]['num_posts'] += $thread['replies']+1; // Remove implied visible from count $forum_counters[$forum['fid']]['num_deleted_posts'] += $thread['replies']+$thread['unapprovedposts']+1;
|
Zeile 3531 | Zeile 3562 |
---|
if($forum['usepostcounts'] != 0) { // On approving thread restore user post counts
|
if($forum['usepostcounts'] != 0) { // On approving thread restore user post counts
|
$query = $db->simple_select("posts", "COUNT(pid) as posts, uid", "tid='{$tid}' AND (visible='1' OR pid='{$thread['firstpost']}') AND uid > 0 GROUP BY uid"); while($counter = $db->fetch_array($query))
| $query2 = $db->simple_select("posts", "COUNT(pid) as posts, uid", "tid='{$thread['tid']}' AND (visible='1' OR pid='{$thread['firstpost']}') AND uid > 0 GROUP BY uid"); while($counter = $db->fetch_array($query2))
|
{ if(!isset($user_counters[$counter['uid']]['num_posts'])) {
| { if(!isset($user_counters[$counter['uid']]['num_posts'])) {
|
Zeile 3578 | Zeile 3609 |
---|
if(!empty($posts_to_restore)) { $db->update_query("posts", $update, "pid IN (".implode(',', $posts_to_restore).")");
|
if(!empty($posts_to_restore)) { $db->update_query("posts", $update, "pid IN (".implode(',', $posts_to_restore).")");
|
}
$plugins->run_hooks("class_moderation_restore_threads", $tids);
| }
$plugins->run_hooks("class_moderation_restore_threads", $tids);
|
if(is_array($forum_counters)) { foreach($forum_counters as $fid => $counters) { // Update stats
|
if(is_array($forum_counters)) { foreach($forum_counters as $fid => $counters) { // Update stats
|
$update_array = array(
| $update_array = array(
|
"threads" => "+{$counters['num_threads']}", "posts" => "+{$counters['num_posts']}", "unapprovedposts" => "+{$counters['num_unapproved_posts']}",
| "threads" => "+{$counters['num_threads']}", "posts" => "+{$counters['num_posts']}", "unapprovedposts" => "+{$counters['num_unapproved_posts']}",
|
Zeile 3608 | Zeile 3639 |
---|
"threadnum" => "+{$counters['num_threads']}", ); update_user_counters($uid, $update_array);
|
"threadnum" => "+{$counters['num_threads']}", ); update_user_counters($uid, $update_array);
|
}
| }
|
} } return true;
| } } return true;
|
Zeile 3636 | Zeile 3667 |
---|
// Make sure we only have valid values $tids = array_map('intval', $tids);
|
// Make sure we only have valid values $tids = array_map('intval', $tids);
|
|
|
$tid_list = implode(',', $tids); $tid_moved_list = ""; $comma = "";
| $tid_list = implode(',', $tids); $tid_moved_list = ""; $comma = "";
|
Zeile 3647 | Zeile 3678 |
---|
}
$forum_counters = $user_counters = $posts_to_delete = array();
|
}
$forum_counters = $user_counters = $posts_to_delete = array();
|
foreach($tids as $tid)
| $tids_list = implode(",", $tids); $query = $db->simple_select("threads", "*", "tid IN ($tids_list)");
while($thread = $db->fetch_array($query))
|
{
|
{
|
$thread = get_thread($tid);
| |
$forum = get_forum($thread['fid']);
if($thread['visible'] == 1 || $thread['visible'] == 0)
| $forum = get_forum($thread['fid']);
if($thread['visible'] == 1 || $thread['visible'] == 0)
|
Zeile 3664 | Zeile 3697 |
---|
'num_deleted_posts' => 0, 'unapproved_threads' => 0, 'unapproved_posts' => 0
|
'num_deleted_posts' => 0, 'unapproved_threads' => 0, 'unapproved_posts' => 0
|
);
| );
|
}
if(!isset($user_counters[$thread['uid']]))
| }
if(!isset($user_counters[$thread['uid']]))
|
Zeile 3694 | Zeile 3727 |
---|
// On unapproving thread update user post counts if($thread['visible'] == 1 && $forum['usepostcounts'] != 0) {
|
// On unapproving thread update user post counts if($thread['visible'] == 1 && $forum['usepostcounts'] != 0) {
|
$query = $db->simple_select("posts", "COUNT(pid) AS posts, uid", "tid='{$tid}' AND (visible='1' OR pid='{$thread['firstpost']}') AND uid > 0 GROUP BY uid"); while($counter = $db->fetch_array($query))
| $query2 = $db->simple_select("posts", "COUNT(pid) AS posts, uid", "tid='{$thread['tid']}' AND (visible='1' OR pid='{$thread['firstpost']}') AND uid > 0 GROUP BY uid"); while($counter = $db->fetch_array($query2))
|
{ if(!isset($user_counters[$counter['uid']]['num_posts'])) {
| { if(!isset($user_counters[$counter['uid']]['num_posts'])) {
|
Zeile 3722 | Zeile 3755 |
---|
$query = $db->simple_select('threads', 'tid', "closed IN ({$tid_moved_list})");
mark_reports($tids, "threads");
|
$query = $db->simple_select('threads', 'tid', "closed IN ({$tid_moved_list})");
mark_reports($tids, "threads");
|
|
|
while($redirect_tid = $db->fetch_field($query, 'tid')) { $redirect_tids[] = $redirect_tid;
| while($redirect_tid = $db->fetch_field($query, 'tid')) { $redirect_tids[] = $redirect_tid;
|