Revert more minor breakage from missing HTML escaping (broken June 24)
[lhc/web/wiklou.git] / index.php
index 27b7fb9..c9b09ad 100644 (file)
--- a/index.php
+++ b/index.php
@@ -69,7 +69,6 @@ OutputPage::setEncodings(); # Not really used yet
 $action = $wgRequest->getVal( 'action', 'view' );
 $title = $wgRequest->getVal( 'title' );
 
-$action = rtrim( $action );
 if ($wgRequest->getVal( 'printable' ) == 'yes') {
        $wgOut->setPrintable();
 }
@@ -144,14 +143,27 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
        }
 
        $ns = $wgTitle->getNamespace();
+
+       // Namespace might change when using redirects
+       if($action == 'view' && !$wgRequest->getVal( 'oldid' ) ) {
+               $wgArticle = new Article( $wgTitle );
+               $rTitle = Title::newFromRedirect( $wgArticle->fetchContent() );
+               if($rTitle) {
+                       # Reload from the page pointed to later
+                       $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 ) ) {
@@ -173,6 +185,7 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
                        case 'markpatrolled':
                        case 'validate':
                        case 'render':
+                       case 'deletetrackback':
                                $wgArticle->$action();
                                break;
                        case 'print':