Vergleich admin/templates.php - 1.2.2 - 1.2.4

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * $Id: templates.php 2327 2006-10-10 23:18:38Z Tikitiki $

 * $Id: templates.php 2655 2007-01-15 06:41:53Z Christian $

 */

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=''");

Zeile 71Zeile 68
			}
}
break;

			}
}
break;

}


}


$plugins->run_hooks("admin_templates_start");

$plugins->run_hooks("admin_templates_start");





$expand = $mybb->input['expand'];
$group = $mybb->input['group'];

$expand = $mybb->input['expand'];
$group = $mybb->input['group'];





checkadminpermissions("canedittemps");
logadmin();


checkadminpermissions("canedittemps");
logadmin();


Zeile 86Zeile 83
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."templates WHERE sid='".intval($mybb->input['setid'])."' AND title='".$db->escape_string($mybb->input['title'])."'");
$temp = $db->fetch_array($query);
if($temp['tid'])

	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."templates WHERE sid='".intval($mybb->input['setid'])."' AND title='".$db->escape_string($mybb->input['title'])."'");
$temp = $db->fetch_array($query);
if($temp['tid'])

	{

	{

		cperror($lang->name_exists);
}
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."templates WHERE title='".$db->escape_string($mybb->input['title'])."' AND sid='-2'");

		cperror($lang->name_exists);
}
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."templates WHERE title='".$db->escape_string($mybb->input['title'])."' AND sid='-2'");

Zeile 96Zeile 93
		cperror($lang->template_same_master);
}
$newtemplate = array(

		cperror($lang->template_same_master);
}
$newtemplate = array(

		"title" => $db->escape_string($mybb->input['title']),
"template" => $db->escape_string($mybb->input['template']),
"sid" => intval($mybb->input['setid']),
"version" => $mybb->version_code,
"status" => "",

		"title" => $db->escape_string($mybb->input['title']),
"template" => $db->escape_string($mybb->input['template']),
"sid" => intval($mybb->input['setid']),
"version" => $mybb->version_code,
"status" => "",

		"dateline" => time()
);
$plugins->run_hooks("admin_templates_do_add");

		"dateline" => time()
);
$plugins->run_hooks("admin_templates_do_add");

Zeile 227Zeile 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($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, $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)


						// If the template is different, that means the search term has been found. 
if($mybb->input['replace'] != "")

						{

						{

							// 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
{
// 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"));

							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']));
}

						}
}
}

						}
}
}