Vergleich warnings.php - 1.8.1 - 1.8.8

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 11
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'warnings.php');


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


$templatelist = "warnings,warnings_warn_post,warnings_active_header,warnings_expired_header,warnings_warning,warnings_warn_existing,warnings_warn_type,warnings_warn_custom,warnings_warn_pm";
$templatelist .= ",warnings_view_post,warnings_view_user,warnings_view_revoke,warnings_view_revoked,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert,warnings_warn_type_result";
$templatelist .= ",multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start,warnings_no_warnings,codebuttons,warnings_warn,warnings_view,warnings_warn_pm_anonymous";

$templatelist = "warnings,warnings_warn_post,warnings_active_header,warnings_expired_header,warnings_warning,warnings_warn_existing,warnings_warn_type,warnings_warn_custom,warnings_warn_pm,warnings_view";
$templatelist .= ",warnings_view_post,warnings_view_user,warnings_view_revoke,warnings_view_revoked,warnings_warn_type_result,warnings_postlink,codebuttons,warnings_warn,warnings_warn_pm_anonymous";
$templatelist .= ",multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start,warnings_no_warnings";


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


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

Zeile 49Zeile 49
		error_no_permission();
}


		error_no_permission();
}


	$user = get_user($mybb->get_input('uid', 1));

	$user = get_user($mybb->get_input('uid', MyBB::INPUT_INT));


