Clean up after r14751:
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 13 Jun 2006 18:35:11 +0000 (18:35 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 13 Jun 2006 18:35:11 +0000 (18:35 +0000)
* No longer spews "uninitialized variable" notice all over output during category preview
* Don't alter global configuration variables when there's no reason to
Note that __NOGALLERY__ still isn't respected on preview (was this even tested?)

includes/CategoryPage.php
includes/OutputPage.php

index a27e6cd..0c4b85c 100644 (file)
@@ -41,11 +41,7 @@ class CategoryPage extends Article {
                $from = $wgRequest->getVal( 'from' );
                $until = $wgRequest->getVal( 'until' );
                
-               global $wgCategoryMagicGallery;
-               $cmg = $wgCategoryMagicGallery;
-               $wgCategoryMagicGallery = !$wgOut->mNoGallery;
                $wgOut->addHTML( $this->doCategoryMagic( $from, $until ) );
-               $wgCategoryMagicGallery = $cmg;
        }
 
        /**
@@ -57,6 +53,7 @@ class CategoryPage extends Article {
         * @private
         */
        function doCategoryMagic( $from = '', $until = '' ) {
+               global $wgOut;
                global $wgContLang,$wgUser, $wgCategoryMagicGallery, $wgCategoryPagingLimit;
                $fname = 'CategoryPage::doCategoryMagic';
                wfProfileIn( $fname );
@@ -65,7 +62,9 @@ class CategoryPage extends Article {
                $articles_start_char = array();
                $children = array();
                $children_start_char = array();
-               if( $wgCategoryMagicGallery ) {
+               
+               $showGallery = $wgCategoryMagicGallery && !$wgOut->mNoGallery;
+               if( $showGallery ) {
                        $ig = new ImageGallery();
                }
 
@@ -122,7 +121,7 @@ class CategoryPage extends Article {
                                        $sortkey=$wgContLang->firstChar( $x->cl_sortkey );
                                }
                                array_push( $children_start_char, $wgContLang->convert( $sortkey ) ) ;
-                       } elseif( $wgCategoryMagicGallery && $title->getNamespace() == NS_IMAGE ) {
+                       } elseif( $showGallery && $title->getNamespace() == NS_IMAGE ) {
                                // Show thumbnails of categorized images, in a separate chunk
                                if( $flip ) {
                                        $ig->insert( Image::newFromTitle( $title ) );
@@ -164,7 +163,7 @@ class CategoryPage extends Article {
                $r .= wfMsgExt( 'categoryarticlecount', array( 'parse' ), count( $articles) );
                $r .= $this->formatList( $articles, $articles_start_char );
 
-               if( $wgCategoryMagicGallery && ! $ig->isEmpty() ) {
+               if( $showGallery && ! $ig->isEmpty() ) {
                        $r.= $ig->toHTML();
                }
 
index 0dd8526..69e8521 100644 (file)
@@ -28,6 +28,7 @@ class OutputPage {
        var $mArticleBodyOnly = false;
        
        var $mNewSectionLink = false;
+       var $mNoGallery = false;
 
        /**
         * Constructor