Zeile 3 | Zeile 3 |
---|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html
| * Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html
|
*
|
*
|
* $Id: templates.php 2327 2006-10-10 23:18:38Z Tikitiki $
| * $Id: templates.php 3273 2007-08-19 17:36:57Z Tikitiki $
|
*/
define("IN_MYBB", 1);
require_once "./global.php";
|
*/
define("IN_MYBB", 1);
require_once "./global.php";
|
// Hey, don't blame me - it works $db->query("SET SQL_BIG_SELECTS=1");
| |
// Just a little fix here $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title=''");
|
// Just a little fix here $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title=''");
|
| $db->query("SET SQL_BIG_SELECTS=1");
|
// Load language packs for this section global $lang;
| // Load language packs for this section global $lang;
|
Zeile 119 | Zeile 117 |
---|
$editurl = "templates.php?".SID."&action=edit&tid=".$tid."&continue=yes&group=".$mybb->input['group']; } cpredirect($editurl, $lang->template_added);
|
$editurl = "templates.php?".SID."&action=edit&tid=".$tid."&continue=yes&group=".$mybb->input['group']; } cpredirect($editurl, $lang->template_added);
|
}
| }
|
if($mybb->input['action'] == "do_addset") { $newset = array(
| if($mybb->input['action'] == "do_addset") { $newset = array(
|
Zeile 142 | Zeile 140 |
---|
$opengroup = "&group=".$mybb->input['group']."#".$mybb->input['group']; } cpredirect("templates.php?".SID."&expand=".$mybb->input['expand'].$opengroup, $lang->template_deleted);
|
$opengroup = "&group=".$mybb->input['group']."#".$mybb->input['group']; } cpredirect("templates.php?".SID."&expand=".$mybb->input['expand'].$opengroup, $lang->template_deleted);
|
} else {
| } else {
|
$mybb->input['action'] = "modify"; $expand = $template[sid]; }
| $mybb->input['action'] = "modify"; $expand = $template[sid]; }
|
Zeile 157 | Zeile 155 |
---|
$db->query("DELETE FROM ".TABLE_PREFIX."templatesets WHERE sid='".$mybb->input['setid']."'"); $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE sid='".$mybb->input['setid']."'"); cpredirect("templates.php?".SID."&action=modify", $lang->set_deleted);
|
$db->query("DELETE FROM ".TABLE_PREFIX."templatesets WHERE sid='".$mybb->input['setid']."'"); $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE sid='".$mybb->input['setid']."'"); cpredirect("templates.php?".SID."&action=modify", $lang->set_deleted);
|
}
| }
|
else { cpredirect("templates.php?".SID); } } if($mybb->input['action'] == "do_editset")
|
else { cpredirect("templates.php?".SID); } } if($mybb->input['action'] == "do_editset")
|
{
| {
|
$plugins->run_hooks("admin_templates_do_editset"); $db->query("UPDATE ".TABLE_PREFIX."templatesets SET title='".$db->escape_string($mybb->input['title'])."' WHERE sid='".intval($mybb->input['setid'])."'"); cpredirect("templates.php?".SID, $lang->set_edited); }
if($mybb->input['action'] == "do_edit")
|
$plugins->run_hooks("admin_templates_do_editset"); $db->query("UPDATE ".TABLE_PREFIX."templatesets SET title='".$db->escape_string($mybb->input['title'])."' WHERE sid='".intval($mybb->input['setid'])."'"); cpredirect("templates.php?".SID, $lang->set_edited); }
if($mybb->input['action'] == "do_edit")
|
{
| {
|
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."templates WHERE tid='".$mybb->input['tid']."'"); $templateinfo = $db->fetch_array($query);
| $query = $db->query("SELECT * FROM ".TABLE_PREFIX."templates WHERE tid='".$mybb->input['tid']."'"); $templateinfo = $db->fetch_array($query);
|
Zeile 190 | Zeile 188 |
---|
$plugins->run_hooks("admin_templates_do_edit"); $db->update_query(TABLE_PREFIX."templates", $updatedtemplate, "tid='".$mybb->input['tid']."'"); if($mybb->input['group'])
|
$plugins->run_hooks("admin_templates_do_edit"); $db->update_query(TABLE_PREFIX."templates", $updatedtemplate, "tid='".$mybb->input['tid']."'"); if($mybb->input['group'])
|
{
| {
|
$opengroup = "&group=".$mybb->input['group']."#".$mybb->input['group']; } if($mybb->input['continue'] != "yes") { $editurl = "templates.php?".SID."&expand=".$mybb->input['setid'].$opengroup;
|
$opengroup = "&group=".$mybb->input['group']."#".$mybb->input['group']; } if($mybb->input['continue'] != "yes") { $editurl = "templates.php?".SID."&expand=".$mybb->input['setid'].$opengroup;
|
}
| }
|
else { $editurl = "templates.php?".SID."&action=edit&tid=".$mybb->input['tid']."&continue=yes&group=".$mybb->input['group'];
| else { $editurl = "templates.php?".SID."&action=edit&tid=".$mybb->input['tid']."&continue=yes&group=".$mybb->input['group'];
|
Zeile 223 | Zeile 221 |
---|
while($tgroup = $db->fetch_array($query)) { $template_groups[$tgroup['sid']] = $tgroup['title'];
|
while($tgroup = $db->fetch_array($query)) { $template_groups[$tgroup['sid']] = $tgroup['title'];
|
}
| }
|
$plugins->run_hooks("admin_templates_do_replace"); // Select all templates with that search term $query = $db->query("SELECT tid, title, template, sid FROM ".TABLE_PREFIX."templates WHERE template LIKE '%".$db->escape_string($mybb->input['find'])."%' ORDER BY sid,title ASC");
|
$plugins->run_hooks("admin_templates_do_replace"); // Select all templates with that search term $query = $db->query("SELECT tid, title, template, sid FROM ".TABLE_PREFIX."templates WHERE template LIKE '%".$db->escape_string($mybb->input['find'])."%' ORDER BY sid,title ASC");
|
while($template = $db->fetch_array($query))
| if($db->num_rows($query) == 0)
|
{
|
{
|
if($template['sid'] == 1) { $template_list[-2][$template['title']] = $template; } else { $template_list[$template['sid']][$template['title']] = $template; }
| makelabelcode(sprintf($lang->search_noresults, htmlspecialchars_uni($mybb->input['find'])));
|
}
|
}
|
// Loop templates we found foreach($template_list as $sid => $templates)
| else
|
{
|
{
|
// Show group header $search_header = sprintf($lang->search_header, $mybb->input['find'], $template_groups[$sid]); tablesubheader($search_header);
foreach($templates as $title => $template)
| while($template = $db->fetch_array($query))
|
{
|
{
|
// Do replacement $newtemplate = str_replace($mybb->input['find'], $mybb->input['replace'], $template['template']); if($newtemplate != $template['template'])
| if($template['sid'] == 1)
|
{
|
{
|
// If the template is different, that means the search term has been found. if($mybb->input['replace'] != "") { if($template['sid'] == -2) { // The template is a master template. We have to make a new custom template. $new_template = array( "title" => $db->escape_string($title), "template" => $db->escape_string($newtemplate), "sid" => 1, "version" => $mybb->version_code, "status" => '', "dateline" => time() ); $db->insert_query(TABLE_PREFIX."templates", $new_template); $new_tid = $db->insert_id(); $label = sprintf($lang->search_created_custom, $template['title']); makelabelcode($label, makelinkcode($lang->search_edit, "templates.php?".SID."&action=edit&tid=".$new_tid)); } else { // The template is a custom template. Replace as normal. // Update the template if there is a replacement term $updatedtemplate = array( "template" => $db->escape_string($newtemplate) ); $db->update_query(TABLE_PREFIX."templates", $updatedtemplate, "tid='".$template['tid']."'"); $label = sprintf($lang->search_updated, $template['title']); makelabelcode($label, makelinkcode($lang->search_edit, "templates.php?".SID."&action=edit&tid=".$template['tid'])); } } else
| $template_list[-2][$template['title']] = $template; } else { $template_list[$template['sid']][$template['title']] = $template; } } // Loop templates we found foreach($template_list as $sid => $templates) { // Show group header $search_header = sprintf($lang->search_header, htmlspecialchars_uni($mybb->input['find']), $template_groups[$sid]); tablesubheader($search_header); foreach($templates as $title => $template) { // Do replacement $newtemplate = str_replace($mybb->input['find'], $mybb->input['replace'], $template['template']); if($newtemplate != $template['template'])
|
{
|
{
|
// Just show that the term was found if($template['sid'] == -2)
| // If the template is different, that means the search term has been found. if($mybb->input['replace'] != "")
|
{
|
{
|
$label = sprintf($lang->search_found, $template['title']); makelabelcode($label, makelinkcode($lang->search_change_original, "templates.php?".SID."&action=add&title=".$template['title']."&sid=1"));
| if($template['sid'] == -2) { // The template is a master template. We have to make a new custom template. $new_template = array( "title" => $db->escape_string($title), "template" => $db->escape_string($newtemplate), "sid" => 1, "version" => $mybb->version_code, "status" => '', "dateline" => time() ); $db->insert_query(TABLE_PREFIX."templates", $new_template); $new_tid = $db->insert_id(); $label = sprintf($lang->search_created_custom, $template['title']); makelabelcode($label, makelinkcode($lang->search_edit, "templates.php?".SID."&action=edit&tid=".$new_tid)); } else { // The template is a custom template. Replace as normal. // Update the template if there is a replacement term $updatedtemplate = array( "template" => $db->escape_string($newtemplate) ); $db->update_query(TABLE_PREFIX."templates", $updatedtemplate, "tid='".$template['tid']."'"); $label = sprintf($lang->search_updated, $template['title']); makelabelcode($label, makelinkcode($lang->search_edit, "templates.php?".SID."&action=edit&tid=".$template['tid'])); }
|
} else {
|
} else {
|
$label = sprintf($lang->search_found, $template['title']); makelabelcode($label, makelinkcode($lang->search_edit, "templates.php?".SID."&action=edit&tid=".$template['tid']));
| // Just show that the term was found if($template['sid'] == -2) { $label = sprintf($lang->search_found, $template['title']); makelabelcode($label, makelinkcode($lang->search_change_original, "templates.php?".SID."&action=add&title=".$template['title']."&sid=1")); } else { $label = sprintf($lang->search_found, $template['title']); makelabelcode($label, makelinkcode($lang->search_edit, "templates.php?".SID."&action=edit&tid=".$template['tid'])); }
|
} } }
| } } }
|
Zeile 478 | Zeile 483 |
---|
makehiddencode("setid", $mybb->input['setid']); starttable(); tableheader($lang->delete_template_set, "", 1);
|
makehiddencode("setid", $mybb->input['setid']); starttable(); tableheader($lang->delete_template_set, "", 1);
|
$yes = makebuttoncode("deletesubmit", "Yes"); $no = makebuttoncode("no", "No");
| $yes = makebuttoncode("deletesubmit", $lang->yes); $no = makebuttoncode("no", $lang->no);
|
makelabelcode("<div align=\"center\">$lang->delete_set_notice {$templateset['title']}?<br /><br />$yes$no</div>", ""); endtable(); endform();
| makelabelcode("<div align=\"center\">$lang->delete_set_notice {$templateset['title']}?<br /><br />$yes$no</div>", ""); endtable(); endform();
|