if(!$user['uid'])
{


if(!$user['uid'])
{

Zeile 71Zeile 71
	$plugins->run_hooks("warnings_do_warn_start");

$warning = array(

	$plugins->run_hooks("warnings_do_warn_start");

$warning = array(

		'uid' => $mybb->get_input('uid', 1),

		'uid' => $mybb->get_input('uid', MyBB::INPUT_INT),

		'notes' => $mybb->get_input('notes'),
'type' => $mybb->get_input('type'),
'custom_reason' => $mybb->get_input('custom_reason'),

		'notes' => $mybb->get_input('notes'),
'type' => $mybb->get_input('type'),
'custom_reason' => $mybb->get_input('custom_reason'),

		'custom_points' => $mybb->get_input('custom_points', 1),
'expires' => $mybb->get_input('expires', 1),

		'custom_points' => $mybb->get_input('custom_points', MyBB::INPUT_INT),
'expires' => $mybb->get_input('expires', MyBB::INPUT_INT),

		'expires_period' => $mybb->get_input('expires_period')
);

// Is this warning being given for a post?

		'expires_period' => $mybb->get_input('expires_period')
);

// Is this warning being given for a post?

	if($mybb->get_input('pid', 1))

	if($mybb->get_input('pid', MyBB::INPUT_INT))

	{

	{

		$warning['pid'] = $mybb->get_input('pid', 1);

		$warning['pid'] = $mybb->get_input('pid', MyBB::INPUT_INT);


$post = get_post($warning['pid']);



$post = get_post($warning['pid']);


Zeile 102Zeile 102
		$warninginfo = $warningshandler->insert_warning();

// Are we notifying the user?

		$warninginfo = $warningshandler->insert_warning();

// Are we notifying the user?

		if($mybb->get_input('send_pm', 1) == 1 && $group_permissions['canusepms'] != 0 && $mybb->settings['enablepms'] != 0)

		if($mybb->get_input('send_pm', MyBB::INPUT_INT) == 1 && $group_permissions['canusepms'] != 0 && $mybb->settings['enablepms'] != 0)

		{

$pm = array(

		{

$pm = array(

Zeile 112Zeile 112
			);

$sender_uid = $mybb->user['uid'];

			);

$sender_uid = $mybb->user['uid'];

			if($mybb->settings['allowanonwarningpms'] == 1 && $mybb->get_input('pm_anonymous', 1))

			if($mybb->settings['allowanonwarningpms'] == 1 && $mybb->get_input('pm_anonymous', MyBB::INPUT_INT))

			{
$sender_uid = -1;
}

			{
$sender_uid = -1;
}

Zeile 161Zeile 161
		$given_today = $db->fetch_field($query, "given_today");
if($given_today >= $mybb->usergroup['maxwarningsday'])
{

		$given_today = $db->fetch_field($query, "given_today");
if($given_today >= $mybb->usergroup['maxwarningsday'])
{

			error($lang->sprintf($lang->reached_max_warnings_day, $mybb->usergroup['maxwarningsday']));

			error($lang->sprintf($lang->warnings_reached_max_warnings_day, $mybb->usergroup['maxwarningsday']));

		}
}


		}
}


	$user = get_user($mybb->get_input('uid', 1));

	$user = get_user($mybb->get_input('uid', MyBB::INPUT_INT));

	if(!$user)
{
error($lang->error_invalid_user);

	if(!$user)
{
error($lang->error_invalid_user);

Zeile 173Zeile 173

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


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

		error($lang->cannot_warn_self);

		error($lang->warnings_error_cannot_warn_self);

	}

if($user['warningpoints'] >= $mybb->settings['maxwarningpoints'])
{

	}

if($user['warningpoints'] >= $mybb->settings['maxwarningpoints'])
{

		error($lang->user_reached_max_warning);

		error($lang->warnings_error_user_reached_max_warning);

	}

$group_permissions = user_permissions($user['uid']);

	}

$group_permissions = user_permissions($user['uid']);

Zeile 196Zeile 196
	$post = $existing_warnings = '';

// Giving a warning for a specific post

	$post = $existing_warnings = '';

// Giving a warning for a specific post

	if($mybb->get_input('pid', 1))

	if($mybb->get_input('pid', MyBB::INPUT_INT))

	{

	{

		$post = get_post($mybb->get_input('pid', 1));

		$post = get_post($mybb->get_input('pid', MyBB::INPUT_INT));


if($post)
{


if($post)
{

Zeile 207Zeile 207

if(!$post || !$thread)
{


if(!$post || !$thread)
{

			error($lang->error_invalid_post);

			error($lang->warnings_error_invalid_post);

		}

$forum_permissions = forum_permissions($thread['fid']);

		}

$forum_permissions = forum_permissions($thread['fid']);

Zeile 227Zeile 227
			FROM ".TABLE_PREFIX."warnings w
LEFT JOIN ".TABLE_PREFIX."warningtypes t ON (t.tid=w.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=w.issuedby)

			FROM ".TABLE_PREFIX."warnings w
LEFT JOIN ".TABLE_PREFIX."warningtypes t ON (t.tid=w.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=w.issuedby)

			WHERE w.pid='".$mybb->get_input('pid', 1)."'

			WHERE w.pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'

			ORDER BY w.expired ASC, w.dateline DESC
");
$first = true;

			ORDER BY w.expired ASC, w.dateline DESC
");
$first = true;

Zeile 249Zeile 249
			$first = false;

$post_link = "";

			$first = false;

$post_link = "";

 
			$warning['username'] = htmlspecialchars_uni($warning['username']);

			$issuedby = build_profile_link($warning['username'], $warning['issuedby']);
$date_issued = my_date('relative', $warning['dateline']);
if($warning['type_title'])

			$issuedby = build_profile_link($warning['username'], $warning['issuedby']);
$date_issued = my_date('relative', $warning['dateline']);
if($warning['type_title'])

Zeile 304Zeile 305
	$send_pm_checked = '';

// Coming here from failed do_warn?

	$send_pm_checked = '';

// Coming here from failed do_warn?

 
	$user['username'] = htmlspecialchars_uni($user['username']);

	if(!empty($warn_errors))
{
$notes = htmlspecialchars_uni($mybb->get_input('notes'));

	if(!empty($warn_errors))
{
$notes = htmlspecialchars_uni($mybb->get_input('notes'));

		if($mybb->get_input('type', 1))

		if($mybb->get_input('type', MyBB::INPUT_INT))

		{

		{

			$type_checked[$mybb->get_input('type', 1)] = "checked=\"checked\"";

			$type_checked[$mybb->get_input('type', MyBB::INPUT_INT)] = "checked=\"checked\"";

		}
$pm_subject = htmlspecialchars_uni($mybb->get_input('pm_subject'));
$message = htmlspecialchars_uni($mybb->get_input('pm_message'));

		}
$pm_subject = htmlspecialchars_uni($mybb->get_input('pm_subject'));
$message = htmlspecialchars_uni($mybb->get_input('pm_message'));

Zeile 318Zeile 320
			$send_pm_checked = "checked=\"checked\"";
}
$custom_reason = htmlspecialchars_uni($mybb->get_input('custom_reason'));

			$send_pm_checked = "checked=\"checked\"";
}
$custom_reason = htmlspecialchars_uni($mybb->get_input('custom_reason'));

		$custom_points = $mybb->get_input('custom_points', 1);
$expires = $mybb->get_input('expires', 1);
if($mybb->get_input('expires_period', 1))

		$custom_points = $mybb->get_input('custom_points', MyBB::INPUT_INT);
$expires = $mybb->get_input('expires', MyBB::INPUT_INT);
if($mybb->get_input('expires_period', MyBB::INPUT_INT))

		{

		{

			$expires_period[$mybb->get_input('expires_period', 1)] = "selected=\"selected\"";

			$expires_period[$mybb->get_input('expires_period', MyBB::INPUT_INT)] = "selected=\"selected\"";

		}
}
else

		}
}
else

Zeile 340Zeile 342
	add_breadcrumb($lang->nav_add_warning);

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

	add_breadcrumb($lang->nav_add_warning);

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

 

if($mybb->settings['maxwarningpoints'] < 1)
{
$mybb->settings['maxwarningpoints'] = 10;
}

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


$current_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100);



$current_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100);


Zeile 451Zeile 463
		}

eval("\$custom_warning = \"".$templates->get("warnings_warn_custom")."\";");

		}

eval("\$custom_warning = \"".$templates->get("warnings_warn_custom")."\";");

	}


	}


	$pm_notify = '';

