Vergleich admin/modules/style/templates.php - 1.6.0 - 1.6.6

  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: templates.php 5390 2011-03-17 15:23:41Z Tomm $

 */

// 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 385Zeile 385
		{
$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 423Zeile 429
			else
{
// Global template set

			else
{
// Global template set

				$db->update_query("templates", $template_array, "tid='{$template['tid']}' AND sid != '-2'");

				$db->update_query("templates", $template_array, "tid='{$template['tid']}' AND sid != '-2'");

			}

$plugins->run_hooks("admin_style_templates_edit_template_commit");

			}

$plugins->run_hooks("admin_style_templates_edit_template_commit");

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

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

				{

				{

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

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

				}

				}

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

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

Zeile 474Zeile 480
	
if($errors)
{

	
if($errors)
{

		$page->output_inline_error($errors);

 
		$template = $mybb->input;
}
else

		$template = $mybb->input;
}
else

Zeile 498Zeile 503
	if($mybb->input['from'] == "diff_report")
{
$page->add_breadcrumb_item($lang->find_updated, "index.php?module=style-templates&action=find_updated");

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

	}


	}


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

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

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

$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 511Zeile 517
		$sub_tabs['find_updated'] = array(
'title' => $lang->find_updated,
'link' => "index.php?module=style-templates&action=find_updated"

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

		);

		);

		
$sub_tabs['diff_report'] = array(
'title' => $lang->diff_report,
'link' => "index.php?module=style-templates&action=diff_report&title=".$db->escape_string($template['title'])."&sid1=".intval($template['sid'])."&sid2=-2",
);

		
$sub_tabs['diff_report'] = array(
'title' => $lang->diff_report,
'link' => "index.php?module=style-templates&action=diff_report&title=".$db->escape_string($template['title'])."&sid1=".intval($template['sid'])."&sid2=-2",
);

	}


	}


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

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

Zeile 526Zeile 532
	);

$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&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&action=edit_template{$expand_str}", "post", "edit_template");
echo $form->generate_hidden_field('tid', $template['tid'])."\n";


Zeile 537Zeile 548
		
$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 614Zeile 625
				
// Select all templates with that search term
$query = $db->query("

				
// Select all templates with that search term
$query = $db->query("

					SELECT t.tid, t.title, t.sid

					SELECT t.tid, t.title, t.sid, t.template

					FROM ".TABLE_PREFIX."templates t
LEFT JOIN ".TABLE_PREFIX."templatesets s ON (t.sid=s.sid)
LEFT JOIN ".TABLE_PREFIX."templates t2 ON (t.title=t2.title AND t2.sid='1')

					FROM ".TABLE_PREFIX."templates t
LEFT JOIN ".TABLE_PREFIX."templatesets s ON (t.sid=s.sid)
LEFT JOIN ".TABLE_PREFIX."templates t2 ON (t.title=t2.title AND t2.sid='1')

Zeile 997Zeile 1008

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


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

	{

	{

		$templatesets[$templateset['sid']] = $templateset;
}


		$templatesets[$templateset['sid']] = $templateset;
}


Zeile 1042Zeile 1053
		}

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&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}&from=diff_report");

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

			$popup->add_item($lang->diff_report, "index.php?module=style-templates&action=diff_report&title=".urlencode($template['title'])."&sid1=".$template['sid']."&sid2=-2");

			$popup->add_item($lang->diff_report, "index.php?module=style-templates&action=diff_report&title=".urlencode($template['title'])."&sid1=".$template['sid']."&sid2=-2&from=diff_report");

			$popup->add_item($lang->revert_to_orig, "index.php?module=style-templates&action=revert&title=".urlencode($template['title'])."&sid={$sid}&from=diff_report&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_revertion}')");

$table->construct_cell("<a href=\"index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;from=diff_report\">{$template['title']}</a>", array('width' => '80%'));

			$popup->add_item($lang->revert_to_orig, "index.php?module=style-templates&amp;action=revert&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;from=diff_report&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_revertion}')");

$table->construct_cell("<a href=\"index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;from=diff_report\">{$template['title']}</a>", array('width' => '80%'));

