Vergleich admin/inc/functions_themes.php - 1.8.12 - 1.8.23

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 262Zeile 262
		$loop = 1;
foreach($theme['stylesheets']['stylesheet'] as $stylesheet)
{

		$loop = 1;
foreach($theme['stylesheets']['stylesheet'] as $stylesheet)
{

 
			$stylesheet['attributes']['name'] = my_substr($stylesheet['attributes']['name'], 0, 30);


			if(substr($stylesheet['attributes']['name'], -4) != ".css")

			if(substr($stylesheet['attributes']['name'], -4) != ".css")

			{

			{

				continue;

				continue;

			}

			}


if(empty($stylesheet['attributes']['lastmodified']))
{
$stylesheet['attributes']['lastmodified'] = TIME_NOW;


if(empty($stylesheet['attributes']['lastmodified']))
{
$stylesheet['attributes']['lastmodified'] = TIME_NOW;

			}


			}


			if(empty($stylesheet['attributes']['disporder']))

			if(empty($stylesheet['attributes']['disporder']))

			{

			{

				$stylesheet['attributes']['disporder'] = $loop;
}

if(empty($stylesheet['attributes']['attachedto']))

				$stylesheet['attributes']['disporder'] = $loop;
}

if(empty($stylesheet['attributes']['attachedto']))

			{

			{

				$stylesheet['attributes']['attachedto'] = '';
}


				$stylesheet['attributes']['attachedto'] = '';
}


Zeile 296Zeile 298
			$css_url = "css.php?stylesheet={$sid}";
$cached = cache_stylesheet($theme_id, $stylesheet['attributes']['name'], $stylesheet['value']);
if($cached)

			$css_url = "css.php?stylesheet={$sid}";
$cached = cache_stylesheet($theme_id, $stylesheet['attributes']['name'], $stylesheet['value']);
if($cached)

			{

			{

				$css_url = $cached;
}


				$css_url = $cached;
}


Zeile 330Zeile 332
			"stylesheets" => $db->escape_string(my_serialize($theme_stylesheets))
);


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


		if(is_array($properties['disporder']))
{
asort($properties['disporder'], SORT_NUMERIC);

// Because inherited stylesheets can mess this up
$loop = 1;
$orders = array();
foreach($properties['disporder'] as $filename => $order)
{
$orders[$filename] = $loop;
++$loop;
}

$properties['disporder'] = $orders;
$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}'");
}



















update_theme_stylesheet_list($theme_id);



update_theme_stylesheet_list($theme_id);


Zeile 391Zeile 376
	$filename = basename($filename);
$tid = (int) $tid;
$theme_directory = "cache/themes/theme{$tid}";

	$filename = basename($filename);
$tid = (int) $tid;
$theme_directory = "cache/themes/theme{$tid}";

 

if(substr($filename, -4) != ".css")
{
return false;
}


// If we're in safe mode save to the main theme folder by default
if($mybb->safemode)


// If we're in safe mode save to the main theme folder by default
if($mybb->safemode)

Zeile 418Zeile 408

$theme_vars = array(
"theme" => $theme_directory


$theme_vars = array(
"theme" => $theme_directory

	);

	);

	$stylesheet = parse_theme_variables($stylesheet, $theme_vars);

	$stylesheet = parse_theme_variables($stylesheet, $theme_vars);

	$stylesheet = preg_replace_callback("#url\((\"|'|)(.*)\\1\)#", create_function('$matches', 'return fix_css_urls($matches[2]);'), $stylesheet);

	$stylesheet = preg_replace_callback("#url\((\"|'|)([^\"'\s]*?)\\1\)#", 'fix_css_urls_callback', $stylesheet);


$fp = @fopen(MYBB_ROOT . "{$theme_directory}/{$filename}", "wb");
if(!$fp)


$fp = @fopen(MYBB_ROOT . "{$theme_directory}/{$filename}", "wb");
if(!$fp)

Zeile 445Zeile 435
	copy_file_to_cdn(MYBB_ROOT . "{$theme_directory}/{$filename_min}");

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

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

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

}


}


/**
* Minify a stylesheet to remove comments, linebreaks, whitespace,
* unnecessary semicolons, and prefers #rgb over #rrggbb.

/**
* Minify a stylesheet to remove comments, linebreaks, whitespace,
* unnecessary semicolons, and prefers #rgb over #rrggbb.

Zeile 472Zeile 462
 * @param array $stylesheet
*
* @return bool

 * @param array $stylesheet
*
* @return bool

 */

 */

