Vergleich admin/modules/style/templates.php - 1.8.4 - 1.8.9

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 264Zeile 264
<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet">
<script src="./jscripts/codemirror/addon/dialog/dialog.js"></script>
<script src="./jscripts/codemirror/addon/search/searchcursor.js"></script>

<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet">
<script src="./jscripts/codemirror/addon/dialog/dialog.js"></script>
<script src="./jscripts/codemirror/addon/search/searchcursor.js"></script>

<script src="./jscripts/codemirror/addon/search/search.js"></script>

<script src="./jscripts/codemirror/addon/search/search.js?ver=1808"></script>

<script src="./jscripts/codemirror/addon/fold/foldcode.js"></script>
<script src="./jscripts/codemirror/addon/fold/xml-fold.js"></script>
<script src="./jscripts/codemirror/addon/fold/foldgutter.js"></script>

<script src="./jscripts/codemirror/addon/fold/foldcode.js"></script>
<script src="./jscripts/codemirror/addon/fold/xml-fold.js"></script>
<script src="./jscripts/codemirror/addon/fold/foldgutter.js"></script>

Zeile 341Zeile 341
		if(!$prefix)
{
$errors[] = $lang->error_missing_group_prefix;

		if(!$prefix)
{
$errors[] = $lang->error_missing_group_prefix;

 
		}

if(strpos($prefix, "_") !== false)
{
$errors[] = $lang->error_invalid_group_title;

		}

$title = trim($mybb->input['title']);

		}

$title = trim($mybb->input['title']);

Zeile 385Zeile 390
	}

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

	}

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

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

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

	}

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

	}

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

Zeile 428Zeile 433
	if(!$set)
{
flash_message($lang->error_invalid_input, 'error');

	if(!$set)
{
flash_message($lang->error_invalid_input, 'error');

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


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


	$plugins->run_hooks("admin_style_templates_edit_set");

$sid = $set['sid'];

	$plugins->run_hooks("admin_style_templates_edit_set");

$sid = $set['sid'];

Zeile 516Zeile 521
		if(empty($mybb->input['title']))
{
$errors[] = $lang->error_missing_title;

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

		}


		}


		// Are we trying to do malicious things in our template?
if(check_template($mybb->input['template']))

		// Are we trying to do malicious things in our template?
if(check_template($mybb->input['template']))

		{

		{

			$errors[] = $lang->error_security_problem;
}


			$errors[] = $lang->error_security_problem;
}


Zeile 537Zeile 542
				'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");

Zeile 552Zeile 557
				$existing_rows = $db->num_rows($query);

if(($existing_sid == -2 && $existing_rows == 1) || $existing_rows == 0)

				$existing_rows = $db->num_rows($query);

if(($existing_sid == -2 && $existing_rows == 1) || $existing_rows == 0)

				{

				{

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

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

				}
}

				}
}

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

			else
{
// 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");

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

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

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

			}

			}


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


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

Zeile 624Zeile 629
	$template['title'] = htmlspecialchars_uni($template['title']);

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

	$template['title'] = htmlspecialchars_uni($template['title']);

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

	{

	{

		$page->extra_header .= '
<link href="./jscripts/codemirror/lib/codemirror.css" rel="stylesheet">
<link href="./jscripts/codemirror/theme/mybb.css?ver=1804" rel="stylesheet">

		$page->extra_header .= '
<link href="./jscripts/codemirror/lib/codemirror.css" rel="stylesheet">
<link href="./jscripts/codemirror/theme/mybb.css?ver=1804" rel="stylesheet">

Zeile 636Zeile 641
<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet">
<script src="./jscripts/codemirror/addon/dialog/dialog.js"></script>
<script src="./jscripts/codemirror/addon/search/searchcursor.js"></script>

<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet">
<script src="./jscripts/codemirror/addon/dialog/dialog.js"></script>
<script src="./jscripts/codemirror/addon/search/searchcursor.js"></script>

<script src="./jscripts/codemirror/addon/search/search.js"></script>

<script src="./jscripts/codemirror/addon/search/search.js?ver=1808"></script>

<script src="./jscripts/codemirror/addon/fold/foldcode.js"></script>
<script src="./jscripts/codemirror/addon/fold/xml-fold.js"></script>
<script src="./jscripts/codemirror/addon/fold/foldgutter.js"></script>

<script src="./jscripts/codemirror/addon/fold/foldcode.js"></script>
<script src="./jscripts/codemirror/addon/fold/xml-fold.js"></script>
<script src="./jscripts/codemirror/addon/fold/foldgutter.js"></script>

Zeile 668Zeile 673
		$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"

		);

		);


$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=".(int)$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=".(int)$template['sid']."&amp;sid2=-2",
);

	}

	}


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


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

Zeile 690Zeile 695
	}

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

	}

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

	echo $form->generate_hidden_field('tid', $template['tid'])."\n";

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


$form_container = new FormContainer($lang->edit_template_breadcrumb.$template['title'], 'tfixed');
$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'], 'tfixed');
$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 707Zeile 712
	}

$form_container->output_row($lang->template_set, $lang->template_set_desc, $form->generate_select_box('sid', $template_sets, $sid));

	}

