Vergleich admin/inc/functions_themes.php - 1.8.2 - 1.8.5

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 220Zeile 220
	else
{
$db->delete_query("themestylesheets", "tid='{$options['tid']}'");

	else
{
$db->delete_query("themestylesheets", "tid='{$options['tid']}'");

		$db->update_query("themes", array("properties" => $db->escape_string(serialize($properties))), "tid='{$options['tid']}'");

		$db->update_query("themes", array("properties" => $db->escape_string(my_serialize($properties))), "tid='{$options['tid']}'");

		$theme_id = $options['tid'];
}


		$theme_id = $options['tid'];
}


Zeile 327Zeile 327
		}
// Now we have our list of built stylesheets, save them
$updated_theme = array(

		}
// Now we have our list of built stylesheets, save them
$updated_theme = array(

			"stylesheets" => $db->escape_string(serialize($theme_stylesheets))

			"stylesheets" => $db->escape_string(my_serialize($theme_stylesheets))

		);

if(is_array($properties['disporder']))

		);

if(is_array($properties['disporder']))

Zeile 344Zeile 344
			}

$properties['disporder'] = $orders;

			}

$properties['disporder'] = $orders;

			$updated_theme['properties'] = $db->escape_string(serialize($properties));

			$updated_theme['properties'] = $db->escape_string(my_serialize($properties));

		}

$db->update_query("themes", $updated_theme, "tid='{$theme_id}'");

		}

$db->update_query("themes", $updated_theme, "tid='{$theme_id}'");

Zeile 441Zeile 441
	@fwrite($fp_min, $stylesheet_min);
@fclose($fp_min);


	@fwrite($fp_min, $stylesheet_min);
@fclose($fp_min);


	if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
{
$cdn_path = rtrim($mybb->settings['cdnpath'], '/\\');
$cache_themes_dir = $cdn_path . '/' . $theme_directory;

$copy_to_cdn = true;

if(!is_dir($cache_themes_dir))
{
if(!@mkdir($cache_themes_dir))
{
$copy_to_cdn = false;
}
}

if($copy_to_cdn)
{
@copy(MYBB_ROOT . "{$theme_directory}/{$filename}", "{$cache_themes_dir}/{$filename}");
@copy(MYBB_ROOT . "{$theme_directory}/{$filename_min}", "{$cache_themes_dir}/{$filename_min}");
}
}

	copy_file_to_cdn(MYBB_ROOT . "{$theme_directory}/{$filename}");
copy_file_to_cdn(MYBB_ROOT . "{$theme_directory}/{$filename_min}");





















return "{$theme_directory}/{$filename}";
}


return "{$theme_directory}/{$filename}";
}

Zeile 485Zeile 466
	$stylesheet = preg_replace('@#([a-f0-9])\1([a-f0-9])\2([a-f0-9])\3@i','#\1\2\3',$stylesheet);
$stylesheet = trim($stylesheet);
return $stylesheet;

	$stylesheet = preg_replace('@#([a-f0-9])\1([a-f0-9])\2([a-f0-9])\3@i','#\1\2\3',$stylesheet);
$stylesheet = trim($stylesheet);
return $stylesheet;

}


}