if($group_permissions['canusepms'] != 0 && $mybb->user['receivepms'] != 0 && $mybb->settings['enablepms'] != 0)

	$pm_notify = '';

if($group_permissions['canusepms'] != 0 && $mybb->user['receivepms'] != 0 && $mybb->settings['enablepms'] != 0)

	{

	{

		$smilieinserter = $codebuttons = "";

if($mybb->settings['bbcodeinserter'] != 0 && $mybb->settings['pmsallowmycode'] != 0 && $mybb->user['showcodebuttons'] != 0)

		$smilieinserter = $codebuttons = "";

if($mybb->settings['bbcodeinserter'] != 0 && $mybb->settings['pmsallowmycode'] != 0 && $mybb->user['showcodebuttons'] != 0)

Zeile 465Zeile 477
			if($mybb->settings['pmsallowsmilies'] != 0)
{
$smilieinserter = build_clickable_smilies();

			if($mybb->settings['pmsallowsmilies'] != 0)
{
$smilieinserter = build_clickable_smilies();

			}
}


			}
}


		$anonymous_pm = '';
if($mybb->settings['allowanonwarningpms'] == 1)
{
$checked = '';

		$anonymous_pm = '';
if($mybb->settings['allowanonwarningpms'] == 1)
{
$checked = '';

			if($mybb->get_input('pm_anonymous', 1))

			if($mybb->get_input('pm_anonymous', MyBB::INPUT_INT))

			{
$checked = ' checked="checked"';
}

			{
$checked = ' checked="checked"';
}

Zeile 484Zeile 496
	}

$plugins->run_hooks("warnings_warn_end");

	}

$plugins->run_hooks("warnings_warn_end");





	eval("\$warn = \"".$templates->get("warnings_warn")."\";");
output_page($warn);
exit;
}

	eval("\$warn = \"".$templates->get("warnings_warn")."\";");
output_page($warn);
exit;
}





// Revoke a warning
if($mybb->input['action'] == "do_revoke" && $mybb->request_method == "post")
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

// Revoke a warning
if($mybb->input['action'] == "do_revoke" && $mybb->request_method == "post")
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


if($mybb->usergroup['canwarnusers'] != 1)
{
error_no_permission();
}

$warning = $warningshandler->get($mybb->input['wid']);

if(!$warning)
{
error($lang->error_invalid_warning);
}
else if($warning['daterevoked'])
{


if($mybb->usergroup['canwarnusers'] != 1)
{
error_no_permission();
}

$warning = $warningshandler->get($mybb->input['wid']);

if(!$warning)
{
error($lang->error_invalid_warning);
}
else if($warning['daterevoked'])
{

		error($lang->warning_already_revoked);
}


		error($lang->warning_already_revoked);
}


