Vergleich moderation.php - 1.6.0 - 1.6.17

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: moderation.php 5138 2010-07-28 18:31:24Z RyanGordon $

 * $Id$

 */

define("IN_MYBB", 1);
define('THIS_SCRIPT', 'moderation.php');


 */

define("IN_MYBB", 1);
define('THIS_SCRIPT', 'moderation.php');


$templatelist = 'changeuserbox';





$templatelist = 'changeuserbox,loginbox,moderation_delayedmoderation_custommodtool,moderation_delayedmodaction_notes,moderation_delayedmoderation_merge,moderation_delayedmoderation_move';
$templatelist .= ',moderation_delayedmoderation,moderation_deletethread,moderation_deletepoll,moderation_deleteposts_post,moderation_deleteposts,moderation_mergeposts_post,moderation_mergeposts';
$templatelist .= ',moderation_move,moderation_threadnotes_modaction,moderation_threadnotes_delayedmodaction,moderation_threadnotes,moderation_getip_modoptions,moderation_getip,moderation_merge';
$templatelist .= ',moderation_split_post,moderation_split,moderation_inline_deletethreads,moderation_inline_movethreads,moderation_inline_deleteposts,moderation_inline_mergeposts';
$templatelist .= ',moderation_inline_splitposts,forumjump_bit,forumjump_special,forumjump_advanced,forumdisplay_password_wrongpass,forumdisplay_password';


require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";


require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";

Zeile 36Zeile 40
	case "allreports":
add_breadcrumb($lang->all_reported_posts);
break;

	case "allreports":
add_breadcrumb($lang->all_reported_posts);
break;

		



}
$tid = intval($mybb->input['tid']);
$pid = intval($mybb->input['pid']);
$fid = intval($mybb->input['fid']);

}
$tid = intval($mybb->input['tid']);
$pid = intval($mybb->input['pid']);
$fid = intval($mybb->input['fid']);





if($pid)
{
$post = get_post($pid);

if($pid)
{
$post = get_post($pid);

Zeile 49Zeile 53
	if(!$post['pid'])
{
error($lang->error_invalidpost);

	if(!$post['pid'])
{
error($lang->error_invalidpost);

	}
}

	}
}


if($tid)
{


if($tid)
{

Zeile 60Zeile 64
	{
error($lang->error_invalidthread);
}

	{
error($lang->error_invalidthread);
}

}

}


if($fid)
{


if($fid)
{

Zeile 71Zeile 75
	build_forum_breadcrumb($fid);
}


	build_forum_breadcrumb($fid);
}


$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject'])); 

$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));


if($tid)


if($tid)

{

{

	add_breadcrumb($thread['subject'], get_thread_link($thread['tid']));
$modlogdata['tid'] = $tid;

	add_breadcrumb($thread['subject'], get_thread_link($thread['tid']));
$modlogdata['tid'] = $tid;

}


}


// Get our permissions all nice and setup
$permissions = forum_permissions($fid);


// Get our permissions all nice and setup
$permissions = forum_permissions($fid);


Zeile 86Zeile 90
{
// Check if this forum is password protected and we have a valid password
check_forum_password($forum['fid']);

{
// Check if this forum is password protected and we have a valid password
check_forum_password($forum['fid']);

}


}


if($mybb->user['uid'] != 0)
{
eval("\$loginbox = \"".$templates->get("changeuserbox")."\";");

if($mybb->user['uid'] != 0)
{
eval("\$loginbox = \"".$templates->get("changeuserbox")."\";");

}

}

else
{
eval("\$loginbox = \"".$templates->get("loginbox")."\";");

else
{
eval("\$loginbox = \"".$templates->get("loginbox")."\";");

}


}


$allowable_moderation_actions = array("getip", "cancel_delayedmoderation", "delayedmoderation");

if($mybb->request_method != "post" && !in_array($mybb->input['action'], $allowable_moderation_actions))

$allowable_moderation_actions = array("getip", "cancel_delayedmoderation", "delayedmoderation");

if($mybb->request_method != "post" && !in_array($mybb->input['action'], $allowable_moderation_actions))

{

{

	error_no_permission();
}


	error_no_permission();
}


