Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: badwords.php 5380 2011-02-21 12:04:43Z Tomm $
| * $Id: badwords.php 5796 2012-04-19 14:38:15Z Tomm $
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 37 | Zeile 37 |
---|
{ $errors[] = $lang->replacement_word_max; }
|
{ $errors[] = $lang->replacement_word_max; }
|
| if(!$errors) { $query = $db->simple_select("badwords", "bid", "badword = '".$db->escape_string($mybb->input['badword'])."'");
if($db->num_rows($query)) { $errors[] = $lang->error_bad_word_filtered; } }
|
$badword = str_replace('\*', '([a-zA-Z0-9_]{1})', preg_quote($mybb->input['badword'], "#")); // Don't allow certain badword replacements to be added if it would cause an infinite recursive loop.
| $badword = str_replace('\*', '([a-zA-Z0-9_]{1})', preg_quote($mybb->input['badword'], "#")); // Don't allow certain badword replacements to be added if it would cause an infinite recursive loop.
|
Zeile 56 | Zeile 66 |
---|
$bid = $db->insert_query("badwords", $new_badword); $plugins->run_hooks("admin_config_badwords_add_commit");
|
$bid = $db->insert_query("badwords", $new_badword); $plugins->run_hooks("admin_config_badwords_add_commit");
|
|
|
// Log admin action log_admin_action($bid, $mybb->input['badword']);
$cache->update_badwords(); flash_message($lang->success_added_bad_word, 'success');
|
// Log admin action log_admin_action($bid, $mybb->input['badword']);
$cache->update_badwords(); flash_message($lang->success_added_bad_word, 'success');
|
admin_redirect("index.php?module=config-badwords");
| admin_redirect("index.php?module=config-badwords");
|
} else { $mybb->input['action'] = '';
|
} else { $mybb->input['action'] = '';
|
}
| }
|
}
if($mybb->input['action'] == "delete") { $plugins->run_hooks("admin_config_badwords_delete");
|
}
if($mybb->input['action'] == "delete") { $plugins->run_hooks("admin_config_badwords_delete");
|
|
|
$query = $db->simple_select("badwords", "*", "bid='".intval($mybb->input['bid'])."'"); $badword = $db->fetch_array($query); // Does the bad word not exist? if(!$badword['bid'])
|
$query = $db->simple_select("badwords", "*", "bid='".intval($mybb->input['bid'])."'"); $badword = $db->fetch_array($query); // Does the bad word not exist? if(!$badword['bid'])
|
{
| {
|
flash_message($lang->error_invalid_bid, 'error');
|
flash_message($lang->error_invalid_bid, 'error');
|
admin_redirect("index.php?module=config-badwords"); }
| admin_redirect("index.php?module=config-badwords"); }
|
// User clicked no if($mybb->input['no'])
|
// User clicked no if($mybb->input['no'])
|
{ admin_redirect("index.php?module=config-badwords"); }
| { admin_redirect("index.php?module=config-badwords"); }
|
if($mybb->request_method == "post") {
| if($mybb->request_method == "post") {
|
Zeile 101 | Zeile 111 |
---|
log_admin_action($badword['bid'], $badword['badword']);
$cache->update_badwords();
|
log_admin_action($badword['bid'], $badword['badword']);
$cache->update_badwords();
|
|
|
flash_message($lang->success_deleted_bad_word, 'success'); admin_redirect("index.php?module=config-badwords"); }
| flash_message($lang->success_deleted_bad_word, 'success'); admin_redirect("index.php?module=config-badwords"); }
|
Zeile 114 | Zeile 124 |
---|
if($mybb->input['action'] == "edit") { $plugins->run_hooks("admin_config_badwords_edit");
|
if($mybb->input['action'] == "edit") { $plugins->run_hooks("admin_config_badwords_edit");
|
|
|
$query = $db->simple_select("badwords", "*", "bid='".intval($mybb->input['bid'])."'"); $badword = $db->fetch_array($query);
| $query = $db->simple_select("badwords", "*", "bid='".intval($mybb->input['bid'])."'"); $badword = $db->fetch_array($query);
|
Zeile 124 | Zeile 134 |
---|
flash_message($lang->error_invalid_bid, 'error'); admin_redirect("index.php?module=config-badwords"); }
|
flash_message($lang->error_invalid_bid, 'error'); admin_redirect("index.php?module=config-badwords"); }
|
|
|
if($mybb->request_method == "post") { if(!trim($mybb->input['badword'])) { $errors[] = $lang->error_missing_bad_word;
|
if($mybb->request_method == "post") { if(!trim($mybb->input['badword'])) { $errors[] = $lang->error_missing_bad_word;
|
}
| }
|
if(strlen(trim($mybb->input['badword'])) > 100) { $errors[] = $lang->bad_word_max;
| if(strlen(trim($mybb->input['badword'])) > 100) { $errors[] = $lang->bad_word_max;
|
Zeile 140 | Zeile 150 |
---|
if(strlen($mybb->input['replacement']) > 100) { $errors[] = $lang->replacement_word_max;
|
if(strlen($mybb->input['replacement']) > 100) { $errors[] = $lang->replacement_word_max;
|
}
| }
|
if(!$errors) {
| if(!$errors) {
|
Zeile 210 | Zeile 220 |
---|
);
$page->output_nav_tabs($sub_tabs, "badwords");
|
);
$page->output_nav_tabs($sub_tabs, "badwords");
|
| if($errors) { $page->output_inline_error($errors); }
|
$table = new Table; $table->construct_header($lang->bad_word);
| $table = new Table; $table->construct_header($lang->bad_word);
|
Zeile 218 | Zeile 233 |
---|
$query = $db->simple_select("badwords", "*", "", array("order_by" => "badword", "order_dir" => "asc")); while($badword = $db->fetch_array($query))
|
$query = $db->simple_select("badwords", "*", "", array("order_by" => "badword", "order_dir" => "asc")); while($badword = $db->fetch_array($query))
|
{
| {
|
$badword['badword'] = htmlspecialchars_uni($badword['badword']); $badword['replacement'] = htmlspecialchars_uni($badword['replacement']); if(!$badword['replacement'])
| $badword['badword'] = htmlspecialchars_uni($badword['badword']); $badword['replacement'] = htmlspecialchars_uni($badword['replacement']); if(!$badword['replacement'])
|
Zeile 229 | Zeile 244 |
---|
$table->construct_cell($badword['replacement']); $table->construct_cell("<a href=\"index.php?module=config-badwords&action=edit&bid={$badword['bid']}\">{$lang->edit}</a>", array("class" => "align_center")); $table->construct_cell("<a href=\"index.php?module=config-badwords&action=delete&bid={$badword['bid']}&my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_bad_word_deletion}');\">{$lang->delete}</a>", array("class" => "align_center"));
|
$table->construct_cell($badword['replacement']); $table->construct_cell("<a href=\"index.php?module=config-badwords&action=edit&bid={$badword['bid']}\">{$lang->edit}</a>", array("class" => "align_center")); $table->construct_cell("<a href=\"index.php?module=config-badwords&action=delete&bid={$badword['bid']}&my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_bad_word_deletion}');\">{$lang->delete}</a>", array("class" => "align_center"));
|
$table->construct_row();
| $table->construct_row();
|
} if($table->num_rows() == 0)
| } if($table->num_rows() == 0)
|
Zeile 241 | Zeile 256 |
---|
$table->output($lang->bad_word_filters);
$form = new Form("index.php?module=config-badwords&action=add", "post", "add");
|
$table->output($lang->bad_word_filters);
$form = new Form("index.php?module=config-badwords&action=add", "post", "add");
|
if($errors) { $page->output_inline_error($errors); }
|
|
$form_container = new FormContainer($lang->add_bad_word); $form_container->output_row($lang->bad_word." <em>*</em>", $lang->bad_word_desc, $form->generate_text_box('badword', $mybb->input['badword'], array('id' => 'badword')), 'badword'); $form_container->output_row($lang->replacement, $lang->replacement_desc, $form->generate_text_box('replacement', $mybb->input['replacement'], array('id' => 'replacement')), 'replacement');
| $form_container = new FormContainer($lang->add_bad_word); $form_container->output_row($lang->bad_word." <em>*</em>", $lang->bad_word_desc, $form->generate_text_box('badword', $mybb->input['badword'], array('id' => 'badword')), 'badword'); $form_container->output_row($lang->replacement, $lang->replacement_desc, $form->generate_text_box('replacement', $mybb->input['replacement'], array('id' => 'replacement')), 'replacement');
|