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

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 47Zeile 47
		'title' => $lang->add_template,
'link' => "index.php?module=style-templates&action=add_template{$expand_str}"
);

		'title' => $lang->add_template,
'link' => "index.php?module=style-templates&action=add_template{$expand_str}"
);

	



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

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

	



	$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",

Zeile 98Zeile 98
if($mybb->input['action'] == "add_set")
{
$plugins->run_hooks("admin_style_templates_add_set");

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

	



	if($mybb->request_method == "post")
{
if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_set_title;
}

	if($mybb->request_method == "post")
{
if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_set_title;
}

		



		if(!$errors)
{
$sid = $db->insert_query("templatesets", array('title' => $db->escape_string($mybb->input['title'])));

		if(!$errors)
{
$sid = $db->insert_query("templatesets", array('title' => $db->escape_string($mybb->input['title'])));

			



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

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

			



			flash_message($lang->success_template_set_saved, 'success');
admin_redirect("index.php?module=style-templates&sid=".$sid);
}
}

			flash_message($lang->success_template_set_saved, 'success');
admin_redirect("index.php?module=style-templates&sid=".$sid);
}
}

	



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

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

	



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

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

	



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

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

	



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

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

	



	if($errors)
{
$page->output_inline_error($errors);

	if($errors)
{
$page->output_inline_error($errors);

Zeile 139Zeile 139
	{
$mybb->input['title'] = "";
}

	{
$mybb->input['title'] = "";
}

	



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

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

	



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

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

	



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

$form->output_submit_wrapper($buttons);

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

$form->output_submit_wrapper($buttons);

	



	$form->end();

$page->output_footer();

	$form->end();

$page->output_footer();

Zeile 159Zeile 159
if($mybb->input['action'] == "add_template")
{
$plugins->run_hooks("admin_style_templates_add_template");

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

	



	if($mybb->request_method == "post")
{
if(empty($mybb->input['title']))

	if($mybb->request_method == "post")
{
if(empty($mybb->input['title']))

Zeile 167Zeile 167
			$errors[] = $lang->error_missing_set_title;
}
else

			$errors[] = $lang->error_missing_set_title;
}
else

		{	

		{

			$query = $db->simple_select("templates", "COUNT(tid) as count", "title='".$db->escape_string($mybb->input['title'])."' AND (sid = '-2' OR sid = '{$sid}')");
if($db->fetch_field($query, "count") > 0)
{
$errors[] = $lang->error_already_exists;
}
}

			$query = $db->simple_select("templates", "COUNT(tid) as count", "title='".$db->escape_string($mybb->input['title'])."' AND (sid = '-2' OR sid = '{$sid}')");
if($db->fetch_field($query, "count") > 0)
{
$errors[] = $lang->error_already_exists;
}
}

		



		if(!isset($template_sets[$sid]))
{
$errors[] = $lang->error_invalid_set;

		if(!isset($template_sets[$sid]))
{
$errors[] = $lang->error_invalid_set;

Zeile 196Zeile 196
				'status' => '',
'dateline' => TIME_NOW
);

				'status' => '',
'dateline' => TIME_NOW
);

						



			$tid = $db->insert_query("templates", $template_array);

			$tid = $db->insert_query("templates", $template_array);

			



			$plugins->run_hooks("admin_style_templates_add_template_commit");

			$plugins->run_hooks("admin_style_templates_add_template_commit");

			



			// Log admin action
log_admin_action($tid, $mybb->input['title'], $sid, $template_sets[$sid]);

			// Log admin action
log_admin_action($tid, $mybb->input['title'], $sid, $template_sets[$sid]);

			



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

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

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

Zeile 216Zeile 216
			}
}
}

			}
}
}

	



	if($errors)
{
$template = $mybb->input;

	if($errors)
{
$template = $mybb->input;

Zeile 227Zeile 227
		{
$sid = -1;
}

		{
$sid = -1;
}

		



		$template['template'] = "";
$template['sid'] = $sid;
}

		$template['template'] = "";
$template['sid'] = $sid;
}

	



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

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

	



	if($admin_options['codepress'] != 0)
{
$page->extra_header .= '

	if($admin_options['codepress'] != 0)
{
$page->extra_header .= '

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

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

	



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

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

	



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

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

	



	$sub_tabs = array();
$sub_tabs['add_template'] = array(
'title' => $lang->add_template,
'link' => "index.php?module=style-templates&amp;action=add_template&amp;sid=".$template['sid'].$expand_str,
'description' => $lang->add_template_desc
);

	$sub_tabs = array();
$sub_tabs['add_template'] = array(
'title' => $lang->add_template,
'link' => "index.php?module=style-templates&amp;action=add_template&amp;sid=".$template['sid'].$expand_str,
'description' => $lang->add_template_desc
);

	



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

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

	



	if($errors)
{
$page->output_inline_error($errors);
}

	if($errors)
{
$page->output_inline_error($errors);
}

	



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

	$form = new Form("index.php?module=style-templates&amp;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->output_row("", "", $form->generate_text_area('template', $template['template'], array('id' => 'template', 'class' => 'codepress php', 'style' => 'width: 100%; height: 500px;')), 'template');
$form_container->end();

	$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->output_row("", "", $form->generate_text_area('template', $template['template'], array('id' => 'template', 'class' => 'codepress php', 'style' => 'width: 100%; height: 500px;')), 'template');
$form_container->end();

	



	$buttons[] = $form->generate_submit_button($lang->save_continue, array('name' => 'continue'));
$buttons[] = $form->generate_submit_button($lang->save_close, array('name' => 'close'));

$form->output_submit_wrapper($buttons);

	$buttons[] = $form->generate_submit_button($lang->save_continue, array('name' => 'continue'));
$buttons[] = $form->generate_submit_button($lang->save_close, array('name' => 'close'));

$form->output_submit_wrapper($buttons);

	



	$form->end();

	$form->end();

	



	if($admin_options['codepress'] != 0)
{
echo "<script type=\"text/javascript\">

	if($admin_options['codepress'] != 0)
{
echo "<script type=\"text/javascript\">

Zeile 301Zeile 301
if($mybb->input['action'] == "edit_set")
{
$plugins->run_hooks("admin_style_templates_edit_set");

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

	



	$query = $db->simple_select("templatesets", "*", "sid='{$sid}'");
$set = $db->fetch_array($query);
if(!$set)

	$query = $db->simple_select("templatesets", "*", "sid='{$sid}'");
$set = $db->fetch_array($query);
if(!$set)

Zeile 310Zeile 310
		admin_redirect("index.php?module=style-templates");
}
$sid = $set['sid'];

		admin_redirect("index.php?module=style-templates");
}
$sid = $set['sid'];

	



	if($mybb->request_method == "post")
{
if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_set_title;
}

	if($mybb->request_method == "post")
{
if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_set_title;
}

		



		if(!$errors)
{
$query = $db->update_query("templatesets", array('title' => $db->escape_string($mybb->input['title'])), "sid='{$sid}'");

		if(!$errors)
{
$query = $db->update_query("templatesets", array('title' => $db->escape_string($mybb->input['title'])), "sid='{$sid}'");

			



			// Log admin action
log_admin_action($sid, $set['title']);

			// Log admin action
log_admin_action($sid, $set['title']);

			



			flash_message($lang->success_template_set_saved, 'success');
admin_redirect("index.php?module=style-templates&sid=".$sid.$expand_str2);
}
}

			flash_message($lang->success_template_set_saved, 'success');
admin_redirect("index.php?module=style-templates&sid=".$sid.$expand_str2);
}
}

	



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

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

	



	$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,
'link' => "index.php?module=style-templates&amp;action=edit_set&amp;sid=".$sid,
'description' => $lang->edit_set_desc
);

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

	



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

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

	



	if($errors)
{
$page->output_inline_error($errors);

	if($errors)
{
$page->output_inline_error($errors);

Zeile 357Zeile 357
		$query = $db->simple_select("templatesets", "title", "sid='{$sid}'");
$mybb->input['title'] = $db->fetch_field($query, "title");
}

		$query = $db->simple_select("templatesets", "title", "sid='{$sid}'");
$mybb->input['title'] = $db->fetch_field($query, "title");
}

	



	$form = new Form("index.php?module=style-templates&amp;action=edit_set{$expand_str}", "post", "edit_set");
echo $form->generate_hidden_field("sid", $sid);

	$form = new Form("index.php?module=style-templates&amp;action=edit_set{$expand_str}", "post", "edit_set");
echo $form->generate_hidden_field("sid", $sid);

	



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

	



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

$form->output_submit_wrapper($buttons);

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

$form->output_submit_wrapper($buttons);

	



	$form->end();

$page->output_footer();

	$form->end();

$page->output_footer();

Zeile 378Zeile 378
if($mybb->input['action'] == "edit_template")
{
$plugins->run_hooks("admin_style_templates_edit_template");

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

	
if(!$mybb->input['title'] || !$sid)


if(!$mybb->input['title'] || !$sid || !isset($template_sets[$sid]))

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

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

	



	if($mybb->request_method == "post")
{
if(empty($mybb->input['title']))

	if($mybb->request_method == "post")
{
if(empty($mybb->input['title']))

Zeile 402Zeile 402
		{
$query = $db->simple_select("templates", "*", "tid='{$mybb->input['tid']}'");
$template = $db->fetch_array($query);

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

			



			$template_array = array(
'title' => $db->escape_string($mybb->input['title']),
'sid' => $sid,

			$template_array = array(
'title' => $db->escape_string($mybb->input['title']),
'sid' => $sid,

Zeile 411Zeile 411
				'status' => '',
'dateline' => TIME_NOW
);

				'status' => '',
'dateline' => TIME_NOW
);

			



			// 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
$query = $db->simple_select("templates", "sid", "title='".$db->escape_string($mybb->input['title'])."' AND (sid = '-2' OR sid = '{$sid}' OR sid='{$template['sid']}')", array('order_by' => 'sid', 'order_dir' => 'desc'));
$existing_sid = $db->fetch_field($query, "sid");
$existing_rows = $db->num_rows($query);

			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
$query = $db->simple_select("templates", "sid", "title='".$db->escape_string($mybb->input['title'])."' AND (sid = '-2' OR sid = '{$sid}' OR sid='{$template['sid']}')", array('order_by' => 'sid', 'order_dir' => 'desc'));
$existing_sid = $db->fetch_field($query, "sid");
$existing_rows = $db->num_rows($query);

				



				if(($existing_sid == -2 && $existing_rows == 1) || $existing_rows == 0)
{
$tid = $db->insert_query("templates", $template_array);

				if(($existing_sid == -2 && $existing_rows == 1) || $existing_rows == 0)
{
$tid = $db->insert_query("templates", $template_array);

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

				// Global template set
$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");

			



			$query = $db->simple_select("templatesets", "title", "sid='{$sid}'");
$set = $db->fetch_array($query);

			$query = $db->simple_select("templatesets", "title", "sid='{$sid}'");
$set = $db->fetch_array($query);

			



			$exploded = explode("_", $template_array['title'], 2);
$prefix = $exploded[0];

			$exploded = explode("_", $template_array['title'], 2);
$prefix = $exploded[0];

			



			$query = $db->simple_select("templategroups", "gid", "prefix = '".$db->escape_string($prefix)."'");
$group = $db->fetch_field($query, "gid");

			$query = $db->simple_select("templategroups", "gid", "prefix = '".$db->escape_string($prefix)."'");
$group = $db->fetch_field($query, "gid");

			



			if(!$group)
{
$group = "-1";

			if(!$group)
{
$group = "-1";

			}		


			}


			// Log admin action
log_admin_action($tid, $mybb->input['title'], $mybb->input['sid'], $set['title']);

			// Log admin action
log_admin_action($tid, $mybb->input['title'], $mybb->input['sid'], $set['title']);

			



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

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

			



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

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

Zeile 483Zeile 483
			}
}
}

			}
}
}

	



	if($errors)
{
$template = $mybb->input;
}
else

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

		$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)
{
$page->extra_header .= '

	if($admin_options['codepress'] != 0)
{
$page->extra_header .= '

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

$sub_tabs = array();

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

$sub_tabs = array();

	



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

	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['diff_report'] = array(
'title' => $lang->diff_report,
'link' => "index.php?module=style-templates&amp;action=diff_report&amp;title=".$db->escape_string($template['title'])."&amp;sid1=".intval($template['sid'])."&amp;sid2=-2",
);
}

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

	



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

	$sub_tabs['edit_template'] = array(
'title' => $lang->edit_template,
'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');

if($errors)

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

if($errors)

Zeile 549Zeile 549

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

	



	if($mybb->input['from'] == "diff_report")
{
echo $form->generate_hidden_field('from', "diff_report");
}

	if($mybb->input['from'] == "diff_report")
{
echo $form->generate_hidden_field('from', "diff_report");
}

		



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


Zeile 568Zeile 568

$form_container->output_row("", "", $form->generate_text_area('template', $template['template'], array('id' => 'template', 'class' => 'codepress mybb', 'style' => 'width: 100%; height: 500px;')));
$form_container->end();


$form_container->output_row("", "", $form->generate_text_area('template', $template['template'], array('id' => 'template', 'class' => 'codepress mybb', 'style' => 'width: 100%; height: 500px;')));
$form_container->end();

	



	$buttons[] = $form->generate_submit_button($lang->save_continue, array('name' => 'continue'));
$buttons[] = $form->generate_submit_button($lang->save_close, array('name' => 'close'));

$form->output_submit_wrapper($buttons);

	$buttons[] = $form->generate_submit_button($lang->save_continue, array('name' => 'continue'));
$buttons[] = $form->generate_submit_button($lang->save_close, array('name' => 'close'));

$form->output_submit_wrapper($buttons);

	



	$form->end();

	$form->end();

	



	if($admin_options['codepress'] != 0)
{
echo "<script type=\"text/javascript\">

	if($admin_options['codepress'] != 0)
{
echo "<script type=\"text/javascript\">

Zeile 597Zeile 597
if($mybb->input['action'] == "search_replace")
{
$plugins->run_hooks("admin_style_templates_search_replace");

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

	



	if($mybb->request_method == "post")
{
if($mybb->input['type'] == "templates")
{
// Search and replace in templates

	if($mybb->request_method == "post")
{
if($mybb->input['type'] == "templates")
{
// Search and replace in templates

			



			if(!$mybb->input['find'])
{
flash_message($lang->search_noneset, "error");

			if(!$mybb->input['find'])
{
flash_message($lang->search_noneset, "error");

Zeile 612Zeile 612
			else
{
$page->add_breadcrumb_item($lang->search_replace);

			else
{
$page->add_breadcrumb_item($lang->search_replace);

				



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

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

	



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

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

					



				$templates_list = array();
$table = new Table;

				$templates_list = array();
$table = new Table;

				



				$template_sets = array();

				$template_sets = array();

				



				// Get the names of all template sets
$template_sets[-2] = $lang->master_templates;
$template_sets[-1] = $lang->global_templates;

				// Get the names of all template sets
$template_sets[-2] = $lang->master_templates;
$template_sets[-1] = $lang->global_templates;

				



				$query = $db->simple_select("templatesets", "sid, title");
while($set = $db->fetch_array($query))
{
$template_sets[$set['sid']] = $set['title'];
}

				$query = $db->simple_select("templatesets", "sid, title");
while($set = $db->fetch_array($query))
{
$template_sets[$set['sid']] = $set['title'];
}

				



				// Select all templates with that search term
$query = $db->query("
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')

				// Select all templates with that search term
$query = $db->query("
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')

					WHERE t.template LIKE '%".$db->escape_string($mybb->input['find'])."%' AND NOT (t.sid = -2 AND NOT ISNULL(t2.tid))

					WHERE t.template LIKE '%".$db->escape_string_like($mybb->input['find'])."%' AND NOT (t.sid = -2 AND NOT ISNULL(t2.tid))

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

					ORDER BY t.title ASC
");
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->construct_row();

					



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

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

Zeile 655Zeile 655
					{
$template_list[$template['sid']][$template['title']] = $template;
}

					{
$template_list[$template['sid']][$template['title']] = $template;
}

		



					$count = 0;

					$count = 0;

					



					foreach($template_list as $sid => $templates)
{
++$count;

					foreach($template_list as $sid => $templates)
{
++$count;

						
$search_header = $lang->sprintf($lang->search_header, htmlspecialchars_uni($mybb->input['find']), $template_sets[$sid]);


$search_header = $lang->sprintf($lang->search_header, htmlspecialchars_uni($mybb->input['find']), $template_sets[$sid]);

						$table->construct_header($search_header, array("colspan" => 2));

						$table->construct_header($search_header, array("colspan" => 2));

		



						foreach($templates as $title => $template)
{
// Do replacement

						foreach($templates as $title => $template)
{
// Do replacement

Zeile 728Zeile 728
									$url = "index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$template['sid']}";
}
}

									$url = "index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$template['sid']}";
}
}

						



							$table->construct_cell($label, array("width" => "85%"));

							$table->construct_cell($label, array("width" => "85%"));

							



							if($sid == -2)
{
$popup = new PopupMenu("template_{$template['tid']}", $lang->options);

							if($sid == -2)
{
$popup = new PopupMenu("template_{$template['tid']}", $lang->options);

		



								foreach($template_sets as $set_sid => $title)
{
if($set_sid > 0)

								foreach($template_sets as $set_sid => $title)
{
if($set_sid > 0)

									{									

									{

										$popup->add_item($lang->edit_in." ".htmlspecialchars_uni($title), "index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$set_sid}");
}
}

										$popup->add_item($lang->edit_in." ".htmlspecialchars_uni($title), "index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$set_sid}");
}
}

								



								$table->construct_cell($popup->fetch(), array("class" => "align_center"));
}
else
{
$table->construct_cell("<a href=\"{$url}\">{$lang->edit}</a>", array("class" => "align_center"));
}

								$table->construct_cell($popup->fetch(), array("class" => "align_center"));
}
else
{
$table->construct_cell("<a href=\"{$url}\">{$lang->edit}</a>", array("class" => "align_center"));
}

							



							$table->construct_row();
}

							$table->construct_row();
}

						



						if($count == 1)
{
$table->output($lang->search_results);

						if($count == 1)
{
$table->output($lang->search_results);

Zeile 763Zeile 763
						}
}
}

						}
}
}

				



				if(trim($mybb->input['replace']) != "")
{
// Log admin action - only if replace
log_admin_action($mybb->input['find'], $mybb->input['replace']);
}

				if(trim($mybb->input['replace']) != "")
{
// Log admin action - only if replace
log_admin_action($mybb->input['find'], $mybb->input['replace']);
}

				



				$page->output_footer();
exit;
}

				$page->output_footer();
exit;
}

Zeile 784Zeile 784
			else
{
// Search Template Titles

			else
{
// Search Template Titles

				



				$templatessets = array();

				$templatessets = array();

				



				$templates_sets = array();
// Get the names of all template sets
$template_sets[-2] = $lang->master_templates;
$template_sets[-1] = $lang->global_templates;

				$templates_sets = array();
// Get the names of all template sets
$template_sets[-2] = $lang->master_templates;
$template_sets[-1] = $lang->global_templates;

				



				$query = $db->simple_select("templatesets", "sid, title");
while($set = $db->fetch_array($query))
{
$template_sets[$set['sid']] = $set['title'];
}

				$query = $db->simple_select("templatesets", "sid, title");
while($set = $db->fetch_array($query))
{
$template_sets[$set['sid']] = $set['title'];
}

				



				$table = new Table;

				$table = new Table;

				



				$query = $db->query("
SELECT t.tid, t.title, t.sid, s.title as settitle, t2.tid as customtid
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')

				$query = $db->query("
SELECT t.tid, t.title, t.sid, s.title as settitle, t2.tid as customtid
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')

					WHERE t.title LIKE '%".$db->escape_string($mybb->input['title'])."%'

					WHERE t.title LIKE '%".$db->escape_string_like($mybb->input['title'])."%'

					ORDER BY t.title ASC
");
while($template = $db->fetch_array($query))

					ORDER BY t.title ASC
");
while($template = $db->fetch_array($query))

Zeile 828Zeile 828
					}
$templatessets[$template['sid']][$template['title']] = $template;
}

					}
$templatessets[$template['sid']][$template['title']] = $template;
}

				



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

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

				



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

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

	



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

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

				



				if(empty($templatesets))
{
$table->construct_cell($lang->sprintf($lang->search_noresults_title, htmlspecialchars_uni($mybb->input['title'])), array("class" => "align_center"));

				if(empty($templatesets))
{
$table->construct_cell($lang->sprintf($lang->search_noresults_title, htmlspecialchars_uni($mybb->input['title'])), array("class" => "align_center"));

							



					$table->construct_row();

					$table->construct_row();

					



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

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

				



				$count = 0;

				$count = 0;

				



				foreach($templatessets as $sid => $templates)
{
++$count;

				foreach($templatessets as $sid => $templates)
{
++$count;

					



					$table->construct_header($template_sets[$sid], array("colspan" => 2));

					$table->construct_header($template_sets[$sid], array("colspan" => 2));

					



					foreach($templates as $template)
{
$template['pretty_title'] = $template['title'];

					foreach($templates as $template)
{
$template['pretty_title'] = $template['title'];

						



						$popup = new PopupMenu("template_{$template['tid']}", $lang->options);

						$popup = new PopupMenu("template_{$template['tid']}", $lang->options);

						



						if($sid == -2)
{
foreach($template_sets as $set_sid => $title)
{
if($set_sid < 0) continue;

						if($sid == -2)
{
foreach($template_sets as $set_sid => $title)
{
if($set_sid < 0) continue;

								



								$popup->add_item($lang->edit_in." ".htmlspecialchars_uni($title), "index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$set_sid}");
}
}

								$popup->add_item($lang->edit_in." ".htmlspecialchars_uni($title), "index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$set_sid}");
}
}

Zeile 871Zeile 871
						{
$popup->add_item($lang->full_edit, "index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}");
}

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

						



						if(isset($template['modified']) && $template['modified'] == true)

						if(isset($template['modified']) && $template['modified'] == true)

						{					

						{

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

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

							



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

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

							



							$template['pretty_title'] = "<span style=\"color: green;\">{$template['title']}</span>";

							$template['pretty_title'] = "<span style=\"color: green;\">{$template['title']}</span>";

						}				

						}

						// This template does not exist in the master list
else if(!isset($template['original']) || $template['original'] == false)
{
$popup->add_item($lang->delete_template, "index.php?module=style-templates&amp;action=delete_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");

						// This template does not exist in the master list
else if(!isset($template['original']) || $template['original'] == false)
{
$popup->add_item($lang->delete_template, "index.php?module=style-templates&amp;action=delete_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");

							



							$template['pretty_title'] = "<span style=\"color: blue;\">{$template['title']}</span>";
}

							$template['pretty_title'] = "<span style=\"color: blue;\">{$template['title']}</span>";
}

											



						$table->construct_cell("<span style=\"padding: 20px;\">{$template['pretty_title']}</span>", array("width" => "85%"));
$table->construct_cell($popup->fetch(), array("class" => "align_center"));

						$table->construct_cell("<span style=\"padding: 20px;\">{$template['pretty_title']}</span>", array("width" => "85%"));
$table->construct_cell($popup->fetch(), array("class" => "align_center"));

						



						$table->construct_row();
}

						$table->construct_row();
}

					



					if($count == 1)
{
$table->output($lang->sprintf($lang->search_names_header, htmlspecialchars_uni($mybb->input['title'])));

					if($count == 1)
{
$table->output($lang->sprintf($lang->search_names_header, htmlspecialchars_uni($mybb->input['title'])));

Zeile 906Zeile 906
						$table->output();
}
}

						$table->output();
}
}

				



				$page->output_footer();
exit;
}
}
}

				$page->output_footer();
exit;
}
}
}

	



	if($admin_options['codepress'] != 0)
{
$page->extra_header .= '

	if($admin_options['codepress'] != 0)
{
$page->extra_header .= '

Zeile 922Zeile 922
		CodePress.language = \'php\';
</script>';
}

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

	



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

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

	



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

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

	



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

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

	



	$form = new Form("index.php?module=style-templates&amp;action=search_replace", "post", "do_template");
echo $form->generate_hidden_field('type', "templates");

	$form = new Form("index.php?module=style-templates&amp;action=search_replace", "post", "do_template");
echo $form->generate_hidden_field('type', "templates");

		



	$form_container = new FormContainer($lang->search_replace);
$form_container->output_row($lang->search_for, "", $form->generate_text_area('find', $mybb->input['find'], array('id' => 'find', 'class' => 'codepress mybb', 'style' => 'width: 100%; height: 200px;')));

	$form_container = new FormContainer($lang->search_replace);
$form_container->output_row($lang->search_for, "", $form->generate_text_area('find', $mybb->input['find'], array('id' => 'find', 'class' => 'codepress mybb', 'style' => 'width: 100%; height: 200px;')));

	



	$form_container->output_row($lang->replace_with, "", $form->generate_text_area('replace', $mybb->input['replace'], array('id' => 'replace', 'class' => 'codepress mybb', 'style' => 'width: 100%; height: 200px;')));
$form_container->end();

	$form_container->output_row($lang->replace_with, "", $form->generate_text_area('replace', $mybb->input['replace'], array('id' => 'replace', 'class' => 'codepress mybb', 'style' => 'width: 100%; height: 200px;')));
$form_container->end();

	



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

$form->output_submit_wrapper($buttons);

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

$form->output_submit_wrapper($buttons);

	



	$form->end();

	$form->end();

	



	echo "<br />";


	echo "<br />";


	



	$form = new Form("index.php?module=style-templates&amp;action=search_replace", "post", "do_title");
echo $form->generate_hidden_field('type', "titles");

	$form = new Form("index.php?module=style-templates&amp;action=search_replace", "post", "do_title");
echo $form->generate_hidden_field('type', "titles");

		



	$form_container = new FormContainer($lang->search_template_names);

	$form_container = new FormContainer($lang->search_template_names);

	



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

	$form_container->output_row($lang->search_for, "", $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->find_templates);
$buttons[] = $form->generate_reset_button($lang->reset);

$form->output_submit_wrapper($buttons);

	$buttons = array();
$buttons[] = $form->generate_submit_button($lang->find_templates);
$buttons[] = $form->generate_reset_button($lang->reset);

$form->output_submit_wrapper($buttons);

	



	$form->end();

	$form->end();

	



	if($admin_options['codepress'] != 0)
{
echo "<script type=\"text/javascript\">

	if($admin_options['codepress'] != 0)
{
echo "<script type=\"text/javascript\">

Zeile 975Zeile 975
			area.value = find.getCode();
area.disabled = false;
}

			area.value = find.getCode();
area.disabled = false;
}

		



		if($('replace_cp')) {
var area = $('replace_cp');
area.id = 'replace';

		if($('replace_cp')) {
var area = $('replace_cp');
area.id = 'replace';

Zeile 997Zeile 997
	$compare_version = $mybb->version_code;
$query = $db->query("
SELECT COUNT(*) AS updated_count

	$compare_version = $mybb->version_code;
$query = $db->query("
SELECT COUNT(*) AS updated_count

		FROM ".TABLE_PREFIX."templates t 

		FROM ".TABLE_PREFIX."templates t

		LEFT JOIN ".TABLE_PREFIX."templates m ON (m.title=t.title AND m.sid=-2 AND m.version > t.version)
WHERE t.sid > 0 AND m.template != t.template
");

		LEFT JOIN ".TABLE_PREFIX."templates m ON (m.title=t.title AND m.sid=-2 AND m.version > t.version)
WHERE t.sid > 0 AND m.template != t.template
");

Zeile 1008Zeile 1008
		flash_message($lang->no_updated_templates, 'success');
admin_redirect("index.php?module=style-templates");
}

		flash_message($lang->no_updated_templates, 'success');
admin_redirect("index.php?module=style-templates");
}

	



	$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->output_header($lang->find_updated);

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

	



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

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

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

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

Zeile 1020Zeile 1020
	{
$templatesets[$templateset['sid']] = $templateset;
}

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

	





	echo <<<LEGEND
<fieldset>
<legend>{$lang->legend}</legend>

	echo <<<LEGEND
<fieldset>
<legend>{$lang->legend}</legend>

Zeile 1032Zeile 1032
</ul>
</fieldset>
LEGEND;

</ul>
</fieldset>
LEGEND;

	



	$count = 0;
$done_set = array();
$done_output = array();
$templates = array();

	$count = 0;
$done_set = array();
$done_output = array();
$templates = array();

	$table = new Table;	


	$table = new Table;


	$query = $db->query("

	$query = $db->query("

		SELECT t.tid, t.title, t.sid, t.version 
FROM ".TABLE_PREFIX."templates t

		SELECT t.tid, t.title, t.sid, t.version
FROM ".TABLE_PREFIX."templates t

		LEFT JOIN ".TABLE_PREFIX."templates m ON (m.title=t.title AND m.sid=-2 AND m.version > t.version)
WHERE t.sid > 0 AND m.template != t.template
ORDER BY t.sid ASC, title ASC

		LEFT JOIN ".TABLE_PREFIX."templates m ON (m.title=t.title AND m.sid=-2 AND m.version > t.version)
WHERE t.sid > 0 AND m.template != t.template
ORDER BY t.sid ASC, title ASC

Zeile 1050Zeile 1050
	{
$templates[$template['sid']][] = $template;
}

	{
$templates[$template['sid']][] = $template;
}

	



	foreach($templates as $sid => $templates)
{
if(!$done_set[$sid])
{
$table->construct_header($templatesets[$sid]['title'], array("colspan" => 2));

	foreach($templates as $sid => $templates)
{
if(!$done_set[$sid])
{
$table->construct_header($templatesets[$sid]['title'], array("colspan" => 2));

			



			$done_set[$sid] = 1;
++$count;
}

			$done_set[$sid] = 1;
++$count;
}

		



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

		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->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%'));
$table->construct_cell($popup->fetch(), array("class" => "align_center"));

			$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%'));
$table->construct_cell($popup->fetch(), array("class" => "align_center"));

			



			$table->construct_row();
}

			$table->construct_row();
}

		



		if($done_set[$sid] && !$done_output[$sid])

		if($done_set[$sid] && !$done_output[$sid])

		{		

		{

			$done_output[$sid] = 1;
if($count == 1)
{

			$done_output[$sid] = 1;
if($count == 1)
{

Zeile 1087Zeile 1087
			}
}
}

			}
}
}

	



	$page->output_footer();
}

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

	$page->output_footer();
}

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

	



	$query = $db->simple_select("templatesets", "*", "sid='{$sid}' AND sid > 0");
$set = $db->fetch_array($query);

	$query = $db->simple_select("templatesets", "*", "sid='{$sid}' AND sid > 0");
$set = $db->fetch_array($query);

	



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

	// Does the template not exist?
if(!$set['sid'])
{
flash_message($lang->error_invalid_template_set, 'error');
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))

Zeile 1117Zeile 1117
			break;
}
}

			break;
}
}

	



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

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

