Vergleich modcp.php - 1.4.1 - 1.4.8

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * 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: modcp.php 4111 2008-08-13 06:14:12Z Tikitiki $

 * $Id: modcp.php 4308 2009-01-14 03:58:30Z Tikitiki $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 20Zeile 20
$templatelist .= ",codebuttons,smilieinsert,modcp_announcements_new,modcp_modqueue_empty,forumjump_bit,forumjump_special";
$templatelist .= ",modcp_modlogs,modcp_finduser_user,modcp_finduser,usercp_profile_customfield,usercp_profile_profilefields";
$templatelist .= ",modcp_editprofile,modcp_ipsearch,modcp_banuser_addusername,modcp_banuser,modcp_warninglogs_nologs";

$templatelist .= ",codebuttons,smilieinsert,modcp_announcements_new,modcp_modqueue_empty,forumjump_bit,forumjump_special";
$templatelist .= ",modcp_modlogs,modcp_finduser_user,modcp_finduser,usercp_profile_customfield,usercp_profile_profilefields";
$templatelist .= ",modcp_editprofile,modcp_ipsearch,modcp_banuser_addusername,modcp_banuser,modcp_warninglogs_nologs";

$templatelist .= ",modcp_warninglogs";

$templatelist .= ",modcp_warninglogs,modcp_modlogs_result";


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


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

Zeile 50Zeile 50
	while($forum = $db->fetch_array($query))
{
$flist .= ",'{$forum['fid']}'";

	while($forum = $db->fetch_array($query))
{
$flist .= ",'{$forum['fid']}'";

 
		
$children = get_child_list($forum['fid']);
if(!empty($children))
{
$flist .= ",'".implode("','", $children)."'";
}

		$moderated_forums[] = $forum['fid'];
}
if($flist)

		$moderated_forums[] = $forum['fid'];
}
if($flist)

Zeile 65Zeile 71

// Fetch the Mod CP menu
eval("\$modcp_nav = \"".$templates->get("modcp_nav")."\";");


// Fetch the Mod CP menu
eval("\$modcp_nav = \"".$templates->get("modcp_nav")."\";");





$plugins->run_hooks("modcp_start");

// Make navigation
add_breadcrumb($lang->nav_modcp, "modcp.php");

$plugins->run_hooks("modcp_start");

// Make navigation
add_breadcrumb($lang->nav_modcp, "modcp.php");





if($mybb->input['action'] == "do_reports")
{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if($mybb->input['action'] == "do_reports")
{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);





	if(!is_array($mybb->input['reports']))
{
error($lang->error_noselected_reports);
}

	if(!is_array($mybb->input['reports']))
{
error($lang->error_noselected_reports);
}


array_walk($mybb->input['reports'], "intval");


$mybb->input['reports'] = array_map("intval", $mybb->input['reports']);

	$rids = implode($mybb->input['reports'], "','");
$rids = "'0','{$rids}'";


	$rids = implode($mybb->input['reports'], "','");
$rids = "'0','{$rids}'";


Zeile 90Zeile 96
	$db->update_query("reportedposts", array('reportstatus' => 1), "rid IN ({$rids}){$flist}");
$cache->update_reportedposts();
redirect("modcp.php?action=reports", $lang->redirect_reportsmarked);

	$db->update_query("reportedposts", array('reportstatus' => 1), "rid IN ({$rids}){$flist}");
$cache->update_reportedposts();
redirect("modcp.php?action=reports", $lang->redirect_reportsmarked);

}


}


if($mybb->input['action'] == "reports")
{
add_breadcrumb($lang->mcp_nav_reported_posts, "modcp.php?action=reports");

if($mybb->input['action'] == "reports")
{
add_breadcrumb($lang->mcp_nav_reported_posts, "modcp.php?action=reports");





	if(!$mybb->settings['threadsperpage'])
{
$mybb->settings['threadsperpage'] = 20;

	if(!$mybb->settings['threadsperpage'])
{
$mybb->settings['threadsperpage'] = 20;

	}


	}


	// Figure out if we need to display multiple pages.
$perpage = $mybb->settings['threadsperpage'];
if($mybb->input['page'] != "last")
{
$page = intval($mybb->input['page']);

	// Figure out if we need to display multiple pages.
$perpage = $mybb->settings['threadsperpage'];
if($mybb->input['page'] != "last")
{
$page = intval($mybb->input['page']);

	}

	}


$query = $db->simple_select("reportedposts", "COUNT(rid) AS count", "reportstatus ='0'");
$report_count = $db->fetch_field($query, "count");

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


$query = $db->simple_select("reportedposts", "COUNT(rid) AS count", "reportstatus ='0'");
$report_count = $db->fetch_field($query, "count");

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


if($mybb->input['rid'])
{
$query = $db->simple_select("reportedposts", "COUNT(rid) AS count", "rid <= '".$mybb->input['rid']."'");
$result = $db->fetch_field($query, "count");
if(($result % $perpage) == 0)
{
$page = $result / $perpage;
}
else
{
$page = intval($result / $perpage) + 1;
}
}
$postcount = intval($report_count)+1;
$pages = $postcount / $perpage;
$pages = ceil($pages);

if($mybb->input['page'] == "last")

{
$page = $pages;



if($mybb->input['rid'])
{
$query = $db->simple_select("reportedposts", "COUNT(rid) AS count", "rid <= '".$mybb->input['rid']."'");
$result = $db->fetch_field($query, "count");
if(($result % $perpage) == 0)
{
$page = $result / $perpage;
}
else
{
$page = intval($result / $perpage) + 1;
}
}
$postcount = intval($report_count);
$pages = $postcount / $perpage;
$pages = ceil($pages);



if($mybb->input['page'] == "last")
{
$page = $pages;

	}

if($page > $pages || $page <= 0)

	}

if($page > $pages || $page <= 0)

	{
$page = 1;

	{
$page = 1;

	}

if($page && $page > 0)

	}

if($page && $page > 0)

Zeile 173Zeile 180
		LEFT JOIN ".TABLE_PREFIX."users u ON (r.uid=u.uid)
LEFT JOIN ".TABLE_PREFIX."users up ON (p.uid=up.uid)
WHERE r.reportstatus='0'

		LEFT JOIN ".TABLE_PREFIX."users u ON (r.uid=u.uid)
LEFT JOIN ".TABLE_PREFIX."users up ON (p.uid=up.uid)
WHERE r.reportstatus='0'

		ORDER BY r.dateline DESC

		ORDER BY r.dateline DESC

		LIMIT {$start}, {$perpage}
");
while($report = $db->fetch_array($query))

		LIMIT {$start}, {$perpage}
");
while($report = $db->fetch_array($query))

Zeile 214Zeile 221

// Figure out if we need to display multiple pages.
$perpage = $mybb->settings['threadsperpage'];


// Figure out if we need to display multiple pages.
$perpage = $mybb->settings['threadsperpage'];

	if($mybb->input['page'] != "last")

	if($mybb->input['page'] != "last")

	{
$page = intval($mybb->input['page']);
}

	{
$page = intval($mybb->input['page']);
}

Zeile 236Zeile 243
			$page = intval($result / $perpage) + 1;
}
}

			$page = intval($result / $perpage) + 1;
}
}

	$postcount = intval($warnings)+1;

	$postcount = intval($warnings);

	$pages = $postcount / $perpage;
$pages = ceil($pages);


	$pages = $postcount / $perpage;
$pages = ceil($pages);


Zeile 334Zeile 341
	add_breadcrumb($lang->mcp_nav_modlogs, "modcp.php?action=modlogs");

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

	add_breadcrumb($lang->mcp_nav_modlogs, "modcp.php?action=modlogs");

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

	if(!$perpage)

	if(!$perpage || $perpage <= 0)

	{
$perpage = $mybb->settings['threadsperpage'];

	{
$perpage = $mybb->settings['threadsperpage'];

	}


	}


	$where = '';

// Searching for entries by a particular user
if($mybb->input['uid'])
{
$where .= " AND l.uid='".intval($mybb->input['uid'])."'";

	$where = '';

// Searching for entries by a particular user
if($mybb->input['uid'])
{
$where .= " AND l.uid='".intval($mybb->input['uid'])."'";

	}


	}


	// Searching for entries in a specific forum
if($mybb->input['fid'])
{
$where .= " AND t.fid='".intval($mybb->input['fid'])."'";

	// Searching for entries in a specific forum
if($mybb->input['fid'])
{
$where .= " AND t.fid='".intval($mybb->input['fid'])."'";

	}

	}


