Vergleich inc/class_moderation.php - 1.4.5 - 1.4.13

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1Zeile 1
<?php
/**
* MyBB 1.4

<?php
/**
* MyBB 1.4

 * Copyright � 2008 MyBB Group, All Rights Reserved

 * Copyright © 2008 MyBB Group, All Rights Reserved

 *
* Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 *
* Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: class_moderation.php 4330 2009-03-16 02:17:06Z Tikitiki $

 * $Id: class_moderation.php 4736 2010-01-23 23:18:59Z Huji $

 */

class Moderation

 */

class Moderation

Zeile 228Zeile 228
			$pids = implode(',', $pids);
$db->delete_query("posts", "pid IN ($pids)");
$db->delete_query("attachments", "pid IN ($pids)");

			$pids = implode(',', $pids);
$db->delete_query("posts", "pid IN ($pids)");
$db->delete_query("attachments", "pid IN ($pids)");

 
			$db->delete_query("reportedposts", "pid IN ($pids)");

		}
// Get thread info
$query = get_thread($tid);

		}
// Get thread info
$query = get_thread($tid);

Zeile 321Zeile 322
				continue;
}
$tid_list[] = $thread['tid'];

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

 
			
update_thread_counters($tid, array("unapprovedposts" => "-1"));


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



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


Zeile 483Zeile 486

// Delete the post
$db->delete_query("posts", "pid='$pid'");


// Delete the post
$db->delete_query("posts", "pid='$pid'");

 

// Remove any reports attached to this post
$db->delete_query("reportedposts", "pid='$pid'");


$num_unapproved_posts = $num_approved_posts = 0;
// Update unapproved post count


$num_unapproved_posts = $num_approved_posts = 0;
// Update unapproved post count

Zeile 566Zeile 572
				else
{
$message .= "[hr]{$post['message']}";

				else
{
$message .= "[hr]{$post['message']}";

				}

				}


if($post['visible'] == 1 && $post['threadvisible'] == 1)
{


if($post['visible'] == 1 && $post['threadvisible'] == 1)
{

Zeile 580Zeile 586
					--$forum_counters[$post['fid']]['num_posts'];
// Subtract 1 from user's post count
if($post['usepostcounts'] != 0)

					--$forum_counters[$post['fid']]['num_posts'];
// Subtract 1 from user's post count
if($post['usepostcounts'] != 0)

					{

					{

						// Update post count of the user of the merged posts
$db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid='{$post['uid']}'");

						// Update post count of the user of the merged posts
$db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid='{$post['uid']}'");

					}

					}

				}
elseif($post['visible'] == 0)
{

				}
elseif($post['visible'] == 0)
{

Zeile 595Zeile 601
					--$thread_counters[$post['tid']]['unapprovedposts'];
// Subtract 1 unapproved post from post's forum
--$forum_counters[$post['fid']]['unapprovedposts'];

					--$thread_counters[$post['tid']]['unapprovedposts'];
// Subtract 1 unapproved post from post's forum
--$forum_counters[$post['fid']]['unapprovedposts'];

				}

				}

			}
}


			}
}


Zeile 635Zeile 641
				update_thread_data($tid);
}
}

				update_thread_data($tid);
}
}

 
		
update_thread_data($mastertid);

update_forum_lastpost($fid);


if(is_array($forum_counters))


