Zeile 17 | Zeile 17 |
---|
$page->add_breadcrumb_item($lang->banning, "index.php?module=config-banning");
$plugins->run_hooks("admin_config_banning_begin");
|
$page->add_breadcrumb_item($lang->banning, "index.php?module=config-banning");
$plugins->run_hooks("admin_config_banning_begin");
|
| $mybb->input['filter'] = $mybb->get_input('filter');
|
if($mybb->input['action'] == "add" && $mybb->request_method == "post") { $plugins->run_hooks("admin_config_banning_add");
if(!trim($mybb->input['filter']))
|
if($mybb->input['action'] == "add" && $mybb->request_method == "post") { $plugins->run_hooks("admin_config_banning_add");
if(!trim($mybb->input['filter']))
|
{
| {
|
$errors[] = $lang->error_missing_ban_input;
|
$errors[] = $lang->error_missing_ban_input;
|
}
| }
|
$query = $db->simple_select("banfilters", "fid", "filter = '".$db->escape_string($mybb->input['filter'])."' AND type = '".$mybb->get_input('type', MyBB::INPUT_INT)."'"); if($db->num_rows($query))
|
$query = $db->simple_select("banfilters", "fid", "filter = '".$db->escape_string($mybb->input['filter'])."' AND type = '".$mybb->get_input('type', MyBB::INPUT_INT)."'"); if($db->num_rows($query))
|
{
| {
|
$errors[] = $lang->error_filter_already_banned; }
| $errors[] = $lang->error_filter_already_banned; }
|
Zeile 43 | Zeile 45 |
---|
$fid = $db->insert_query("banfilters", $new_filter);
$plugins->run_hooks("admin_config_banning_add_commit");
|
$fid = $db->insert_query("banfilters", $new_filter);
$plugins->run_hooks("admin_config_banning_add_commit");
|
if($mybb->input['type'] == 1) { $cache->update_bannedips(); } else if($mybb->input['type'] == 3) { $cache->update_bannedemails();
| if($mybb->input['type'] == 1) { $cache->update_bannedips(); } else if($mybb->input['type'] == 3) { $cache->update_bannedemails();
|
}
// Log admin action
|
}
// Log admin action
|
log_admin_action($fid, htmlspecialchars_uni($mybb->input['filter']), (int)$mybb->input['type']);
| log_admin_action($fid, $mybb->input['filter'], (int)$mybb->input['type']);
|
if($mybb->input['type'] == 1) {
| if($mybb->input['type'] == 1) {
|
Zeile 96 | Zeile 98 |
---|
$filter = $db->fetch_array($query);
// Does the filter not exist?
|
$filter = $db->fetch_array($query);
// Does the filter not exist?
|
if(!$filter['fid'])
| if(!$filter)
|
{ flash_message($lang->error_invalid_filter, 'error'); admin_redirect("index.php?module=config-banning");
| { flash_message($lang->error_invalid_filter, 'error'); admin_redirect("index.php?module=config-banning");
|
Zeile 118 | Zeile 120 |
---|
}
// User clicked no
|
}
// User clicked no
|
if($mybb->input['no']) {
| if($mybb->get_input('no')) {
|
admin_redirect("index.php?module=config-banning&type={$type}"); }
| admin_redirect("index.php?module=config-banning&type={$type}"); }
|
Zeile 131 | Zeile 133 |
---|
$plugins->run_hooks("admin_config_banning_delete_commit");
// Log admin action
|
$plugins->run_hooks("admin_config_banning_delete_commit");
// Log admin action
|
log_admin_action($filter['fid'], htmlspecialchars_uni($filter['filter']), (int)$filter['type']);
| log_admin_action($filter['fid'], $filter['filter'], (int)$filter['type']);
|
// Banned IP? Rebuild banned IP cache if($filter['type'] == 1)
| // Banned IP? Rebuild banned IP cache if($filter['type'] == 1)
|
Zeile 156 | Zeile 158 |
---|
{ $plugins->run_hooks("admin_config_banning_start");
|
{ $plugins->run_hooks("admin_config_banning_start");
|
switch($mybb->input['type'])
| switch($mybb->get_input('type'))
|
{ case "emails": $type = "3";
| { case "emails": $type = "3";
|
Zeile 203 | Zeile 205 |
---|
{ $page->output_inline_error($errors); }
|
{ $page->output_inline_error($errors); }
|
| $query = $db->simple_select("banfilters", "COUNT(fid) AS filter", "type='{$type}'"); $total_rows = $db->fetch_field($query, "filter");
$pagenum = $mybb->get_input('page', MyBB::INPUT_INT); if($pagenum) { $start = ($pagenum - 1) * 20; $pages = ceil($total_rows / 20); if($pagenum > $pages) { $start = 0; $pagenum = 1; } } else { $start = 0; $pagenum = 1; }
$form = new Form("index.php?module=config-banning&action=add", "post", "add");
if($mybb->input['type'] == "usernames") { $form_container = new FormContainer($lang->add_disallowed_username); $form_container->output_row($lang->username." <em>*</em>", $lang->username_desc, $form->generate_text_box('filter', $mybb->input['filter'], array('id' => 'filter')), 'filter'); $buttons[] = $form->generate_submit_button($lang->disallow_username); } else if($mybb->input['type'] == "emails") { $form_container = new FormContainer($lang->add_disallowed_email_address); $form_container->output_row($lang->email_address." <em>*</em>", $lang->email_address_desc, $form->generate_text_box('filter', $mybb->input['filter'], array('id' => 'filter')), 'filter'); $buttons[] = $form->generate_submit_button($lang->disallow_email_address); } else { $form_container = new FormContainer($lang->ban_an_ip_address); $form_container->output_row($lang->ip_address." <em>*</em>", $lang->ip_address_desc, $form->generate_text_box('filter', $mybb->input['filter'], array('id' => 'filter')), 'filter'); $buttons[] = $form->generate_submit_button($lang->ban_ip_address); }
$form_container->end(); echo $form->generate_hidden_field("type", $type); $form->output_submit_wrapper($buttons); $form->end();
echo '<br />';
|
$table = new Table; if($mybb->input['type'] == "usernames")
| $table = new Table; if($mybb->input['type'] == "usernames")
|
Zeile 225 | Zeile 275 |
---|
} $table->construct_header($lang->controls, array("width" => 1));
|
} $table->construct_header($lang->controls, array("width" => 1));
|
$query = $db->simple_select("banfilters", "*", "type='{$type}'", array("order_by" => "filter", "order_dir" => "asc"));
| $query = $db->simple_select("banfilters", "*", "type='{$type}'", array('limit_start' => $start, 'limit' => 20, "order_by" => "filter", "order_dir" => "asc"));
|
while($filter = $db->fetch_array($query)) { $filter['filter'] = htmlspecialchars_uni($filter['filter']);
| while($filter = $db->fetch_array($query)) { $filter['filter'] = htmlspecialchars_uni($filter['filter']);
|
Zeile 252 | Zeile 302 |
---|
$table->construct_cell($date, array("class" => "align_center")); $table->construct_cell($last_use, array("class" => "align_center")); $table->construct_cell("<a href=\"index.php?module=config-banning&action=delete&fid={$filter['fid']}&my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_ban_deletion}');\"><img src=\"styles/{$page->style}/images/icons/delete.png\" title=\"{$lang->delete}\" alt=\"{$lang->delete}\" /></a>", array("class" => "align_center"));
|
$table->construct_cell($date, array("class" => "align_center")); $table->construct_cell($last_use, array("class" => "align_center")); $table->construct_cell("<a href=\"index.php?module=config-banning&action=delete&fid={$filter['fid']}&my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_ban_deletion}');\"><img src=\"styles/{$page->style}/images/icons/delete.png\" title=\"{$lang->delete}\" alt=\"{$lang->delete}\" /></a>", array("class" => "align_center"));
|
$table->construct_row(); }
| $table->construct_row(); }
|
if($table->num_rows() == 0)
|
if($table->num_rows() == 0)
|
{
| {
|
$table->construct_cell($lang->no_bans, array("colspan" => 4)); $table->construct_row(); }
|
$table->construct_cell($lang->no_bans, array("colspan" => 4)); $table->construct_row(); }
|
$table->output($title);
$form = new Form("index.php?module=config-banning&action=add", "post", "add");
if($mybb->input['type'] == "usernames") { $form_container = new FormContainer($lang->add_disallowed_username); $form_container->output_row($lang->username." <em>*</em>", $lang->username_desc, $form->generate_text_box('filter', $mybb->input['filter'], array('id' => 'filter')), 'filter'); $buttons[] = $form->generate_submit_button($lang->disallow_username); } else if($mybb->input['type'] == "emails") { $form_container = new FormContainer($lang->add_disallowed_email_address); $form_container->output_row($lang->email_address." <em>*</em>", $lang->email_address_desc, $form->generate_text_box('filter', $mybb->input['filter'], array('id' => 'filter')), 'filter'); $buttons[] = $form->generate_submit_button($lang->disallow_email_address); } else { $form_container = new FormContainer($lang->ban_an_ip_address); $form_container->output_row($lang->ip_address." <em>*</em>", $lang->ip_address_desc, $form->generate_text_box('filter', $mybb->input['filter'], array('id' => 'filter')), 'filter'); $buttons[] = $form->generate_submit_button($lang->ban_ip_address); }
$form_container->end(); echo $form->generate_hidden_field("type", $type); $form->output_submit_wrapper($buttons); $form->end();
| $table->output($title);
echo "<br />".draw_admin_pagination($pagenum, "20", $total_rows, "index.php?module=config-banning&type={$mybb->get_input('type')}&page={page}");
|
$page->output_footer(); }
| $page->output_footer(); }
|