Zeile 109Zeile 113
{
// Delayed Moderation
case "cancel_delayedmoderation":

{
// Delayed Moderation
case "cancel_delayedmoderation":

		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

add_breadcrumb($lang->delayed_moderation);
if(!is_moderator($fid, "canmanagethreads"))
{
error_no_permission();
}


		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

add_breadcrumb($lang->delayed_moderation);
if(!is_moderator($fid, "canmanagethreads"))
{
error_no_permission();
}


		$db->delete_query("delayedmoderation", "did='".intval($mybb->input['did'])."'");

		$db->delete_query("delayedmoderation", "did='".intval($mybb->input['did'])."'");

		



		if($tid == 0)
{
moderation_redirect(get_forum_link($fid), $lang->redirect_delayed_moderation_cancelled);

		if($tid == 0)
{
moderation_redirect(get_forum_link($fid), $lang->redirect_delayed_moderation_cancelled);

		}
else
{
moderation_redirect("moderation.php?action=delayedmoderation&tid={$tid}&my_post_key={$mybb->post_code}", $lang->redirect_delayed_moderation_cancelled);
}

		}
else
{
moderation_redirect("moderation.php?action=delayedmoderation&tid={$tid}&my_post_key={$mybb->post_code}", $lang->redirect_delayed_moderation_cancelled);
}

		break;
case "do_delayedmoderation":
case "delayedmoderation":
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

		break;
case "do_delayedmoderation":
case "delayedmoderation":
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

		



		add_breadcrumb($lang->delayed_moderation);

		add_breadcrumb($lang->delayed_moderation);

		



		if(!is_moderator($fid, "canmanagethreads"))
{
error_no_permission();

		if(!is_moderator($fid, "canmanagethreads"))
{
error_no_permission();

		}


		}


		$errors = array();
$customthreadtools = "";

		$errors = array();
$customthreadtools = "";

		



		$allowed_types = array('openclosethread', 'deletethread', 'move', 'stick', 'merge', 'removeredirects', 'removesubscriptions', 'approveunapprovethread');

		$allowed_types = array('openclosethread', 'deletethread', 'move', 'stick', 'merge', 'removeredirects', 'removesubscriptions', 'approveunapprovethread');

		
switch($db->type)
{
case "pgsql":
case "sqlite":
$query = $db->simple_select("modtools", 'tid, name', "(','||forums||',' LIKE '%,$fid,%' OR ','||forums||',' LIKE '%,-1,%' OR forums='') AND type = 't'");
break;
default:
$query = $db->simple_select("modtools", 'tid, name', "(CONCAT(',',forums,',') LIKE '%,$fid,%' OR CONCAT(',',forums,',') LIKE '%,-1,%' OR forums='') AND type = 't'");
}
while($tool = $db->fetch_array($query))


switch($db->type)
{
case "pgsql":
case "sqlite":
$query = $db->simple_select("modtools", 'tid, name', "(','||forums||',' LIKE '%,$fid,%' OR ','||forums||',' LIKE '%,-1,%' OR forums='') AND type = 't'");
break;
default:
$query = $db->simple_select("modtools", 'tid, name', "(CONCAT(',',forums,',') LIKE '%,$fid,%' OR CONCAT(',',forums,',') LIKE '%,-1,%' OR forums='') AND type = 't'");
}
while($tool = $db->fetch_array($query))

		{
$allowed_types[] = "modtool_".$tool['tid'];

		{
$allowed_types[] = "modtool_".$tool['tid'];

			



			$tool['name'] = htmlspecialchars_uni($tool['name']);

			$tool['name'] = htmlspecialchars_uni($tool['name']);

			



			$checked = "";
if($mybb->input['type'] == "modtool_".$tool['tid'])
{

			$checked = "";
if($mybb->input['type'] == "modtool_".$tool['tid'])
{

				$checked = "checked=\"checked\""; 

				$checked = "checked=\"checked\"";

			}

			}

			



			eval("\$customthreadtools .= \"".$templates->get("moderation_delayedmoderation_custommodtool")."\";");
}

			eval("\$customthreadtools .= \"".$templates->get("moderation_delayedmoderation_custommodtool")."\";");
}

		



		if($mybb->input['tid'])
{
$mybb->input['tids'] = $mybb->input['tid'];

		if($mybb->input['tid'])
{
$mybb->input['tids'] = $mybb->input['tid'];

Zeile 179Zeile 183
			if($mybb->input['inlinetype'] == 'search')
{
$tids = getids($mybb->input['searchid'], 'search');

			if($mybb->input['inlinetype'] == 'search')
{
$tids = getids($mybb->input['searchid'], 'search');

			}

			}

			else
{
$fid = $mybb->input['fid'];

			else
{
$fid = $mybb->input['fid'];

Zeile 189Zeile 193
			{
error($lang->error_inline_nothreadsselected);
}

			{
error($lang->error_inline_nothreadsselected);
}

			



			$mybb->input['tids'] = $tids;
}

			$mybb->input['tids'] = $tids;
}

		



		if($mybb->input['action'] == "do_delayedmoderation" && $mybb->request_method == "post")
{
if(!in_array($mybb->input['type'], $allowed_types))

		if($mybb->input['action'] == "do_delayedmoderation" && $mybb->request_method == "post")
{
if(!in_array($mybb->input['type'], $allowed_types))

Zeile 200Zeile 204
				$mybb->input['type'] = '';
$errors[] = $lang->error_delayedmoderation_unsupported_type;
}

				$mybb->input['type'] = '';
$errors[] = $lang->error_delayedmoderation_unsupported_type;
}

			



			if($mybb->input['type'] == 'move' && !in_array($mybb->input['delayedmoderation']['method'], array('move', 'redirect', 'copy')))
{
$mybb->input['delayedmoderation']['method'] = '';
$errors[] = $lang->error_delayedmoderation_unsupported_method;

			if($mybb->input['type'] == 'move' && !in_array($mybb->input['delayedmoderation']['method'], array('move', 'redirect', 'copy')))
{
$mybb->input['delayedmoderation']['method'] = '';
$errors[] = $lang->error_delayedmoderation_unsupported_method;

			}


			}


			if($mybb->input['type'] == 'move')
{

			if($mybb->input['type'] == 'move')
{

				$query = $db->simple_select("forums", "*", "fid='{$fid}'");
$newforum = $db->fetch_array($query);
if($newforum['type'] != 'f')

				$newforum = get_forum($fid);
if(!$newforum || $newforum['type'] != "f" || $newforum['type'] == "f" && $newforum['linkto'] != '')


				{
$errors[] = $lang->error_invalidforum;
}
}

				{
$errors[] = $lang->error_invalidforum;
}
}

			



			if($mybb->input['delay'] < 1)
{
$mybb->input['delay'] = 1;
$errors[] = $lang->error_delayedmoderation_invalid_delay;
}

			if($mybb->input['delay'] < 1)
{
$mybb->input['delay'] = 1;
$errors[] = $lang->error_delayedmoderation_invalid_delay;
}

			



			if(!$errors)
{
if(is_array($mybb->input['tids']))

			if(!$errors)
{
if(is_array($mybb->input['tids']))

Zeile 238Zeile 241
					'dateline' => TIME_NOW,
'inputs' => $db->escape_string(serialize($mybb->input['delayedmoderation']))
));

					'dateline' => TIME_NOW,
'inputs' => $db->escape_string(serialize($mybb->input['delayedmoderation']))
));

				



				$lang->redirect_delayed_moderation_thread = $lang->sprintf($lang->redirect_delayed_moderation_thread, intval($mybb->input['delay']));

				$lang->redirect_delayed_moderation_thread = $lang->sprintf($lang->redirect_delayed_moderation_thread, intval($mybb->input['delay']));

				



				if($mybb->input['tid'])
{
moderation_redirect(get_thread_link($thread['tid']), $lang->redirect_delayed_moderation_thread);

				if($mybb->input['tid'])
{
moderation_redirect(get_thread_link($thread['tid']), $lang->redirect_delayed_moderation_thread);

				}

				}

				else
{
if($mybb->input['inlinetype'] == 'search')

				else
{
if($mybb->input['inlinetype'] == 'search')

Zeile 261Zeile 264
			{
$type_selected = array($mybb->input['type'] => "checked=\"checked\"");
$method_selected = array($mybb->input['delayedmoderation']['method'] => "checked=\"checked\"");

			{
$type_selected = array($mybb->input['type'] => "checked=\"checked\"");
$method_selected = array($mybb->input['delayedmoderation']['method'] => "checked=\"checked\"");

				



				$mybb->input['delay'] = intval($mybb->input['delay']);
$mybb->input['delayedmoderation']['redirect_expire'] = intval($mybb->input['delayedmoderation']['redirect_expire']);
$mybb->input['delayedmoderation']['new_forum'] = intval($mybb->input['delayedmoderation']['new_forum']);
$mybb->input['delayedmoderation']['subject'] = htmlspecialchars_uni($mybb->input['delayedmoderation']['subject']);
$mybb->input['delayedmoderation']['threadurl'] = htmlspecialchars_uni($mybb->input['delayedmoderation']['threadurl']);

				$mybb->input['delay'] = intval($mybb->input['delay']);
$mybb->input['delayedmoderation']['redirect_expire'] = intval($mybb->input['delayedmoderation']['redirect_expire']);
$mybb->input['delayedmoderation']['new_forum'] = intval($mybb->input['delayedmoderation']['new_forum']);
$mybb->input['delayedmoderation']['subject'] = htmlspecialchars_uni($mybb->input['delayedmoderation']['subject']);
$mybb->input['delayedmoderation']['threadurl'] = htmlspecialchars_uni($mybb->input['delayedmoderation']['threadurl']);

				



				$forumselect = build_forum_jump("", $mybb->input['delayedmoderation']['new_forum'], 1, '', 0, true, '', "delayedmoderation[new_forum]");
}
}

				$forumselect = build_forum_jump("", $mybb->input['delayedmoderation']['new_forum'], 1, '', 0, true, '', "delayedmoderation[new_forum]");
}
}

Zeile 275Zeile 278
		{
$type_selected = array('openclosethread' => "checked=\"checked\"");
$method_selected = array('move' => "checked=\"checked\"");

		{
$type_selected = array('openclosethread' => "checked=\"checked\"");
$method_selected = array('move' => "checked=\"checked\"");

			



			$mybb->input['delay'] = 1;
$mybb->input['delayedmoderation']['redirect_expire'] = '';
$mybb->input['delayedmoderation']['subject'] = $thread['subject'];
$mybb->input['delayedmoderation']['threadurl'] = '';

			$mybb->input['delay'] = 1;
$mybb->input['delayedmoderation']['redirect_expire'] = '';
$mybb->input['delayedmoderation']['subject'] = $thread['subject'];
$mybb->input['delayedmoderation']['threadurl'] = '';

			



			$forumselect = build_forum_jump("", $fid, 1, '', 0, true, '', "delayedmoderation[new_forum]");
}

			$forumselect = build_forum_jump("", $fid, 1, '', 0, true, '', "delayedmoderation[new_forum]");
}

		



		if(count($errors) > 0)

		if(count($errors) > 0)

		{

		{

			$display_errors = inline_error($errors);
}

			$display_errors = inline_error($errors);
}

		



		$forum_cache = $cache->read("forums");

		$forum_cache = $cache->read("forums");

		



		$actions = array(
'openclosethread' => $lang->open_close_thread,
'deletethread' => $lang->delete_thread,

		$actions = array(
'openclosethread' => $lang->open_close_thread,
'deletethread' => $lang->delete_thread,

Zeile 301Zeile 304
			'removesubscriptions' => $lang->remove_subscriptions,
'approveunapprovethread' => $lang->approve_unapprove_thread
);

			'removesubscriptions' => $lang->remove_subscriptions,
'approveunapprovethread' => $lang->approve_unapprove_thread
);

		



		switch($db->type)
{
case "pgsql":

		switch($db->type)
{
case "pgsql":

Zeile 315Zeile 318
		{
$actions['modtool_'.$tool['tid']] = htmlspecialchars_uni($tool['name']);
}

		{
$actions['modtool_'.$tool['tid']] = htmlspecialchars_uni($tool['name']);
}

		



		$delayedmods = '';
$trow = alt_trow(1);
if($tid == 0)

		$delayedmods = '';
$trow = alt_trow(1);
if($tid == 0)

Zeile 339Zeile 342
						$where_array[] = "','||d.tids||',' LIKE '%,".$db->escape_string($like).",%'";
}
$where_statement = implode(" OR ", $where_array);

						$where_array[] = "','||d.tids||',' LIKE '%,".$db->escape_string($like).",%'";
}
$where_statement = implode(" OR ", $where_array);

					$query = $db->query("
SELECT d.*, u.username, t.subject AS tsubject, f.name AS fname
FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=d.tids)
LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE ".$where_statement."
ORDER BY d.dateline DESC
LIMIT 0, 20
");

 
					break;
default:
foreach($tids as $like)

					break;
default:
foreach($tids as $like)

Zeile 356Zeile 349
						$where_array[] = "CONCAT(',',d.tids,',') LIKE  '%,".$db->escape_string($like).",%'";
}
$where_statement = implode(" OR ", $where_array);

						$where_array[] = "CONCAT(',',d.tids,',') LIKE  '%,".$db->escape_string($like).",%'";
}
$where_statement = implode(" OR ", $where_array);

					$query = $db->query("
SELECT d.*, u.username, t.subject AS tsubject, f.name AS fname
FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=d.tids)
LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE ".$where_statement."
ORDER BY d.dateline DESC
LIMIT 0, 20
");
}
}

			}