Zeile 1130Zeile 1130
		$db->delete_query("templatesets", "sid='{$set['sid']}'");
// Delete all custom templates in this templateset
$db->delete_query("templates", "sid='{$set['sid']}'");

		$db->delete_query("templatesets", "sid='{$set['sid']}'");
// Delete all custom templates in this templateset
$db->delete_query("templates", "sid='{$set['sid']}'");

		



		$plugins->run_hooks("admin_style_templates_delete_set_commit");

// Log admin action

		$plugins->run_hooks("admin_style_templates_delete_set_commit");

// Log admin action

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

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

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

	



}

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

}

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

	



	$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 1157Zeile 1157
		WHERE t.title='".$db->escape_string($mybb->input['title'])."' AND t.sid > '-2' AND t.sid = '{$sid}'
");
$template = $db->fetch_array($query);

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

	// 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'])
{

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

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

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

		



		$plugins->run_hooks("admin_style_templates_delete_template_commit");

// Log admin action

		$plugins->run_hooks("admin_style_templates_delete_template_commit");

// Log admin action

Zeile 1185Zeile 1185
		admin_redirect("index.php?module=style-templates&sid={$template['sid']}{$expand_str2}");
}
else

		admin_redirect("index.php?module=style-templates&sid={$template['sid']}{$expand_str2}");
}
else

	{		

	{

		$page->output_confirm_action("index.php?module=style-templates&amp;action=delete_template&amp;sid={$template['sid']}{$expand_str}", $lang->confirm_template_deletion);
}
}

		$page->output_confirm_action("index.php?module=style-templates&amp;action=delete_template&amp;sid={$template['sid']}{$expand_str}", $lang->confirm_template_deletion);
}
}