// Order?
switch($mybb->input['sortby'])


// Order?
switch($mybb->input['sortby'])

Zeile 361Zeile 368
			break;
case "forum":
$sortby = "f.name";

			break;
case "forum":
$sortby = "f.name";

			break;

			break;

		case "thread":
$sortby = "t.subject";
break;

		case "thread":
$sortby = "t.subject";
break;

Zeile 376Zeile 383

$query = $db->query("
SELECT COUNT(l.dateline) AS count


$query = $db->query("
SELECT COUNT(l.dateline) AS count

		FROM ".TABLE_PREFIX."moderatorlog l
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=l.tid)

		FROM ".TABLE_PREFIX."moderatorlog l
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=l.tid)

		WHERE 1=1 {$where}
");
$rescount = $db->fetch_field($query, "count");

		WHERE 1=1 {$where}
");
$rescount = $db->fetch_field($query, "count");

Zeile 387Zeile 394
	if($mybb->input['page'] != "last")
{
$page = intval($mybb->input['page']);

	if($mybb->input['page'] != "last")
{
$page = intval($mybb->input['page']);

	}

	}


$postcount = intval($rescount);
$pages = $postcount / $perpage;
$pages = ceil($pages);


$postcount = intval($rescount);
$pages = $postcount / $perpage;
$pages = ceil($pages);





	if($mybb->input['page'] == "last")
{
$page = $pages;

	if($mybb->input['page'] == "last")
{
$page = $pages;

	}

	}


if($page > $pages || $page <= 0)


if($page > $pages || $page <= 0)

	{
$page = 1;

	{
$page = 1;

	}

if($page)

	}

if($page)

Zeile 413Zeile 420
		$page = 1;
}


		$page = 1;
}


	$multipage = multipage($postcount, $perpage, $page, "modcp.php?action=modlogs&amp;perpage=$perpage&amp;uid={$mybb->input['uid']}&amp;fid={$mybb->input['fid']}&amp;orderby=$mybb->input['sortby']&amp;order={$mybb->input['order']}");

	$multipage = multipage($postcount, $perpage, $page, "modcp.php?action=modlogs&amp;perpage=$perpage&amp;uid={$mybb->input['uid']}&amp;fid={$mybb->input['fid']}&amp;sortby={$mybb->input['sortby']}&amp;order={$mybb->input['order']}");

	if($postcount > $perpage)

	if($postcount > $perpage)

	{

	{

		eval("\$resultspages = \"".$templates->get("modcp_modlogs_multipage")."\";");
}
$query = $db->query("

		eval("\$resultspages = \"".$templates->get("modcp_modlogs_multipage")."\";");
}
$query = $db->query("

Zeile 444Zeile 451
		if($logitem['fname'])
{
$information .= "<strong>{$lang->forum}</strong> <a href=\"".get_forum_link($logitem['fid'])."\" target=\"_blank\">{$logitem['fname']}</a><br />";

		if($logitem['fname'])
{
$information .= "<strong>{$lang->forum}</strong> <a href=\"".get_forum_link($logitem['fid'])."\" target=\"_blank\">{$logitem['fname']}</a><br />";

		}

		}

		if($logitem['psubject'])
{
$information .= "<strong>{$lang->post}</strong> <a href=\"".get_post_link($logitem['pid'])."#pid{$logitem['pid']}\">".htmlspecialchars_uni($logitem['psubject'])."</a>";
}

		if($logitem['psubject'])
{
$information .= "<strong>{$lang->post}</strong> <a href=\"".get_post_link($logitem['pid'])."#pid{$logitem['pid']}\">".htmlspecialchars_uni($logitem['psubject'])."</a>";
}





		eval("\$results .= \"".$templates->get("modcp_modlogs_result")."\";");
}

if(!$results)

		eval("\$results .= \"".$templates->get("modcp_modlogs_result")."\";");
}

if(!$results)

	{

	{

		eval("\$results = \"".$templates->get("modcp_modlogs_noresults")."\";");
}


		eval("\$results = \"".$templates->get("modcp_modlogs_noresults")."\";");
}


Zeile 471Zeile 478
	{
// Deleted Users
if(!$user['username'])

	{
// Deleted Users
if(!$user['username'])

		{

		{

			$user['username'] = $lang->na_deleted;
}


			$user['username'] = $lang->na_deleted;
}


Zeile 483Zeile 490
		$user_options .= "<option value=\"{$user['uid']}\"{$selected}>".htmlspecialchars_uni($user['username'])."</option>\n";
}


		$user_options .= "<option value=\"{$user['uid']}\"{$selected}>".htmlspecialchars_uni($user['username'])."</option>\n";
}


	$forum_select = build_forum_jump("", $mybb->input['fid'], 1, '', 0, '', "fid");

	$forum_select = build_forum_jump("", $mybb->input['fid'], 1, '', 0, true, '', "fid");


eval("\$modlogs = \"".$templates->get("modcp_modlogs")."\";");
output_page($modlogs);
}

if($mybb->input['action'] == "do_delete_announcement")


eval("\$modlogs = \"".$templates->get("modcp_modlogs")."\";");
output_page($modlogs);
}

if($mybb->input['action'] == "do_delete_announcement")

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

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

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

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

	$query = $db->simple_select("announcements", "aid, subject, fid", "aid='{$aid}'");
$announcement = $db->fetch_array($query);


	$query = $db->simple_select("announcements", "aid, subject, fid", "aid='{$aid}'");
$announcement = $db->fetch_array($query);


Zeile 601Zeile 608
		{
$mybb->input['endtime_month'] = 1;
}

		{
$mybb->input['endtime_month'] = 1;
}

		$enddate = gmmktime($enddatehour, intval($mybb->input['endtime_time']), 0, (int)$mybb->input['endtime_month'], intval($mybb->input['endtime_day']), intval($mybb->input['endtime_year']));

		$enddate = gmmktime(intval($enddate[0]), intval($enddate[1]), 0, (int)$mybb->input['endtime_month'], intval($mybb->input['endtime_day']), intval($mybb->input['endtime_year']));

		if($enddate < 0 || $enddate == false)
{
$errors[] = $lang->error_invalid_end_date;

		if($enddate < 0 || $enddate == false)
{
$errors[] = $lang->error_invalid_end_date;

Zeile 609Zeile 616
		elseif($enddate < $startdate)
{
$errors[] = $lang->error_end_before_start;

		elseif($enddate < $startdate)
{
$errors[] = $lang->error_end_before_start;

		}
}

		}
}


if(!$errors)
{


if(!$errors)
{

Zeile 625Zeile 632
			'allowmycode' => $db->escape_string($mybb->input['allowmycode']),
'allowsmilies' => $db->escape_string($mybb->input['allowsmilies']),
);

			'allowmycode' => $db->escape_string($mybb->input['allowmycode']),
'allowsmilies' => $db->escape_string($mybb->input['allowsmilies']),
);





		$aid = $db->insert_query("announcements", $insert_announcement);
redirect("modcp.php?action=announcements", $lang->redirect_add_announcement);
}
else

		$aid = $db->insert_query("announcements", $insert_announcement);
redirect("modcp.php?action=announcements", $lang->redirect_add_announcement);
}
else

	{

	{

		$mybb->input['action'] = 'new_announcement';
}
}

		$mybb->input['action'] = 'new_announcement';
}
}

Zeile 649Zeile 656

// Deal with inline errors
if(is_array($errors))


