Vergleich warnings.php - 1.8.7 - 1.8.18

  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 123Zeile 124
				$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 142Zeile 143
		$warn_errors = $warningshandler->get_friendly_errors();
$warn_errors = inline_error($warn_errors);
$mybb->input['action'] = 'warn';

		$warn_errors = $warningshandler->get_friendly_errors();
$warn_errors = inline_error($warn_errors);
$mybb->input['action'] = 'warn';

	}

	}

}

}





// Warn a user
if($mybb->input['action'] == "warn")
{
if($mybb->usergroup['canwarnusers'] != 1)
{
error_no_permission();

// Warn a user
if($mybb->input['action'] == "warn")
{
if($mybb->usergroup['canwarnusers'] != 1)
{
error_no_permission();

	}


	}


	// Check we haven't exceeded the maximum number of warnings per day
if($mybb->usergroup['maxwarningsday'] != 0)
{

	// Check we haven't exceeded the maximum number of warnings per day
if($mybb->usergroup['maxwarningsday'] != 0)
{

Zeile 162Zeile 163
		if($given_today >= $mybb->usergroup['maxwarningsday'])
{
error($lang->sprintf($lang->warnings_reached_max_warnings_day, $mybb->usergroup['maxwarningsday']));

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

		}
}


		}
}


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

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

Zeile 172Zeile 173
	}

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

	}

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

	{

	{

		error($lang->warnings_error_cannot_warn_self);

		error($lang->warnings_error_cannot_warn_self);

	}


	}


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

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

	}

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


	}

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


	if($group_permissions['canreceivewarnings'] != 1)

	if($group_permissions['canreceivewarnings'] != 1)

	{

	{

		error($lang->error_cant_warn_group);

		error($lang->error_cant_warn_group);

	}

	}


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





	$post = $existing_warnings = '';

	$post = $existing_warnings = '';





	// Giving a warning for a specific post
if($mybb->get_input('pid', MyBB::INPUT_INT))
{
$post = get_post($mybb->get_input('pid', MyBB::INPUT_INT));

	// Giving a warning for a specific post
if($mybb->get_input('pid', MyBB::INPUT_INT))
{
$post = get_post($mybb->get_input('pid', MyBB::INPUT_INT));





		if($post)

		if($post)

		{

		{

			$thread = get_thread($post['tid']);

			$thread = get_thread($post['tid']);

		}

if(!$post || !$thread)
{
error($lang->warnings_error_invalid_post);
}

		}

if(!$post || !$thread)
{
error($lang->warnings_error_invalid_post);
}


$forum_permissions = forum_permissions($thread['fid']);
if($forum_permissions['canview'] != 1)


$forum_permissions = forum_permissions($thread['fid']);
if($forum_permissions['canview'] != 1)

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

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

				}
else

				}
else

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

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

Zeile 249Zeile 250
			$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 272Zeile 274
					$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 294Zeile 296
		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 314Zeile 317
		$pm_subject = htmlspecialchars_uni($mybb->get_input('pm_subject'));
$message = htmlspecialchars_uni($mybb->get_input('pm_message'));
if(!empty($mybb->input['send_pm']))

		$pm_subject = htmlspecialchars_uni($mybb->get_input('pm_subject'));
$message = htmlspecialchars_uni($mybb->get_input('pm_message'));
if(!empty($mybb->input['send_pm']))

		{

		{

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

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

		}

		}

		$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);

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

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

	}

	}

	else
{
$notes = $custom_reason = $custom_points = $expires = '';

	else
{
$notes = $custom_reason = $custom_points = $expires = '';

Zeile 333Zeile 336
		$pm_subject = $lang->warning_pm_subject;
$message = $lang->sprintf($lang->warning_pm_message, $user['username'], $mybb->settings['bbname']);
$warn_errors = '';

		$pm_subject = $lang->warning_pm_subject;
$message = $lang->sprintf($lang->warning_pm_message, $user['username'], $mybb->settings['bbname']);
$warn_errors = '';

	}


	}


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

	$lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']);
