Skip to content

Commit

Permalink
Fix for bug #2323 - forum search problem
Browse files Browse the repository at this point in the history
  • Loading branch information
fiedorow committed Dec 31, 2004
1 parent 4f2ed95 commit 9ccdcd9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/weblib.php
Expand Up @@ -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) {
Expand All @@ -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);

Expand Down

0 comments on commit 9ccdcd9

Please sign in to comment.