diff -r 32429702305e -r c72b545f1304 plugins/SpecialSearch.php --- a/plugins/SpecialSearch.php Fri Dec 21 19:08:27 2007 -0500 +++ b/plugins/SpecialSearch.php Wed Dec 26 00:37:26 2007 -0500 @@ -20,17 +20,17 @@ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. */ -$plugins->attachHook('base_classes_initted', ' +$plugins->attachHook('session_started', ' global $paths; $paths->add_page(Array( - \'name\'=>\'Rebuild search index\', + \'name\'=>\'specialpage_search_rebuild\', \'urlname\'=>\'SearchRebuild\', \'namespace\'=>\'Special\', \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', )); $paths->add_page(Array( - \'name\'=>\'Search\', + \'name\'=>\'specialpage_search\', \'urlname\'=>\'Search\', \'namespace\'=>\'Special\', \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', @@ -40,7 +40,10 @@ function page_Special_SearchRebuild() { global $db, $session, $paths, $template, $plugins; // Common objects - if(!$session->get_permissions('mod_misc')) die_friendly('Unauthorized', '

You need to be an administrator to rebuild the search index

'); + if ( !$session->get_permissions('mod_misc') ) + { + die_friendly('Unauthorized', '

You need to be an administrator to rebuild the search index

'); + } $template->header(); @set_time_limit(0); if($paths->rebuild_search_index(true)) @@ -54,6 +57,8 @@ { global $db, $session, $paths, $template, $plugins; // Common objects global $aggressive_optimize_html; + global $lang; + $aggressive_optimize_html = false; if ( !$q = $paths->getParam(0) ) @@ -95,7 +100,7 @@ $qin = ( isset($q) ) ? str_replace('"', '\"', htmlspecialchars($q)) : ''; $search_form = '
-   Advanced search +   ' . $lang->get('search_btn_advanced_search') . ' ' . ( $session->auth_level > USER_LEVEL_MEMBER ? '' : '' ) . '
'; @@ -103,7 +108,7 @@ { $search_start = microtime_float(); - $results = perform_search($q, $warn, ( isset($_GET['match_case']) )); + $results = perform_search($q, $warn, ( isset($_GET['match_case']) ), $word_list); $warn = array_unique($warn); if ( file_exists( ENANO_ROOT . '/themes/' . $template->theme . '/search-result.tpl' ) ) @@ -122,7 +127,7 @@ {PAGE_TEXT} {PAGE_URL} - {PAGE_LENGTH} {PAGE_LENGTH_UNIT} - - Relevance: {RELEVANCE_SCORE}% + {lang:search_lbl_relevance} {RELEVANCE_SCORE}%

@@ -138,22 +143,25 @@ if ( !empty($result['page_text']) ) $result['page_text'] .= '
'; $result['page_name'] = str_replace(array('', ''), array('', ''), $result['page_name']); + $result['url_highlight'] = str_replace(array('', ''), array('', ''), $result['url_highlight']); if ( $result['page_length'] >= 1048576 ) { $result['page_length'] = round($result['page_length'] / 1048576, 1); - $length_unit = 'MB'; + $length_unit = $lang->get('etc_unit_megabytes_short'); } else if ( $result['page_length'] >= 1024 ) { $result['page_length'] = round($result['page_length'] / 1024, 1); - $length_unit = 'KB'; + $length_unit = $lang->get('etc_unit_kilobytes_short'); } else { - $length_unit = 'bytes'; + $length_unit = $lang->get('etc_unit_bytes'); } - $url = makeUrlComplete($result['namespace'], $result['page_id']); - $url = preg_replace('/\?.+$/', '', $url); + //$url = makeUrlComplete($result['namespace'], $result['page_id']); + //$url = preg_replace('/\?.+$/', '', $url); + $url = $result['url_highlight']; + $parser->assign_vars(array( 'PAGE_TITLE' => $result['page_name'], 'PAGE_TEXT' => $result['page_text'], @@ -193,13 +201,20 @@ $q_trim = ( strlen($q) > 30 ) ? substr($q, 0, 27) . '...' : $q; $q_trim = htmlspecialchars($q_trim); - $result_string = ( count($results) > 0 ) ? "Results $start_string - $per_string of about $num_results for " . $q_trim . " in {$search_time}s." : 'No results.'; + $result_detail = $lang->get('search_msg_result_detail', array( + 'start_string' => $start_string, + 'per_string' => $per_string, + 'q_trim' => $q_trim, + 'num_results' => $num_results, + 'search_time' => $search_time + )); + $result_string = ( count($results) > 0 ) ? $result_detail : $lang->get('search_msg_no_results'); echo '
' . $result_string . '
- Site search + ' . $lang->get('search_lbl_site_search') . '
' . $search_form . ' @@ -208,8 +223,8 @@ if ( count($warn) > 0 ) { echo '
'; - echo 'Some problems were encountered during your search.
- There was a problem with your search query, and as a result there may be a reduced number of search results.'; + echo '' . $lang->get('search_err_query_title') . '
+ ' . $lang->get('search_err_query_body'); echo ''; echo '
'; } @@ -254,26 +269,26 @@ endif; ?>
- + - + - + - + - +
Advanced Search
get('search_th_advanced_search'); ?>
Search for pages with any of these words:get('search_lbl_field_any'); ?>
with this exact phrase:get('search_lbl_field_exact'); ?>
with none of these words:get('search_lbl_field_none'); ?>
with all of these words:get('search_lbl_field_all'); ?>
- + @@ -281,7 +296,7 @@
- +