Vergleich admin/modules/style/templates.php - 1.8.5 - 1.8.11

  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 368Zeile 373
				);

$gid = $db->insert_query('templategroups', $insert_array);

				);

$gid = $db->insert_query('templategroups', $insert_array);





				$plugins->run_hooks('admin_style_templates_add_template_group_commit');

log_admin_action($gid, $title);

				$plugins->run_hooks('admin_style_templates_add_template_group_commit');

log_admin_action($gid, $title);

Zeile 407Zeile 412
	echo $form->generate_hidden_field('sid', $sid);

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

	echo $form->generate_hidden_field('sid', $sid);

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

	$form_container->output_row($lang->template_group_prefix, $lang->template_group_prefix_desc, $form->generate_text_box('prefix', $template_group['prefix'], array('id' => 'prefix')), 'prefix');
$form_container->output_row($lang->template_group_title, $lang->template_group_title_desc, $form->generate_text_box('title', $template_group['title'], array('id' => 'title')), 'title');
$form_container->end();


	$form_container->output_row($lang->template_group_prefix, $lang->template_group_prefix_desc, $form->generate_text_box('prefix', $template_group['prefix'], array('id' => 'prefix')), 'prefix');
$form_container->output_row($lang->template_group_title, $lang->template_group_title_desc, $form->generate_text_box('title', $template_group['title'], array('id' => 'title')), 'title');
$form_container->end();


	$buttons = array(
$form->generate_submit_button($lang->add_template_group)

	$buttons = array(
$form->generate_submit_button($lang->add_template_group)

	);


	);


	$form->output_submit_wrapper($buttons);
$form->end();


	$form->output_submit_wrapper($buttons);
$form->end();


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

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

	}


	}


	$plugins->run_hooks("admin_style_templates_edit_set");

	$plugins->run_hooks("admin_style_templates_edit_set");





	$sid = $set['sid'];

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

	$sid = $set['sid'];

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

		{

		{

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


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


Zeile 454Zeile 459
			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');

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

	);

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

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

	}
else
{

	}
else
{

Zeile 493Zeile 498

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


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





	$form->output_submit_wrapper($buttons);

$form->end();

	$form->output_submit_wrapper($buttons);

$form->end();

Zeile 510Zeile 515
	}

$plugins->run_hooks("admin_style_templates_edit_template");

	}

$plugins->run_hooks("admin_style_templates_edit_template");





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

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

Zeile 543Zeile 548
			$template['tid'] = $db->fetch_field($query, "tid");

$plugins->run_hooks("admin_style_templates_edit_template_commit_start");

			$template['tid'] = $db->fetch_field($query, "tid");

$plugins->run_hooks("admin_style_templates_edit_template_commit_start");





			if($sid > 0)
{
// Check to see if it's never been edited before (i.e. master) or 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) or 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)
{
$template['tid'] = $db->insert_query("templates", $template_array);

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

Zeile 563Zeile 568
			else
{
// Global template set

			else
{
// Global template set

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


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


			$plugins->run_hooks("admin_style_templates_edit_template_commit");

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

			$plugins->run_hooks("admin_style_templates_edit_template_commit");

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

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

			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 603Zeile 608
				if($mybb->input['from'] == "diff_report")
{
admin_redirect("index.php?module=style-templates&amp;action=find_updated");

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

				}
else
{
admin_redirect("index.php?module=style-templates&sid=".$mybb->get_input('sid', MyBB::INPUT_INT).$expand_str2."#group_{$group}");
}
}
}

				}
else
{
admin_redirect("index.php?module=style-templates&sid=".$mybb->get_input('sid', MyBB::INPUT_INT).$expand_str2."#group_{$group}");
}
}
}

	}

if($errors)

	}

if($errors)

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 764Zeile 769
		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']);
if(!$title)
{
$errors[] = $lang->error_missing_group_title;

		}

$title = trim($mybb->input['title']);
if(!$title)
{
$errors[] = $lang->error_missing_group_title;

		}


		}


		if(!$errors)
{
if($prefix != $template_group['prefix'])

		if(!$errors)
{
if($prefix != $template_group['prefix'])

Zeile 783Zeile 793
				{
$errors[] = $lang->error_duplicate_group_prefix;
}

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

			}

			}


if(!$errors)
{


if(!$errors)
{

Zeile 806Zeile 816
	}

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





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

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

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

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





	if($errors)
{
$template_group['prefix'] = $prefix;

	if($errors)
{
$template_group['prefix'] = $prefix;

Zeile 828Zeile 838
	$form_container->output_row($lang->template_group_prefix, $lang->template_group_prefix_desc, $form->generate_text_box('prefix', $template_group['prefix'], array('id' => 'prefix')), 'prefix');
$form_container->output_row($lang->template_group_title, $lang->template_group_title_desc, $form->generate_text_box('title', $template_group['title'], array('id' => 'title')), 'title');
$form_container->end();

	$form_container->output_row($lang->template_group_prefix, $lang->template_group_prefix_desc, $form->generate_text_box('prefix', $template_group['prefix'], array('id' => 'prefix')), 'prefix');
$form_container->output_row($lang->template_group_title, $lang->template_group_title_desc, $form->generate_text_box('title', $template_group['title'], array('id' => 'title')), 'title');
$form_container->end();





	$buttons = array(
$form->generate_submit_button($lang->save_template_group)
);

	$buttons = array(
$form->generate_submit_button($lang->save_template_group)
);

Zeile 861Zeile 871
				$page->output_header($lang->search_replace);

$plugins->run_hooks("admin_style_templates_search_replace_find");

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

$plugins->run_hooks("admin_style_templates_search_replace_find");





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

$templates_list = array();

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

$templates_list = array();

Zeile 878Zeile 888
				{
$template_sets[$set['sid']] = $set['title'];
}

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