Zeile 1193Zeile 1193
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['action'] == "diff_report")
{
// Compares a template of sid1 with that of sid2, if no sid1, it is assumed -2

	if(!$mybb->input['sid1'])

	if(!$mybb->input['sid1'] || !isset($template_sets[$mybb->input['sid1']]))

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

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

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

 
	}

if($mybb->input['sid2'] != -2 && !isset($template_sets[$mybb->input['sid2']]))
{
flash_message($lang->error_invalid_input, 'error');
admin_redirect("index.php?module=style-templates");

	}

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

	}

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

	



	$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;from=".$mybb->input['from']."sid1=".intval($mybb->input['sid1'])."&amp;sid2=".intval($mybb->input['sid2']),
'description' => $lang->diff_report_desc
);

	$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;from=".$mybb->input['from']."sid1=".intval($mybb->input['sid1'])."&amp;sid2=".intval($mybb->input['sid2']),
'description' => $lang->diff_report_desc
);

	



	$plugins->run_hooks("admin_style_templates_diff_report");

	$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'])."'");
$template1 = $db->fetch_array($query);

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

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

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

	



	if($mybb->input['sid2'] == -2)
{
$sub_tabs['full_edit'] = array(

	if($mybb->input['sid2'] == -2)
{
$sub_tabs['full_edit'] = array(

Zeile 1250Zeile 1256

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


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

	



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

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

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

	



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

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

	



	$table = new Table;

	$table = new Table;

	



	if($mybb->input['from'])
{
$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>");

Zeile 1277Zeile 1283
	{
$table->construct_header("<ins>".$lang->master_updated_del."</ins><br /><del>".$lang->master_updated_ins."</del>");
}

	{
$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']);

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

	



	$page->output_footer();
}

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

	$page->output_footer();
}

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 1297Zeile 1303
		WHERE t.title='".$db->escape_string($mybb->input['title'])."' AND t.sid > 0 AND t.sid = '".intval($mybb->input['sid'])."'
");
$template = $db->fetch_array($query);

		WHERE t.title='".$db->escape_string($mybb->input['title'])."' AND t.sid > 0 AND t.sid = '".intval($mybb->input['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");
}

	// 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'])
{

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

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

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

		



		$plugins->run_hooks("admin_style_templates_revert_commit");

// Log admin action
log_admin_action($template['tid'], $template['sid'], $template['sid'], $template['set_title']);

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

		$plugins->run_hooks("admin_style_templates_revert_commit");

// Log admin action
log_admin_action($template['tid'], $template['sid'], $template['sid'], $template['set_title']);

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

		



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

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

Zeile 1333Zeile 1339
		}
}
else

		}
}
else

	{	

	{

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

if($mybb->input['sid'] && !$mybb->input['action'])
{

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

if($mybb->input['sid'] && !$mybb->input['action'])
{

 
	if(!isset($template_sets[$mybb->input['sid']]))
{
flash_message($lang->error_invalid_input, 'error');
admin_redirect("index.php?module=style-templates");
}


	$plugins->run_hooks("admin_style_templates_set");

	$plugins->run_hooks("admin_style_templates_set");

	



	$table = new Table;

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

	



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

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

	



	$table->construct_header($lang->template_set);
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));

	$table->construct_header($lang->template_set);
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));

	



	// Global Templates
