From 74dbd01ed066702c74a64248c40ea12bcf3f774a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 13 Jun 2006 18:35:11 +0000 Subject: [PATCH] Clean up after r14751: * 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 | 13 ++++++------- includes/OutputPage.php | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index a27e6cd7b5..0c4b85c3c5 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -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(); } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 0dd85267c6..69e8521292 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -28,6 +28,7 @@ class OutputPage { var $mArticleBodyOnly = false; var $mNewSectionLink = false; + var $mNoGallery = false; /** * Constructor -- 2.20.1