Zeile 1065Zeile 1076
			{
$table->output();
}

			{
$table->output();
}

		}
}


		}
}


	$page->output_footer();
}


	$page->output_footer();
}


Zeile 1082Zeile 1093
	if(!$set['sid'])
{
flash_message($lang->error_invalid_template_set, 'error');

	if(!$set['sid'])
{
flash_message($lang->error_invalid_template_set, 'error');

		admin_redirect("index.php?module=style-templates");
}

		admin_redirect("index.php?module=style-templates");
}

	
// Is there a theme attached to this set?
$query = $db->simple_select("themes", "properties");
while($theme = $db->fetch_array($query))

	
// Is there a theme attached to this set?
$query = $db->simple_select("themes", "properties");
while($theme = $db->fetch_array($query))

	{

	{

		$properties = @unserialize($theme['properties']);
if($properties['templateset'] == $sid)
{

		$properties = @unserialize($theme['properties']);
if($properties['templateset'] == $sid)
{

Zeile 1096Zeile 1107
			admin_redirect("index.php?module=style-templates");
break;
}

			admin_redirect("index.php?module=style-templates");
break;
}

	}

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

	}

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

		admin_redirect("index.php?module=style-templates");
}

		admin_redirect("index.php?module=style-templates");
}





	if($mybb->request_method == "post")
{
// Delete the templateset

	if($mybb->request_method == "post")
{
// Delete the templateset

Zeile 1117Zeile 1128
		log_admin_action($set['sid'], $set['title']);

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

		log_admin_action($set['sid'], $set['title']);

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

		admin_redirect("index.php?module=style-templates");

		admin_redirect("index.php?module=style-templates");

	}
else
{
$page->output_confirm_action("index.php?module=style-templates&amp;action=delete_set&amp;sid={$set['sid']}", $lang->confirm_template_set_deletion);

	}
else
{
$page->output_confirm_action("index.php?module=style-templates&amp;action=delete_set&amp;sid={$set['sid']}", $lang->confirm_template_set_deletion);

	}

	}

	
}


	
}


Zeile 1135Zeile 1146
		FROM ".TABLE_PREFIX."templates t
LEFT JOIN ".TABLE_PREFIX."templatesets s ON(t.sid=s.sid)
WHERE t.title='".$db->escape_string($mybb->input['title'])."' AND t.sid > '-2' AND t.sid = '{$sid}'

		FROM ".TABLE_PREFIX."templates t
LEFT JOIN ".TABLE_PREFIX."templatesets s ON(t.sid=s.sid)
WHERE t.title='".$db->escape_string($mybb->input['title'])."' AND t.sid > '-2' AND t.sid = '{$sid}'

	");
$template = $db->fetch_array($query);

// Does the template not exist?
if(!$template)
{
flash_message($lang->error_invalid_template, 'error');
admin_redirect("index.php?module=style-templates");
}

// User clicked no
if($mybb->input['no'])
{
admin_redirect("index.php?module=style-templates&sid={$template['sid']}{$expand_str2}");
}

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

	");
$template = $db->fetch_array($query);

// Does the template not exist?
if(!$template)
{
flash_message($lang->error_invalid_template, 'error');
admin_redirect("index.php?module=style-templates");
}

// User clicked no
if($mybb->input['no'])
{
admin_redirect("index.php?module=style-templates&sid={$template['sid']}{$expand_str2}");
}

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

	{
// Delete the template
$db->delete_query("templates", "tid='{$template['tid']}'");

	{
// Delete the template
$db->delete_query("templates", "tid='{$template['tid']}'");

Zeile 1171Zeile 1182
}

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

}

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

{

{

	// Compares a template of sid1 with that of sid2, if no sid1, it is assumed -2
if(!$mybb->input['sid1'])

	// Compares a template of sid1 with that of sid2, if no sid1, it is assumed -2
if(!$mybb->input['sid1'])

	{

	{

		$mybb->input['sid1'] = -2;

		$mybb->input['sid1'] = -2;

	}

	}

	
if($mybb->input['sid2'] == -2)

	
if($mybb->input['sid2'] == -2)

	{

	{

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

 
	}

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

	}

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

	}

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

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

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

		'description' => $lang->diff_report_desc
);

		'description' => $lang->diff_report_desc
);

	

	

	$plugins->run_hooks("admin_style_templates_diff_report");

