Vergleich warnings.php - 1.8.7 - 1.8.37

  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 22Zeile 22
$parser = new postParser;

$lang->load("warnings");

$parser = new postParser;

$lang->load("warnings");

 
$lang->load("datahandler_warnings");


if($mybb->settings['enablewarningsystem'] == 0)
{


if($mybb->settings['enablewarningsystem'] == 0)
{

Zeile 51Zeile 52

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



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


	if(!$user['uid'])

	if(!$user)

	{
error($lang->error_invalid_user);
}

	{
error($lang->error_invalid_user);
}

Zeile 66Zeile 67
	if(!modcp_can_manage_user($user['uid']))
{
error($lang->error_cant_warn_user);

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

	}

$plugins->run_hooks("warnings_do_warn_start");


	}

$plugins->run_hooks("warnings_do_warn_start");


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

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

Zeile 96Zeile 97
	}

$warningshandler->set_data($warning);

	}

$warningshandler->set_data($warning);





	if($warningshandler->validate_warning())
{
$warninginfo = $warningshandler->insert_warning();

	if($warningshandler->validate_warning())
{
$warninginfo = $warningshandler->insert_warning();

Zeile 115Zeile 116
			if($mybb->settings['allowanonwarningpms'] == 1 && $mybb->get_input('pm_anonymous', MyBB::INPUT_INT))
{
$sender_uid = -1;

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

 
				// Workaround for eliminating PHP warnings in PHP 8. Ref: https://github.com/mybb/mybb/issues/4630#issuecomment-1369144163
$pm['sender']['uid'] = -1;

			}

// Some kind of friendly error notification

			}

// Some kind of friendly error notification

Zeile 123Zeile 126
				$warningshandler->friendly_action .= $lang->redirect_warned_pmerror;
}
}

				$warningshandler->friendly_action .= $lang->redirect_warned_pmerror;
}
}

	



		$plugins->run_hooks("warnings_do_warn_end");

$lang->redirect_warned = $lang->sprintf($lang->redirect_warned, htmlspecialchars_uni($user['username']), $warningshandler->new_warning_level, $warningshandler->friendly_action);

		$plugins->run_hooks("warnings_do_warn_end");

$lang->redirect_warned = $lang->sprintf($lang->redirect_warned, htmlspecialchars_uni($user['username']), $warningshandler->new_warning_level, $warningshandler->friendly_action);

Zeile 230Zeile 233
			WHERE w.pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'
ORDER BY w.expired ASC, w.dateline DESC
");

			WHERE w.pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'
ORDER BY w.expired ASC, w.dateline DESC
");

		$first = true;

		$last_expired = -1;

		$warnings = '';
