* Remove useless, unvalidated charset option on raw page
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 30 Sep 2004 19:46:27 +0000 (19:46 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 30 Sep 2004 19:46:27 +0000 (19:46 +0000)
* Clean up input validation

includes/RawPage.php

index 66a6305..2a806d8 100644 (file)
@@ -23,9 +23,8 @@ class RawPage {
                $this->mTitle =& $article->mTitle;
                        
                $ctype = $wgRequest->getText( 'ctype' );
-               $charset = $wgRequest->getText( 'charset' );
-               $smaxage = $wgRequest->getText( 'smaxage' );
-               $maxage = $wgRequest->getText( 'maxage' );
+               $smaxage = $wgRequest->getInt( 'smaxage', $wgSquidMaxage );
+               $maxage = $wgRequest->getInt( 'maxage', $wgSquidMaxage );
                $this->mOldId = $wgRequest->getInt( 'oldid' );
                # special case for 'generated' raw things: user css/js
                $gen = $wgRequest->getText( 'gen' );
@@ -40,9 +39,9 @@ class RawPage {
                } else {
                        $this->mGen = false;
                }
-               $this->mCharset = !empty($charset) ? $charset : $wgInputEncoding;
-               $this->mSmaxage = ($smaxage != '') ? $smaxage : 0;
-               $this->mMaxage = ($maxage != '') ? $maxage : 86400;
+               $this->mCharset = $wgInputEncoding;
+               $this->mSmaxage = $smaxage;
+               $this->mMaxage = $maxage;
                if(empty($ctype) or !in_array($ctype, $allowedCTypes)) {
                        $this->mContentType = 'text/x-wiki';
                } else {
@@ -82,8 +81,6 @@ class RawPage {
                # special case
                if($ns == NS_MEDIAWIKI) {
                        $rawtext = wfMsg($t);
-                       if($wgInputEncoding != $this->mCharset)
-                       $rawtext = $wgContLang->iconv( $wgInputEncoding, $this->mCharset, $rawtext );
                        return $rawtext;
                }
                # else get it from the DB
@@ -99,8 +96,6 @@ class RawPage {
                $res = $dbr->query( $sql, $fname );
                if( $s = $dbr->fetchObject( $res ) ) {
                        $rawtext = Article::getRevisionText( $s, "" );
-                       if($wgInputEncoding != $this->mCharset)
-                       $rawtext = $wgContLang->iconv( $wgInputEncoding, $this->mCharset, $rawtext );
                        header( 'Last-modified: '.gmdate( "D, j M Y H:i:s", wfTimestamp2Unix( $s->timestamp )).' GMT' );
                        return $rawtext;
                } else {