$query = $db->simple_select("templates", "*", "title='".$db->escape_string($mybb->input['title'])."' AND sid='".intval($mybb->input['sid1'])."'");

	$plugins->run_hooks("admin_style_templates_diff_report");

$query = $db->simple_select("templates", "*", "title='".$db->escape_string($mybb->input['title'])."' AND sid='".intval($mybb->input['sid1'])."'");

Zeile 1234Zeile 1250
		$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->diff_report.": ".$template1['title'], "index.php?module=style-templates&amp;action=diff_report&amp;title=".$db->escape_string($mybb->input['title'])."&amp;sid1=".intval($mybb->input['sid1'])."&amp;sid2=".intval($mybb->input['sid2']));

	$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_header($lang->template_sets);


Zeile 1242Zeile 1258
	
$table = new Table;


	
$table = new Table;


	$table->construct_header("<ins>".$lang->master_updated_ins."</ins><br /><del>".$lang->master_updated_del."</del>");









	if($mybb->input['from'])
{
$table->construct_header("<ins>".$lang->master_updated_ins."</ins><br /><del>".$lang->master_updated_del."</del>");
}
else
{
$table->construct_header("<ins>".$lang->master_updated_del."</ins><br /><del>".$lang->master_updated_ins."</del>");
}


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

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

}

}


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 1269Zeile 1292
	{
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 1307Zeile 1330
if($mybb->input['sid'] && !$mybb->input['action'])
{
$plugins->run_hooks("admin_style_templates_set");

if($mybb->input['sid'] && !$mybb->input['action'])
{
$plugins->run_hooks("admin_style_templates_set");

	

	

	$table = new Table;

	$table = new Table;

	
$page->extra_header .= '<script type="text/javascript">
Event.observe(document, "dom:loaded", function() {
var lastelement = \'\';
link_preview_template_list = $$(\'a.preview_template_list\');
link_preview_template_list.each(function(element) {
Event.observe(element, "mouseover", function(event) { if(lastelement != \'\') { $(lastelement).hide(); } listelement = Event.element(event); $(listelement.id.replace("preview_", "")).show(); lastelement = listelement.id.replace("preview_", ""); } );

Event.observe(element, "mouseout", function(event) { listelement = Event.element(event); $(listelement.id.replace("preview_", "")).hide(); lastelement = \'\'; } );
});
});
</script>';

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


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


Zeile 1524Zeile 1535
		}
else if(isset($group['templates']) && count($group['templates']) > 0)
{

		}
else if(isset($group['templates']) && count($group['templates']) > 0)
{

			$table->construct_cell("<strong><a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\" class=\"preview_template_list\" id=\"preview_template_list_{$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']));

		}
}


		}
}


Zeile 1549Zeile 1560
	{
$tbits = unserialize($theme['properties']);
$themes[$tbits['templateset']][$theme['tid']] = $theme['name'];

	{
$tbits = unserialize($theme['properties']);
$themes[$tbits['templateset']][$theme['tid']] = $theme['name'];

	}

	}

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

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

Zeile 1573Zeile 1584
			$table->construct_cell("<a href=\"index.php?module=style-templates&amp;sid=-1\">{$lang->expand_templates}</a>", array("class" => "align_center"));
$table->construct_row();
continue;

			$table->construct_cell("<a href=\"index.php?module=style-templates&amp;sid=-1\">{$lang->expand_templates}</a>", array("class" => "align_center"));
$table->construct_row();
continue;

		}

		}

		
if($themes[$set['sid']])
{

		
if($themes[$set['sid']])
{

Zeile 1583Zeile 1594
			{
$used_by_note .= $comma.$theme_name;
$comma = $lang->comma;

			{
$used_by_note .= $comma.$theme_name;
$comma = $lang->comma;

			}
}
else

			}
}
else

		{
$used_by_note = $lang->not_used_by_any_themes;
}

		{
$used_by_note = $lang->not_used_by_any_themes;
}

Zeile 1621Zeile 1632

$page->output_footer();
}


$page->output_footer();
}



 
?>

?>