+
+ if ( $request === false ) {
+ $this->mRequest =& $wgRequest;
+ } else {
+ $this->mRequest = $request;
+ }
+
+ $ctype = $this->mRequest->getVal( 'ctype' );
+ $smaxage = $this->mRequest->getIntOrNull( 'smaxage', $wgSquidMaxage );
+ $maxage = $this->mRequest->getInt( 'maxage', $wgSquidMaxage );
+
+ $this->mExpandTemplates = $this->mRequest->getVal( 'templates' ) === 'expand';
+ $this->mUseMessageCache = $this->mRequest->getBool( 'usemsgcache' );
+
+ $this->mSection = $this->mRequest->getIntOrNull( 'section' );
+
+ $oldid = $this->mRequest->getInt( 'oldid' );
+
+ switch ( $wgRequest->getText( 'direction' ) ) {
+ case 'next':
+ # output next revision, or nothing if there isn't one
+ if ( $oldid ) {
+ $oldid = $this->mTitle->getNextRevisionId( $oldid );
+ }
+ $oldid = $oldid ? $oldid : -1;
+ break;
+ case 'prev':
+ # output previous revision, or nothing if there isn't one
+ if ( ! $oldid ) {
+ # get the current revision so we can get the penultimate one
+ $this->mArticle->getTouched();
+ $oldid = $this->mArticle->mLatest;
+ }
+ $prev = $this->mTitle->getPreviousRevisionId( $oldid );
+ $oldid = $prev ? $prev : -1 ;
+ break;
+ case 'cur':
+ $oldid = 0;
+ break;
+ }
+ $this->mOldId = $oldid;
+
+ # special case for 'generated' raw things: user css/js
+ $gen = $this->mRequest->getVal( 'gen' );
+
+ if($gen == 'css') {
+ $this->mGen = $gen;
+ if( is_null( $smaxage ) ) $smaxage = $wgSquidMaxage;
+ if($ctype == '') $ctype = 'text/css';
+ } elseif ($gen == 'js') {
+ $this->mGen = $gen;
+ if( is_null( $smaxage ) ) $smaxage = $wgSquidMaxage;
+ if($ctype == '') $ctype = $wgJsMimeType;
+ } else {
+ $this->mGen = false;
+ }
+ $this->mCharset = $wgInputEncoding;
+
+ # Force caching for CSS and JS raw content, default: 5 minutes
+ if (is_null($smaxage) and ($ctype=='text/css' or $ctype==$wgJsMimeType)) {
+ $this->mSmaxage = intval($wgForcedRawSMaxage);
+ } else {
+ $this->mSmaxage = intval( $smaxage );
+ }
+ $this->mMaxage = $maxage;
+
+ # Output may contain user-specific data;
+ # vary generated content for open sessions and private wikis
+ if ($this->mGen or !$wgGroupPermissions['*']['read']) {
+ $this->mPrivateCache = ( $this->mSmaxage == 0 ) ||
+ ( session_id() != '' );
+ } else {
+ $this->mPrivateCache = false;
+ }
+
+ if ( $ctype == '' or ! in_array( $ctype, $allowedCTypes ) ) {
+ $this->mContentType = 'text/x-wiki';
+ } else {
+ $this->mContentType = $ctype;
+ }