Vergleich admin/modules/style/templates.php - 1.6.4 - 1.6.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: templates.php 5390 2011-03-17 15:23:41Z Tomm $

 * $Id$

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 179Zeile 179
		{
$errors[] = $lang->error_invalid_set;
}

		{
$errors[] = $lang->error_invalid_set;
}

		








// Are we trying to do malicious things in our template?
if(check_template($mybb->input['template']))
{
$errors[] = $lang->error_security_problem;
}


		if(!$errors)
{
$template_array = array(

		if(!$errors)
{
$template_array = array(

Zeile 255Zeile 261
	$page->output_nav_tabs($sub_tabs, 'add_template');

if($errors)

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

if($errors)

	{

	{

		$page->output_inline_error($errors);
}


		$page->output_inline_error($errors);
}


	$form = new Form("index.php?module=style-templates&action=add_template{$expand_str}", "post", "add_template");


	$form = new Form("index.php?module=style-templates&action=add_template{$expand_str}", "post", "add_template");


	$form_container = new FormContainer($lang->add_template);
$form_container->output_row($lang->template_name, $lang->template_name_desc, $form->generate_text_box('title', $template['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->template_set, $lang->template_set_desc, $form->generate_select_box('sid', $template_sets, $sid), 'sid');

	$form_container = new FormContainer($lang->add_template);
$form_container->output_row($lang->template_name, $lang->template_name_desc, $form->generate_text_box('title', $template['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->template_set, $lang->template_set_desc, $form->generate_select_box('sid', $template_sets, $sid), 'sid');

Zeile 275Zeile 281
	$form->end();

if($admin_options['codepress'] != 0)

	$form->end();

if($admin_options['codepress'] != 0)

	{

	{

		echo "<script type=\"text/javascript\">
Event.observe('add_template', 'submit', function()
{

		echo "<script type=\"text/javascript\">
Event.observe('add_template', 'submit', function()
{

Zeile 330Zeile 336
	}

$page->add_breadcrumb_item($lang->edit_set);

	}

$page->add_breadcrumb_item($lang->edit_set);

	
$page->output_header($lang->edit_set);


	
$page->output_header($lang->edit_set);


	$sub_tabs = array();
$sub_tabs['edit_set'] = array(
'title' => $lang->edit_set,

	$sub_tabs = array();
$sub_tabs['edit_set'] = array(
'title' => $lang->edit_set,

Zeile 497Zeile 503
		CodePress.language = \'mybb\';
</script>';
}

		CodePress.language = \'mybb\';
</script>';
}

	



	$page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&amp;sid={$sid}{$expand_str}");

	$page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&amp;sid={$sid}{$expand_str}");

	
if($mybb->input['from'] == "diff_report")







if(!isset($mybb->input['from']))
{
$mybb->input['from'] = '';
}

if($mybb->input['from'] == "diff_report")

	{
$page->add_breadcrumb_item($lang->find_updated, "index.php?module=style-templates&amp;action=find_updated");
}

	{
$page->add_breadcrumb_item($lang->find_updated, "index.php?module=style-templates&amp;action=find_updated");
}

	



	$page->add_breadcrumb_item($lang->edit_template_breadcrumb.$template['title'], "index.php?module=style-templates&amp;sid={$sid}");

	$page->add_breadcrumb_item($lang->edit_template_breadcrumb.$template['title'], "index.php?module=style-templates&amp;sid={$sid}");

	

 
	$page->output_header($lang->edit_template);

	$page->output_header($lang->edit_template);



 

$sub_tabs = array();


$sub_tabs = array();

	
if($mybb->input['from'] == "diff_report")
{

	
if($mybb->input['from'] == "diff_report")
{

		$sub_tabs['find_updated'] = array(
'title' => $lang->find_updated,
'link' => "index.php?module=style-templates&amp;action=find_updated"

		$sub_tabs['find_updated'] = array(
'title' => $lang->find_updated,
'link' => "index.php?module=style-templates&amp;action=find_updated"

Zeile 530Zeile 539
		'link' => "index.php?module=style-templates&amp;action=edit_template&amp;title=".htmlspecialchars_uni($template['title']).$expand_str,
'description' => $lang->edit_template_desc
);

		'link' => "index.php?module=style-templates&amp;action=edit_template&amp;title=".htmlspecialchars_uni($template['title']).$expand_str,
'description' => $lang->edit_template_desc
);

	

	

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

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





	if($errors)

	if($errors)

	{

	{

		$page->output_inline_error($errors);

		$page->output_inline_error($errors);

	}

	}


$form = new Form("index.php?module=style-templates&amp;action=edit_template{$expand_str}", "post", "edit_template");
echo $form->generate_hidden_field('tid', $template['tid'])."\n";


$form = new Form("index.php?module=style-templates&amp;action=edit_template{$expand_str}", "post", "edit_template");
echo $form->generate_hidden_field('tid', $template['tid'])."\n";

Zeile 548Zeile 557
		
$form_container = new FormContainer($lang->edit_template_breadcrumb.$template['title']);
$form_container->output_row($lang->template_name, $lang->template_name_desc, $form->generate_text_box('title', $template['title'], array('id' => 'title')), 'title');

		
$form_container = new FormContainer($lang->edit_template_breadcrumb.$template['title']);
$form_container->output_row($lang->template_name, $lang->template_name_desc, $form->generate_text_box('title', $template['title'], array('id' => 'title')), 'title');





	// Force users to save the default template to a specific set, rather than the "global" templates - where they can delete it
if($template['sid'] == "-2")
{

	// Force users to save the default template to a specific set, rather than the "global" templates - where they can delete it
if($template['sid'] == "-2")
{

Zeile 635Zeile 644
				if($db->num_rows($query) == 0)
{
$table->construct_cell($lang->sprintf($lang->search_noresults, htmlspecialchars_uni($mybb->input['find'])), array("class" => "align_center"));

				if($db->num_rows($query) == 0)
{
$table->construct_cell($lang->sprintf($lang->search_noresults, htmlspecialchars_uni($mybb->input['find'])), array("class" => "align_center"));

					
$table->construct_row();

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

					
$table->construct_row();

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

				}
else
{

				}
else
{

Zeile 660Zeile 669
						{
// Do replacement
$newtemplate = str_ireplace($mybb->input['find'], $mybb->input['replace'], $template['template']);

						{
// Do replacement
$newtemplate = str_ireplace($mybb->input['find'], $mybb->input['replace'], $template['template']);

							if($newtemplate != $template['template'])

							if($newtemplate != $template['template'] && check_template($newtemplate) === false)

							{
// If the template is different, that means the search term has been found.
if(trim($mybb->input['replace']) != "")

							{
// If the template is different, that means the search term has been found.
if(trim($mybb->input['replace']) != "")

Zeile 1234Zeile 1243
	$template2['template'] = explode("\n", $template2['template']);

$plugins->run_hooks("admin_style_templates_diff_report_run");

	$template2['template'] = explode("\n", $template2['template']);

$plugins->run_hooks("admin_style_templates_diff_report_run");

	require_once MYBB_ROOT."inc/3rdparty/diff/Diff.php";	
require_once MYBB_ROOT."inc/3rdparty/diff/Diff/Renderer/inline.php";

 




	$diff = new Text_Diff('auto', array($template1['template'], $template2['template']));
$renderer = new Text_Diff_Renderer_inline();






	require_once MYBB_ROOT."inc/3rdparty/diff/Diff.php";
require_once MYBB_ROOT."inc/3rdparty/diff/Diff/Renderer.php";
require_once MYBB_ROOT."inc/3rdparty/diff/Diff/Renderer/Inline.php";

$diff = new Horde_Text_Diff('auto', array($template1['template'], $template2['template']));
$renderer = new Horde_Text_Diff_Renderer_Inline();


	if($sid)

	if($sid)

	{

	{

		$page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&amp;sid={$sid}{$expand_str}");

		$page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&amp;sid={$sid}{$expand_str}");

	}


	}


	if($mybb->input['sid2'] == -2)
{
$page->add_breadcrumb_item($lang->find_updated, "index.php?module=style-templates&amp;action=find_updated");

	if($mybb->input['sid2'] == -2)
{
$page->add_breadcrumb_item($lang->find_updated, "index.php?module=style-templates&amp;action=find_updated");

	}

$page->add_breadcrumb_item($lang->diff_report.": ".$template1['title'], "index.php?module=style-templates&amp;action=diff_report&amp;title=".$db->escape_string($mybb->input['title'])."&amp;from=".$mybb->input['from']."&amp;sid1=".intval($mybb->input['sid1'])."&amp;sid2=".intval($mybb->input['sid2']));

$page->output_header($lang->template_sets);

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


	}

$page->add_breadcrumb_item($lang->diff_report.": ".$template1['title'], "index.php?module=style-templates&amp;action=diff_report&amp;title=".$db->escape_string($mybb->input['title'])."&amp;from=".$mybb->input['from']."&amp;sid1=".intval($mybb->input['sid1'])."&amp;sid2=".intval($mybb->input['sid2']));

$page->output_header($lang->template_sets);

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


	$table = new Table;

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

	$table = new Table;

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

Zeile 1313Zeile 1324
		flash_message($lang->success_template_reverted, 'success');

if($mybb->input['from'] == "diff_report")

		flash_message($lang->success_template_reverted, 'success');

if($mybb->input['from'] == "diff_report")

		{

		{

			admin_redirect("index.php?module=style-templates&action=find_updated");
}
else

			admin_redirect("index.php?module=style-templates&action=find_updated");
}
else

Zeile 1332Zeile 1343
	$plugins->run_hooks("admin_style_templates_set");

$table = new Table;

	$plugins->run_hooks("admin_style_templates_set");

$table = new Table;

	

	

	$page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&amp;sid={$sid}");

$page->output_header($lang->template_sets);

	$page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&amp;sid={$sid}");

$page->output_header($lang->template_sets);

Zeile 1368Zeile 1379
	
$page->output_footer();
}

	
$page->output_footer();
}

	
if($mybb->input['expand'] == 'all')






if(!isset($mybb->input['expand']))
{
$mybb->input['expand'] = '';
}
if($mybb->input['expand'] == 'all')

	{
// If we're expanding everything, stick in the ungrouped templates in the list as well
$expand_array = array(-1);

	{
// If we're expanding everything, stick in the ungrouped templates in the list as well
$expand_array = array(-1);

Zeile 1388Zeile 1403
			$templategroup['expanded'] = 1;
}
$template_groups[$templategroup['prefix']] = $templategroup;

			$templategroup['expanded'] = 1;
}
$template_groups[$templategroup['prefix']] = $templategroup;

	}


	}


	function sort_template_groups($a, $b)
{
return strcasecmp($a['title'], $b['title']);

	function sort_template_groups($a, $b)
{
return strcasecmp($a['title'], $b['title']);

Zeile 1402Zeile 1417
		"title" => $lang->ungrouped_templates,
"gid" => -1
);

		"title" => $lang->ungrouped_templates,
"gid" => -1
);

	



	// Load the list of templates
$query = $db->simple_select("templates", "*", "sid='".intval($mybb->input['sid'])."' OR sid='-2'", array('order_by' => 'sid DESC, title', 'order_dir' => 'ASC'));
while($template = $db->fetch_array($query))
{
$exploded = explode("_", $template['title'], 2);

	// Load the list of templates
$query = $db->simple_select("templates", "*", "sid='".intval($mybb->input['sid'])."' OR sid='-2'", array('order_by' => 'sid DESC, title', 'order_dir' => 'ASC'));
while($template = $db->fetch_array($query))
{
$exploded = explode("_", $template['title'], 2);

		



		if(isset($template_groups[$exploded[0]]))
{
$group = $exploded[0];

		if(isset($template_groups[$exploded[0]]))
{
$group = $exploded[0];

Zeile 1417Zeile 1432
		{
$group = -1;
}

		{
$group = -1;
}

		$template['gid'] = $template_groups[$exploded[0]]['gid'];

 




		// Ungrouped template?
if(!$template['gid'])

		$template['gid'] = -1;
if(isset($template_groups[$exploded[0]]['gid']))

		{

		{

			$template['gid'] = -1;

			$template['gid'] = $template_groups[$exploded[0]]['gid'];

		}

// If this template is not a master template, we simple add it to the list

		}

// If this template is not a master template, we simple add it to the list

Zeile 1559Zeile 1573
	while($theme = $db->fetch_array($query))
{
$tbits = unserialize($theme['properties']);

	while($theme = $db->fetch_array($query))
{
$tbits = unserialize($theme['properties']);

		$themes[$tbits['templateset']][$theme['tid']] = $theme['name'];

		$themes[$tbits['templateset']][$theme['tid']] = htmlspecialchars_uni($theme['name']);

	}

$template_sets = array();

	}

$template_sets = array();