Vergleich inc/class_moderation.php - 1.4.1 - 1.4.15

  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 4119 2008-08-16 01:00:23Z Tikitiki $

 * $Id: class_moderation.php 5379 2011-02-21 11:06:42Z Tomm $

 */

class Moderation

 */

class Moderation

Zeile 27Zeile 27
		}

// Make sure we only have valid values

		}

// Make sure we only have valid values

		array_walk($tids, 'intval');

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


$plugins->run_hooks("class_moderation_close_threads", $tids);



$plugins->run_hooks("class_moderation_close_threads", $tids);


Zeile 36Zeile 36
		$openthread = array(
"closed" => 1,
);

		$openthread = array(
"closed" => 1,
);

		$db->update_query("threads", $openthread, "tid IN ($tid_list)");

		$db->update_query("threads", $openthread, "tid IN ($tid_list) AND closed NOT LIKE 'moved|%'");


return true;
}


return true;
}

Zeile 58Zeile 58
		}

// Make sure we only have valid values

		}

// Make sure we only have valid values

		array_walk($tids, 'intval');

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


$plugins->run_hooks("class_moderation_open_threads", $tids);



$plugins->run_hooks("class_moderation_open_threads", $tids);


Zeile 88Zeile 88
		}

// Make sure we only have valid values

		}

// Make sure we only have valid values

		array_walk($tids, 'intval');

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


$plugins->run_hooks("class_moderation_stick_threads", $tids);



$plugins->run_hooks("class_moderation_stick_threads", $tids);


Zeile 118Zeile 118
		}

// Make sure we only have valid values

		}

// Make sure we only have valid values

		array_walk($tids, 'intval');

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


$plugins->run_hooks("class_moderation_unstick_threads", $tids);



$plugins->run_hooks("class_moderation_unstick_threads", $tids);


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 311Zeile 312
		}

// Make sure we only have valid values

		}

// Make sure we only have valid values

		array_walk($tids, 'intval');

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


foreach($tids as $tid)
{


foreach($tids as $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']);






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

if($forum['usepostcounts'] != 0)

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

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");
while($counter = $db->fetch_array($query))

				// 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");
while($counter = $db->fetch_array($query))

Zeile 342Zeile 345

if(is_array($tid_list))
{


if(is_array($tid_list))
{

 
			$tid_moved_list = "";
$comma = "";
foreach($tid_list as $tid)
{
$tid_moved_list .= "{$comma}'moved|{$tid}'";
$comma = ",";
}

			$tid_list = implode(',', $tid_list);
$approve = array(
"visible" => 1
);

			$tid_list = implode(',', $tid_list);
$approve = array(
"visible" => 1
);

			$db->update_query("threads", $approve, "tid IN ($tid_list)");

			$db->update_query("threads", $approve, "tid IN ($tid_list) OR closed IN ({$tid_moved_list})");

			$db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_approve).")");

$plugins->run_hooks("class_moderation_approve_threads", $tids);

			$db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_approve).")");

$plugins->run_hooks("class_moderation_approve_threads", $tids);

Zeile 378Zeile 388
	function unapprove_threads($tids)
{
global $db, $cache, $plugins;

	function unapprove_threads($tids)
{
global $db, $cache, $plugins;





		if(!is_array($tids))

		if(!is_array($tids))

		{

		{

			$tids = array($tids);

			$tids = array($tids);

		}


		}


		// Make sure we only have valid values

		// Make sure we only have valid values

		array_walk($tids, 'intval');

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


$tid_list = implode(',', $tids);


$tid_list = implode(',', $tids);

 
		$tid_moved_list = "";
$comma = "";
foreach($tids as $tid)
{
$tid_moved_list .= "{$comma}'moved|{$tid}'";
$comma = ",";
}


foreach($tids as $tid)
{


foreach($tids as $tid)
{

Zeile 415Zeile 432
		$approve = array(
"visible" => 0
);

		$approve = array(
"visible" => 0
);

		$db->update_query("threads", $approve, "tid IN ($tid_list)");

		$db->update_query("threads", $approve, "tid IN ($tid_list) OR closed IN ({$tid_moved_list})");

		$db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_unapprove).")");

$plugins->run_hooks("class_moderation_unapprove_threads", $tids);

		$db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_unapprove).")");

$plugins->run_hooks("class_moderation_unapprove_threads", $tids);

