From 2f3f8433fbdabf1047b26bbeaae89b9e196fecb5 Mon Sep 17 00:00:00 2001 From: "T.D. Corell" Date: Tue, 20 May 2003 06:15:20 +0000 Subject: [PATCH] New function ShowingResultsNum for use in SearchEngine. --- includes/GlobalFunctions.php | 8 ++++++++ includes/SearchEngine.php | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 287938738d..e2244c6fc1 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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; diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index 53be8f7eaf..0a827eb2fe 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -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( "

{$top}\n" ); # For powersearch -- 2.20.1