global $wgMaxCredits, $wgShowCreditsIfMax;
global $wgPageShowWatchingUsers;
global $wgUseTrackbacks, $wgUseSiteJs, $wgDebugComments;
- global $wgArticlePath, $wgScriptPath, $wgServer, $wgProfiler;
+ global $wgArticlePath, $wgScriptPath, $wgServer;
wfProfileIn( __METHOD__ );
- if ( is_object( $wgProfiler ) ) {
- $wgProfiler->setTemplated( true );
- }
+ Profiler::instance()->setTemplated( true );
$oldid = $wgRequest->getVal( 'oldid' );
$diff = $wgRequest->getVal( 'diff' );
/* set up the default links for the personal toolbar */
$personal_urls = array();
- $page = $wgRequest->getVal( 'returnto', $this->thisurl );
- $query = $wgRequest->getVal( 'returntoquery', $this->thisquery );
- $returnto = wfArrayToCGI( array( 'returnto' => $page ) );
- if( $this->thisquery != '' ) {
+
+ // Get the returnto and returntoquery parameters from the query string
+ // or fall back on $this->thisurl or $this->thisquery
+ // We can't use getVal()'s default value feature here because
+ // stuff from $wgRequest needs to be escaped, but thisurl and thisquery
+ // are already escaped.
+ $page = $wgRequest->getVal( 'returnto' );
+ if ( !is_null( $page ) ) {
+ $page = wfUrlencode( $page );
+ } else {
+ $page = $this->thisurl;
+ }
+ $query = $wgRequest->getVal( 'returntoquery' );
+ if ( !is_null( $query ) ) {
+ $query = wfUrlencode( $query );
+ } else {
+ $query = $this->thisquery;
+ }
+ $returnto = "returnto=$page";
+ if( $query != '' ) {
$returnto .= "&returntoquery=$query";
}
if( $this->loggedin ) {
# contain the original alias-with-subpage.
$origTitle = Title::newFromText( $wgRequest->getText( 'title' ) );
if( $origTitle instanceof Title && $origTitle->getNamespace() == NS_SPECIAL ) {
- list( $spName, $spPar ) =
- SpecialPage::resolveAliasWithSubpage( $origTitle->getText() );
+ list( $spName, $spPar ) = SpecialPageFactory::resolveAlias( $origTitle->getText() );
$active = $spName == 'Contributions'
&& ( ( $spPar && $spPar == $this->username )
|| $wgRequest->getText( 'target' ) == $this->username );