Vergleich admin/modules/tools/warninglog.php - 1.8.0 - 1.8.33

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 21Zeile 21
// Revoke a warning
if($mybb->input['action'] == "do_revoke" && $mybb->request_method == "post")
{

// Revoke a warning
if($mybb->input['action'] == "do_revoke" && $mybb->request_method == "post")
{

	$query = $db->simple_select("warnings", "*", "wid='".(int)$mybb->input['wid']."'");

	$query = $db->simple_select("warnings", "*", "wid='".$mybb->get_input('wid', MyBB::INPUT_INT)."'");

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

if(!$warning['wid'])

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

if(!$warning['wid'])

Zeile 59Zeile 59
			$updated_user = array(
"warningpoints" => $new_warning_points
);

			$updated_user = array(
"warningpoints" => $new_warning_points
);

			$db->update_query("users", $updated_user, "uid='{$warning['uid']}'");
}

		}



// Update warning
$updated_warning = array(


// Update warning
$updated_warning = array(

Zeile 69Zeile 68
			"revokedby" => $mybb->user['uid'],
"revokereason" => $db->escape_string($mybb->input['reason'])
);

			"revokedby" => $mybb->user['uid'],
"revokereason" => $db->escape_string($mybb->input['reason'])
);

		$db->update_query("warnings", $updated_warning, "wid='{$warning['wid']}'");





		$plugins->run_hooks("admin_tools_warninglog_do_revoke_commit");

		$plugins->run_hooks("admin_tools_warninglog_do_revoke_commit");

 

if($warning['expired'] != 1)
{
$db->update_query("users", $updated_user, "uid='{$warning['uid']}'");
}

$db->update_query("warnings", $updated_warning, "wid='{$warning['wid']}'");


flash_message($lang->redirect_warning_revoked, 'success');
admin_redirect("index.php?module=tools-warninglog&action=view&wid={$warning['wid']}");


flash_message($lang->redirect_warning_revoked, 'success');
admin_redirect("index.php?module=tools-warninglog&action=view&wid={$warning['wid']}");

Zeile 87Zeile 92
		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='".(int)$mybb->input['wid']."'

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

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


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


Zeile 105Zeile 110

$page->output_header($lang->warning_details);



$page->output_header($lang->warning_details);


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

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





	if(is_array($warn_errors))

	if(isset($warn_errors) && is_array($warn_errors))

	{
$page->output_inline_error($warn_errors);
$mybb->input['reason'] = htmlspecialchars_uni($mybb->input['reason']);

	{
$page->output_inline_error($warn_errors);
$mybb->input['reason'] = htmlspecialchars_uni($mybb->input['reason']);

Zeile 137Zeile 142
		$table->construct_row();
}


		$table->construct_row();
}


	$issuedby = build_profile_link($warning['username'], $warning['issuedby'], "_blank");

	$issuedby = build_profile_link(htmlspecialchars_uni($warning['username']), $warning['issuedby'], "_blank");

	$notes = nl2br(htmlspecialchars_uni($warning['notes']));

$date_issued = my_date('relative', $warning['dateline']);

	$notes = nl2br(htmlspecialchars_uni($warning['notes']));

$date_issued = my_date('relative', $warning['dateline']);

Zeile 157Zeile 162

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


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

	{

	{

		if($warning['expires'] == 0)
{
$expires = $lang->never;

		if($warning['expires'] == 0)
{
$expires = $lang->never;

Zeile 167Zeile 172
			$expires = my_date('relative', $warning['expires']);
}
$status = $lang->warning_active;

			$expires = my_date('relative', $warning['expires']);
}
$status = $lang->warning_active;

	}
else

	}
else

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

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

Zeile 186Zeile 191

$table->construct_cell("<strong>{$lang->issued_by}</strong><br /><br />{$issuedby}", array('width' => '50%'));
$table->construct_cell("<strong>{$lang->expires}</strong><br /><br />{$expires}", array('width' => '50%'));


$table->construct_cell("<strong>{$lang->issued_by}</strong><br /><br />{$issuedby}", array('width' => '50%'));
$table->construct_cell("<strong>{$lang->expires}</strong><br /><br />{$expires}", array('width' => '50%'));

	$table->construct_row();


	$table->construct_row();


	$table->construct_cell("<strong>{$lang->warning_note}</strong><br /><br />{$notes}", array('colspan' => 2));
$table->construct_row();

	$table->construct_cell("<strong>{$lang->warning_note}</strong><br /><br />{$notes}", array('colspan' => 2));
