Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1463)
+++ branches/2.8.x/CHANGELOG	(revision 1464)
@@ -11,6 +11,8 @@
 ! = Update/Change
 
 ------------------------------------- 2.8.2 ------------------------------------
+01 Jun-2011 Build 1464 Werner v.d.Decken(DarkViper)
+# fixed little bug in moveCssToHead()
 01 Jul-2011 Build 1463 Dietmar Woellbrink (Luisehahne)
 # fixed Ticket 1050 Bug in include/phpmailer/class.phpmailer.php with Lotus Notes
 # fixed Ticket 573, 939 Bad formatting of e-mail received from form submissions
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1463)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1464)
@@ -52,6 +52,6 @@
 
 // check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
 if(!defined('VERSION')) define('VERSION', '2.8.2.RC6');
-if(!defined('REVISION')) define('REVISION', '1463');
+if(!defined('REVISION')) define('REVISION', '1464');
 
 ?>
Index: branches/2.8.x/wb/framework/frontend.functions.php
===================================================================
--- branches/2.8.x/wb/framework/frontend.functions.php	(revision 1463)
+++ branches/2.8.x/wb/framework/frontend.functions.php	(revision 1464)
@@ -595,21 +595,22 @@
 
 	function moveCssToHead($content) {
 		// move css definitions into head section
-		$pattern1 = '/(?:.*?<body.*?)(<link[^>]*?\"text\/css\".*?\/>)(?:.*)/si';
-		$pattern2 = '/(?:.*?<body.*?)(<style[^>]*?\"text\/css\"[^>]*?>.*?<\/style>)(?:.*)/si';
-		$insert1 = array();
-		$insert2 = array();
-		if(preg_match_all($pattern1, $content, $matches)) {
-			$insert1 = $matches[1];
-			$content = str_replace($insert1, '', $content);
+		$pattern1 = '/(?:<body.*?)(<link[^>]*?\"text\/css\".*?\/>)/si';
+		$pattern2 = '/(?:<body.*?)(<style[^>]*?\"text\/css\"[^>]*?>.*?<\/style>)/si';
+		while(preg_match($pattern1, $content, $matches)==1) {
+		// loop through all linked CSS
+			$insert = $matches[1];
+			$content = str_replace($insert, '', $content);
+			$insert = "\n".$insert."\n</head>\n<body";
+			$content = preg_replace('/<\/head>.*?<body/si', $insert, $content);
 		}
-		if(preg_match_all($pattern2, $content, $matches)) {
-			$insert2 = $matches[1];
-			$content = str_replace($insert2, '', $content);
+		while(preg_match($pattern2, $content, $matches)==1) {
+		// loop through all inline CSS
+			$insert = $matches[1];
+			$content = str_replace($insert, '', $content);
+			$insert = "\n".$insert."\n</head>\n<body";
+			$content = preg_replace('/<\/head>.*?<body/si', $insert, $content);
 		}
-		$insert = array_merge($insert1, $insert2);
-		$insert = "\n".implode("\n", $insert)."\n</head>\n<body";
-		$content = preg_replace('/<\/head>.*?<body/si', $insert, $content);
 		return $content;
 	}
 
@@ -627,6 +628,4 @@
 		// Get the pages submenu
 		$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PARENT."' AND $extra_where_sql ORDER BY position ASC");
 	}
-// End WB < 2.4.x template compatibility code
-// Include template file
 
