Vergleich admin/modules/config/badwords.php - 1.8.1 - 1.8.30

  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']),
"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
{
$mybb->input['action'] = '';
}























































	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', null) === 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)
{
$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")
{

	$query = $db->simple_select("badwords", "*", "bid='".$mybb->get_input('bid', 1)."'");

	$query = $db->simple_select("badwords", "*", "bid='".$mybb->get_input('bid', MyBB::INPUT_INT)."'");

	$badword = $db->fetch_array($query);

	$badword = $db->fetch_array($query);





	// Does the bad word not exist?
if(!$badword['bid'])
{

	// Does the bad word not exist?
if(!$badword['bid'])
{

Zeile 92Zeile 146
	}

// User clicked no

	}

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

$plugins->run_hooks("admin_config_badwords_delete");

if($mybb->request_method == "post")
{

		// Delete the bad word
$db->delete_query("badwords", "bid='{$badword['bid']}'");


		// Delete the bad word
$db->delete_query("badwords", "bid='{$badword['bid']}'");


Zeile 122Zeile 176

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


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

	$query = $db->simple_select("badwords", "*", "bid='".$mybb->get_input('bid', 1)."'");

	$query = $db->simple_select("badwords", "*", "bid='".$mybb->get_input('bid', MyBB::INPUT_INT)."'");

	$badword = $db->fetch_array($query);

// Does the bad word not exist?

	$badword = $db->fetch_array($query);

// Does the bad word not exist?

Zeile 155Zeile 209
		{
$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 178Zeile 233
	$sub_tabs['editbadword'] = array(
'title' => $lang->edit_bad_word,
'description' => $lang->edit_bad_word_desc,

	$sub_tabs['editbadword'] = array(
'title' => $lang->edit_bad_word,
'description' => $lang->edit_bad_word_desc,

		'link' => "index.php?module=config-badwords"
);


		'link' => "index.php?module=config-badwords"
);


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

$form = new Form("index.php?module=config-badwords&amp;action=edit&amp;bid={$badword['bid']}", "post");

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

$form = new Form("index.php?module=config-badwords&amp;action=edit&amp;bid={$badword['bid']}", "post");

Zeile 198Zeile 253
	$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 214Zeile 270
		'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->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));


	$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 239Zeile 317
		{
$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&amp;action=edit&amp;bid={$badword['bid']}\">{$lang->edit}</a>", array("class" => "align_center"));
$table->construct_cell("<a href=\"index.php?module=config-badwords&amp;action=delete&amp;bid={$badword['bid']}&amp;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("<a href=\"index.php?module=config-badwords&amp;action=edit&amp;bid={$badword['bid']}\">{$lang->edit}</a>", array("class" => "align_center"));
$table->construct_cell("<a href=\"index.php?module=config-badwords&amp;action=delete&amp;bid={$badword['bid']}&amp;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)
{
$table->construct_cell($lang->no_bad_words, array("colspan" => 4));
$table->construct_row();
}


if($table->num_rows() == 0)
{
$table->construct_cell($lang->no_bad_words, array("colspan" => 4));
$table->construct_row();
}





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