$table->construct_row();





	$table->output("<div class=\"float_right\" style=\"font-weight: normal;\">{$status}</div>".$lang->warning_details);

	$table->output("<div class=\"float_right\" style=\"font-weight: normal;\">{$status}</div>".$lang->warning_details);





	if(!$warning['daterevoked'])
{
$form = new Form("index.php?module=tools-warninglog", "post");
$form_container = new FormContainer($lang->revoke_warning);
echo $form->generate_hidden_field('action', 'do_revoke');
echo $form->generate_hidden_field('wid', $warning['wid']);

	if(!$warning['daterevoked'])
{
$form = new Form("index.php?module=tools-warninglog", "post");
$form_container = new FormContainer($lang->revoke_warning);
echo $form->generate_hidden_field('action', 'do_revoke');
echo $form->generate_hidden_field('wid', $warning['wid']);

		$form_container->output_row("", $lang->revoke_warning_desc, $form->generate_text_area('reason', $mybb->input['reason'], array('id' => 'reason')), 'reason');

		$form_container->output_row("", $lang->revoke_warning_desc, $form->generate_text_area('reason', $mybb->get_input('reason'), array('id' => 'reason')), 'reason');


$form_container->end();
$buttons[] = $form->generate_submit_button($lang->revoke_warning);
$form->output_submit_wrapper($buttons);
$form->end();


$form_container->end();
$buttons[] = $form->generate_submit_button($lang->revoke_warning);
$form->output_submit_wrapper($buttons);
$form->end();

	}
else

	}
else

	{
$date_revoked = my_date('relative', $warning['daterevoked']);
$revoked_user = get_user($warning['revokedby']);

	{
$date_revoked = my_date('relative', $warning['daterevoked']);
$revoked_user = get_user($warning['revokedby']);

		$revoked_by = build_profile_link($revoked_user['username'], $revoked_user['uid'], "_blank");

		$revoked_by = build_profile_link(htmlspecialchars_uni($revoked_user['username']), $revoked_user['uid'], "_blank");

		$revoke_reason = nl2br(htmlspecialchars_uni($warning['revokereason']));

$revoke_table = new Table;

		$revoke_reason = nl2br(htmlspecialchars_uni($warning['revokereason']));

$revoke_table = new Table;

Zeile 222Zeile 227
		$revoke_table->construct_row();

$revoke_table->output($lang->warning_is_revoked);

		$revoke_table->construct_row();

$revoke_table->output($lang->warning_is_revoked);

	}


	}


	$page->output_footer();
}


	$page->output_footer();
}


Zeile 240Zeile 245
	);

$page->output_nav_tabs($sub_tabs, 'warning_logs');

	);

$page->output_nav_tabs($sub_tabs, 'warning_logs');

 

if(empty($mybb->input['filter']))
{
$mybb->input['filter'] = array();
}


// Filter options
$where_sql = '';


// Filter options
$where_sql = '';

Zeile 248Zeile 258
		$search_user = get_user_by_username($mybb->input['filter']['username']);

$mybb->input['filter']['uid'] = (int)$search_user['uid'];

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

$mybb->input['filter']['uid'] = (int)$search_user['uid'];

		$mybb->input['filter']['uid'] = $db->fetch_field($query, "uid");

 
	}

	}

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

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

	{
$search['uid'] = (int)$mybb->input['filter']['uid'];
$where_sql .= " AND w.uid='{$search['uid']}'";

	{
$search['uid'] = (int)$mybb->input['filter']['uid'];
$where_sql .= " AND w.uid='{$search['uid']}'";

Zeile 266Zeile 275

$mybb->input['filter']['mod_uid'] = (int)$mod_user['uid'];
}


$mybb->input['filter']['mod_uid'] = (int)$mod_user['uid'];
}

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

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

	{
$search['mod_uid'] = (int)$mybb->input['filter']['mod_uid'];
$where_sql .= " AND w.issuedby='{$search['mod_uid']}'";

	{
$search['mod_uid'] = (int)$mybb->input['filter']['mod_uid'];
$where_sql .= " AND w.issuedby='{$search['mod_uid']}'";

Zeile 276Zeile 285
			$mybb->input['search']['mod_username'] = $mod_user['username'];
}
}

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

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

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

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

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

	switch($mybb->input['filter']['sortby'])






	$sortby_input = '';
