New function ShowingResultsNum for use in SearchEngine.
authorT.D. Corell <smurf-wiki@users.mediawiki.org>
Tue, 20 May 2003 06:15:20 +0000 (06:15 +0000)
committerT.D. Corell <smurf-wiki@users.mediawiki.org>
Tue, 20 May 2003 06:15:20 +0000 (06:15 +0000)
includes/GlobalFunctions.php
includes/SearchEngine.php

index 2879387..e2244c6 100644 (file)
@@ -448,6 +448,14 @@ function wfShowingResults( $offset, $limit )
        return $top;
 }
 
+function wfShowingResultsNum( $offset, $limit, $num )
+{
+       $top = str_replace( "$1", $limit, wfMsg( "showingresultsnum" ) );
+       $top = str_replace( "$2", $offset+1, $top );
+       $top = str_replace( "$3", $num, $top );
+       return $top;
+}
+
 function wfViewPrevNext( $offset, $limit, $link, $query = "" )
 {
        global $wgUser;
index 53be8f7..0a827eb 100644 (file)
@@ -152,6 +152,7 @@ class SearchEngine {
                  "AND {$searchnamespaces} {$redircond}" .
                  "LIMIT {$offset}, {$limit}";
                $res1 = wfQuery( $sql, $fname );
+               $num = wfNumRows($res1);
 
                if ( $wgDisableTextSearch ) {
                        $res2 = 0;
@@ -162,9 +163,14 @@ class SearchEngine {
                          "AND {$searchnamespaces} {$redircond} " .
                          "LIMIT {$offset}, {$limit}";
                        $res2 = wfQuery( $sql, $fname );
+                       $num = $num + wfNumRows($res2);
                }
 
-               $top = wfShowingResults( $offset, $limit );
+                if ( $num == $limit ) {
+                 $top = wfShowingResults( $offset, $limit);
+               } else {
+                 $top = wfShowingResultsNum( $offset, $limit, $num );
+               }
                $wgOut->addHTML( "<p>{$top}\n" );
 
                # For powersearch