Vergleich admin/modules/style/templates.php - 1.6.1 - 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 5150 2010-07-31 01:46:18Z RyanGordon $

 * $Id$

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 60Zeile 60
		'description' => $lang->find_updated_desc
);
}

		'description' => $lang->find_updated_desc
);
}

else if(($sid && !$mybb->input['action']) || $mybb->input['action'] == "edit_set" || $mybb->input['action'] == "edit_template")

else if(($sid && !$mybb->input['action']) || $mybb->input['action'] == "edit_set" || $mybb->input['action'] == "check_set" || $mybb->input['action'] == "edit_template")

{
$sub_tabs['manage_templates'] = array(
'title' => $lang->manage_templates,

{
$sub_tabs['manage_templates'] = array(
'title' => $lang->manage_templates,

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 201Zeile 207
			flash_message($lang->success_template_saved, 'success');

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

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

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

			{

			{

				admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".$sid.$expand_str2);
}
else

				admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".$sid.$expand_str2);
}
else

Zeile 357Zeile 363
	
$form_container = new FormContainer($lang->edit_set);
$form_container->output_row($lang->title, "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');

	
$form_container = new FormContainer($lang->edit_set);
$form_container->output_row($lang->title, "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');

	$form_container->end();


	$form_container->end();


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


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


Zeile 385Zeile 391
		{
$errors[] = $lang->error_missing_title;
}

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

		








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


		if(!$errors)
{
$query = $db->simple_select("templates", "*", "tid='{$mybb->input['tid']}'");

		if(!$errors)
{
$query = $db->simple_select("templates", "*", "tid='{$mybb->input['tid']}'");

Zeile 403Zeile 415
			// Make sure we have the correct tid associated with this template. If the user double submits then the tid could originally be the master template tid, but because the form is sumbitted again, the tid doesn't get updated to the new modified template one. This then causes the master template to be overwritten
$query = $db->simple_select("templates", "tid", "title='".$db->escape_string($template['title'])."' AND (sid = '-2' OR sid = '{$template['sid']}')", array('order_by' => 'sid', 'order_dir' => 'desc', 'limit' => 1));
$template['tid'] = $db->fetch_field($query, "tid");

			// Make sure we have the correct tid associated with this template. If the user double submits then the tid could originally be the master template tid, but because the form is sumbitted again, the tid doesn't get updated to the new modified template one. This then causes the master template to be overwritten
$query = $db->simple_select("templates", "tid", "title='".$db->escape_string($template['title'])."' AND (sid = '-2' OR sid = '{$template['sid']}')", array('order_by' => 'sid', 'order_dir' => 'desc', 'limit' => 1));
$template['tid'] = $db->fetch_field($query, "tid");

			

			

			if($sid > 0)
{
// Check to see if it's never been edited before (i.e. master) of if this a new template (i.e. we've renamed it) or if it's a custom template

			if($sid > 0)
{
// Check to see if it's never been edited before (i.e. master) of if this a new template (i.e. we've renamed it) or if it's a custom template

Zeile 448Zeile 460
			flash_message($lang->success_template_saved, 'success');

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

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

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

			{

			{

				if($mybb->input['from'] == "diff_report")
{
admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".intval($mybb->input['sid']).$expand_str2."&from=diff_report");
}

				if($mybb->input['from'] == "diff_report")
{
admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".intval($mybb->input['sid']).$expand_str2."&from=diff_report");
}

				else
{
admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".intval($mybb->input['sid']).$expand_str2);
}
}

				else
{
admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".intval($mybb->input['sid']).$expand_str2);
}
}

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

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

Zeile 470Zeile 482
				}
}
}

				}
}
}

	}

	}

	
if($errors)

	
if($errors)

	{
$page->output_inline_error($errors);

	{


		$template = $mybb->input;

		$template = $mybb->input;

	}

	}

	else
{
$query = $db->simple_select("templates", "*", "title='".$db->escape_string($mybb->input['title'])."' AND (sid='-2' OR sid='{$sid}')", array('order_by' => 'sid', 'order_dir' => 'DESC', 'limit' => 1));
$template = $db->fetch_array($query);

	else
{
$query = $db->simple_select("templates", "*", "title='".$db->escape_string($mybb->input['title'])."' AND (sid='-2' OR sid='{$sid}')", array('order_by' => 'sid', 'order_dir' => 'DESC', 'limit' => 1));
$template = $db->fetch_array($query);

	}

	}

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

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

Zeile 492Zeile 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(!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");
}

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

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

	$sub_tabs = array();

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

Zeile 526Zeile 541
	);

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

	);

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

	