if(!empty($mybb->input['filter']['sortby']))
{
$sortby_input = $mybb->input['filter']['sortby'];
}
switch($sortby_input)

	{
case "username":
$sortby = "u.username";

	{
case "username":
$sortby = "u.username";

Zeile 300Zeile 314
			$sortby = "w.dateline";
$sortbysel['dateline'] = ' selected="selected"';
}

			$sortby = "w.dateline";
$sortbysel['dateline'] = ' selected="selected"';
}

	$order = $mybb->input['filter']['order'];

 
	$ordersel = array();

	$ordersel = array();

	if($order != "asc")

	if(empty($mybb->input['filter']['order']) || $mybb->input['filter']['order'] != "asc")

	{
$order = "desc";
$ordersel['desc'] = ' selected="selected"';
}
else

	{
$order = "desc";
$ordersel['desc'] = ' selected="selected"';
}
else

	{

	{

		$ordersel['asc'] = ' selected="selected"';
}


		$ordersel['asc'] = ' selected="selected"';
}


Zeile 330Zeile 343
	$query = $db->query($sql);
$total_warnings = $db->fetch_field($query, 'count');
$view_page = 1;

	$query = $db->query($sql);
$total_warnings = $db->fetch_field($query, 'count');
$view_page = 1;

	if(isset($mybb->input['page']) && $mybb->get_input('page', 1) > 0)
{
$view_page = $mybb->get_input('page', 1);

	if(isset($mybb->input['page']) && $mybb->get_input('page', MyBB::INPUT_INT) > 0)
{
$view_page = $mybb->get_input('page', MyBB::INPUT_INT);

	}
$per_page = 20;
if(isset($mybb->input['filter']['per_page']) && (int)$mybb->input['filter']['per_page'] > 0)

	}
$per_page = 20;
if(isset($mybb->input['filter']['per_page']) && (int)$mybb->input['filter']['per_page'] > 0)

	{

	{

		$per_page = (int)$mybb->input['filter']['per_page'];

		$per_page = (int)$mybb->input['filter']['per_page'];

	}

	}

	$start = ($view_page-1) * $per_page;

	$start = ($view_page-1) * $per_page;

 
	$pages = ceil($total_warnings / $per_page);
if($view_page > $pages)
{
$start = 0;
$view_page = 1;
}

	// Build the base URL for pagination links
$url = 'index.php?module=tools-warninglog';
if(is_array($mybb->input['filter']) && count($mybb->input['filter']))

	// Build the base URL for pagination links
$url = 'index.php?module=tools-warninglog';
if(is_array($mybb->input['filter']) && count($mybb->input['filter']))

Zeile 386Zeile 405
		}

$trow = alt_trow();

		}

$trow = alt_trow();

		$username = format_name($row['username'], $row['usergroup'], $row['displaygroup']);

		$username = format_name(htmlspecialchars_uni($row['username']), $row['usergroup'], $row['displaygroup']);

		if(!$row['uid'])
{
$username_link = $username;

		if(!$row['uid'])
{
$username_link = $username;

Zeile 395Zeile 414
		{
$username_link = build_profile_link($username, $row['uid'], "_blank");
}

		{
$username_link = build_profile_link($username, $row['uid'], "_blank");
}

		$mod_username = format_name($row['mod_username'], $row['mod_usergroup'], $row['mod_displaygroup']);

		$mod_username = format_name(htmlspecialchars_uni($row['mod_username']), $row['mod_usergroup'], $row['mod_displaygroup']);

		$mod_username_link = build_profile_link($mod_username, $row['mod_uid'], "_blank");
$issued_date = my_date('relative', $row['dateline']);
$revoked_text = '';

		$mod_username_link = build_profile_link($mod_username, $row['mod_uid'], "_blank");
$issued_date = my_date('relative', $row['dateline']);
$revoked_text = '';

Zeile 407Zeile 426
		if($row['expires'] > 0)
{
$expire_date = my_date('relative', $row['expires']);

		if($row['expires'] > 0)
{
$expire_date = my_date('relative', $row['expires']);

		}

		}

		else
{
$expire_date = $lang->never;

		else
{
$expire_date = $lang->never;

Zeile 419Zeile 438
		}
$title = htmlspecialchars_uni($title);
if($row['points'] > 0)

		}
$title = htmlspecialchars_uni($title);
if($row['points'] > 0)

		{
$points = '+'.$row['points'];

		{
$row['points'] = "+{$row['points']}";

		}

		}

 
		$points = $lang->sprintf($lang->warning_points, $row['points']);


$table->construct_cell($username_link);


$table->construct_cell($username_link);

		$table->construct_cell("{$title} ({$points})");

		$table->construct_cell("{$title} {$points}");

		$table->construct_cell($issued_date, array("class" => "align_center"));
$table->construct_cell($expire_date.$revoked_text, array("class" => "align_center"));
$table->construct_cell($mod_username_link);

		$table->construct_cell($issued_date, array("class" => "align_center"));
$table->construct_cell($expire_date.$revoked_text, array("class" => "align_center"));
$table->construct_cell($mod_username_link);

Zeile 433Zeile 453
	}

if($table->num_rows() == 0)

	}