$form_container->output_row($lang->template_set, $lang->template_set_desc, $form->generate_select_box('sid', $template_sets, $sid));





	$form_container->output_row("", "", $form->generate_text_area('template', $template['template'], array('id' => 'template', 'class' => '', '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_container->output_row("", "", $form->generate_text_area('template', $template['template'], array('id' => 'template', 'class' => '', '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);



$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 733Zeile 738
				theme: "mybb"
});
</script>';

				theme: "mybb"
});
</script>';

	}

$page->output_footer();
}


	}

$page->output_footer();
}


if($mybb->input['action'] == "edit_template_group")
{
$query = $db->simple_select("templategroups", "*", "gid = '".$mybb->get_input('gid', MyBB::INPUT_INT)."'");

if(!$db->num_rows($query))

if($mybb->input['action'] == "edit_template_group")
{
$query = $db->simple_select("templategroups", "*", "gid = '".$mybb->get_input('gid', MyBB::INPUT_INT)."'");

if(!$db->num_rows($query))

	{

	{

		flash_message($lang->error_missing_template_group, 'error');

		flash_message($lang->error_missing_template_group, 'error');

		admin_redirect("index.php?module=style-templates&amp;sid={$sid}{$expand_str}");
}

		admin_redirect("index.php?module=style-templates&amp;sid={$sid}{$expand_str}");
}


$template_group = $db->fetch_array($query);
if(isset($template_group['isdefault']) && $template_group['isdefault'] == 1)


$template_group = $db->fetch_array($query);
if(isset($template_group['isdefault']) && $template_group['isdefault'] == 1)

Zeile 754Zeile 759
		flash_message($lang->error_default_template_group, 'error');
admin_redirect("index.php?module=style-templates&amp;sid={$sid}{$expand_str}");
}

		flash_message($lang->error_default_template_group, 'error');
admin_redirect("index.php?module=style-templates&amp;sid={$sid}{$expand_str}");
}





	$plugins->run_hooks("admin_style_templates_edit_template_group");

$errors = array();

	$plugins->run_hooks("admin_style_templates_edit_template_group");

$errors = array();

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

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

		$prefix = trim($mybb->input['prefix']);
if(!$prefix)

		$prefix = trim($mybb->input['prefix']);
if(!$prefix)

		{

		{

			$errors[] = $lang->error_missing_group_prefix;

			$errors[] = $lang->error_missing_group_prefix;

 
		}

if(strpos($prefix, "_") !== false)
{
$errors[] = $lang->error_invalid_group_title;

		}

$title = trim($mybb->input['title']);

		}

$title = trim($mybb->input['title']);

Zeile 803Zeile 813
				admin_redirect("index.php?module=style-templates&amp;sid={$sid}");
}
}

				admin_redirect("index.php?module=style-templates&amp;sid={$sid}");
}
}

	}

	}


$lang->editing_template_group = $lang->sprintf($lang->editing_template_group, htmlspecialchars_uni($template_group['title']));



$lang->editing_template_group = $lang->sprintf($lang->editing_template_group, htmlspecialchars_uni($template_group['title']));


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

$templates_list = array();

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

$templates_list = array();

				$table = new Table;

$template_sets = array();


				$table = new Table;

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

 

$search_string = str_replace(array("\r\n", "\r"), "\n", $mybb->input['find']);
$search_string = str_replace(array(" ", "\t"), "", $search_string);


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


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

Zeile 885Zeile 898
					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')

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

					WHERE REPLACE(REPLACE(REPLACE(REPLACE(t.template, '\r\n', '\n'), '\r', '\n'), '  ', ''), '\t', '') LIKE '%".$db->escape_string_like($search_string)."%' AND NOT (t.sid = -2 AND (t2.tid) IS NOT NULL)

					ORDER BY t.title ASC
");
if($db->num_rows($query) == 0)

					ORDER BY t.title ASC
");
if($db->num_rows($query) == 0)

Zeile 1176Zeile 1189
<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet">
<script src="./jscripts/codemirror/addon/dialog/dialog.js"></script>
<script src="./jscripts/codemirror/addon/search/searchcursor.js"></script>

<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet">
<script src="./jscripts/codemirror/addon/dialog/dialog.js"></script>
<script src="./jscripts/codemirror/addon/search/searchcursor.js"></script>

<script src="./jscripts/codemirror/addon/search/search.js"></script>

<script src="./jscripts/codemirror/addon/search/search.js?ver=1808"></script>

<script src="./jscripts/codemirror/addon/fold/foldcode.js"></script>
<script src="./jscripts/codemirror/addon/fold/xml-fold.js"></script>
<script src="./jscripts/codemirror/addon/fold/foldgutter.js"></script>

<script src="./jscripts/codemirror/addon/fold/foldcode.js"></script>
<script src="./jscripts/codemirror/addon/fold/xml-fold.js"></script>
<script src="./jscripts/codemirror/addon/fold/foldgutter.js"></script>

Zeile 1726Zeile 1739
		$template_groups[$templategroup['prefix']] = $templategroup;
}


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


 
	/**
* @param array $a
* @param array $b
*
* @return int
*/

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

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

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

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

 

// Set the template group keys to lowercase for case insensitive comparison.
$template_groups = array_change_key_case($template_groups, CASE_LOWER);


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


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

 

// Set the prefix to lowercase for case insensitive comparison.
$exploded[0] = strtolower($exploded[0]);


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


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