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") {
| if($mybb->input['action'] == "add" && $mybb->request_method == "post") {
|
Zeile 25 | Zeile 27 |
---|
if(!trim($mybb->input['filter'])) { $errors[] = $lang->error_missing_ban_input;
|
if(!trim($mybb->input['filter'])) { $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', 1)."'");
| $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;
| if($db->num_rows($query)) { $errors[] = $lang->error_filter_already_banned;
|
Zeile 37 | Zeile 39 |
---|
{ $new_filter = array( "filter" => $db->escape_string($mybb->input['filter']),
|
{ $new_filter = array( "filter" => $db->escape_string($mybb->input['filter']),
|
"type" => $mybb->get_input('type', 1),
| "type" => $mybb->get_input('type', MyBB::INPUT_INT),
|
"dateline" => TIME_NOW ); $fid = $db->insert_query("banfilters", $new_filter);
|
"dateline" => TIME_NOW ); $fid = $db->insert_query("banfilters", $new_filter);
|
if($mybb->input['type'] == 1) { $cache->update_bannedips(); } else if($mybb->input['type'] == 3) { $cache->update_bannedemails(); }
$plugins->run_hooks("admin_config_banning_add_commit");
| $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(); }
|
// Log admin action
|
// Log admin action
|
log_admin_action($fid, $mybb->input['filter'], $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 92 | Zeile 94 |
---|
if($mybb->input['action'] == "delete") {
|
if($mybb->input['action'] == "delete") {
|
$query = $db->simple_select("banfilters", "*", "fid='".$mybb->get_input('fid', 1)."'");
| $query = $db->simple_select("banfilters", "*", "fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'");
|
$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']) { admin_redirect("index.php?module=config-banning&type={$type}"); }
| if($mybb->get_input('no')) { admin_redirect("index.php?module=config-banning&type={$type}"); }
|
if($mybb->request_method == "post") {
| if($mybb->request_method == "post") {
|
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'], $filter['filter'], $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)
|
{
| {
|
$cache->update_bannedips(); } else if($filter['type'] == 3)
| $cache->update_bannedips(); } else if($filter['type'] == 3)
|
Zeile 155 | Zeile 157 |
---|
if(!$mybb->input['action']) { $plugins->run_hooks("admin_config_banning_start");
|
if(!$mybb->input['action']) { $plugins->run_hooks("admin_config_banning_start");
|
switch($mybb->input['type'])
| switch($mybb->get_input('type'))
|
{ case "emails": $type = "3"; $title = $lang->disallowed_email_addresses;
|
{ case "emails": $type = "3"; $title = $lang->disallowed_email_addresses;
|
break;
| break;
|
case "usernames": $type = "2"; $title = $lang->disallowed_usernames;
| case "usernames": $type = "2"; $title = $lang->disallowed_usernames;
|
Zeile 173 | Zeile 175 |
---|
}
$page->output_header($title);
|
}
$page->output_header($title);
|
|
|
$sub_tabs['ips'] = array( 'title' => $lang->banned_ips, 'link' => "index.php?module=config-banning",
| $sub_tabs['ips'] = array( 'title' => $lang->banned_ips, 'link' => "index.php?module=config-banning",
|
Zeile 189 | Zeile 191 |
---|
'title' => $lang->disallowed_usernames, 'link' => "index.php?module=config-banning&type=usernames", 'description' => $lang->disallowed_usernames_desc
|
'title' => $lang->disallowed_usernames, 'link' => "index.php?module=config-banning&type=usernames", 'description' => $lang->disallowed_usernames_desc
|
);
| );
|
$sub_tabs['emails'] = array( 'title' => $lang->disallowed_email_addresses,
| $sub_tabs['emails'] = array( 'title' => $lang->disallowed_email_addresses,
|
Zeile 197 | Zeile 199 |
---|
'description' => $lang->disallowed_email_addresses_desc );
|
'description' => $lang->disallowed_email_addresses_desc );
|
$page->output_nav_tabs($sub_tabs, $mybb->input['type']);
| $page->output_nav_tabs($sub_tabs, $mybb->input['type']);
|
if($errors) { $page->output_inline_error($errors); }
|
if($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 263 | Zeile 313 |
---|
$table->output($title);
|
$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();
| 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(); }
|