$query = $db->query("
SELECT d.*, u.username, f.name AS fname
FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)
LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE ".$where_statement."
ORDER BY d.dateline DESC
LIMIT 0, 20
");
}


		else
{
switch($db->type)
{
case "pgsql":
case "sqlite":

		else
{
switch($db->type)
{
case "pgsql":
case "sqlite":

					$query = $db->query("
SELECT d.*, u.username, t.subject AS tsubject, f.name AS fname

					$query = $db->query("
SELECT d.*, u.username, f.name AS fname

						FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)

						FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)

						LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=d.tids)

 
						LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE ','||d.tids||',' LIKE '%,{$tid},%'

						LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE ','||d.tids||',' LIKE '%,{$tid},%'

						ORDER BY d.dateline DESC
LIMIT 0, 20
");

						ORDER BY d.dateline DESC
LIMIT 0, 20
");

					break;
default:
$query = $db->query("

					break;
default:
$query = $db->query("

						SELECT d.*, u.username, t.subject AS tsubject, f.name AS fname

						SELECT d.*, u.username, f.name AS fname

						FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)

						FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)

						LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=d.tids)

 
						LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE CONCAT(',',d.tids,',') LIKE '%,{$tid},%'
ORDER BY d.dateline DESC

						LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE CONCAT(',',d.tids,',') LIKE '%,{$tid},%'
ORDER BY d.dateline DESC

Zeile 399Zeile 389
			}
}
while($delayedmod = $db->fetch_array($query))

			}
}
while($delayedmod = $db->fetch_array($query))

		{

		{

			$delayedmod['dateline'] = my_date("jS M Y, G:i", $delayedmod['delaydateline']);
$delayedmod['profilelink'] = build_profile_link($delayedmod['username'], $delayedmod['uid']);
$delayedmod['action'] = $actions[$delayedmod['type']];
$info = '';

			$delayedmod['dateline'] = my_date("jS M Y, G:i", $delayedmod['delaydateline']);
$delayedmod['profilelink'] = build_profile_link($delayedmod['username'], $delayedmod['uid']);
$delayedmod['action'] = $actions[$delayedmod['type']];
$info = '';

			if($delayedmod['tsubject'] && strpos($delayedmod['tids'], ',') === false)
{
$info .= "<strong>{$lang->thread}</strong> <a href=\"".get_thread_link($delayedmod['tids'])."\">".htmlspecialchars_uni($delayedmod['tsubject'])."</a><br />";
}
else


			if(strpos($delayedmod['tids'], ',') === false)
{
$delayed_thread = get_thread($delayedmod['tids']);
$info .= "<strong>{$lang->thread}</strong> <a href=\"".get_thread_link($delayedmod['tids'])."\">".htmlspecialchars_uni($delayed_thread['subject'])."</a><br />";
}
else

			{
$info .= "<strong>{$lang->thread}</strong> {$lang->multiple_threads}<br />";

			{
$info .= "<strong>{$lang->thread}</strong> {$lang->multiple_threads}<br />";

			}


			}


			if($delayedmod['fname'])
{
$info .= "<strong>{$lang->forum}</strong> <a href=\"".get_forum_link($delayedmod['fid'])."\">".htmlspecialchars_uni($delayedmod['fname'])."</a><br />";
}
$delayedmod['inputs'] = unserialize($delayedmod['inputs']);

			if($delayedmod['fname'])
{
$info .= "<strong>{$lang->forum}</strong> <a href=\"".get_forum_link($delayedmod['fid'])."\">".htmlspecialchars_uni($delayedmod['fname'])."</a><br />";
}
$delayedmod['inputs'] = unserialize($delayedmod['inputs']);

				



			if($delayedmod['type'] == 'move')
{
$info .= "<strong>{$lang->new_forum}</strong> <a href=\"".get_forum_link($delayedmod['inputs']['new_forum'])."\">".htmlspecialchars_uni($forum_cache[$delayedmod['inputs']['new_forum']]['name'])."</a><br />";

			if($delayedmod['type'] == 'move')
{
$info .= "<strong>{$lang->new_forum}</strong> <a href=\"".get_forum_link($delayedmod['inputs']['new_forum'])."\">".htmlspecialchars_uni($forum_cache[$delayedmod['inputs']['new_forum']]['name'])."</a><br />";

Zeile 448Zeile 439
		{
$delayedmods = "<tr><td class=\"trow1\" colspan=\"5\">{$lang->no_delayed_mods}</td></tr>";
}

		{
$delayedmods = "<tr><td class=\"trow1\" colspan=\"5\">{$lang->no_delayed_mods}</td></tr>";
}

		



		$url = '';
if($mybb->input['tid'])
{

		$url = '';
if($mybb->input['tid'])
{

Zeile 471Zeile 462
			{
error($lang->error_inline_nothreadsselected);
}

			{
error($lang->error_inline_nothreadsselected);
}

			



			$threads = $lang->sprintf($lang->threads_selected, count($tids));
}
eval("\$moderation_delayedmoderation_move = \"".$templates->get("moderation_delayedmoderation_move")."\";");

			$threads = $lang->sprintf($lang->threads_selected, count($tids));
}
eval("\$moderation_delayedmoderation_move = \"".$templates->get("moderation_delayedmoderation_move")."\";");

		



		$plugins->run_hooks("moderation_delayedmoderation");

eval("\$delayedmoderation = \"".$templates->get("moderation_delayedmoderation")."\";");

		$plugins->run_hooks("moderation_delayedmoderation");

eval("\$delayedmoderation = \"".$templates->get("moderation_delayedmoderation")."\";");

Zeile 487Zeile 478
		verify_post_check($mybb->input['my_post_key']);

if(!is_moderator($fid, "canopenclosethreads"))

		verify_post_check($mybb->input['my_post_key']);

if(!is_moderator($fid, "canopenclosethreads"))

		{

		{

			error_no_permission();

			error_no_permission();

		}


		}


		if($thread['closed'] == 1)
{
$openclose = $lang->opened;
$redirect = $lang->redirect_openthread;
$moderation->open_threads($tid);

		if($thread['closed'] == 1)
{
$openclose = $lang->opened;
$redirect = $lang->redirect_openthread;
$moderation->open_threads($tid);

		}

		}

		else
{
$openclose = $lang->closed;
$redirect = $lang->redirect_closethread;
$moderation->close_threads($tid);
}

		else
{
$openclose = $lang->closed;
$redirect = $lang->redirect_closethread;
$moderation->close_threads($tid);
}





		$lang->mod_process = $lang->sprintf($lang->mod_process, $openclose);

log_moderator_action($modlogdata, $lang->mod_process);

		$lang->mod_process = $lang->sprintf($lang->mod_process, $openclose);

log_moderator_action($modlogdata, $lang->mod_process);

Zeile 513Zeile 504

// Stick or unstick that post to the top bab!
case "stick";


// Stick or unstick that post to the top bab!
case "stick";

		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);


if(!is_moderator($fid, "canmanagethreads"))
{
error_no_permission();


if(!is_moderator($fid, "canmanagethreads"))
{
error_no_permission();

		}

$plugins->run_hooks("moderation_stick");

		}

$plugins->run_hooks("moderation_stick");


if($thread['sticky'] == 1)
{
$stuckunstuck = $lang->unstuck;
$redirect = $lang->redirect_unstickthread;
$moderation->unstick_threads($tid);


if($thread['sticky'] == 1)
{
$stuckunstuck = $lang->unstuck;
$redirect = $lang->redirect_unstickthread;
$moderation->unstick_threads($tid);

		}

		}

		else
{
$stuckunstuck = $lang->stuck;
$redirect = $lang->redirect_stickthread;
$moderation->stick_threads($tid);
}

		else
{
$stuckunstuck = $lang->stuck;
$redirect = $lang->redirect_stickthread;
$moderation->stick_threads($tid);
}





		$lang->mod_process = $lang->sprintf($lang->mod_process, $stuckunstuck);

log_moderator_action($modlogdata, $lang->mod_process);

moderation_redirect(get_thread_link($thread['tid']), $redirect);

		$lang->mod_process = $lang->sprintf($lang->mod_process, $stuckunstuck);

log_moderator_action($modlogdata, $lang->mod_process);

moderation_redirect(get_thread_link($thread['tid']), $redirect);

		break;

		break;


// Remove redirects to a specific thread
case "removeredirects":


// Remove redirects to a specific thread
case "removeredirects":

Zeile 550Zeile 541
		verify_post_check($mybb->input['my_post_key']);

if(!is_moderator($fid, "canmanagethreads"))

		verify_post_check($mybb->input['my_post_key']);

if(!is_moderator($fid, "canmanagethreads"))

		{

		{

			error_no_permission();
}

			error_no_permission();
}





		$plugins->run_hooks("moderation_removeredirects");

$moderation->remove_redirects($tid);

		$plugins->run_hooks("moderation_removeredirects");

$moderation->remove_redirects($tid);

Zeile 567Zeile 558

add_breadcrumb($lang->nav_deletethread);



add_breadcrumb($lang->nav_deletethread);


		if(!is_moderator($fid, "candeleteposts"))
{
if($permissions['candeletethreads'] != 1 || $mybb->user['uid'] != $thread['uid'])
{
error_no_permission();
}
}

$plugins->run_hooks("moderation_deletethread");


		if(!is_moderator($fid, "candeleteposts"))
{
if($permissions['candeletethreads'] != 1 || $mybb->user['uid'] != $thread['uid'])
{
error_no_permission();
}
}

$plugins->run_hooks("moderation_deletethread");


		eval("\$deletethread = \"".$templates->get("moderation_deletethread")."\";");
output_page($deletethread);
break;

// Delete the actual thread here

		eval("\$deletethread = \"".$templates->get("moderation_deletethread")."\";");
output_page($deletethread);
break;

// Delete the actual thread here

	case "do_deletethread":

	case "do_deletethread":


// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);


// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

Zeile 596Zeile 587
		}

$plugins->run_hooks("moderation_do_deletethread");

		}

$plugins->run_hooks("moderation_do_deletethread");

		



		// Log the subject of the deleted thread
$modlogdata['thread_subject'] = $thread['subject'];


		// Log the subject of the deleted thread
$modlogdata['thread_subject'] = $thread['subject'];


Zeile 818Zeile 809
			SELECT p.*, u.*
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (p.uid=u.uid)

			SELECT p.*, u.*
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (p.uid=u.uid)

			WHERE tid='$tid' 

			WHERE tid='$tid'

			ORDER BY dateline ASC
");
$altbg = "trow1";

			ORDER BY dateline ASC
");
$altbg = "trow1";

Zeile 842Zeile 833
			$message = $parser->parse_message($post['message'], $parser_options);
eval("\$posts .= \"".$templates->get("moderation_mergeposts_post")."\";");
$altbg = alt_trow();

			$message = $parser->parse_message($post['message'], $parser_options);
eval("\$posts .= \"".$templates->get("moderation_mergeposts_post")."\";");
$altbg = alt_trow();

		}


		}


		$plugins->run_hooks("moderation_mergeposts");

		$plugins->run_hooks("moderation_mergeposts");





		eval("\$mergeposts = \"".$templates->get("moderation_mergeposts")."\";");
output_page($mergeposts);
break;

		eval("\$mergeposts = \"".$templates->get("moderation_mergeposts")."\";");
output_page($mergeposts);
break;





	// Lets merge those selected posts!
case "do_mergeposts":

	// Lets merge those selected posts!
case "do_mergeposts":


// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!is_moderator($fid, "canmanagethreads"))


// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!is_moderator($fid, "canmanagethreads"))

		{
error_no_permission();
}

		{
error_no_permission();
}

Zeile 864Zeile 855
		$plugins->run_hooks("moderation_do_mergeposts");

$mergepost = $mybb->input['mergepost'];

		$plugins->run_hooks("moderation_do_mergeposts");

