Vergleich inc/adminfunctions_templates.php - 1.8.0 - 1.8.1

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 15Zeile 15
 * @param string The regular expression to match in the template
* @param string The replacement string
* @param int Set to 1 to automatically create templates which do not exist for that set (based off master) - Defaults to 1

 * @param string The regular expression to match in the template
* @param string The replacement string
* @param int Set to 1 to automatically create templates which do not exist for that set (based off master) - Defaults to 1

 
 * @param int The maximum possible replacements for the regular expression

 * @return boolean true if updated one or more templates, false if not.
*/


 * @return boolean true if updated one or more templates, false if not.
*/


function find_replace_templatesets($title, $find, $replace, $autocreate=1, $sid=false)

function find_replace_templatesets($title, $find, $replace, $autocreate=1, $sid=false, $limit=-1)

{
global $db, $mybb;


{
global $db, $mybb;


Zeile 37Zeile 38
		while($template = $db->fetch_array($query))
{
// Update the template if there is a replacement term or a change

		while($template = $db->fetch_array($query))
{
// Update the template if there is a replacement term or a change

			$new_template = preg_replace($find, $replace, $template['template']);

			$new_template = preg_replace($find, $replace, $template['template'], $limit);

			if($new_template == $template['template'])
{
continue;

			if($new_template == $template['template'])
{
continue;

Zeile 59Zeile 60
		$template_sets[] = $template['sid'];

// Update the template if there is a replacement term or a change

		$template_sets[] = $template['sid'];

// Update the template if there is a replacement term or a change

		$new_template = preg_replace($find, $replace, $template['template']);

		$new_template = preg_replace($find, $replace, $template['template'], $limit);

		if($new_template == $template['template'])
{
continue;

		if($new_template == $template['template'])
{
continue;

Zeile 80Zeile 81
		// Select our master template with that title
$query = $db->simple_select("templates", "title, template", "title='".$db->escape_string($title)."' AND sid='-2'", array('limit' => 1));
$master_template = $db->fetch_array($query);

		// Select our master template with that title
$query = $db->simple_select("templates", "title, template", "title='".$db->escape_string($title)."' AND sid='-2'", array('limit' => 1));
$master_template = $db->fetch_array($query);

		$master_template['new_template'] = preg_replace($find, $replace, $master_template['template']);

		$master_template['new_template'] = preg_replace($find, $replace, $master_template['template'], $limit);


if($master_template['new_template'] != $master_template['template'])
{


if($master_template['new_template'] != $master_template['template'])
{