Vergleich admin/inc/functions_themes.php - 1.4.0 - 1.4.12

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 332Zeile 332
		return false;
}


		return false;
}


	if(!file_exists(MYBB_ROOT."cache/themes/theme{$stylesheet['tid']}/{$stylesheet['cachefile']}"))

	if(!file_exists(MYBB_ROOT."cache/themes/theme{$stylesheet['tid']}/{$stylesheet['name']}"))

	{
if(cache_stylesheet($stylesheet['tid'], $stylesheet['cachefile'], $stylesheet['stylesheet']) !== false)
{

	{
if(cache_stylesheet($stylesheet['tid'], $stylesheet['cachefile'], $stylesheet['stylesheet']) !== false)
{

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


			update_theme_stylesheet_list($stylesheet['tid']);

if($stylesheet['sid'] != 1)

			update_theme_stylesheet_list($stylesheet['tid']);

if($stylesheet['sid'] != 1)

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

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

	
return true;
}
else if($stylesheet['sid'] != 1 && @filemtime(MYBB_ROOT."cache/themes/theme{$stylesheet['tid']}/{$stylesheet['cachefile']}") > $stylesheet['lastmodified'])

	
return true;
}
else if($stylesheet['sid'] != 1 && @filemtime(MYBB_ROOT."cache/themes/theme{$stylesheet['tid']}/{$stylesheet['name']}") > $stylesheet['lastmodified'])

	{

	{

		$contents = unfix_css_urls(file_get_contents(MYBB_ROOT."cache/themes/theme{$stylesheet['tid']}/{$stylesheet['cachefile']}"));

		$contents = unfix_css_urls(file_get_contents(MYBB_ROOT."cache/themes/theme{$stylesheet['tid']}/{$stylesheet['name']}"));

		$db->update_query("themestylesheets", array('stylesheet' => $db->escape_string($contents), 'lastmodified' => TIME_NOW), "sid='{$stylesheet['sid']}'", 1);
return true;
}

		$db->update_query("themestylesheets", array('stylesheet' => $db->escape_string($contents), 'lastmodified' => TIME_NOW), "sid='{$stylesheet['sid']}'", 1);
return true;
}

Zeile 366Zeile 368
	{
return "url({$url})";
}

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

}

}


function unfix_css_urls($url)
{


function unfix_css_urls($url)
{

Zeile 413Zeile 415
					
$properties[$property] = $value;
if($parent_properties['inherited'][$property])

					
$properties[$property] = $value;
if($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;

			}
}

			}
}


