* Use WebRequest::getInt()
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 14 Aug 2004 08:57:51 +0000 (08:57 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 14 Aug 2004 08:57:51 +0000 (08:57 +0000)
* Check that the namespace actually exists before trying to use it

includes/SpecialAllpages.php

index e2a2893..8841e2b 100644 (file)
@@ -6,10 +6,12 @@ function wfSpecialAllpages( $par=NULL )
        $indexMaxperpage = 480;
        $toplevelMaxperpage = 50;
        $from = $wgRequest->getVal( 'from' );
-       $namespace = $wgRequest->getVal( 'namespace' );
-       if ( is_null($namespace) ) { $namespace = 0; }
-       $arr = $wgLang->getNamespaces();
-       $wgOut->setPagetitle ( $namespace > 0 ? wfMsg ( 'allpagesnamespace', $arr[$namespace] )
+       $namespace = $wgRequest->getInt( 'namespace' );
+       $names = $wgLang->getNamespaces();
+       if( !isset( $names[$namespace] ) ) {
+               $namespace = 0;
+       }
+       $wgOut->setPagetitle ( $namespace > 0 ? wfMsg ( 'allpagesnamespace', $names[$namespace] )
                                              : wfMsg ( 'allarticles' ) );
 
        if ( $par ) {