Zeile 434 | Zeile 434 |
---|
$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)) {
|
$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']])) { $user_counters[$counter['uid']] = array( 'num_posts' => 0, 'num_threads' => 0 ); }
|
$user_counters[$counter['uid']]['num_posts'] += $counter['posts']; }
|
$user_counters[$counter['uid']]['num_posts'] += $counter['posts']; }
|
}
| }
|
if($forum['usethreadcounts'] != 0 && substr($thread['closed'], 0, 6) != 'moved|')
|
if($forum['usethreadcounts'] != 0 && substr($thread['closed'], 0, 6) != 'moved|')
|
{
| {
|
++$user_counters[$thread['uid']]['num_threads']; }
| ++$user_counters[$thread['uid']]['num_threads']; }
|
Zeile 454 | Zeile 461 |
---|
{ $tid_moved_list .= "{$comma}'moved|{$tid}'"; $comma = ",";
|
{ $tid_moved_list .= "{$comma}'moved|{$tid}'"; $comma = ",";
|
}
| }
|
$tid_list = implode(',', $tid_list); $approve = array( "visible" => 1
| $tid_list = implode(',', $tid_list); $approve = array( "visible" => 1
|
Zeile 464 | Zeile 471 |
---|
$redirect_tids = array(); $query = $db->simple_select('threads', 'tid', "closed IN ({$tid_moved_list})"); while($redirect_tid = $db->fetch_field($query, 'tid'))
|
$redirect_tids = array(); $query = $db->simple_select('threads', 'tid', "closed IN ({$tid_moved_list})"); while($redirect_tid = $db->fetch_field($query, 'tid'))
|
{
| {
|
$redirect_tids[] = $redirect_tid; } if(!empty($redirect_tids))
| $redirect_tids[] = $redirect_tid; } if(!empty($redirect_tids))
|
Zeile 474 | Zeile 481 |
---|
if(!empty($posts_to_approve)) { $db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_approve).")");
|
if(!empty($posts_to_approve)) { $db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_approve).")");
|
}
$plugins->run_hooks("class_moderation_approve_threads", $tids);
| }
$plugins->run_hooks("class_moderation_approve_threads", $tids);
|
if(!empty($forum_counters)) {
| if(!empty($forum_counters)) {
|
Zeile 492 | Zeile 499 |
---|
); update_forum_counters($fid, $update_array); update_forum_lastpost($fid);
|
); update_forum_counters($fid, $update_array); update_forum_lastpost($fid);
|
} }
| } }
|
if(!empty($user_counters)) { foreach($user_counters as $uid => $counters)
| if(!empty($user_counters)) { foreach($user_counters as $uid => $counters)
|
Zeile 554 | Zeile 561 |
---|
if($thread['visible'] == 1 || $thread['visible'] == -1) { if(!isset($forum_counters[$forum['fid']]))
|
if($thread['visible'] == 1 || $thread['visible'] == -1) { if(!isset($forum_counters[$forum['fid']]))
|
{
| {
|
$forum_counters[$forum['fid']] = array( 'num_threads' => 0, 'num_posts' => 0,
| $forum_counters[$forum['fid']] = array( 'num_threads' => 0, 'num_posts' => 0,
|
Zeile 595 | Zeile 602 |
---|
$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)) {
|
$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']])) { $user_counters[$counter['uid']] = array( 'num_posts' => 0, 'num_threads' => 0 ); }
|
$user_counters[$counter['uid']]['num_posts'] += $counter['posts']; } }
| $user_counters[$counter['uid']]['num_posts'] += $counter['posts']; } }
|
Zeile 1604 | Zeile 1618 |
---|
{ $updated_stats = array( "unapprovedposts" => '+'.($mergethread['replies']+$mergethread['unapprovedposts']+$mergethread['deletedposts'])
|
{ $updated_stats = array( "unapprovedposts" => '+'.($mergethread['replies']+$mergethread['unapprovedposts']+$mergethread['deletedposts'])
|
); } elseif($thread['visible'] == -1) { $updated_stats = array(
| ); } elseif($thread['visible'] == -1) { $updated_stats = array(
|
"deletedposts" => '+'.($mergethread['replies']+$mergethread['deletedposts']+$mergethread['unapprovedposts']) ); }
| "deletedposts" => '+'.($mergethread['replies']+$mergethread['deletedposts']+$mergethread['unapprovedposts']) ); }
|
Zeile 2389 | Zeile 2403 |
---|
"threadnum" => "+{$counters['num_threads']}", ); update_user_counters($uid, $update_array);
|
"threadnum" => "+{$counters['num_threads']}", ); update_user_counters($uid, $update_array);
|
} }
| } }
|
if(is_array($forum_counters)) { foreach($forum_counters as $fid => $counter)
| if(is_array($forum_counters)) { foreach($forum_counters as $fid => $counter)
|
Zeile 3174 | Zeile 3188 |
---|
$arguments = array('tids' => $tids, 'prefix' => $prefix);
|
$arguments = array('tids' => $tids, 'prefix' => $prefix);
|
$plugins->run_hooks('class_moderation_apply_thread_prefix', $arguments);
| $plugins->run_hooks('class_moderation_apply_thread_prefix', $arguments);
|
return true; }
| return true; }
|
Zeile 3221 | Zeile 3235 |
---|
while($post = $db->fetch_array($query)) { // This is the first post in the thread so we're deleting the whole thread.
|
while($post = $db->fetch_array($query)) { // This is the first post in the thread so we're deleting the whole thread.
|
$threads_to_update[] = $post['tid']; }
if(!empty($threads_to_update))
| $threads_to_update[] = $post['tid']; }
if(!empty($threads_to_update))
|
{ $this->soft_delete_threads($threads_to_update); }
| { $this->soft_delete_threads($threads_to_update); }
|
Zeile 3243 | Zeile 3257 |
---|
$pids[] = $post['pid'];
if(!isset($thread_counters[$post['tid']]))
|
$pids[] = $post['pid'];
if(!isset($thread_counters[$post['tid']]))
|
{
| {
|
$thread_counters[$post['tid']] = array( 'replies' => 0, 'unapprovedposts' => 0, 'deletedposts' => 0
|
$thread_counters[$post['tid']] = array( 'replies' => 0, 'unapprovedposts' => 0, 'deletedposts' => 0
|
); }
| ); }
|
++$thread_counters[$post['tid']]['deletedposts']; if($post['visible'] == 1) { ++$thread_counters[$post['tid']]['replies'];
|
++$thread_counters[$post['tid']]['deletedposts']; if($post['visible'] == 1) { ++$thread_counters[$post['tid']]['replies'];
|
}
| }
|
else { ++$thread_counters[$post['tid']]['unapprovedposts'];
| else { ++$thread_counters[$post['tid']]['unapprovedposts'];
|
Zeile 3267 | Zeile 3281 |
---|
'num_posts' => 0, 'num_unapproved_posts' => 0, 'num_deleted_posts' => 0
|
'num_posts' => 0, 'num_unapproved_posts' => 0, 'num_deleted_posts' => 0
|
); }
// If the thread of this post is deleted then we've already taken into account this counter as implied. // Updating it again would cause it to double count if($post['threadvisible'] == 1) {
| ); }
// If the thread of this post is deleted then we've already taken into account this counter as implied. // Updating it again would cause it to double count if($post['threadvisible'] == 1) {
|
++$forum_counters[$post['fid']]['num_deleted_posts']; if($post['visible'] == 1) { ++$forum_counters[$post['fid']]['num_posts']; } else
|
++$forum_counters[$post['fid']]['num_deleted_posts']; if($post['visible'] == 1) { ++$forum_counters[$post['fid']]['num_posts']; } else
|
{
| {
|
++$forum_counters[$post['fid']]['num_unapproved_posts']; } }
| ++$forum_counters[$post['fid']]['num_unapproved_posts']; } }
|
Zeile 3318 | Zeile 3332 |
---|
"unapprovedposts" => "-".$counters['unapprovedposts'], "replies" => "-".$counters['replies'], "deletedposts" => "+".$counters['deletedposts']
|
"unapprovedposts" => "-".$counters['unapprovedposts'], "replies" => "-".$counters['replies'], "deletedposts" => "+".$counters['deletedposts']
|
);
update_thread_counters($tid, $counters_update); update_last_post($tid); }
| );
update_thread_counters($tid, $counters_update); update_last_post($tid); }
|
}
if(is_array($forum_counters))
| }
if(is_array($forum_counters))
|
Zeile 3418 | Zeile 3432 |
---|
{ $thread_counters[$post['tid']] = array( 'replies' => 0
|
{ $thread_counters[$post['tid']] = array( 'replies' => 0
|
); }
| ); }
|
++$thread_counters[$post['tid']]['replies'];
// If the thread of this post is deleted then we've already taken into account this counter as implied. // Updating it again would cause it to double count if($post['threadvisible'] == 1)
|
++$thread_counters[$post['tid']]['replies'];
// If the thread of this post is deleted then we've already taken into account this counter as implied. // Updating it again would cause it to double count if($post['threadvisible'] == 1)
|
{
| {
|
if(!isset($forum_counters[$post['fid']])) { $forum_counters[$post['fid']] = array( 'num_posts' => 0 );
|
if(!isset($forum_counters[$post['fid']])) { $forum_counters[$post['fid']] = array( 'num_posts' => 0 );
|
}
| }
|
++$forum_counters[$post['fid']]['num_posts']; }
// If post counts enabled in this forum and the thread is approved, add 1 if($post['usepostcounts'] != 0 && $post['threadvisible'] == 1)
|
++$forum_counters[$post['fid']]['num_posts']; }
// If post counts enabled in this forum and the thread is approved, add 1 if($post['usepostcounts'] != 0 && $post['threadvisible'] == 1)
|
{
| {
|
if(!isset($user_counters[$post['uid']])) { $user_counters[$post['uid']] = 0; } ++$user_counters[$post['uid']];
|
if(!isset($user_counters[$post['uid']])) { $user_counters[$post['uid']] = 0; } ++$user_counters[$post['uid']];
|
|
|
} }
| } }
|
Zeile 3468 | Zeile 3482 |
---|
$counters_update = array( "deletedposts" => "-".$counters['replies'], "replies" => "+".$counters['replies']
|
$counters_update = array( "deletedposts" => "-".$counters['replies'], "replies" => "+".$counters['replies']
|
);
| );
|
update_thread_counters($tid, $counters_update); update_last_post($tid); } }
if(is_array($forum_counters))
|
update_thread_counters($tid, $counters_update); update_last_post($tid); } }
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 3493 | Zeile 3507 |
---|
{ update_user_counters($uid, array('postnum' => "+{$counter}")); }
|
{ update_user_counters($uid, array('postnum' => "+{$counter}")); }
|
}
| }
|
return true; }
| return true; }
|
Zeile 3511 | Zeile 3525 |
---|
if(!is_array($tids)) { $tids = array($tids);
|
if(!is_array($tids)) { $tids = array($tids);
|
}
| }
|
if(empty($tids)) { return false; }
|
if(empty($tids)) { 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);
|
Zeile 3529 | Zeile 3543 |
---|
while($thread = $db->fetch_array($query)) { if($thread['visible'] != -1)
|
while($thread = $db->fetch_array($query)) { if($thread['visible'] != -1)
|
{
| {
|
continue; } $tid_list[] = $thread['tid'];
$forum = get_forum($thread['fid']);
|
continue; } $tid_list[] = $thread['tid'];
$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 3547 | Zeile 3561 |
---|
}
if(!isset($user_counters[$thread['uid']]))
|
}
if(!isset($user_counters[$thread['uid']]))
|
{
| {
|
$user_counters[$thread['uid']] = array( 'num_posts' => 0, 'num_threads' => 0 ); }
|
$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 3565 | Zeile 3579 |
---|
$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)) {
|
$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']]))
|
{
|
{
|
$user_counters[$counter['uid']]['num_posts'] = 0;
| $user_counters[$counter['uid']] = array( 'num_posts' => 0, 'num_threads' => 0 );
|
} $user_counters[$counter['uid']]['num_posts'] += $counter['posts']; }
| } $user_counters[$counter['uid']]['num_posts'] += $counter['posts']; }
|
Zeile 3730 | Zeile 3747 |
---|
$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)) {
|
$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']]))
|
{
|
{
|
$user_counters[$counter['uid']]['num_posts'] = 0;
| $user_counters[$counter['uid']] = array( 'num_posts' => 0, 'num_threads' => 0 );
|
} $user_counters[$counter['uid']]['num_posts'] += $counter['posts']; }
| } $user_counters[$counter['uid']]['num_posts'] += $counter['posts']; }
|