Vergleich admin/modules/style/templates.php - 1.4.0 - 1.4.4

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 25Zeile 25
if(isset($mybb->input['expand']))
{
$expand_array = explode("|", $mybb->input['expand']);

if(isset($mybb->input['expand']))
{
$expand_array = explode("|", $mybb->input['expand']);

	array_map("intval", $expand_array);

	$expand_array = array_map("intval", $expand_array);

	$expand_str = "&expand=".implode("|", $expand_array);
$expand_str2 = "&expand=".implode("|", $expand_array);
}

	$expand_str = "&expand=".implode("|", $expand_array);
$expand_str2 = "&expand=".implode("|", $expand_array);
}

Zeile 164Zeile 164
	{
if(empty($mybb->input['title']))
{

	{
if(empty($mybb->input['title']))
{

			$errors[] = $lang->error_missing_title;

			$errors[] = $lang->error_missing_set_title;

		}
else
{

		}
else
{

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

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

				admin_redirect("index.php?module=style/templates&action=edit_template&tid=".intval($tid)."&sid=".$sid.$expand_str2);

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

			}
else
{

			}
else
{

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


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


	$page->extra_header .= '



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

	<link type="text/css" href="./jscripts/codepress/languages/codepress-mybb.css" rel="stylesheet" id="cp-lang-style" />
<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
<script type="text/javascript">
CodePress.language = \'mybb\';
</script>';

	<link type="text/css" href="./jscripts/codepress/languages/codepress-mybb.css" rel="stylesheet" id="cp-lang-style" />
<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
<script type="text/javascript">
CodePress.language = \'mybb\';
</script>';

 
	}

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


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


Zeile 254Zeile 257
	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'));


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


Zeile 271Zeile 274
	
$form->end();


	
$form->end();


	echo "<script language=\"Javascript\" type=\"text/javascript\">



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

	Event.observe('add_template', 'submit', function()
{
if($('template_cp')) {

	Event.observe('add_template', 'submit', function()
{
if($('template_cp')) {

Zeile 282Zeile 287
		}
});
</script>";

		}
});
</script>";

 
	}


$page->output_footer();
}


$page->output_footer();
}

Zeile 293Zeile 299
	$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)

	{

	{

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

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

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

		{

		{

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


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


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


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

Zeile 347Zeile 353
	}

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

	}

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

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


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

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

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

$form->end();

	$form->output_submit_wrapper($buttons);

$form->end();

Zeile 366Zeile 372
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['tid'] || !$sid)

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

Zeile 402Zeile 408
				else
{
$db->update_query("templates", $template_array, "tid='{$tid}'");

				else
{
$db->update_query("templates", $template_array, "tid='{$tid}'");

				}
}

				}
}

			else
{
// Global template set

			else
{
// Global template set

Zeile 433Zeile 439
			
if($mybb->input['continue'])
{

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

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








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

			else
{

			else
{

				admin_redirect("index.php?module=style/templates&sid=".$sid.$expand_str2."#group_{$group}");








				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=".$sid.$expand_str2."#group_{$group}");
}

			}
}

			}
}

	}


	}


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

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

	}

	}

	else

	else

	{
$query = $db->simple_select("templates", "title", "tid='".intval($mybb->input['tid'])."' AND (sid='-2' OR sid='{$sid}')", array('order_by' => 'sid', 'order_dir' => 'ASC', 'limit' => 1));
$title = $db->fetch_field($query, "title");

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

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


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


	$page->extra_header .= '



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

	<link type="text/css" href="./jscripts/codepress/languages/codepress-mybb.css" rel="stylesheet" id="cp-lang-style" />
<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
<script type="text/javascript">
CodePress.language = \'mybb\';

	<link type="text/css" href="./jscripts/codepress/languages/codepress-mybb.css" rel="stylesheet" id="cp-lang-style" />
<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
<script type="text/javascript">
CodePress.language = \'mybb\';

	</script>';

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

	</script>';
}


	

	

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

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

	

	

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








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

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

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

	
$sub_tabs = array();

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

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

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

		'link' => "index.php?module=style/templates&amp;action=edit_template&amp;tid=".$mybb->input['tid'].$expand_str,

		'link' => "index.php?module=style/templates&amp;action=edit_template&amp;title=".htmlspecialchars_uni($template['title']).$expand_str,

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


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


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


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


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






	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']);
$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 494Zeile 538
	
