Zeile 388 | Zeile 388 |
---|
if(!$errors) {
|
if(!$errors) {
|
| $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 397 | Zeile 400 |
---|
'dateline' => TIME_NOW );
|
'dateline' => TIME_NOW );
|
$tid = intval($mybb->input['tid']); if($mybb->input['sid'] > 0)
| // 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)
|
{
|
{
|
$query = $db->simple_select("templates", "sid", "title='".$db->escape_string($mybb->input['title'])."' AND (sid = '-2' OR sid = '{$sid}')", array('order_by' => 'sid', 'order_dir' => 'desc', 'limit' => 1)); if($db->fetch_field($query, "sid") == -2)
| // 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); } else {
|
{ $tid = $db->insert_query("templates", $template_array); } else {
|
$db->update_query("templates", $template_array, "tid='{$tid}'");
| $db->update_query("templates", $template_array, "tid='{$template['tid']}' AND sid != '-2'");
|
} } else { // Global template set
|
} } else { // Global template set
|
$db->update_query("templates", $template_array, "tid='{$tid}'");
| $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");
|
Zeile 433 | Zeile 443 |
---|
} // Log admin action
|
} // Log admin action
|
log_admin_action($tid, $mybb->input['title'], $sid, $set['title']);
| 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');
|
Zeile 441 | Zeile 451 |
---|
{ if($mybb->input['from'] == "diff_report") {
|
{ if($mybb->input['from'] == "diff_report") {
|
admin_redirect("index.php?module=style/templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".$sid.$expand_str2."&from=diff_report");
| admin_redirect("index.php?module=style/templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".intval($mybb->input['sid']).$expand_str2."&from=diff_report");
|
} else {
|
} else {
|
admin_redirect("index.php?module=style/templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".$sid.$expand_str2);
| admin_redirect("index.php?module=style/templates&action=edit_template&title=".urlencode($mybb->input['title'])."&sid=".intval($mybb->input['sid']).$expand_str2);
|
} } else
| } } else
|
Zeile 456 | Zeile 466 |
---|
} else {
|
} else {
|
admin_redirect("index.php?module=style/templates&sid=".$sid.$expand_str2."#group_{$group}");
| admin_redirect("index.php?module=style/templates&sid=".intval($mybb->input['sid']).$expand_str2."#group_{$group}");
|
} } }
| } } }
|
Zeile 533 | Zeile 543 |
---|
{ unset($template_sets[-1]); }
|
{ 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("", "", $form->generate_text_area('template', $template['template'], array('id' => 'template', 'class' => 'codepress mybb', 'style' => 'width: 100%; height: 500px;')));
| $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;')));
|
Zeile 884 | Zeile 894 |
---|
<script type="text/javascript"> CodePress.language = \'php\'; </script>';
|
<script type="text/javascript"> 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_nav_tabs($sub_tabs, 'search_replace');
| $page->output_header($lang->search_replace); $page->output_nav_tabs($sub_tabs, 'search_replace');
|
Zeile 1118 | Zeile 1128 |
---|
FROM ".TABLE_PREFIX."templates t LEFT JOIN ".TABLE_PREFIX."templatesets s ON(t.sid=s.sid) WHERE t.title='".$db->escape_string($mybb->input['title'])."' AND t.sid > '-2' AND t.sid = '{$sid}'
|
FROM ".TABLE_PREFIX."templates t LEFT JOIN ".TABLE_PREFIX."templatesets s ON(t.sid=s.sid) 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"); } // User clicked no if($mybb->input['no']) { admin_redirect("index.php?module=style/templates&sid={$template['sid']}{$expand_str2}"); }
| "); $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"); } // User clicked no if($mybb->input['no']) { admin_redirect("index.php?module=style/templates&sid={$template['sid']}{$expand_str2}"); }
|
if($mybb->request_method == "post") {
| if($mybb->request_method == "post") {
|
Zeile 1376 | Zeile 1386 |
---|
{ $template_sql = " AND (1=0{$template_sql})"; }
|
{ $template_sql = " AND (1=0{$template_sql})"; }
|
|
|
// Load the list of templates
|
// Load the list of templates
|
$query = $db->simple_select("templates", "*", "(sid='".intval($mybb->input['sid'])."' OR sid='-2') {$template_sql}", array('order_by' => 'sid DESC, title', 'order_dir' => 'ASC'));
| $query = $db->simple_select("templates", "*", "(sid='".intval($mybb->input['sid'])."' {$template_sql}) 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);
|