$mergepost = $mybb->input['mergepost'];

		if(count($mergepost) <= 1)
{
error($lang->error_nomergeposts);
}


		if(count($mergepost) <= 1)
{
error($lang->error_nomergeposts);
}


		foreach($mergepost as $pid => $yes)
{
$plist[] = intval($pid);

		foreach($mergepost as $pid => $yes)
{
$plist[] = intval($pid);

Zeile 905Zeile 896
		$method = $mybb->input['method'];

if(!is_moderator($fid, "canmanagethreads"))

		$method = $mybb->input['method'];

if(!is_moderator($fid, "canmanagethreads"))

		{
error_no_permission();

		{
error_no_permission();

		}
// Check if user has moderator permission to move to destination
if(!is_moderator($moveto, "canmanagethreads") && !is_moderator($fid, "canmovetononmodforum"))

		}
// Check if user has moderator permission to move to destination
if(!is_moderator($moveto, "canmanagethreads") && !is_moderator($fid, "canmovetononmodforum"))

		{
error_no_permission();
}

		{
error_no_permission();
}

		$newperms = forum_permissions($moveto);
if($newperms['canview'] == 0 && !is_moderator($fid, "canmovetononmodforum"))
{
error_no_permission();
}


		$newperms = forum_permissions($moveto);
if($newperms['canview'] == 0 && !is_moderator($fid, "canmovetononmodforum"))
{
error_no_permission();
}


		$query = $db->simple_select("forums", "*", "fid='$moveto'");
$newforum = $db->fetch_array($query);
if($newforum['type'] != "f")

		$newforum = get_forum($moveto);
if(!$newforum || $newforum['type'] != "f" || $newforum['type'] == "f" && $newforum['linkto'] != '')


		{
error($lang->error_invalidforum);
}

		{
error($lang->error_invalidforum);
}

Zeile 979Zeile 969
		{
$modaction['dateline'] = my_date("jS M Y, G:i", $modaction['dateline']);
$modaction['profilelink'] = build_profile_link($modaction['username'], $modaction['uid']);

		{
$modaction['dateline'] = my_date("jS M Y, G:i", $modaction['dateline']);
$modaction['profilelink'] = build_profile_link($modaction['username'], $modaction['uid']);

 
			$modaction['action'] = htmlspecialchars_uni($modaction['action']);

			$info = '';
if($modaction['tsubject'])
{

			$info = '';
if($modaction['tsubject'])
{

Zeile 1000Zeile 991
		{
$modactions = "<tr><td class=\"trow1\" colspan=\"4\">$lang->no_mod_options</td></tr>";
}

		{
$modactions = "<tr><td class=\"trow1\" colspan=\"4\">$lang->no_mod_options</td></tr>";
}

		



		$actions = array(
'openclosethread' => $lang->open_close_thread,
'deletethread' => $lang->delete_thread,

		$actions = array(
'openclosethread' => $lang->open_close_thread,
'deletethread' => $lang->delete_thread,

Zeile 1011Zeile 1002
			'removesubscriptions' => $lang->remove_subscriptions,
'approveunapprovethread' => $lang->approve_unapprove_thread
);

			'removesubscriptions' => $lang->remove_subscriptions,
'approveunapprovethread' => $lang->approve_unapprove_thread
);

		
switch($db->type)
{


switch($db->type)
{

			case "pgsql":
case "sqlite":
$query = $db->simple_select("modtools", 'tid, name', "(','||forums||',' LIKE '%,$fid,%' OR ','||forums||',' LIKE '%,-1,%' OR forums='') AND type = 't'");

			case "pgsql":
case "sqlite":
$query = $db->simple_select("modtools", 'tid, name', "(','||forums||',' LIKE '%,$fid,%' OR ','||forums||',' LIKE '%,-1,%' OR forums='') AND type = 't'");

Zeile 1025Zeile 1016
		{
$actions['modtool_'.$tool['tid']] = htmlspecialchars_uni($tool['name']);
}

		{
$actions['modtool_'.$tool['tid']] = htmlspecialchars_uni($tool['name']);
}

		



		$forum_cache = $cache->read("forums");

		$forum_cache = $cache->read("forums");

		



		$trow = alt_trow(1);
switch($db->type)
{
case "pgsql":
case "sqlite":

		$trow = alt_trow(1);
switch($db->type)
{
case "pgsql":
case "sqlite":

				$query = $db->query("
SELECT d.*, u.username, t.subject AS tsubject, f.name AS fname
FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=d.tids)

				$query = $db->query("
SELECT d.*, u.username, f.name AS fname
FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)


					LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE ','||d.tids||',' LIKE '%,{$tid},%'

					LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE ','||d.tids||',' LIKE '%,{$tid},%'

					ORDER BY d.dateline DESC
LIMIT 0, 20

					ORDER BY d.dateline DESC
LIMIT 0, 20

				");
break;
default:
$query = $db->query("

				");
break;
default:
$query = $db->query("

					SELECT d.*, u.username, t.subject AS tsubject, f.name AS fname

					SELECT d.*, u.username, f.name AS fname

					FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)

					FROM ".TABLE_PREFIX."delayedmoderation d
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=d.uid)

					LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=d.tids)

 
					LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE CONCAT(',',d.tids,',') LIKE '%,{$tid},%'
ORDER BY d.dateline DESC

					LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=d.fid)
WHERE CONCAT(',',d.tids,',') LIKE '%,{$tid},%'
ORDER BY d.dateline DESC

Zeile 1058Zeile 1047
		}
while($delayedmod = $db->fetch_array($query))
{

		}
while($delayedmod = $db->fetch_array($query))
{

			$delayedmod['dateline'] = my_date("jS M Y, G:i", $delayedmod['dateline']+($delayedmod['delay']*24*60*60));

			$delayedmod['dateline'] = my_date("jS M Y, G:i", $delayedmod['delaydateline']);

			$delayedmod['profilelink'] = build_profile_link($delayedmod['username'], $delayedmod['uid']);
$delayedmod['action'] = $actions[$delayedmod['type']];
$info = '';

			$delayedmod['profilelink'] = build_profile_link($delayedmod['username'], $delayedmod['uid']);
$delayedmod['action'] = $actions[$delayedmod['type']];
$info = '';

			if($delayedmod['tsubject'] && strpos($delayedmod['tids'], ',') === false)

			if(strpos($delayedmod['tids'], ',') === false)

			{

			{

				$info .= "<strong>{$lang->thread}</strong> <a href=\"".get_thread_link($delayedmod['tids'])."\">".htmlspecialchars_uni($delayedmod['tsubject'])."</a><br />";

				$info .= "<strong>{$lang->thread}</strong> <a href=\"".get_thread_link($delayedmod['tids'])."\">{$thread['subject']}</a><br />";

			}
else
{
$info .= "<strong>{$lang->thread}</strong> {$lang->multiple_threads}<br />";
}

			}
else
{
$info .= "<strong>{$lang->thread}</strong> {$lang->multiple_threads}<br />";
}

			



			if($delayedmod['fname'])
{
$info .= "<strong>{$lang->forum}</strong> <a href=\"".get_forum_link($delayedmod['fid'])."\">".htmlspecialchars_uni($delayedmod['fname'])."</a><br />";
}
$delayedmod['inputs'] = unserialize($delayedmod['inputs']);

			if($delayedmod['fname'])
{
$info .= "<strong>{$lang->forum}</strong> <a href=\"".get_forum_link($delayedmod['fid'])."\">".htmlspecialchars_uni($delayedmod['fname'])."</a><br />";
}
$delayedmod['inputs'] = unserialize($delayedmod['inputs']);

				



			if($delayedmod['type'] == 'move')
{
$info .= "<strong>{$lang->new_forum}</strong> <a href=\"".get_forum_link($delayedmod['inputs']['new_forum'])."\">".htmlspecialchars_uni($forum_cache[$delayedmod['inputs']['new_forum']]['name'])."</a><br />";

			if($delayedmod['type'] == 'move')
{
$info .= "<strong>{$lang->new_forum}</strong> <a href=\"".get_forum_link($delayedmod['inputs']['new_forum'])."\">".htmlspecialchars_uni($forum_cache[$delayedmod['inputs']['new_forum']]['name'])."</a><br />";

Zeile 1084Zeile 1073
				{
$info .= "<strong>{$lang->leave_redirect_for}</strong> ".intval($delayedmod['inputs']['redirect_expire'])." {$lang->days}<br />";
}

				{
$info .= "<strong>{$lang->leave_redirect_for}</strong> ".intval($delayedmod['inputs']['redirect_expire'])." {$lang->days}<br />";
}

			}

			}

			else if($delayedmod['type'] == 'merge')
{
$info .= "<strong>{$lang->new_subject}</strong> ".htmlspecialchars_uni($delayedmod['inputs']['subject'])."<br />";

			else if($delayedmod['type'] == 'merge')
{
$info .= "<strong>{$lang->new_subject}</strong> ".htmlspecialchars_uni($delayedmod['inputs']['subject'])."<br />";

Zeile 1100Zeile 1089
		}

$plugins->run_hooks("moderation_threadnotes");

		}

$plugins->run_hooks("moderation_threadnotes");





		eval("\$threadnotes = \"".$templates->get("moderation_threadnotes")."\";");
output_page($threadnotes);
break;

// Update the thread notes!
case "do_threadnotes":

		eval("\$threadnotes = \"".$templates->get("moderation_threadnotes")."\";");
output_page($threadnotes);
break;

// Update the thread notes!
case "do_threadnotes":





		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);





		if(!is_moderator($fid, "canmanagethreads"))

		if(!is_moderator($fid, "canmanagethreads"))

		{
error_no_permission();
}

		{
error_no_permission();
}


$plugins->run_hooks("moderation_do_threadnotes");



$plugins->run_hooks("moderation_do_threadnotes");


Zeile 1130Zeile 1119
	case "getip":
add_breadcrumb($lang->nav_getip);
if(!is_moderator($fid, "canviewips"))

	case "getip":
add_breadcrumb($lang->nav_getip);
if(!is_moderator($fid, "canviewips"))

		{

		{

			error_no_permission();
}


			error_no_permission();
}


Zeile 1138Zeile 1127
		if(!$hostname || $hostname == $post['ipaddress'])
{
$hostname = $lang->resolve_fail;

		if(!$hostname || $hostname == $post['ipaddress'])
{
$hostname = $lang->resolve_fail;

		}




		}

$username = build_profile_link($post['username'], $post['uid']);


		// Moderator options
$modoptions = "";
if($mybb->usergroup['canmodcp'] == 1)

		// Moderator options
$modoptions = "";
if($mybb->usergroup['canmodcp'] == 1)

Zeile 1177Zeile 1168
		}

$plugins->run_hooks("moderation_do_merge");

		}

$plugins->run_hooks("moderation_do_merge");

		



		// explode at # sign in a url (indicates a name reference) and reassign to the url
$realurl = explode("#", $mybb->input['threadurl']);
$mybb->input['threadurl'] = $realurl[0];

		// explode at # sign in a url (indicates a name reference) and reassign to the url
$realurl = explode("#", $mybb->input['threadurl']);
$mybb->input['threadurl'] = $realurl[0];

		



		// Are we using an SEO URL?
if(substr($mybb->input['threadurl'], -4) == "html")
{
// Get thread to merge's tid the SEO way
preg_match("#thread-([0-9]+)?#i", $mybb->input['threadurl'], $threadmatch);
preg_match("#post-([0-9]+)?#i", $mybb->input['threadurl'], $postmatch);

		// Are we using an SEO URL?
if(substr($mybb->input['threadurl'], -4) == "html")
{
// Get thread to merge's tid the SEO way
preg_match("#thread-([0-9]+)?#i", $mybb->input['threadurl'], $threadmatch);
preg_match("#post-([0-9]+)?#i", $mybb->input['threadurl'], $postmatch);

			



			if($threadmatch[1])
{
$parameters['tid'] = $threadmatch[1];

			if($threadmatch[1])
{
$parameters['tid'] = $threadmatch[1];

			}


			}


			if($postmatch[1])
{
$parameters['pid'] = $postmatch[1];

			if($postmatch[1])
{
$parameters['pid'] = $postmatch[1];

Zeile 1206Zeile 1197
			$temp = explode("&", my_substr($splitloc[1], 1));

if(!empty($temp))

			$temp = explode("&", my_substr($splitloc[1], 1));

if(!empty($temp))

			{

			{

				for($i = 0; $i < count($temp); $i++)
{
$temp2 = explode("=", $temp[$i], 2);
$parameters[$temp2[0]] = $temp2[1];
}

				for($i = 0; $i < count($temp); $i++)
{
$temp2 = explode("=", $temp[$i], 2);
$parameters[$temp2[0]] = $temp2[1];
}

			}

			}

			else
{
$temp2 = explode("=", $splitloc[1], 2);
$parameters[$temp2[0]] = $temp2[1];
}
}

			else
{
$temp2 = explode("=", $splitloc[1], 2);
$parameters[$temp2[0]] = $temp2[1];
}
}

		



		if($parameters['pid'] && !$parameters['tid'])
{
$query = $db->simple_select("posts", "*", "pid='".intval($parameters['pid'])."'");

		if($parameters['pid'] && !$parameters['tid'])
{
$query = $db->simple_select("posts", "*", "pid='".intval($parameters['pid'])."'");

Zeile 1258Zeile 1249

log_moderator_action($modlogdata, $lang->thread_merged);



log_moderator_action($modlogdata, $lang->thread_merged);


		moderation_redirect("showthread.php?tid=$tid", $lang->redirect_threadsmerged);

		moderation_redirect(get_thread_link($tid), $lang->redirect_threadsmerged);

		break;

// Divorce the posts in this thread (Split!)
case "split":
add_breadcrumb($lang->nav_split);

		break;

// Divorce the posts in this thread (Split!)
case "split":
add_breadcrumb($lang->nav_split);

		if(!is_moderator($fid, "canmanagethreads"))
{
error_no_permission();
}
$query = $db->query("
SELECT p.*, u.*
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (p.uid=u.uid)

		if(!is_moderator($fid, "canmanagethreads"))
{
error_no_permission();
}
$query = $db->query("
SELECT p.*, u.*
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (p.uid=u.uid)

			WHERE tid='$tid'
ORDER BY dateline ASC
");

			WHERE tid='$tid'
ORDER BY dateline ASC
");

Zeile 1298Zeile 1289
			if($post['smilieoff'] == 1)
{
$parser_options['allow_smilies'] = 0;

			if($post['smilieoff'] == 1)
{
$parser_options['allow_smilies'] = 0;

			}


			}


			$message = $parser->parse_message($post['message'], $parser_options);
eval("\$posts .= \"".$templates->get("moderation_split_post")."\";");
$altbg = alt_trow();

			$message = $parser->parse_message($post['message'], $parser_options);
eval("\$posts .= \"".$templates->get("moderation_split_post")."\";");
$altbg = alt_trow();

Zeile 1341Zeile 1332
		{
error($lang->error_cantsplitall);
}

		{
error($lang->error_cantsplitall);
}

		



		if($mybb->input['moveto'])

		if($mybb->input['moveto'])

		{

		{

			$moveto = intval($mybb->input['moveto']);

			$moveto = intval($mybb->input['moveto']);

		}

		}

		else
{
$moveto = $fid;
}

		else
{
$moveto = $fid;
}

		$query = $db->simple_select("forums", "fid", "fid='$moveto'", array('limit' => 1));
if($db->num_rows($query) == 0)



$newforum = get_forum($moveto);
if(!$newforum || $newforum['type'] != "f" || $newforum['type'] == "f" && $newforum['linkto'] != '')

		{
error($lang->error_invalidforum);
}

		{
error($lang->error_invalidforum);
}

Zeile 1373Zeile 1365

moderation_redirect(get_thread_link($newtid), $lang->redirect_threadsplit);
break;


moderation_redirect(get_thread_link($newtid), $lang->redirect_threadsplit);
break;

		



	// Delete Thread Subscriptions
case "removesubscriptions":
if(!is_moderator($fid, "canmanagethreads"))
{
error_no_permission();

	// Delete Thread Subscriptions
case "removesubscriptions":
if(!is_moderator($fid, "canmanagethreads"))
{
error_no_permission();

		}

		}


$plugins->run_hooks("moderation_removesubscriptions");


$plugins->run_hooks("moderation_removesubscriptions");





		$moderation->remove_thread_subscriptions($tid, true);

log_moderator_action($modlogdata, $lang->removed_subscriptions);

		$moderation->remove_thread_subscriptions($tid, true);

log_moderator_action($modlogdata, $lang->removed_subscriptions);

Zeile 1393Zeile 1385
	// Delete Threads - Inline moderation
case "multideletethreads":
add_breadcrumb($lang->nav_multi_deletethreads);

	// Delete Threads - Inline moderation
case "multideletethreads":
add_breadcrumb($lang->nav_multi_deletethreads);

		



		if(!empty($mybb->input['searchid']))

		if(!empty($mybb->input['searchid']))

		{

		{

			// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'candeleteposts'))

			// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'candeleteposts'))

			{
error_no_permission();
}
}
else
{

			{
error_no_permission();
}
}
else
{

			$threads = getids($fid, 'forum');
if(!is_moderator($fid, 'candeleteposts'))
{

			$threads = getids($fid, 'forum');
if(!is_moderator($fid, 'candeleteposts'))
{

Zeile 1415Zeile 1407
		{
error($lang->error_inline_nothreadsselected);
}

		{
error($lang->error_inline_nothreadsselected);
}

		



		$inlineids = implode("|", $threads);
if($mybb->input['inlinetype'] == 'search')

		$inlineids = implode("|", $threads);
if($mybb->input['inlinetype'] == 'search')

		{

		{

			clearinline($mybb->input['searchid'], 'search');
}
else

			clearinline($mybb->input['searchid'], 'search');
}
else

		{

		{

			clearinline($fid, 'forum');
}
$return_url = htmlspecialchars_uni($mybb->input['url']);

			clearinline($fid, 'forum');
}
$return_url = htmlspecialchars_uni($mybb->input['url']);

Zeile 1440Zeile 1432
		if(!is_moderator_by_tids($threadlist, "candeleteposts"))
{
error_no_permission();

		if(!is_moderator_by_tids($threadlist, "candeleteposts"))
{
error_no_permission();

		}

		}

		foreach($threadlist as $tid)
{
$tid = intval($tid);

		foreach($threadlist as $tid)
{
$tid = intval($tid);

Zeile 1451Zeile 1443
		if($mybb->input['inlinetype'] == 'search')
{
clearinline($mybb->input['searchid'], 'search');

		if($mybb->input['inlinetype'] == 'search')
{
clearinline($mybb->input['searchid'], 'search');

		}

		}

		else
{
clearinline($fid, 'forum');

		else
{
clearinline($fid, 'forum');

Zeile 1462Zeile 1454

// Open threads - Inline moderation
case "multiopenthreads":


// Open threads - Inline moderation
case "multiopenthreads":





		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

		



		if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canopenclosethreads'))

		if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canopenclosethreads'))

			{
error_no_permission();
}
}
else
{
$threads = getids($fid, 'forum');
if(!is_moderator($fid, 'canopenclosethreads'))
{
error_no_permission();
}
}

if(count($threads) < 1)
{
error($lang->error_inline_nothreadsselected);
}

$moderation->open_threads($threads);

log_moderator_action($modlogdata, $lang->multi_opened_threads);
if($mybb->input['inlinetype'] == 'search')
{
clearinline($mybb->input['searchid'], 'search');
}
else
{
clearinline($fid, 'forum');
}
moderation_redirect(get_forum_link($fid), $lang->redirect_inline_threadsopened);
break;

// Close threads - Inline moderation
case "multiclosethreads":

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canmanagethreads'))
{
error_no_permission();
}
}
else

			{
error_no_permission();
}
}
else












































		{
$threads = getids($fid, 'forum');

		{
$threads = getids($fid, 'forum');

			if(!is_moderator($fid, 'canmanagethreads'))

			if(!is_moderator($fid, 'canopenclosethreads'))

			{
error_no_permission();
}
}

			{
error_no_permission();
}
}

 


		if(count($threads) < 1)
{
error($lang->error_inline_nothreadsselected);

		if(count($threads) < 1)
{
error($lang->error_inline_nothreadsselected);

		}

$moderation->close_threads($threads);

		}

$moderation->open_threads($threads);





		log_moderator_action($modlogdata, $lang->multi_closed_threads);

		log_moderator_action($modlogdata, $lang->multi_opened_threads);

		if($mybb->input['inlinetype'] == 'search')

		if($mybb->input['inlinetype'] == 'search')

		{

		{

			clearinline($mybb->input['searchid'], 'search');
}
else
{
clearinline($fid, 'forum');
}

			clearinline($mybb->input['searchid'], 'search');
}
else
{
clearinline($fid, 'forum');
}

		moderation_redirect(get_forum_link($fid), $lang->redirect_inline_threadsclosed);

		moderation_redirect(get_forum_link($fid), $lang->redirect_inline_threadsopened);

		break;

		break;


// Approve threads - Inline moderation
case "multiapprovethreads":


// Close threads - Inline moderation
case "multiclosethreads":


// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!empty($mybb->input['searchid']))


// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!empty($mybb->input['searchid']))

		{

		{

			// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canmanagethreads'))

			// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canmanagethreads'))

			{
error_no_permission();
}
}
else











































			{
error_no_permission();
}
}
else
{
$threads = getids($fid, 'forum');
if(!is_moderator($fid, 'canmanagethreads'))
{
error_no_permission();
}
}
if(count($threads) < 1)
{
error($lang->error_inline_nothreadsselected);
}

$moderation->close_threads($threads);

log_moderator_action($modlogdata, $lang->multi_closed_threads);
if($mybb->input['inlinetype'] == 'search')
{
clearinline($mybb->input['searchid'], 'search');
}
else
{
clearinline($fid, 'forum');
}
moderation_redirect(get_forum_link($fid), $lang->redirect_inline_threadsclosed);
break;

// Approve threads - Inline moderation
case "multiapprovethreads":

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canmanagethreads'))
{
error_no_permission();
}
}
else

		{
$threads = getids($fid, 'forum');
if(!is_moderator($fid, 'canmanagethreads'))

		{
$threads = getids($fid, 'forum');
if(!is_moderator($fid, 'canmanagethreads'))

Zeile 1571Zeile 1563
		if(count($threads) < 1)
{
error($lang->error_inline_nothreadsselected);

		if(count($threads) < 1)
{
error($lang->error_inline_nothreadsselected);

		}

$moderation->approve_threads($threads, $fid);

		}

$moderation->approve_threads($threads, $fid);


log_moderator_action($modlogdata, $lang->multi_approved_threads);
if($mybb->input['inlinetype'] == 'search')


log_moderator_action($modlogdata, $lang->multi_approved_threads);
if($mybb->input['inlinetype'] == 'search')

Zeile 1589Zeile 1581
		break;

// Unapprove threads - Inline moderation

		break;

// Unapprove threads - Inline moderation

	case "multiunapprovethreads":

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canmanagethreads'))
{
error_no_permission();
}
}
else
{
$threads = getids($fid, 'forum');

	case "multiunapprovethreads":

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canmanagethreads'))
{
error_no_permission();
}
}
else
{
$threads = getids($fid, 'forum');

			if(!is_moderator($fid, 'canmanagethreads'))
{
error_no_permission();
}

			if(!is_moderator($fid, 'canmanagethreads'))
{
error_no_permission();
}

		}

		}

		if(count($threads) < 1)
{
error($lang->error_inline_nothreadsselected);

		if(count($threads) < 1)
{
error($lang->error_inline_nothreadsselected);

		}

		}


$moderation->unapprove_threads($threads, $fid);



$moderation->unapprove_threads($threads, $fid);


Zeile 1632Zeile 1624
		break;

// Stick threads - Inline moderation

		break;

// Stick threads - Inline moderation

	case "multistickthreads":

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canopenclosethreads'))
{
error_no_permission();
}
}
else

	case "multistickthreads":

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canopenclosethreads'))
{
error_no_permission();
}
}
else

		{
$threads = getids($fid, 'forum');
if(!is_moderator($fid, 'canopenclosethreads'))

		{
$threads = getids($fid, 'forum');
if(!is_moderator($fid, 'canopenclosethreads'))

Zeile 1655Zeile 1647
			}
}
if(count($threads) < 1)

			}
}
if(count($threads) < 1)

		{

		{

			error($lang->error_inline_nothreadsselected);

			error($lang->error_inline_nothreadsselected);

		}

$moderation->stick_threads($threads);

		}

$moderation->stick_threads($threads);


log_moderator_action($modlogdata, $lang->multi_stuck_threads);
if($mybb->input['inlinetype'] == 'search')


log_moderator_action($modlogdata, $lang->multi_stuck_threads);
if($mybb->input['inlinetype'] == 'search')

Zeile 1674Zeile 1666
		break;

// Unstick threads - Inline moderaton

		break;

// Unstick threads - Inline moderaton

	case "multiunstickthreads":

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

	case "multiunstickthreads":

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);


if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canopenclosethreads'))


if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canopenclosethreads'))

			{
error_no_permission();
}

			{
error_no_permission();
}

		}
else
{

		}
else
{

Zeile 1695Zeile 1687
			{
error_no_permission();
}

			{
error_no_permission();
}

		}

		}

		if(count($threads) < 1)
{
error($lang->error_inline_nothreadsselected);

		if(count($threads) < 1)
{
error($lang->error_inline_nothreadsselected);

		}


		}


		$moderation->unstick_threads($threads);

log_moderator_action($modlogdata, $lang->multi_unstuck_threads);

		$moderation->unstick_threads($threads);

log_moderator_action($modlogdata, $lang->multi_unstuck_threads);

Zeile 1713Zeile 1705
			clearinline($fid, 'forum');
}
moderation_redirect(get_forum_link($fid), $lang->redirect_inline_threadsunstuck);

			clearinline($fid, 'forum');
}
moderation_redirect(get_forum_link($fid), $lang->redirect_inline_threadsunstuck);

		break;


		break;


	// Move threads - Inline moderation
case "multimovethreads":
add_breadcrumb($lang->nav_multi_movethreads);

	// Move threads - Inline moderation
case "multimovethreads":
add_breadcrumb($lang->nav_multi_movethreads);

		



		if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canmanagethreads'))

		if(!empty($mybb->input['searchid']))
{
// From search page
$threads = getids($mybb->input['searchid'], 'search');
if(!is_moderator_by_tids($threads, 'canmanagethreads'))

			{
error_no_permission();
}
}
else

			{
error_no_permission();
}
}
else

		{
$threads = getids($fid, 'forum');
if(!is_moderator($fid, 'canmanagethreads'))

		{
$threads = getids($fid, 'forum');
if(!is_moderator($fid, 'canmanagethreads'))

Zeile 1736Zeile 1728
				error_no_permission();
}
}

				error_no_permission();
}
}

		



		if(count($threads) < 1)

		if(count($threads) < 1)

		{

		{

			error($lang->error_inline_nothreadsselected);
}
$inlineids = implode("|", $threads);

			error($lang->error_inline_nothreadsselected);
}
$inlineids = implode("|", $threads);

Zeile 1751Zeile 1743
			clearinline($fid, 'forum');
}
$forumselect = build_forum_jump("", '', 1, '', 0, true, '', "moveto");

			clearinline($fid, 'forum');
}
$forumselect = build_forum_jump("", '', 1, '', 0, true, '', "moveto");

		$return_url = htmlspecialchars_uni($mybb->input['url']);

		$return_url = htmlspecialchars_uni($mybb->input['url']);

		eval("\$movethread = \"".$templates->get("moderation_inline_movethreads")."\";");
output_page($movethread);
break;

		eval("\$movethread = \"".$templates->get("moderation_inline_movethreads")."\";");
output_page($movethread);
break;





	// Actually move the threads in Inline moderation
case "do_multimovethreads":

	// Actually move the threads in Inline moderation
case "do_multimovethreads":





		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);





		$moveto = intval($mybb->input['moveto']);
