Vergleich inc/class_moderation.php - 1.8.5 - 1.8.6

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 13Zeile 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 43Zeile 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 79Zeile 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 114Zeile 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 137Zeile 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 149Zeile 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 177Zeile 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 187Zeile 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 208Zeile 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 332Zeile 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 361Zeile 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 395Zeile 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 502Zeile 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 653Zeile 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 750Zeile 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 991Zeile 990
	/**
* 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 1388Zeile 1387
	/**
* 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 1399Zeile 1398

$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 1424Zeile 1423
				"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'])
{

		// Both the old and the new thread have polls? Remove one
elseif($mergethread['poll'])
{

Zeile 1766Zeile 1765
	/**
* 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 2213Zeile 2212
	/**
* 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 2414Zeile 2413
	/**
* 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 2424Zeile 2423
		$num_posts = 0;

if(empty($pids))

		$num_posts = 0;

if(empty($pids))

		{

		{

			return false;
}


			return false;
}


Zeile 2454Zeile 2453
		while($post = $db->fetch_array($query))
{
// This is the first post in the thread so we're approving the whole thread.

		while($post = $db->fetch_array($query))
{
// This is the first post in the thread so we're approving the whole thread.

			$threads_to_update[] = $post['tid'];
}

if(!empty($threads_to_update))
{
$this->approve_threads($threads_to_update);
}

			$threads_to_update[] = $post['tid'];
}

if(!empty($threads_to_update))
{
$this->approve_threads($threads_to_update);
}


$thread_counters = $forum_counters = $user_counters = array();



$thread_counters = $forum_counters = $user_counters = array();


Zeile 2542Zeile 2541
				$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}"));
}

			{
update_user_counters($uid, array('postnum' => "+{$counter}"));
}

Zeile 2562Zeile 2561
	/**
* 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 2597Zeile 2596
			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE p.pid IN ($pid_list) AND p.visible IN (-1,1) AND t.firstpost = p.pid AND t.visible IN (-1,1)

			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE p.pid IN ($pid_list) AND p.visible IN (-1,1) AND t.firstpost = p.pid AND t.visible IN (-1,1)

		");

		");

		while($post = $db->fetch_array($query))
{
// This is the first post in the thread so we're unapproving the whole thread.

		while($post = $db->fetch_array($query))
{
// This is the first post in the thread so we're unapproving the whole thread.

Zeile 2686Zeile 2685
		{
$where = "pid IN (".implode(',', $pids).")";
$db->update_query("posts", $approve, $where);

		{
$where = "pid IN (".implode(',', $pids).")";
$db->update_query("posts", $approve, $where);

		}


		}


		$plugins->run_hooks("class_moderation_unapprove_posts", $pids);

if(!empty($thread_counters))
{
foreach($thread_counters as $tid => $counters)

		$plugins->run_hooks("class_moderation_unapprove_posts", $pids);

if(!empty($thread_counters))
{
foreach($thread_counters as $tid => $counters)

			{

			{

				$counters_update = array(
"unapprovedposts" => "+".$counters['unapprovedposts'],
"replies" => "-".$counters['replies'],
"deletedposts" => "-".$counters['deletedposts']

				$counters_update = array(
"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(!empty($forum_counters))
{
foreach($forum_counters as $fid => $counters)

		if(!empty($forum_counters))
{
foreach($forum_counters as $fid => $counters)

Zeile 2716Zeile 2715
				);
update_forum_counters($fid, $updated_forum_stats);
update_forum_lastpost($fid);

				);
update_forum_counters($fid, $updated_forum_stats);
update_forum_lastpost($fid);

			}

			}

		}

if(!empty($user_counters))

		}

if(!empty($user_counters))

Zeile 2732Zeile 2731

/**
* 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 2745Zeile 2744
		if(!is_array($tids))
{
$tids = array($tids);

		if(!is_array($tids))
{
$tids = array($tids);

		}


		}


		// 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 2780Zeile 2779
	/**
* Add thread expiry
*

	/**
* Add thread expiry
*

	 * @param int Thread ID
* @param int Timestamp when the thread is deleted
* @return boolean true

	 * @param int $tid Thread ID
* @param int $deletetime Timestamp when the thread is deleted
* @return boolean

	 */