Zeile 529Zeile 541
		$mybb->input['action'] = "view";
}
else

		$mybb->input['action'] = "view";
}
else

	{

	{

		$warning_data = array(
'wid' => $warning['wid'],
'reason' => $mybb->get_input('reason'),

		$warning_data = array(
'wid' => $warning['wid'],
'reason' => $mybb->get_input('reason'),

Zeile 543Zeile 555
		$warningshandler->update_warning();

redirect("warnings.php?action=view&wid={$warning['wid']}", $lang->redirect_warning_revoked);

		$warningshandler->update_warning();

redirect("warnings.php?action=view&wid={$warning['wid']}", $lang->redirect_warning_revoked);

	}

	}

}

// Detailed view of a warning

}

// Detailed view of a warning

Zeile 560Zeile 572
		LEFT JOIN ".TABLE_PREFIX."warningtypes t ON (t.tid=w.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=w.issuedby)
LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=w.pid)

		LEFT JOIN ".TABLE_PREFIX."warningtypes t ON (t.tid=w.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=w.issuedby)
LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=w.pid)

		WHERE w.wid='".$mybb->get_input('wid', 1)."'

		WHERE w.wid='".$mybb->get_input('wid', MyBB::INPUT_INT)."'

	");
$warning = $db->fetch_array($query);

if(!$warning)

	");
$warning = $db->fetch_array($query);

if(!$warning)

	{

	{

		error($lang->error_invalid_warning);
}


		error($lang->error_invalid_warning);
}


Zeile 574Zeile 586
	{
$user['username'] = $lang->guest;
}

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

 
	$user['username'] = htmlspecialchars_uni($user['username']);


$group_permissions = user_permissions($user['uid']);
if($group_permissions['canreceivewarnings'] != 1)


$group_permissions = user_permissions($user['uid']);
if($group_permissions['canreceivewarnings'] != 1)

Zeile 611Zeile 624
		eval("\$warning_info = \"".$templates->get("warnings_view_user")."\";");
}


		eval("\$warning_info = \"".$templates->get("warnings_view_user")."\";");
}


 
	$warning['username'] = htmlspecialchars_uni($warning['username']);

	$issuedby = build_profile_link($warning['username'], $warning['issuedby']);
$notes = nl2br(htmlspecialchars_uni($warning['notes']));


	$issuedby = build_profile_link($warning['username'], $warning['issuedby']);
$notes = nl2br(htmlspecialchars_uni($warning['notes']));


Zeile 673Zeile 687
		{
$revoked_user['username'] = $lang->guest;
}

		{
$revoked_user['username'] = $lang->guest;
}

 
		$revoked_user['username'] = htmlspecialchars_uni($revoked_user['username']);

		$revoked_by = build_profile_link($revoked_user['username'], $revoked_user['uid']);
$revoke_reason = nl2br(htmlspecialchars_uni($warning['revokereason']));
eval("\$revoke = \"".$templates->get("warnings_view_revoked")."\";");

		$revoked_by = build_profile_link($revoked_user['username'], $revoked_user['uid']);
$revoke_reason = nl2br(htmlspecialchars_uni($warning['revokereason']));
eval("\$revoke = \"".$templates->get("warnings_view_revoked")."\";");

	}


	}


	$plugins->run_hooks("warnings_view_end");

eval("\$warning = \"".$templates->get("warnings_view")."\";");
output_page($warning);
}

	$plugins->run_hooks("warnings_view_end");

eval("\$warning = \"".$templates->get("warnings_view")."\";");
output_page($warning);
}