$threadlist = explode("|", $mybb->input['threads']);
if(!is_moderator_by_tids($threadlist, 'canmanagethreads'))

		$moveto = intval($mybb->input['moveto']);
$threadlist = explode("|", $mybb->input['threads']);
if(!is_moderator_by_tids($threadlist, 'canmanagethreads'))

Zeile 1778Zeile 1770
		{
error_no_permission();
}

		{
error_no_permission();
}

		



		$newforum = get_forum($moveto);

		$newforum = get_forum($moveto);

		if($newforum['type'] != "f")

		if(!$newforum || $newforum['type'] != "f" || $newforum['type'] == "f" && $newforum['linkto'] != '')

		{
error($lang->error_invalidforum);
}

		{
error($lang->error_invalidforum);
}

Zeile 1795Zeile 1787
	// Delete posts - Inline moderation
case "multideleteposts":
add_breadcrumb($lang->nav_multi_deleteposts);

	// Delete posts - Inline moderation
case "multideleteposts":
add_breadcrumb($lang->nav_multi_deleteposts);

		



		if($mybb->input['inlinetype'] == 'search')
{
$posts = getids($mybb->input['searchid'], 'search');

		if($mybb->input['inlinetype'] == 'search')
{
$posts = getids($mybb->input['searchid'], 'search');

		}

		}

		else
{
$posts = getids($tid, 'thread');
}

		else
{
$posts = getids($tid, 'thread');
}

		



		if(count($posts) < 1)

		if(count($posts) < 1)

		{

		{

			error($lang->error_inline_nopostsselected);
}
if(!is_moderator_by_pids($posts, "candeleteposts"))

			error($lang->error_inline_nopostsselected);
}
if(!is_moderator_by_pids($posts, "candeleteposts"))

