Zeile 323 | Zeile 323 |
---|
// Update forum count update_forum_counters($thread['fid'], $updated_counters); update_forum_lastpost($thread['fid']);
|
// Update forum count update_forum_counters($thread['fid'], $updated_counters); update_forum_lastpost($thread['fid']);
|
| mark_reports($tid, 'thread');
|
$plugins->run_hooks("class_moderation_delete_thread", $tid);
| $plugins->run_hooks("class_moderation_delete_thread", $tid);
|
Zeile 754 | Zeile 755 |
---|
* @param int $tid Thread ID (Set to 0 if posts from multiple threads are selected) * @return int ID of the post into which all other posts are merged */
|
* @param int $tid Thread ID (Set to 0 if posts from multiple threads are selected) * @return int ID of the post into which all other posts are merged */
|
function merge_posts($pids, $tid=0, $sep="new_line")
| function merge_posts($pids=array(), $tid=0, $sep="new_line")
|
{ global $db, $plugins;
| { global $db, $plugins;
|
Zeile 801 | Zeile 802 |
---|
$fid = $post['fid']; $mastertid = $post['tid']; $first = 0;
|
$fid = $post['fid']; $mastertid = $post['tid']; $first = 0;
|
| $visible = $post['visible'];
|
} else {
| } else {
|
Zeile 844 | Zeile 846 |
---|
{ --$user_counters[$post['uid']]['num_threads']; }
|
{ --$user_counters[$post['uid']]['num_threads']; }
|
| $thread_counters[$post['tid']]['attachmentcount'] -= $post['attachmentcount'];
|
} elseif($post['visible'] == 0) {
| } elseif($post['visible'] == 0) {
|
Zeile 855 | Zeile 858 |
---|
// 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']; }
|
$thread_counters[$post['tid']]['attachmentcount'] -= $post['attachmentcount'];
| |
// Subtract 1 post from post's forum if($post['threadvisible'] == 1 && $post['visible'] == 1)
| // Subtract 1 post from post's forum if($post['threadvisible'] == 1 && $post['visible'] == 1)
|
Zeile 869 | Zeile 871 |
---|
else { --$forum_counters[$post['fid']]['deletedposts'];
|
else { --$forum_counters[$post['fid']]['deletedposts'];
|
| }
// Add attachment count to thread if($visible == 1) { $thread_counters[$mastertid]['attachmentcount'] += $post['attachmentcount'];
|
} } }
| } } }
|
Zeile 936 | Zeile 944 |
---|
); } ++$user_counters[$new_firstpost['uid']]['num_threads'];
|
); } ++$user_counters[$new_firstpost['uid']]['num_threads'];
|
}
| }
|
update_first_post($thread['tid']); }
| update_first_post($thread['tid']); }
|
Zeile 1044 | Zeile 1052 |
---|
$plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);
$query = $db->simple_select('threads', 'tid', "closed='moved|$tid' AND fid='$new_fid'");
|
$plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);
$query = $db->simple_select('threads', 'tid', "closed='moved|$tid' AND fid='$new_fid'");
|
while($redirect_tid = $db->fetch_field($query, 'tid')) { $this->delete_thread($redirect_tid);
| while($redirect_tid = $db->fetch_field($query, 'tid')) { $this->delete_thread($redirect_tid);
|
} $changefid = array( "fid" => $new_fid,
| } $changefid = array( "fid" => $new_fid,
|
Zeile 1559 | Zeile 1567 |
---|
if($new_firstpost['pid'] != $thread['firstpost']) { update_first_post($thread['tid']);
|
if($new_firstpost['pid'] != $thread['firstpost']) { update_first_post($thread['tid']);
|
}
// Subtract merged thread from user counter if($mergethread['visible'] == 1 && $forum_cache[$mergethread['fid']]['usethreadcounts'] == 1) { if(!isset($user_posts[$mergethread['uid']]['threadnum'])) { $user_posts[$mergethread['uid']]['threadnum'] = 0; } --$user_posts[$mergethread['uid']]['threadnum'];
| |
}
// Update thread count if thread has a new firstpost and is visible if($thread['uid'] != $new_firstpost['uid'] && $thread['visible'] == 1 && $forum_cache[$thread['fid']]['usethreadcounts'] == 1) { if(!isset($user_posts[$thread['uid']]['threadnum']))
|
}
// Update thread count if thread has a new firstpost and is visible if($thread['uid'] != $new_firstpost['uid'] && $thread['visible'] == 1 && $forum_cache[$thread['fid']]['usethreadcounts'] == 1) { if(!isset($user_posts[$thread['uid']]['threadnum']))
|
{
| {
|
$user_posts[$thread['uid']]['threadnum'] = 0; } --$user_posts[$thread['uid']]['threadnum']; if(!isset($user_posts[$new_firstpost['uid']]['threadnum']))
|
$user_posts[$thread['uid']]['threadnum'] = 0; } --$user_posts[$thread['uid']]['threadnum']; if(!isset($user_posts[$new_firstpost['uid']]['threadnum']))
|
{
| {
|
$user_posts[$new_firstpost['uid']]['threadnum'] = 0;
|
$user_posts[$new_firstpost['uid']]['threadnum'] = 0;
|
}
| }
|
++$user_posts[$new_firstpost['uid']]['threadnum']; }
| ++$user_posts[$new_firstpost['uid']]['threadnum']; }
|
Zeile 1591 | Zeile 1589 |
---|
{ // If new thread is unapproved, implied counter comes in to effect if($thread['visible'] == 0)
|
{ // If new thread is unapproved, implied counter comes in to effect if($thread['visible'] == 0)
|
{ $updated_stats = array(
| { $updated_stats = array(
|
"unapprovedposts" => '+'.($mergethread['replies']+$mergethread['unapprovedposts']+$mergethread['deletedposts'])
|
"unapprovedposts" => '+'.($mergethread['replies']+$mergethread['unapprovedposts']+$mergethread['deletedposts'])
|
);
| );
|
} elseif($thread['visible'] == -1) { $updated_stats = array( "deletedposts" => '+'.($mergethread['replies']+$mergethread['deletedposts']+$mergethread['unapprovedposts'])
|
} elseif($thread['visible'] == -1) { $updated_stats = array( "deletedposts" => '+'.($mergethread['replies']+$mergethread['deletedposts']+$mergethread['unapprovedposts'])
|
); } else
| ); } else
|
{ $updated_stats = array( "posts" => "+{$mergethread['replies']}", "unapprovedposts" => "+{$mergethread['unapprovedposts']}", "deletedposts" => "+{$mergethread['deletedposts']}"
|
{ $updated_stats = array( "posts" => "+{$mergethread['replies']}", "unapprovedposts" => "+{$mergethread['unapprovedposts']}", "deletedposts" => "+{$mergethread['deletedposts']}"
|
);
| );
|
} update_forum_counters($thread['fid'], $updated_stats);
| } update_forum_counters($thread['fid'], $updated_stats);
|
Zeile 1623 | Zeile 1621 |
---|
{ $updated_stats = array( "deletedposts" => '-'.($mergethread['replies']+$mergethread['deletedposts']+$mergethread['unapprovedposts'])
|
{ $updated_stats = array( "deletedposts" => '-'.($mergethread['replies']+$mergethread['deletedposts']+$mergethread['unapprovedposts'])
|
); }
| ); }
|
else { $updated_stats = array(
| else { $updated_stats = array(
|
Zeile 1690 | Zeile 1688 |
---|
elseif($updated_stats['unapprovedposts'] > 0) { $new_stats['unapprovedposts'] = "+{$updated_stats['unapprovedposts']}";
|
elseif($updated_stats['unapprovedposts'] > 0) { $new_stats['unapprovedposts'] = "+{$updated_stats['unapprovedposts']}";
|
}
| }
|
if($updated_stats['deletedposts'] < 0)
|
if($updated_stats['deletedposts'] < 0)
|
{
| {
|
$new_stats['deletedposts'] = $updated_stats['deletedposts']; } elseif($updated_stats['deletedposts'] > 0) { $new_stats['deletedposts'] = "+{$updated_stats['deletedposts']}";
|
$new_stats['deletedposts'] = $updated_stats['deletedposts']; } elseif($updated_stats['deletedposts'] > 0) { $new_stats['deletedposts'] = "+{$updated_stats['deletedposts']}";
|
}
| }
|
if(!empty($new_stats)) {
| if(!empty($new_stats)) {
|
Zeile 1712 | Zeile 1710 |
---|
{ // Correct counters if($new_firstpost['visible'] == 1)
|
{ // Correct counters if($new_firstpost['visible'] == 1)
|
{
| {
|
--$mergethread['replies']; } elseif($new_firstpost['visible'] == -1)
| --$mergethread['replies']; } elseif($new_firstpost['visible'] == -1)
|
Zeile 1756 | Zeile 1754 |
---|
); update_thread_counters($tid, $updated_stats); update_last_post($tid);
|
); update_thread_counters($tid, $updated_stats); update_last_post($tid);
|
|
|
// Forum last post has to be updated after thread update_forum_lastpost($thread['fid']); return true; }
|
// Forum last post has to be updated after thread update_forum_lastpost($thread['fid']); return true; }
|
|
|
/** * Split posts into a new/existing thread *
| /** * Split posts into a new/existing thread *
|
Zeile 1777 | Zeile 1775 |
---|
function split_posts($pids, $tid, $moveto, $newsubject, $destination_tid=0) { global $db, $thread, $plugins, $cache;
|
function split_posts($pids, $tid, $moveto, $newsubject, $destination_tid=0) { global $db, $thread, $plugins, $cache;
|
|
|
$tid = (int)$tid; $moveto = (int)$moveto; $newtid = (int)$destination_tid;
| $tid = (int)$tid; $moveto = (int)$moveto; $newtid = (int)$destination_tid;
|
Zeile 1799 | Zeile 1797 |
---|
$query = $db->simple_select('posts', 'pid,uid,visible,icon,username,dateline', 'pid IN ('.$pids_list.')', array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 1));
$post_info = $db->fetch_array($query);
|
$query = $db->simple_select('posts', 'pid,uid,visible,icon,username,dateline', 'pid IN ('.$pids_list.')', array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 1));
$post_info = $db->fetch_array($query);
|
|
|
$visible = $post_info['visible'];
$forum_counters[$moveto] = array(
| $visible = $post_info['visible'];
$forum_counters[$moveto] = array(
|
Zeile 1841 | Zeile 1839 |
---|
'threadnum' => 0 ); }
|
'threadnum' => 0 ); }
|
// Subtract thread from old thread opener --$user_counters[$newthread['uid']]['threadnum'];
| ++$user_counters[$newthread['uid']]['threadnum'];
|
} elseif($visible == -1)
|
} elseif($visible == -1)
|
{
| {
|
++$forum_counters[$moveto]['deletedthreads']; } else
| ++$forum_counters[$moveto]['deletedthreads']; } else
|
Zeile 1933 | Zeile 1930 |
---|
// 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) {
| } elseif($post['visible'] == -1) {
|
// Soft deleted post // Subtract 1 from the old thread's deleted posts --$thread_counters[$post['tid']]['deletedposts'];
| // Soft deleted post // Subtract 1 from the old thread's deleted posts --$thread_counters[$post['tid']]['deletedposts'];
|
Zeile 2023 | Zeile 2020 |
---|
{ ++$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
| }
// Update user thread counter if thread opener changes
|
Zeile 2111 | Zeile 2108 |
---|
{ // If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post --$thread_counters[$newtid]['replies'];
|
{ // If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post --$thread_counters[$newtid]['replies'];
|
}
| }
|
elseif($destination_tid == 0 && $newthread['visible'] == 0)
|
elseif($destination_tid == 0 && $newthread['visible'] == 0)
|
{
| {
|
// If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post --$thread_counters[$newtid]['unapprovedposts']; } elseif($destination_tid == 0 && $newthread['visible'] == -1)
|
// If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post --$thread_counters[$newtid]['unapprovedposts']; } elseif($destination_tid == 0 && $newthread['visible'] == -1)
|
{
| {
|
// If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post --$thread_counters[$newtid]['deletedposts']; }
|
// If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post --$thread_counters[$newtid]['deletedposts']; }
|
|
|
$arguments = array("pids" => $pids, "tid" => $tid, "moveto" => $moveto, "newsubject" => $newsubject, "destination_tid" => $destination_tid); $plugins->run_hooks("class_moderation_split_posts", $arguments);
| $arguments = array("pids" => $pids, "tid" => $tid, "moveto" => $moveto, "newsubject" => $newsubject, "destination_tid" => $destination_tid); $plugins->run_hooks("class_moderation_split_posts", $arguments);
|
Zeile 2130 | Zeile 2127 |
---|
if(!empty($user_counters)) { foreach($user_counters as $uid => $counters)
|
if(!empty($user_counters)) { foreach($user_counters as $uid => $counters)
|
{ foreach($counters as $key => $counter) { if($counter >= 0)
| { foreach($counters as $key => $counter) { if($counter >= 0)
|
{ $counters[$key] = "+{$counter}"; // add the addition operator for query }
| { $counters[$key] = "+{$counter}"; // add the addition operator for query }
|
Zeile 2154 | Zeile 2151 |
---|
$newthread = $db->fetch_array($query); $sqlarray = array( "subject" => $newsubject,
|
$newthread = $db->fetch_array($query); $sqlarray = array( "subject" => $newsubject,
|
"replyto" => 0 );
| "replyto" => 0 );
|
$db->update_query("posts", $sqlarray, "pid='{$newthread['pid']}'"); } else
| $db->update_query("posts", $sqlarray, "pid='{$newthread['pid']}'"); } else
|
Zeile 2175 | Zeile 2172 |
---|
"replyto" => 0 ); $db->update_query("posts", $sqlarray, "pid='{$oldthread['pid']}'");
|
"replyto" => 0 ); $db->update_query("posts", $sqlarray, "pid='{$oldthread['pid']}'");
|
}
foreach($counters as $key => $counter)
| }
foreach($counters as $key => $counter)
|
{ if($counter >= 0) {
| { if($counter >= 0) {
|
Zeile 2253 | Zeile 2250 |
---|
); }
|
); }
|
if(!isset($user_counters[$thread['uid']]['num_threads']))
| if(!isset($user_counters[$thread['uid']]))
|
{
|
{
|
$user_counters[$thread['uid']]['num_threads'] = 0;
| $user_counters[$thread['uid']] = array( 'num_posts' => 0, 'num_threads' => 0 );
|
}
if($thread['visible'] == 1)
| }
if($thread['visible'] == 1)
|
Zeile 2289 | Zeile 2289 |
---|
"); while($posters = $db->fetch_array($query1)) {
|
"); while($posters = $db->fetch_array($query1)) {
|
if(!isset($user_counters[$posters['uid']]['num_posts']))
| if(!isset($user_counters[$posters['uid']]))
|
{
|
{
|
$user_counters[$posters['uid']]['num_posts'] = 0;
| $user_counters[$posters['uid']] = array( 'num_posts' => 0, 'num_threads' => 0 );
|
}
if($newforum['usepostcounts'] != 0 && $forum['usepostcounts'] == 0)
| }
if($newforum['usepostcounts'] != 0 && $forum['usepostcounts'] == 0)
|