Fixed namespace handling (will now accept English namespace names in addition to...
authorMagnus Manske <magnusmanske@users.mediawiki.org>
Thu, 4 May 2006 09:41:33 +0000 (09:41 +0000)
committerMagnus Manske <magnusmanske@users.mediawiki.org>
Thu, 4 May 2006 09:41:33 +0000 (09:41 +0000)
includes/SpecialRandompage.php

index cf6ecc0..9d38abc 100644 (file)
  *               used as e.g. Special:Randompage/Category
  */
 function wfSpecialRandompage( $par = NS_MAIN ) {
-       global $wgOut, $wgExtraRandompageSQL, $wgContLang;
+       global $wgOut, $wgExtraRandompageSQL, $wgContLang, $wgLang;
        $fname = 'wfSpecialRandompage';
 
-       # Determine the namespace to get a random page from.
-       $namespace = $wgContLang->getNsIndex($par);
-       if ($namespace === false || $namespace < NS_MAIN) {
-               $namespace = NS_MAIN;
-       }
+       # Determine namespace
+       $t = Title::newFromText ( $par . ":Dummy" ) ;
+       $namespace = $t->getNamespace () ;
 
        # NOTE! We use a literal constant in the SQL instead of the RAND()
        # function because RAND() will return a different value for every row