if($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 537Zeile 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 649Zeile 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 1042Zeile 1062
		}

foreach($templates as $template)

		}

foreach($templates as $template)

		{		

		{

			$popup = new PopupMenu("template_{$template['tid']}", $lang->options);
$popup->add_item($lang->full_edit, "index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;from=diff_report");
$popup->add_item($lang->diff_report, "index.php?module=style-templates&amp;action=diff_report&amp;title=".urlencode($template['title'])."&amp;sid1=".$template['sid']."&amp;sid2=-2&amp;from=diff_report");

			$popup = new PopupMenu("template_{$template['tid']}", $lang->options);
$popup->add_item($lang->full_edit, "index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;from=diff_report");
$popup->add_item($lang->diff_report, "index.php?module=style-templates&amp;action=diff_report&amp;title=".urlencode($template['title'])."&amp;sid1=".$template['sid']."&amp;sid2=-2&amp;from=diff_report");

Zeile 1223Zeile 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}");
}

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

	}


	}


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

Zeile 1257Zeile 1279
	}

$table->construct_cell("<pre class=\"differential\">".$renderer->render($diff)."</pre>");

	}

$table->construct_cell("<pre class=\"differential\">".$renderer->render($diff)."</pre>");

	$table->construct_row();


	$table->construct_row();


	$table->output($lang->template_diff_analysis.": ".$template1['title']);

$page->output_footer();

	$table->output($lang->template_diff_analysis.": ".$template1['title']);

$page->output_footer();

Zeile 1267Zeile 1289
if($mybb->input['action'] == "revert")
{
$plugins->run_hooks("admin_style_templates_revert");

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

	

	

	$query = $db->query("
SELECT t.*, s.title as set_title
FROM ".TABLE_PREFIX."templates t

	$query = $db->query("
SELECT t.*, s.title as set_title
FROM ".TABLE_PREFIX."templates t

Zeile 1281Zeile 1303
	{
flash_message($lang->error_invalid_template, 'error');
admin_redirect("index.php?module=style-templates");

	{
flash_message($lang->error_invalid_template, 'error');
admin_redirect("index.php?module=style-templates");

	}

	}

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

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

Zeile 1348Zeile 1370
		}

if($table->num_rows() == 0)

		}

if($table->num_rows() == 0)

		{

		{

			$table->construct_cell($lang->no_global_templates, array('colspan' => 2));
$table->construct_row();
}

			$table->construct_cell($lang->no_global_templates, array('colspan' => 2));
$table->construct_row();
}

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

	
$page->output_footer();
}

	






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

	if($mybb->input['expand'] == 'all')
{
// If we're expanding everything, stick in the ungrouped templates in the list as well

Zeile 1391Zeile 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]]))

		if(isset($template_groups[$exploded[0]]))

		{

		{

			$group = $exploded[0];

			$group = $exploded[0];

		}

		}

		else

		else

		{

		{

			$group = -1;

			$group = -1;

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

// Ungrouped template?
if(!$template['gid'])
{
$template['gid'] = -1;

		}

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


		}

// If this template is not a master template, we simple add it to the list
if($template['sid'] != -2)
{
$template['original'] = false;

		}

// If this template is not a master template, we simple add it to the list
if($template['sid'] != -2)
{
$template['original'] = false;

			$template['modified'] = false;
$template_groups[$group]['templates'][$template['title']] = $template;

			$template['modified'] = false;
$template_groups[$group]['templates'][$template['title']] = $template;

		}
else if(!in_array($template['gid'], $expand_array) && !isset($expand_array[-1]))

		}
else if(!in_array($template['gid'], $expand_array) && !isset($expand_array[-1]))

		{

		{

			$template['original'] = true;
$template['modified'] = false;
$template_groups[$group]['templates'][$template['title']] = $template;

			$template['original'] = true;
$template['modified'] = false;
$template_groups[$group]['templates'][$template['title']] = $template;

Zeile 1441Zeile 1466
			}
// Template has been modified in the set we have expanded (it doesn't match the master)
else if($template_groups[$group]['templates'][$template['title']]['template'] != $template['template'] && $template_groups[$group]['templates'][$template['title']]['sid'] != -2)

			}