function resync_stylesheet($stylesheet)
{
global $db;

function resync_stylesheet($stylesheet)
{
global $db;

Zeile 511Zeile 501
}

/**

}

/**

 
 * @deprecated

 * @param string $url
*
* @return string

 * @param string $url
*
* @return string

Zeile 528Zeile 519
}

/**

}

/**

 
 * @param array $matches Matches.
*
* @return string
*/
function fix_css_urls_callback($matches)
{
return fix_css_urls($matches[2]);
}

/**
* @deprecated

 * @param string $url
*
* @return string

 * @param string $url
*
* @return string

Zeile 565Zeile 567
	{
$query = $db->simple_select("themes", "*", "tid='".(int)$parent."'");
$parent_theme = $db->fetch_array($query);

	{
$query = $db->simple_select("themes", "*", "tid='".(int)$parent."'");
$parent_theme = $db->fetch_array($query);

		if(count($properties) == 0 || !is_array($properties))

		if(!is_array($properties) || count($properties) == 0)

		{
$parent_properties = my_unserialize($parent_theme['properties']);
if(!empty($parent_properties))

		{
$parent_properties = my_unserialize($parent_theme['properties']);
if(!empty($parent_properties))

Zeile 628Zeile 630
		);
$properties['logo'] = parse_theme_variables($properties['logo'], $theme_vars);
}

		);
$properties['logo'] = parse_theme_variables($properties['logo'], $theme_vars);
}

 
	
$updated_theme = array();

	if(!empty($stylesheets))
{
$updated_theme['stylesheets'] = $db->escape_string(my_serialize($stylesheets));

	if(!empty($stylesheets))
{
$updated_theme['stylesheets'] = $db->escape_string(my_serialize($stylesheets));

Zeile 711Zeile 715
{
$select = "";


{
$select = "";


	if(!is_array($css))
{
$css = css_to_array($css);
}

$selected = false;


	if(!is_array($css))
{
$css = css_to_array($css);
}

$selected = false;


	if(is_array($css))
{
uasort($css, "css_selectors_sort_cmp");

	if(is_array($css))
{
uasort($css, "css_selectors_sort_cmp");

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

// Do we have any children themes that need updating too?

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

// Do we have any children themes that need updating too?

	if(count($child_list) > 0)

	if(is_array($child_list) && count($child_list) > 0)

	{
foreach($child_list as $id)
{

	{
foreach($child_list as $id)
{

Zeile 1161Zeile 1165
	{
$themes[] = $theme['tid'];
$parents = make_parent_theme_list($theme['pid']);

	{
$themes[] = $theme['tid'];
$parents = make_parent_theme_list($theme['pid']);





		if(is_array($parents))
{
$themes = array_merge($themes, $parents);
}
}

		if(is_array($parents))
{
$themes = array_merge($themes, $parents);
}
}





	return $themes;
}


	return $themes;
}


Zeile 1179Zeile 1183
function make_child_theme_list($tid)
{
static $themes_by_child;

function make_child_theme_list($tid)
{
static $themes_by_child;


$themes = array();


$themes = array();

	if(!is_array($themes_by_child))
{
$theme_cache = cache_themes();

	if(!is_array($themes_by_child))
{
$theme_cache = cache_themes();

Zeile 1193Zeile 1197

$themes_by_child[$theme['pid']][$theme['tid']] = $theme;
}


$themes_by_child[$theme['pid']][$theme['tid']] = $theme;
}

	}

	}


if(!isset($themes_by_child[$tid]) || !is_array($themes_by_child[$tid]))


if(!isset($themes_by_child[$tid]) || !is_array($themes_by_child[$tid]))

	{
return null;
}

	{
return null;
}


$themes = array();



$themes = array();


Zeile 1235Zeile 1239
			if($theme['def'] == 1)
{
$theme_cache['default'] = $theme['tid'];

			if($theme['def'] == 1)
{
$theme_cache['default'] = $theme['tid'];

			}

			}

		}
}


		}
}


Zeile 1309Zeile 1313

// We must have at least the master and 1 other active theme
if($theme_cache['num_themes'] > 2)


// We must have at least the master and 1 other active theme
if($theme_cache['num_themes'] > 2)

			{

			{

				$popup->add_item($lang->delete_theme, "index.php?module=style-themes&action=delete&tid={$theme['tid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_theme_deletion}')");
}


				$popup->add_item($lang->delete_theme, "index.php?module=style-themes&action=delete&tid={$theme['tid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_theme_deletion}')");
}


Zeile 1346Zeile 1350
 * @return null|string
*/
function build_theme_array($ignoretid = null, $parent=0, $depth=0)

 * @return null|string
*/
function build_theme_array($ignoretid = null, $parent=0, $depth=0)

{

{

	global $list;
static $theme_cache;


	global $list;
static $theme_cache;


Zeile 1364Zeile 1368
			$theme_cache[$theme['pid']][$theme['tid']] = $theme;
}
unset($theme);

			$theme_cache[$theme['pid']][$theme['tid']] = $theme;
}
unset($theme);

	}


	}


	if(!is_array($theme_cache[$parent]) || $ignoretid === $parent)
{
return null;

	if(!is_array($theme_cache[$parent]) || $ignoretid === $parent)
{
return null;

Zeile 1457Zeile 1461
 */
function upgrade_css_120_to_140($css)
{

 */
function upgrade_css_120_to_140($css)
{

 
	global $mybb;

	// Update our CSS to the new stuff in 1.4
$parsed_css = css_to_array($css);


	// Update our CSS to the new stuff in 1.4
$parsed_css = css_to_array($css);