/// should be private. To include the variable {{REVISIONID}}
var $mRevisionId = null;
+ private $mRevisionTimestamp = null;
var $mFileVersion = null;
return $this->mRevisionId;
}
+ /**
+ * Set the timestamp of the revision which will be displayed. This is used
+ * to avoid a extra DB call in Skin::lastModified().
+ *
+ * @param $revid Mixed: string, or null
+ * @return Mixed: previous value
+ */
+ public function setRevisionTimestamp( $timestmap ) {
+ return wfSetVar( $this->mRevisionTimestamp, $timestmap );
+ }
+
+ /**
+ * Get the timestamp of displayed revision.
+ * This will be null if not filled by setRevisionTimestamp().
+ *
+ * @return String or null
+ */
+ public function getRevisionTimestamp() {
+ return $this->mRevisionTimestamp;
+ }
+
/**
* Set the displayed file version
*
if ( $this->mRedirect != '' ) {
# Standards require redirect URLs to be absolute
$this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT );
- if( $this->mRedirectCode == '301' || $this->mRedirectCode == '303' ) {
- if( !$wgDebugRedirects ) {
- $message = HttpStatus::getMessage( $this->mRedirectCode );
- $response->header( "HTTP/1.1 {$this->mRedirectCode} $message" );
+
+ $redirect = $this->mRedirect;
+ $code = $this->mRedirectCode;
+
+ if( wfRunHooks( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) {
+ if( $code == '301' || $code == '303' ) {
+ if( !$wgDebugRedirects ) {
+ $message = HttpStatus::getMessage( $code );
+ $response->header( "HTTP/1.1 $code $message" );
+ }
+ $this->mLastModified = wfTimestamp( TS_RFC2822 );
+ }
+ if ( $wgVaryOnXFP ) {
+ $this->addVaryHeader( 'X-Forwarded-Proto' );
+ }
+ $this->sendCacheControl();
+
+ $response->header( "Content-Type: text/html; charset=utf-8" );
+ if( $wgDebugRedirects ) {
+ $url = htmlspecialchars( $redirect );
+ print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
+ print "<p>Location: <a href=\"$url\">$url</a></p>\n";
+ print "</body>\n</html>\n";
+ } else {
+ $response->header( 'Location: ' . $redirect );
}
- $this->mLastModified = wfTimestamp( TS_RFC2822 );
- }
- if ( $wgVaryOnXFP ) {
- $this->addVaryHeader( 'X-Forwarded-Proto' );
- }
- $this->sendCacheControl();
-
- $response->header( "Content-Type: text/html; charset=utf-8" );
- if( $wgDebugRedirects ) {
- $url = htmlspecialchars( $this->mRedirect );
- print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
- print "<p>Location: <a href=\"$url\">$url</a></p>\n";
- print "</body>\n</html>\n";
- } else {
- $response->header( 'Location: ' . $this->mRedirect );
}
+
wfProfileOut( __METHOD__ );
return;
} elseif ( $this->mStatusCode ) {
# Don't return to a page the user can't read otherwise
# we'll end up in a pointless loop
- if ( $displayReturnto && $displayReturnto->userCanRead() ) {
+ if ( $displayReturnto && $displayReturnto->userCan( 'read', $this->getUser() ) ) {
$this->returnToMain( null, $displayReturnto );
}
} else {
'cols' => $this->getUser()->getOption( 'cols' ),
'rows' => $this->getUser()->getOption( 'rows' ),
'readonly' => 'readonly',
- 'lang' => $pageLang->getCode(),
+ 'lang' => $pageLang->getHtmlCode(),
'dir' => $pageLang->getDir(),
);
$this->addHTML( Html::element( 'textarea', $params, $source ) );
$this->addModuleStyles( 'mediawiki.legacy.wikiprintable' );
}
- $ret = Html::htmlHeader( array( 'lang' => $this->getLanguage()->getCode(), 'dir' => $userdir, 'class' => 'client-nojs' ) );
+ $ret = Html::htmlHeader( array( 'lang' => $this->getLanguage()->getHtmlCode(), 'dir' => $userdir, 'class' => 'client-nojs' ) );
if ( $this->getHTMLTitle() == '' ) {
$this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() ) );
$tags[] = Html::element( 'link', array(
'rel' => 'alternate',
'hreflang' => $_v,
- 'href' => $this->getTitle()->getLocalURL( '', $_v ) )
+ 'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
);
}
} else {
);
}
} elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
+ $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
foreach ( $wgAdvertisedFeedTypes as $format ) {
$tags[] = $this->feedLink(
$format,
- $this->getTitle()->getLocalURL( "feed={$format}" ),
+ $rctitle->getLocalURL( "feed={$format}" ),
$this->msg( "site-{$format}-feed", $wgSitename )->text() # For grep: 'site-rss-feed', 'site-atom-feed'.
);
}
array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
);
// Load the previewed CSS
- $otherTags .= Html::inlineStyle( $this->getRequest()->getText( 'wpTextbox1' ) );
+ $this->addInlineStyle( $this->getRequest()->getText( 'wpTextbox1' ) );
} else {
// Load the user styles normally
$moduleStyles[] = 'user';