X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fskins%2FSkinTemplate.php;h=25771bc95245e24351b14e3d574458b0eac99f53;hb=04d1aa3033f40a38d721f7f0e88b5bac440d2869;hp=a9c0993e297e22912d3a0bb84372b091c5b211d6;hpb=f5e45bb6d75d6df49fc2285877487ad74d095bf1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index a9c0993e29..5d6197e7ac 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -207,21 +207,10 @@ class SkinTemplate extends Skin { } /** - * initialize various variables and generate the template - * - * @param OutputPage|null $out + * Initialize various variables and generate the template */ - function outputPage( OutputPage $out = null ) { + function outputPage() { Profiler::instance()->setTemplated( true ); - - $oldContext = null; - if ( $out !== null ) { - // Deprecated since 1.20, note added in 1.25 - wfDeprecated( __METHOD__, '1.25' ); - $oldContext = $this->getContext(); - $this->setContext( $out->getContext() ); - } - $out = $this->getOutput(); $this->initPage( $out ); @@ -231,10 +220,6 @@ class SkinTemplate extends Skin { // result may be an error $this->printOrError( $res ); - - if ( $oldContext ) { - $this->setContext( $oldContext ); - } } /** @@ -332,7 +317,7 @@ class SkinTemplate extends Skin { $tpl->set( 'handheld', $request->getBool( 'handheld' ) ); $tpl->set( 'loggedin', $this->loggedin ); $tpl->set( 'notspecialpage', !$title->isSpecialPage() ); - $tpl->set( 'searchaction', $this->escapeSearchLink() ); + $tpl->set( 'searchaction', $this->getSearchLink() ); $tpl->set( 'searchtitle', SpecialPage::getTitleFor( 'Search' )->getPrefixedDBkey() ); $tpl->set( 'search', trim( $request->getVal( 'search' ) ) ); $tpl->set( 'stylepath', $wgStylePath ); @@ -389,17 +374,15 @@ class SkinTemplate extends Skin { $tpl->set( 'credits', false ); $tpl->set( 'numberofwatchingusers', false ); if ( $title->exists() ) { - if ( $out->isArticle() ) { - if ( $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->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() ) { @@ -619,16 +602,17 @@ class SkinTemplate extends Skin { $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 ); + $query = wfArrayToCgi( $paramsArray ); if ( $query != '' ) { - $a['returntoquery'] = $query; + $returnto['returntoquery'] = $query; } } - $returnto = wfArrayToCgi( $a ); if ( $this->loggedin ) { $personal_urls['userpage'] = [ 'text' => $this->username, @@ -693,9 +677,9 @@ class SkinTemplate extends Skin { $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 ) ), 'active' => false ]; } @@ -789,7 +773,8 @@ class SkinTemplate extends Skin { } } - $linkClass = MediaWikiServices::getInstance()->getLinkRenderer()->getLinkClasses( $title ); + $services = MediaWikiServices::getInstance(); + $linkClass = $services->getLinkRenderer()->getLinkClasses( $title ); // wfMessageFallback will nicely accept $message as an array of fallbacks // or just a single key @@ -801,8 +786,9 @@ class SkinTemplate extends Skin { if ( $msg->exists() ) { $text = $msg->text(); } else { - $text = MediaWikiServices::getInstance()->getContentLanguage()->getConverter()-> - convertNamespace( MWNamespace::getSubject( $title->getNamespace() ) ); + $text = $services->getContentLanguage()->getConverter()-> + convertNamespace( $services->getNamespaceInfo()-> + getSubject( $title->getNamespace() ) ); } // Avoid PHP 7.1 warning of passing $this by reference @@ -1085,7 +1071,8 @@ class SkinTemplate extends Skin { } if ( $title->quickUserCan( 'protect', $user ) && $title->getRestrictionTypes() && - MWNamespace::getRestrictionLevels( $title->getNamespace(), $user ) !== [ '' ] + MediaWikiServices::getInstance()->getNamespaceInfo()-> + getRestrictionLevels( $title->getNamespace(), $user ) !== [ '' ] ) { $mode = $title->isProtected() ? 'unprotect' : 'protect'; $content_navigation['actions'][$mode] = [