$form->end();


	
$form->end();


	echo "<script language=\"Javascript\" type=\"text/javascript\">



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

	Event.observe('edit_template', 'submit', function()
{
if($('template_cp')) {

	Event.observe('edit_template', 'submit', function()
{
if($('template_cp')) {

Zeile 505Zeile 551
		}
});
</script>";

		}
});
</script>";

 
	}


$page->output_footer();
}


$page->output_footer();
}

Zeile 525Zeile 572
				admin_redirect("index.php?module=style/templates&action=search_replace");
}
else

				admin_redirect("index.php?module=style/templates&action=search_replace");
}
else

			{				



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


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

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

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

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

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

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

							$newtemplate = str_replace($mybb->input['find'], $mybb->input['replace'], $template['template']);

							$newtemplate = str_ireplace($mybb->input['find'], $mybb->input['replace'], $template['template']);

							if($newtemplate != $template['template'])
{
// If the template is different, that means the search term has been found.

							if($newtemplate != $template['template'])
{
// If the template is different, that means the search term has been found.

Zeile 593Zeile 642
										);
$new_tid = $db->insert_query("templates", $new_template);
$label = $lang->sprintf($lang->search_created_custom, $template['title']);

										);
$new_tid = $db->insert_query("templates", $new_template);
$label = $lang->sprintf($lang->search_created_custom, $template['title']);

										$url = "index.php?module=style/templates&amp;action=edit_template&amp;tid={$new_tid}&amp;sid=1";

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

									}
else
{

									}
else
{

Zeile 604Zeile 653
										);
$db->update_query("templates", $updatedtemplate, "tid='".$template['tid']."'");
$label = $lang->sprintf($lang->search_updated, $template['title']);

										);
$db->update_query("templates", $updatedtemplate, "tid='".$template['tid']."'");
$label = $lang->sprintf($lang->search_updated, $template['title']);

										$url = "index.php?module=style/templates&amp;action=edit_template&amp;tid={$template['tid']}&amp;sid={$template['sid']}";

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

									}
}
else
{
// Just show that the term was found
if($template['sid'] == -2)

									}
}
else
{
// Just show that the term was found
if($template['sid'] == -2)

									{
$label = $lang->sprintf($lang->search_found, $template['title']);

									{
$label = $lang->sprintf($lang->search_found, $template['title']);

									}
else
{
$label = $lang->sprintf($lang->search_found, $template['title']);

									}
else
{
$label = $lang->sprintf($lang->search_found, $template['title']);

										$url = "index.php?module=style/templates&amp;action=edit_template&amp;tid={$template['tid']}&amp;sid={$template['sid']}";

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

									}
}
}

									}
}
}

