Vergleich admin/modules/config/mycode.php - 1.8.0 - 1.8.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 26Zeile 26
		admin_redirect("index.php?module=config-mycode");
}


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


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

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

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

if(!$mycode['cid'])

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

if(!$mycode['cid'])

Zeile 51Zeile 51
		'active' => $new_status,
);


		'active' => $new_status,
);


	$db->update_query("mycode", $mycode_update, "cid='".$mybb->get_input('cid', 1)."'");




	$plugins->run_hooks("admin_config_mycode_toggle_status_commit");

$db->update_query("mycode", $mycode_update, "cid='{$mycode['cid']}'");


	$cache->update_mycode();

	$cache->update_mycode();


$plugins->run_hooks("admin_config_mycode_toggle_status_commit");






	// Log admin action
log_admin_action($mycode['cid'], $mycode['title'], $new_status);


	// Log admin action
log_admin_action($mycode['cid'], $mycode['title'], $new_status);


Zeile 86Zeile 86
if($mybb->input['action'] == "add")
{
$plugins->run_hooks("admin_config_mycode_add");

if($mybb->input['action'] == "add")
{
$plugins->run_hooks("admin_config_mycode_add");


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


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

		if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_title;

		if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_title;

		}


		}


		if(!trim($mybb->input['regex']))
{
$errors[] = $lang->error_missing_regex;

		if(!trim($mybb->input['regex']))
{
$errors[] = $lang->error_missing_regex;

		}

		}


if(!trim($mybb->input['replacement']))
{
$errors[] = $lang->error_missing_replacement;


if(!trim($mybb->input['replacement']))
{
$errors[] = $lang->error_missing_replacement;

		}

		}


if($mybb->input['test'])
{


if($mybb->input['test'])
{

Zeile 117Zeile 117
				'description' => $db->escape_string($mybb->input['description']),
'regex' => $db->escape_string(str_replace("\x0", "", $mybb->input['regex'])),
'replacement' => $db->escape_string($mybb->input['replacement']),

				'description' => $db->escape_string($mybb->input['description']),
'regex' => $db->escape_string(str_replace("\x0", "", $mybb->input['regex'])),
'replacement' => $db->escape_string($mybb->input['replacement']),

				'active' => $db->escape_string($mybb->input['active']),
'parseorder' => (int)$mybb->input['parseorder']

				'active' => $mybb->get_input('active', MyBB::INPUT_INT),
'parseorder' => $mybb->get_input('parseorder', MyBB::INPUT_INT)

			);

$cid = $db->insert_query("mycode", $new_mycode);

			);

$cid = $db->insert_query("mycode", $new_mycode);


$cache->update_mycode();

 

$plugins->run_hooks("admin_config_mycode_add_commit");


$plugins->run_hooks("admin_config_mycode_add_commit");






$cache->update_mycode();


			// Log admin action

			// Log admin action

			log_admin_action($cid, $mybb->input['title']);

			log_admin_action($cid, htmlspecialchars_uni($mybb->input['title']));


flash_message($lang->success_added_mycode, 'success');
admin_redirect('index.php?module=config-mycode');


flash_message($lang->success_added_mycode, 'success');
admin_redirect('index.php?module=config-mycode');

Zeile 168Zeile 168

$form = new Form("index.php?module=config-mycode&action=add", "post", "add");
$form_container = new FormContainer($lang->add_mycode);