// Showing list of warnings for a particular user
if(!$mybb->input['action'])
{
if($mybb->usergroup['canwarnusers'] != 1)
{
error_no_permission();

// Showing list of warnings for a particular user
if(!$mybb->input['action'])
{
if($mybb->usergroup['canwarnusers'] != 1)
{
error_no_permission();

	}

	}





	$user = get_user($mybb->get_input('uid', 1));

	$user = get_user($mybb->get_input('uid', MyBB::INPUT_INT));

	if(!$user['uid'])
{
error($lang->error_invalid_user);

	if(!$user['uid'])
{
error($lang->error_invalid_user);

Zeile 704Zeile 719
		error($lang->error_cant_warn_group);
}


		error($lang->error_cant_warn_group);
}


 
	$user['username'] = htmlspecialchars_uni($user['username']);

	$lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']);
add_breadcrumb($lang->nav_profile, get_profile_link($user['uid']));
add_breadcrumb($lang->nav_warning_log);

	$lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']);
add_breadcrumb($lang->nav_profile, get_profile_link($user['uid']));
add_breadcrumb($lang->nav_warning_log);

Zeile 711Zeile 727
	if(!$mybb->settings['postsperpage'] || (int)$mybb->settings['postsperpage'] < 1)
{
$mybb->settings['postsperpage'] = 20;

	if(!$mybb->settings['postsperpage'] || (int)$mybb->settings['postsperpage'] < 1)
{
$mybb->settings['postsperpage'] = 20;

	}


	}


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

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

	$page = $mybb->get_input('page', 1);

	$page = $mybb->get_input('page', MyBB::INPUT_INT);


$query = $db->simple_select("warnings", "COUNT(wid) AS warning_count", "uid='{$user['uid']}'");
$warning_count = $db->fetch_field($query, "warning_count");


$query = $db->simple_select("warnings", "COUNT(wid) AS warning_count", "uid='{$user['uid']}'");
$warning_count = $db->fetch_field($query, "warning_count");

Zeile 727Zeile 743
		$page = 1;
}
if($page)

		$page = 1;
}
if($page)

	{

	{

		$start = ($page-1) * $perpage;
}
else
{
$start = 0;
$page = 1;

		$start = ($page-1) * $perpage;
}
else
{
$start = 0;
$page = 1;

	}


	}


	$multipage = multipage($warning_count, $perpage, $page, "warnings.php?uid={$user['uid']}");

	$multipage = multipage($warning_count, $perpage, $page, "warnings.php?uid={$user['uid']}");

 

if($mybb->settings['maxwarningpoints'] < 1)
{
$mybb->settings['maxwarningpoints'] = 10;
}


$warning_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100);
if($warning_level > 100)


$warning_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100);
if($warning_level > 100)

Zeile 747Zeile 768
	if($user['warningpoints'] > $mybb->settings['maxwarningpoints'])
{
$user['warningpoints'] = $mybb->settings['maxwarningpoints'];

	if($user['warningpoints'] > $mybb->settings['maxwarningpoints'])
{
$user['warningpoints'] = $mybb->settings['maxwarningpoints'];

	}


	}


	if($warning_level > 0)
{
$lang->current_warning_level = $lang->sprintf($lang->current_warning_level, $warning_level, $user['warningpoints'], $mybb->settings['maxwarningpoints']);

	if($warning_level > 0)
{
$lang->current_warning_level = $lang->sprintf($lang->current_warning_level, $warning_level, $user['warningpoints'], $mybb->settings['maxwarningpoints']);

Zeile 785Zeile 806
		}
$last_expired = $warning['expired'];


		}
$last_expired = $warning['expired'];


		$post_link = "";

		$post_link = '';

		if($warning['post_subject'])
{
$warning['post_subject'] = $parser->parse_badwords($warning['post_subject']);
$warning['post_subject'] = htmlspecialchars_uni($warning['post_subject']);

		if($warning['post_subject'])
{
$warning['post_subject'] = $parser->parse_badwords($warning['post_subject']);
$warning['post_subject'] = htmlspecialchars_uni($warning['post_subject']);

			$post_link = "<br /><small>{$lang->warning_for_post} <a href=\"".get_post_link($warning['pid'])."#pid{$warning['pid']}\">{$warning['post_subject']}</a></small>";


			$warning['post_link'] = get_post_link($warning['pid']);
eval("\$post_link = \"".$templates->get("warnings_postlink")."\";");

		}

		}

 

$warning['username'] = htmlspecialchars_uni($warning['username']);

		$issuedby = build_profile_link($warning['username'], $warning['issuedby']);
$date_issued = my_date('relative', $warning['dateline']);
if($warning['type_title'])

		$issuedby = build_profile_link($warning['username'], $warning['issuedby']);
$date_issued = my_date('relative', $warning['dateline']);
if($warning['type_title'])