cvs: php-bugs-web / search.php /include functions.inc
| From: | jim winstead | Date: | Thu, 20 Jun 2002 04:43:20 +0000 |
| Subject: | cvs: php-bugs-web / search.php /include functions.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-10941@lists.php.net to get a copy of this message | ||
jimw Thu Jun 20 00:43:20 2002 EDT
Modified files:
/php-bugs-web search.php
/php-bugs-web/include functions.inc
Log:
just split words on whitespace, and handle stripslashes inside the word checking
Index: php-bugs-web/search.php
diff -u php-bugs-web/search.php:1.22 php-bugs-web/search.php:1.23
--- php-bugs-web/search.php:1.22 Thu Jun 20 00:38:35 2002
+++ php-bugs-web/search.php Thu Jun 20 00:43:19 2002
@@ -49,7 +49,7 @@
list($sql_search, $ignored) = format_search_string($search_for);
$where_clause .= $sql_search;
if (count($ignored) > 0 ) {
- array_push($warnings, "The following words were ignored: " .
htmlentities(stripslashes(implode(', ', array_unique($ignored)))));
+ array_push($warnings, "The following words were ignored: " .
htmlentities(implode(', ', array_unique($ignored))));
}
}
Index: php-bugs-web/include/functions.inc
diff -u php-bugs-web/include/functions.inc:1.34 php-bugs-web/include/functions.inc:1.35
--- php-bugs-web/include/functions.inc:1.34 Thu Jun 20 00:33:06 2002
+++ php-bugs-web/include/functions.inc Thu Jun 20 00:43:19 2002
@@ -439,12 +439,10 @@
$min_word_len=4;
- $ok = preg_match_all("/\w+/", $search, $matches);
+ $words = preg_split("/\s+/", stripslashes($search));
$ignored = array();
- foreach($matches[0] AS $match)
- {
- if(strlen($match) < $min_word_len)
- {
+ foreach($words AS $match) {
+ if(strlen($match) < $min_word_len) {
array_push($ignored, $match);
}
}