$form = new Form("index.php?module=config-mycode&action=add", "post", "add");
$form_container = new FormContainer($lang->add_mycode);

	$form_container->output_row($lang->title." <em>*</em>", '', $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->short_description, '', $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');
$form_container->output_row($lang->regular_expression." <em>*</em>", $lang->regular_expression_desc.'<br /><strong>'.$lang->example.'</strong> \[b\](.*?)\[/b\]', $form->generate_text_area('regex', $mybb->input['regex'], array('id' => 'regex')), 'regex');
$form_container->output_row($lang->replacement." <em>*</em>", $lang->replacement_desc.'<br /><strong>'.$lang->example.'</strong> &lt;strong&gt;$1&lt;/strong&gt;', $form->generate_text_area('replacement', $mybb->input['replacement'], array('id' => 'replacement')), 'replacement');
$form_container->output_row($lang->enabled." <em>*</em>", '', $form->generate_yes_no_radio('active', $mybb->input['active']));
$form_container->output_row($lang->parse_order, $lang->parse_order_desc, $form->generate_text_box('parseorder', $mybb->input['parseorder'], array('id' => 'parseorder')), 'parseorder');
$form_container->end();

$buttons[] = $form->generate_submit_button($lang->save_mycode);
$form->output_submit_wrapper($buttons);

// Sandbox
echo "<br />\n";
$form_container = new FormContainer($lang->sandbox);
$form_container->output_row($lang->sandbox_desc);
$form_container->output_row($lang->test_value, $lang->test_value_desc, $form->generate_text_area('test_value', $mybb->input['test_value'], array('id' => 'test_value'))."<br />".$form->generate_submit_button($lang->test, array('id' => 'test', 'name' => 'test')), 'test_value');
$form_container->output_row($lang->result_html, $lang->result_html_desc, $form->generate_text_area('result_html', $sandbox['html'], array('id' => 'result_html', 'disabled' => 1)), 'result_html');
$form_container->output_row($lang->result_actual, $lang->result_actual_desc, "<div id=\"result_actual\">{$sandbox['actual']}</div>");
$form_container->end();
echo '<script type="text/javascript" src="./jscripts/mycode_sandbox.js"></script>';
echo '<script type="text/javascript">
//<![CDATA[
$(function(){
new MyCodeSandbox("./index.php?module=config-mycode&action=xmlhttp_test_mycode", $("#test"), $("#regex"), $("#replacement"), $("#test_value"), $("#result_html"), $("#result_actual"));
});
//]]>
</script>';

$form->end();

$page->output_footer();
}


	$form_container->output_row($lang->title." <em>*</em>", '', $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->short_description, '', $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');
$form_container->output_row($lang->regular_expression." <em>*</em>", $lang->regular_expression_desc.'<br /><strong>'.$lang->example.'</strong> \[b\](.*?)\[/b\]', $form->generate_text_area('regex', $mybb->input['regex'], array('id' => 'regex')), 'regex');
$form_container->output_row($lang->replacement." <em>*</em>", $lang->replacement_desc.'<br /><strong>'.$lang->example.'</strong> &lt;strong&gt;$1&lt;/strong&gt;', $form->generate_text_area('replacement', $mybb->input['replacement'], array('id' => 'replacement')), 'replacement');
$form_container->output_row($lang->enabled." <em>*</em>", '', $form->generate_yes_no_radio('active', $mybb->input['active']));
$form_container->output_row($lang->parse_order, $lang->parse_order_desc, $form->generate_numeric_field('parseorder', $mybb->input['parseorder'], array('id' => 'parseorder', 'min' => 0)), 'parseorder');
$form_container->end();

$buttons[] = $form->generate_submit_button($lang->save_mycode);
$form->output_submit_wrapper($buttons);

// Sandbox
echo "<br />\n";
$form_container = new FormContainer($lang->sandbox);
$form_container->output_row($lang->sandbox_desc);
$form_container->output_row($lang->test_value, $lang->test_value_desc, $form->generate_text_area('test_value', $mybb->input['test_value'], array('id' => 'test_value'))."<br />".$form->generate_submit_button($lang->test, array('id' => 'test', 'name' => 'test')), 'test_value');
$form_container->output_row($lang->result_html, $lang->result_html_desc, $form->generate_text_area('result_html', $sandbox['html'], array('id' => 'result_html', 'disabled' => 1)), 'result_html');
$form_container->output_row($lang->result_actual, $lang->result_actual_desc, "<div id=\"result_actual\">{$sandbox['actual']}</div>");
$form_container->end();
echo '<script type="text/javascript" src="./jscripts/mycode_sandbox.js"></script>';
echo '<script type="text/javascript">
//<![CDATA[
$(function(){
new MyCodeSandbox("./index.php?module=config-mycode&action=xmlhttp_test_mycode", $("#test"), $("#regex"), $("#replacement"), $("#test_value"), $("#result_html"), $("#result_actual"));
});
//]]>
</script>';

$form->end();

$page->output_footer();
}


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

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

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

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

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