function expire_thread($tid, $deletetime)
{

	 */
function expire_thread($tid, $deletetime)
{

Zeile 2809Zeile 2808
	/**
* Toggle post visibility (approved/unapproved)
*

	/**
* Toggle post visibility (approved/unapproved)
*

	 * @param array Post IDs

	 * @param array $pids Post IDs

	 * @return boolean true
*/
function toggle_post_visibility($pids)

	 * @return boolean true
*/
function toggle_post_visibility($pids)

Zeile 2846Zeile 2845
	/**
* 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)

Zeile 2883Zeile 2882
	/**
* 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)

	 * @return boolean true
*/
function toggle_thread_visibility($tids, $fid)

Zeile 2922Zeile 2921
	/**
* Toggle thread visibility (deleted/restored)
*

	/**
* Toggle thread visibility (deleted/restored)
*

	 * @param array Thread IDs

	 * @param array $tids Thread IDs

	 * @return boolean true
*/
function toggle_thread_softdelete($tids)

	 * @return boolean true
*/
function toggle_thread_softdelete($tids)

Zeile 2959Zeile 2958
	/**
* 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 2996Zeile 2995
	/**
* 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 3036Zeile 3035
	/**
* 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)

	{
global $db, $plugins;

// Format thread IDs
if(!is_array($tids))
{
$tids = array($tids);
}

if(empty($tids))
{
return false;

	{
global $db, $plugins;

// Format thread IDs
if(!is_array($tids))
{
$tids = array($tids);
}

if(empty($tids))
{
return false;

		}

// Make sure we only have valid values

		}

// Make sure we only have valid values

Zeile 3069Zeile 3068
			$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 3080Zeile 3080
						break;
default:
$additional_groups .= " OR CONCAT(',',u.additionalgroups,',') LIKE ',{$group['gid']},'";

						break;
default:
$additional_groups .= " OR CONCAT(',',u.additionalgroups,',') LIKE ',{$group['gid']},'";

				}

				}

			}
// If there are groups found, delete subscriptions from users in these groups
if(count($groups) > 0)

			}
// If there are groups found, delete subscriptions from users in these groups
if(count($groups) > 0)

Zeile 3107Zeile 3107

$arguments = array("tids" => $tids, "all" => $all, "fid" => $fid);
$plugins->run_hooks("class_moderation_remove_thread_subscriptions", $arguments);


$arguments = array("tids" => $tids, "all" => $all, "fid" => $fid);
$plugins->run_hooks("class_moderation_remove_thread_subscriptions", $arguments);





		return true;
}

/**
* Apply a thread prefix (to one or multiple threads in the same forum)
*

		return true;
}

/**
* 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 3135Zeile 3136
		// Make sure we only have valid values
$tids = array_map('intval', $tids);
$tids_csv = implode(',', $tids);

		// Make sure we only have valid values
$tids = array_map('intval', $tids);
$tids_csv = implode(',', $tids);





		$update_thread = array('prefix' => (int)$prefix);
$db->update_query('threads', $update_thread, "tid IN ({$tids_csv})");

$arguments = array('tids' => $tids, 'prefix' => $prefix);

		$update_thread = array('prefix' => (int)$prefix);
$db->update_query('threads', $update_thread, "tid IN ({$tids_csv})");

$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;
}

/**
* Soft delete multiple posts
*

		return true;
}

/**
* 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 3272Zeile 3273
		{
$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 3319Zeile 3321
	/**
* 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 3415Zeile 3417
		}

if(empty($pids) && empty($threads_to_update))

		}

if(empty($pids) && empty($threads_to_update))

		{
return false;
}


		{
return false;
}


		if(!empty($pids))
{
$where = "pid IN (".implode(',', $pids).")";
$db->update_query("posts", $update, $where);

		if(!empty($pids))
{
$where = "pid IN (".implode(',', $pids).")";
$db->update_query("posts", $update, $where);

		}

$plugins->run_hooks("class_moderation_restore_posts", $pids);

		}

$plugins->run_hooks("class_moderation_restore_posts", $pids);


if(is_array($thread_counters))
{


if(is_array($thread_counters))
{

Zeile 3437Zeile 3439
				);
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))
{
foreach($forum_counters as $fid => $counters)

		}

if(is_array($forum_counters))
{
foreach($forum_counters as $fid => $counters)

			{

			{

				$updated_forum_stats = array(
'posts' => "+{$counters['num_posts']}",
'deletedposts' => "-{$counters['num_posts']}"

				$updated_forum_stats = array(
'posts' => "+{$counters['num_posts']}",
'deletedposts' => "-{$counters['num_posts']}"

Zeile 3466Zeile 3468

/**
* Restore one or more threads


/**
* Restore one or more threads

	 *
* @param array Thread IDs
* @return boolean true

	 *
* @param array|int $tids Thread ID(s)
* @return boolean true

	 */
function restore_threads($tids)
{
global $db, $cache, $plugins;

	 */
function restore_threads($tids)
{
global $db, $cache, $plugins;





		if(!is_array($tids))
{
$tids = array($tids);

		if(!is_array($tids))
{
$tids = array($tids);

Zeile 3497Zeile 3499
				continue;
}
$tid_list[] = $thread['tid'];

				continue;
}
$tid_list[] = $thread['tid'];





			$forum = get_forum($thread['fid']);

if(!isset($forum_counters[$forum['fid']]))
{
$forum_counters[$forum['fid']] = array(

			$forum = get_forum($thread['fid']);

if(!isset($forum_counters[$forum['fid']]))
{
$forum_counters[$forum['fid']] = array(

					'num_posts' => 0,

					'num_posts' => 0,

					'num_threads' => 0,
'num_deleted_posts' => 0,
'num_unapproved_posts' => 0

					'num_threads' => 0,
'num_deleted_posts' => 0,
'num_unapproved_posts' => 0

				);
}


				);
}


			if(!isset($user_counters[$thread['uid']]))
{
$user_counters[$thread['uid']] = array(
'num_posts' => 0,
'num_threads' => 0
);

			if(!isset($user_counters[$thread['uid']]))
{
$user_counters[$thread['uid']] = array(
'num_posts' => 0,
'num_threads' => 0
);

			}


			}


			++$forum_counters[$forum['fid']]['num_threads'];
$forum_counters[$forum['fid']]['num_posts'] += $thread['replies']+1; // Remove implied visible from count
$forum_counters[$forum['fid']]['num_deleted_posts'] += $thread['replies']+$thread['unapprovedposts']+1;

			++$forum_counters[$forum['fid']]['num_threads'];
$forum_counters[$forum['fid']]['num_posts'] += $thread['replies']+1; // Remove implied visible from count
$forum_counters[$forum['fid']]['num_deleted_posts'] += $thread['replies']+$thread['unapprovedposts']+1;

Zeile 3612Zeile 3614
	/**
* 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 3715Zeile 3717
		// 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;