if(is_array($forum_counters))

		{

		{

			foreach($forum_counters as $fid => $counters)
{
$updated_forum_stats = array(

			foreach($forum_counters as $fid => $counters)
{
$updated_forum_stats = array(

Zeile 652Zeile 662

return true;
}


return true;
}





	/**
* Move/copy thread
*

	/**
* Move/copy thread
*

Zeile 682Zeile 692
			case "redirect": // move (and leave redirect) thread
$arguments = array("tid" => $tid, "new_fid" => $new_fid);
$plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);

			case "redirect": // move (and leave redirect) thread
$arguments = array("tid" => $tid, "new_fid" => $new_fid);
$plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);


if($thread['visible'] == 1)
{
$num_threads++;
$num_posts = $thread['replies']+1;
}
else


if($thread['visible'] == 1)
{
$num_threads++;
$num_posts = $thread['replies']+1;
}
else

				{
$num_unapproved_threads++;
// Implied forum unapproved count for unapproved threads

				{
$num_unapproved_threads++;
// Implied forum unapproved count for unapproved threads

Zeile 742Zeile 752
					"uid" => $thread['uid'],
"username" => $db->escape_string($thread['username']),
"dateline" => $thread['dateline'],

					"uid" => $thread['uid'],
"username" => $db->escape_string($thread['username']),
"dateline" => $thread['dateline'],

 
					"firstpost" => $thread['firstpost'],

					"lastpost" => $thread['lastpost'],
"lastposteruid" => $thread['lastposteruid'],
"lastposter" => $db->escape_string($thread['lastposter']),

					"lastpost" => $thread['lastpost'],
"lastposteruid" => $thread['lastposteruid'],
"lastposter" => $db->escape_string($thread['lastposter']),

Zeile 903Zeile 914
			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
WHERE tid='$tid'

			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
WHERE tid='$tid'

			GROUP BY u.uid

			GROUP BY u.uid, p.visible

			ORDER BY posts DESC
");
while($posters = $db->fetch_array($query))

			ORDER BY posts DESC
");
while($posters = $db->fetch_array($query))

Zeile 1026Zeile 1037
		$db->update_query("threadsubscriptions", $sqlarray, "tid='{$mergetid}'");
update_first_post($tid);


		$db->update_query("threadsubscriptions", $sqlarray, "tid='{$mergetid}'");
update_first_post($tid);


		$arguments = array("mergetid" => $tid, "tid" => $tid, "subject" => $subject);

		$arguments = array("mergetid" => $mergetid, "tid" => $tid, "subject" => $subject);

		$plugins->run_hooks("class_moderation_merge_threads", $arguments);

$this->delete_thread($mergetid);

		$plugins->run_hooks("class_moderation_merge_threads", $arguments);

$this->delete_thread($mergetid);

Zeile 1091Zeile 1102
		$pids = array_map('intval', $pids);

$pids_list = implode(',', $pids);

		$pids = array_map('intval', $pids);

$pids_list = implode(',', $pids);

 

// Get the icon for the first split post
$query = $db->simple_select("posts", "icon", "pid=".intval($pids[0]));
$icon = $db->fetch_array($query);


if($destination_tid == 0)
{


if($destination_tid == 0)
{

Zeile 1101Zeile 1116
			$query = array(
"fid" => $moveto,
"subject" => $newsubject,

			$query = array(
"fid" => $moveto,
"subject" => $newsubject,

				"icon" => intval($thread['icon']),

				"icon" => intval($icon['icon']),

				"uid" => intval($thread['uid']),
"username" => $db->escape_string($thread['username']),
"dateline" => intval($thread['dateline']),

				"uid" => intval($thread['uid']),
"username" => $db->escape_string($thread['username']),
"dateline" => intval($thread['dateline']),

Zeile 1115Zeile 1130
			
$forum_counters[$moveto]['threads'] = $forum_cache[$moveto]['threads'];
++$forum_counters[$moveto]['threads'];

			
$forum_counters[$moveto]['threads'] = $forum_cache[$moveto]['threads'];
++$forum_counters[$moveto]['threads'];

		}

		}


// Get attachment counts for each post
/*$query = $db->simple_select("attachments", "COUNT(aid) as count, pid", "pid IN ($pids_list)");


// Get attachment counts for each post
/*$query = $db->simple_select("attachments", "COUNT(aid) as count, pid", "pid IN ($pids_list)");

Zeile 1138Zeile 1153
			LEFT JOIN ".TABLE_PREFIX."threads t ON (p.tid=t.tid)
LEFT JOIN ".TABLE_PREFIX."attachments a ON (a.pid=p.pid)
WHERE p.pid IN ($pids_list)

			LEFT JOIN ".TABLE_PREFIX."threads t ON (p.tid=t.tid)
LEFT JOIN ".TABLE_PREFIX."attachments a ON (a.pid=p.pid)
WHERE p.pid IN ($pids_list)

			GROUP BY p.pid

			GROUP BY p.pid, p.tid, p.fid, p.visible, p.uid, t.visible, t.replies, t.unapprovedposts,t.attachmentcount

		");

// Move the selected posts over

		");

// Move the selected posts over

Zeile 1158Zeile 1173
				if($forum_cache[$post['fid']]['usepostcounts'] == 1 && $forum_cache[$moveto]['usepostcounts'] == 0)
{
// Moving into a forum that doesn't count post counts

				if($forum_cache[$post['fid']]['usepostcounts'] == 1 && $forum_cache[$moveto]['usepostcounts'] == 0)
{
// Moving into a forum that doesn't count post counts

					if(!isset($user_counters[$post['uid']]))
{
$user_counters[$post['uid']] = 0;
}

					if(!isset($user_counters[$post['uid']]))
{
$user_counters[$post['uid']] = 0;
}

					--$user_counters[$post['uid']];
}
elseif($forum_cache[$post['fid']]['usepostcounts'] == 0 && $forum_cache[$moveto]['usepostcounts'] == 1)

					--$user_counters[$post['uid']];
}
elseif($forum_cache[$post['fid']]['usepostcounts'] == 0 && $forum_cache[$moveto]['usepostcounts'] == 1)

Zeile 1172Zeile 1187
						$user_counters[$post['uid']] = 0;
}
++$user_counters[$post['uid']];

						$user_counters[$post['uid']] = 0;
}
++$user_counters[$post['uid']];

				}

				}


// Subtract 1 from the old thread's replies
if(!isset($thread_counters[$post['tid']]['replies']))


// Subtract 1 from the old thread's replies
if(!isset($thread_counters[$post['tid']]['replies']))

Zeile 1183Zeile 1198

// Add 1 to the new thread's replies
++$thread_counters[$newtid]['replies'];


// Add 1 to the new thread's replies
++$thread_counters[$newtid]['replies'];





				if($moveto != $post['fid'])
{
// Only need to change forum info if the old forum is different from new forum
// Subtract 1 from the old forum's posts
if(!isset($forum_counters[$post['fid']]['posts']))

				if($moveto != $post['fid'])
{
// Only need to change forum info if the old forum is different from new forum
// Subtract 1 from the old forum's posts
if(!isset($forum_counters[$post['fid']]['posts']))

					{

					{

						$forum_counters[$post['fid']]['posts'] = $forum_cache[$post['fid']]['posts'];

						$forum_counters[$post['fid']]['posts'] = $forum_cache[$post['fid']]['posts'];

					}

					}

					--$forum_counters[$post['fid']]['posts'];
// Add 1 to the new forum's posts
if(!isset($forum_counters[$moveto]['posts']))

					--$forum_counters[$post['fid']]['posts'];
// Add 1 to the new forum's posts
if(!isset($forum_counters[$moveto]['posts']))

Zeile 1199Zeile 1214
						$forum_counters[$moveto]['posts'] = $forum_cache[$moveto]['posts'];
}
++$forum_counters[$moveto]['posts'];

						$forum_counters[$moveto]['posts'] = $forum_cache[$moveto]['posts'];
}
++$forum_counters[$moveto]['posts'];

				}

				}


}
elseif($post['visible'] == 0)


}
elseif($post['visible'] == 0)

Zeile 1214Zeile 1229

// Add 1 to the new thread's unapproved posts
++$thread_counters[$newtid]['unapprovedposts'];


// Add 1 to the new thread's unapproved posts
++$thread_counters[$newtid]['unapprovedposts'];





				if($moveto != $post['fid'])
{
// Only need to change forum info if the old forum is different from new forum

				if($moveto != $post['fid'])
{
// Only need to change forum info if the old forum is different from new forum

Zeile 1260Zeile 1275
					$change = '+'.$change; // add the addition operator for query
}
$db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum{$change} WHERE uid='{$uid}'");

					$change = '+'.$change; // add the addition operator for query
}
$db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum{$change} WHERE uid='{$uid}'");

			}

			}

		}

// Update thread counters

		}

// Update thread counters

Zeile 1275Zeile 1290
					$newthread = $db->fetch_array($query);
$sqlarray = array(
"subject" => $newsubject,

					$newthread = $db->fetch_array($query);
$sqlarray = array(
"subject" => $newsubject,

						"replyto" => 0

						"replyto" => 0

					);
$db->update_query("posts", $sqlarray, "pid='{$newthread['pid']}'");
}

					);
$db->update_query("posts", $sqlarray, "pid='{$newthread['pid']}'");
}

Zeile 1306Zeile 1321
				update_first_post($tid);
}
}

				update_first_post($tid);
}
}

 
		update_thread_data($newtid);


		update_first_post($newtid);

// Update forum counters

		update_first_post($newtid);

// Update forum counters

Zeile 1341Zeile 1358
		$newforum = get_forum($moveto);

$total_posts = $total_unapproved_posts = $total_threads = $total_unapproved_threads = 0;

		$newforum = get_forum($moveto);

$total_posts = $total_unapproved_posts = $total_threads = $total_unapproved_threads = 0;

		$query = $db->simple_select("threads", "fid, visible, replies, unapprovedposts", "tid IN ($tid_list)");

		$query = $db->simple_select("threads", "fid, visible, replies, unapprovedposts, tid", "tid IN ($tid_list)");

		while($thread = $db->fetch_array($query))
{
$forum = get_forum($thread['fid']);

		while($thread = $db->fetch_array($query))
{
$forum = get_forum($thread['fid']);