Localisation updates for core and extension messages from translatewiki.net
[lhc/web/wiklou.git] / includes / RawPage.php
index c722c1c..6a552a5 100644 (file)
@@ -23,12 +23,12 @@ class RawPage {
        var $mSmaxage, $mMaxage;
        var $mContentType, $mExpandTemplates;
 
-       function __construct( Article $article, $request = false ) {
+       function __construct( Page $article, $request = false ) {
                global $wgRequest, $wgSquidMaxage, $wgJsMimeType, $wgGroupPermissions;
 
                $allowedCTypes = array( 'text/x-wiki', $wgJsMimeType, 'text/css', 'application/x-zope-edit' );
                $this->mArticle = $article;
-               $this->mTitle = $article->mTitle;
+               $this->mTitle = $article->getTitle();
 
                if( $request === false ) {
                        $this->mRequest = $wgRequest;
@@ -60,7 +60,7 @@ class RawPage {
                                if( !$oldid ) {
                                        # get the current revision so we can get the penultimate one
                                        $this->mArticle->getTouched();
-                                       $oldid = $this->mArticle->mLatest;
+                                       $oldid = $this->mArticle->getLatest();
                                }
                                $prev = $this->mTitle->getPreviousRevisionId( $oldid );
                                $oldid = $prev ? $prev : -1 ;
@@ -118,22 +118,8 @@ class RawPage {
        function view() {
                global $wgOut, $wgRequest;
 
-               if( $wgRequest->isPathInfoBad() ) {
-                       # Internet Explorer will ignore the Content-Type header if it
-                       # thinks it sees a file extension it recognizes. Make sure that
-                       # all raw requests are done through the script node, which will
-                       # have eg '.php' and should remain safe.
-                       #
-                       # We used to redirect to a canonical-form URL as a general
-                       # backwards-compatibility / good-citizen nice thing. However
-                       # a lot of servers are set up in buggy ways, resulting in
-                       # redirect loops which hang the browser until the CSS load
-                       # times out.
-                       #
-                       # Just return a 403 Forbidden and get it over with.
-                       wfHttpError( 403, 'Forbidden',
-                               'Invalid file extension found in PATH_INFO or QUERY_STRING. ' .
-                               'Raw pages must be accessed through the primary script entry point.' );
+               if( !$wgRequest->checkUrlExtension() ) {
+                       $wgOut->disable();
                        return;
                }
 
@@ -165,7 +151,7 @@ class RawPage {
        }
 
        function getRawText() {
-               global $wgUser, $wgOut;
+               global $wgOut, $wgUser;
                if( $this->mGen ) {
                        $sk = $wgUser->getSkin();
                        if( !StubObject::isRealObject( $wgOut ) ) {
@@ -174,7 +160,7 @@ class RawPage {
                        $sk->initPage( $wgOut );
                        if( $this->mGen == 'css' ) {
                                return $sk->generateUserStylesheet();
-                       } else if( $this->mGen == 'js' ) {
+                       } elseif( $this->mGen == 'js' ) {
                                return $sk->generateUserJs();
                        }
                } else {
@@ -223,6 +209,10 @@ class RawPage {
                return $this->parseArticleText( $text );
        }
 
+       /**
+        * @param $text
+        * @return string
+        */
        function parseArticleText( $text ) {
                if( $text === '' ) {
                        return '';