// Template has been modified in the set we have expanded (it doesn't match the master)
else if($template_groups[$group]['templates'][$template['title']]['template'] != $template['template'] && $template_groups[$group]['templates'][$template['title']]['sid'] != -2)

			{

			{

				$template_groups[$group]['templates'][$template['title']]['modified'] = true;
}


				$template_groups[$group]['templates'][$template['title']]['modified'] = true;
}


Zeile 1454Zeile 1479
	{	
$tmp_expand = "";
if(in_array($group['gid'], $expand_array))

	{	
$tmp_expand = "";
if(in_array($group['gid'], $expand_array))

		{

		{

			$expand = $lang->collapse;
$expanded = true;


			$expand = $lang->collapse;
$expanded = true;


Zeile 1462Zeile 1487
			$unsetgid = array_search($group['gid'], $tmp_expand);
unset($tmp_expand[$unsetgid]);
$group['expand_str'] = implode("|", $tmp_expand);

			$unsetgid = array_search($group['gid'], $tmp_expand);
unset($tmp_expand[$unsetgid]);
$group['expand_str'] = implode("|", $tmp_expand);

		}
else
{

		}
else
{

			$expand = $lang->expand;
$expanded = false;


			$expand = $lang->expand;
$expanded = false;


Zeile 1474Zeile 1499
				$group['expand_str'] .= "|";
}
$group['expand_str'] .= $group['gid'];

				$group['expand_str'] .= "|";
}
$group['expand_str'] .= $group['gid'];

		}


		}


		if($group['expand_str'])
{
$group['expand_str'] = "&amp;expand={$group['expand_str']}";

		if($group['expand_str'])
{
$group['expand_str'] = "&amp;expand={$group['expand_str']}";

Zeile 1486Zeile 1511
			$table->construct_cell("<strong><a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>");
$table->construct_cell("<a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$expand}</a>", array("class" => "align_center"));
$table->construct_row(array("class" => "alt_row", "id" => "group_".$group['gid'], "name" => "group_".$group['gid']));

			$table->construct_cell("<strong><a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>");
$table->construct_cell("<a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$expand}</a>", array("class" => "align_center"));
$table->construct_row(array("class" => "alt_row", "id" => "group_".$group['gid'], "name" => "group_".$group['gid']));

		

		

			$templates = $group['templates'];
ksort($templates);


			$templates = $group['templates'];
ksort($templates);


Zeile 1527Zeile 1552
			$table->construct_cell("<strong><a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>");
$table->construct_cell("<a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$expand}</a>", array("class" => "align_center"));
$table->construct_row(array("class" => "alt_row", "id" => "group_".$group['gid'], "name" => "group_".$group['gid']));

			$table->construct_cell("<strong><a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>");
$table->construct_cell("<a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$expand}</a>", array("class" => "align_center"));
$table->construct_row(array("class" => "alt_row", "id" => "group_".$group['gid'], "name" => "group_".$group['gid']));

		}
}

$table->output($template_sets[$sid]);


		}
}

$table->output($template_sets[$sid]);


	$page->output_footer();
}


	$page->output_footer();
}


Zeile 1541Zeile 1566
	
$page->output_header($lang->template_sets);


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


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


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


	$themes = array();
$query = $db->simple_select("themes", "name,tid,properties", "tid != '1'");
while($theme = $db->fetch_array($query))
{
$tbits = unserialize($theme['properties']);

	$themes = array();
$query = $db->simple_select("themes", "name,tid,properties", "tid != '1'");
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[-1]['title'] = $lang->global_templates;
$template_sets[-1]['sid'] = -1;

	}

$template_sets = array();
$template_sets[-1]['title'] = $lang->global_templates;
$template_sets[-1]['sid'] = -1;





	$query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title', 'order_dir' => 'ASC'));
while($template_set = $db->fetch_array($query))
{

	$query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title', 'order_dir' => 'ASC'));
while($template_set = $db->fetch_array($query))
{

Zeile 1621Zeile 1646

$page->output_footer();
}


$page->output_footer();
}



 
?>

?>