Zeile 1822Zeile 1814
		{
clearinline($tid, 'thread');
}

		{
clearinline($tid, 'thread');
}

		



		$return_url = htmlspecialchars_uni($mybb->input['url']);

		$return_url = htmlspecialchars_uni($mybb->input['url']);

		



		eval("\$multidelete = \"".$templates->get("moderation_inline_deleteposts")."\";");
output_page($multidelete);
break;

		eval("\$multidelete = \"".$templates->get("moderation_inline_deleteposts")."\";");
output_page($multidelete);
break;

Zeile 1834Zeile 1826

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);


// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

		



		$postlist = explode("|", $mybb->input['posts']);
if(!is_moderator_by_pids($postlist, "candeleteposts"))
{

		$postlist = explode("|", $mybb->input['posts']);
if(!is_moderator_by_pids($postlist, "candeleteposts"))
{

Zeile 1842Zeile 1834
		}
$postlist = array_map('intval', $postlist);
$pids = implode(',', $postlist);

		}
$postlist = array_map('intval', $postlist);
$pids = implode(',', $postlist);





		$tids = array();
if($pids)
{

		$tids = array();
if($pids)
{

Zeile 1861Zeile 1853
			$plist[] = $pid;
$deletecount++;
}

			$plist[] = $pid;
$deletecount++;
}

		



		// If we have multiple threads, we must be coming from the search
if(!empty($tids))
{
foreach($tids as $tid)

		// If we have multiple threads, we must be coming from the search
if(!empty($tids))
{
foreach($tids as $tid)

			{
$moderation->delete_thread($tid);
mark_reports($tid, "thread");
$url = get_forum_link($fid);

			{
$moderation->delete_thread($tid);
mark_reports($tid, "thread");
$url = get_forum_link($fid);

			}
}
// Otherwise we're just deleting from showthread.php

			}
}
// Otherwise we're just deleting from showthread.php

		else

		else

		{
$query = $db->simple_select("posts", "*", "tid='$tid'");
$numposts = $db->num_rows($query);

		{
$query = $db->simple_select("posts", "*", "tid='$tid'");
$numposts = $db->num_rows($query);

Zeile 1888Zeile 1880
				mark_reports($plist, "posts");
$url = get_thread_link($thread['tid']);
}

				mark_reports($plist, "posts");
$url = get_thread_link($thread['tid']);
}

		}


		}


		$lang->deleted_selective_posts = $lang->sprintf($lang->deleted_selective_posts, $deletecount);
log_moderator_action($modlogdata, $lang->deleted_selective_posts);
moderation_redirect($url, $lang->redirect_postsdeleted);

		$lang->deleted_selective_posts = $lang->sprintf($lang->deleted_selective_posts, $deletecount);
log_moderator_action($modlogdata, $lang->deleted_selective_posts);
moderation_redirect($url, $lang->redirect_postsdeleted);

Zeile 1898Zeile 1890
	// Merge posts - Inline moderation
case "multimergeposts":
add_breadcrumb($lang->nav_multi_mergeposts);

	// Merge posts - Inline moderation
case "multimergeposts":
add_breadcrumb($lang->nav_multi_mergeposts);

		
if($mybb->input['inlinetype'] == 'search')
{
$posts = getids($mybb->input['searchid'], 'search');
}
else
{
$posts = getids($tid, 'thread');
}



if($mybb->input['inlinetype'] == 'search')
{
$posts = getids($mybb->input['searchid'], 'search');
}
else
{
$posts = getids($tid, 'thread');
}


		// Add the selected posts from other threads