Zeile 469Zeile 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
if($post['visible'] == 0)
{


$num_unapproved_posts = $num_approved_posts = 0;
// Update unapproved post count
if($post['visible'] == 0)
{

			--$num_unaproved_posts;

			++$num_unapproved_posts;

		}
else
{

		}
else
{

Zeile 514Zeile 534
		global $db, $plugins;

// Make sure we only have valid values

		global $db, $plugins;

// Make sure we only have valid values

		array_walk($pids, 'intval');

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

		$tid = intval($tid);

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

		$tid = intval($tid);

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

Zeile 589Zeile 609
		$query = $db->simple_select("posts", "pid", "tid = '{$post['tid']}'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => '1'));
$lastpostpid = $db->fetch_field($query, 'pid');


		$query = $db->simple_select("posts", "pid", "tid = '{$post['tid']}'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => '1'));
$lastpostpid = $db->fetch_field($query, 'pid');


		$query2 = $db->simple_select("attachments", "COUNT(aid) as count", "pid IN({$pidin}) AND pid != '{$masterpid}' AND visible='1'");

		$query2 = $db->simple_select("attachments", "COUNT(aid) as count", "pid IN({$pidin}) AND visible='1'");

		$attachment_count = $db->fetch_field($query2, "count");

$db->update_query("threads", array("attachmentcount" => $attachment_count), "tid = '{$mastertid}'");

		$attachment_count = $db->fetch_field($query2, "count");

$db->update_query("threads", array("attachmentcount" => $attachment_count), "tid = '{$mastertid}'");

Zeile 621Zeile 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))
{

Zeile 661Zeile 685
		$newforum = get_forum($new_fid);
$fid = $thread['fid'];
$forum = get_forum($fid);

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





		$num_threads = $num_unapproved_threads = $num_posts = $num_unapproved_threads = 0;
switch($method)
{

		$num_threads = $num_unapproved_threads = $num_posts = $num_unapproved_threads = 0;
switch($method)
{

Zeile 669Zeile 693
				$arguments = array("tid" => $tid, "new_fid" => $new_fid);
$plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);


				$arguments = array("tid" => $tid, "new_fid" => $new_fid);
$plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);


				if($thread['visible'] == 1)
{
$num_threads++;
}
else
{
$num_unapproved_threads++;
// Implied forum unapproved count for unapproved threads
$num_unapproved_posts = $thread['replies']+1;
}

$num_posts = $thread['replies']+1;
$num_unapproved_posts += $thread['unapprovedposts'];


				if($thread['visible'] == 1)
{
$num_threads++;
$num_posts = $thread['replies']+1;
}
else
{
$num_unapproved_threads++;
// Implied forum unapproved count for unapproved threads
$num_unapproved_posts = $thread['replies']+1;
}

$num_unapproved_posts += $thread['unapprovedposts'];


				$db->delete_query("threads", "closed='moved|$tid' AND fid='$new_fid'");
$changefid = array(
"fid" => $new_fid,

				$db->delete_query("threads", "closed='moved|$tid' AND fid='$new_fid'");
$changefid = array(
"fid" => $new_fid,

				);

				);

				$db->update_query("threads", $changefid, "tid='$tid'");
$db->update_query("posts", $changefid, "tid='$tid'");
$threadarray = array(

				$db->update_query("threads", $changefid, "tid='$tid'");
$db->update_query("posts", $changefid, "tid='$tid'");
$threadarray = array(

Zeile 710Zeile 734
				if($redirect_expire)
{
$this->expire_thread($redirect_tid, $redirect_expire);

				if($redirect_expire)
{
$this->expire_thread($redirect_tid, $redirect_expire);

 
				}

// If we're moving back to a forum where we left a redirect, delete the rediect
$query = $db->simple_select("threads", "tid", "closed LIKE 'moved|".intval($tid)."' AND fid='".intval($new_fid)."'");
while($movedthread = $db->fetch_array($query))
{
$db->delete_query("threads", "tid='".intval($movedthread['tid'])."'", 1);

				}
break;
case "copy":// copy thread

				}
break;
case "copy":// copy thread

Zeile 721Zeile 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 850Zeile 882
				if($thread['visible'] == 1)
{
$num_threads++;

				if($thread['visible'] == 1)
{
$num_threads++;

				}


					$num_posts = $thread['replies']+1;
}

				else
{
$num_unapproved_threads++;
// Implied forum unapproved count for unapproved threads
$num_unapproved_posts = $thread['replies']+1;

				else
{
$num_unapproved_threads++;
// Implied forum unapproved count for unapproved threads
$num_unapproved_posts = $thread['replies']+1;

				}

$num_posts = $thread['replies']+1;
$num_unapproved_posts = $thread['unapprovedposts'];

				}

$num_unapproved_posts = $thread['unapprovedposts'];



$sqlarray = array(
"fid" => $new_fid,
);
$db->update_query("threads", $sqlarray, "tid='$tid'");
$db->update_query("posts", $sqlarray, "tid='$tid'");


$sqlarray = array(
"fid" => $new_fid,
);
$db->update_query("threads", $sqlarray, "tid='$tid'");
$db->update_query("posts", $sqlarray, "tid='$tid'");

 
				
// If we're moving back to a forum where we left a redirect, delete the rediect
$query = $db->simple_select("threads", "tid", "closed LIKE 'moved|".intval($tid)."' AND fid='".intval($new_fid)."'");
while($movedthread = $db->fetch_array($query))
{
$db->delete_query("threads", "tid='".intval($movedthread['tid'])."'", 1);
}

				break;

				break;

		}

		}


// Do post count changes if changing between countable and non-countable forums
$query = $db->query("


// Do post count changes if changing between countable and non-countable forums
$query = $db->query("

Zeile 875Zeile 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 885Zeile 924
				$pcount = "+{$posters['posts']}";
}
elseif($method != "copy" && ($newforum['usepostcounts'] != 0 && $forum['usepostcounts'] == 0 && $posters['visible'] != 0))

				$pcount = "+{$posters['posts']}";
}
elseif($method != "copy" && ($newforum['usepostcounts'] != 0 && $forum['usepostcounts'] == 0 && $posters['visible'] != 0))

			{

			{

				$pcount = "+{$posters['posts']}";
}
elseif($method != "copy" && ($newforum['usepostcounts'] == 0 && $forum['usepostcounts'] != 0 && $posters['visible'] != 0))

				$pcount = "+{$posters['posts']}";
}
elseif($method != "copy" && ($newforum['usepostcounts'] == 0 && $forum['usepostcounts'] != 0 && $posters['visible'] != 0))

Zeile 919Zeile 958
		}

if(isset($newtid))

		}

if(isset($newtid))

		{

		{

			return $newtid;
}
else

			return $newtid;
}
else

Zeile 998Zeile 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 1060Zeile 1099
		}

