If asked to 'go' to a special: page title, jump directly there. Fix encoding of searc...
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 11 Apr 2004 05:28:11 +0000 (05:28 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 11 Apr 2004 05:28:11 +0000 (05:28 +0000)
includes/SearchEngine.php

index dd512e9..d9dd183 100644 (file)
@@ -145,11 +145,11 @@ class SearchEngine {
        # Perform the search and construct the results page
        function showResults()
        {
-               global $wgUser, $wgTitle, $wgOut, $wgLang, $wgDisableTextSearch;
-               global $wgInputEncoding;
+               global $wgUser, $wgTitle, $wgOut, $wgLang, $wgRequest;
+               global $wgDisableTextSearch, $wgInputEncoding;
                $fname = "SearchEngine::showResults";
 
-               $search = $_REQUEST['search'];
+               $search = $wgRequest->getText( 'search' );
 
                $powersearch = $this->powersearch(); /* Need side-effects here? */
 
@@ -418,10 +418,11 @@ class SearchEngine {
 
        function goResult()
        {
-               global $wgOut, $wgDisableTextSearch;
+               global $wgOut, $wgRequest;
+               global $wgDisableTextSearch;
                $fname = "SearchEngine::goResult";
                
-               $search         = $_REQUEST['search'];
+               $search = $wgRequest->getText( "search" );
 
                # First try to go to page as entered.
                #
@@ -433,7 +434,8 @@ class SearchEngine {
                        return;
                }
 
-               if ( 0 != $t->getArticleID() ) {
+               # Exact match? No need to look further.
+               if ( $t->getNamespace() == NS_SPECIAL || 0 != $t->getArticleID() ) {
                        $wgOut->redirect( $t->getFullURL() );
                        return;
                }