Zeile 384 | Zeile 384 |
---|
$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 402 | Zeile 404 |
---|
'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(
| if(!isset($user_counters[$thread['uid']])) { $user_counters[$thread['uid']] = array(
|
Zeile 417 | Zeile 419 |
---|
$forum_counters[$forum['fid']]['num_posts'] += $thread['replies']+1; // Remove implied visible from count $forum_counters[$forum['fid']]['num_deleted_posts'] += $thread['deletedposts']; $forum_counters[$forum['fid']]['num_unapproved_posts'] += $thread['deletedposts']+$thread['replies']+1;
|
$forum_counters[$forum['fid']]['num_posts'] += $thread['replies']+1; // Remove implied visible from count $forum_counters[$forum['fid']]['num_deleted_posts'] += $thread['deletedposts']; $forum_counters[$forum['fid']]['num_unapproved_posts'] += $thread['deletedposts']+$thread['replies']+1;
|
|
|
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");
| $query = $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($query)) { $user_counters[$counter['uid']]['num_posts'] += $counter['posts'];
| while($counter = $db->fetch_array($query)) { $user_counters[$counter['uid']]['num_posts'] += $counter['posts'];
|
Zeile 437 | Zeile 439 |
---|
}
if(!empty($tid_list))
|
}
if(!empty($tid_list))
|
{
| {
|
$tid_moved_list = ""; $comma = ""; foreach($tid_list as $tid)
| $tid_moved_list = ""; $comma = ""; foreach($tid_list as $tid)
|
Zeile 534 | Zeile 536 |
---|
$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 584 |
---|
// 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");
| $query = $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($query)) { $user_counters[$counter['uid']]['num_posts'] += $counter['posts'];
| while($counter = $db->fetch_array($query)) { $user_counters[$counter['uid']]['num_posts'] += $counter['posts'];
|
Zeile 594 | Zeile 598 |
---|
} $posts_to_unapprove[] = $thread['firstpost'];
|
} $posts_to_unapprove[] = $thread['firstpost'];
|
}
| }
|
$approve = array( "visible" => 0
| $approve = array( "visible" => 0
|
Zeile 606 | Zeile 610 |
---|
while($redirect_tid = $db->fetch_field($query, 'tid')) { $redirect_tids[] = $redirect_tid;
|
while($redirect_tid = $db->fetch_field($query, 'tid')) { $redirect_tids[] = $redirect_tid;
|
}
| }
|
if(!empty($redirect_tids)) { $this->unapprove_threads($redirect_tids);
| if(!empty($redirect_tids)) { $this->unapprove_threads($redirect_tids);
|
Zeile 619 | Zeile 623 |
---|
$plugins->run_hooks("class_moderation_unapprove_threads", $tids);
if(!empty($forum_counters))
|
$plugins->run_hooks("class_moderation_unapprove_threads", $tids);
if(!empty($forum_counters))
|
{
| {
|
foreach($forum_counters as $fid => $counters) { // Update stats
| foreach($forum_counters as $fid => $counters) { // Update stats
|
Zeile 645 | Zeile 649 |
---|
"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 779 | Zeile 783 |
---|
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 802 | Zeile 806 |
---|
$fid = $post['fid']; $mastertid = $post['tid']; $first = 0;
|
$fid = $post['fid']; $mastertid = $post['tid']; $first = 0;
|
$visible = $post['visible'];
| $visible = $post['visible'];
|
} else {
| } else {
|
Zeile 814 | Zeile 818 |
---|
else { $message .= "[hr]{$post['message']}";
|
else { $message .= "[hr]{$post['message']}";
|
}
| }
|
if(!isset($forum_counters[$post['fid']])) { $forum_counters[$post['fid']] = array(
| if(!isset($forum_counters[$post['fid']])) { $forum_counters[$post['fid']] = array(
|
Zeile 835 | Zeile 839 |
---|
'num_posts' => 0, 'num_threads' => 0 );
|
'num_posts' => 0, 'num_threads' => 0 );
|
}
| }
|
// Subtract 1 from user's post count if($forum['usepostcounts'] != 0 && $post['threadvisible'] == 1) { // Update post count of the user of the merged posts --$user_counters[$post['uid']]['num_posts'];
|
// Subtract 1 from user's post count if($forum['usepostcounts'] != 0 && $post['threadvisible'] == 1) { // Update post count of the user of the merged posts --$user_counters[$post['uid']]['num_posts'];
|
}
| }
|
if($post['threadfirstpost'] == $post['pid'] && $forum['usethreadcounts'] != 0 && $post['threadvisible'] == 1) { --$user_counters[$post['uid']]['num_threads'];
| if($post['threadfirstpost'] == $post['pid'] && $forum['usethreadcounts'] != 0 && $post['threadvisible'] == 1) { --$user_counters[$post['uid']]['num_threads'];
|
Zeile 854 | Zeile 858 |
---|
--$thread_counters[$post['tid']]['unapprovedposts']; } elseif($post['visible'] == -1)
|
--$thread_counters[$post['tid']]['unapprovedposts']; } elseif($post['visible'] == -1)
|
{
| {
|
// Subtract 1 deleted post from post's thread --$thread_counters[$post['tid']]['deletedposts']; }
| // Subtract 1 deleted post from post's thread --$thread_counters[$post['tid']]['deletedposts']; }
|
Zeile 902 | Zeile 906 |
---|
{ // 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 1167 | Zeile 1171 |
---|
$poll = $db->fetch_array($query);
$poll_array = array(
|
$poll = $db->fetch_array($query);
$poll_array = array(
|
'tid' => $newtid,
| 'tid' => $newtid,
|
'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 1219 | Zeile 1223 |
---|
// Properly set our new firstpost in our new thread if($thread['firstpost'] == $post['pid'])
|
// Properly set our new firstpost in our new thread if($thread['firstpost'] == $post['pid'])
|
{
| {
|
$db->update_query("threads", array('firstpost' => $pid), "tid='{$newtid}'"); }
| $db->update_query("threads", array('firstpost' => $pid), "tid='{$newtid}'"); }
|
Zeile 1549 | Zeile 1553 |
---|
// 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 1753 |
---|
"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 1797 |
---|
}
// 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 1811 |
---|
'unapprovedposts' => 0, 'deletedposts' => 0 );
|
'unapprovedposts' => 0, 'deletedposts' => 0 );
|
| $user_counters = array();
|
if($destination_tid == 0) {
| if($destination_tid == 0) {
|
Zeile 1930 | Zeile 1935 |
---|
// 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'];
|
}
| }
|
elseif($post['visible'] == -1) { // Soft deleted post
| elseif($post['visible'] == -1) { // Soft deleted post
|
Zeile 1960 | Zeile 1965 |
---|
{ // 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 2021 | Zeile 2026 |
---|
++$thread_counters[$post['tid']]['unapprovedposts']; ++$forum_counters[$post['fid']]['unapprovedposts']; }
|
++$thread_counters[$post['tid']]['unapprovedposts']; ++$forum_counters[$post['fid']]['unapprovedposts']; }
|
}
| }
|
// Update user thread counter if thread opener changes if($post['threadvisible'] == 1 && $forum_cache[$post['fid']]['usethreadcounts'] == 1 && $post['uid'] != $new_firstpost['uid']) {
| // Update user thread counter if thread opener changes if($post['threadvisible'] == 1 && $forum_cache[$post['fid']]['usethreadcounts'] == 1 && $post['uid'] != $new_firstpost['uid']) {
|
Zeile 2030 | Zeile 2035 |
---|
--$user_counters[$post['uid']]['threadnum']; // Add thread to new thread opener ++$user_counters[$new_firstpost['uid']]['threadnum'];
|
--$user_counters[$post['uid']]['threadnum']; // Add thread to new thread opener ++$user_counters[$new_firstpost['uid']]['threadnum'];
|
}
| }
|
update_first_post($post['tid']); }
| update_first_post($post['tid']); }
|
Zeile 2041 | Zeile 2046 |
---|
if($post['visible'] != $newthread['visible']) { $db->update_query("posts", array('visible' => $newthread['visible']), "pid='{$post['pid']}'");
|
if($post['visible'] != $newthread['visible']) { $db->update_query("posts", array('visible' => $newthread['visible']), "pid='{$post['pid']}'");
|
|
|
// This is needed to update the forum counters correctly $post['visible'] = $newthread['visible']; }
| // This is needed to update the forum counters correctly $post['visible'] = $newthread['visible']; }
|
Zeile 2052 | Zeile 2057 |
---|
// Add thread to new thread opener ++$user_counters[$post['uid']]['threadnum']; if(!isset($user_counters[$newthread['uid']]))
|
// Add thread to new thread opener ++$user_counters[$post['uid']]['threadnum']; if(!isset($user_counters[$newthread['uid']]))
|
{
| {
|
$user_counters[$newthread['uid']] = array( 'postnum' => 0, 'threadnum' => 0
| $user_counters[$newthread['uid']] = array( 'postnum' => 0, 'threadnum' => 0
|
Zeile 2147 | Zeile 2152 |
---|
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 2168 |
---|
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 2762 | Zeile 2767 |
---|
$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);
| }
$arguments = array("tids" => $tids, "format" => $format);
|
Zeile 3306 | Zeile 3325 |
---|
'posts' => "-{$counters['num_posts']}", 'unapprovedposts' => "-{$counters['num_unapproved_posts']}", 'deletedposts' => "+{$counters['num_deleted_posts']}"
|
'posts' => "-{$counters['num_posts']}", 'unapprovedposts' => "-{$counters['num_unapproved_posts']}", 'deletedposts' => "+{$counters['num_deleted_posts']}"
|
);
| );
|
update_forum_counters($fid, $updated_forum_stats); update_forum_lastpost($fid); }
| update_forum_counters($fid, $updated_forum_stats); update_forum_lastpost($fid); }
|
Zeile 3496 | Zeile 3515 |
---|
$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; }
|
Zeile 3514 | Zeile 3535 |
---|
'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']]))
| }
if(!isset($user_counters[$thread['uid']]))
|
Zeile 3533 | Zeile 3554 |
---|
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");
| $query = $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($query)) { if(!isset($user_counters[$counter['uid']]['num_posts']))
| while($counter = $db->fetch_array($query)) { if(!isset($user_counters[$counter['uid']]['num_posts']))
|
Zeile 3650 | Zeile 3671 |
---|
$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 3696 | Zeile 3719 |
---|
// 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");
| $query = $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($query)) { if(!isset($user_counters[$counter['uid']]['num_posts']))
| while($counter = $db->fetch_array($query)) { if(!isset($user_counters[$counter['uid']]['num_posts']))
|
Zeile 3724 | Zeile 3747 |
---|
$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;
|