From fcd0a41574e404866e5023a826976bb93e0503c5 Mon Sep 17 00:00:00 2001 From: Arne Heizmann Date: Fri, 13 Aug 2004 00:56:03 +0000 Subject: [PATCH] Allow an optional &namespace= parameter for Special:Allpages. Might need some UI. --- includes/SpecialAllpages.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/includes/SpecialAllpages.php b/includes/SpecialAllpages.php index 054385e122..177df3183b 100644 --- a/includes/SpecialAllpages.php +++ b/includes/SpecialAllpages.php @@ -5,11 +5,13 @@ function wfSpecialAllpages( $par=NULL ) global $indexMaxperpage, $wgRequest; $indexMaxperpage = 480; $from = $wgRequest->getVal( 'from' ); - + $namespace = $wgRequest->getVal( 'namespace' ); + if ( is_null($namespace) ) { $namespace = 0; } + if( $par ) { - indexShowChunk( $par ); + indexShowChunk( $par, $namespace ); } elseif( !is_null( $from ) ) { - indexShowChunk( $from ); + indexShowChunk( $from, $namespace ); } else { indexShowToplevel(); } @@ -30,7 +32,7 @@ function indexShowToplevel() $log->showAsDisabledPage(); return; } - + $dbr =& wfGetDB( DB_SLAVE ); $cur = $dbr->tableName( 'cur' ); $fromwhere = "FROM $cur WHERE cur_namespace=0"; @@ -41,7 +43,7 @@ function indexShowToplevel() $count = $dbr->selectField( 'cur', 'COUNT(*)', $where, $fname ); $sections = ceil( $count / $indexMaxperpage ); $inpoint = $dbr->selectField( 'cur', 'cur_title', $where, $fname, $order ); - + $out .= "\n"; # There's got to be a cleaner way to do this! for( $i = 1; $i < $sections; $i++ ) { @@ -91,16 +93,17 @@ function indexShowline( $inpoint, $outpoint ) return "\n"; } -function indexShowChunk( $from ) +function indexShowChunk( $from, $namespace = 0 ) { global $wgOut, $wgUser, $indexMaxperpage, $wgLang; $sk = $wgUser->getSkin(); $maxPlusOne = $indexMaxperpage + 1; + $namespacee = intval($namespace); $out = ""; $dbr =& wfGetDB( DB_SLAVE ); $cur = $dbr->tableName( 'cur' ); - $sql = "SELECT cur_title FROM $cur WHERE cur_namespace=0 AND cur_title >= '" + $sql = "SELECT cur_title FROM $cur WHERE cur_namespace=$namespacee AND cur_title >= '" . $dbr->strencode( $from ) . "' ORDER BY cur_title LIMIT " . $maxPlusOne; $res = $dbr->query( $sql, "indexShowChunk" ); @@ -109,7 +112,7 @@ function indexShowChunk( $from ) $n = 0; $out = "
{$out}
\n"; while( ($n < $indexMaxperpage) && ($s = $dbr->fetchObject( $res )) ) { - $t = Title::makeTitle( 0, $s->cur_title ); + $t = Title::makeTitle( $namespacee, $s->cur_title ); if( $t ) { $link = $sk->makeKnownLinkObj( $t ); } else { -- 2.20.1