Merge "Change message on Special:Wantedfiles based on if foreign repo on."
[lhc/web/wiklou.git] / includes / specials / SpecialSearch.php
index 13591aa..15a7b59 100644 (file)
@@ -114,7 +114,7 @@ class SpecialSearch extends SpecialPage {
         */
        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();
@@ -207,8 +207,7 @@ class SpecialSearch extends SpecialPage {
 
                $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;
@@ -352,7 +351,7 @@ class SpecialSearch extends SpecialPage {
                                        $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 ) );
@@ -551,11 +550,9 @@ class SpecialSearch extends SpecialPage {
 
                $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";
 
@@ -717,7 +714,7 @@ class SpecialSearch extends SpecialPage {
                                                $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>' .
@@ -896,9 +893,7 @@ class SpecialSearch extends SpecialPage {
                        }
 
                        $rows[$subject] .=
-                               Xml::openElement(
-                                       'td', array( 'style' => 'white-space: nowrap' )
-                               ) .
+                               Xml::openElement( 'td' ) .
                                Xml::checkLabel(
                                        $name,
                                        "ns{$namespace}",
@@ -956,10 +951,7 @@ class SpecialSearch extends SpecialPage {
                }
 
                // 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' ) ) .
@@ -1104,7 +1096,8 @@ class SpecialSearch extends SpecialPage {
                                ->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' ), '', false );
                }
 
                return $out . $this->didYouMeanHtml;