if($sid == -1)
{

	// Global Templates
if($sid == -1)
{

Zeile 1362Zeile 1374
			$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=-1");
$popup->add_item($lang->delete_template, "index.php?module=style-templates&amp;action=delete_template&amp;title=".urlencode($template['title'])."&amp;sid=-1&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");

			$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=-1");
$popup->add_item($lang->delete_template, "index.php?module=style-templates&amp;action=delete_template&amp;title=".urlencode($template['title'])."&amp;sid=-1&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");

				



			$table->construct_cell("<a href=\"index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid=-1\">{$template['title']}</a>");
$table->construct_cell($popup->fetch(), array("class" => "align_center"));

			$table->construct_cell("<a href=\"index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid=-1\">{$template['title']}</a>");
$table->construct_cell($popup->fetch(), array("class" => "align_center"));

			



			$table->construct_row();
}

			$table->construct_row();
}

		



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

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

		



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

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

	



		$page->output_footer();
}


		$page->output_footer();
}


Zeile 1404Zeile 1416
		}
$template_groups[$templategroup['prefix']] = $templategroup;
}

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

	



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

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

	



	// Add the ungrouped templates group at the bottom
$template_groups['-1'] = array(
"prefix" => "",

	// Add the ungrouped templates group at the bottom
$template_groups['-1'] = array(
"prefix" => "",

Zeile 1451Zeile 1463
			$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;

			



			// Save some memory!
unset($template_groups[$group]['templates'][$template['title']]['template']);
}

			// Save some memory!
unset($template_groups[$group]['templates'][$template['title']]['template']);
}