function resync_stylesheet($stylesheet)
{
global $db;

function resync_stylesheet($stylesheet)
{
global $db;

Zeile 502Zeile 483
	if(!$stylesheet['cachefile'] || strpos($stylesheet['cachefile'], 'css.php') !== false)
{
return false;

	if(!$stylesheet['cachefile'] || strpos($stylesheet['cachefile'], 'css.php') !== false)
{
return false;

	}


	}


	if(!file_exists(MYBB_ROOT."cache/themes/theme{$stylesheet['tid']}/{$stylesheet['name']}") && !file_exists(MYBB_ROOT."cache/themes/{$stylesheet['tid']}_{$stylesheet['name']}"))
{
if(cache_stylesheet($stylesheet['tid'], $stylesheet['cachefile'], $stylesheet['stylesheet']) !== false)

	if(!file_exists(MYBB_ROOT."cache/themes/theme{$stylesheet['tid']}/{$stylesheet['name']}") && !file_exists(MYBB_ROOT."cache/themes/{$stylesheet['tid']}_{$stylesheet['name']}"))
{
if(cache_stylesheet($stylesheet['tid'], $stylesheet['cachefile'], $stylesheet['stylesheet']) !== false)

Zeile 511Zeile 492
			$db->update_query("themestylesheets", array('cachefile' => $db->escape_string($stylesheet['name'])), "sid='{$stylesheet['sid']}'");

update_theme_stylesheet_list($stylesheet['tid']);

			$db->update_query("themestylesheets", array('cachefile' => $db->escape_string($stylesheet['name'])), "sid='{$stylesheet['sid']}'");

update_theme_stylesheet_list($stylesheet['tid']);





			if($stylesheet['sid'] != 1)
{
$db->update_query("themestylesheets", array('lastmodified' => TIME_NOW), "sid='{$stylesheet['sid']}'");

			if($stylesheet['sid'] != 1)
{
$db->update_query("themestylesheets", array('lastmodified' => TIME_NOW), "sid='{$stylesheet['sid']}'");

Zeile 527Zeile 508
function fix_css_urls($url)
{
if(!preg_match("#^([a-z0-9]+\:|/)#i", $url) && strpos($url, "../../../") === false)

function fix_css_urls($url)
{
if(!preg_match("#^([a-z0-9]+\:|/)#i", $url) && strpos($url, "../../../") === false)

	{

	{

		return "url(../../../{$url})";

		return "url(../../../{$url})";

	}

	}

	else
{
return "url({$url})";
}

	else
{
return "url({$url})";
}

}


}


function unfix_css_urls($url)
{
return str_replace("../../../", "", $url);

function unfix_css_urls($url)
{
return str_replace("../../../", "", $url);

Zeile 583Zeile 564

$properties[$property] = $value;
if(!empty($parent_properties['inherited'][$property]))


$properties[$property] = $value;
if(!empty($parent_properties['inherited'][$property]))

					{

					{

						$properties['inherited'][$property] = $parent_properties['inherited'][$property];

						$properties['inherited'][$property] = $parent_properties['inherited'][$property];

					}

					}

					else
{
$properties['inherited'][$property] = $parent;
}
}
$inherited_properties = true;

					else
{
$properties['inherited'][$property] = $parent;
}
}
$inherited_properties = true;

			}

			}

		}

$parent_stylesheets = my_unserialize($parent_theme['stylesheets']);

		}

$parent_stylesheets = my_unserialize($parent_theme['stylesheets']);

Zeile 634Zeile 615
	}
if(!empty($stylesheets))
{

	}
if(!empty($stylesheets))
{

		$updated_theme['stylesheets'] = $db->escape_string(serialize($stylesheets));

		$updated_theme['stylesheets'] = $db->escape_string(my_serialize($stylesheets));

	}

	}

	$updated_theme['properties'] = $db->escape_string(serialize($properties));

	$updated_theme['properties'] = $db->escape_string(my_serialize($properties));


if(count($updated_theme) > 0)
{


if(count($updated_theme) > 0)
{

Zeile 854Zeile 835
	}
// Valid CSS, swap out old, swap in new
else

	}
