X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialSearch.php;h=b3a58cbd91d2fc59c9be25b26f4ad17a32ccf649;hb=5af3ad33ed1b27bd5f77038c89844d513d078cba;hp=e5adeb53b4f4c83a1576d210f563db26297d857d;hpb=43a548a5c3436b5d07091b504bbf5eb80d1ed215;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index e5adeb53b4..b3a58cbd91 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -352,7 +352,7 @@ class SpecialSearch extends SpecialPage { $out->addHTML( $dymWidget->render( $term, $textMatches ) ); } - $hasErrors = $textStatus && $textStatus->getErrors(); + $hasErrors = $textStatus && $textStatus->getErrors() !== []; $hasOtherResults = $textMatches && $textMatches->hasInterwikiResults( SearchResultSet::INLINE_RESULTS ); @@ -365,16 +365,12 @@ class SpecialSearch extends SpecialPage { if ( $hasErrors ) { list( $error, $warning ) = $textStatus->splitByErrorType(); if ( $error->getErrors() ) { - $out->addHTML( Html::rawElement( - 'div', - [ 'class' => 'errorbox' ], + $out->addHTML( Html::errorBox( $error->getHTML( 'search-error' ) ) ); } if ( $warning->getErrors() ) { - $out->addHTML( Html::rawElement( - 'div', - [ 'class' => 'warningbox' ], + $out->addHTML( Html::warningBox( $warning->getHTML( 'search-warning' ) ) ); } @@ -435,9 +431,17 @@ class SpecialSearch extends SpecialPage { // prev/next links if ( $totalRes > $this->limit || $this->offset ) { + // Allow matches to define the correct offset, as interleaved + // AB testing may require a different next page offset. + if ( $textMatches && $textMatches->getOffset() !== null ) { + $offset = $textMatches->getOffset(); + } else { + $offset = $this->offset; + } + $prevnext = $this->getLanguage()->viewPrevNext( $this->getPageTitle(), - $this->offset, + $offset, $this->limit, $this->powerSearchOptions() + [ 'search' => $term ], $this->limit + $this->offset >= $totalRes @@ -521,7 +525,7 @@ class SpecialSearch extends SpecialPage { if ( strval( $term ) !== '' ) { $out->setPageTitle( $this->msg( 'searchresults' ) ); $out->setHTMLTitle( $this->msg( 'pagetitle' ) - ->rawParams( $this->msg( 'searchresults-title' )->rawParams( $term )->text() ) + ->plaintextParams( $this->msg( 'searchresults-title' )->plaintextParams( $term )->text() ) ->inContentLanguage()->text() ); } @@ -547,7 +551,7 @@ class SpecialSearch extends SpecialPage { * Extract "power search" namespace settings from the request object, * returning a list of index numbers to search. * - * @param WebRequest $request + * @param WebRequest &$request * @return array */ protected function powerSearch( &$request ) {