Zeile 1469Zeile 1481
			{
$template_groups[$group]['templates'][$template['title']]['modified'] = true;
}

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

			



			// Save some memory!
unset($template_groups[$group]['templates'][$template['title']]['template']);
}
}

			// Save some memory!
unset($template_groups[$group]['templates'][$template['title']]['template']);
}
}

	



	foreach($template_groups as $prefix => $group)

	foreach($template_groups as $prefix => $group)

	{	

	{

		$tmp_expand = "";
if(in_array($group['gid'], $expand_array))
{
$expand = $lang->collapse;
$expanded = true;

		$tmp_expand = "";
if(in_array($group['gid'], $expand_array))
{
$expand = $lang->collapse;
$expanded = true;

			



			$tmp_expand = $expand_array;
$unsetgid = array_search($group['gid'], $tmp_expand);
unset($tmp_expand[$unsetgid]);

			$tmp_expand = $expand_array;
$unsetgid = array_search($group['gid'], $tmp_expand);
unset($tmp_expand[$unsetgid]);

Zeile 1492Zeile 1504
		{
$expand = $lang->expand;
$expanded = false;

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

			



			$group['expand_str'] = implode("|", $expand_array);
if($group['expand_str'])
{

			$group['expand_str'] = implode("|", $expand_array);
if($group['expand_str'])
{

Zeile 1500Zeile 1512
			}
$group['expand_str'] .= $group['gid'];
}

			}
$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']}";
}

		



		if($expanded == true && 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']}\">{$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']));

		if($expanded == true && 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']}\">{$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);

			



			foreach($templates as $template)
{
$template['pretty_title'] = $template['title'];

			foreach($templates as $template)
{
$template['pretty_title'] = $template['title'];

				



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

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

				



				if(isset($template['modified']) && $template['modified'] == true)

				if(isset($template['modified']) && $template['modified'] == true)

				{					

				{

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

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

					



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

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

					



					$template['pretty_title'] = "<span style=\"color: green;\">{$template['title']}</span>";

					$template['pretty_title'] = "<span style=\"color: green;\">{$template['title']}</span>";

				}				

				}

				// This template does not exist in the master list
else if(isset($template['original']) && $template['original'] == false)
{
$popup->add_item($lang->delete_template, "index.php?module=style-templates&amp;action=delete_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;my_post_key={$mybb->post_code}{$expand_str}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");

				// This template does not exist in the master list
else if(isset($template['original']) && $template['original'] == false)
{
$popup->add_item($lang->delete_template, "index.php?module=style-templates&amp;action=delete_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;my_post_key={$mybb->post_code}{$expand_str}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");

					



					$template['pretty_title'] = "<span style=\"color: blue;\">{$template['title']}</span>";
}

					$template['pretty_title'] = "<span style=\"color: blue;\">{$template['title']}</span>";
}

				



				$table->construct_cell("<span style=\"padding: 20px;\"><a href=\"index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}{$expand_str}\" >{$template['pretty_title']}</a></span>");
$table->construct_cell($popup->fetch(), array("class" => "align_center"));

				$table->construct_cell("<span style=\"padding: 20px;\"><a href=\"index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}{$expand_str}\" >{$template['pretty_title']}</a></span>");
$table->construct_cell($popup->fetch(), array("class" => "align_center"));

				



				$table->construct_row();
}
}
else if(isset($group['templates']) && count($group['templates']) > 0)

				$table->construct_row();
}
}
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']}\">{$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();
}

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

	$page->output_footer();
}

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

	



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

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

