- Fixed empty searches being performed.

- Fixed empty searches being logged.
- Trim whitespace from start and end of search key.
4.5.x
Kjartan Mannes 2004-05-30 21:04:07 +00:00
parent 5cd371578e
commit 2954836fba
2 changed files with 12 additions and 10 deletions

View File

@ -339,13 +339,14 @@ function search_view($keys) {
$output .= "<br />". $help_link ."<br />"; $output .= "<br />". $help_link ."<br />";
} }
// Log the search keys: // Only perform search if there is non-whitespace search term:
watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys))); if (trim($keys)) {
// Log the search keys:
watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys)));
// Collect the search results: // Collect the search results:
$results = search_data($keys); $results = search_data($keys);
if ($keys) {
if ($results) { if ($results) {
$output .= theme("box", t("Search Results"), $results); $output .= theme("box", t("Search Results"), $results);
} }

View File

@ -339,13 +339,14 @@ function search_view($keys) {
$output .= "<br />". $help_link ."<br />"; $output .= "<br />". $help_link ."<br />";
} }
// Log the search keys: // Only perform search if there is non-whitespace search term:
watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys))); if (trim($keys)) {
// Log the search keys:
watchdog("search", "search: '$keys'", l("view results", "search", NULL, "keys=". urlencode($keys)));
// Collect the search results: // Collect the search results:
$results = search_data($keys); $results = search_data($keys);
if ($keys) {
if ($results) { if ($results) {
$output .= theme("box", t("Search Results"), $results); $output .= theme("box", t("Search Results"), $results);
} }