summaryrefslogtreecommitdiff
path: root/modules/search
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2007-03-27 05:13:55 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2007-03-27 05:13:55 +0000
commitf7440d4d73ec57219af232c135be3b2567dda45f (patch)
treea6b7d947eda1c7bfc2197bfb584f7b17143c97a5 /modules/search
parentf2ca29071fe33603cf22f1603a3e6a61ee9c0814 (diff)
downloadbrdo-f7440d4d73ec57219af232c135be3b2567dda45f.tar.gz
brdo-f7440d4d73ec57219af232c135be3b2567dda45f.tar.bz2
#130971: Kitchen sink (E_NOTICE compliance / Code style / Bugfix in book toc)
Diffstat (limited to 'modules/search')
-rw-r--r--modules/search/search.module17
1 files changed, 10 insertions, 7 deletions
diff --git a/modules/search/search.module b/modules/search/search.module
index 177793015..9f5419f78 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -515,7 +515,7 @@ function search_index($sid, $type, $text) {
}
}
else {
- if ($tagstack[0] == $tagname) {
+ if (isset($tagstack[0]) && $tagstack[0] == $tagname) {
// None of the tags we look for make sense when nested identically.
// If they are, it's probably broken HTML.
$tagstack = array();
@@ -575,6 +575,9 @@ function search_index($sid, $type, $text) {
$results[$linknid][$word] += $score * $focus;
}
else {
+ if (!isset($results[0][$word])) {
+ $results[0][$word] = 0;
+ }
$results[0][$word] += $score * $focus;
// Focus is a decaying value in terms of the amount of unique words up to this point.
// From 100 words and more, it decays, to e.g. 0.5 at 500 words and 0.3 at 1000 words.
@@ -933,7 +936,7 @@ function search_view($type = 'node') {
return $output;
}
- return drupal_get_form('search_form', NULL, $keys, $type);
+ return drupal_get_form('search_form', NULL, empty($keys) ? array() : $keys, $type);
}
/**
@@ -1240,19 +1243,19 @@ function _search_excerpt_replace(&$text) {
function theme_search_item($item, $type) {
$output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';
$info = array();
- if ($item['type']) {
+ if (!empty($item['type'])) {
$info[] = $item['type'];
}
- if ($item['user']) {
+ if (!empty($item['user'])) {
$info[] = $item['user'];
}
- if ($item['date']) {
+ if (!empty($item['date'])) {
$info[] = format_date($item['date'], 'small');
}
- if (is_array($item['extra'])) {
+ if (isset($item['extra']) && is_array($item['extra'])) {
$info = array_merge($info, $item['extra']);
}
- $output .= ' <dd>'. ($item['snippet'] ? '<p>'. $item['snippet'] . '</p>' : '') . '<p class="search-info">' . implode(' - ', $info) .'</p></dd>';
+ $output .= ' <dd>'. (!empty($item['snippet']) ? '<p>'. $item['snippet'] . '</p>' : '') . '<p class="search-info">' . implode(' - ', $info) .'</p></dd>';
return $output;
}