add_breadcrumb($lang->nav_profile, get_profile_link($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;

	$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");

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

Zeile 376Zeile 379
				$level['friendly_action'] = $lang->sprintf($lang->result_banned, $group_name, $period);
break;
case 2:

				$level['friendly_action'] = $lang->sprintf($lang->result_banned, $group_name, $period);
break;
case 2:

				if($level['action']['length'] > 0)
{
$period = fetch_friendly_expiration($level['action']['length']);
$lang_str = "expiration_".$period['period'];

				if($level['action']['length'] > 0)
{
$period = fetch_friendly_expiration($level['action']['length']);
$lang_str = "expiration_".$period['period'];

					$period = $lang->sprintf($lang->result_period, $period['time'], $lang->$lang_str);

					$period = $lang->sprintf($lang->result_period, $period['time'], $lang->$lang_str);

				}

				}

				else
{
$period = $lang->result_period_perm;

				else
{
$period = $lang->result_period_perm;

Zeile 390Zeile 393
				break;
case 3:
if($level['action']['length'] > 0)

				break;
case 3:
if($level['action']['length'] > 0)

				{

				{

					$period = fetch_friendly_expiration($level['action']['length']);
$lang_str = "expiration_".$period['period'];
$period = $lang->sprintf($lang->result_period, $period['time'], $lang->$lang_str);

					$period = fetch_friendly_expiration($level['action']['length']);
$lang_str = "expiration_".$period['period'];
$period = $lang->sprintf($lang->result_period, $period['time'], $lang->$lang_str);

Zeile 401Zeile 404
				}
$level['friendly_action'] = $lang->sprintf($lang->result_moderated, $period);
break;

				}
$level['friendly_action'] = $lang->sprintf($lang->result_moderated, $period);
break;

		}

		}

		$levels[$level['percentage']] = $level;
}
krsort($levels);

		$levels[$level['percentage']] = $level;
}
krsort($levels);





	$types = '';

// Fetch all current warning types
$query = $db->simple_select("warningtypes", "*", "", array("order_by" => "title"));
while($type = $db->fetch_array($query))

	$types = '';

// Fetch all current warning types
$query = $db->simple_select("warningtypes", "*", "", array("order_by" => "title"));
while($type = $db->fetch_array($query))

	{

	{

		if(!isset($type_checked[$type['tid']]))

		if(!isset($type_checked[$type['tid']]))

		{

		{

			$type_checked[$type['tid']] = '';
}
$checked = $type_checked[$type['tid']];

			$type_checked[$type['tid']] = '';
}
$checked = $type_checked[$type['tid']];

Zeile 422Zeile 425
		if($new_warning_level > 100)
{
$new_warning_level = 100;

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

		}

		}

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

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

Zeile 443Zeile 446
		$level_diff = $new_warning_level-$current_level;
$result = '';
if(!empty($new_level['friendly_action']))

		$level_diff = $new_warning_level-$current_level;
$result = '';
if(!empty($new_level['friendly_action']))

		{

		{

			eval("\$result = \"".$templates->get("warnings_warn_type_result")."\";");
}
eval("\$types .= \"".$templates->get("warnings_warn_type")."\";");

			eval("\$result = \"".$templates->get("warnings_warn_type_result")."\";");
}
eval("\$types .= \"".$templates->get("warnings_warn_type")."\";");

Zeile 461Zeile 464
		}

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

		}

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

	}

$pm_notify = '';


	}

$pm_notify = '';


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

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

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

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

			}

			}

		}

$anonymous_pm = '';

		}

$anonymous_pm = '';

Zeile 486Zeile 489
			{
$checked = ' checked="checked"';
}

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





			eval('$anonymous_pm = "'.$templates->get('warnings_warn_pm_anonymous').'";');
}


			eval('$anonymous_pm = "'.$templates->get('warnings_warn_pm_anonymous').'";');
}


Zeile 507Zeile 510
	verify_post_check($mybb->get_input('my_post_key'));

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

	verify_post_check($mybb->get_input('my_post_key'));

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

	{

	{

		error_no_permission();

		error_no_permission();

	}


	}


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

if(!$warning)

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

if(!$warning)

Zeile 518Zeile 521
		error($lang->error_invalid_warning);
}
else if($warning['daterevoked'])

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

	{

	{

		error($lang->warning_already_revoked);
}

		error($lang->warning_already_revoked);
}





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

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

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

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

	}

	}


$plugins->run_hooks("warnings_do_revoke_start");



$plugins->run_hooks("warnings_do_revoke_start");


Zeile 549Zeile 552
		);

$warningshandler->set_data($warning_data);

		);

$warningshandler->set_data($warning_data);





		$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);

Zeile 584Zeile 587
	{
$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 621Zeile 625
		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 650Zeile 655
		}
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 667
		}
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;
}
}

Zeile 683Zeile 688
		{
$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")."\";");

Zeile 714Zeile 720
		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 800Zeile 807
		}
$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 841
			}
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