foreach($mybb->cookies as $key => $value)
{

		// Add the selected posts from other threads
foreach($mybb->cookies as $key => $value)
{

Zeile 1917Zeile 1909
				foreach($inlinepostlist as $p)
{
$p = intval($p);

				foreach($inlinepostlist as $p)
{
$p = intval($p);

					



					if(!empty($p))
{
$posts[] = intval($p);

					if(!empty($p))
{
$posts[] = intval($p);

Zeile 1927Zeile 1919
				my_unsetcookie($key);
}
}

				my_unsetcookie($key);
}
}

		



		if(empty($posts))

		if(empty($posts))

		{

		{

			error($lang->error_inline_nopostsselected);
}

			error($lang->error_inline_nopostsselected);
}

		



		if(!is_moderator_by_pids($posts, "canmanagethreads"))
{
error_no_permission();
}

		if(!is_moderator_by_pids($posts, "canmanagethreads"))
{
error_no_permission();
}

		



		$postlist = "";
$query = $db->query("
SELECT p.*, u.*

		$postlist = "";
$query = $db->query("
SELECT p.*, u.*

Zeile 1968Zeile 1960
			eval("\$postlist .= \"".$templates->get("moderation_mergeposts_post")."\";");
$altbg = alt_trow();
}

			eval("\$postlist .= \"".$templates->get("moderation_mergeposts_post")."\";");
$altbg = alt_trow();
}

		



		$inlineids = implode("|", $posts);
if($mybb->input['inlinetype'] == 'search')

		$inlineids = implode("|", $posts);
if($mybb->input['inlinetype'] == 'search')

		{

		{

			clearinline($mybb->input['searchid'], 'search');

			clearinline($mybb->input['searchid'], 'search');

		}

		}

		else
{
clearinline($tid, 'thread');
}

		else
{
clearinline($tid, 'thread');
}

		



		$return_url = htmlspecialchars_uni($mybb->input['url']);

eval("\$multimerge = \"".$templates->get("moderation_inline_mergeposts")."\";");

		$return_url = htmlspecialchars_uni($mybb->input['url']);

eval("\$multimerge = \"".$templates->get("moderation_inline_mergeposts")."\";");

Zeile 2001Zeile 1993
		{
$postlist[] = intval($pid);
}

		{
$postlist[] = intval($pid);
}

		



		if(!is_moderator_by_pids($postlist, "canmanagethreads"))
{
error_no_permission();
}

		if(!is_moderator_by_pids($postlist, "canmanagethreads"))
{
error_no_permission();
}

		



		foreach($postlist as $pid)
{
$pid = intval($pid);

		foreach($postlist as $pid)
{
$pid = intval($pid);

Zeile 2023Zeile 2015
	// Split posts - Inline moderation
case "multisplitposts":
add_breadcrumb($lang->nav_multi_splitposts);

	// Split posts - Inline moderation
case "multisplitposts":
add_breadcrumb($lang->nav_multi_splitposts);

		
if($mybb->input['inlinetype'] == 'search')
{


if($mybb->input['inlinetype'] == 'search')
{

			$posts = getids($mybb->input['searchid'], 'search');

			$posts = getids($mybb->input['searchid'], 'search');

		}
else
{

		}
else
{

			$posts = getids($tid, 'thread');
}

			$posts = getids($tid, 'thread');
}

		



		if(count($posts) < 1)

		if(count($posts) < 1)

		{
error($lang->error_inline_nopostsselected);
}


		{
error($lang->error_inline_nopostsselected);
}


		if(!is_moderator_by_pids($posts, "canmanagethreads"))
{
error_no_permission();
}

		if(!is_moderator_by_pids($posts, "canmanagethreads"))
{
error_no_permission();
}

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






























































































		$posts = array_map('intval', $posts);
$pidin = implode(',', $posts);

// Make sure that we are not splitting a thread with one post
// Select number of posts in each thread that the splitted post is in
$query = $db->query("
SELECT DISTINCT p.tid, COUNT(q.pid) as count
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."posts q ON (p.tid=q.tid)
WHERE p.pid IN ($pidin)
GROUP BY p.tid, p.pid
");
$threads = $pcheck = array();
while($tcheck = $db->fetch_array($query))
{
if(intval($tcheck['count']) <= 1)
{
error($lang->error_cantsplitonepost);
}
$threads[] = $pcheck[] = $tcheck['tid']; // Save tids for below
}

// Make sure that we are not splitting all posts in the thread
// The query does not return a row when the count is 0, so find if some threads are missing (i.e. 0 posts after removal)
$query = $db->query("
SELECT DISTINCT p.tid, COUNT(q.pid) as count
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."posts q ON (p.tid=q.tid)
WHERE p.pid IN ($pidin) AND q.pid NOT IN ($pidin)
GROUP BY p.tid, p.pid
");
$pcheck2 = array();
while($tcheck = $db->fetch_array($query))
{
if($tcheck['count'] > 0)
{
$pcheck2[] = $tcheck['tid'];
}
}
if(count($pcheck2) != count($pcheck))
{
// One or more threads do not have posts after splitting
error($lang->error_cantsplitall);
}

$inlineids = implode("|", $posts);
if($mybb->input['inlinetype'] == 'search')
{
clearinline($mybb->input['searchid'], 'search');
}
else
{
clearinline($tid, 'thread');
}
$forumselect = build_forum_jump("", $fid, 1, '', 0, true, '', "moveto");
eval("\$splitposts = \"".$templates->get("moderation_inline_splitposts")."\";");
output_page($splitposts);
break;

// Actually split the posts - Inline moderation
case "do_multisplitposts":

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

$plist = array();
$postlist = explode("|", $mybb->input['posts']);
foreach($postlist as $pid)
{
$pid = intval($pid);
$plist[] = $pid;
}

if(!is_moderator_by_pids($plist, "canmanagethreads"))
{
error_no_permission();
}

// Ensure all posts exist
$posts = array();
if(!empty($plist))
{
$query = $db->simple_select('posts', 'pid', 'pid IN ('.implode(',', $plist).')');
while($pid = $db->fetch_field($query, 'pid'))
{
$posts[] = $pid;
}
}

if(empty($posts))
{
error($lang->error_inline_nopostsselected);
}


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

// Make sure that we are not splitting a thread with one post

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

// Make sure that we are not splitting a thread with one post

Zeile 2054Zeile 2139
			WHERE p.pid IN ($pidin)
GROUP BY p.tid, p.pid
");

			WHERE p.pid IN ($pidin)
GROUP BY p.tid, p.pid
");

		$threads = $pcheck = array();

		$pcheck = array();

		while($tcheck = $db->fetch_array($query))
{
if(intval($tcheck['count']) <= 1)
{
error($lang->error_cantsplitonepost);

		while($tcheck = $db->fetch_array($query))
{
if(intval($tcheck['count']) <= 1)
{
error($lang->error_cantsplitonepost);

			}
$threads[] = $pcheck[] = $tcheck['tid']; // Save tids for below
}


			}
$pcheck[] = $tcheck['tid']; // Save tids for below
}


		// Make sure that we are not splitting all posts in the thread
// The query does not return a row when the count is 0, so find if some threads are missing (i.e. 0 posts after removal)
$query = $db->query("

		// Make sure that we are not splitting all posts in the thread
// The query does not return a row when the count is 0, so find if some threads are missing (i.e. 0 posts after removal)
$query = $db->query("

Zeile 2075Zeile 2160
		");
$pcheck2 = array();
while($tcheck = $db->fetch_array($query))

		");
$pcheck2 = array();
while($tcheck = $db->fetch_array($query))

		{

		{

			if($tcheck['count'] > 0)
{
$pcheck2[] = $tcheck['tid'];

			if($tcheck['count'] > 0)
{
$pcheck2[] = $tcheck['tid'];

Zeile 2085Zeile 2170
		{
// One or more threads do not have posts after splitting
error($lang->error_cantsplitall);

		{
// One or more threads do not have posts after splitting
error($lang->error_cantsplitall);

		}

$inlineids = implode("|", $posts);
if($mybb->input['inlinetype'] == 'search')
{
clearinline($mybb->input['searchid'], 'search');
}
else
{
clearinline($tid, 'thread');
}
$forumselect = build_forum_jump("", $fid, 1, '', 0, true, '', "moveto");
eval("\$splitposts = \"".$templates->get("moderation_inline_splitposts")."\";");
output_page($splitposts);
break;

		}



















	// Actually split the posts - Inline moderation
case "do_multisplitposts":

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

$postlist = explode("|", $mybb->input['posts']);
foreach($postlist as $pid)
{
$pid = intval($pid);
$plist[] = $pid;
}

if(!is_moderator_by_pids($plist, "canmanagethreads"))
{
error_no_permission();
}


 
		if($mybb->input['moveto'])
{
$moveto = intval($mybb->input['moveto']);

		if($mybb->input['moveto'])
{
$moveto = intval($mybb->input['moveto']);

		}

		}

		else
{
$moveto = $fid;

		else
{
$moveto = $fid;

		}
$query = $db->simple_select("forums", "COUNT(fid) as count", "fid='$moveto'");
if($db->fetch_field($query, 'count') == 0)


		}

$newforum = get_forum($moveto);
if(!$newforum || $newforum['type'] != "f" || $newforum['type'] == "f" && $newforum['linkto'] != '')

		{
error($lang->error_invalidforum);
}

		{
error($lang->error_invalidforum);
}

 


		$newsubject = $mybb->input['newsubject'];

		$newsubject = $mybb->input['newsubject'];

 
		$newtid = $moderation->split_posts($posts, $tid, $moveto, $newsubject);





		$newtid = $moderation->split_posts($plist, $tid, $moveto, $newsubject);

$pid_list = implode(', ', $plist);

		$pid_list = implode(', ', $posts);



		$lang->split_selective_posts = $lang->sprintf($lang->split_selective_posts, $pid_list, $newtid);
log_moderator_action($modlogdata, $lang->split_selective_posts);

moderation_redirect(get_thread_link($newtid), $lang->redirect_threadsplit);

		$lang->split_selective_posts = $lang->sprintf($lang->split_selective_posts, $pid_list, $newtid);
log_moderator_action($modlogdata, $lang->split_selective_posts);

moderation_redirect(get_thread_link($newtid), $lang->redirect_threadsplit);

		break;


		break;


	// Approve posts - Inline moderation
case "multiapproveposts":

	// Approve posts - Inline moderation
case "multiapproveposts":





		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);


if($mybb->input['inlinetype'] == 'search')
{


if($mybb->input['inlinetype'] == 'search')
{

			$posts = getids($mybb->input['searchid'], 'search');

			$posts = getids($mybb->input['searchid'], 'search');

		}
else
{

		}
else
{

			$posts = getids($tid, 'thread');
}
if(count($posts) < 1)

			$posts = getids($tid, 'thread');
}
if(count($posts) < 1)

		{

		{

			error($lang->error_inline_nopostsselected);
}

			error($lang->error_inline_nopostsselected);
}

		



		if(!is_moderator_by_pids($posts, "canmanagethreads"))
{
error_no_permission();

		if(!is_moderator_by_pids($posts, "canmanagethreads"))
{
error_no_permission();

Zeile 2176Zeile 2230
		$moderation->approve_posts($pids);

log_moderator_action($modlogdata, $lang->multi_approve_posts);

		$moderation->approve_posts($pids);

log_moderator_action($modlogdata, $lang->multi_approve_posts);

		if($mybb->input['inlinetype'] == 'search')
{
clearinline($mybb->input['searchid'], 'search');

		if($mybb->input['inlinetype'] == 'search')
{
clearinline($mybb->input['searchid'], 'search');

		}
else
{
clearinline($tid, 'thread');

		}
else
{
clearinline($tid, 'thread');

		}

		}

		moderation_redirect(get_thread_link($thread['tid']), $lang->redirect_inline_postsapproved);
break;


		moderation_redirect(get_thread_link($thread['tid']), $lang->redirect_inline_postsapproved);
break;


Zeile 2192Zeile 2246

// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);


// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

		



		if($mybb->input['inlinetype'] == 'search')
{
$posts = getids($mybb->input['searchid'], 'search');
}
else

		if($mybb->input['inlinetype'] == 'search')
{
$posts = getids($mybb->input['searchid'], 'search');
}
else

		{

		{

			$posts = getids($tid, 'thread');
}

			$posts = getids($tid, 'thread');
}

		



		if(count($posts) < 1)
{
error($lang->error_inline_nopostsselected);
}
$pids = array();

		if(count($posts) < 1)
{
error($lang->error_inline_nopostsselected);
}
$pids = array();

		



		if(!is_moderator_by_pids($posts, "canmanagethreads"))

		if(!is_moderator_by_pids($posts, "canmanagethreads"))

		{

		{

			error_no_permission();
}
foreach($posts as $pid)
{
$pids[] = intval($pid);

			error_no_permission();
}
foreach($posts as $pid)
{
$pids[] = intval($pid);

		}

$moderation->unapprove_posts($pids);


		}

$moderation->unapprove_posts($pids);


		log_moderator_action($modlogdata, $lang->multi_unapprove_posts);
if($mybb->input['inlinetype'] == 'search')
{
clearinline($mybb->input['searchid'], 'search');

		log_moderator_action($modlogdata, $lang->multi_unapprove_posts);
if($mybb->input['inlinetype'] == 'search')
{
clearinline($mybb->input['searchid'], 'search');

		}

		}

		else
{
clearinline($tid, 'thread');

		else
{
clearinline($tid, 'thread');

Zeile 2254Zeile 2308
					error($lang->error_inline_nopostsselected);
}
if(!is_moderator_by_tids($tids))

					error($lang->error_inline_nopostsselected);
}
if(!is_moderator_by_tids($tids))

				{

				{

					error_no_permission();
}

					error_no_permission();
}

				








$thread_options = unserialize($tool['threadoptions']);
if($thread_options['movethread'] && $forum_cache[$thread_options['movethread']]['type'] != "f")
{
error($lang->error_movetocategory);
}


				$custommod->execute(intval($mybb->input['action']), $tids);
$lang->custom_tool = $lang->sprintf($lang->custom_tool, $tool['name']);
log_moderator_action($modlogdata, $lang->custom_tool);
if($mybb->input['inlinetype'] == 'search')

				$custommod->execute(intval($mybb->input['action']), $tids);
$lang->custom_tool = $lang->sprintf($lang->custom_tool, $tool['name']);
log_moderator_action($modlogdata, $lang->custom_tool);
if($mybb->input['inlinetype'] == 'search')

				{

				{

					clearinline($mybb->input['searchid'], 'search');

					clearinline($mybb->input['searchid'], 'search');

					$lang->redirect_customtool_search = $lang->sprintf($lang->redirect_customtool_search, $tool['name']);					

					$lang->redirect_customtool_search = $lang->sprintf($lang->redirect_customtool_search, $tool['name']);

					$return_url = htmlspecialchars_uni($mybb->input['url']);
redirect($return_url, $lang->redirect_customtool_search);
}
else

					$return_url = htmlspecialchars_uni($mybb->input['url']);
redirect($return_url, $lang->redirect_customtool_search);
}
else

				{

				{

					clearinline($fid, "forum");
$lang->redirect_customtool_forum = $lang->sprintf($lang->redirect_customtool_forum, $tool['name']);
redirect(get_forum_link($fid), $lang->redirect_customtool_forum);

					clearinline($fid, "forum");
$lang->redirect_customtool_forum = $lang->sprintf($lang->redirect_customtool_forum, $tool['name']);
redirect(get_forum_link($fid), $lang->redirect_customtool_forum);

Zeile 2282Zeile 2342
				{
error_no_permission();
}

				{
error_no_permission();
}

 

$thread_options = unserialize($tool['threadoptions']);
if($thread_options['movethread'] && $forum_cache[$thread_options['movethread']]['type'] != "f")
{
error($lang->error_movetocategory);
}


				$ret = $custommod->execute(intval($mybb->input['action']), $tid);
$lang->custom_tool = $lang->sprintf($lang->custom_tool, $tool['name']);
log_moderator_action($modlogdata, $lang->custom_tool);

				$ret = $custommod->execute(intval($mybb->input['action']), $tid);
$lang->custom_tool = $lang->sprintf($lang->custom_tool, $tool['name']);
log_moderator_action($modlogdata, $lang->custom_tool);

Zeile 2307Zeile 2374
				{
$pids = getids($tid, 'thread');
}

				{
$pids = getids($tid, 'thread');
}

				



				if(count($pids) < 1)
{
error($lang->error_inline_nopostsselected);

				if(count($pids) < 1)
{
error($lang->error_inline_nopostsselected);

Zeile 2315Zeile 2382
				if(!is_moderator_by_pids($pids))
{
error_no_permission();

				if(!is_moderator_by_pids($pids))
{
error_no_permission();

				}


				}


				// Get threads which are associated with the posts
$tids = array();
$options = array(

				// Get threads which are associated with the posts
$tids = array();
$options = array(

Zeile 2328Zeile 2395
				{
$tids[] = $row['tid'];
}

				{
$tids[] = $row['tid'];
}

				



				$ret = $custommod->execute(intval($mybb->input['action']), $tids, $pids);
$lang->custom_tool = $lang->sprintf($lang->custom_tool, $tool['name']);
log_moderator_action($modlogdata, $lang->custom_tool);

				$ret = $custommod->execute(intval($mybb->input['action']), $tids, $pids);
$lang->custom_tool = $lang->sprintf($lang->custom_tool, $tool['name']);
log_moderator_action($modlogdata, $lang->custom_tool);

Zeile 2353Zeile 2420
						moderation_redirect(get_thread_link($tid), $lang->redirect_customtool_thread);
}
}

						moderation_redirect(get_thread_link($tid), $lang->redirect_customtool_thread);
}
}

				



				break;
}
}

				break;
}
}

Zeile 2365Zeile 2432
function getids($id, $type)
{
global $mybb;

function getids($id, $type)
{
global $mybb;

	
$newids = array();


$newids = array();

	$cookie = "inlinemod_".$type.$id;
$cookie_ids = explode("|", $mybb->cookies[$cookie]);

	$cookie = "inlinemod_".$type.$id;
$cookie_ids = explode("|", $mybb->cookies[$cookie]);

	



	foreach($cookie_ids as $cookie_id)

	foreach($cookie_ids as $cookie_id)

	{

	{

		if(empty($cookie_id))
{
continue;

		if(empty($cookie_id))
{
continue;

		}


		}


		if($cookie_id == 'ALL')
{
$newids += getallids($id, $type);
}
else

		if($cookie_id == 'ALL')
{
$newids += getallids($id, $type);
}
else

		{

		{

			$newids[] = intval($cookie_id);

			$newids[] = intval($cookie_id);

		}
}


		}
}


	return $newids;
}

function getallids($id, $type)
{
global $db, $mybb;

	return $newids;
}

function getallids($id, $type)
{
global $db, $mybb;

	



	$ids = array();

	$ids = array();

	















// Get any removed threads (after our user hit 'all')
$removed_ids = array();
$cookie = "inlinemod_".$type.$id."_removed";
if($mybb->cookies[$cookie])
{
$removed_ids = explode("|", $mybb->cookies[$cookie]);

if(!is_array($removed_ids))
{
$removed_ids = array();
}
}


	// "Select all Threads in this forum" only supported by forumdisplay and search
if($type == 'forum')
{
$query = $db->simple_select("threads", "tid", "fid='".intval($id)."'");
while($tid = $db->fetch_field($query, "tid"))
{

	// "Select all Threads in this forum" only supported by forumdisplay and search
if($type == 'forum')
{
$query = $db->simple_select("threads", "tid", "fid='".intval($id)."'");
while($tid = $db->fetch_field($query, "tid"))
{

 
			if(in_array($tid, $removed_ids))
{
continue;
}


			$ids[] = $tid;
}
}

			$ids[] = $tid;
}
}

Zeile 2416Zeile 2501
		else
{
$ids = explode(',', $searchlog['threads']);

		else
{
$ids = explode(',', $searchlog['threads']);

 
		}

if(is_array($ids))
{
foreach($ids as $key => $tid)
{
if(in_array($tid, $removed_ids))
{
unset($ids[$key]);
}
}

		}
}

		}
}

	
return $ids;
}


return $ids;
}


function clearinline($id, $type)
{
my_unsetcookie("inlinemod_".$type.$id);


function clearinline($id, $type)
{
my_unsetcookie("inlinemod_".$type.$id);

}


	my_unsetcookie("inlinemod_".$type.$id."_removed");
}


function extendinline($id, $type)
{
global $mybb;


function extendinline($id, $type)
{
global $mybb;

	



	my_setcookie("inlinemod_$type$id", '', TIME_NOW+3600);

	my_setcookie("inlinemod_$type$id", '', TIME_NOW+3600);

 
	my_setcookie("inlinemod_$type$id_removed", '', TIME_NOW+3600);

}

/**
* Checks if the current user is a moderator of all the posts specified

}

/**
* Checks if the current user is a moderator of all the posts specified

 * 

 *

 * Note: If no posts are specified, this function will return true.  It is the
* responsibility of the calling script to error-check this case if necessary.

 * Note: If no posts are specified, this function will return true.  It is the
* responsibility of the calling script to error-check this case if necessary.

 * 

 *

 * @param array Array of post IDs
* @param string Permission to check
* @returns bool True if moderator of all; false otherwise

 * @param array Array of post IDs
* @param string Permission to check
* @returns bool True if moderator of all; false otherwise

Zeile 2447Zeile 2545
function is_moderator_by_pids($posts, $permission='')
{
global $db, $mybb;

function is_moderator_by_pids($posts, $permission='')
{
global $db, $mybb;

	



	// Speedy determination for supermods/admins and guests
if($mybb->usergroup['issupermod'])
{
return true;

	// Speedy determination for supermods/admins and guests
if($mybb->usergroup['issupermod'])
{
return true;

	}

	}

	elseif(!$mybb->user['uid'])
{
return false;

	elseif(!$mybb->user['uid'])
{
return false;

Zeile 2461Zeile 2559
	if(!is_array($posts))
{
$posts = array($posts);

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

	}

	}

	// Validate input
$posts = array_map('intval', $posts);
$posts[] = 0;

	// Validate input
$posts = array_map('intval', $posts);
$posts[] = 0;

Zeile 2480Zeile 2578

/**
* Checks if the current user is a moderator of all the threads specified


/**
* Checks if the current user is a moderator of all the threads specified

 * 

 *

 * Note: If no threads are specified, this function will return true.  It is the
* responsibility of the calling script to error-check this case if necessary.

 * Note: If no threads are specified, this function will return true.  It is the
* responsibility of the calling script to error-check this case if necessary.

 * 

 *

 * @param array Array of thread IDs
* @param string Permission to check
* @returns bool True if moderator of all; false otherwise

 * @param array Array of thread IDs
* @param string Permission to check
* @returns bool True if moderator of all; false otherwise

Zeile 2491Zeile 2589
function is_moderator_by_tids($threads, $permission='')
{
global $db, $mybb;

function is_moderator_by_tids($threads, $permission='')
{
global $db, $mybb;

	



	// Speedy determination for supermods/admins and guests
if($mybb->usergroup['issupermod'])
{

	// Speedy determination for supermods/admins and guests
if($mybb->usergroup['issupermod'])
{