Salt the "nsToken" used for Special:Search namespace remembering
[lhc/web/wiklou.git] / includes / specials / SpecialSearch.php
index 1cc5930..54e9987 100644 (file)
@@ -253,9 +253,7 @@ class SpecialSearch extends SpecialPage {
                $rewritten = $search->replacePrefixes( $term );
 
                $titleMatches = $search->searchTitle( $rewritten );
-               if ( !( $titleMatches instanceof SearchResultTooMany ) ) {
-                       $textMatches = $search->searchText( $rewritten );
-               }
+               $textMatches = $search->searchText( $rewritten );
 
                $textStatus = null;
                if ( $textMatches instanceof Status ) {
@@ -319,13 +317,6 @@ class SpecialSearch extends SpecialPage {
                        Xml::closeElement( 'div' )
                );
 
-               // Sometimes the search engine knows there are too many hits
-               if ( $titleMatches instanceof SearchResultTooMany ) {
-                       $out->wrapWikiMsg( "==$1==\n", 'toomanymatches' );
-
-                       return;
-               }
-
                $filePrefix = $wgContLang->getFormattedNsText( NS_FILE ) . ':';
                if ( trim( $term ) === '' || $filePrefix === trim( $term ) ) {
                        $out->addHTML( $this->formHeader( $term, 0, 0 ) );
@@ -535,7 +526,11 @@ class SpecialSearch extends SpecialPage {
 
                if ( $user->isLoggedIn() &&
                        !is_null( $request->getVal( 'nsRemember' ) ) &&
-                       $user->matchEditToken( $request->getVal( 'nsToken' ) )
+                       $user->matchEditToken(
+                               $request->getVal( 'nsToken' ),
+                               'searchnamespace',
+                               $request
+                       )
                ) {
                        // Reset namespace preferences: namespaces are not searched
                        // when they're not mentioned in the URL parameters.
@@ -979,7 +974,13 @@ class SpecialSearch extends SpecialPage {
                $remember = '';
                $user = $this->getUser();
                if ( $user->isLoggedIn() ) {
-                       $remember .= Html::hidden( 'nsToken', $user->getEditToken() ) .
+                       $remember .= Html::hidden(
+                               'nsToken',
+                               $user->getEditToken(
+                                       'searchnamespace',
+                                       $this->getRequest()
+                               )
+                       ) .
                        Xml::checkLabel(
                                wfMessage( 'powersearch-remember' )->text(),
                                'nsRemember',