// Make sure we only have valid values

		}

// Make sure we only have valid values

		array_walk($pids, 'intval');

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


$pids_list = implode(',', $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 1073Zeile 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 1110Zeile 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 1278Zeile 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 1304Zeile 1349
		global $db, $plugins;

// Make sure we only have valid values

		global $db, $plugins;

// Make sure we only have valid values

		array_walk($tids, 'intval');

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


$tid_list = implode(',', $tids);



$tid_list = implode(',', $tids);


Zeile 1313Zeile 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']);

Zeile 1420Zeile 1465
		$num_posts = 0;

// Make sure we only have valid values

		$num_posts = 0;

// Make sure we only have valid values

		array_walk($pids, 'intval');

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


$pid_list = implode(',', $pids);
$pids = $threads_to_update = array();


$pid_list = implode(',', $pids);
$pids = $threads_to_update = array();

Zeile 1526Zeile 1571
		global $db, $cache;

// Make sure we only have valid values

		global $db, $cache;

// Make sure we only have valid values

		array_walk($pids, 'intval');

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


$pid_list = implode(',', $pids);
$pids = $threads_to_update = array();


$pid_list = implode(',', $pids);
$pids = $threads_to_update = array();

Zeile 1641Zeile 1686


// Make sure we only have valid values



// Make sure we only have valid values

		array_walk($tids, 'intval');

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


$tid_list = implode(',', $tids);



$tid_list = implode(',', $tids);


Zeile 1702Zeile 1747
		global $db;

// Make sure we only have valid values

		global $db;

// Make sure we only have valid values

		array_walk($pids, 'intval');

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


$pid_list = implode(',', $pids);
$query = $db->simple_select("posts", 'pid, visible', "pid IN ($pid_list)");


$pid_list = implode(',', $pids);
$query = $db->simple_select("posts", 'pid, visible', "pid IN ($pid_list)");

Zeile 1740Zeile 1785
		global $db;

// Make sure we only have valid values

		global $db;

// Make sure we only have valid values

		array_walk($tids, 'intval');

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

		$fid = intval($fid);

$tid_list = implode(',', $tids);

		$fid = intval($fid);

$tid_list = implode(',', $tids);

Zeile 1778Zeile 1823
		global $db;

// Make sure we only have valid values

		global $db;

// Make sure we only have valid values

		array_walk($tids, 'intval');

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


$tid_list = implode(',', $tids);
$query = $db->simple_select("threads", 'tid, closed', "tid IN ($tid_list)");


$tid_list = implode(',', $tids);
$query = $db->simple_select("threads", 'tid, closed', "tid IN ($tid_list)");

Zeile 1823Zeile 1868
		}

// Make sure we only have valid values

		}

// Make sure we only have valid values

		array_walk($tids, 'intval');

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

		$fid = intval($fid);

$tids_csv = implode(',', $tids);

		$fid = intval($fid);

$tids_csv = implode(',', $tids);