From: Antoine Musso Date: Thu, 11 Aug 2005 05:28:48 +0000 (+0000) Subject: Fix #710: redirect to category pages got an empty category list. X-Git-Tag: 1.6.0~2029 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=7b007ab37cbbf4ba74d7bfda9aabaec75cb0c855;p=lhc%2Fweb%2Fwiklou.git Fix #710: redirect to category pages got an empty category list. TODO: redirect to image pages doesn't show the image. --- diff --git a/index.php b/index.php index 196bf89fe6..3ad6f783ba 100644 --- a/index.php +++ b/index.php @@ -143,14 +143,28 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) { } $ns = $wgTitle->getNamespace(); + + // Namespace might change when using redirects + if($action == 'view') { + $wgArticle = new Article( $wgTitle ); + $rTitle = Title::newFromRedirect( $wgArticle->fetchContent() ); + if($rTitle) { + if( $rTitle->getNamespace() == $ns ) { + $wgArticle->mContentLoaded=false; + } + $ns = $rTitle->getNamespace(); + } + } + + // Categories and images are handled by a different class if ( $ns == NS_IMAGE ) { + unset($wgArticle); require_once( 'includes/ImagePage.php' ); $wgArticle = new ImagePage( $wgTitle ); } elseif ( $wgUseCategoryMagic && $ns == NS_CATEGORY ) { + unset($wgArticle); require_once( 'includes/CategoryPage.php' ); $wgArticle = new CategoryPage( $wgTitle ); - } else { - $wgArticle = new Article( $wgTitle ); } if ( in_array( $action, $wgDisabledActions ) ) {