From f7440d4d73ec57219af232c135be3b2567dda45f Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Tue, 27 Mar 2007 05:13:55 +0000 Subject: #130971: Kitchen sink (E_NOTICE compliance / Code style / Bugfix in book toc) --- modules/search/search.module | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'modules/search/search.module') 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 = '
'. check_plain($item['title']) .'
'; $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 .= '
'. ($item['snippet'] ? '

'. $item['snippet'] . '

' : '') . '

' . implode(' - ', $info) .'

'; + $output .= '
'. (!empty($item['snippet']) ? '

'. $item['snippet'] . '

' : '') . '

' . implode(' - ', $info) .'

'; return $output; } -- cgit v1.2.3