Vergleich admin/modules/config/badwords.php - 1.8.16 - 1.8.36

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 18Zeile 18

$plugins->run_hooks("admin_config_badwords_begin");



$plugins->run_hooks("admin_config_badwords_begin");


if($mybb->input['action'] == "add" && $mybb->request_method == "post")

if($mybb->input['action'] == "add")

{
$plugins->run_hooks("admin_config_badwords_add");


{
$plugins->run_hooks("admin_config_badwords_add");


	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($mybb->input['replacement']) > 100)
{
$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.
if(strlen($mybb->input['badword']) == strlen($mybb->input['replacement']) && preg_match("#(^|\W)".$badword."(\W|$)#i", $mybb->input['replacement']))
{
$errors[] = $lang->error_replacement_word_invalid;
}

if(!$errors)
{
$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'])
);

$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');
admin_redirect("index.php?module=config-badwords");
}
else











































	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($mybb->input['replacement']) > 100)
{
$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 = trim($mybb->input['badword']);

if($mybb->get_input('regex', MyBB::INPUT_INT))
{
// Check validity of defined regular expression
if((@preg_match('#'.$badword.'#is', '') === false))
{
$errors[] = $lang->error_invalid_regex;
}
}
else
{
if(!isset($parser) || !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.
if(@preg_match('#'.$badword.'#is', $mybb->input['replacement']))
{
$errors[] = $lang->error_replacement_word_invalid;
}

if(!$errors)
{
$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'])
);

$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');
admin_redirect("index.php?module=config-badwords");
}
}

$page->add_breadcrumb_item($lang->add_bad_word);
$page->output_header($lang->bad_words." - ".$lang->add_bad_word);

$sub_tabs['badwords'] = array(
'title' => $lang->bad_word_filters,
'description' => $lang->bad_word_filters_desc,
'link' => "index.php?module=config-badwords"
);

$sub_tabs['add_badword'] = array(
'title' => $lang->add_bad_word,
'description' => $lang->add_bad_word_desc,
'link' => "index.php?module=config-badwords&action=add"
);

$page->output_nav_tabs($sub_tabs, "add_badword");

$form = new Form("index.php?module=config-badwords&action=add", "post", "add");

if($errors)

	{

	{

		$mybb->input['action'] = '';

		$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->get_input('badword'), array('id' => 'badword')), 'badword');
$form_container->output_row($lang->replacement, $lang->replacement_desc, $form->generate_text_box('replacement', $mybb->get_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', MyBB::INPUT_INT), array('id' => 'regex')), 'regex');
$form_container->end();
$buttons[] = $form->generate_submit_button($lang->save_bad_word);
$form->output_submit_wrapper($buttons);
$form->end();

$page->output_footer();

}

if($mybb->input['action'] == "delete")

}

if($mybb->input['action'] == "delete")

Zeile 93Zeile 146
	}

// User clicked no

	}

// User clicked no

	if($mybb->input['no'])

	if($mybb->get_input('no'))

	{
admin_redirect("index.php?module=config-badwords");
}

	{
admin_redirect("index.php?module=config-badwords");
}

Zeile 131Zeile 184
	{
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");

	}

	}


$plugins->run_hooks("admin_config_badwords_edit");

if($mybb->request_method == "post")
{
if(!trim($mybb->input['badword']))


$plugins->run_hooks("admin_config_badwords_edit");

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;

			$errors[] = $lang->error_missing_bad_word;
}

if(strlen(trim($mybb->input['badword'])) > 100)
{
$errors[] = $lang->bad_word_max;

		}

		}


if(strlen($mybb->input['replacement']) > 100)
{
$errors[] = $lang->replacement_word_max;


if(strlen($mybb->input['replacement']) > 100)
{
$errors[] = $lang->replacement_word_max;

 
		}

if(!$errors)
{
$query = $db->simple_select("badwords", "bid", "badword = '".$db->escape_string($mybb->input['badword'])."' AND bid != '".$badword['bid']."'");

if($db->num_rows($query))
{
$errors[] = $lang->error_bad_word_filtered;
}
}

$badword_check = trim($mybb->input['badword']);

if($mybb->get_input('regex', MyBB::INPUT_INT))
{
// Check validity of defined regular expression
if((@preg_match('#'.$badword_check.'#is', '') === false))
{
$errors[] = $lang->error_invalid_regex;
}
}
else
{
if(!isset($parser) || !is_object($parser))
{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
}

$badword_check = $parser->generate_regex($badword_check);
}

// Don't allow certain badword replacements to be added if it would cause an infinite recursive loop.
if(@preg_match('#'.$badword_check.'#is', $mybb->input['replacement']))
{
$errors[] = $lang->error_replacement_word_invalid;

		}

if(!$errors)

		}

if(!$errors)

Zeile 159Zeile 249
				"regex" => $mybb->get_input('regex', MyBB::INPUT_INT),
"replacement" => $db->escape_string($mybb->input['replacement'])
);

				"regex" => $mybb->get_input('regex', MyBB::INPUT_INT),
"replacement" => $db->escape_string($mybb->input['replacement'])
);





			$plugins->run_hooks("admin_config_badwords_edit_commit");

$db->update_query("badwords", $updated_badword, "bid='{$badword['bid']}'");

			$plugins->run_hooks("admin_config_badwords_edit_commit");

$db->update_query("badwords", $updated_badword, "bid='{$badword['bid']}'");

Zeile 217Zeile 307
		'title' => $lang->bad_word_filters,
'description' => $lang->bad_word_filters_desc,
'link' => "index.php?module=config-badwords"

		'title' => $lang->bad_word_filters,
'description' => $lang->bad_word_filters_desc,
'link' => "index.php?module=config-badwords"

 
	);

$sub_tabs['add_badword'] = array(
'title' => $lang->add_bad_word,
'description' => $lang->add_bad_word_desc,
'link' => "index.php?module=config-badwords&amp;action=add"

	);

$plugins->run_hooks("admin_config_badwords_start");

	);

$plugins->run_hooks("admin_config_badwords_start");





	$page->output_nav_tabs($sub_tabs, "badwords");


	$page->output_nav_tabs($sub_tabs, "badwords");


	if($errors)





	$query = $db->simple_select("badwords", "COUNT(bid) AS badwords");
$total_rows = $db->fetch_field($query, "badwords");

$pagenum = $mybb->get_input('page', MyBB::INPUT_INT);
if($pagenum)

	{

	{

		$page->output_inline_error($errors);












		$start = ($pagenum - 1) * 20;
$pages = ceil($total_rows / 20);
if($pagenum > $pages)
{
$start = 0;
$pagenum = 1;
}
}
else
{
$start = 0;
$pagenum = 1;

	}

$table = new Table;

	}

$table = new Table;

Zeile 234Zeile 345
	$table->construct_header($lang->regex, array("class" => "align_center", "width" => "20%"));
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150, "colspan" => 2));


	$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"));

	$query = $db->simple_select("badwords", "*", "", array('limit_start' => $start, 'limit' => 20, "order_by" => "badword", "order_dir" => "asc"));

	while($badword = $db->fetch_array($query))
{
$badword['badword'] = htmlspecialchars_uni($badword['badword']);

	while($badword = $db->fetch_array($query))
{
$badword['badword'] = htmlspecialchars_uni($badword['badword']);

Zeile 266Zeile 377

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



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


	$form = new Form("index.php?module=config-badwords&amp;action=add", "post", "add");

$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->end();

	echo "<br />".draw_admin_pagination($pagenum, "20", $total_rows, "index.php?module=config-badwords&amp;page={page}");











$page->output_footer();
}


$page->output_footer();
}