From: Tim Starling Date: Sat, 28 May 2005 06:52:55 +0000 (+0000) Subject: fixed silly switch() use, much better handled with if..elseif..else X-Git-Tag: 1.5.0alpha2~77 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=ce5b29ff095d6f42f73264b5039fd6b6ec0eaee9;p=lhc%2Fweb%2Fwiklou.git fixed silly switch() use, much better handled with if..elseif..else --- diff --git a/index.php b/index.php index f22de25ff0..2dade97059 100644 --- a/index.php +++ b/index.php @@ -141,20 +141,14 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) { $wgTitle = Title::makeTitle( NS_IMAGE, $wgTitle->getDBkey() ); } - switch( $wgTitle->getNamespace() ) { - case NS_IMAGE: + $ns = $wgTitle->getNamespace(); + if ( $ns == NS_IMAGE ) { require_once( 'includes/ImagePage.php' ); $wgArticle = new ImagePage( $wgTitle ); - break; - case NS_CATEGORY: - if ( $wgUseCategoryMagic ) { - require_once( 'includes/CategoryPage.php' ); - $wgArticle = new CategoryPage( $wgTitle ); - break; - } - # NO break if wgUseCategoryMagic is false, drop through to next (default). - # Don't insert other cases between NS_CATEGORY and default. - default: + } elseif ( $wgUseCategoryMagic && $ns == NS_CATEGORY ) { + require_once( 'includes/CategoryPage.php' ); + $wgArticle = new CategoryPage( $wgTitle ); + } else { $wgArticle = new Article( $wgTitle ); }