Permalink
Browse files

Fix for bug #2323 - forum search problem

  • Loading branch information...
1 parent 4f2ed95 commit 9ccdcd97eeb41e8021fd5d66e1d9461a4e3598e1 fiedorow committed Dec 31, 2004
Showing with 12 additions and 6 deletions.
  1. +12 −6 lib/weblib.php
View
@@ -1394,7 +1394,7 @@ function highlight($needle, $haystack, $case=0,
return $haystack;
}
- $list_of_words = eregi_replace("[^-a-zA-Z0-9&']", " ", $needle);
+ $list_of_words = eregi_replace("[^-a-zA-Z0-9&.']", " ", $needle);
$list_array = explode(' ', $list_of_words);
for ($i=0; $i<sizeof($list_array); $i++) {
if (strlen($list_array[$i]) == 1) {
@@ -1419,12 +1419,18 @@ function highlight($needle, $haystack, $case=0,
if ($list_of_words_cp{strlen($list_of_words_cp)-1}=='|') {
$list_of_words_cp{strlen($list_of_words_cp)-1}='';
}
- $list_of_words_cp = '('. trim($list_of_words_cp) .')';
- if (!$case){
- $haystack = eregi_replace($list_of_words_cp, $left_string ."\\1". $right_string, $haystack);
- } else {
- $haystack = ereg_replace($list_of_words_cp, $left_string ."\\1". $right_string, $haystack);
+ $list_of_words_cp = trim($list_of_words_cp);
+
+ if ($list_of_words_cp) {
+
+ $list_of_words_cp = "(". $list_of_words_cp .")";
+
+ if (!$case){
+ $haystack = eregi_replace("$list_of_words_cp", "$left_string"."\\1"."$right_string", $haystack);
+ } else {
+ $haystack = ereg_replace("$list_of_words_cp", "$left_string"."\\1"."$right_string", $haystack);
+ }
}
$haystack = str_replace(array_keys($final),$final,$haystack);

0 comments on commit 9ccdcd9

Please sign in to comment.