// Deal with inline errors
if(is_array($errors))

	{

	{

		$errors = inline_error($errors);

// Set $announcement to input stuff

		$errors = inline_error($errors);

// Set $announcement to input stuff

Zeile 663Zeile 670
		if(!in_array($mybb->input['starttime_month'], $months))
{
$mybb->input['starttime_month'] = 1;

		if(!in_array($mybb->input['starttime_month'], $months))
{
$mybb->input['starttime_month'] = 1;

		}


		}


		if(!in_array($mybb->input['endtime_month'], $months))
{
$mybb->input['endtime_month'] = 1;

		if(!in_array($mybb->input['endtime_month'], $months))
{
$mybb->input['endtime_month'] = 1;

		}

		}

		
$startmonth = $mybb->input['starttime_month'];
$startdateyear = htmlspecialchars_uni($mybb->input['starttime_year']);

		
$startmonth = $mybb->input['starttime_month'];
$startdateyear = htmlspecialchars_uni($mybb->input['starttime_year']);

Zeile 678Zeile 685
		$enddateyear = htmlspecialchars_uni($mybb->input['endtime_year']);
$endday = intval($mybb->input['endtime_day']);
$endtime_time = htmlspecialchars($mybb->input['endtime_time']);

		$enddateyear = htmlspecialchars_uni($mybb->input['endtime_year']);
$endday = intval($mybb->input['endtime_day']);
$endtime_time = htmlspecialchars($mybb->input['endtime_time']);

	}

	}

	else
{

	else
{

		// Note: dates are not in user's timezone

		// Note: dates are in GMT timezone

		$starttime_time = gmdate("g:i a", TIME_NOW);
$endtime_time = gmdate("g:i a", TIME_NOW);
$startday = $endday = gmdate("j", TIME_NOW);

		$starttime_time = gmdate("g:i a", TIME_NOW);
$endtime_time = gmdate("g:i a", TIME_NOW);
$startday = $endday = gmdate("j", TIME_NOW);

Zeile 689Zeile 696
		$startdateyear = gmdate("Y", TIME_NOW);

$enddateyear = $startdateyear+1;

		$startdateyear = gmdate("Y", TIME_NOW);

$enddateyear = $startdateyear+1;

	}

// Generate form elements
for($i = 1; $i <= 31; ++$i)
{
if($startday == $i)
{
$startdateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
}
else
{
$startdateday .= "<option value=\"$i\">$i</option>\n";
}

if($endday == $i)
{
$enddateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
}
else

	}

// Generate form elements
for($i = 1; $i <= 31; ++$i)
{
if($startday == $i)
{
$startdateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
}
else
{
$startdateday .= "<option value=\"$i\">$i</option>\n";
}

if($endday == $i)
{
$enddateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
}
else

		{
$enddateday .= "<option value=\"$i\">$i</option>\n";
}

		{
$enddateday .= "<option value=\"$i\">$i</option>\n";
}

Zeile 747Zeile 754

$html_sel = $mycode_sel = $smilies_sel = array();
if($mybb->input['allowhtml'] || !isset($mybb->input['allowhtml']))


$html_sel = $mycode_sel = $smilies_sel = array();
if($mybb->input['allowhtml'] || !isset($mybb->input['allowhtml']))

	{
$html_sel['yes'] = ' checked="checked"';

	{
$html_sel['yes'] = ' checked="checked"';

	}
else
{
$html_sel['no'] = ' checked="checked"';

	}
else
{
$html_sel['no'] = ' checked="checked"';

	}


	}


	if($mybb->input['allowmycode'] || !isset($mybb->input['allowmycode']))
{
$mycode_sel['yes'] = ' checked="checked"';

	if($mybb->input['allowmycode'] || !isset($mybb->input['allowmycode']))
{
$mycode_sel['yes'] = ' checked="checked"';

	}
else

	}
else

	{
$mycode_sel['no'] = ' checked="checked"';
}

	{
$mycode_sel['no'] = ' checked="checked"';
}

Zeile 767Zeile 774
	if($mybb->input['allowsmilies'] || !isset($mybb->input['allowsmilies']))
{
$smilies_sel['yes'] = ' checked="checked"';

	if($mybb->input['allowsmilies'] || !isset($mybb->input['allowsmilies']))
{
$smilies_sel['yes'] = ' checked="checked"';

	}
else
{

	}
else
{

		$smilies_sel['no'] = ' checked="checked"';
}

if($mybb->input['endtime_type'] == 2 || !isset($mybb->input['endtime_type']))

		$smilies_sel['no'] = ' checked="checked"';
}

if($mybb->input['endtime_type'] == 2 || !isset($mybb->input['endtime_type']))

	{

	{

		$end_type_sel['infinite'] = ' checked="checked"';
}
else

		$end_type_sel['infinite'] = ' checked="checked"';
}
else

Zeile 788Zeile 795

eval("\$announcements = \"".$templates->get("modcp_announcements_new")."\";");
output_page($announcements);


eval("\$announcements = \"".$templates->get("modcp_announcements_new")."\";");
output_page($announcements);

}


}


if($mybb->input['action'] == "do_edit_announcement")
{
verify_post_check($mybb->input['my_post_key']);

if($mybb->input['action'] == "do_edit_announcement")
{
verify_post_check($mybb->input['my_post_key']);

Zeile 803Zeile 810
	if(!$announcement['aid'])
{
error($lang->error_invalid_announcement);

	if(!$announcement['aid'])
{
error($lang->error_invalid_announcement);

	}


	}


	// Mod has permissions to edit this announcement
if(($mybb->usergroup['issupermod'] != 1 && $announcement['fid'] == -1) || ($announcement['fid'] != -1 && !is_moderator($announcement['fid'])))
{
error_no_permission();

	// Mod has permissions to edit this announcement
if(($mybb->usergroup['issupermod'] != 1 && $announcement['fid'] == -1) || ($announcement['fid'] != -1 && !is_moderator($announcement['fid'])))
{
error_no_permission();

	}

	}


// Basic error checking
if(!trim($mybb->input['title']))


// Basic error checking
if(!trim($mybb->input['title']))

Zeile 827Zeile 834
		$errors[] = $lang->error_missing_forum;
}


		$errors[] = $lang->error_missing_forum;
}


	$months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');			
if(!in_array($mybb->input['starttime_month'], $months))
























	$startdate = @explode(" ", $mybb->input['starttime_time']);
$startdate = @explode(":", $startdate[0]);
$enddate = @explode(" ", $mybb->input['endtime_time']);
$enddate = @explode(":", $enddate[0]);

if(stristr($mybb->input['starttime_time'], "pm"))
{
$startdate[0] = 12+$startdate[0];
if($startdate[0] >= 24)
{
$startdate[0] = "00";
}
}

if(stristr($mybb->input['endtime_time'], "pm"))
{
$enddate[0] = 12+$enddate[0];
if($enddate[0] >= 24)
{
$enddate[0] = "00";
}
}

$months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
if(!in_array($mybb->input['starttime_month'], $months))

	{
$mybb->input['starttime_month'] = 1;
}

	{
$mybb->input['starttime_month'] = 1;
}

Zeile 849Zeile 879
		{
$mybb->input['endtime_month'] = 1;
}

		{
$mybb->input['endtime_month'] = 1;
}

		$enddate = gmmktime($enddatehour, intval($mybb->input['endtime_time']), 0, (int)$mybb->input['endtime_month'], intval($mybb->input['endtime_day']), intval($mybb->input['endtime_year']));

		$enddate = gmmktime(intval($enddate[0]), intval($enddate[1]), 0, (int)$mybb->input['endtime_month'], intval($mybb->input['endtime_day']), intval($mybb->input['endtime_year']));

		if($enddate < 0 || $enddate == false)
{
$errors[] = $lang->error_invalid_end_date;

		if($enddate < 0 || $enddate == false)
{
$errors[] = $lang->error_invalid_end_date;

Zeile 940Zeile 970
	}
else
{

	}
else
{

		// Note: dates are in user's timezone
$starttime_time = my_date('g:i a', $announcement['startdate']);
$endtime_time = my_date('g:i a', $announcement['enddate']);

		// Note: dates are in GMT timezone
$starttime_time = gmdate('g:i a', $announcement['startdate']);
$endtime_time = gmdate('g:i a', $announcement['enddate']);





		$startday = my_date('j', $announcement['startdate']);
$endday = my_date('j', $announcement['enddate']);

		$startday = gmdate('j', $announcement['startdate']);
$endday = gmdate('j', $announcement['enddate']);





		$startmonth = my_date('m', $announcement['startdate']);
$endmonth = my_date('m', $announcement['enddate']);

		$startmonth = gmdate('m', $announcement['startdate']);
$endmonth = gmdate('m', $announcement['enddate']);





		$startdateyear = my_date('Y', $announcement['startdate']);
$enddateyear = my_date('Y', $announcement['enddate']);

		$startdateyear = gmdate('Y', $announcement['startdate']);
$enddateyear = gmdate('Y', $announcement['enddate']);


$errored = false;
}


$errored = false;
}

Zeile 1041Zeile 1071
	if(($errored && $mybb->input['endtime_type'] == 2) || (!$errored && intval($announcement['enddate']) == 0))
{
$end_type_sel['infinite'] = ' checked="checked"';

	if(($errored && $mybb->input['endtime_type'] == 2) || (!$errored && intval($announcement['enddate']) == 0))
{
$end_type_sel['infinite'] = ' checked="checked"';

	}
else

	}
