Zeile 47 | Zeile 47 |
---|
} }
|
} }
|
$badword = str_replace('\*', '([a-zA-Z0-9_]{1})', preg_quote($mybb->input['badword'], "#"));
| $badword = trim($mybb->input['badword']);
if($mybb->get_input('regex', MyBB::INPUT_INT)) { // Check validity of defined regular expression if((@preg_match('#'.$badword.'#is', null) === false)) { $errors[] = $lang->error_invalid_regex; } } else { if(!is_object($parser)) { require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser; } $badword = $parser->generate_regex($badword); }
|
// Don't allow certain badword replacements to be added if it would cause an infinite recursive loop.
|
// Don't allow certain badword replacements to be added if it would cause an infinite recursive loop.
|
if(strlen($mybb->input['badword']) == strlen($mybb->input['replacement']) && preg_match("#(^|\W)".$badword."(\W|$)#i", $mybb->input['replacement']))
| if(@preg_match('#'.$badword.'#is', $mybb->input['replacement']))
|
{ $errors[] = $lang->error_replacement_word_invalid; }
| { $errors[] = $lang->error_replacement_word_invalid; }
|
Zeile 59 | Zeile 78 |
---|
{ $new_badword = array( "badword" => $db->escape_string($mybb->input['badword']),
|
{ $new_badword = array( "badword" => $db->escape_string($mybb->input['badword']),
|
| "regex" => $mybb->get_input('regex', MyBB::INPUT_INT),
|
"replacement" => $db->escape_string($mybb->input['replacement']) );
|
"replacement" => $db->escape_string($mybb->input['replacement']) );
|
|
|
$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");
|
Zeile 71 | Zeile 91 |
---|
$cache->update_badwords(); flash_message($lang->success_added_bad_word, 'success');
|
$cache->update_badwords(); flash_message($lang->success_added_bad_word, 'success');
|
admin_redirect("index.php?module=config-badwords"); } else { $mybb->input['action'] = ''; }
| admin_redirect("index.php?module=config-badwords"); } else { $mybb->input['action'] = ''; }
|
}
if($mybb->input['action'] == "delete")
| }
if($mybb->input['action'] == "delete")
|
Zeile 91 | Zeile 111 |
---|
admin_redirect("index.php?module=config-badwords"); }
|
admin_redirect("index.php?module=config-badwords"); }
|
// User clicked no if($mybb->input['no']) { admin_redirect("index.php?module=config-badwords"); }
$plugins->run_hooks("admin_config_badwords_delete");
| // User clicked no if($mybb->input['no']) { admin_redirect("index.php?module=config-badwords"); }
$plugins->run_hooks("admin_config_badwords_delete");
|
if($mybb->request_method == "post") {
| if($mybb->request_method == "post") {
|
Zeile 144 | Zeile 164 |
---|
if(strlen(trim($mybb->input['badword'])) > 100) { $errors[] = $lang->bad_word_max;
|
if(strlen(trim($mybb->input['badword'])) > 100) { $errors[] = $lang->bad_word_max;
|
}
| }
|
if(strlen($mybb->input['replacement']) > 100) {
| if(strlen($mybb->input['replacement']) > 100) {
|
Zeile 155 | Zeile 175 |
---|
{ $updated_badword = array( "badword" => $db->escape_string($mybb->input['badword']),
|
{ $updated_badword = array( "badword" => $db->escape_string($mybb->input['badword']),
|
| "regex" => $mybb->get_input('regex', MyBB::INPUT_INT),
|
"replacement" => $db->escape_string($mybb->input['replacement']) );
| "replacement" => $db->escape_string($mybb->input['replacement']) );
|
Zeile 191 | Zeile 212 |
---|
$badword_data = $mybb->input; } else
|
$badword_data = $mybb->input; } else
|
{
| {
|
$badword_data = $badword; }
|
$badword_data = $badword; }
|
|
|
$form_container = new FormContainer($lang->edit_bad_word); $form_container->output_row($lang->bad_word." <em>*</em>", $lang->bad_word_desc, $form->generate_text_box('badword', $badword_data['badword'], array('id' => 'badword')), 'badword'); $form_container->output_row($lang->replacement, $lang->replacement_desc, $form->generate_text_box('replacement', $badword_data['replacement'], array('id' => 'replacement')), 'replacement');
|
$form_container = new FormContainer($lang->edit_bad_word); $form_container->output_row($lang->bad_word." <em>*</em>", $lang->bad_word_desc, $form->generate_text_box('badword', $badword_data['badword'], array('id' => 'badword')), 'badword'); $form_container->output_row($lang->replacement, $lang->replacement_desc, $form->generate_text_box('replacement', $badword_data['replacement'], array('id' => 'replacement')), 'replacement');
|
| $form_container->output_row($lang->regex, $lang->regex_desc, $form->generate_yes_no_radio('regex', (int)$badword_data['regex'], array('id' => 'regex')), 'regex');
|
$form_container->end(); $buttons[] = $form->generate_submit_button($lang->save_bad_word); $form->output_submit_wrapper($buttons);
| $form_container->end(); $buttons[] = $form->generate_submit_button($lang->save_bad_word); $form->output_submit_wrapper($buttons);
|
Zeile 215 | Zeile 237 |
---|
'description' => $lang->bad_word_filters_desc, 'link' => "index.php?module=config-badwords" );
|
'description' => $lang->bad_word_filters_desc, 'link' => "index.php?module=config-badwords" );
|
|
|
$plugins->run_hooks("admin_config_badwords_start");
$page->output_nav_tabs($sub_tabs, "badwords");
if($errors)
|
$plugins->run_hooks("admin_config_badwords_start");
$page->output_nav_tabs($sub_tabs, "badwords");
if($errors)
|
{
| {
|
$page->output_inline_error($errors); }
|
$page->output_inline_error($errors); }
|
|
|
$table = new Table; $table->construct_header($lang->bad_word); $table->construct_header($lang->replacement, array("width" => "50%"));
|
$table = new Table; $table->construct_header($lang->bad_word); $table->construct_header($lang->replacement, array("width" => "50%"));
|
| $table->construct_header($lang->regex, array("class" => "align_center", "width" => "20%"));
|
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150, "colspan" => 2));
$query = $db->simple_select("badwords", "*", "", array("order_by" => "badword", "order_dir" => "asc"));
| $table->construct_header($lang->controls, array("class" => "align_center", "width" => 150, "colspan" => 2));
$query = $db->simple_select("badwords", "*", "", array("order_by" => "badword", "order_dir" => "asc"));
|
Zeile 236 | Zeile 259 |
---|
$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'])
|
{
| {
|
$badword['replacement'] = '*****'; }
|
$badword['replacement'] = '*****'; }
|
| $regex = $lang->no; if($badword['regex']) { $regex = $lang->yes; }
|
$table->construct_cell($badword['badword']); $table->construct_cell($badword['replacement']);
|
$table->construct_cell($badword['badword']); $table->construct_cell($badword['replacement']);
|
| $table->construct_cell($regex, array("class" => "align_center"));
|
$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_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();
|
Zeile 259 | Zeile 290 |
---|
$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');
|
| $form_container->output_row($lang->regex, $lang->regex_desc, $form->generate_yes_no_radio('regex', !$mybb->get_input('regex'), array('id' => 'regex')), 'regex');
|
$form_container->end(); $buttons[] = $form->generate_submit_button($lang->save_bad_word); $form->output_submit_wrapper($buttons);
| $form_container->end(); $buttons[] = $form->generate_submit_button($lang->save_bad_word); $form->output_submit_wrapper($buttons);
|