Vergleich inc/class_moderation.php - 1.8.26 - 1.8.27

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 384Zeile 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 402Zeile 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 417Zeile 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 437Zeile 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 534Zeile 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 580Zeile 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 594Zeile 598

}
$posts_to_unapprove[] = $thread['firstpost'];


}
$posts_to_unapprove[] = $thread['firstpost'];

		}

		}


$approve = array(
"visible" => 0


$approve = array(
"visible" => 0

Zeile 606Zeile 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 619Zeile 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 645Zeile 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 779Zeile 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 802Zeile 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 902Zeile 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 1549Zeile 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 1793Zeile 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 1807Zeile 1811
			'unapprovedposts' => 0,
'deletedposts' => 0
);

			'unapprovedposts' => 0,
'deletedposts' => 0
);

 

$user_counters = array();


if($destination_tid == 0)
{


if($destination_tid == 0)
{

Zeile 1929Zeile 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 1959Zeile 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 2020Zeile 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 2029Zeile 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 2040Zeile 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 2051Zeile 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 2146Zeile 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 2162Zeile 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 2761Zeile 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 3305Zeile 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 3495Zeile 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 3513Zeile 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 3532Zeile 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 3649Zeile 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 3695Zeile 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 3723Zeile 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;