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 2154 2006-08-27 16:52:47Z Tikitiki $
| * $Id: templates.php 3014 2007-04-22 10:27:34Z musicalmidget $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 224 | Zeile 224 |
---|
$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($template['sid'] == 1) { $template_list[-2][$template['title']] = $template; } else { $template_list[$template['sid']][$template['title']] = $template; }
| if($db->num_rows($query) == 0) { makelabelcode(sprintf($lang->search_noresults, $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'] != "")
| $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, $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'])
|
{
|
{
|
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
| // If the template is different, that means the search term has been found. if($mybb->input['replace'] != "")
|
{
|
{
|
// 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)
| 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->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 { // 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"));
| $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'])); }
|
} }
|
} }
|
} } } endtable();
| } } } endtable();
|
cpfooter(); } }
| cpfooter(); } }
|
Zeile 348 | Zeile 355 |
---|
} endtable(); cpfooter();
|
} endtable(); cpfooter();
|
}
| }
|
} if($mybb->input['action'] == "edit") {
| } if($mybb->input['action'] == "edit") {
|
Zeile 400 | Zeile 407 |
---|
else { makehiddencode("setid", $template['sid']);
|
else { makehiddencode("setid", $template['sid']);
|
}
| }
|
if($mybb->input['continue']) { $continue = "yes";
| if($mybb->input['continue']) { $continue = "yes";
|
Zeile 475 | Zeile 482 |
---|
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();
|