Zeile 16 | Zeile 16 |
---|
$page->add_breadcrumb_item($lang->template_sets, "index.php?module=style-templates");
|
$page->add_breadcrumb_item($lang->template_sets, "index.php?module=style-templates");
|
$sid = $mybb->get_input('sid', 1);
| $sid = $mybb->get_input('sid', MyBB::INPUT_INT);
|
$expand_str = ""; $expand_str2 = "";
| $expand_str = ""; $expand_str2 = "";
|
Zeile 42 | Zeile 42 |
---|
'link' => "index.php?module=style-templates&action=add_set".$expand_str );
|
'link' => "index.php?module=style-templates&action=add_set".$expand_str );
|
if($mybb->get_input('sid', 1) != -1)
| if($mybb->get_input('sid', MyBB::INPUT_INT) != -1)
|
{ $sub_tabs['add_template_group'] = array( 'title' => $lang->add_template_group,
| { $sub_tabs['add_template_group'] = array( 'title' => $lang->add_template_group,
|
Zeile 86 | Zeile 86 |
---|
'description' => $lang->add_template_desc );
|
'description' => $lang->add_template_desc );
|
if($mybb->get_input('sid', 1) != -1)
| if($mybb->get_input('sid', MyBB::INPUT_INT) != -1)
|
{ $sub_tabs['add_template_group'] = array( 'title' => $lang->add_template_group,
| { $sub_tabs['add_template_group'] = array( 'title' => $lang->add_template_group,
|
Zeile 102 | Zeile 102 |
---|
$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']] = htmlspecialchars_uni($template_set['title']);
|
}
$plugins->run_hooks("admin_style_templates");
| }
$plugins->run_hooks("admin_style_templates");
|
Zeile 157 | Zeile 157 |
---|
$form = new Form("index.php?module=style-templates&action=add_set", "post", "add_set");
$form_container = new FormContainer($lang->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->output_row($lang->title, "", $form->generate_text_box('title', htmlspecialchars_uni($mybb->input['title']), array('id' => 'title')), 'title');
|
$form_container->end();
$buttons = array();
| $form_container->end();
$buttons = array();
|
Zeile 177 | Zeile 177 |
---|
if($mybb->request_method == "post") { if(empty($mybb->input['title']))
|
if($mybb->request_method == "post") { if(empty($mybb->input['title']))
|
{
| {
|
$errors[] = $lang->error_missing_set_title; } else { $query = $db->simple_select("templates", "COUNT(tid) as count", "title='".$db->escape_string($mybb->input['title'])."' AND (sid = '-2' OR sid = '{$sid}')"); if($db->fetch_field($query, "count") > 0)
|
$errors[] = $lang->error_missing_set_title; } else { $query = $db->simple_select("templates", "COUNT(tid) as count", "title='".$db->escape_string($mybb->input['title'])."' AND (sid = '-2' OR sid = '{$sid}')"); if($db->fetch_field($query, "count") > 0)
|
{
| {
|
$errors[] = $lang->error_already_exists; }
|
$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']))
|
// Are we trying to do malicious things in our template? if(check_template($mybb->input['template']))
|
{
| {
|
$errors[] = $lang->error_security_problem; }
| $errors[] = $lang->error_security_problem; }
|
Zeile 210 | Zeile 210 |
---|
'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]);
|
Zeile 227 | Zeile 227 |
---|
else { admin_redirect("index.php?module=style-templates&sid=".$sid.$expand_str2);
|
else { admin_redirect("index.php?module=style-templates&sid=".$sid.$expand_str2);
|
} } }
if($errors) { $template = $mybb->input; } else {
| } } }
if($errors) { $template = $mybb->input; } else {
|
if(!$sid) { $sid = -1; }
|
if(!$sid) { $sid = -1; }
|
| $template['title'] = "";
|
$template['template'] = ""; $template['sid'] = $sid; }
| $template['template'] = ""; $template['sid'] = $sid; }
|
Zeile 254 | Zeile 255 |
---|
if($admin_options['codepress'] != 0) { $page->extra_header .= '
|
if($admin_options['codepress'] != 0) { $page->extra_header .= '
|
<link href="./jscripts/codemirror/lib/codemirror.css" rel="stylesheet"> <link href="./jscripts/codemirror/theme/mybb.css" rel="stylesheet"> <script src="./jscripts/codemirror/lib/codemirror.js"></script> <script src="./jscripts/codemirror/mode/xml/xml.js"></script> <script src="./jscripts/codemirror/mode/javascript/javascript.js"></script> <script src="./jscripts/codemirror/mode/css/css.js"></script> <script src="./jscripts/codemirror/mode/htmlmixed/htmlmixed.js"></script> <link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet" > <script src="./jscripts/codemirror/addon/dialog/dialog.js"></script> <script src="./jscripts/codemirror/addon/search/searchcursor.js"></script> <script src="./jscripts/codemirror/addon/search/search.js"></script>
| <link href="./jscripts/codemirror/lib/codemirror.css?ver=1813" rel="stylesheet"> <link href="./jscripts/codemirror/theme/mybb.css?ver=1813" rel="stylesheet"> <script src="./jscripts/codemirror/lib/codemirror.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/xml/xml.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/javascript/javascript.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/css/css.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/htmlmixed/htmlmixed.js?ver=1813"></script> <link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css?ver=1813" rel="stylesheet"> <script src="./jscripts/codemirror/addon/dialog/dialog.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/search/searchcursor.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/search/search.js?ver=1821"></script> <script src="./jscripts/codemirror/addon/fold/foldcode.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/fold/xml-fold.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/fold/foldgutter.js?ver=1813"></script> <link href="./jscripts/codemirror/addon/fold/foldgutter.css?ver=1813" rel="stylesheet">
|
'; }
| '; }
|
Zeile 288 | Zeile 293 |
---|
$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 = new FormContainer($lang->add_template, 'tfixed');
|
$form_container->output_row($lang->template_name, $lang->template_name_desc, $form->generate_text_box('title', $template['title'], array('id' => 'title')), 'title'); $form_container->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' => '', 'style' => 'width: 100%; height: 500px;')), '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' => '', 'style' => 'width: 100%; height: 500px;')), 'template');
|
Zeile 300 | Zeile 305 |
---|
$form->output_submit_wrapper($buttons);
$form->end();
|
$form->output_submit_wrapper($buttons);
$form->end();
|
|
|
if($admin_options['codepress'] != 0) {
|
if($admin_options['codepress'] != 0) {
|
echo "<script type=\"text/javascript\"> var editor = CodeMirror.fromTextArea(document.getElementById(\"template\"), {
| echo '<script type="text/javascript"> var editor = CodeMirror.fromTextArea(document.getElementById("template"), {
|
lineNumbers: true, lineWrapping: true,
|
lineNumbers: true, lineWrapping: true,
|
mode: \"text/html\", tabMode: \"indent\", theme: \"mybb\"
| foldGutter: true, gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], viewportMargin: Infinity, indentWithTabs: true, indentUnit: 4, mode: "text/html", theme: "mybb"
|
});
|
});
|
</script>"; }
| </script>'; }
|
$page->output_footer(); }
| $page->output_footer(); }
|
Zeile 321 | Zeile 330 |
---|
{ $plugins->run_hooks("admin_style_templates_add_template_group");
|
{ $plugins->run_hooks("admin_style_templates_add_template_group");
|
if($mybb->get_input('sid', 1) == -1)
| if($mybb->get_input('sid', MyBB::INPUT_INT) == -1)
|
{ admin_redirect("index.php?module=style-templates&sid={$sid}".$expand_str2); }
| { admin_redirect("index.php?module=style-templates&sid={$sid}".$expand_str2); }
|
Zeile 333 | Zeile 342 |
---|
if(!$prefix) { $errors[] = $lang->error_missing_group_prefix;
|
if(!$prefix) { $errors[] = $lang->error_missing_group_prefix;
|
| }
if(strpos($prefix, "_") !== false) { $errors[] = $lang->error_invalid_group_title;
|
}
$title = trim($mybb->input['title']);
| }
$title = trim($mybb->input['title']);
|
Zeile 376 | Zeile 390 |
---|
} }
|
} }
|
if($mybb->input['sid']) {
| if(!empty($mybb->input['sid'])) {
|
$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->add_breadcrumb_item($lang->add_template_group); $page->output_header($lang->add_template_group); $page->output_nav_tabs($sub_tabs, 'add_template_group');
|
$page->add_breadcrumb_item($lang->add_template_group); $page->output_header($lang->add_template_group); $page->output_nav_tabs($sub_tabs, 'add_template_group');
|
if($errors) { $template_group = array(
| $template_group = array(); if($errors) { $template_group = array(
|
'prefix' => $prefix, 'title' => $title
|
'prefix' => $prefix, 'title' => $title
|
);
| );
|
$page->output_inline_error($errors);
|
$page->output_inline_error($errors);
|
| } else { $template_group = array( 'prefix' => null, 'title' => null, );
|
}
$form = new Form("index.php?module=style-templates&action=add_template_group{$expand_str}", "post", "add_template_group");
| }
$form = new Form("index.php?module=style-templates&action=add_template_group{$expand_str}", "post", "add_template_group");
|
Zeile 437 | Zeile 459 |
---|
if(!$errors) { $query = $db->update_query("templatesets", array('title' => $db->escape_string($mybb->input['title'])), "sid='{$sid}'");
|
if(!$errors) { $query = $db->update_query("templatesets", array('title' => $db->escape_string($mybb->input['title'])), "sid='{$sid}'");
|
$plugins->run_hooks("admin_style_templates_edit_set_commit");
| $plugins->run_hooks("admin_style_templates_edit_set_commit");
|
// 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); }
|
// 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); }
|
}
| }
|
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->output_header($lang->edit_set);
|
$page->add_breadcrumb_item($lang->edit_set);
$page->output_header($lang->edit_set);
|
|
|
$sub_tabs = array(); $sub_tabs['edit_set'] = array( 'title' => $lang->edit_set,
| $sub_tabs = array(); $sub_tabs['edit_set'] = array( 'title' => $lang->edit_set,
|
Zeile 465 | Zeile 487 |
---|
);
$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 544 | Zeile 566 |
---|
$existing_rows = $db->num_rows($query);
if(($existing_sid == -2 && $existing_rows == 1) || $existing_rows == 0)
|
$existing_rows = $db->num_rows($query);
if(($existing_sid == -2 && $existing_rows == 1) || $existing_rows == 0)
|
{
| {
|
$template['tid'] = $db->insert_query("templates", $template_array); } else { $db->update_query("templates", $template_array, "tid='{$template['tid']}' AND sid != '-2'"); }
|
$template['tid'] = $db->insert_query("templates", $template_array); } else { $db->update_query("templates", $template_array, "tid='{$template['tid']}' AND sid != '-2'"); }
|
}
| }
|
else { // Global template set $db->update_query("templates", $template_array, "tid='{$template['tid']}' AND sid != '-2'"); }
|
else { // Global template set $db->update_query("templates", $template_array, "tid='{$template['tid']}' AND sid != '-2'"); }
|
|
|
$plugins->run_hooks("admin_style_templates_edit_template_commit");
$query = $db->simple_select("templatesets", "title", "sid='{$sid}'");
| $plugins->run_hooks("admin_style_templates_edit_template_commit");
$query = $db->simple_select("templatesets", "title", "sid='{$sid}'");
|
Zeile 570 | Zeile 592 |
---|
$group = $db->fetch_field($query, "gid");
if(!$group)
|
$group = $db->fetch_field($query, "gid");
if(!$group)
|
{
| {
|
$group = "-1";
|
$group = "-1";
|
}
| }
|
// Log admin action
|
// Log admin action
|
log_admin_action($template['tid'], $mybb->input['title'], $mybb->input['sid'], $set['title']);
| if(!empty($set['title'])) { $title = $set['title']; } else { $title = null; }
log_admin_action($template['tid'], $mybb->get_input('title'), $mybb->get_input('sid'), $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") { admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".$mybb->get_input('sid', 1).$expand_str2."&from=diff_report"); } else
| if($mybb->get_input('continue')) { if($mybb->get_input('from') == "diff_report")
|
{
|
{
|
admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".$mybb->get_input('sid', 1).$expand_str2); } } else { if($mybb->input['from'] == "diff_report") { admin_redirect("index.php?module=style-templates&action=find_updated");
| admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".$mybb->get_input('sid', MyBB::INPUT_INT).$expand_str2."&from=diff_report");
|
} else {
|
} else {
|
admin_redirect("index.php?module=style-templates&sid=".$mybb->get_input('sid', 1).$expand_str2."#group_{$group}");
| admin_redirect("index.php?module=style-templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".$mybb->get_input('sid', MyBB::INPUT_INT).$expand_str2);
|
} }
|
} }
|
} }
| else { if($mybb->get_input('from') == "diff_report") { admin_redirect("index.php?module=style-templates&action=find_updated"); } else { admin_redirect("index.php?module=style-templates&sid=".$mybb->get_input('sid', MyBB::INPUT_INT).$expand_str2."#group_{$group}"); } } } }
|
if($errors) {
| if($errors) {
|
Zeile 613 | Zeile 644 |
---|
$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); }
|
| $template['title'] = htmlspecialchars_uni($template['title']);
|
if($admin_options['codepress'] != 0) { $page->extra_header .= '
|
if($admin_options['codepress'] != 0) { $page->extra_header .= '
|
<link href="./jscripts/codemirror/lib/codemirror.css" rel="stylesheet"> <link href="./jscripts/codemirror/theme/mybb.css" rel="stylesheet"> <script src="./jscripts/codemirror/lib/codemirror.js"></script> <script src="./jscripts/codemirror/mode/xml/xml.js"></script> <script src="./jscripts/codemirror/mode/javascript/javascript.js"></script> <script src="./jscripts/codemirror/mode/css/css.js"></script> <script src="./jscripts/codemirror/mode/htmlmixed/htmlmixed.js"></script> <link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet" > <script src="./jscripts/codemirror/addon/dialog/dialog.js"></script> <script src="./jscripts/codemirror/addon/search/searchcursor.js"></script> <script src="./jscripts/codemirror/addon/search/search.js"></script>
| <link href="./jscripts/codemirror/lib/codemirror.css?ver=1813" rel="stylesheet"> <link href="./jscripts/codemirror/theme/mybb.css?ver=1813" rel="stylesheet"> <script src="./jscripts/codemirror/lib/codemirror.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/xml/xml.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/javascript/javascript.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/css/css.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/htmlmixed/htmlmixed.js?ver=1813"></script> <link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css?ver=1813" rel="stylesheet"> <script src="./jscripts/codemirror/addon/dialog/dialog.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/search/searchcursor.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/search/search.js?ver=1821"></script> <script src="./jscripts/codemirror/addon/fold/foldcode.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/fold/xml-fold.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/fold/foldgutter.js?ver=1813"></script> <link href="./jscripts/codemirror/addon/fold/foldgutter.css?ver=1813" rel="stylesheet">
|
'; }
| '; }
|
Zeile 659 | Zeile 695 |
---|
$sub_tabs['diff_report'] = array( 'title' => $lang->diff_report,
|
$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=".(int)$template['sid']."&sid2=-2",
| 'link' => "index.php?module=style-templates&action=diff_report&title=".urlencode($template['title'])."&sid1=".(int)$template['sid']."&sid2=-2",
|
); }
| ); }
|
Zeile 667 | Zeile 703 |
---|
'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
|
'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');
|
Zeile 684 | Zeile 720 |
---|
echo $form->generate_hidden_field('from', "diff_report"); }
|
echo $form->generate_hidden_field('from', "diff_report"); }
|
$form_container = new FormContainer($lang->edit_template_breadcrumb.$template['title']);
| $form_container = new FormContainer($lang->edit_template_breadcrumb.$template['title'], 'tfixed');
|
$form_container->output_row($lang->template_name, $lang->template_name_desc, $form->generate_text_box('title', $template['title'], array('id' => 'title')), 'title');
// Force users to save the default template to a specific set, rather than the "global" templates - where they can delete it
| $form_container->output_row($lang->template_name, $lang->template_name_desc, $form->generate_text_box('title', $template['title'], array('id' => 'title')), 'title');
// Force users to save the default template to a specific set, rather than the "global" templates - where they can delete it
|
Zeile 707 | Zeile 743 |
---|
if($admin_options['codepress'] != 0) {
|
if($admin_options['codepress'] != 0) {
|
echo "<script type=\"text/javascript\"> var editor = CodeMirror.fromTextArea(document.getElementById(\"template\"), {
| echo '<script type="text/javascript"> var editor = CodeMirror.fromTextArea(document.getElementById("template"), {
|
lineNumbers: true, lineWrapping: true,
|
lineNumbers: true, lineWrapping: true,
|
mode: \"text/html\", tabMode: \"indent\", theme: \"mybb\"
| foldGutter: true, gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], viewportMargin: Infinity, indentWithTabs: true, indentUnit: 4, mode: "text/html", theme: "mybb"
|
});
|
});
|
</script>";
| </script>';
|
}
$page->output_footer();
| }
$page->output_footer();
|
Zeile 723 | Zeile 763 |
---|
if($mybb->input['action'] == "edit_template_group") {
|
if($mybb->input['action'] == "edit_template_group") {
|
$query = $db->simple_select("templategroups", "*", "gid = '".(int)$mybb->input['gid']."'");
| $query = $db->simple_select("templategroups", "*", "gid = '".$mybb->get_input('gid', MyBB::INPUT_INT)."'");
|
if(!$db->num_rows($query)) { flash_message($lang->error_missing_template_group, 'error');
|
if(!$db->num_rows($query)) { flash_message($lang->error_missing_template_group, 'error');
|
admin_redirect("index.php?module=style-templates&sid={$sid}{$expand_str}");
| admin_redirect("index.php?module=style-templates&sid={$sid}{$expand_str}");
|
}
$template_group = $db->fetch_array($query);
| }
$template_group = $db->fetch_array($query);
|
Zeile 745 | Zeile 785 |
---|
{ $prefix = trim($mybb->input['prefix']); if(!$prefix)
|
{ $prefix = trim($mybb->input['prefix']); if(!$prefix)
|
{
| {
|
$errors[] = $lang->error_missing_group_prefix;
|
$errors[] = $lang->error_missing_group_prefix;
|
| }
if(strpos($prefix, "_") !== false) { $errors[] = $lang->error_invalid_group_title;
|
}
$title = trim($mybb->input['title']); if(!$title) { $errors[] = $lang->error_missing_group_title;
|
}
$title = trim($mybb->input['title']); if(!$title) { $errors[] = $lang->error_missing_group_title;
|
}
| }
|
if(!$errors) { if($prefix != $template_group['prefix'])
| if(!$errors) { if($prefix != $template_group['prefix'])
|
Zeile 788 | Zeile 833 |
---|
} }
|
} }
|
$lang->editing_template_group = $lang->sprintf($lang->editing_template_group, $template_group['title']);
| $lang->editing_template_group = $lang->sprintf($lang->editing_template_group, htmlspecialchars_uni($template_group['title']));
|
$page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&sid={$sid}{$expand_str}"); $page->add_breadcrumb_item($lang->editing_template_group, "index.php?module=style-templates&sid={$sid}");
| $page->add_breadcrumb_item($template_sets[$sid], "index.php?module=style-templates&sid={$sid}{$expand_str}"); $page->add_breadcrumb_item($lang->editing_template_group, "index.php?module=style-templates&sid={$sid}");
|
Zeile 833 | Zeile 878 |
---|
// Search and replace in templates
if(!$mybb->input['find'])
|
// Search and replace in templates
if(!$mybb->input['find'])
|
{ flash_message($lang->search_noneset, "error");
| { flash_message($lang->search_noneset, "error");
|
admin_redirect("index.php?module=style-templates&action=search_replace"); } else { $page->add_breadcrumb_item($lang->search_replace);
|
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);
|
|
|
$plugins->run_hooks("admin_style_templates_search_replace_find");
|
$plugins->run_hooks("admin_style_templates_search_replace_find");
|
|
|
$page->output_nav_tabs($sub_tabs, 'search_replace');
|
$page->output_nav_tabs($sub_tabs, 'search_replace');
|
|
|
$templates_list = array();
|
$templates_list = array();
|
$table = new Table;
$template_sets = array();
// Get the names of all template sets $template_sets[-2] = $lang->master_templates; $template_sets[-1] = $lang->global_templates;
$query = $db->simple_select("templatesets", "sid, title"); while($set = $db->fetch_array($query)) { $template_sets[$set['sid']] = $set['title']; }
| $table = new Table;
$template_sets = array();
// Get the names of all template sets $template_sets[-2] = $lang->master_templates; $template_sets[-1] = $lang->global_templates;
$query = $db->simple_select("templatesets", "sid, title"); while($set = $db->fetch_array($query)) { $template_sets[$set['sid']] = $set['title']; }
$search_string = str_replace(array("\r\n", "\r"), "\n", $mybb->input['find']); $search_string = str_replace(array(" ", "\t"), "", $search_string);
|
// Select all templates with that search term $query = $db->query(" SELECT 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_like($mybb->input['find'])."%' AND NOT (t.sid = -2 AND (t2.tid) IS NOT NULL)
| WHERE REPLACE(REPLACE(REPLACE(REPLACE(t.template, '\r\n', '\n'), '\r', '\n'), ' ', ''), '\t', '') LIKE '%".$db->escape_string_like($search_string)."%' AND NOT (t.sid = -2 AND (t2.tid) IS NOT NULL)
|
ORDER BY t.title ASC "); if($db->num_rows($query) == 0)
|
ORDER BY t.title ASC "); if($db->num_rows($query) == 0)
|
{
| {
|
$table->construct_cell($lang->sprintf($lang->search_noresults, htmlspecialchars_uni($mybb->input['find'])), array("class" => "align_center"));
$table->construct_row();
| $table->construct_cell($lang->sprintf($lang->search_noresults, htmlspecialchars_uni($mybb->input['find'])), array("class" => "align_center"));
$table->construct_row();
|
Zeile 888 | Zeile 936 |
---|
}
$count = 0;
|
}
$count = 0;
|
|
|
foreach($template_list as $sid => $templates) { ++$count;
| foreach($template_list as $sid => $templates) { ++$count;
|
Zeile 960 | Zeile 1008 |
---|
} }
|
} }
|
$table->construct_cell($label, array("width" => "85%"));
| $table->construct_cell(htmlspecialchars_uni($label), array("width" => "85%"));
|
if($sid == -2) {
| if($sid == -2) {
|
Zeile 993 | Zeile 1041 |
---|
$table->output(); } }
|
$table->output(); } }
|
}
| }
|
if(trim($mybb->input['replace']) != "") { // Log admin action - only if replace
| if(trim($mybb->input['replace']) != "") { // Log admin action - only if replace
|
Zeile 1046 | Zeile 1094 |
---|
if($template['sid'] == -2) { if(!$template['customtid'])
|
if($template['sid'] == -2) { if(!$template['customtid'])
|
{
| {
|
$template['original'] = true; } else
| $template['original'] = true; } else
|
Zeile 1087 | Zeile 1135 |
---|
foreach($templates as $template) {
|
foreach($templates as $template) {
|
$template['pretty_title'] = $template['title'];
| $template['pretty_title'] = htmlspecialchars_uni($template['title']);
|
$popup = new PopupMenu("template_{$template['tid']}", $lang->options);
| $popup = new PopupMenu("template_{$template['tid']}", $lang->options);
|
Zeile 1114 | Zeile 1162 |
---|
$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;\">".htmlspecialchars_uni($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;\">".htmlspecialchars_uni($template['title'])."</span>";
|
}
$table->construct_cell("<span style=\"padding: 20px;\">{$template['pretty_title']}</span>", array("width" => "85%"));
| }
$table->construct_cell("<span style=\"padding: 20px;\">{$template['pretty_title']}</span>", array("width" => "85%"));
|
Zeile 1149 | Zeile 1197 |
---|
if($admin_options['codepress'] != 0) { $page->extra_header .= '
|
if($admin_options['codepress'] != 0) { $page->extra_header .= '
|
<link href="./jscripts/codemirror/lib/codemirror.css" rel="stylesheet"> <link href="./jscripts/codemirror/theme/mybb.css" rel="stylesheet"> <script src="./jscripts/codemirror/lib/codemirror.js"></script> <script src="./jscripts/codemirror/mode/xml/xml.js"></script> <script src="./jscripts/codemirror/mode/javascript/javascript.js"></script> <script src="./jscripts/codemirror/mode/css/css.js"></script> <script src="./jscripts/codemirror/mode/htmlmixed/htmlmixed.js"></script> <link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet" > <script src="./jscripts/codemirror/addon/dialog/dialog.js"></script> <script src="./jscripts/codemirror/addon/search/searchcursor.js"></script> <script src="./jscripts/codemirror/addon/search/search.js"></script>
| <link href="./jscripts/codemirror/lib/codemirror.css?ver=1813" rel="stylesheet"> <link href="./jscripts/codemirror/theme/mybb.css?ver=1813" rel="stylesheet"> <script src="./jscripts/codemirror/lib/codemirror.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/xml/xml.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/javascript/javascript.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/css/css.js?ver=1813"></script> <script src="./jscripts/codemirror/mode/htmlmixed/htmlmixed.js?ver=1813"></script> <link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css?ver=1813" rel="stylesheet"> <script src="./jscripts/codemirror/addon/dialog/dialog.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/search/searchcursor.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/search/search.js?ver=1821"></script> <script src="./jscripts/codemirror/addon/fold/foldcode.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/fold/xml-fold.js?ver=1813"></script> <script src="./jscripts/codemirror/addon/fold/foldgutter.js?ver=1813"></script> <link href="./jscripts/codemirror/addon/fold/foldgutter.css?ver=1813" rel="stylesheet">
|
'; }
| '; }
|
Zeile 1172 | Zeile 1224 |
---|
$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' => '', 'style' => 'width: 100%; height: 200px;')));
| $form_container = new FormContainer($lang->search_replace, 'tfixed'); $form_container->output_row($lang->search_for, "", $form->generate_text_area('find', $mybb->get_input('find'), array('id' => 'find', 'class' => '', 'style' => 'width: 100%; height: 200px;')));
|
|
|
$form_container->output_row($lang->replace_with, "", $form->generate_text_area('replace', $mybb->input['replace'], array('id' => 'replace', 'class' => '', 'style' => 'width: 100%; height: 200px;')));
| $form_container->output_row($lang->replace_with, "", $form->generate_text_area('replace', $mybb->get_input('replace'), array('id' => 'replace', 'class' => '', 'style' => 'width: 100%; height: 200px;')));
|
$form_container->end();
$buttons[] = $form->generate_submit_button($lang->find_and_replace);
| $form_container->end();
$buttons[] = $form->generate_submit_button($lang->find_and_replace);
|
Zeile 1192 | Zeile 1244 |
---|
$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->get_input('title'), array('id' => 'title')), 'title');
|
$form_container->end();
| $form_container->end();
|
Zeile 1206 | Zeile 1258 |
---|
if($admin_options['codepress'] != 0) {
|
if($admin_options['codepress'] != 0) {
|
echo "<script type=\"text/javascript\"> var editor1 = CodeMirror.fromTextArea(document.getElementById(\"find\"), {
| echo '<script type="text/javascript"> var editor1 = CodeMirror.fromTextArea(document.getElementById("find"), {
|
lineNumbers: true, lineWrapping: true,
|
lineNumbers: true, lineWrapping: true,
|
mode: \"text/html\", tabMode: \"indent\", theme: \"mybb\"
| foldGutter: true, gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], viewportMargin: Infinity, indentWithTabs: true, indentUnit: 4, mode: "text/html", theme: "mybb"
|
});
|
});
|
var editor2 = CodeMirror.fromTextArea(document.getElementById(\"replace\"), {
| var editor2 = CodeMirror.fromTextArea(document.getElementById("replace"), {
|
lineNumbers: true, lineWrapping: true,
|
lineNumbers: true, lineWrapping: true,
|
mode: \"text/html\", tabMode: \"indent\", theme: \"mybb\"
| foldGutter: true, gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], viewportMargin: Infinity, indentWithTabs: true, indentUnit: 4, mode: "text/html", theme: "mybb"
|
});
|
});
|
</script>";
| </script>';
|
}
$page->output_footer();
| }
$page->output_footer();
|
Zeile 1282 | Zeile 1342 |
---|
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
|
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
| ORDER BY t.sid ASC, t.title ASC
|
"); while($template = $db->fetch_array($query)) {
| "); while($template = $db->fetch_array($query)) {
|
Zeile 1291 | Zeile 1351 |
---|
foreach($templates as $sid => $templates) {
|
foreach($templates as $sid => $templates) {
|
if(!$done_set[$sid])
| if(empty($done_set[$sid]))
|
{
|
{
|
$table->construct_header($templatesets[$sid]['title'], array("colspan" => 2));
| $table->construct_header(htmlspecialchars_uni($templatesets[$sid]['title']), array("colspan" => 2));
|
$done_set[$sid] = 1; ++$count;
| $done_set[$sid] = 1; ++$count;
|
Zeile 1306 | Zeile 1366 |
---|
$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->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("<a href=\"index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}&from=diff_report\">".htmlspecialchars_uni($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(); }
|
if($done_set[$sid] && !$done_output[$sid])
| if(!empty($done_set[$sid]) && empty($done_output[$sid]))
|
{ $done_output[$sid] = 1; if($count == 1)
| { $done_output[$sid] = 1; if($count == 1)
|
Zeile 1331 | Zeile 1391 |
---|
if($mybb->input['action'] == "delete_template_group") {
|
if($mybb->input['action'] == "delete_template_group") {
|
$gid = (int)$mybb->input['gid'];
| $gid = $mybb->get_input('gid', MyBB::INPUT_INT);
|
$query = $db->simple_select("templategroups", "*", "gid='{$gid}'");
if(!$db->num_rows($query))
| $query = $db->simple_select("templategroups", "*", "gid='{$gid}'");
if(!$db->num_rows($query))
|
Zeile 1341 | Zeile 1401 |
---|
}
// User clicked no
|
}
// User clicked no
|
if($mybb->input['no'])
| if($mybb->get_input('no'))
|
{ admin_redirect("index.php?module=style-templates&sid={$sid}"); }
| { admin_redirect("index.php?module=style-templates&sid={$sid}"); }
|
Zeile 1375 | Zeile 1435 |
---|
$set = $db->fetch_array($query);
// Does the template not exist?
|
$set = $db->fetch_array($query);
// Does the template not exist?
|
if(!$set['sid'])
| if(!$set)
|
{ flash_message($lang->error_invalid_template_set, 'error'); admin_redirect("index.php?module=style-templates");
| { flash_message($lang->error_invalid_template_set, 'error'); admin_redirect("index.php?module=style-templates");
|
Zeile 1397 | Zeile 1457 |
---|
}
// User clicked no
|
}
// User clicked no
|
if($mybb->input['no'])
| if($mybb->get_input('no'))
|
{ admin_redirect("index.php?module=style-templates"); }
| { admin_redirect("index.php?module=style-templates"); }
|
Zeile 1415 | Zeile 1475 |
---|
log_admin_action($set['sid'], $set['title']);
flash_message($lang->success_template_set_deleted, 'success');
|
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") { $query = $db->query("
| if($mybb->input['action'] == "delete_template") { $query = $db->query("
|
Zeile 1438 | Zeile 1498 |
---|
if(!$template) { flash_message($lang->error_invalid_template, 'error');
|
if(!$template) { flash_message($lang->error_invalid_template, 'error');
|
admin_redirect("index.php?module=style-templates"); }
| admin_redirect("index.php?module=style-templates"); }
|
// User clicked no
|
// User clicked no
|
if($mybb->input['no'])
| if($mybb->get_input('no'))
|
{ admin_redirect("index.php?module=style-templates&sid={$template['sid']}{$expand_str2}"); }
|
{ admin_redirect("index.php?module=style-templates&sid={$template['sid']}{$expand_str2}"); }
|
$plugins->run_hooks("admin_style_templates_delete_template");
| $plugins->run_hooks("admin_style_templates_delete_template");
|
if($mybb->request_method == "post") { // Delete the template $db->delete_query("templates", "tid='{$template['tid']}'");
$plugins->run_hooks("admin_style_templates_delete_template_commit");
|
if($mybb->request_method == "post") { // Delete the template $db->delete_query("templates", "tid='{$template['tid']}'");
$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']);
|
|
|
flash_message($lang->success_template_deleted, 'success'); admin_redirect("index.php?module=style-templates&sid={$template['sid']}{$expand_str2}"); }
| flash_message($lang->success_template_deleted, 'success'); admin_redirect("index.php?module=style-templates&sid={$template['sid']}{$expand_str2}"); }
|
Zeile 1471 | Zeile 1531 |
---|
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'] || !isset($template_sets[$mybb->input['sid1']])) {
| if(empty($mybb->input['sid1']) || !isset($template_sets[$mybb->input['sid1']])) {
|
$mybb->input['sid1'] = -2;
|
$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&action=find_updated"
| $sub_tabs['find_updated'] = array( 'title' => $lang->find_updated, 'link' => "index.php?module=style-templates&action=find_updated"
|
Zeile 1488 | Zeile 1548 |
---|
{ 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");
|
}
if(!$mybb->input['from']) {
| }
if(empty($mybb->input['from'])) {
|
$mybb->input['from'] = 0; }
$sub_tabs['diff_report'] = array( 'title' => $lang->diff_report,
|
$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=".(int)$mybb->input['sid1']."&sid2=".(int)$mybb->input['sid2'],
| 'link' => "index.php?module=style-templates&action=diff_report&title=".urlencode($mybb->input['title'])."&from=".htmlspecialchars_uni($mybb->input['from'])."sid1=".$mybb->get_input('sid1', MyBB::INPUT_INT)."&sid2=".$mybb->get_input('sid2', MyBB::INPUT_INT),
|
'description' => $lang->diff_report_desc );
|
'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='".(int)$mybb->input['sid1']."'");
| $query = $db->simple_select("templates", "*", "title='".$db->escape_string($mybb->input['title'])."' AND sid='".$mybb->get_input('sid1', MyBB::INPUT_INT)."'");
|
$template1 = $db->fetch_array($query);
|
$template1 = $db->fetch_array($query);
|
$query = $db->simple_select("templates", "*", "title='".$db->escape_string($mybb->input['title'])."' AND sid='".(int)$mybb->input['sid2']."'");
| $query = $db->simple_select("templates", "*", "title='".$db->escape_string($mybb->input['title'])."' AND sid='".$mybb->get_input('sid2', MyBB::INPUT_INT)."'");
|
$template2 = $db->fetch_array($query);
|
$template2 = $db->fetch_array($query);
|
if($mybb->input['sid2'] == -2) {
| if($mybb->input['sid2'] == -2) {
|
$sub_tabs['full_edit'] = array( 'title' => $lang->full_edit,
|
$sub_tabs['full_edit'] = array( 'title' => $lang->full_edit,
|
'link' => "index.php?module=style-templates&action=edit_template&title=".urlencode($template1['title'])."&sid=".(int)$mybb->input['sid1']."&from=diff_report",
| 'link' => "index.php?module=style-templates&action=edit_template&title=".urlencode($template1['title'])."&sid=".$mybb->get_input('sid1', MyBB::INPUT_INT)."&from=diff_report",
|
); }
if($template1['template'] == $template2['template']) { flash_message($lang->templates_the_same, 'error');
|
); }
if($template1['template'] == $template2['template']) { flash_message($lang->templates_the_same, 'error');
|
admin_redirect("index.php?module=style-templates&sid=".(int)$mybb->input['sid2'].$expand_str);
| admin_redirect("index.php?module=style-templates&sid=".$mybb->get_input('sid2', MyBB::INPUT_INT).$expand_str);
|
}
$template1['template'] = explode("\n", $template1['template']);
| }
$template1['template'] = explode("\n", $template1['template']);
|
Zeile 1545 | Zeile 1605 |
---|
$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->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=".(int)$mybb->input['sid1']."&sid2=".(int)$mybb->input['sid2']);
| $page->add_breadcrumb_item($lang->diff_report.": ".htmlspecialchars_uni($template1['title']), "index.php?module=style-templates&action=diff_report&title=".urlencode($mybb->input['title'])."&from=".htmlspecialchars_uni($mybb->input['from'])."&sid1=".$mybb->get_input('sid1', MyBB::INPUT_INT)."&sid2=".$mybb->get_input('sid2', MyBB::INPUT_INT));
|
$page->output_header($lang->template_sets);
| $page->output_header($lang->template_sets);
|
Zeile 1565 | Zeile 1625 |
---|
$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.": ".htmlspecialchars_uni($template1['title']));
|
$page->output_footer(); }
| $page->output_footer(); }
|
Zeile 1576 | Zeile 1636 |
---|
SELECT t.*, s.title as set_title FROM ".TABLE_PREFIX."templates t LEFT JOIN ".TABLE_PREFIX."templatesets s ON(s.sid=t.sid)
|
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.title='".$db->escape_string($mybb->input['title'])."' AND t.sid > 0 AND t.sid = '".$mybb->get_input('sid', 1)."'
| WHERE t.title='".$db->escape_string($mybb->input['title'])."' AND t.sid > 0 AND t.sid = '".$mybb->get_input('sid', MyBB::INPUT_INT)."'
|
"); $template = $db->fetch_array($query);
| "); $template = $db->fetch_array($query);
|
Zeile 1588 | Zeile 1648 |
---|
}
// User clicked no
|
}
// User clicked no
|
if($mybb->input['no']) {
| if($mybb->get_input('no')) {
|
admin_redirect("index.php?module=style-templates&sid={$template['sid']}{$expand_str2}"); }
| admin_redirect("index.php?module=style-templates&sid={$template['sid']}{$expand_str2}"); }
|
Zeile 1622 | Zeile 1682 |
---|
} }
|
} }
|
if($mybb->input['sid'] && !$mybb->input['action'])
| if(!empty($mybb->input['sid']) && !$mybb->input['action'])
|
{ if(!isset($template_sets[$mybb->input['sid']])) {
| { if(!isset($template_sets[$mybb->input['sid']])) {
|
Zeile 1639 | Zeile 1699 |
---|
$page->output_header($lang->template_sets);
$page->output_nav_tabs($sub_tabs, 'manage_templates');
|
$page->output_header($lang->template_sets);
$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));
|
Zeile 1653 | Zeile 1713 |
---|
$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->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("<a href=\"index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid=-1\">".htmlspecialchars_uni($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)); $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]);
$page->output_footer();
| $table->output($template_sets[$sid]);
$page->output_footer();
|
Zeile 1673 | Zeile 1733 |
---|
if(!isset($mybb->input['expand'])) { $mybb->input['expand'] = '';
|
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 1685 | Zeile 1745 |
---|
$template_groups = array(); while($templategroup = $db->fetch_array($query)) {
|
$template_groups = array(); while($templategroup = $db->fetch_array($query)) {
|
$templategroup['title'] = $lang->parse($templategroup['title'])." ".$lang->templates;
| $templategroup['title'] = $lang->sprintf($lang->templates, htmlspecialchars_uni($lang->parse($templategroup['title'])));
|
if($mybb->input['expand'] == 'all') { $expand_array[] = $templategroup['gid'];
|
if($mybb->input['expand'] == 'all') { $expand_array[] = $templategroup['gid'];
|
}
| }
|
if(in_array($templategroup['gid'], $expand_array)) { $templategroup['expanded'] = 1; } $template_groups[$templategroup['prefix']] = $templategroup;
|
if(in_array($templategroup['gid'], $expand_array)) { $templategroup['expanded'] = 1; } $template_groups[$templategroup['prefix']] = $templategroup;
|
}
| }
|
|
|
| /** * @param array $a * @param array $b * * @return int */
|
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");
|
Zeile 1709 | Zeile 1775 |
---|
"title" => $lang->ungrouped_templates, "gid" => -1 );
|
"title" => $lang->ungrouped_templates, "gid" => -1 );
|
| // Set the template group keys to lowercase for case insensitive comparison. $template_groups = array_change_key_case($template_groups, CASE_LOWER);
|
// Load the list of templates
|
// Load the list of templates
|
$query = $db->simple_select("templates", "*", "sid='".$mybb->get_input('sid', 1)."' OR sid='-2'", array('order_by' => 'sid DESC, title', 'order_dir' => 'ASC'));
| $query = $db->simple_select("templates", "*", "sid='".$mybb->get_input('sid', MyBB::INPUT_INT)."' OR sid='-2'", array('order_by' => 'sid DESC, title', 'order_dir' => 'ASC'));
|
while($template = $db->fetch_array($query)) { $exploded = explode("_", $template['title'], 2);
|
while($template = $db->fetch_array($query)) { $exploded = explode("_", $template['title'], 2);
|
| // Set the prefix to lowercase for case insensitive comparison. $exploded[0] = strtolower($exploded[0]);
|
if(isset($template_groups[$exploded[0]])) {
| if(isset($template_groups[$exploded[0]])) {
|
Zeile 1815 | Zeile 1887 |
---|
$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("<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(isset($group['templates']) && count($group['templates']) > 0)
| if(isset($group['templates']) && is_array($group['templates']) && count($group['templates']) > 0)
|
{ $templates = $group['templates']; ksort($templates);
foreach($templates as $template) {
|
{ $templates = $group['templates']; ksort($templates);
foreach($templates as $template) {
|
$template['pretty_title'] = $template['title'];
| $template['pretty_title'] = htmlspecialchars_uni($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}");
|
Zeile 1836 | Zeile 1908 |
---|
$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;\">".htmlspecialchars_uni($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;\">".htmlspecialchars_uni($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("<span style=\"padding-left: 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_cell($popup->fetch(), array("class" => "align_center"));
$table->construct_row();
|
Zeile 1913 | Zeile 1985 |
---|
continue; }
|
continue; }
|
if($themes[$set['sid']])
| if(!empty($themes[$set['sid']]))
|
{ $used_by_note = $lang->used_by; $comma = "";
| { $used_by_note = $lang->used_by; $comma = "";
|
Zeile 1941 | Zeile 2013 |
---|
{ $popup->add_item($lang->edit_template_set, "index.php?module=style-templates&action=edit_set&sid={$set['sid']}");
|
{ $popup->add_item($lang->edit_template_set, "index.php?module=style-templates&action=edit_set&sid={$set['sid']}");
|
if(!$themes[$set['sid']])
| if(empty($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}')"); }
| { $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}')"); }
|
Zeile 1949 | Zeile 2021 |
---|
$actions = $popup->fetch(); }
|
$actions = $popup->fetch(); }
|
| $set['title'] = htmlspecialchars_uni($set['title']);
|
$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_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"));
|