// Valid CSS, swap out old, swap in new
else

	{

	{

		$css = str_replace(array("\r\n", "\n", "\r"), "\n", $css);
$css = preg_replace('#(?<!\\")\}#', "}\n", $css);
$css = preg_replace("#^(?!@)\s*([a-z0-9a+\\\[\]\-\"=_:>\*\.\#\,\s\(\)\|~\^]+)(\s*)\{(\n*)#isu", "\n$1 {\n", $css);

		$css = str_replace(array("\r\n", "\n", "\r"), "\n", $css);
$css = preg_replace('#(?<!\\")\}#', "}\n", $css);
$css = preg_replace("#^(?!@)\s*([a-z0-9a+\\\[\]\-\"=_:>\*\.\#\,\s\(\)\|~\^]+)(\s*)\{(\n*)#isu", "\n$1 {\n", $css);

Zeile 902Zeile 883
function copy_stylesheet_to_theme($stylesheet, $tid)
{
global $db;

function copy_stylesheet_to_theme($stylesheet, $tid)
{
global $db;





	$stylesheet['tid'] = $tid;
unset($stylesheet['sid']);


	$stylesheet['tid'] = $tid;
unset($stylesheet['sid']);


Zeile 919Zeile 900

return $sid;
}


return $sid;
}





function update_theme_stylesheet_list($tid, $theme = false, $update_disporders = true)
{

function update_theme_stylesheet_list($tid, $theme = false, $update_disporders = true)
{

	global $db, $cache;

	global $mybb, $db, $cache, $plugins;


$stylesheets = array();



$stylesheets = array();


Zeile 932Zeile 913
	if(!is_array($parent_list))
{
return false;

	if(!is_array($parent_list))
{
return false;

	}

$tid_list = implode(',', $parent_list);


	}

$tid_list = implode(',', $parent_list);


	// Get our list of stylesheets
$query = $db->simple_select("themestylesheets", "*", "tid IN ({$tid_list})", array('order_by' => 'tid', 'order_dir' => 'desc'));
while($stylesheet = $db->fetch_array($query))

	// Get our list of stylesheets
$query = $db->simple_select("themestylesheets", "*", "tid IN ({$tid_list})", array('order_by' => 'tid', 'order_dir' => 'desc'));
while($stylesheet = $db->fetch_array($query))

Zeile 943Zeile 924
		if(empty($stylesheets[$stylesheet['name']]))
{
if($stylesheet['tid'] != $tid)

		if(empty($stylesheets[$stylesheet['name']]))
{
if($stylesheet['tid'] != $tid)

			{

			{

				$stylesheet['inherited'] = $stylesheet['tid'];
}


				$stylesheet['inherited'] = $stylesheet['tid'];
}


Zeile 959Zeile 940
		$css_url = "css.php?stylesheet={$sid}";

foreach($parent_list as $theme_id)

		$css_url = "css.php?stylesheet={$sid}";

foreach($parent_list as $theme_id)

		{

		{

			if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
{
$cdnpath = rtrim($mybb->settings['cdnpath'], '/\\').'/';
if(file_exists($cdnpath."cache/themes/theme{$theme_id}/{$stylesheet['name']}") && filemtime(
$cdnpath."cache/themes/theme{$theme_id}/{$stylesheet['name']}"

			if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
{
$cdnpath = rtrim($mybb->settings['cdnpath'], '/\\').'/';
if(file_exists($cdnpath."cache/themes/theme{$theme_id}/{$stylesheet['name']}") && filemtime(
$cdnpath."cache/themes/theme{$theme_id}/{$stylesheet['name']}"

					) >= $stylesheet['lastmodified']
)
{

					) >= $stylesheet['lastmodified']
)
{

					$css_url = "cache/themes/theme{$theme_id}/{$stylesheet['name']}";
break;
}

					$css_url = "cache/themes/theme{$theme_id}/{$stylesheet['name']}";
break;
}

Zeile 983Zeile 964
					break;
}
}

					break;
}
}

 
		}

if(is_object($plugins))
{
$plugins->run_hooks('update_theme_stylesheet_list_set_css_url', $css_url);

		}

$attachedto = $stylesheet['attachedto'];

		}

$attachedto = $stylesheet['attachedto'];

Zeile 1021Zeile 1007

// Now we have our list of built stylesheets, save them
$updated_theme = array(


// Now we have our list of built stylesheets, save them
$updated_theme = array(

		"stylesheets" => $db->escape_string(serialize($theme_stylesheets))

		"stylesheets" => $db->escape_string(my_serialize($theme_stylesheets))

	);

// Do we have a theme present? If so, update the stylesheet display orders

	);

// Do we have a theme present? If so, update the stylesheet display orders

Zeile 1072Zeile 1058

asort($orders);
$properties['disporder'] = $orders;


asort($orders);
$properties['disporder'] = $orders;

		$updated_theme['properties'] = $db->escape_string(serialize($properties));

		$updated_theme['properties'] = $db->escape_string(my_serialize($properties));

	}

$db->update_query("themes", $updated_theme, "tid = '{$tid}'");

	}

$db->update_query("themes", $updated_theme, "tid = '{$tid}'");