if(count($stylesheets) == 0)
{


if(count($stylesheets) == 0)
{

Zeile 489Zeile 491
{
// Normalise line breaks
$css = str_replace(array("\r\n", "\n", "\r"), "\n", $css);

{
// Normalise line breaks
$css = str_replace(array("\r\n", "\n", "\r"), "\n", $css);





	/**
* Play with the css a little - just to ensure we can parse it
*

	/**
* Play with the css a little - just to ensure we can parse it
*

Zeile 517Zeile 519
		if($description_match[count($description_match)-1][0])
{
$description = trim($description_match[count($description_match)-1][0]);

		if($description_match[count($description_match)-1][0])
{
$description = trim($description_match[count($description_match)-1][0]);

		}

		}

		$class_id = md5($class_name);
if($already_parsed[$class_id])
{

		$class_id = md5($class_name);
if($already_parsed[$class_id])
{

Zeile 554Zeile 556
			if(!$css_array['name'])
{
$css_array['name'] = $css_array['class_name'];

			if(!$css_array['name'])
{
$css_array['name'] = $css_array['class_name'];

			}

			}

			
if($selected_item == $id || (!$selected_item && !$selected))

			
if($selected_item == $id || (!$selected_item && !$selected))

			{

			{

				$select .= "<option value=\"{$id}\" selected=\"selected\">{$css_array['name']}</option>\n";
$selected = true;

				$select .= "<option value=\"{$id}\" selected=\"selected\">{$css_array['name']}</option>\n";
$selected = true;

			}

			}

			else
{
$select .= "<option value=\"{$id}\">{$css_array['name']}</option>\n";

			else
{
$select .= "<option value=\"{$id}\">{$css_array['name']}</option>\n";

			}
}

			}
}

	}
return $select;
}

	}
return $select;
}

Zeile 575Zeile 577
	if(!is_array($css))
{
$css = css_to_array($css);

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

	}

	}

	
if(!isset($css[$id]))
{
return false;
}
return parse_css_properties($css[$id]['values']);

	
if(!isset($css[$id]))
{
return false;
}
return parse_css_properties($css[$id]['values']);

}

/**

}

/**

 * Parses CSS supported properties and returns them as an array.
*
* @param string Value of CSS properties from within class or selector

 * Parses CSS supported properties and returns them as an array.
*
* @param string Value of CSS properties from within class or selector

Zeile 641Zeile 643
	foreach($new_css as $css_line)
{
$generated_css .= "\t".trim($css_line)."\n";

	foreach($new_css as $css_line)
{
$generated_css .= "\t".trim($css_line)."\n";

	}

	}


// Parse out the CSS
if($css)


// Parse out the CSS
if($css)

	{

	{

		$parsed_css = css_to_array($css);
}

if(!$class_id)

		$parsed_css = css_to_array($css);
}

if(!$class_id)

	{

	{

		$class_id = $parsed_css[$selector]['class_name'];
}


		$class_id = $parsed_css[$selector]['class_name'];
}


Zeile 685Zeile 687
		{
$pos = strpos($css, "\n".$existing_block['class_name']." {", $pos);
if($pos === false)

		{
$pos = strpos($css, "\n".$existing_block['class_name']." {", $pos);
if($pos === false)

			{
break;
}

			{
break;
}

			if($occurance == $actual_occurance)
{
// This is the part we want to replace, now we need to fetch the opening & closing braces

			if($occurance == $actual_occurance)
{
// This is the part we want to replace, now we need to fetch the opening & closing braces

Zeile 715Zeile 717
	foreach($stylesheet as $key => $value)
{
$stylesheet[$db->escape_string($key)] = $db->escape_string($value);

	foreach($stylesheet as $key => $value)
{
$stylesheet[$db->escape_string($key)] = $db->escape_string($value);

	}

$sid = $db->insert_query("themestylesheets", $stylesheet);

	}

$sid = $db->insert_query("themestylesheets", $stylesheet);

	
return $sid;
}

	
return $sid;
}

Zeile 760Zeile 762
		
foreach($parent_list as $theme_id)
{

		
foreach($parent_list as $theme_id)
{

			if(file_exists(MYBB_ROOT."cache/themes/theme{$theme_id}/{$stylesheet['cachefile']}") && filemtime(MYBB_ROOT."cache/themes/theme{$theme_id}/{$stylesheet['cachefile']}") >= $stylesheet['lastmodified'])

			if(file_exists(MYBB_ROOT."cache/themes/theme{$theme_id}/{$stylesheet['name']}") && filemtime(MYBB_ROOT."cache/themes/theme{$theme_id}/{$stylesheet['name']}") >= $stylesheet['lastmodified'])

			{

			{

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

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

				break;
}
}

				break;
}
}

Zeile 810Zeile 812
	// Do we have any children themes that need updating too?
if(count($child_list) > 0)
{

	// Do we have any children themes that need updating too?
if(count($child_list) > 0)
{

		update_theme_stylesheet_list($child_list[0]);




		foreach($child_list as $id)
{
update_theme_stylesheet_list($id);
}

	}

return true;

	}

return true;

Zeile 822Zeile 827
	
$themes = array();
if(!is_array($themes_by_parent))

	
$themes = array();
if(!is_array($themes_by_parent))

	{
$theme_cache = cache_themes();
foreach($theme_cache as $key => $theme)
{
if($key == "default")

	{
$theme_cache = cache_themes();
foreach($theme_cache as $key => $theme)
{
if($key == "default")

			{
continue;
}

$themes_by_parent[$theme['tid']][$theme['pid']] = $theme;

			{
continue;
}

$themes_by_parent[$theme['tid']][$theme['pid']] = $theme;

		}
}


		}
}


	if(!is_array($themes_by_parent[$tid]))
{
return false;

	if(!is_array($themes_by_parent[$tid]))
{
return false;

Zeile 872Zeile 877
			if($key == "default")
{
continue;

			if($key == "default")
{
continue;

			}

			}

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

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

	}


	}


	if(!is_array($themes_by_child[$tid]))
{
return;

	if(!is_array($themes_by_child[$tid]))
{
return;

	}


	}


	$themes = array();

foreach($themes_by_child[$tid] as $theme)

	$themes = array();

foreach($themes_by_child[$tid] as $theme)

Zeile 891Zeile 896
		$children = make_child_theme_list($theme['tid']);

if(is_array($children))

		$children = make_child_theme_list($theme['tid']);

if(is_array($children))

		{

		{

			$themes = array_merge($themes, $children);
}
}

			$themes = array_merge($themes, $children);
}
}

Zeile 949Zeile 954
			{
$user_themes['style'] = $themes['default'];
}

			{
$user_themes['style'] = $themes['default'];
}

			$themes[$user_themes['style']]['users'] = intval($user_themes['users']);









			
if($themes[$user_themes['style']]['users'] > 0)
{
$themes[$user_themes['style']]['users'] += intval($user_themes['users']);
}
else
{
$themes[$user_themes['style']]['users'] = intval($user_themes['users']);
}

		}

// Restrucure the theme array to something we can "loop-de-loop" with

		}

// Restrucure the theme array to something we can "loop-de-loop" with

Zeile 987Zeile 1000
			
if($theme['def'] != 1)
{

			
if($theme['def'] != 1)
{

				$popup->add_item($lang->set_as_default, "index.php?module=style/themes&amp;action=set_default&amp;tid={$theme['tid']}");
$set_default = "<a href=\"index.php?module=style/themes&amp;action=set_default&amp;tid={$theme['tid']}\"><img src=\"styles/{$page->style}/images/icons/make_default.gif\" alt=\"{$lang->set_as_default}\" style=\"vertical-align: middle;\" title=\"{$lang->set_as_default}\" /></a>";

				$popup->add_item($lang->set_as_default, "index.php?module=style/themes&amp;action=set_default&amp;tid={$theme['tid']}&amp;my_post_key={$mybb->post_code}");
$set_default = "<a href=\"index.php?module=style/themes&amp;action=set_default&amp;tid={$theme['tid']}&amp;my_post_key={$mybb->post_code}\"><img src=\"styles/{$page->style}/images/icons/make_default.gif\" alt=\"{$lang->set_as_default}\" style=\"vertical-align: middle;\" title=\"{$lang->set_as_default}\" /></a>";

			}
else
{

			}
else
{