Zeile 13 | Zeile 13 |
---|
/** * Close one or more threads *
|
/** * Close one or more threads *
|
* @param array Thread IDs
| * @param array|int $tids Thread ID(s)
|
* @return boolean true */ function close_threads($tids)
| * @return boolean true */ function close_threads($tids)
|
Zeile 43 | Zeile 43 |
---|
/** * Open one or more threads *
|
/** * Open one or more threads *
|
* @param int Thread IDs * @return boolean true
| * @param array|int $tids Thread ID(s) * @return boolean
|
*/
function open_threads($tids)
| */
function open_threads($tids)
|
Zeile 79 | Zeile 79 |
---|
/** * Stick one or more threads *
|
/** * Stick one or more threads *
|
* @param int Thread IDs * @return boolean true
| * @param array|int $tids Thread ID(s) * @return boolean
|
*/ function stick_threads($tids) {
| */ function stick_threads($tids) {
|
Zeile 114 | Zeile 114 |
---|
/** * Unstick one or more thread *
|
/** * Unstick one or more thread *
|
* @param int Thread IDs * @return boolean true
| * @param array|int $tids Thread ID(s) * @return boolean
|
*/ function unstick_threads($tids)
|
*/ function unstick_threads($tids)
|
{ global $db, $plugins;
| { global $db, $plugins;
|
if(!is_array($tids)) { $tids = array($tids);
|
if(!is_array($tids)) { $tids = array($tids);
|
}
if(empty($tids))
| }
if(empty($tids))
|
{ return false; }
| { return false; }
|
Zeile 137 | Zeile 137 |
---|
$plugins->run_hooks("class_moderation_unstick_threads", $tids);
$tid_list = implode(',', $tids);
|
$plugins->run_hooks("class_moderation_unstick_threads", $tids);
$tid_list = implode(',', $tids);
|
|
|
$unstickthread = array( "sticky" => 0, );
| $unstickthread = array( "sticky" => 0, );
|
Zeile 149 | Zeile 149 |
---|
/** * Remove redirects that redirect to the specified thread *
|
/** * Remove redirects that redirect to the specified thread *
|
* @param int Thread ID of the thread * @return boolean true
| * @param int $tid Thread ID of the thread * @return boolean
|
*/ function remove_redirects($tid) { global $db, $plugins;
|
*/ function remove_redirects($tid) { global $db, $plugins;
|
|
|
$plugins->run_hooks("class_moderation_remove_redirects", $tid);
// Delete the redirects $tid = (int)$tid; if(empty($tid))
|
$plugins->run_hooks("class_moderation_remove_redirects", $tid);
// Delete the redirects $tid = (int)$tid; if(empty($tid))
|
{ return false; }
| { return false; }
|
$query = $db->simple_select('threads', 'tid', "closed='moved|$tid'"); while($redirect_tid = $db->fetch_field($query, 'tid'))
| $query = $db->simple_select('threads', 'tid', "closed='moved|$tid'"); while($redirect_tid = $db->fetch_field($query, 'tid'))
|
Zeile 177 | Zeile 177 |
---|
/** * Delete a thread *
|
/** * Delete a thread *
|
* @param int Thread ID of the thread * @return boolean true
| * @param int $tid Thread ID of the thread * @return boolean
|
*/ function delete_thread($tid) {
| */ function delete_thread($tid) {
|
Zeile 187 | Zeile 187 |
---|
$tid = (int)$tid;
$plugins->run_hooks("class_moderation_delete_thread_start", $tid);
|
$tid = (int)$tid;
$plugins->run_hooks("class_moderation_delete_thread_start", $tid);
|
|
|
$thread = get_thread($tid); if(!$thread) { return false; } $forum = get_forum($thread['fid']);
|
$thread = get_thread($tid); if(!$thread) { return false; } $forum = get_forum($thread['fid']);
|
|
|
$userposts = array();
// Find the pid, uid, visibility, and forum post count status
| $userposts = array();
// Find the pid, uid, visibility, and forum post count status
|
Zeile 208 | Zeile 208 |
---|
if(!function_exists("remove_attachments")) { require_once MYBB_ROOT."inc/functions_upload.php";
|
if(!function_exists("remove_attachments")) { require_once MYBB_ROOT."inc/functions_upload.php";
|
}
| }
|
// Remove attachments remove_attachments($post['pid']);
// If the post is unapproved, count it! if(($post['visible'] == 0 && $thread['visible'] != -1) || $thread['visible'] == 0)
|
// Remove attachments remove_attachments($post['pid']);
// If the post is unapproved, count it! if(($post['visible'] == 0 && $thread['visible'] != -1) || $thread['visible'] == 0)
|
{
| {
|
$num_unapproved_posts++;
|
$num_unapproved_posts++;
|
}
| }
|
elseif($post['visible'] == -1 || $thread['visible'] == -1) { $num_deleted_posts++;
|
elseif($post['visible'] == -1 || $thread['visible'] == -1) { $num_deleted_posts++;
|
} else
| } else
|
{ $num_approved_posts++;
| { $num_approved_posts++;
|
Zeile 332 | Zeile 332 |
---|
/** * Delete a poll *
|
/** * Delete a poll *
|
* @param int Poll id * @return boolean true
| * @param int $pid Poll id * @return boolean
|
*/ function delete_poll($pid)
|
*/ function delete_poll($pid)
|
{
| {
|
global $db, $plugins;
|
global $db, $plugins;
|
|
|
$pid = (int)$pid;
if(empty($pid))
|
$pid = (int)$pid;
if(empty($pid))
|
{ return false; }
| { return false; }
|
$plugins->run_hooks("class_moderation_delete_poll", $pid);
| $plugins->run_hooks("class_moderation_delete_poll", $pid);
|
Zeile 361 | Zeile 361 |
---|
/** * Approve one or more threads *
|
/** * Approve one or more threads *
|
* @param array Thread IDs * @return boolean true
| * @param array|int $tids Thread ID(s) * @return boolean
|
*/ function approve_threads($tids) { global $db, $cache, $plugins;
|
*/ function approve_threads($tids) { global $db, $cache, $plugins;
|
|
|
if(!is_array($tids))
|
if(!is_array($tids))
|
{
| {
|
$tids = array($tids); }
if(empty($tids))
|
$tids = array($tids); }
if(empty($tids))
|
{
| {
|
return false; }
| return false; }
|
Zeile 395 | Zeile 395 |
---|
$forum = get_forum($thread['fid']);
if(!isset($forum_counters[$forum['fid']]))
|
$forum = get_forum($thread['fid']);
if(!isset($forum_counters[$forum['fid']]))
|
{
| {
|
$forum_counters[$forum['fid']] = array( 'num_posts' => 0, 'num_threads' => 0,
| $forum_counters[$forum['fid']] = array( 'num_posts' => 0, 'num_threads' => 0,
|
Zeile 502 | Zeile 502 |
---|
/** * Unapprove one or more threads *
|
/** * Unapprove one or more threads *
|
* @param array Thread IDs * @return boolean true
| * @param array|int $tids Thread ID(s) * @return boolean
|
*/ function unapprove_threads($tids)
|
*/ function unapprove_threads($tids)
|
{ global $db, $cache, $plugins;
if(!is_array($tids))
| { global $db, $cache, $plugins;
if(!is_array($tids))
|
{ $tids = array($tids); }
| { $tids = array($tids); }
|
Zeile 541 | Zeile 541 |
---|
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 561 | Zeile 561 |
---|
}
++$forum_counters[$forum['fid']]['num_unapprovedthreads'];
|
}
++$forum_counters[$forum['fid']]['num_unapprovedthreads'];
|
$forum_counters[$forum['fid']]['num_unapprovedposts'] += $thread['replies']+$thread['deletedposts']+1;
| $forum_counters[$forum['fid']]['num_unapprovedposts'] += $thread['replies']+$thread['deletedposts']+1;
|
if($thread['visible'] == 1) {
| if($thread['visible'] == 1) {
|
Zeile 593 | Zeile 593 |
---|
} $posts_to_unapprove[] = $thread['firstpost'];
|
} $posts_to_unapprove[] = $thread['firstpost'];
|
}
| }
|
$approve = array( "visible" => 0
| $approve = array( "visible" => 0
|
Zeile 613 | Zeile 613 |
---|
if(!empty($posts_to_unapprove)) { $db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_unapprove).")");
|
if(!empty($posts_to_unapprove)) { $db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_unapprove).")");
|
}
$plugins->run_hooks("class_moderation_unapprove_threads", $tids);
| }
$plugins->run_hooks("class_moderation_unapprove_threads", $tids);
|
if(!empty($forum_counters)) { foreach($forum_counters as $fid => $counters)
| if(!empty($forum_counters)) { foreach($forum_counters as $fid => $counters)
|
Zeile 653 | Zeile 653 |
---|
/** * Delete a specific post *
|
/** * Delete a specific post *
|
* @param int Post ID * @return boolean true
| * @param int $pid Post ID * @return boolean
|
*/ function delete_post($pid) {
| */ function delete_post($pid) {
|
Zeile 671 | Zeile 671 |
---|
"); $post = $db->fetch_array($query); if(!$post)
|
"); $post = $db->fetch_array($query); if(!$post)
|
{ return false;
| { return false;
|
}
$forum = get_forum($post['fid']);
| }
$forum = get_forum($post['fid']);
|
Zeile 685 | Zeile 685 |
---|
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($pid);
| // Remove attachments remove_attachments($pid);
|
Zeile 698 | Zeile 698 |
---|
// Update unapproved post count if($post['visible'] == 0)
|
// Update unapproved post count if($post['visible'] == 0)
|
{ $update_array = array( "unapprovedposts" => "-1"
| { $update_array = array( "unapprovedposts" => "-1"
|
); } elseif($post['visible'] == -1) { $update_array = array( "deletedposts" => "-1"
|
); } elseif($post['visible'] == -1) { $update_array = array( "deletedposts" => "-1"
|
);
| );
|
} else {
| } else {
|
Zeile 726 | Zeile 726 |
---|
{ $update_array = array( "unapprovedposts" => "-1"
|
{ $update_array = array( "unapprovedposts" => "-1"
|
); }
| ); }
|
elseif($post['visible'] == -1 || $post['threadvisible'] == -1) { $update_array = array(
| elseif($post['visible'] == -1 || $post['threadvisible'] == -1) { $update_array = array(
|
Zeile 750 | Zeile 750 |
---|
/** * Merge posts within thread *
|
/** * Merge posts within thread *
|
* @param array Post IDs to be merged * @param int Thread ID (Set to 0 if posts from multiple threads are * selected)
| * @param array $pids Post IDs to be 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")
| * @return int ID of the post into which all other posts are merged */ function merge_posts($pids, $tid=0, $sep="new_line")
|
Zeile 802 | Zeile 801 |
---|
$fid = $post['fid']; $mastertid = $post['tid']; $first = 0;
|
$fid = $post['fid']; $mastertid = $post['tid']; $first = 0;
|
| $visible = $post['visible'];
|
} else {
| } else {
|
Zeile 845 | Zeile 845 |
---|
{ --$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 856 | Zeile 857 |
---|
// 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 870 | Zeile 870 |
---|
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 953 | Zeile 959 |
---|
'unapprovedposts' => signed($counters['unapprovedposts']), 'deletedposts' => signed($counters['deletedposts']), 'attachmentcount' => signed($counters['attachmentcount'])
|
'unapprovedposts' => signed($counters['unapprovedposts']), 'deletedposts' => signed($counters['deletedposts']), 'attachmentcount' => signed($counters['attachmentcount'])
|
); update_thread_counters($tid, $counters); update_last_post($tid); } }
if(!empty($forum_counters)) { foreach($forum_counters as $fid => $counters) {
| ); update_thread_counters($tid, $counters); update_last_post($tid); } }
if(!empty($forum_counters)) { foreach($forum_counters as $fid => $counters) {
|
$updated_forum_stats = array( 'posts' => signed($counters['num_posts']), 'unapprovedposts' => signed($counters['unapprovedposts']),
| $updated_forum_stats = array( 'posts' => signed($counters['num_posts']), 'unapprovedposts' => signed($counters['unapprovedposts']),
|
Zeile 991 | Zeile 997 |
---|
/** * Move/copy thread *
|
/** * Move/copy thread *
|
* @param int Thread to be moved * @param int Destination forum * @param string Method of movement (redirect, copy, move) * @param int Expiry timestamp for redirect
| * @param int $tid Thread to be moved * @param int $new_fid Destination forum * @param string $method Method of movement (redirect, copy, move) * @param int $redirect_expire Expiry timestamp for redirect
|
* @return int Thread ID */ function move_thread($tid, $new_fid, $method="redirect", $redirect_expire=0)
| * @return int Thread ID */ function move_thread($tid, $new_fid, $method="redirect", $redirect_expire=0)
|
Zeile 1078 | Zeile 1084 |
---|
$threadarray = array( "fid" => $thread['fid'],
|
$threadarray = array( "fid" => $thread['fid'],
|
"subject" => $db->escape_string($thread['subject']), "icon" => $thread['icon'],
| "subject" => $db->escape_string($thread['subject']), "icon" => $thread['icon'],
|
"uid" => $thread['uid'], "username" => $db->escape_string($thread['username']), "dateline" => $thread['dateline'],
| "uid" => $thread['uid'], "username" => $db->escape_string($thread['username']), "dateline" => $thread['dateline'],
|
Zeile 1136 | Zeile 1142 |
---|
// If the thread has a prefix and the destination forum doesn't accept that prefix, don't copy the prefix if($threadarray['prefix'] != 0)
|
// If the thread has a prefix and the destination forum doesn't accept that prefix, don't copy the prefix if($threadarray['prefix'] != 0)
|
{
| {
|
switch($db->type) { case "pgsql":
| switch($db->type) { case "pgsql":
|
Zeile 1224 | Zeile 1230 |
---|
'pid' => $pid, 'uid' => $attachment['uid'], 'filename' => $db->escape_string($attachment['filename']),
|
'pid' => $pid, 'uid' => $attachment['uid'], 'filename' => $db->escape_string($attachment['filename']),
|
'filetype' => $attachment['filetype'],
| 'filetype' => $db->escape_string($attachment['filetype']),
|
'filesize' => $attachment['filesize'],
|
'filesize' => $attachment['filesize'],
|
'attachname' => $attachment['attachname'],
| 'attachname' => $db->escape_string($attachment['attachname']),
|
'downloads' => $attachment['downloads'], 'visible' => $attachment['visible'],
|
'downloads' => $attachment['downloads'], 'visible' => $attachment['visible'],
|
'thumbnail' => $attachment['thumbnail']
| 'thumbnail' => $db->escape_string($attachment['thumbnail'])
|
); $new_aid = $db->insert_query("attachments", $attachment_array);
| ); $new_aid = $db->insert_query("attachments", $attachment_array);
|
Zeile 1388 | Zeile 1394 |
---|
/** * Merge one thread into another *
|
/** * Merge one thread into another *
|
* @param int Thread that will be merged into destination * @param int Destination thread * @param string New thread subject * @return boolean true
| * @param int $mergetid Thread that will be merged into destination * @param int $tid Destination thread * @param string $subject New thread subject * @return boolean
|
*/ function merge_threads($mergetid, $tid, $subject) {
| */ function merge_threads($mergetid, $tid, $subject) {
|
Zeile 1399 | Zeile 1405 |
---|
$mergetid = (int)$mergetid; $tid = (int)$tid;
|
$mergetid = (int)$mergetid; $tid = (int)$tid;
|
|
|
if(!isset($mergethread['tid']) || $mergethread['tid'] != $mergetid) { $mergethread = get_thread($mergetid);
|
if(!isset($mergethread['tid']) || $mergethread['tid'] != $mergetid) { $mergethread = get_thread($mergetid);
|
}
| }
|
if(!isset($thread['tid']) || $thread['tid'] != $tid) { $thread = get_thread($tid);
|
if(!isset($thread['tid']) || $thread['tid'] != $tid) { $thread = get_thread($tid);
|
}
| }
|
if(!$mergethread || !$thread) {
| if(!$mergethread || !$thread) {
|
Zeile 1424 | Zeile 1430 |
---|
"tid" => $tid, ); $db->update_query("polls", $sqlarray, "tid='".(int)$mergethread['tid']."'");
|
"tid" => $tid, ); $db->update_query("polls", $sqlarray, "tid='".(int)$mergethread['tid']."'");
|
}
| }
|
// Both the old and the new thread have polls? Remove one elseif($mergethread['poll']) { $db->delete_query("polls", "pid='{$mergethread['poll']}'"); $db->delete_query("pollvotes", "pid='{$mergethread['poll']}'");
|
// Both the old and the new thread have polls? Remove one elseif($mergethread['poll']) { $db->delete_query("polls", "pid='{$mergethread['poll']}'"); $db->delete_query("pollvotes", "pid='{$mergethread['poll']}'");
|
}
| }
|
$subject = $db->escape_string($subject); $threadarray['subject'] = $subject;
| $subject = $db->escape_string($subject); $threadarray['subject'] = $subject;
|
Zeile 1457 | Zeile 1463 |
---|
} } }
|
} } }
|
$sqlarray = array( "tid" => $tid,
| $sqlarray = array( "tid" => $tid,
|
"fid" => $thread['fid'], "replyto" => 0, );
| "fid" => $thread['fid'], "replyto" => 0, );
|
Zeile 1480 | Zeile 1486 |
---|
$threadarray["numratings"] = $new_numrating; $threadarray["totalratings"] = $new_threadrating; $db->update_query("threads", $threadarray, "tid = '{$tid}'");
|
$threadarray["numratings"] = $new_numrating; $threadarray["totalratings"] = $new_threadrating; $db->update_query("threads", $threadarray, "tid = '{$tid}'");
|
|
|
// Check if we have a thread subscription already for our new thread $subscriptions = array();
$query = $db->simple_select("threadsubscriptions", "tid, uid", "tid='{$mergetid}' OR tid='{$tid}'"); while($subscription = $db->fetch_array($query))
|
// Check if we have a thread subscription already for our new thread $subscriptions = array();
$query = $db->simple_select("threadsubscriptions", "tid, uid", "tid='{$mergetid}' OR tid='{$tid}'"); while($subscription = $db->fetch_array($query))
|
{
| {
|
if(!isset($subscriptions[$subscription['tid']])) { $subscriptions[$subscription['tid']] = array(); } $subscriptions[$subscription['tid']][] = $subscription['uid'];
|
if(!isset($subscriptions[$subscription['tid']])) { $subscriptions[$subscription['tid']] = array(); } $subscriptions[$subscription['tid']][] = $subscription['uid'];
|
}
| }
|
// Update any subscriptions for the merged thread if(!empty($subscriptions[$mergetid])) {
| // Update any subscriptions for the merged thread if(!empty($subscriptions[$mergetid])) {
|
Zeile 1505 | Zeile 1511 |
---|
// User doesn't have a $tid subscription $update_users[] = $user; }
|
// User doesn't have a $tid subscription $update_users[] = $user; }
|
}
| }
|
if(!empty($update_users)) { $update_array = array(
| if(!empty($update_users)) { $update_array = array(
|
Zeile 1520 | Zeile 1526 |
---|
// Remove source thread subscriptions $db->delete_query("threadsubscriptions", "tid = '{$mergetid}'");
|
// Remove source thread subscriptions $db->delete_query("threadsubscriptions", "tid = '{$mergetid}'");
|
|
|
$arguments = array("mergetid" => $mergetid, "tid" => $tid, "subject" => $subject); $plugins->run_hooks("class_moderation_merge_threads", $arguments);
| $arguments = array("mergetid" => $mergetid, "tid" => $tid, "subject" => $subject); $plugins->run_hooks("class_moderation_merge_threads", $arguments);
|
Zeile 1534 | Zeile 1540 |
---|
elseif($mergethread['visible'] == -1) { ++$mergethread['deletedposts'];
|
elseif($mergethread['visible'] == -1) { ++$mergethread['deletedposts'];
|
} else {
| } else {
|
++$mergethread['unapprovedposts']; }
| ++$mergethread['unapprovedposts']; }
|
Zeile 1554 | Zeile 1560 |
---|
elseif($thread['visible'] == 1 && $forum_cache[$thread['fid']]['usepostcounts'] == 1) { ++$user_posts[$post['uid']]['postnum'];
|
elseif($thread['visible'] == 1 && $forum_cache[$thread['fid']]['usepostcounts'] == 1) { ++$user_posts[$post['uid']]['postnum'];
|
} }
| } }
|
// Update first post if needed if($new_firstpost['pid'] != $thread['firstpost']) { update_first_post($thread['tid']);
|
// Update first post if needed 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;
|
// 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']; }
| --$user_posts[$mergethread['uid']]['threadnum']; }
|
Zeile 1589 | Zeile 1595 |
---|
// Thread is not in current forum if($mergethread['fid'] != $thread['fid'])
|
// Thread is not in current forum if($mergethread['fid'] != $thread['fid'])
|
{ // 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( "unapprovedposts" => '+'.($mergethread['replies']+$mergethread['unapprovedposts']+$mergethread['deletedposts']) ); } elseif($thread['visible'] == -1)
|
$updated_stats = array( "unapprovedposts" => '+'.($mergethread['replies']+$mergethread['unapprovedposts']+$mergethread['deletedposts']) ); } elseif($thread['visible'] == -1)
|
{ $updated_stats = array(
| { $updated_stats = array(
|
"deletedposts" => '+'.($mergethread['replies']+$mergethread['deletedposts']+$mergethread['unapprovedposts']) ); }
| "deletedposts" => '+'.($mergethread['replies']+$mergethread['deletedposts']+$mergethread['unapprovedposts']) ); }
|
Zeile 1612 | Zeile 1618 |
---|
); } update_forum_counters($thread['fid'], $updated_stats);
|
); } update_forum_counters($thread['fid'], $updated_stats);
|
// If old thread is unapproved, implied counter comes in to effect
| // If old thread is unapproved, implied counter comes in to effect
|
if($mergethread['visible'] == 0) { $updated_stats = array(
| if($mergethread['visible'] == 0) { $updated_stats = array(
|
Zeile 1648 | Zeile 1654 |
---|
// If old thread is unapproved, implied counter comes in to effect if($mergethread['visible'] == 0)
|
// If old thread is unapproved, implied counter comes in to effect if($mergethread['visible'] == 0)
|
{
| {
|
$updated_stats['unapprovedposts'] -= $mergethread['replies']+$mergethread['deletedposts']; $updated_stats['posts'] += $mergethread['replies']; $updated_stats['deletedposts'] += $mergethread['deletedposts'];
| $updated_stats['unapprovedposts'] -= $mergethread['replies']+$mergethread['deletedposts']; $updated_stats['posts'] += $mergethread['replies']; $updated_stats['deletedposts'] += $mergethread['deletedposts'];
|
Zeile 1766 | Zeile 1772 |
---|
/** * Split posts into a new/existing thread *
|
/** * Split posts into a new/existing thread *
|
* @param array PIDs of posts to split * @param int Original thread ID (this is only used as a base for the new
| * @param array $pids PIDs of posts to split * @param int $tid Original thread ID (this is only used as a base for the new
|
* thread; it can be set to 0 when the posts specified are coming from more * than 1 thread)
|
* thread; it can be set to 0 when the posts specified are coming from more * than 1 thread)
|
* @param int Destination forum * @param string New thread subject * @param int TID if moving into existing thread * @return int New thread ID
| * @param int $moveto Destination forum * @param string $newsubject New thread subject * @param int $destination_tid TID if moving into existing thread * @return int|bool New thread ID or false on failure
|
*/ function split_posts($pids, $tid, $moveto, $newsubject, $destination_tid=0) {
| */ function split_posts($pids, $tid, $moveto, $newsubject, $destination_tid=0) {
|
Zeile 1880 | Zeile 1886 |
---|
"tid" => $newtid, "fid" => $moveto, "replyto" => 0
|
"tid" => $newtid, "fid" => $moveto, "replyto" => 0
|
);
| );
|
$db->update_query("posts", $sqlarray, "pid IN ($pids_list)");
$thread_counters[$newtid] = array(
| $db->update_query("posts", $sqlarray, "pid IN ($pids_list)");
$thread_counters[$newtid] = array(
|
Zeile 1900 | Zeile 1906 |
---|
'unapprovedposts' => 0, 'deletedposts' => 0, 'attachmentcount' => 0
|
'unapprovedposts' => 0, 'deletedposts' => 0, 'attachmentcount' => 0
|
);
| );
|
} if(!isset($forum_counters[$post['fid']])) {
| } if(!isset($forum_counters[$post['fid']])) {
|
Zeile 1934 | Zeile 1940 |
---|
// 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
|
// Subtract 1 from the old thread's deleted posts --$thread_counters[$post['tid']]['deletedposts']; }
// Subtract 1 from the old forum's posts if($post['threadvisible'] == 1 && $post['visible'] == 1)
|
// Subtract 1 from the old thread's deleted posts --$thread_counters[$post['tid']]['deletedposts']; }
// Subtract 1 from the old forum's 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']]['posts']; } elseif($post['threadvisible'] == 0 || ($post['visible'] == 0 && $post['threadvisible'] == 1))
|
Zeile 1991 | Zeile 1997 |
---|
elseif($new_firstpost['visible'] == -1) { --$thread_counters[$post['tid']]['deletedposts'];
|
elseif($new_firstpost['visible'] == -1) { --$thread_counters[$post['tid']]['deletedposts'];
|
} else {
| } else {
|
--$thread_counters[$post['tid']]['unapprovedposts']; } if($post['threadvisible'] == 0 || ($new_firstpost['visible'] == 0 && $post['threadvisible'] == 1))
| --$thread_counters[$post['tid']]['unapprovedposts']; } if($post['threadvisible'] == 0 || ($new_firstpost['visible'] == 0 && $post['threadvisible'] == 1))
|
Zeile 2105 | Zeile 2111 |
---|
else { ++$forum_counters[$moveto]['deletedposts'];
|
else { ++$forum_counters[$moveto]['deletedposts'];
|
} }
| } }
|
if($destination_tid == 0 && $newthread['visible'] == 1) {
| if($destination_tid == 0 && $newthread['visible'] == 1) {
|
Zeile 2213 | Zeile 2219 |
---|
/** * Move multiple threads to new forum *
|
/** * Move multiple threads to new forum *
|
* @param array Thread IDs * @param int Destination forum * @return boolean true
| * @param array $tids Thread IDs * @param int $moveto Destination forum * @return boolean
|
*/ function move_threads($tids, $moveto) {
| */ function move_threads($tids, $moveto) {
|
Zeile 2278 | Zeile 2284 |
---|
else if($newforum['usethreadcounts'] == 0 && $forum['usethreadcounts'] == 1) { --$user_counters[$thread['uid']]['num_threads'];
|
else if($newforum['usethreadcounts'] == 0 && $forum['usethreadcounts'] == 1) { --$user_counters[$thread['uid']]['num_threads'];
|
}
| }
|
$query1 = $db->query(" SELECT COUNT(p.pid) AS posts, u.uid
| $query1 = $db->query(" SELECT COUNT(p.pid) AS posts, u.uid
|
Zeile 2291 | Zeile 2297 |
---|
while($posters = $db->fetch_array($query1)) { if(!isset($user_counters[$posters['uid']]['num_posts']))
|
while($posters = $db->fetch_array($query1)) { if(!isset($user_counters[$posters['uid']]['num_posts']))
|
{
| {
|
$user_counters[$posters['uid']]['num_posts'] = 0; }
if($newforum['usepostcounts'] != 0 && $forum['usepostcounts'] == 0) { $user_counters[$posters['uid']]['num_posts'] += $posters['posts'];
|
$user_counters[$posters['uid']]['num_posts'] = 0; }
if($newforum['usepostcounts'] != 0 && $forum['usepostcounts'] == 0) { $user_counters[$posters['uid']]['num_posts'] += $posters['posts'];
|
}
| }
|
else if($newforum['usepostcounts'] == 0 && $forum['usepostcounts'] != 0) { $user_counters[$posters['uid']]['num_posts'] -= $posters['posts'];
| else if($newforum['usepostcounts'] == 0 && $forum['usepostcounts'] != 0) { $user_counters[$posters['uid']]['num_posts'] -= $posters['posts'];
|
Zeile 2319 | Zeile 2325 |
---|
$total_unapproved_posts += $thread['replies']+$thread['unapprovedposts']+$thread['deletedposts']+1;
$forum_counters[$thread['fid']]['unapprovedposts'] += $thread['replies']+$thread['unapprovedposts']+$thread['deletedposts']+1; // Implied unapproved posts counter for unapproved threads
|
$total_unapproved_posts += $thread['replies']+$thread['unapprovedposts']+$thread['deletedposts']+1;
$forum_counters[$thread['fid']]['unapprovedposts'] += $thread['replies']+$thread['unapprovedposts']+$thread['deletedposts']+1; // Implied unapproved posts counter for unapproved threads
|
|
|
$forum_counters[$thread['fid']]['unapprovedthreads']++; ++$total_unapproved_threads; }
| $forum_counters[$thread['fid']]['unapprovedthreads']++; ++$total_unapproved_threads; }
|
Zeile 2334 | Zeile 2340 |
---|
$sqlarray = array( "fid" => $moveto,
|
$sqlarray = array( "fid" => $moveto,
|
);
| );
|
$db->update_query("threads", $sqlarray, "tid IN ($tid_list)"); $db->update_query("posts", $sqlarray, "tid IN ($tid_list)");
| $db->update_query("threads", $sqlarray, "tid IN ($tid_list)"); $db->update_query("posts", $sqlarray, "tid IN ($tid_list)");
|
Zeile 2414 | Zeile 2420 |
---|
/** * Approve multiple posts *
|
/** * Approve multiple posts *
|
* @param array PIDs * @return boolean true
| * @param array $pids PIDs * @return boolean
|
*/ function approve_posts($pids) {
| */ function approve_posts($pids) {
|
Zeile 2494 | Zeile 2500 |
---|
); } ++$forum_counters[$post['fid']]['num_posts'];
|
); } ++$forum_counters[$post['fid']]['num_posts'];
|
}
$forum = get_forum($post['fid']);
| }
$forum = get_forum($post['fid']);
|
// If post counts enabled in this forum and the thread is approved, add 1 if($forum['usepostcounts'] != 0 && $post['threadvisible'] == 1) {
| // If post counts enabled in this forum and the thread is approved, add 1 if($forum['usepostcounts'] != 0 && $post['threadvisible'] == 1) {
|
Zeile 2523 | Zeile 2529 |
---|
$plugins->run_hooks("class_moderation_approve_posts", $pids);
if(!empty($thread_counters))
|
$plugins->run_hooks("class_moderation_approve_posts", $pids);
if(!empty($thread_counters))
|
{
| {
|
foreach($thread_counters as $tid => $counters) { $counters_update = array( "unapprovedposts" => "-".$counters['replies'], "replies" => "+".$counters['replies']
|
foreach($thread_counters as $tid => $counters) { $counters_update = array( "unapprovedposts" => "-".$counters['replies'], "replies" => "+".$counters['replies']
|
);
| );
|
update_thread_counters($tid, $counters_update); update_last_post($tid); }
| update_thread_counters($tid, $counters_update); update_last_post($tid); }
|
Zeile 2542 | Zeile 2548 |
---|
$updated_forum_stats = array( 'posts' => "+{$counters['num_posts']}", 'unapprovedposts' => "-{$counters['num_posts']}",
|
$updated_forum_stats = array( 'posts' => "+{$counters['num_posts']}", 'unapprovedposts' => "-{$counters['num_posts']}",
|
); update_forum_counters($fid, $updated_forum_stats); update_forum_lastpost($fid); } }
if(!empty($user_counters)) { foreach($user_counters as $uid => $counter) {
| ); update_forum_counters($fid, $updated_forum_stats); update_forum_lastpost($fid); } }
if(!empty($user_counters)) { foreach($user_counters as $uid => $counter) {
|
update_user_counters($uid, array('postnum' => "+{$counter}")); } }
return true; }
|
update_user_counters($uid, array('postnum' => "+{$counter}")); } }
return true; }
|
|
|
/** * Unapprove multiple posts *
|
/** * Unapprove multiple posts *
|
* @param array PIDs * @return boolean true
| * @param array $pids PIDs * @return boolean
|
*/ function unapprove_posts($pids) {
| */ function unapprove_posts($pids) {
|
Zeile 2572 | Zeile 2578 |
---|
if(empty($pids)) { return false;
|
if(empty($pids)) { return false;
|
}
| }
|
// Make sure we only have valid values $pids = array_map('intval', $pids);
| // Make sure we only have valid values $pids = array_map('intval', $pids);
|
Zeile 2607 | Zeile 2613 |
---|
if(!empty($threads_to_update)) { $this->unapprove_threads($threads_to_update);
|
if(!empty($threads_to_update)) { $this->unapprove_threads($threads_to_update);
|
}
| }
|
$thread_counters = $forum_counters = $user_counters = array();
| $thread_counters = $forum_counters = $user_counters = array();
|
Zeile 2627 | Zeile 2633 |
---|
'replies' => 0, 'unapprovedposts' => 0, 'deletedposts' => 0
|
'replies' => 0, 'unapprovedposts' => 0, 'deletedposts' => 0
|
); }
| ); }
|
++$thread_counters[$post['tid']]['unapprovedposts']; if($post['visible'] == 1) { ++$thread_counters[$post['tid']]['replies'];
|
++$thread_counters[$post['tid']]['unapprovedposts']; if($post['visible'] == 1) { ++$thread_counters[$post['tid']]['replies'];
|
}
| }
|
else { ++$thread_counters[$post['tid']]['deletedposts']; }
if(!isset($forum_counters[$post['fid']]))
|
else { ++$thread_counters[$post['tid']]['deletedposts']; }
if(!isset($forum_counters[$post['fid']]))
|
{
| {
|
$forum_counters[$post['fid']] = array( 'num_posts' => 0, 'num_unapproved_posts' => 0,
| $forum_counters[$post['fid']] = array( 'num_posts' => 0, 'num_unapproved_posts' => 0,
|
Zeile 2655 | Zeile 2661 |
---|
{ ++$forum_counters[$post['fid']]['num_unapproved_posts']; if($post['visible'] == 1)
|
{ ++$forum_counters[$post['fid']]['num_unapproved_posts']; if($post['visible'] == 1)
|
{
| {
|
++$forum_counters[$post['fid']]['num_posts']; } else { ++$forum_counters[$post['fid']]['num_deleted_posts'];
|
++$forum_counters[$post['fid']]['num_posts']; } else { ++$forum_counters[$post['fid']]['num_deleted_posts'];
|
}
| }
|
}
$forum = get_forum($post['fid']);
| }
$forum = get_forum($post['fid']);
|
Zeile 2733 | Zeile 2739 |
---|
/** * Change thread subject *
|
/** * Change thread subject *
|
* @param mixed Thread ID(s) * @param string Format of new subject (with {subject}) * @return boolean true
| * @param int|array $tids Thread ID(s) * @param string $format Format of new subject (with {subject}) * @return boolean
|
*/ function change_thread_subject($tids, $format) {
| */ function change_thread_subject($tids, $format) {
|
Zeile 2751 | Zeile 2757 |
---|
$tids = array_map('intval', $tids);
if(empty($tids))
|
$tids = array_map('intval', $tids);
if(empty($tids))
|
{ return false; }
| { return false; }
|
$tid_list = implode(',', $tids);
| $tid_list = implode(',', $tids);
|
Zeile 2772 | Zeile 2778 |
---|
}
$arguments = array("tids" => $tids, "format" => $format);
|
}
$arguments = array("tids" => $tids, "format" => $format);
|
$plugins->run_hooks("class_moderation_change_thread_subject", $arguments);
return true; }
/** * Add thread expiry * * @param int Thread ID * @param int Timestamp when the thread is deleted * @return boolean true */ function expire_thread($tid, $deletetime) { global $db, $plugins;
$tid = (int)$tid;
if(empty($tid)) { return false; }
| $plugins->run_hooks("class_moderation_change_thread_subject", $arguments);
return true; }
/** * Add thread expiry * * @param int $tid Thread ID * @param int $deletetime Timestamp when the thread is deleted * @return boolean */ function expire_thread($tid, $deletetime) { global $db, $plugins;
$tid = (int)$tid;
if(empty($tid)) { return false; }
|
$update_thread = array( "deletetime" => (int)$deletetime );
| $update_thread = array( "deletetime" => (int)$deletetime );
|
Zeile 2802 | Zeile 2808 |
---|
$arguments = array("tid" => $tid, "deletetime" => $deletetime); $plugins->run_hooks("class_moderation_expire_thread", $arguments);
|
$arguments = array("tid" => $tid, "deletetime" => $deletetime); $plugins->run_hooks("class_moderation_expire_thread", $arguments);
|
|
|
return true; }
/** * Toggle post visibility (approved/unapproved)
|
return true; }
/** * Toggle post visibility (approved/unapproved)
|
* * @param array Post IDs * @return boolean true
| * * @param array $pids Post IDs * @return boolean true
|
*/ function toggle_post_visibility($pids) {
| */ function toggle_post_visibility($pids) {
|
Zeile 2824 | Zeile 2830 |
---|
while($post = $db->fetch_array($query)) { if($post['visible'] != 0)
|
while($post = $db->fetch_array($query)) { if($post['visible'] != 0)
|
{
| {
|
$unapprove[] = $post['pid'];
|
$unapprove[] = $post['pid'];
|
}
| }
|
else { $approve[] = $post['pid']; }
|
else { $approve[] = $post['pid']; }
|
}
| }
|
if(is_array($unapprove)) { $this->unapprove_posts($unapprove);
| if(is_array($unapprove)) { $this->unapprove_posts($unapprove);
|
Zeile 2846 | Zeile 2852 |
---|
/** * Toggle post visibility (deleted/restored) *
|
/** * Toggle post visibility (deleted/restored) *
|
* @param array Post IDs
| * @param array $pids Post IDs
|
* @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
| { global $db;
// Make sure we only have valid values
|
$pids = array_map('intval', $pids);
$pid_list = implode(',', $pids);
| $pids = array_map('intval', $pids);
$pid_list = implode(',', $pids);
|
Zeile 2867 | Zeile 2873 |
---|
else { $restore[] = $post['pid'];
|
else { $restore[] = $post['pid'];
|
} }
| } }
|
if(is_array($delete))
|
if(is_array($delete))
|
{
| {
|
$this->soft_delete_posts($delete); } if(is_array($restore))
|
$this->soft_delete_posts($delete); } if(is_array($restore))
|
{
| {
|
$this->restore_posts($restore); } return true;
| $this->restore_posts($restore); } return true;
|
Zeile 2883 | Zeile 2889 |
---|
/** * Toggle thread visibility (approved/unapproved) *
|
/** * Toggle thread visibility (approved/unapproved) *
|
* @param array Thread IDs * @param int Forum ID
| * @param array $tids Thread IDs * @param int $fid Forum ID
|
* @return boolean true */ function toggle_thread_visibility($tids, $fid) { global $db;
|
* @return boolean true */ function toggle_thread_visibility($tids, $fid) { global $db;
|
|
|
// Make sure we only have valid values $tids = array_map('intval', $tids); $fid = (int)$fid;
| // Make sure we only have valid values $tids = array_map('intval', $tids); $fid = (int)$fid;
|
Zeile 2909 | Zeile 2915 |
---|
} } if(is_array($unapprove))
|
} } if(is_array($unapprove))
|
{ $this->unapprove_threads($unapprove, $fid); }
| { $this->unapprove_threads($unapprove, $fid); }
|
if(is_array($approve)) { $this->approve_threads($approve, $fid); } return true; }
|
if(is_array($approve)) { $this->approve_threads($approve, $fid); } return true; }
|
|
|
/** * Toggle thread visibility (deleted/restored) *
|
/** * Toggle thread visibility (deleted/restored) *
|
* @param array Thread IDs * @param int Forum ID
| * @param array $tids Thread IDs
|
* @return boolean true */
|
* @return boolean true */
|
function toggle_thread_softdelete($tids, $fid)
| function toggle_thread_softdelete($tids)
|
{ global $db;
// Make sure we only have valid values $tids = array_map('intval', $tids);
|
{ global $db;
// Make sure we only have valid values $tids = array_map('intval', $tids);
|
$fid = (int)$fid;
| |
$tid_list = implode(',', $tids); $query = $db->simple_select("threads", 'tid, visible', "tid IN ($tid_list)");
| $tid_list = implode(',', $tids); $query = $db->simple_select("threads", 'tid, visible', "tid IN ($tid_list)");
|
Zeile 2949 | Zeile 2953 |
---|
} if(is_array($delete)) {
|
} if(is_array($delete)) {
|
$this->soft_delete_threads($delete, $fid);
| $this->soft_delete_threads($delete);
|
} if(is_array($restore)) {
|
} if(is_array($restore)) {
|
$this->restore_threads($restore, $fid);
| $this->restore_threads($restore);
|
} return true; }
| } return true; }
|
Zeile 2961 | Zeile 2965 |
---|
/** * Toggle threads open/closed *
|
/** * Toggle threads open/closed *
|
* @param array Thread IDs
| * @param array $tids Thread IDs
|
* @return boolean true */ function toggle_thread_status($tids)
| * @return boolean true */ function toggle_thread_status($tids)
|
Zeile 2998 | Zeile 3002 |
---|
/** * Toggle threads stick/unstick *
|
/** * Toggle threads stick/unstick *
|
* @param array Thread IDs
| * @param array $tids Thread IDs
|
* @return boolean true */ function toggle_thread_importance($tids)
| * @return boolean true */ function toggle_thread_importance($tids)
|
Zeile 3031 | Zeile 3035 |
---|
if(!empty($unstick)) { $this->unstick_threads($unstick);
|
if(!empty($unstick)) { $this->unstick_threads($unstick);
|
} return true;
| } return true;
|
}
/** * Remove thread subscriptions (from one or multiple threads in the same forum) *
|
}
/** * Remove thread subscriptions (from one or multiple threads in the same forum) *
|
* @param int $tids Thread ID, or an array of thread IDs from the same forum.
| * @param int|array $tids Thread ID, or an array of thread IDs from the same forum.
|
* @param boolean $all True (default) to delete all subscriptions, false to only delete subscriptions from users with no permission to read the thread * @param int $fid (Only applies if $all is false) The forum ID of the thread
|
* @param boolean $all True (default) to delete all subscriptions, false to only delete subscriptions from users with no permission to read the thread * @param int $fid (Only applies if $all is false) The forum ID of the thread
|
* @return boolean true
| * @return boolean
|
*/ function remove_thread_subscriptions($tids, $all = true, $fid = 0) {
| */ function remove_thread_subscriptions($tids, $all = true, $fid = 0) {
|
Zeile 3071 | Zeile 3075 |
---|
$forum_parentlist = get_parent_list($fid); $query = $db->simple_select("forumpermissions", "gid", "fid IN ({$forum_parentlist}) AND (canview=0 OR canviewthreads=0)"); $groups = array();
|
$forum_parentlist = get_parent_list($fid); $query = $db->simple_select("forumpermissions", "gid", "fid IN ({$forum_parentlist}) AND (canview=0 OR canviewthreads=0)"); $groups = array();
|
| $additional_groups = '';
|
while($group = $db->fetch_array($query)) { $groups[] = $group['gid'];
| while($group = $db->fetch_array($query)) { $groups[] = $group['gid'];
|
Zeile 3116 | Zeile 3121 |
---|
/** * Apply a thread prefix (to one or multiple threads in the same forum) *
|
/** * Apply a thread prefix (to one or multiple threads in the same forum) *
|
* @param int $tids Thread ID, or an array of thread IDs from the same forum.
| * @param int|array $tids Thread ID, or an array of thread IDs from the same forum.
|
* @param int $prefix Prefix ID to apply to the threads
|
* @param int $prefix Prefix ID to apply to the threads
|
| * @return bool
|
*/ function apply_thread_prefix($tids, $prefix = 0) {
| */ function apply_thread_prefix($tids, $prefix = 0) {
|
Zeile 3151 | Zeile 3157 |
---|
/** * Soft delete multiple posts *
|
/** * Soft delete multiple posts *
|
* @param array PIDs * @return boolean true
| * @param array $pids PIDs * @return boolean
|
*/ function soft_delete_posts($pids) {
| */ function soft_delete_posts($pids) {
|
Zeile 3262 | Zeile 3268 |
---|
$user_counters[$post['uid']] = 0; } --$user_counters[$post['uid']];
|
$user_counters[$post['uid']] = 0; } --$user_counters[$post['uid']];
|
}
| }
|
}
if(empty($pids) && empty($threads_to_update))
| }
if(empty($pids) && empty($threads_to_update))
|
Zeile 3274 | Zeile 3280 |
---|
{ $where = "pid IN (".implode(',', $pids).")"; $db->update_query("posts", $update, $where);
|
{ $where = "pid IN (".implode(',', $pids).")"; $db->update_query("posts", $update, $where);
|
| mark_reports($pids, "posts");
|
}
$plugins->run_hooks("class_moderation_soft_delete_posts", $pids);
| }
$plugins->run_hooks("class_moderation_soft_delete_posts", $pids);
|
Zeile 3321 | Zeile 3328 |
---|
/** * Restore multiple posts *
|
/** * Restore multiple posts *
|
* @param array PIDs * @return boolean true
| * @param array $pids PIDs * @return boolean
|
*/ function restore_posts($pids) {
| */ function restore_posts($pids) {
|
Zeile 3469 | Zeile 3476 |
---|
/** * Restore one or more threads *
|
/** * Restore one or more threads *
|
* @param array Thread IDs
| * @param array|int $tids Thread ID(s)
|
* @return boolean true */ function restore_threads($tids)
|
* @return boolean true */ function restore_threads($tids)
|
{ global $db, $cache, $plugins;
if(!is_array($tids)) { $tids = array($tids); }
if(empty($tids)) { return false; }
// Make sure we only have valid values $tids = array_map('intval', $tids);
$tid_list = $forum_counters = $user_counters = $posts_to_restore = array();
| { global $db, $cache, $plugins;
if(!is_array($tids)) { $tids = array($tids); }
if(empty($tids)) { return false; }
// Make sure we only have valid values $tids = array_map('intval', $tids);
$tid_list = $forum_counters = $user_counters = $posts_to_restore = array();
|
foreach($tids as $tid) { $thread = get_thread($tid);
| foreach($tids as $tid) { $thread = get_thread($tid);
|
Zeile 3603 | Zeile 3610 |
---|
$update_array = array( "postnum" => "+{$counters['num_posts']}", "threadnum" => "+{$counters['num_threads']}",
|
$update_array = array( "postnum" => "+{$counters['num_posts']}", "threadnum" => "+{$counters['num_threads']}",
|
);
| );
|
update_user_counters($uid, $update_array); } } } return true; }
|
update_user_counters($uid, $update_array); } } } return true; }
|
|
|
/** * Soft delete one or more threads *
|
/** * Soft delete one or more threads *
|
* @param array Thread IDs * @return boolean true
| * @param array|int Thread ID(s) * @return boolean
|
*/ function soft_delete_threads($tids) {
| */ function soft_delete_threads($tids) {
|
Zeile 3633 | Zeile 3640 |
---|
// 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 3661 | Zeile 3668 |
---|
'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 3674 | Zeile 3681 |
---|
++$forum_counters[$forum['fid']]['num_deleted_threads']; $forum_counters[$forum['fid']]['num_deleted_posts'] += $thread['replies']+$thread['unapprovedposts']+1;
|
++$forum_counters[$forum['fid']]['num_deleted_threads']; $forum_counters[$forum['fid']]['num_deleted_posts'] += $thread['replies']+$thread['unapprovedposts']+1;
|
|
|
if($thread['visible'] == 1) { ++$forum_counters[$forum['fid']]['num_threads'];
| if($thread['visible'] == 1) { ++$forum_counters[$forum['fid']]['num_threads'];
|
Zeile 3709 | Zeile 3716 |
---|
} $posts_to_delete[] = $thread['firstpost']; }
|
} $posts_to_delete[] = $thread['firstpost']; }
|
|
|
$update = array( "visible" => -1 );
| $update = array( "visible" => -1 );
|
Zeile 3717 | Zeile 3724 |
---|
// Soft delete redirects, too $redirect_tids = array(); $query = $db->simple_select('threads', 'tid', "closed IN ({$tid_moved_list})");
|
// Soft delete redirects, too $redirect_tids = array(); $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;
|