Zeile 632Zeile 681
								{
if($set_sid > 0)
{

								{
if($set_sid > 0)
{

										$popup->add_item($lang->edit_in." ".htmlspecialchars_uni($title), "index.php?module=style/templates&amp;action=edit_template&amp;tid={$template['tid']}&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 649Zeile 698
						if($count == 1)
{
$table->output($lang->search_results);

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

						}
else

						}
else

						{
$table->output();
}

						{
$table->output();
}

Zeile 704Zeile 753
				while($template = $db->fetch_array($query))
{
if($template['sid'] == -2)

				while($template = $db->fetch_array($query))
{
if($template['sid'] == -2)

					{

					{

						if(!$template['customtid'])

						if(!$template['customtid'])

						{

						{

							$template['original'] = true;

							$template['original'] = true;

						}

						}

						else
{
$template['modified'] = true;

						else
{
$template['modified'] = true;

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

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

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

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


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


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

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

					

					

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

foreach($templates as $template)
{

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

foreach($templates as $template)
{

 
						$template['pretty_title'] = $template['title'];


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

if($sid == -2)

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

if($sid == -2)

Zeile 753Zeile 806
							{
if($set_sid < 0) continue;


							{
if($set_sid < 0) continue;


								$popup->add_item($lang->edit_in." ".htmlspecialchars_uni($title), "index.php?module=style/templates&amp;action=edit_template&amp;tid={$template['tid']}&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}");

							}
}
else

							}
}
else

						{
$popup->add_item($lang->full_edit, "index.php?module=style/templates&amp;action=edit_template&amp;tid={$template['tid']}&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($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(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}");


								$popup->add_item($lang->revert_to_orig, "index.php?module=style/templates&amp;action=revert&amp;tid={$template['tid']}&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['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)
{

						}				
// 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;tid={$template['tid']}&amp;sid={$sid}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");

							$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['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;tid={$template['tid']}&amp;sid={$sid}\">{$template['title']}</a></span>", array("width" => "85%"));

						$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}\">{$template['pretty_title']}</a></span>", array("width" => "85%"));

						$table->construct_cell($popup->fetch(), array("class" => "align_center"));

$table->construct_row();

						$table->construct_cell($popup->fetch(), array("class" => "align_center"));

$table->construct_row();

Zeile 802Zeile 855
		}
}


		}
}


	$page->extra_header .= '



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

	<link type="text/css" href="./jscripts/codepress/languages/codepress-php.css" rel="stylesheet" id="cp-lang-style" />
<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
<script type="text/javascript">
CodePress.language = \'php\';
</script>';

	<link type="text/css" href="./jscripts/codepress/languages/codepress-php.css" rel="stylesheet" id="cp-lang-style" />
<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
<script type="text/javascript">
CodePress.language = \'php\';
</script>';

 
	}

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

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

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

	
$page->output_header($lang->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_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 = 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->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);

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


$form->output_submit_wrapper($buttons);

$form->end();



$form->output_submit_wrapper($buttons);

$form->end();


	echo "<br />";



	echo "<br />";



Zeile 848Zeile 906
	
$form->end();


	
$form->end();


	echo "<script language=\"Javascript\" type=\"text/javascript\">



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

	Event.observe('do_template', 'submit', function()
{
if($('find_cp')) {

	Event.observe('do_template', 'submit', function()
{
if($('find_cp')) {

Zeile 866Zeile 926
		}
});
</script>";

		}
});
</script>";




	}


	$page->output_footer();
}

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

	$page->output_footer();
}

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





	// Finds templates that are old and have been updated by MyBB
$compare_version = $mybb->version_code;
$query = $db->query("

	// Finds templates that are old and have been updated by MyBB
$compare_version = $mybb->version_code;
$query = $db->query("

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


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


Zeile 943Zeile 1006
		foreach($templates as $template)
{
$popup = new PopupMenu("template_{$template['tid']}", $lang->options);

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

			//$popup->add_item($lang->inline_edit, "javascript:;");
$popup->add_item($lang->full_edit, "index.php?module=style/templates&amp;action=edit_template&amp;tid={$template['tid']}&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}&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");

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

			$popup->add_item($lang->revert_to_orig, "index.php?module=style/templates&amp;action=revert&amp;tid={$template['tid']}&amp;sid={$sid}&amp;find_updated=1&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;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;tid={$template['tid']}&amp;sid={$sid}\">{$template['title']}</a>", array('width' => '80%')); // onclick=\"Templates.quick_edit('{$template['tid']}'); return false;\"

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

$table->construct_row();

Zeile 1034Zeile 1096
		SELECT t.*, s.title as set_title
FROM ".TABLE_PREFIX."templates t
LEFT JOIN ".TABLE_PREFIX."templatesets s ON(t.sid=s.sid)

		SELECT t.*, s.title as set_title
FROM ".TABLE_PREFIX."templates t
LEFT JOIN ".TABLE_PREFIX."templatesets s ON(t.sid=s.sid)

		WHERE t.tid='".intval($mybb->input['tid'])."' AND t.sid > '-2' AND t.sid = '{$sid}'

		WHERE t.title='".$db->escape_string($mybb->input['title'])."' AND t.sid > '-2' AND t.sid = '{$sid}'

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


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


Zeile 1060Zeile 1122

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


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


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


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

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

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

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

	}

	}

}

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

}

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

Zeile 1076Zeile 1138
	if(!$mybb->input['sid1'])
{
$mybb->input['sid1'] = -2;

	if(!$mybb->input['sid1'])
{
$mybb->input['sid1'] = -2;

	}

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

	}

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

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

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

Zeile 1099Zeile 1161

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

 
	
if($mybb->input['sid2'] == -2)
{
$sub_tabs['full_edit'] = array(
'title' => $lang->full_edit,
'link' => "index.php?module=style/templates&action=edit_template&title=".urlencode($template1['title'])."&sid=".intval($mybb->input['sid1'])."&amp;from=diff_report",
);
}


if($template1['template'] == $template2['template'])
{
flash_message($lang->templates_the_same, 'error');
admin_redirect("index.php?module=style/templates&sid=".intval($mybb->input['sid2']).$expand_str);
}


if($template1['template'] == $template2['template'])
{
flash_message($lang->templates_the_same, 'error');
admin_redirect("index.php?module=style/templates&sid=".intval($mybb->input['sid2']).$expand_str);
}





	$template1['template'] = explode("\n", $template1['template']);
$template2['template'] = explode("\n", $template2['template']);


	$template1['template'] = explode("\n", $template1['template']);
$template2['template'] = explode("\n", $template2['template']);


Zeile 1115Zeile 1185

$diff = &new Text_Diff('auto', array($template1['template'], $template2['template']));
$renderer = &new Text_Diff_Renderer_inline();


$diff = &new Text_Diff('auto', array($template1['template'], $template2['template']));
$renderer = &new 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}");
}


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




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

	

	

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





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

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

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

	
$table = new Table;

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


	
$table = new Table;

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


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

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

	$table->construct_row();


	$table->construct_row();


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


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


	$page->output_footer();

	$page->output_footer();

}

}


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


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

	

	

	$query = $db->query("
SELECT t.*, s.title as set_title
FROM ".TABLE_PREFIX."templates t
LEFT JOIN ".TABLE_PREFIX."templatesets s ON(s.sid=t.sid)

	$query = $db->query("
SELECT t.*, s.title as set_title
FROM ".TABLE_PREFIX."templates t
LEFT JOIN ".TABLE_PREFIX."templatesets s ON(s.sid=t.sid)

		WHERE t.tid='".intval($mybb->input['tid'])."' AND t.sid > 0 AND t.sid = '".intval($mybb->input['sid'])."'

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


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


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

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

	}

	}

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

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

