From 602845867210e0a65a074cb9df055ccaaea789a1 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 30 Sep 2004 19:46:27 +0000 Subject: [PATCH] * Remove useless, unvalidated charset option on raw page * Clean up input validation --- includes/RawPage.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/includes/RawPage.php b/includes/RawPage.php index 66a6305e2d..2a806d8886 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -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 { -- 2.20.1