if($table->num_rows() == 0)

	{

	{

		$table->construct_cell($lang->no_warning_logs, array("colspan" => "6"));
$table->construct_row();
}

$table->output($lang->warning_logs);

		$table->construct_cell($lang->no_warning_logs, array("colspan" => "6"));
$table->construct_row();
}

$table->output($lang->warning_logs);





	// Do we need to construct the pagination?
if($total_warnings > $per_page)
{
echo draw_admin_pagination($view_page, $per_page, $total_warnings, $url)."<br />";

	// Do we need to construct the pagination?
if($total_warnings > $per_page)
{
echo draw_admin_pagination($view_page, $per_page, $total_warnings, $url)."<br />";

	}


	}


	$sort_by = array(
'expires' => $lang->expiry_date,
'dateline' => $lang->issued_date,
'username' => $lang->warned_user,
'issuedby' => $lang->issued_by

	$sort_by = array(
'expires' => $lang->expiry_date,
'dateline' => $lang->issued_date,
'username' => $lang->warned_user,
'issuedby' => $lang->issued_by

	);


	);


	$order_array = array(
'asc' => $lang->asc,
'desc' => $lang->desc
);

	$order_array = array(
'asc' => $lang->asc,
'desc' => $lang->desc
);

 

$user_filters = array();
$input_filters = $mybb->get_input('filter', MyBB::INPUT_ARRAY);
foreach(array('username', 'mod_username', 'reason', 'sortby') as $key)
{
if(isset($input_filters[$key]))
{
$user_filters[$key] = $input_filters[$key];
}
else
{
$user_filters[$key] = '';
}
}


$form = new Form("index.php?module=tools-warninglog", "post");
$form_container = new FormContainer($lang->filter_warning_logs);


$form = new Form("index.php?module=tools-warninglog", "post");
$form_container = new FormContainer($lang->filter_warning_logs);

	$form_container->output_row($lang->filter_warned_user, "", $form->generate_text_box('filter[username]', $mybb->input['filter']['username'], array('id' => 'filter_username')), 'filter_username');
$form_container->output_row($lang->filter_issued_by, "", $form->generate_text_box('filter[mod_username]', $mybb->input['filter']['mod_username'], array('id' => 'filter_mod_username')), 'filter_mod_username');
$form_container->output_row($lang->filter_reason, "", $form->generate_text_box('filter[reason]', $mybb->input['filter']['reason'], array('id' => 'filter_reason')), 'filter_reason');
$form_container->output_row($lang->sort_by, "", $form->generate_select_box('filter[sortby]', $sort_by, $mybb->input['filter']['sortby'], array('id' => 'filter_sortby'))." {$lang->in} ".$form->generate_select_box('filter[order]', $order_array, $order, array('id' => 'filter_order'))." {$lang->order}", 'filter_order');
$form_container->output_row($lang->results_per_page, "", $form->generate_text_box('filter[per_page]', $per_page, array('id' => 'filter_per_page')), 'filter_per_page');

	$form_container->output_row($lang->filter_warned_user, "", $form->generate_text_box('filter[username]', $user_filters['username'], array('id' => 'filter_username')), 'filter_username');
$form_container->output_row($lang->filter_issued_by, "", $form->generate_text_box('filter[mod_username]', $user_filters['mod_username'], array('id' => 'filter_mod_username')), 'filter_mod_username');
$form_container->output_row($lang->filter_reason, "", $form->generate_text_box('filter[reason]', $user_filters['reason'], array('id' => 'filter_reason')), 'filter_reason');
$form_container->output_row($lang->sort_by, "", $form->generate_select_box('filter[sortby]', $sort_by, $user_filters['sortby'], array('id' => 'filter_sortby'))." {$lang->in} ".$form->generate_select_box('filter[order]', $order_array, $order, array('id' => 'filter_order'))." {$lang->order}", 'filter_order');
$form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('filter[per_page]', $per_page, array('id' => 'filter_per_page', 'min' => 1)), 'filter_per_page');


$form_container->end();
$buttons[] = $form->generate_submit_button($lang->filter_warning_logs);


$form_container->end();
$buttons[] = $form->generate_submit_button($lang->filter_warning_logs);