while($warning = $db->fetch_array($query))
{

		$warnings = '';
while($warning = $db->fetch_array($query))
{

			if($warning['expired'] != $last_expired || $first)

			if($warning['expired'] != $last_expired)

			{
if($warning['expired'] == 0)
{
eval("\$warnings .= \"".$templates->get("warnings_active_header")."\";");

			{
if($warning['expired'] == 0)
{
eval("\$warnings .= \"".$templates->get("warnings_active_header")."\";");

				}

				}

				else
{
eval("\$warnings .= \"".$templates->get("warnings_expired_header")."\";");
}
}
$last_expired = $warning['expired'];

				else
{
eval("\$warnings .= \"".$templates->get("warnings_expired_header")."\";");
}
}
$last_expired = $warning['expired'];

			$first = false;





			$post_link = "";

			$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'])
{
$warning_type = $warning['type_title'];

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

			}

			}

			else
{
$warning_type = $warning['title'];
}
$warning_type = htmlspecialchars_uni($warning_type);
if($warning['points'] > 0)

			else
{
$warning_type = $warning['title'];
}
$warning_type = htmlspecialchars_uni($warning_type);
if($warning['points'] > 0)

			{

			{

				$warning['points'] = "+{$warning['points']}";
}
$points = $lang->sprintf($lang->warning_points, $warning['points']);
if($warning['expired'] != 1)
{
if($warning['expires'] == 0)

				$warning['points'] = "+{$warning['points']}";
}
$points = $lang->sprintf($lang->warning_points, $warning['points']);
if($warning['expired'] != 1)
{
if($warning['expires'] == 0)

				{

				{

					$expires = $lang->never;
}
else
{

					$expires = $lang->never;
}
else
{

					$expires = my_date($mybb->settings['dateformat'], $warning['expires']) . ", " . my_date($mybb->settings['timeformat'], $warning['expires']);

					$expires = nice_time($warning['expires']-TIME_NOW);

				}
}
else

				}
}
else

Zeile 290Zeile 293
			$alt_bg = alt_trow();
$plugins->run_hooks("warnings_warning");
eval("\$warnings .= \"".$templates->get("warnings_warning")."\";");

			$alt_bg = alt_trow();
$plugins->run_hooks("warnings_warning");
eval("\$warnings .= \"".$templates->get("warnings_warning")."\";");

		}

		}

		if($warnings)
{
eval("\$existing_warnings = \"".$templates->get("warnings_warn_existing")."\";");
}
}

		if($warnings)
{
eval("\$existing_warnings = \"".$templates->get("warnings_warn_existing")."\";");
}
}





	$plugins->run_hooks("warnings_warn_start");

	$plugins->run_hooks("warnings_warn_start");

	



	$type_checked = array('custom' => '');
$expires_period = array('hours' => '', 'days' => '', 'weeks' => '', 'months' => '', 'never' => '');
$send_pm_checked = '';

// Coming here from failed do_warn?

	$type_checked = array('custom' => '');
$expires_period = array('hours' => '', 'days' => '', 'weeks' => '', 'months' => '', 'never' => '');
$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'));

Zeile 320Zeile 324
		$custom_reason = htmlspecialchars_uni($mybb->get_input('custom_reason'));
$custom_points = $mybb->get_input('custom_points', MyBB::INPUT_INT);
$expires = $mybb->get_input('expires', MyBB::INPUT_INT);

		$custom_reason = htmlspecialchars_uni($mybb->get_input('custom_reason'));
$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))

		if($mybb->get_input('expires_period'))

		{

		{

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

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

		}
}
else

		}
}
else

Zeile 520Zeile 524
	else if($warning['daterevoked'])
{
error($lang->warning_already_revoked);

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

	}

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

	}

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


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


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

Zeile 580Zeile 584
	}

$user = get_user((int)$warning['uid']);

	}

$user = get_user((int)$warning['uid']);

	if(!$user)

	if(empty($user))

	{

	{

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

		$user = array('uid' => 0, 'username' => $lang->guest);

	}

	}

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


$group_permissions = user_permissions($user['uid']);
if($group_permissions['canreceivewarnings'] != 1)
{
error($lang->error_cant_warn_group);


$group_permissions = user_permissions($user['uid']);
if($group_permissions['canreceivewarnings'] != 1)
{
error($lang->error_cant_warn_group);

	}

$plugins->run_hooks("warnings_view_start");


	}

$plugins->run_hooks("warnings_view_start");


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

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

	if($user['uid'])
{

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

		add_breadcrumb($lang->nav_profile, get_profile_link($user['uid']));
add_breadcrumb($lang->nav_warning_log, "warnings.php?uid={$user['uid']}");

		add_breadcrumb($lang->nav_profile, get_profile_link($user['uid']));
add_breadcrumb($lang->nav_warning_log, "warnings.php?uid={$user['uid']}");

	}

	}

	else
{
add_breadcrumb($lang->nav_profile);
add_breadcrumb($lang->nav_warning_log);
}
add_breadcrumb($lang->nav_view_warning);

	else
{
add_breadcrumb($lang->nav_profile);
add_breadcrumb($lang->nav_warning_log);
}
add_breadcrumb($lang->nav_view_warning);





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

$post_link = "";

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