if(!$mycode['cid'])

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

if(!$mycode['cid'])

Zeile 244Zeile 244
				'description' => $db->escape_string($mybb->input['description']),
'regex' => $db->escape_string(str_replace("\x0", "", $mybb->input['regex'])),
'replacement' => $db->escape_string($mybb->input['replacement']),

				'description' => $db->escape_string($mybb->input['description']),
'regex' => $db->escape_string(str_replace("\x0", "", $mybb->input['regex'])),
'replacement' => $db->escape_string($mybb->input['replacement']),

				'active' => $db->escape_string($mybb->input['active']),
'parseorder' => (int)$mybb->input['parseorder']

				'active' => $mybb->get_input('active', MyBB::INPUT_INT),
'parseorder' => $mybb->get_input('parseorder', MyBB::INPUT_INT)

			);


			);


			$db->update_query("mycode", $updated_mycode, "cid='".$mybb->get_input('cid', 1)."'");



			$plugins->run_hooks("admin_config_mycode_edit_commit");

$db->update_query("mycode", $updated_mycode, "cid='{$mycode['cid']}'");


$cache->update_mycode();


$cache->update_mycode();


$plugins->run_hooks("admin_config_mycode_edit_commit");

// Log admin action
log_admin_action($mycode['cid'], $mybb->input['title']);



// Log admin action
log_admin_action($mycode['cid'], htmlspecialchars_uni($mybb->input['title']));




			flash_message($lang->success_updated_mycode, 'success');
admin_redirect('index.php?module=config-mycode');
}

			flash_message($lang->success_updated_mycode, 'success');
admin_redirect('index.php?module=config-mycode');
}

Zeile 276Zeile 276

$page->add_breadcrumb_item($lang->edit_mycode);
$page->output_header($lang->custom_mycode." - ".$lang->edit_mycode);


$page->add_breadcrumb_item($lang->edit_mycode);
$page->output_header($lang->custom_mycode." - ".$lang->edit_mycode);

	$page->output_nav_tabs($sub_tabs, 'edit_mycode');


	$page->output_nav_tabs($sub_tabs, 'edit_mycode');


	$form = new Form("index.php?module=config-mycode&amp;action=edit", "post", "edit");
echo $form->generate_hidden_field('cid', $mycode['cid']);


	$form = new Form("index.php?module=config-mycode&amp;action=edit", "post", "edit");
echo $form->generate_hidden_field('cid', $mycode['cid']);


Zeile 296Zeile 296
	$form_container->output_row($lang->regular_expression." <em>*</em>", $lang->regular_expression_desc.'<br /><strong>'.$lang->example.'</strong> \[b\](.*?)\[/b\]', $form->generate_text_area('regex', $mybb->input['regex'], array('id' => 'regex')), 'regex');
$form_container->output_row($lang->replacement." <em>*</em>", $lang->replacement_desc.'<br /><strong>'.$lang->example.'</strong> &lt;strong&gt;$1&lt;/strong&gt;', $form->generate_text_area('replacement', $mybb->input['replacement'], array('id' => 'replacement')), 'replacement');
$form_container->output_row($lang->enabled." <em>*</em>", '', $form->generate_yes_no_radio('active', $mybb->input['active']));

	$form_container->output_row($lang->regular_expression." <em>*</em>", $lang->regular_expression_desc.'<br /><strong>'.$lang->example.'</strong> \[b\](.*?)\[/b\]', $form->generate_text_area('regex', $mybb->input['regex'], array('id' => 'regex')), 'regex');
