Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 885)
+++ trunk/CHANGELOG	(revision 886)
@@ -11,6 +11,8 @@
 ! = Update/Change
 
 ------------------------------------- 2.7.1 -------------------------------------
+26-Dec-2008 Thomas Hornik
+#	fixed two issues with searchresult-highlighting: do not highlight in <pre>/<code>-tags, do not convert &lt; to &amp;lt; anymore. 
 13-Dec-2008 Christian Sommer
 !	changed mailer to not extract line break of alternative body text (thanks to freeSbee)
 28-Oct-2008 Christian Sommer
Index: trunk/wb/framework/frontend.functions.php
===================================================================
--- trunk/wb/framework/frontend.functions.php	(revision 885)
+++ trunk/wb/framework/frontend.functions.php	(revision 886)
@@ -67,7 +67,7 @@
 }
 
 //function to highlight search results
-if (!function_exists('search_highlight')) {
+if(!function_exists('search_highlight')) {
 function search_highlight($foo='', $arr_string=array()) {
 	require_once(WB_PATH.'/framework/functions.php');
 	static $string_ul_umlaut = FALSE;
@@ -75,21 +75,22 @@
 	if($string_ul_umlaut===FALSE || $string_ul_regex===FALSE)
 		require(WB_PATH.'/search/search_convert.php');
 	$foo = entities_to_umlauts($foo, 'UTF-8');
-	array_walk($arr_string, create_function('&$v,$k','$v = preg_quote($v, \'/\');'));
+	array_walk($arr_string, create_function('&$v,$k','$v = preg_quote($v, \'~\');'));
 	$search_string = implode("|", $arr_string);
 	$string = str_replace($string_ul_umlaut, $string_ul_regex, $search_string);
 	// the highlighting
 	// match $string, but not inside <style>...</style>, <script>...</script>, <!--...--> or HTML-Tags
 	// split $string into pieces - "cut away" styles, scripts, comments, HTML-tags and eMail-addresses
+	// we have to cut <pre> and <code> as well.
 	// for HTML-Tags use <(?:[^<]|<.*>)*> which will match strings like <input ... value="<b>value</b>" >
-	$matches = preg_split("/(<style.*<\/style>|<script.*<\/script>|<!--.*-->|<(?:[^<]|<.*>)*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}\b)/iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
+	$matches = preg_split("~(<style.*</style>|<script.*</script>|<pre.*</pre>|<code.*</code>|<!--.*-->|<(?:[^<]|<.*>)*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}\b)~iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
 	if(is_array($matches) && $matches != array()) {
 		$foo = "";
 		foreach($matches as $match) {
 			if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}$/i', $match)) {
 				$match = str_replace(array('&lt;', '&gt;', '&amp;', '&quot;', '&#039;', '&nbsp;'), array('<', '>', '&', '"', '\'', "\xC2\xA0"), $match);
-				$match = preg_replace('/('.$string.')/ui', '_span class=_highlight__$1_/span_',$match);
-				$match = str_replace(array('<', '>', '&', '"', '\'', "\xC2\xA0"), array('&lt;', '&gt;', '&amp;', '&quot;', '&#039;', '&nbsp;'), $match);
+				$match = preg_replace('~('.$string.')~ui', '_span class=_highlight__$1_/span_',$match);
+				$match = str_replace(array('&', '<', '>', '"', '\'', "\xC2\xA0"), array('&amp;', '&lt;', '&gt;', '&quot;', '&#039;', '&nbsp;'), $match);
 				$match = str_replace(array('_span class=_highlight__', '_/span_'), array('<span class="highlight">', '</span>'), $match);
 			}
 			$foo .= $match;
