*/
public function load() {
$request = $this->getRequest();
- list( $this->limit, $this->offset ) = $request->getLimitOffset( 20 );
+ list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, '' );
$this->mPrefix = $request->getVal( 'prefix', '' );
$user = $this->getUser();
$profile = new ProfileSection( __METHOD__ );
$search = $this->getSearchEngine();
- // Request an extra result to determine whether a "next page" link is useful
- $search->setLimitOffset( $this->limit + 1, $this->offset );
+ $search->setLimitOffset( $this->limit, $this->offset );
$search->setNamespaces( $this->namespaces );
$this->saveNamespaces();
$search->prefix = $this->mPrefix;
$this->offset,
$this->limit,
$this->powerSearchOptions() + array( 'search' => $term ),
- max( $titleMatchesNum, $textMatchesNum ) <= $this->limit
+ $this->limit + $this->offset >= $totalRes
);
}
wfRunHooks( 'SpecialSearchResults', array( $term, &$titleMatches, &$textMatches ) );
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.
$out = "<ul class='mw-search-results'>\n";
$result = $matches->next();
- $count = 0;
- while ( $result && $count < $this->limit ) {
+ while ( $result ) {
$out .= $this->showHit( $result, $terms );
$result = $matches->next();
- $count++;
}
$out .= "</ul>\n";
$thumb->toHtml( array( 'desc-link' => true ) ) .
'</td>' .
'<td style="vertical-align: top;">' .
- "{$link} {$fileMatch}" .
+ "{$link} {$redirect} {$section} {$fileMatch}" .
$extract .
"<div class='mw-search-result-data'>{$score}{$desc} - {$date}{$related}</div>" .
'</td>' .
}
$rows[$subject] .=
- Xml::openElement(
- 'td', array( 'style' => 'white-space: nowrap' )
- ) .
+ Xml::openElement( 'td' ) .
Xml::checkLabel(
$name,
"ns{$namespace}",
$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',
}
// Return final output
- return Xml::openElement(
- 'fieldset',
- array( 'id' => 'mw-searchoptions', 'style' => 'margin:0em;' )
- ) .
+ return Xml::openElement( 'fieldset', array( 'id' => 'mw-searchoptions' ) ) .
Xml::element( 'legend', null, $this->msg( 'powersearch-legend' )->text() ) .
Xml::tags( 'h4', null, $this->msg( 'powersearch-ns' )->parse() ) .
Html::element( 'div', array( 'id' => 'mw-search-togglebox' ) ) .
->params( wfEscapeWikiText( $term ) )
->numParams( $resultsShown )
->parse();
- $out .= Xml::tags( 'div', array( 'class' => 'results-info' ), $top );
+ $out .= Xml::tags( 'div', array( 'class' => 'results-info' ), $top ) .
+ Xml::element( 'div', array( 'style' => 'clear:both' ) );
}
return $out . $this->didYouMeanHtml;