(bug 20273) Undefined variable in Special:RandomPage. Fix this output entirely, build...
[lhc/web/wiklou.git] / includes / specials / SpecialRandompage.php
index af43e9c..ce2a8c0 100644 (file)
 class RandomPage extends SpecialPage {
        private $namespaces;  // namespaces to select pages from
 
-       function __construct( $name = 'Randompage' ){
+       public function __construct( $name = 'Randompage' ){
                global $wgContentNamespaces;
-
                $this->namespaces = $wgContentNamespaces;
-
                parent::__construct( $name );
        }
 
@@ -44,7 +42,8 @@ class RandomPage extends SpecialPage {
 
                if( is_null( $title ) ) {
                        $this->setHeaders();
-                       $wgOut->addWikiMsg( strtolower( $this->mName ) . '-nopages',  $wgContLang->getNsText( $this->namespace ) );
+                       $wgOut->addWikiMsg( strtolower( $this->mName ) . '-nopages', 
+                               $this->getNsList(), count( $this->namespaces ) );
                        return;
                }
 
@@ -52,6 +51,23 @@ class RandomPage extends SpecialPage {
                $wgOut->redirect( $title->getFullUrl( $query ) );
        }
 
+       /**
+        * Get a comma-delimited list of namespaces we don't have
+        * any pages in
+        * @return String
+        */
+       private function getNsList() {
+               global $wgContLang;
+               $nsNames = array();
+               foreach( $this->namespaces as $n ) {
+                       if( $n === NS_MAIN )
+                               $nsNames[] = wfMsgForContent( 'blanknamespace' );
+                       else
+                               $nsNames[] = $wgContLang->getNsText( $n );
+               }
+               return $wgContLang->commaList( $nsNames );
+       }
+
 
        /**
         * Choose a random title.