Zeile 1575Zeile 1587
		$tbits = unserialize($theme['properties']);
$themes[$tbits['templateset']][$theme['tid']] = htmlspecialchars_uni($theme['name']);
}

		$tbits = unserialize($theme['properties']);
$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;

Zeile 1585Zeile 1597
	{
$template_sets[$template_set['sid']] = $template_set;
}

	{
$template_sets[$template_set['sid']] = $template_set;
}

	



	$table = new Table;
$table->construct_header($lang->template_set);
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));

	$table = new Table;
$table->construct_header($lang->template_set);
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));

	



	foreach($template_sets as $set)
{
if($set['sid'] == -1)

	foreach($template_sets as $set)
{
if($set['sid'] == -1)

Zeile 1599Zeile 1611
			$table->construct_row();
continue;
}

			$table->construct_row();
continue;
}

		



		if($themes[$set['sid']])
{
$used_by_note = $lang->used_by;

		if($themes[$set['sid']])
{
$used_by_note = $lang->used_by;

Zeile 1614Zeile 1626
		{
$used_by_note = $lang->not_used_by_any_themes;
}

		{
$used_by_note = $lang->not_used_by_any_themes;
}

		



		if($set['sid'] == 1)
{
$actions = "<a href=\"index.php?module=style-templates&amp;sid={$set['sid']}\">{$lang->expand_templates}</a>";
}
else

		if($set['sid'] == 1)
{
$actions = "<a href=\"index.php?module=style-templates&amp;sid={$set['sid']}\">{$lang->expand_templates}</a>";
}
else

		{	

		{

			$popup = new PopupMenu("templateset_{$set['sid']}", $lang->options);

			$popup = new PopupMenu("templateset_{$set['sid']}", $lang->options);

			$popup->add_item($lang->expand_templates, "index.php?module=style-templates&amp;sid={$set['sid']}");		


			$popup->add_item($lang->expand_templates, "index.php?module=style-templates&amp;sid={$set['sid']}");


			if($set['sid'] != 1)
{
$popup->add_item($lang->edit_template_set, "index.php?module=style-templates&amp;action=edit_set&amp;sid={$set['sid']}");

			if($set['sid'] != 1)
{
$popup->add_item($lang->edit_template_set, "index.php?module=style-templates&amp;action=edit_set&amp;sid={$set['sid']}");

					



				if(!$themes[$set['sid']])
{
$popup->add_item($lang->delete_template_set, "index.php?module=style-templates&amp;action=delete_set&amp;sid={$set['sid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_set_deletion}')");
}
}

				if(!$themes[$set['sid']])
{
$popup->add_item($lang->delete_template_set, "index.php?module=style-templates&amp;action=delete_set&amp;sid={$set['sid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_set_deletion}')");
}
}

			



			$actions = $popup->fetch();
}

			$actions = $popup->fetch();
}

		



		$table->construct_cell("<strong><a href=\"index.php?module=style-templates&amp;sid={$set['sid']}\">{$set['title']}</a></strong><br /><small>{$used_by_note}</small>");
$table->construct_cell($actions, array("class" => "align_center"));
$table->construct_row();
}

		$table->construct_cell("<strong><a href=\"index.php?module=style-templates&amp;sid={$set['sid']}\">{$set['title']}</a></strong><br /><small>{$used_by_note}</small>");
$table->construct_cell($actions, array("class" => "align_center"));
$table->construct_row();
}

	



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

$page->output_footer();

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

$page->output_footer();