fixed silly switch() use, much better handled with if..elseif..else
[lhc/web/wiklou.git] / index.php
index f22de25..2dade97 100644 (file)
--- 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 );
        }