return $languageLinks;
}
+ /**
+ * @return QuickTemplate
+ */
protected function setupTemplateForOutput() {
$request = $this->getRequest();
$user = $this->getUser();
$tpl->set( 'credits', false );
$tpl->set( 'numberofwatchingusers', false );
if ( $title->exists() ) {
- if ( $out->isArticle() ) {
- if ( $this->isRevisionCurrent() ) {
- if ( $wgMaxCredits != 0 ) {
- $tpl->set( 'credits', Action::factory( 'credits', $this->getWikiPage(),
- $this->getContext() )->getCredits( $wgMaxCredits, $wgShowCreditsIfMax ) );
- } else {
- $tpl->set( 'lastmod', $this->lastModified() );
- }
+ if ( $out->isArticle() && $this->isRevisionCurrent() ) {
+ if ( $wgMaxCredits != 0 ) {
+ /** @var CreditsAction $action */
+ $action = Action::factory(
+ 'credits', $this->getWikiPage(), $this->getContext() );
+ $tpl->set( 'credits',
+ $action->getCredits( $wgMaxCredits, $wgShowCreditsIfMax ) );
+ } else {
+ $tpl->set( 'lastmod', $this->lastModified() );
}
}
if ( $out->showsCopyright() ) {
$html = '';
if ( $personalTools === null ) {
- $personalTools = $tpl->getPersonalTools();
+ $personalTools = ( $tpl instanceof BaseTemplate )
+ ? $tpl->getPersonalTools()
+ : [];
}
foreach ( $personalTools as $key => $item ) {
$tpl = $this->setupTemplateForOutput();
$tpl->set( 'personal_urls', $this->buildPersonalUrls() );
- return $tpl->getPersonalTools();
+ return ( $tpl instanceof BaseTemplate ) ? $tpl->getPersonalTools() : [];
}
/**
$page = Title::newFromText( $request->getVal( 'title', '' ) );
}
$page = $request->getVal( 'returnto', $page );
- $a = [];
+ $returnto = [];
if ( strval( $page ) !== '' ) {
- $a['returnto'] = $page;
+ $returnto['returnto'] = $page;
$query = $request->getVal( 'returntoquery', $this->thisquery );
+ $paramsArray = wfCgiToArray( $query );
+ unset( $paramsArray['logoutToken'] );
+ $query = wfArrayToCgi( $paramsArray );
if ( $query != '' ) {
- $a['returntoquery'] = $query;
+ $returnto['returntoquery'] = $query;
}
}
- $returnto = wfArrayToCgi( $a );
if ( $this->loggedin ) {
$personal_urls['userpage'] = [
'text' => $this->username,
$personal_urls['logout'] = [
'text' => $this->msg( 'pt-userlogout' )->text(),
'href' => self::makeSpecialUrl( 'Userlogout',
- // userlogout link must always contain an & character, otherwise we might not be able
+ // Note: userlogout link must always contain an & character, otherwise we might not be able
// to detect a buggy precaching proxy (T19790)
- $title->isSpecial( 'Preferences' ) ? 'noreturnto' : $returnto ),
+ ( $title->isSpecial( 'Preferences' ) ? [] : $returnto )
+ + [ 'logoutToken' => $this->getUser()->getEditToken( 'logoutToken', $this->getRequest() ) ] ),
'active' => false
];
}