Zeile 1174Zeile 1251

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



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


		if($mybb->input['find_updated'] == 1)

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

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

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

Zeile 1208Zeile 1285
	if($sid == -1)
{
$query = $db->simple_select("templates", "tid,title", "sid='-1'", array('order_by' => 'title', 'order_dir' => 'ASC'));

	if($sid == -1)
{
$query = $db->simple_select("templates", "tid,title", "sid='-1'", array('order_by' => 'title', 'order_dir' => 'ASC'));

		while($template = $db->fetch_array($query))
{

		while($template = $db->fetch_array($query))
{

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

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

			$popup->add_item($lang->full_edit, "index.php?module=style/templates&amp;action=edit_template&amp;tid={$template['tid']}&amp;sid=-1");
$popup->add_item($lang->delete_template, "index.php?module=style/templates&amp;action=delete_template&amp;tid={$template['tid']}&amp;sid=-1&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");

			$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;tid={$template['tid']}&amp;sid=-1\">{$template['title']}</a>");

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

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

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

$page->output_footer();

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

$page->output_footer();

	}


	}


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

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

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

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

	

	

	if(count($expand_array) > 0)
{
// The ungrouped list is expanded so we need to load all templates
if(in_array('-1', $expand_array))

	if(count($expand_array) > 0)
{
// The ungrouped list is expanded so we need to load all templates
if(in_array('-1', $expand_array))

		{

		{

			$template_sql = '';

			$template_sql = '';

		}

		}

		else

		else

		{

		{

			$template_sql = " AND (1=0{$template_sql})";
}


			$template_sql = " AND (1=0{$template_sql})";
}


Zeile 1284Zeile 1361
		while($template = $db->fetch_array($query))
{
$exploded = explode("_", $template['title'], 2);

		while($template = $db->fetch_array($query))
{
$exploded = explode("_", $template['title'], 2);

			

			

			if(isset($template_groups[$exploded[0]]))
{
$group = $exploded[0];

			if(isset($template_groups[$exploded[0]]))
{
$group = $exploded[0];

Zeile 1348Zeile 1425
			$group['expand_str'] .= $group['gid'];
}


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


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






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

$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_row(array("class" => "alt_row", "id" => "group_".$group['gid'], "name" => "group_".$group['gid']));

if($expanded == true && isset($group['templates']) && count($group['templates']) > 0)

Zeile 1359Zeile 1441
			
foreach($templates as $template)
{

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

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

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

Zeile 1368Zeile 1452
					{
$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->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;tid={$template['tid']}&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['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)
{

				}				
// 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;tid={$template['tid']}&amp;sid={$sid}&amp;my_post_key={$mybb->post_code}{$expand_str}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");

					$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['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;tid={$template['tid']}&amp;sid={$sid}{$expand_str}\" >{$template['title']}</a></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_row();

				$table->construct_cell($popup->fetch(), array("class" => "align_center"));

$table->construct_row();