$post_link = "";

Zeile 615Zeile 620
		$warning['post_subject'] = htmlspecialchars_uni($warning['post_subject']);
$post_link = get_post_link($warning['pid'])."#pid{$warning['pid']}";
eval("\$warning_info = \"".$templates->get("warnings_view_post")."\";");

		$warning['post_subject'] = htmlspecialchars_uni($warning['post_subject']);
$post_link = get_post_link($warning['pid'])."#pid{$warning['pid']}";
eval("\$warning_info = \"".$templates->get("warnings_view_post")."\";");

	}
else

	}
else

	{
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 628Zeile 634
	if($warning['type_title'])
{
$warning_type = $warning['type_title'];

	if($warning['type_title'])
{
$warning_type = $warning['type_title'];

	}

	}

	else

	else

	{

	{

		$warning_type = $warning['title'];

		$warning_type = $warning['title'];

	}

	}

	$warning_type = htmlspecialchars_uni($warning_type);
if($warning['points'] > 0)
{
$warning['points'] = "+{$warning['points']}";

	$warning_type = htmlspecialchars_uni($warning_type);
if($warning['points'] > 0)
{
$warning['points'] = "+{$warning['points']}";

	}

$revoked_date = '';


	}

$revoked_date = '';


	$points = $lang->sprintf($lang->warning_points, $warning['points']);
if($warning['expired'] != 1)
{

	$points = $lang->sprintf($lang->warning_points, $warning['points']);
if($warning['expired'] != 1)
{

Zeile 650Zeile 656
		}
else
{

		}
else
{

			$expires = my_date($mybb->settings['dateformat'], $warning['expires']) . ", " . my_date($mybb->settings['timeformat'], $warning['expires']);

			$expires = my_date('normal', $warning['expires']); // Purposely not using nice_time here as the moderator has clicked for more details so the actual day/time should be shown

		}
$status = $lang->warning_active;
}

		}
$status = $lang->warning_active;
}

Zeile 662Zeile 668
		}
else if($warning['expires'])
{

		}
else if($warning['expires'])
{

			$revoked_date = '('.my_date($mybb->settings['dateformat'], $warning['expires']).', '.my_date($mybb->settings['timeformat'], $warning['expires']).')';

			$revoked_date = '('.my_date('normal', $warning['expires']).')';

			$expires = $status = $lang->already_expired;

			$expires = $status = $lang->already_expired;

		}
}

		}
}


if(!$warning['daterevoked'])
{


if(!$warning['daterevoked'])
{

Zeile 683Zeile 689
		{
$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");

	}

$plugins->run_hooks("warnings_view_end");


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


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

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

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

	}

	}


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


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

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

	if(!$user)
{

		error($lang->error_invalid_user);
}


		error($lang->error_invalid_user);
}


Zeile 712Zeile 719
	if($group_permissions['canreceivewarnings'] != 1)
{
error($lang->error_cant_warn_group);

	if($group_permissions['canreceivewarnings'] != 1)
{
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 733Zeile 741
	$pages = ceil($warning_count/$perpage);

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

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

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

	{
$page = 1;
}

	{
$page = 1;
}

	if($page)

	if($page)

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

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

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

	}
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)

	if($mybb->settings['maxwarningpoints'] < 1)

	{

	{

		$mybb->settings['maxwarningpoints'] = 10;
}


		$mybb->settings['maxwarningpoints'] = 10;
}


Zeile 757Zeile 765
	if($warning_level > 100)
{
$warning_level = 100;

	if($warning_level > 100)
{
$warning_level = 100;

	}


	}


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

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

Zeile 800Zeile 808
		}
$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'])

Zeile 831Zeile 842
			}
else
{

			}
else
{

				$expires = my_date($mybb->settings['dateformat'], $warning['expires']) . ", " . my_date($mybb->settings['timeformat'], $warning['expires']);

				$expires = nice_time($warning['expires']-TIME_NOW);

			}
}
else

			}
}
else