summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjartan Mannes <kjartan@2.no-reply.drupal.org>2004-05-30 21:04:07 +0000
committerKjartan Mannes <kjartan@2.no-reply.drupal.org>2004-05-30 21:04:07 +0000
commit2954836fbacfb1da67da83756f7505f61b75ba73 (patch)
tree78895c2322c5657984c21cfde0a85da69bb0e6ac
parent5cd371578ed6af0c5dba1f9f3e7d617f36b21324 (diff)
downloadbrdo-2954836fbacfb1da67da83756f7505f61b75ba73.tar.gz
brdo-2954836fbacfb1da67da83756f7505f61b75ba73.tar.bz2
- Fixed empty searches being performed.
- Fixed empty searches being logged. - Trim whitespace from start and end of search key.
-rw-r--r--modules/search.module11
-rw-r--r--modules/search/search.module11
2 files changed, 12 insertions, 10 deletions
diff --git a/modules/search.module b/modules/search.module
index dec843da3..790fcca77 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -339,13 +339,14 @@ function search_view($keys) {
$output .= "<br />". $help_link ."<br />";
}
- // Log the search keys:
- watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys)));
+ // Only perform search if there is non-whitespace search term:
+ if (trim($keys)) {
+ // Log the search keys:
+ watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys)));
- // Collect the search results:
- $results = search_data($keys);
+ // Collect the search results:
+ $results = search_data($keys);
- if ($keys) {
if ($results) {
$output .= theme("box", t("Search Results"), $results);
}
diff --git a/modules/search/search.module b/modules/search/search.module
index dec843da3..790fcca77 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -339,13 +339,14 @@ function search_view($keys) {
$output .= "<br />". $help_link ."<br />";
}
- // Log the search keys:
- watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys)));
+ // Only perform search if there is non-whitespace search term:
+ if (trim($keys)) {
+ // Log the search keys:
+ watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys)));
- // Collect the search results:
- $results = search_data($keys);
+ // Collect the search results:
+ $results = search_data($keys);
- if ($keys) {
if ($results) {
$output .= theme("box", t("Search Results"), $results);
}