else

	{
$end_type_sel['finite'] = ' checked="checked"';
}

	{
$end_type_sel['finite'] = ' checked="checked"';
}

Zeile 1124Zeile 1154

// 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_array($mybb->input['threads']))
{
// Fetch threads

	if(is_array($mybb->input['threads']))
{
// Fetch threads

Zeile 1139Zeile 1169
			else if($action == "delete")
{
$moderation->delete_thread($thread['tid']);

			else if($action == "delete")
{
$moderation->delete_thread($thread['tid']);

			}

			}

		}
if(is_array($threads_to_approve))
{

		}
if(is_array($threads_to_approve))
{

Zeile 1164Zeile 1194
			}
}
if(is_array($posts_to_approve))

			}
}
if(is_array($posts_to_approve))

		{

		{

			$moderation->approve_posts($posts_to_approve);
}
redirect("modcp.php?action=modqueue&type=posts", $lang->redirect_postsmoderated);
}
else if(is_array($mybb->input['attachments']))

			$moderation->approve_posts($posts_to_approve);
}
redirect("modcp.php?action=modqueue&type=posts", $lang->redirect_postsmoderated);
}
else if(is_array($mybb->input['attachments']))

	{
$query = $db->simple_select("attachments", "aid, pid", "aid IN (".implode(",", array_map("intval", array_keys($mybb->input['attachments'])))."){$flist}");







	{
$query = $db->query("
SELECT a.pid, a.aid
FROM ".TABLE_PREFIX."attachments a
LEFT JOIN ".TABLE_PREFIX."posts p ON (a.pid=p.pid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE aid IN (".implode(",", array_map("intval", array_keys($mybb->input['attachments'])))."){$tflist}
");

		while($attachment = $db->fetch_array($query))
{
$action = $mybb->input['attachments'][$attachment['aid']];
if($action == "approve")

		while($attachment = $db->fetch_array($query))
{
$action = $mybb->input['attachments'][$attachment['aid']];
if($action == "approve")

			{

			{

				$db->update_query("attachments", array("visible" => 1), "aid='{$attachment['aid']}'");
}
else if($action == "delete")

				$db->update_query("attachments", array("visible" => 1), "aid='{$attachment['aid']}'");
}
else if($action == "delete")

Zeile 1196Zeile 1232

$query = $db->simple_select("threads", "COUNT(tid) AS unapprovedthreads", "visible=0 {$flist}");
$unapproved_threads = $db->fetch_field($query, "unapprovedthreads");


$query = $db->simple_select("threads", "COUNT(tid) AS unapprovedthreads", "visible=0 {$flist}");
$unapproved_threads = $db->fetch_field($query, "unapprovedthreads");





		// Figure out if we need to display multiple pages.
if($mybb->input['page'] != "last")
{

		// Figure out if we need to display multiple pages.
if($mybb->input['page'] != "last")
{

Zeile 1205Zeile 1241

$perpage = $mybb->settings['threadsperpage'];
$pages = $unapproved_threads / $perpage;


$perpage = $mybb->settings['threadsperpage'];
$pages = $unapproved_threads / $perpage;

		$pages = ceil($pages);


		$pages = ceil($pages);


		if($mybb->input['page'] == "last")
{
$page = $pages;

		if($mybb->input['page'] == "last")
{
$page = $pages;

Zeile 1227Zeile 1263
			$page = 1;
}


			$page = 1;
}


		$multipage = multipage($postcount, $perpage, $page, "modcp.php?action=modqueue&amp;type=threads");

		$multipage = multipage($pages, $perpage, $page, "modcp.php?action=modqueue&amp;type=threads");


$query = $db->query("
SELECT t.tid, t.dateline, t.fid, t.subject, p.message AS postmessage, u.username AS username, t.uid


$query = $db->query("
SELECT t.tid, t.dateline, t.fid, t.subject, p.message AS postmessage, u.username AS username, t.uid

Zeile 1288Zeile 1324

$perpage = $mybb->settings['postsperpage'];
$pages = $unapproved_posts / $perpage;


$perpage = $mybb->settings['postsperpage'];
$pages = $unapproved_posts / $perpage;

		$pages = ceil($pages);

		$pages = ceil($pages);


if($mybb->input['page'] == "last")
{


if($mybb->input['page'] == "last")
{

Zeile 1310Zeile 1346
			$page = 1;
}


			$page = 1;
}


		$multipage = multipage($postcount, $perpage, $page, "modcp.php?action=modqueue&amp;type=posts");

		$multipage = multipage($pages, $perpage, $page, "modcp.php?action=modqueue&amp;type=posts");


$query = $db->query("
SELECT p.pid, p.subject, p.message, t.subject AS threadsubject, t.tid, u.username, p.uid, t.fid, p.dateline


$query = $db->query("
SELECT p.pid, p.subject, p.message, t.subject AS threadsubject, t.tid, u.username, p.uid, t.fid, p.dateline

Zeile 1370Zeile 1406
		}

$perpage = $mybb->settings['postsperpage'];

		}

$perpage = $mybb->settings['postsperpage'];

		$pages = $unapprovedthreads / $perpage;
$pages = ceil($pages);

		$pages = $unapproved_attachments / $perpage;
$pages = ceil($pages);


if($mybb->input['page'] == "last")
{


if($mybb->input['page'] == "last")
{

Zeile 1393Zeile 1429
			$page = 1;
}


			$page = 1;
}


		$multipage = multipage($postcount, $perpage, $page, "modcp.php?action=modqueue&amp;type=attachments");

		$multipage = multipage($pages, $perpage, $page, "modcp.php?action=modqueue&amp;type=attachments");


$query = $db->query("
SELECT a.*, p.subject AS postsubject, p.dateline, p.uid, u.username, t.tid, t.subject AS threadsubject


$query = $db->query("
SELECT a.*, p.subject AS postsubject, p.dateline, p.uid, u.username, t.tid, t.subject AS threadsubject

Zeile 1472Zeile 1508
		error_no_permission();
}
// Current user is a super mod or is an administrator and the user we are editing is a super admin, cannot edit admins

		error_no_permission();
}
// Current user is a super mod or is an administrator and the user we are editing is a super admin, cannot edit admins

	else if($mybb->usergroup['issupermod'] == 1 && $user_permissions['cancp'] == 1 || (is_super_admin($user['uid']) && !is_super_admin($user['uid'])))

	else if(!modcp_can_manage_user($user['uid']))

	{
error_no_permission();
}

	{
error_no_permission();
}

Zeile 1561Zeile 1597
		error_no_permission();
}
// Current user is a super mod or is an administrator and the user we are editing is a super admin, cannot edit admins

		error_no_permission();
}
// Current user is a super mod or is an administrator and the user we are editing is a super admin, cannot edit admins

	else if($mybb->usergroup['issupermod'] == 1 && $user_permissions['cancp'] == 1 || (is_super_admin($user['uid']) && !is_super_admin($user['uid'])))

	else if(!modcp_can_manage_user($user['uid']))

	{
error_no_permission();
}

	{
error_no_permission();
}

Zeile 1769Zeile 1805
		else
{
$value = htmlspecialchars_uni($userfield);

		else
{
$value = htmlspecialchars_uni($userfield);

			$code = "<input type=\"text\" name=\"profile_fields[$field]\" class=\"textbox\" size=\"{$profilefield['length']}\" maxlength=\"{$profilefield['maxlength']}\" value=\"$value\" />";






			$maxlength = "";
if($profilefield['maxlength'] > 0)
{
$maxlength = " maxlength=\"{$profilefield['maxlength']}\"";
}
$code = "<input type=\"text\" name=\"profile_fields[$field]\" class=\"textbox\" size=\"{$profilefield['length']}\"{$maxlength} value=\"$value\" />";

		}
if($profilefield['required'] == 1)
{

		}
if($profilefield['required'] == 1)
{

Zeile 1803Zeile 1844

if($mybb->input['action'] == "finduser")
{


if($mybb->input['action'] == "finduser")
{

	if(!$perpage)


	$perpage = intval($mybb->input['perpage']);
if(!$perpage || $perpage <= 0)

	{
$perpage = $mybb->settings['threadsperpage'];

	{
$perpage = $mybb->settings['threadsperpage'];

	}

	}

	$where = '';

if($mybb->input['username'])
{
$where = " AND LOWER(username) LIKE '%".my_strtolower($db->escape_string_like($mybb->input['username']))."%'";

	$where = '';

if($mybb->input['username'])
{
$where = " AND LOWER(username) LIKE '%".my_strtolower($db->escape_string_like($mybb->input['username']))."%'";

	}


	}


	// Sort order & direction
switch($mybb->input['sortby'])

	// Sort order & direction
switch($mybb->input['sortby'])

	{

	{

		case "lastvisit":
$sortby = "lastvisit";

		case "lastvisit":
$sortby = "lastvisit";

			break;

			break;

		case "postnum":
$sortby = "postnum";
break;

		case "postnum":
$sortby = "postnum";
break;

Zeile 1830Zeile 1872
			$sortby = "regdate";
}
$order = $mybb->input['order'];

			$sortby = "regdate";
}
$order = $mybb->input['order'];

	if($order != "asc")
{
$order = "desc";
}


	if($order != "asc")
{
$order = "desc";
}


	$query = $db->simple_select("users", "COUNT(uid) AS count", "1=1 {$where}");
$user_count = $db->fetch_field($query, "count");


	$query = $db->simple_select("users", "COUNT(uid) AS count", "1=1 {$where}");
$user_count = $db->fetch_field($query, "count");


Zeile 1872Zeile 1914
		if($mybb->input[$field])
{
$page_url .= "&amp;{$field}=".htmlspecialchars_uni($mybb->input[$field]);

		if($mybb->input[$field])
{
$page_url .= "&amp;{$field}=".htmlspecialchars_uni($mybb->input[$field]);

 
			$mybb->input[$field] = htmlspecialchars_uni($mybb->input[$field]);

		}
}


		}
}


Zeile 1888Zeile 1931
		$user['postnum'] = my_number_format($user['postnum']);
$regdate = my_date($mybb->settings['dateformat'], $user['regdate']);
$regtime = my_date($mybb->settings['timeformat'], $user['regdate']);

		$user['postnum'] = my_number_format($user['postnum']);
$regdate = my_date($mybb->settings['dateformat'], $user['regdate']);
$regtime = my_date($mybb->settings['timeformat'], $user['regdate']);

		$lastdate = my_date($mybb->settings['dateformat'], $user['lastactive']);
$lasttime = my_date($mybb->settings['timeformat'], $user['lastactive']);

		$lastdate = my_date($mybb->settings['dateformat'], $user['lastvisit']);
$lasttime = my_date($mybb->settings['timeformat'], $user['lastvisit']);

		$usergroup = $usergroups_cache[$user['usergroup']]['title'];
eval("\$users .= \"".$templates->get("modcp_finduser_user")."\";");
}

		$usergroup = $usergroups_cache[$user['usergroup']]['title'];
eval("\$users .= \"".$templates->get("modcp_finduser_user")."\";");
}

Zeile 1915Zeile 1958
		$search['username'] = $db->escape_string($mybb->input['filter']['username']);
$query = $db->simple_select("users", "uid", "username='{$search['username']}'");
$mybb->input['filter']['uid'] = $db->fetch_field($query, "uid");

		$search['username'] = $db->escape_string($mybb->input['filter']['username']);
$query = $db->simple_select("users", "uid", "username='{$search['username']}'");
$mybb->input['filter']['uid'] = $db->fetch_field($query, "uid");

 
		$mybb->input['filter']['username'] = htmlspecialchars_uni($mybb->input['filter']['username']);

	}
if($mybb->input['filter']['uid'])
{

	}
if($mybb->input['filter']['uid'])
{

Zeile 1923Zeile 1967
		if(!isset($mybb->input['search']['username']))
{
$user = get_user($mybb->input['search']['uid']);

		if(!isset($mybb->input['search']['username']))
{
$user = get_user($mybb->input['search']['uid']);

			$mybb->input['search']['username'] = $user['username'];

			$mybb->input['search']['username'] = htmlspecialchars_uni($user['username']);

		}
}
if($mybb->input['filter']['mod_username'])

		}
}
if($mybb->input['filter']['mod_username'])

Zeile 1931Zeile 1975
		$search['mod_username'] = $db->escape_string($mybb->input['filter']['mod_username']);
$query = $db->simple_select("users", "uid", "username='{$search['mod_username']}'");
$mybb->input['filter']['mod_uid'] = $db->fetch_field($query, "uid");

		$search['mod_username'] = $db->escape_string($mybb->input['filter']['mod_username']);
$query = $db->simple_select("users", "uid", "username='{$search['mod_username']}'");
$mybb->input['filter']['mod_uid'] = $db->fetch_field($query, "uid");

 
		$mybb->input['filter']['mod_username'] = htmlspecialchars_uni($mybb->input['filter']['mod_username']);

	}
if($mybb->input['filter']['mod_uid'])

	}
if($mybb->input['filter']['mod_uid'])

	{

	{

		$search['mod_uid'] = intval($mybb->input['filter']['mod_uid']);
$where_sql .= " AND w.issuedby='{$search['mod_uid']}'";
if(!isset($mybb->input['search']['mod_username']))
{
$mod_user = get_user($mybb->input['search']['uid']);

		$search['mod_uid'] = intval($mybb->input['filter']['mod_uid']);
$where_sql .= " AND w.issuedby='{$search['mod_uid']}'";
if(!isset($mybb->input['search']['mod_username']))
{
$mod_user = get_user($mybb->input['search']['uid']);

			$mybb->input['search']['mod_username'] = $mod_user['username'];

			$mybb->input['search']['mod_username'] = htmlspecialchars_uni($mod_user['username']);

		}
}
if($mybb->input['filter']['reason'])
{
$search['reason'] = $db->escape_string($mybb->input['filter']['reason']);
$where_sql .= " AND (w.notes LIKE '%{$search['reason']}%' OR t.title LIKE '%{$search['reason']}%' OR w.title LIKE '%{$search['reason']}%')";

		}
}
if($mybb->input['filter']['reason'])
{
$search['reason'] = $db->escape_string($mybb->input['filter']['reason']);
$where_sql .= " AND (w.notes LIKE '%{$search['reason']}%' OR t.title LIKE '%{$search['reason']}%' OR w.title LIKE '%{$search['reason']}%')";

 
		$mybb->input['filter']['reason'] = htmlspecialchars_uni($mybb->input['filter']['reason']);

	}
$sortbysel = array();
switch($mybb->input['filter']['sortby'])

	}
$sortbysel = array();
switch($mybb->input['filter']['sortby'])

Zeile 1998Zeile 2044
	if(isset($mybb->input['filter']['per_page']) && intval($mybb->input['filter']['per_page']) > 0)
{
$per_page = intval($mybb->input['filter']['per_page']);

	if(isset($mybb->input['filter']['per_page']) && intval($mybb->input['filter']['per_page']) > 0)
{
$per_page = intval($mybb->input['filter']['per_page']);

	}

	}

	$start = ($page-1) * $per_page;
// Build the base URL for pagination links
$url = 'modcp.php?action=warninglogs';

	$start = ($page-1) * $per_page;
// Build the base URL for pagination links
$url = 'modcp.php?action=warninglogs';

Zeile 2029Zeile 2075
		LIMIT {$start}, {$per_page}
";
$query = $db->query($sql);

		LIMIT {$start}, {$per_page}
";
$query = $db->query($sql);







	$warning_list = '';
while($row = $db->fetch_array($query))
{

	$warning_list = '';
while($row = $db->fetch_array($query))
{

Zeile 2051Zeile 2097
			$expire_date = my_date($mybb->settings['dateformat'], $row['expires']).' '.my_date($mybb->settings['timeformat'], $row['expires']);
}
else

			$expire_date = my_date($mybb->settings['dateformat'], $row['expires']).' '.my_date($mybb->settings['timeformat'], $row['expires']);
}
else

		{

		{

			$expire_date = $lang->never;
}
$title = $row['title'];
if(empty($row['title']))

			$expire_date = $lang->never;
}
$title = $row['title'];
if(empty($row['title']))

		{

		{

			$title = $row['custom_title'];
}
$title = htmlspecialchars_uni($title);

			$title = $row['custom_title'];
}
$title = htmlspecialchars_uni($title);

Zeile 2071Zeile 2117
	if(!$warning_list)
{
eval("\$warning_list = \"".$templates->get("modcp_warninglogs_nologs")."\";");

	if(!$warning_list)
{
eval("\$warning_list = \"".$templates->get("modcp_warninglogs_nologs")."\";");

	}

	}


eval("\$warninglogs = \"".$templates->get("modcp_warninglogs")."\";");
output_page($warninglogs);


eval("\$warninglogs = \"".$templates->get("modcp_warninglogs")."\";");
output_page($warninglogs);

Zeile 2087Zeile 2133
		{
$groupscache = $cache->read("usergroups");
}

		{
$groupscache = $cache->read("usergroups");
}





		$ipaddressvalue = htmlspecialchars_uni($mybb->input['ipaddress']);

// Searching post IP addresses

		$ipaddressvalue = htmlspecialchars_uni($mybb->input['ipaddress']);

// Searching post IP addresses

Zeile 2097Zeile 2143
			if(strpos($mybb->input['ipaddress'], ":") !== false)
{
$post_ip_sql = "ipaddress LIKE '".$db->escape_string(str_replace("*", "%", $mybb->input['ipaddress']))."'";

			if(strpos($mybb->input['ipaddress'], ":") !== false)
{
$post_ip_sql = "ipaddress LIKE '".$db->escape_string(str_replace("*", "%", $mybb->input['ipaddress']))."'";

			}

			}

			else
{
$ip_range = fetch_longipv4_range($mybb->input['ipaddress']);
if(!is_array($ip_range))

			else
{
$ip_range = fetch_longipv4_range($mybb->input['ipaddress']);
if(!is_array($ip_range))

				{

				{

					$post_ip_sql = "longipaddress='{$ip_range}'";
}
else

					$post_ip_sql = "longipaddress='{$ip_range}'";
}
else

Zeile 2112Zeile 2158
			}
$query = $db->query("
SELECT COUNT(pid) AS count

			}
$query = $db->query("
SELECT COUNT(pid) AS count

				FROM ".TABLE_PREFIX."posts

				FROM ".TABLE_PREFIX."posts

				WHERE {$post_ip_sql}
");
$post_results = $db->fetch_field($query, "count");

				WHERE {$post_ip_sql}
");
$post_results = $db->fetch_field($query, "count");

		}


		}


		// Searching user IP addresses
if($mybb->input['search_users'])
{

		// Searching user IP addresses
if($mybb->input['search_users'])
{

Zeile 2132Zeile 2178
				if(!is_array($ip_range))
{
$user_ip_sql = "longregip='{$ip_range}' OR longlastip='{$ip_range}'";

				if(!is_array($ip_range))
{
$user_ip_sql = "longregip='{$ip_range}' OR longlastip='{$ip_range}'";

				}

				}

				else
{
$user_ip_sql = "(longregip > '{$ip_range[0]}' AND longregip < '{$ip_range[1]}') OR (longlastip > '{$ip_range[0]}' AND longlastip < '{$ip_range[1]}')";

				else
{
$user_ip_sql = "(longregip > '{$ip_range[0]}' AND longregip < '{$ip_range[1]}') OR (longlastip > '{$ip_range[0]}' AND longlastip < '{$ip_range[1]}')";

Zeile 2150Zeile 2196

// Now we have the result counts, paginate
$perpage = intval($mybb->input['perpage']);


// Now we have the result counts, paginate
$perpage = intval($mybb->input['perpage']);

		if(!$perpage)

		if(!$perpage || $perpage <= 0)

		{
$perpage = $mybb->settings['threadsperpage'];

		{
$perpage = $mybb->settings['threadsperpage'];

		}

		}


// Figure out if we need to display multiple pages.
if($mybb->input['page'] != "last")


// Figure out if we need to display multiple pages.
if($mybb->input['page'] != "last")

		{

		{

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


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


Zeile 2167Zeile 2213
		if($mybb->input['page'] == "last")
{
$page = $pages;

		if($mybb->input['page'] == "last")
{
$page = $pages;

		}

		}


if($page > $pages || $page <= 0)


if($page > $pages || $page <= 0)

		{
$page = 1;
}

		{
$page = 1;
}


if($page)
{
$start = ($page-1) * $perpage;


if($page)
{
$start = ($page-1) * $perpage;

		}

		}

		else
{
$start = 0;
$page = 1;

		else
{
$start = 0;
$page = 1;

		}

		}





		$page_url = "modcp.php?action=ipsearch&amp;perpage={$perpage}&amp;ipaddress={$mybb->input['ipaddress']}";

		$page_url = "modcp.php?action=ipsearch&amp;perpage={$perpage}";

		foreach(array('ipaddress', 'search_users', 'search_posts') as $input)
{
if(!$mybb->input[$input]) continue;

		foreach(array('ipaddress', 'search_users', 'search_posts') as $input)
{
if(!$mybb->input[$input]) continue;

Zeile 2194Zeile 2240

$post_limit = $perpage;
if($mybb->input['search_users'] && $start <= $user_results)


$post_limit = $perpage;
if($mybb->input['search_users'] && $start <= $user_results)

		{
$query = $db->query("

		{
$query = $db->query("

				SELECT username, uid, regip, lastip
FROM ".TABLE_PREFIX."users
WHERE {$user_ip_sql}

				SELECT username, uid, regip, lastip
FROM ".TABLE_PREFIX."users
WHERE {$user_ip_sql}

Zeile 2210Zeile 2256
				$regexp_ip = str_replace("\*", "(.*)", preg_quote($mybb->input['ipaddress'], "#"));
// Reg IP matches
if(preg_match("#{$regexp_ip}#i", $ipaddress['regip']))

				$regexp_ip = str_replace("\*", "(.*)", preg_quote($mybb->input['ipaddress'], "#"));
// Reg IP matches
if(preg_match("#{$regexp_ip}#i", $ipaddress['regip']))

				{

				{

					$ip = $ipaddress['regip'];
$subject = "<strong>{$lang->ipresult_regip}</strong> {$profile_link}";

					$ip = $ipaddress['regip'];
$subject = "<strong>{$lang->ipresult_regip}</strong> {$profile_link}";

					eval("\$results .= \"".$templates->get("modcp_ipsearch_result")."\";");
$result = true;
}

					eval("\$results .= \"".$templates->get("modcp_ipsearch_result")."\";");
$result = true;
}

				// Last known IP matches
if(preg_match("#{$regexp_ip}#i", $ipaddress['lastip']))
{

				// Last known IP matches
if(preg_match("#{$regexp_ip}#i", $ipaddress['lastip']))
{

Zeile 2235Zeile 2281
		if($total_results > $user_results && $post_limit)
{
$post_start = $start-$user_results;

		if($total_results > $user_results && $post_limit)
{
$post_start = $start-$user_results;

			if($post_start < 0) $post_start = 0;




			if($post_start < 0)
{
$post_start = 0;
}

		}
if($mybb->input['search_posts'] && (!$mybb->input['search_users'] || ($mybb->input['search_users'] && $post_limit > 0)))
{

		}
if($mybb->input['search_posts'] && (!$mybb->input['search_users'] || ($mybb->input['search_users'] && $post_limit > 0)))
{

 
			$ipaddresses = $tids = $uids = array();

			$query = $db->query("

			$query = $db->query("

				SELECT p.username AS postusername, p.uid, u.username, p.subject, p.pid, p.tid, p.ipaddress, t.subject AS threadsubject
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON(p.uid=u.uid)

				SELECT username AS postusername, uid, subject, pid, tid, ipaddress
FROM ".TABLE_PREFIX."posts



				WHERE {$post_ip_sql}

				WHERE {$post_ip_sql}

				ORDER BY p.dateline DESC

				ORDER BY dateline DESC

				LIMIT {$post_start}, {$post_limit}
");
while($ipaddress = $db->fetch_array($query))
{

				LIMIT {$post_start}, {$post_limit}
");
while($ipaddress = $db->fetch_array($query))
{

				$ip = $ipaddress['ipaddress'];
if(!$ipaddress['username']) $ipaddress['username'] = $ipaddress['postusername']; // Guest username support
$trow = alt_trow();
if(!$ipaddress['subject'])






				$tids[$ipaddress['tid']] = $ipaddress['pid'];
$uids[$ipaddress['uid']] = $ipaddress['pid'];
$ipaddresses[$ipaddress['pid']] = $ipaddress;
}

if(!empty($ipaddresses))
{
$query = $db->simple_select("threads", "subject, tid", "tid IN(".implode(',', array_keys($tids)).")");
while($thread = $db->fetch_array($query))

				{

				{

					$ipaddress['subject'] = "RE: {$ipaddress['threadsubject']}";






















					$ipaddresses[$tids[$thread['tid']]]['threadsubject'] = $thread['subject'];
}
unset($tids);

$query = $db->simple_select("users", "username, uid", "uid IN(".implode(',', array_keys($uids)).")");
while($user = $db->fetch_array($query))
{
$ipaddresses[$uids[$user['uid']]]['username'] = $user['username'];
}
unset($uids);

foreach($ipaddresses as $ipaddress)
{
$ip = $ipaddress['ipaddress'];
if(!$ipaddress['username']) $ipaddress['username'] = $ipaddress['postusername']; // Guest username support
$trow = alt_trow();
if(!$ipaddress['subject'])
{
$ipaddress['subject'] = "RE: {$ipaddress['threadsubject']}";
}
$subject = "<strong>{$lang->ipresult_post}</strong> <a href=\"".get_post_link($ipaddress['pid'], $ipaddress['tid'])."\">".htmlspecialchars_uni($ipaddress['subject'])."</a> {$lang->by} ".build_profile_link($ipaddress['username'], $ipaddress['uid']);
eval("\$results .= \"".$templates->get("modcp_ipsearch_result")."\";");

				}

				}

				$subject = "<strong>{$lang->ipresult_post}</strong> <a href=\"".get_post_link($ipaddress['pid'], $ipaddress['tid'])."\">".htmlspecialchars_uni($ipaddress['subject'])."</a> by ".build_profile_link($ipaddress['username'], $ipaddress['uid']);
eval("\$results .= \"".$templates->get("modcp_ipsearch_result")."\";");

 
			}

			}

		}

		}


if(!$results)
{
eval("\$results = \"".$templates->get("modcp_ipsearch_noresults")."\";");


if(!$results)
{
eval("\$results = \"".$templates->get("modcp_ipsearch_noresults")."\";");

		}

		}


if($ipaddressvalue)
{


if($ipaddressvalue)
{

Zeile 2288Zeile 2360
	if($mybb->input['search_posts'])
{
$postsearchselect = "checked=\"checked\"";

	if($mybb->input['search_posts'])
{
$postsearchselect = "checked=\"checked\"";

	}

	}

	if($mybb->input['search_users'])
{
$usersearchselect = "checked=\"checked\"";

	if($mybb->input['search_users'])
{
$usersearchselect = "checked=\"checked\"";

	}


	}


	eval("\$ipsearch = \"".$templates->get("modcp_ipsearch")."\";");
output_page($ipsearch);
}

	eval("\$ipsearch = \"".$templates->get("modcp_ipsearch")."\";");
output_page($ipsearch);
}





if($mybb->input['action'] == "banning")
{
add_breadcrumb($lang->mcp_nav_banning, "modcp.php?action=banning");

if($mybb->input['action'] == "banning")
{
add_breadcrumb($lang->mcp_nav_banning, "modcp.php?action=banning");

Zeile 2305Zeile 2377
	if(!$mybb->settings['threadsperpage'])
{
$mybb->settings['threadsperpage'] = 20;

	if(!$mybb->settings['threadsperpage'])
{
$mybb->settings['threadsperpage'] = 20;

	}


	}


	// Figure out if we need to display multiple pages.
$perpage = $mybb->settings['threadsperpage'];
if($mybb->input['page'] != "last")

	// Figure out if we need to display multiple pages.
$perpage = $mybb->settings['threadsperpage'];
if($mybb->input['page'] != "last")

Zeile 2316Zeile 2388

$query = $db->simple_select("banned", "COUNT(uid) AS count");
$banned_count = $db->fetch_field($query, "count");


$query = $db->simple_select("banned", "COUNT(uid) AS count");
$banned_count = $db->fetch_field($query, "count");


$postcount = intval($banned_count)+1;


$postcount = intval($banned_count);

	$pages = $postcount / $perpage;
$pages = ceil($pages);

if($mybb->input['page'] == "last")

	$pages = $postcount / $perpage;
$pages = ceil($pages);

if($mybb->input['page'] == "last")

	{

	{

		$page = $pages;
}


		$page = $pages;
}


	if($page > $pages || $page <= 0)
{
$page = 1;
}


	if($page > $pages || $page <= 0)
{
$page = 1;
}


	if($page)
{
$start = ($page-1) * $perpage;

	if($page)
{
$start = ($page-1) * $perpage;

Zeile 2367Zeile 2439
		if($mybb->user['uid'] == $banned['admin'] || !$banned['adminuser'] || $mybb->usergroup['issupermod'] == 1 || $mybb->usergroup['cancp'] == 1)
{
$edit_link = "<br /><span class=\"smalltext\"><a href=\"modcp.php?action=banuser&amp;uid={$banned['uid']}\">{$lang->edit_ban}</a> | <a href=\"modcp.php?action=liftban&amp;uid={$banned['uid']}&amp;my_post_key={$mybb->post_code}\">{$lang->lift_ban}</a></span>";

		if($mybb->user['uid'] == $banned['admin'] || !$banned['adminuser'] || $mybb->usergroup['issupermod'] == 1 || $mybb->usergroup['cancp'] == 1)
{
$edit_link = "<br /><span class=\"smalltext\"><a href=\"modcp.php?action=banuser&amp;uid={$banned['uid']}\">{$lang->edit_ban}</a> | <a href=\"modcp.php?action=liftban&amp;uid={$banned['uid']}&amp;my_post_key={$mybb->post_code}\">{$lang->lift_ban}</a></span>";

		}

$admin_profile = build_profile_link($banned['adminuser'], $banned['admin']);


		}

$admin_profile = build_profile_link($banned['adminuser'], $banned['admin']);


		$trow = alt_trow();

if($banned['reason'])
{
$banned['reason'] = htmlspecialchars_uni($parser->parse_badwords($banned['reason']));

		$trow = alt_trow();

if($banned['reason'])
{
$banned['reason'] = htmlspecialchars_uni($parser->parse_badwords($banned['reason']));

		}

		}

		else
{
$banned['reason'] = $lang->na;

		else
{
$banned['reason'] = $lang->na;

		}


		}


		if($banned['lifted'] == 'perm' || $banned['lifted'] == '' || $banned['bantime'] == 'perm' || $banned['bantime'] == '---')
{
$banlength = $lang->permanent;

		if($banned['lifted'] == 'perm' || $banned['lifted'] == '' || $banned['bantime'] == 'perm' || $banned['bantime'] == '---')
{
$banlength = $lang->permanent;

Zeile 2391Zeile 2463
		{
$banlength = $bantimes[$banned['bantime']];
$remaining = $banned['lifted']-TIME_NOW;

		{
$banlength = $bantimes[$banned['bantime']];
$remaining = $banned['lifted']-TIME_NOW;





			$timeremaining = nice_time($remaining, array('short' => 1, 'seconds' => false))."";

if($remaining < 3600)

			$timeremaining = nice_time($remaining, array('short' => 1, 'seconds' => false))."";

if($remaining < 3600)

Zeile 2401Zeile 2473
			else if($remaining < 86400)
{
$timeremaining = "<span style=\"color: maroon;\">({$timeremaining} {$lang->ban_remaining})</span>";

			else if($remaining < 86400)
{
$timeremaining = "<span style=\"color: maroon;\">({$timeremaining} {$lang->ban_remaining})</span>";

			}

			}

			else if($remaining < 604800)
{
$timeremaining = "<span style=\"color: green;\">({$timeremaining} {$lang->ban_remaining})</span>";

			else if($remaining < 604800)
{
$timeremaining = "<span style=\"color: green;\">({$timeremaining} {$lang->ban_remaining})</span>";

Zeile 2410Zeile 2482
			{
$timeremaining = "({$timeremaining} {$lang->ban_remaining})";
}

			{
$timeremaining = "({$timeremaining} {$lang->ban_remaining})";
}

		}


		}


		eval("\$bannedusers .= \"".$templates->get("modcp_banning_ban")."\";");
}

if(!$bannedusers)

		eval("\$bannedusers .= \"".$templates->get("modcp_banning_ban")."\";");
}

if(!$bannedusers)

	{

	{

		eval("\$bannedusers = \"".$templates->get("modcp_banning_nobanned")."\";");

		eval("\$bannedusers = \"".$templates->get("modcp_banning_nobanned")."\";");

	}

$plugins->run_hooks("modcp_banning");


	}

$plugins->run_hooks("modcp_banning");


	eval("\$bannedpage = \"".$templates->get("modcp_banning")."\";");
output_page($bannedpage);
}

	eval("\$bannedpage = \"".$templates->get("modcp_banning")."\";");
output_page($bannedpage);
}

Zeile 2435Zeile 2507
	$ban = $db->fetch_array($query);

if(!$ban['uid'])

	$ban = $db->fetch_array($query);

if(!$ban['uid'])

	{
$lang->error_invalidban;
}

	{
error($lang->error_invalidban);
}


// Permission to edit this ban?
if($mybb->user['uid'] != $ban['admin'] && $mybb->usergroup['issupermod'] != 1 && $mybb->usergroup['cancp'] != 1)


// Permission to edit this ban?
if($mybb->user['uid'] != $ban['admin'] && $mybb->usergroup['issupermod'] != 1 && $mybb->usergroup['cancp'] != 1)

Zeile 2452Zeile 2524
	);
$db->update_query("users", $updated_group, "uid='{$ban['uid']}'");
$db->delete_query("banned", "uid='{$ban['uid']}'");

	);
$db->update_query("users", $updated_group, "uid='{$ban['uid']}'");
$db->delete_query("banned", "uid='{$ban['uid']}'");





	$cache->update_banned();
$cache->update_moderators();


	$cache->update_banned();
$cache->update_moderators();


Zeile 2485Zeile 2557
		{
error_no_permission();
}

		{
error_no_permission();
}

		
$lift_link = "<div class=\"float_right\"><a href=\"modcp.php?action=liftban&amp;bid={$user['uid']}&amp;my_post_key={$mybb->post_code}\">{$lang->lift_ban}</a></div>";

 
	}
// Creating a new ban
else

	}
// Creating a new ban
else

Zeile 2575Zeile 2645
			);

$db->insert_query('banned', $insert_array);

			);

$db->insert_query('banned', $insert_array);

		}

		}


// Move the user to the banned group
$update_array = array(


// Move the user to the banned group
$update_array = array(

Zeile 2584Zeile 2654
			'additionalgroups' => '',
);
$db->update_query('users', $update_array, "uid = {$user['uid']}");

			'additionalgroups' => '',
);
$db->update_query('users', $update_array, "uid = {$user['uid']}");





		$cache->update_banned();

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

		$cache->update_banned();

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

Zeile 2614Zeile 2684
	else
{
add_breadcrumb($lang->mcp_nav_editing_ban);

	else
{
add_breadcrumb($lang->mcp_nav_editing_ban);

	}


	}


	// If incoming user ID, we are editing a ban
if($mybb->input['uid'])
{
$query = $db->query("

	// If incoming user ID, we are editing a ban
if($mybb->input['uid'])
{
$query = $db->query("

			SELECT b.*, u.username

			SELECT b.*, u.username, u.uid

			FROM ".TABLE_PREFIX."banned b
LEFT JOIN ".TABLE_PREFIX."users u ON (b.uid=u.uid)
WHERE b.uid='{$mybb->input['uid']}'

			FROM ".TABLE_PREFIX."banned b
LEFT JOIN ".TABLE_PREFIX."users u ON (b.uid=u.uid)
WHERE b.uid='{$mybb->input['uid']}'

Zeile 2631Zeile 2701
			$username = htmlspecialchars_uni($banned['username']);
$banreason = htmlspecialchars_uni($banned['reason']);
$uid = $mybb->input['uid'];

			$username = htmlspecialchars_uni($banned['username']);
$banreason = htmlspecialchars_uni($banned['reason']);
$uid = $mybb->input['uid'];

 
			$user = get_user($banned['uid']);

			$lang->ban_user = $lang->edit_ban; // Swap over lang variables
eval("\$banuser_username = \"".$templates->get("modcp_banuser_editusername")."\";");
}
}

			$lang->ban_user = $lang->edit_ban; // Swap over lang variables
eval("\$banuser_username = \"".$templates->get("modcp_banuser_editusername")."\";");
}
}

 
	

	// New ban!

	// New ban!

	if(!$banuer_username)

	if(!$banuser_username)

	{
if($mybb->input['uid'])
{

	{
if($mybb->input['uid'])
{

Zeile 2680Zeile 2752
			$liftlist .= ">{$title} ({$thatime})</option>\n";
}
}

			$liftlist .= ">{$title} ({$thatime})</option>\n";
}
}



	

	$bangroups = '';
$query = $db->simple_select("usergroups", "gid, title", "isbannedgroup=1");
while($item = $db->fetch_array($query))

	$bangroups = '';
$query = $db->simple_select("usergroups", "gid, title", "isbannedgroup=1");
while($item = $db->fetch_array($query))

Zeile 2692Zeile 2764
		}
$bangroups .= "<option value=\"{$item['gid']}\"{$selected}>".htmlspecialchars_uni($item['title'])."</option>\n";
}

		}
$bangroups .= "<option value=\"{$item['gid']}\"{$selected}>".htmlspecialchars_uni($item['title'])."</option>\n";
}

 
	
$lift_link = "<div class=\"float_right\"><a href=\"modcp.php?action=liftban&amp;uid={$user['uid']}&amp;my_post_key={$mybb->post_code}\">{$lang->lift_ban}</a></div>";


eval("\$banuser = \"".$templates->get("modcp_banuser")."\";");
output_page($banuser);


eval("\$banuser = \"".$templates->get("modcp_banuser")."\";");
output_page($banuser);

Zeile 2699Zeile 2773

if($mybb->input['action'] == "do_modnotes")
{


if($mybb->input['action'] == "do_modnotes")
{

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


	// Update Moderator Notes cache
$update_cache = array(
"modmessage" => $mybb->input['modnotes']

	// Update Moderator Notes cache
$update_cache = array(
"modmessage" => $mybb->input['modnotes']

Zeile 2722Zeile 2799
	if($unapproved_attachments > 0)
{
$query = $db->query("

	if($unapproved_attachments > 0)
{
$query = $db->query("

			SELECT t.tid, p.pid, t.uid, t.username, a.filename, a.dateuploaded

			SELECT t.tid, p.pid, p.uid, t.username, a.filename, a.dateuploaded

			FROM  ".TABLE_PREFIX."attachments a
LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=a.pid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

			FROM  ".TABLE_PREFIX."attachments a
LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=a.pid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

Zeile 2755Zeile 2832
	if($unapproved_posts > 0)
{
$query = $db->query("

	if($unapproved_posts > 0)
{
$query = $db->query("

			SELECT p.pid, p.tid, p.subject, p.uid, p.username

			SELECT p.pid, p.tid, p.subject, p.uid, p.username, p.dateline

			FROM  ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE p.visible='0' {$tflist} AND t.firstpost != p.pid

			FROM  ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE p.visible='0' {$tflist} AND t.firstpost != p.pid

Zeile 2770Zeile 2847
		$post['subject'] = $post['fullsubject'] = $parser->parse_badwords($post['subject']);
if(my_strlen($post['subject']) > 25)
{

		$post['subject'] = $post['fullsubject'] = $parser->parse_badwords($post['subject']);
if(my_strlen($post['subject']) > 25)
{

			$lastpost_subject = my_substr($post['subject'], 0, 25)."...";

			$post['subject'] = my_substr($post['subject'], 0, 25)."...";

		}
$post['subject'] = htmlspecialchars_uni($post['subject']);
$post['fullsubject'] = htmlspecialchars_uni($post['fullsubject']);

		}
$post['subject'] = htmlspecialchars_uni($post['subject']);
$post['fullsubject'] = htmlspecialchars_uni($post['fullsubject']);

Zeile 2796Zeile 2873
		$thread['subject'] = $thread['fullsubject'] = $parser->parse_badwords($thread['subject']);
if(my_strlen($thread['subject']) > 25)
{

		$thread['subject'] = $thread['fullsubject'] = $parser->parse_badwords($thread['subject']);
if(my_strlen($thread['subject']) > 25)
{

			$lastpost_subject = my_substr($thread['subject'], 0, 25)."...";

			$post['subject'] = my_substr($thread['subject'], 0, 25)."...";

		}
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$thread['fullsubject'] = htmlspecialchars_uni($thread['fullsubject']);

		}
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$thread['fullsubject'] = htmlspecialchars_uni($thread['fullsubject']);