Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: templates.php 5812 2012-04-20 11:48:27Z Tomm $
| * $Id$
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 47 | Zeile 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 69 | Zeile 69 |
---|
);
if($sid > 0)
|
);
if($sid > 0)
|
{
| {
|
$sub_tabs['edit_set'] = array( 'title' => $lang->edit_set, 'link' => "index.php?module=style-templates&action=edit_set&sid=".$sid.$expand_str,
| $sub_tabs['edit_set'] = array( 'title' => $lang->edit_set, 'link' => "index.php?module=style-templates&action=edit_set&sid=".$sid.$expand_str,
|
Zeile 89 | Zeile 89 |
---|
$query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title', 'order_dir' => 'ASC')); while($template_set = $db->fetch_array($query))
|
$query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title', 'order_dir' => 'ASC')); while($template_set = $db->fetch_array($query))
|
{
| {
|
$template_sets[$template_set['sid']] = $template_set['title']; }
|
$template_sets[$template_set['sid']] = $template_set['title']; }
|
$plugins->run_hooks("admin_style_templates");
| $plugins->run_hooks("admin_style_templates");
|
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']))
|
if($mybb->request_method == "post") { if(!trim($mybb->input['title']))
|
{
| {
|
$errors[] = $lang->error_missing_set_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)
|
if($errors)
|
{
| {
|
$page->output_inline_error($errors);
|
$page->output_inline_error($errors);
|
}
| }
|
else { $mybb->input['title'] = ""; }
|
else { $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);
|
$buttons = array(); $buttons[] = $form->generate_submit_button($lang->save);
|
|
|
$form->output_submit_wrapper($buttons);
|
$form->output_submit_wrapper($buttons);
|
|
|
$form->end();
$page->output_footer();
| $form->end();
$page->output_footer();
|
Zeile 159 | Zeile 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'])) { $errors[] = $lang->error_missing_set_title;
|
if($mybb->request_method == "post") { if(empty($mybb->input['title'])) { $errors[] = $lang->error_missing_set_title;
|
}
| }
|
else
|
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]))
|
if(!isset($template_sets[$sid]))
|
{
| {
|
$errors[] = $lang->error_invalid_set; }
|
$errors[] = $lang->error_invalid_set; }
|
| // Are we trying to do malicious things in our template? if(check_template($mybb->input['template'])) { $errors[] = $lang->error_security_problem; }
|
if(!$errors) { $template_array = array(
| if(!$errors) { $template_array = array(
|
Zeile 190 | Zeile 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 210 | Zeile 216 |
---|
} } }
|
} } }
|
|
|
if($errors) { $template = $mybb->input;
| if($errors) { $template = $mybb->input;
|
Zeile 221 | Zeile 227 |
---|
{ $sid = -1; }
|
{ $sid = -1; }
|
|
|
$template['template'] = ""; $template['sid'] = $sid;
|
$template['template'] = ""; $template['sid'] = $sid;
|
}
| }
|
if($mybb->input['sid'])
|
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 .= ' <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&sid={$sid}{$expand_str}"); }
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>';
|
}
|
}
|
|
|
$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&action=add_template&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&action=add_template&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&action=add_template{$expand_str}", "post", "add_template");
|
$form = new Form("index.php?module=style-templates&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 287 | Zeile 293 |
---|
} }); </script>";
|
} }); </script>";
|
}
$page->output_footer();
| }
$page->output_footer();
|
}
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 304 | Zeile 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) {
| }
if(!$errors) {
|
$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); } }
|
|
|
if($sid) { $page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&sid={$sid}{$expand_str}"); }
|
if($sid) { $page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&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&action=edit_set&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&action=edit_set&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 351 | Zeile 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&action=edit_set{$expand_str}", "post", "edit_set"); echo $form->generate_hidden_field("sid", $sid);
|
$form = new Form("index.php?module=style-templates&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();
| $form->end();
|
$page->output_footer(); }
|
$page->output_footer(); }
|
|
|
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 396 | Zeile 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 405 | Zeile 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 425 | Zeile 431 |
---|
{ $db->update_query("templates", $template_array, "tid='{$template['tid']}' AND sid != '-2'"); }
|
{ $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");
|
$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 462 | Zeile 468 |
---|
else { admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".intval($mybb->input['sid']).$expand_str2);
|
else { admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".intval($mybb->input['sid']).$expand_str2);
|
} } else
| } } else
|
{ if($mybb->input['from'] == "diff_report")
|
{ if($mybb->input['from'] == "diff_report")
|
{
| {
|
admin_redirect("index.php?module=style-templates&action=find_updated");
|
admin_redirect("index.php?module=style-templates&action=find_updated");
|
}
| }
|
else { admin_redirect("index.php?module=style-templates&sid=".intval($mybb->input['sid']).$expand_str2."#group_{$group}");
| else { admin_redirect("index.php?module=style-templates&sid=".intval($mybb->input['sid']).$expand_str2."#group_{$group}");
|
Zeile 477 | Zeile 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 496 | Zeile 502 |
---|
<script type="text/javascript"> CodePress.language = \'mybb\'; </script>';
|
<script type="text/javascript"> CodePress.language = \'mybb\'; </script>';
|
}
| }
|
$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}");
|
| if(!isset($mybb->input['from'])) { $mybb->input['from'] = ''; }
|
if($mybb->input['from'] == "diff_report") { $page->add_breadcrumb_item($lang->find_updated, "index.php?module=style-templates&action=find_updated"); }
|
if($mybb->input['from'] == "diff_report") { $page->add_breadcrumb_item($lang->find_updated, "index.php?module=style-templates&action=find_updated"); }
|
|
|
$page->add_breadcrumb_item($lang->edit_template_breadcrumb.$template['title'], "index.php?module=style-templates&sid={$sid}");
|
$page->add_breadcrumb_item($lang->edit_template_breadcrumb.$template['title'], "index.php?module=style-templates&sid={$sid}");
|
| |
$page->output_header($lang->edit_template);
|
$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&action=find_updated" );
|
if($mybb->input['from'] == "diff_report") { $sub_tabs['find_updated'] = array( 'title' => $lang->find_updated, 'link' => "index.php?module=style-templates&action=find_updated" );
|
|
|
$sub_tabs['diff_report'] = array( 'title' => $lang->diff_report, 'link' => "index.php?module=style-templates&action=diff_report&title=".$db->escape_string($template['title'])."&sid1=".intval($template['sid'])."&sid2=-2", ); }
|
$sub_tabs['diff_report'] = array( 'title' => $lang->diff_report, 'link' => "index.php?module=style-templates&action=diff_report&title=".$db->escape_string($template['title'])."&sid1=".intval($template['sid'])."&sid2=-2", ); }
|
|
|
$sub_tabs['edit_template'] = array( 'title' => $lang->edit_template, 'link' => "index.php?module=style-templates&action=edit_template&title=".htmlspecialchars_uni($template['title']).$expand_str, 'description' => $lang->edit_template_desc );
|
$sub_tabs['edit_template'] = array( 'title' => $lang->edit_template, 'link' => "index.php?module=style-templates&action=edit_template&title=".htmlspecialchars_uni($template['title']).$expand_str, 'description' => $lang->edit_template_desc );
|
$page->output_nav_tabs($sub_tabs, 'edit_template');
| $page->output_nav_tabs($sub_tabs, 'edit_template');
|
if($errors) { $page->output_inline_error($errors);
|
if($errors) { $page->output_inline_error($errors);
|
}
| }
|
$form = new Form("index.php?module=style-templates&action=edit_template{$expand_str}", "post", "edit_template"); echo $form->generate_hidden_field('tid', $template['tid'])."\n";
|
$form = new Form("index.php?module=style-templates&action=edit_template{$expand_str}", "post", "edit_template"); echo $form->generate_hidden_field('tid', $template['tid'])."\n";
|
|
|
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 553 | Zeile 562 |
---|
if($template['sid'] == "-2") { unset($template_sets[-1]);
|
if($template['sid'] == "-2") { unset($template_sets[-1]);
|
}
| }
|
$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' => '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'));
|
$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 588 | Zeile 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'])
|
if(!$mybb->input['find'])
|
{
| {
|
flash_message($lang->search_noneset, "error"); admin_redirect("index.php?module=style-templates&action=search_replace"); } else { $page->add_breadcrumb_item($lang->search_replace);
|
flash_message($lang->search_noneset, "error"); 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_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 { while($template = $db->fetch_array($query))
|
$table->output($lang->search_results); } else { while($template = $db->fetch_array($query))
|
{
| {
|
$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 719 | Zeile 728 |
---|
$url = "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$template['sid']}"; } }
|
$url = "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&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&action=edit_template&title=".urlencode($template['title'])."&sid={$set_sid}"); } }
|
$popup->add_item($lang->edit_in." ".htmlspecialchars_uni($title), "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&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 754 | Zeile 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 775 | Zeile 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 818 | Zeile 827 |
---|
$template['modified'] = false; } $templatessets[$template['sid']][$template['title']] = $template;
|
$template['modified'] = false; } $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))
|
if(empty($templatesets))
|
{
| {
|
$table->construct_cell($lang->sprintf($lang->search_noresults_title, htmlspecialchars_uni($mybb->input['title'])), array("class" => "align_center"));
|
$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&action=edit_template&title=".urlencode($template['title'])."&sid={$set_sid}");
|
$popup->add_item($lang->edit_in." ".htmlspecialchars_uni($title), "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$set_sid}");
|
}
| }
|
} else { $popup->add_item($lang->full_edit, "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}");
|
} else { $popup->add_item($lang->full_edit, "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&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&action=diff_report&title=".urlencode($template['title'])."&sid2={$sid}");
|
if($sid > 0) { $popup->add_item($lang->diff_report, "index.php?module=style-templates&action=diff_report&title=".urlencode($template['title'])."&sid2={$sid}");
|
|
|
$popup->add_item($lang->revert_to_orig, "index.php?module=style-templates&action=revert&title=".urlencode($template['title'])."&sid={$sid}&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&action=revert&title=".urlencode($template['title'])."&sid={$sid}&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&action=delete_template&title=".urlencode($template['title'])."&sid={$sid}&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&action=delete_template&title=".urlencode($template['title'])."&sid={$sid}&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)
|
if($count == 1)
|
{
| {
|
$table->output($lang->sprintf($lang->search_names_header, htmlspecialchars_uni($mybb->input['title'])));
|
$table->output($lang->sprintf($lang->search_names_header, htmlspecialchars_uni($mybb->input['title'])));
|
}
| }
|
else if($count > 0) { $table->output(); } }
|
else if($count > 0) { $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 913 | Zeile 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&action=search_replace", "post", "do_template"); echo $form->generate_hidden_field('type', "templates");
|
$form = new Form("index.php?module=style-templates&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); $form->end(); echo "<br />";
| $buttons[] = $form->generate_submit_button($lang->find_and_replace);
$form->output_submit_wrapper($buttons);
$form->end();
echo "<br />";
|
|
|
| |
$form = new Form("index.php?module=style-templates&action=search_replace", "post", "do_title"); echo $form->generate_hidden_field('type', "titles");
|
$form = new Form("index.php?module=style-templates&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 966 | Zeile 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 988 | Zeile 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 999 | Zeile 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&action=find_updated");
|
$page->add_breadcrumb_item($lang->find_updated, "index.php?module=style-templates&action=find_updated");
|
|
|
$page->output_header($lang->find_updated);
|
$page->output_header($lang->find_updated);
|
$page->output_nav_tabs($sub_tabs, 'find_updated');
| $page->output_nav_tabs($sub_tabs, 'find_updated');
|
$query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title')); while($templateset = $db->fetch_array($query)) { $templatesets[$templateset['sid']] = $templateset; }
|
$query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title')); while($templateset = $db->fetch_array($query)) { $templatesets[$templateset['sid']] = $templateset; }
|
|
|
echo <<<LEGEND <fieldset> <legend>{$lang->legend}</legend>
| echo <<<LEGEND <fieldset> <legend>{$lang->legend}</legend>
|
Zeile 1023 | Zeile 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 1041 | Zeile 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)
|
foreach($templates as $template)
|
{
| {
|
$popup = new PopupMenu("template_{$template['tid']}", $lang->options); $popup->add_item($lang->full_edit, "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}&from=diff_report"); $popup->add_item($lang->diff_report, "index.php?module=style-templates&action=diff_report&title=".urlencode($template['title'])."&sid1=".$template['sid']."&sid2=-2&from=diff_report"); $popup->add_item($lang->revert_to_orig, "index.php?module=style-templates&action=revert&title=".urlencode($template['title'])."&sid={$sid}&from=diff_report&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_revertion}')");
|
$popup = new PopupMenu("template_{$template['tid']}", $lang->options); $popup->add_item($lang->full_edit, "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}&from=diff_report"); $popup->add_item($lang->diff_report, "index.php?module=style-templates&action=diff_report&title=".urlencode($template['title'])."&sid1=".$template['sid']."&sid2=-2&from=diff_report"); $popup->add_item($lang->revert_to_orig, "index.php?module=style-templates&action=revert&title=".urlencode($template['title'])."&sid={$sid}&from=diff_report&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_revertion}')");
|
|
|
$table->construct_cell("<a href=\"index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}&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&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}&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 1078 | Zeile 1087 |
---|
} } }
|
} } }
|
|
|
$page->output_footer(); }
|
$page->output_footer(); }
|
|
|
if($mybb->input['action'] == "delete_set") { $plugins->run_hooks("admin_style_templates_delete_set");
|
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))
|
{
| {
|
$properties = @unserialize($theme['properties']); if($properties['templateset'] == $sid) {
| $properties = @unserialize($theme['properties']); if($properties['templateset'] == $sid) {
|
Zeile 1107 | Zeile 1116 |
---|
admin_redirect("index.php?module=style-templates"); break; }
|
admin_redirect("index.php?module=style-templates"); break; }
|
} // User clicked no if($mybb->input['no']) {
| }
// User clicked no if($mybb->input['no']) {
|
admin_redirect("index.php?module=style-templates"); }
|
admin_redirect("index.php?module=style-templates"); }
|
|
|
if($mybb->request_method == "post") { // Delete the templateset $db->delete_query("templatesets", "sid='{$set['sid']}'"); // Delete all custom templates in this templateset $db->delete_query("templates", "sid='{$set['sid']}'");
|
if($mybb->request_method == "post") { // Delete the templateset $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 log_admin_action($set['sid'], $set['title']);
flash_message($lang->success_template_set_deleted, 'success');
|
$plugins->run_hooks("admin_style_templates_delete_set_commit");
// Log admin action log_admin_action($set['sid'], $set['title']);
flash_message($lang->success_template_set_deleted, 'success');
|
admin_redirect("index.php?module=style-templates"); } else { $page->output_confirm_action("index.php?module=style-templates&action=delete_set&sid={$set['sid']}", $lang->confirm_template_set_deletion); }
| admin_redirect("index.php?module=style-templates"); } else { $page->output_confirm_action("index.php?module=style-templates&action=delete_set&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 1148 | Zeile 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 1166 | Zeile 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");
| $plugins->run_hooks("admin_style_templates_delete_template_commit");
|
// 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']);
|
Zeile 1176 | Zeile 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&action=delete_template&sid={$template['sid']}{$expand_str}", $lang->confirm_template_deletion);
|
$page->output_confirm_action("index.php?module=style-templates&action=delete_template&sid={$template['sid']}{$expand_str}", $lang->confirm_template_deletion);
|
}
| }
|
}
|
}
|
|
|
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&action=find_updated" );
|
if($mybb->input['sid2'] == -2) { $sub_tabs['find_updated'] = array( 'title' => $lang->find_updated, 'link' => "index.php?module=style-templates&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&action=diff_report&title=".$db->escape_string($mybb->input['title'])."&from=".$mybb->input['from']."sid1=".intval($mybb->input['sid1'])."&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&action=diff_report&title=".$db->escape_string($mybb->input['title'])."&from=".$mybb->input['from']."sid1=".intval($mybb->input['sid1'])."&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( 'title' => $lang->full_edit, 'link' => "index.php?module=style-templates&action=edit_template&title=".urlencode($template1['title'])."&sid=".intval($mybb->input['sid1'])."&from=diff_report", );
|
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'])."&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']);
$plugins->run_hooks("admin_style_templates_diff_report_run");
|
$template1['template'] = explode("\n", $template1['template']); $template2['template'] = explode("\n", $template2['template']);
$plugins->run_hooks("admin_style_templates_diff_report_run");
|
require_once MYBB_ROOT."inc/3rdparty/diff/Diff.php"; require_once MYBB_ROOT."inc/3rdparty/diff/Diff/Renderer/inline.php";
| |
|
|
$diff = new Text_Diff('auto', array($template1['template'], $template2['template'])); $renderer = new Text_Diff_Renderer_inline();
| require_once MYBB_ROOT."inc/3rdparty/diff/Diff.php"; require_once MYBB_ROOT."inc/3rdparty/diff/Diff/Renderer.php"; require_once MYBB_ROOT."inc/3rdparty/diff/Diff/Renderer/Inline.php";
$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&sid={$sid}{$expand_str}"); }
|
if($sid) { $page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&sid={$sid}{$expand_str}"); }
|
|
|
if($mybb->input['sid2'] == -2) { $page->add_breadcrumb_item($lang->find_updated, "index.php?module=style-templates&action=find_updated");
|
if($mybb->input['sid2'] == -2) { $page->add_breadcrumb_item($lang->find_updated, "index.php?module=style-templates&action=find_updated");
|
}
| }
|
$page->add_breadcrumb_item($lang->diff_report.": ".$template1['title'], "index.php?module=style-templates&action=diff_report&title=".$db->escape_string($mybb->input['title'])."&from=".$mybb->input['from']."&sid1=".intval($mybb->input['sid1'])."&sid2=".intval($mybb->input['sid2']));
|
$page->add_breadcrumb_item($lang->diff_report.": ".$template1['title'], "index.php?module=style-templates&action=diff_report&title=".$db->escape_string($mybb->input['title'])."&from=".$mybb->input['from']."&sid1=".intval($mybb->input['sid1'])."&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'])
|
if($mybb->input['from'])
|
{
| {
|
$table->construct_header("<ins>".$lang->master_updated_ins."</ins><br /><del>".$lang->master_updated_del."</del>");
|
$table->construct_header("<ins>".$lang->master_updated_ins."</ins><br /><del>".$lang->master_updated_del."</del>");
|
}
| }
|
else { $table->construct_header("<ins>".$lang->master_updated_del."</ins><br /><del>".$lang->master_updated_ins."</del>"); }
|
else { $table->construct_header("<ins>".$lang->master_updated_del."</ins><br /><del>".$lang->master_updated_ins."</del>"); }
|
|
|
$table->construct_cell("<pre class=\"differential\">".$renderer->render($diff)."</pre>"); $table->construct_row();
|
$table->construct_cell("<pre class=\"differential\">".$renderer->render($diff)."</pre>"); $table->construct_row();
|
|
|
$table->output($lang->template_diff_analysis.": ".$template1['title']);
|
$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 1286 | Zeile 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 1304 | Zeile 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");
| $plugins->run_hooks("admin_style_templates_revert_commit");
|
// Log admin action log_admin_action($template['tid'], $template['sid'], $template['sid'], $template['set_title']);
|
// Log admin action log_admin_action($template['tid'], $template['sid'], $template['sid'], $template['set_title']);
|
|
|
flash_message($lang->success_template_reverted, 'success');
|
flash_message($lang->success_template_reverted, 'success');
|
|
|
if($mybb->input['from'] == "diff_report") { admin_redirect("index.php?module=style-templates&action=find_updated"); } else
|
if($mybb->input['from'] == "diff_report") { admin_redirect("index.php?module=style-templates&action=find_updated"); } else
|
{
| {
|
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
|
else
|
{
| {
|
$page->output_confirm_action("index.php?module=style-templates&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&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&sid={$sid}");
| $page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&sid={$sid}");
|
$page->output_header($lang->template_sets);
|
$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 1351 | Zeile 1374 |
---|
$popup = new PopupMenu("template_{$template['tid']}", $lang->options); $popup->add_item($lang->full_edit, "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid=-1"); $popup->add_item($lang->delete_template, "index.php?module=style-templates&action=delete_template&title=".urlencode($template['title'])."&sid=-1&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&action=edit_template&title=".urlencode($template['title'])."&sid=-1"); $popup->add_item($lang->delete_template, "index.php?module=style-templates&action=delete_template&title=".urlencode($template['title'])."&sid=-1&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");
|
|
|
$table->construct_cell("<a href=\"index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid=-1\">{$template['title']}</a>"); $table->construct_cell($popup->fetch(), array("class" => "align_center"));
|
$table->construct_cell("<a href=\"index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&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(); }
|
| if(!isset($mybb->input['expand'])) { $mybb->input['expand'] = ''; }
|
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 1389 | Zeile 1416 |
---|
} $template_groups[$templategroup['prefix']] = $templategroup; }
|
} $template_groups[$templategroup['prefix']] = $templategroup; }
|
|
|
function sort_template_groups($a, $b)
|
function sort_template_groups($a, $b)
|
{
| {
|
return strcasecmp($a['title'], $b['title']); } uasort($template_groups, "sort_template_groups");
|
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" => "", "title" => $lang->ungrouped_templates, "gid" => -1 );
|
// Add the ungrouped templates group at the bottom $template_groups['-1'] = array( "prefix" => "", "title" => $lang->ungrouped_templates, "gid" => -1 );
|
|
|
// Load the list of templates $query = $db->simple_select("templates", "*", "sid='".intval($mybb->input['sid'])."' 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='".intval($mybb->input['sid'])."' OR sid='-2'", array('order_by' => 'sid DESC, title', 'order_dir' => 'ASC')); 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 1417 | Zeile 1444 |
---|
{ $group = -1; }
|
{ $group = -1; }
|
$template['gid'] = $template_groups[$exploded[0]]['gid'];
| |
|
|
// Ungrouped template? if(!$template['gid'])
| $template['gid'] = -1; if(isset($template_groups[$exploded[0]]['gid']))
|
{
|
{
|
$template['gid'] = -1;
| $template['gid'] = $template_groups[$exploded[0]]['gid'];
|
}
// If this template is not a master template, we simple add it to the list
| }
// If this template is not a master template, we simple add it to the list
|
Zeile 1437 | Zeile 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 1455 | Zeile 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))
|
$tmp_expand = ""; if(in_array($group['gid'], $expand_array))
|
{
| {
|
$expand = $lang->collapse; $expanded = true;
|
$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 1478 | Zeile 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'])
|
{
| {
|
$group['expand_str'] .= "|"; } $group['expand_str'] .= $group['gid']; }
|
$group['expand_str'] .= "|"; } $group['expand_str'] .= $group['gid']; }
|
|
|
if($group['expand_str']) { $group['expand_str'] = "&expand={$group['expand_str']}"; }
|
if($group['expand_str']) { $group['expand_str'] = "&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&sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>"); $table->construct_cell("<a href=\"index.php?module=style-templates&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&sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>"); $table->construct_cell("<a href=\"index.php?module=style-templates&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&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}{$expand_str}");
|
$popup = new PopupMenu("template_{$template['tid']}", $lang->options); $popup->add_item($lang->full_edit, "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}{$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&action=diff_report&title=".urlencode($template['title'])."&sid2={$sid}");
|
if($sid > 0) { $popup->add_item($lang->diff_report, "index.php?module=style-templates&action=diff_report&title=".urlencode($template['title'])."&sid2={$sid}");
|
|
|
$popup->add_item($lang->revert_to_orig, "index.php?module=style-templates&action=revert&title=".urlencode($template['title'])."&sid={$sid}&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&action=revert&title=".urlencode($template['title'])."&sid={$sid}&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&action=delete_template&title=".urlencode($template['title'])."&sid={$sid}&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&action=delete_template&title=".urlencode($template['title'])."&sid={$sid}&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&action=edit_template&title=".urlencode($template['title'])."&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&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}{$expand_str}\" >{$template['pretty_title']}</a></span>"); $table->construct_cell($popup->fetch(), array("class" => "align_center"));
|
|
|
$table->construct_row();
|
$table->construct_row();
|
} }
| } }
|
else if(isset($group['templates']) && count($group['templates']) > 0)
|
else if(isset($group['templates']) && count($group['templates']) > 0)
|
{
| {
|
$table->construct_cell("<strong><a href=\"index.php?module=style-templates&sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>"); $table->construct_cell("<a href=\"index.php?module=style-templates&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&sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>"); $table->construct_cell("<a href=\"index.php?module=style-templates&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(); }
|
$page->output_footer(); }
|
|
|
if(!$mybb->input['action']) { $plugins->run_hooks("admin_style_templates_start");
|
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))
|
{
| {
|
$tbits = unserialize($theme['properties']);
|
$tbits = unserialize($theme['properties']);
|
$themes[$tbits['templateset']][$theme['tid']] = $theme['name']; }
| $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;
|
|
|
$query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title', 'order_dir' => 'ASC')); while($template_set = $db->fetch_array($query)) { $template_sets[$template_set['sid']] = $template_set; }
|
$query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title', 'order_dir' => 'ASC')); while($template_set = $db->fetch_array($query)) { $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 1585 | Zeile 1611 |
---|
$table->construct_row(); continue; }
|
$table->construct_row(); continue; }
|
|
|
if($themes[$set['sid']])
|
if($themes[$set['sid']])
|
{
| {
|
$used_by_note = $lang->used_by; $comma = ""; foreach($themes[$set['sid']] as $theme_name)
| $used_by_note = $lang->used_by; $comma = ""; foreach($themes[$set['sid']] as $theme_name)
|
Zeile 1600 | Zeile 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&sid={$set['sid']}\">{$lang->expand_templates}</a>"; } else
|
if($set['sid'] == 1) { $actions = "<a href=\"index.php?module=style-templates&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&sid={$set['sid']}");
| $popup->add_item($lang->expand_templates, "index.php?module=style-templates&sid={$set['sid']}");
|
if($set['sid'] != 1) { $popup->add_item($lang->edit_template_set, "index.php?module=style-templates&action=edit_set&sid={$set['sid']}");
|
if($set['sid'] != 1) { $popup->add_item($lang->edit_template_set, "index.php?module=style-templates&action=edit_set&sid={$set['sid']}");
|
|
|
if(!$themes[$set['sid']]) { $popup->add_item($lang->delete_template_set, "index.php?module=style-templates&action=delete_set&sid={$set['sid']}&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&action=delete_set&sid={$set['sid']}&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&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&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();
|