$form_container->output_row($lang->replacement." <em>*</em>", $lang->replacement_desc.'<br /><strong>'.$lang->example.'</strong> &lt;strong&gt;$1&lt;/strong&gt;', $form->generate_text_area('replacement', $mybb->input['replacement'], array('id' => 'replacement')), 'replacement');
$form_container->output_row($lang->enabled." <em>*</em>", '', $form->generate_yes_no_radio('active', $mybb->input['active']));

	$form_container->output_row($lang->parse_order, $lang->parse_order_desc, $form->generate_text_box('parseorder', $mybb->input['parseorder'], array('id' => 'parseorder')), 'parseorder');

	$form_container->output_row($lang->parse_order, $lang->parse_order_desc, $form->generate_numeric_field('parseorder', $mybb->input['parseorder'], array('id' => 'parseorder', 'min' => 0)), 'parseorder');

	$form_container->end();

$buttons[] = $form->generate_submit_button($lang->save_mycode);

	$form_container->end();

$buttons[] = $form->generate_submit_button($lang->save_mycode);

Zeile 328Zeile 328

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


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

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

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

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

if(!$mycode['cid'])

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

if(!$mycode['cid'])

Zeile 348Zeile 348
	if($mybb->request_method == "post")
{
$db->delete_query("mycode", "cid='{$mycode['cid']}'");

	if($mybb->request_method == "post")
{
$db->delete_query("mycode", "cid='{$mycode['cid']}'");


$cache->update_mycode();

 

$plugins->run_hooks("admin_config_mycode_delete_commit");


$plugins->run_hooks("admin_config_mycode_delete_commit");

 

$cache->update_mycode();


// Log admin action


// Log admin action

		log_admin_action($mycode['cid'], $mycode['title']);

		log_admin_action($mycode['cid'], htmlspecialchars_uni($mycode['title']));


flash_message($lang->success_deleted_mycode, 'success');
admin_redirect("index.php?module=config-mycode");


flash_message($lang->success_deleted_mycode, 'success');
admin_redirect("index.php?module=config-mycode");

Zeile 404Zeile 404

if($mycode['description'])
{


if($mycode['description'])
{

			$mycode['description'] = "<small>{$mycode['description']}</small>";

			$mycode['description'] = "<small>".htmlspecialchars_uni($mycode['description'])."</small>";

		}


		}


		$table->construct_cell("<div>{$icon}<strong><a href=\"index.php?module=config-mycode&amp;action=edit&amp;cid={$mycode['cid']}\">{$mycode['title']}</a></strong><br />{$mycode['description']}</div>");

		$table->construct_cell("<div>{$icon}<strong><a href=\"index.php?module=config-mycode&amp;action=edit&amp;cid={$mycode['cid']}\">".htmlspecialchars_uni($mycode['title'])."</a></strong><br />{$mycode['description']}</div>");


$popup = new PopupMenu("mycode_{$mycode['cid']}", $lang->options);
$popup->add_item($lang->edit_mycode, "index.php?module=config-mycode&amp;action=edit&amp;cid={$mycode['cid']}");


$popup = new PopupMenu("mycode_{$mycode['cid']}", $lang->options);
$popup->add_item($lang->edit_mycode, "index.php?module=config-mycode&amp;action=edit&amp;cid={$mycode['cid']}");

Zeile 428Zeile 428
	$page->output_footer();
}


	$page->output_footer();
}


 
/**
* @param string $regex
* @param string $replacement
* @param string $test
*
* @return array
*/

function test_regex($regex, $replacement, $test)
{
$array = array();

function test_regex($regex, $replacement, $test)
{
$array = array();