X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fskins%2FSkinTemplate.php;h=70df73bc21322601ab7648b5e82ca3d9b4dcf2dc;hb=25be8cc5859e2f9f6560d6d1d52a47888023fbd6;hp=f3481354276195bc4a36a9e5c923151ae34f5aa7;hpb=c5ebb91c6f4bf02d8874c60fc1ce549cdeab0b6e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index f348135427..70df73bc21 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -208,7 +208,7 @@ class SkinTemplate extends Skin { * Initialize various variables and generate the template */ function outputPage() { - Profiler::instance()->setTemplated( true ); + Profiler::instance()->setAllowOutput(); $out = $this->getOutput(); $this->initPage( $out ); @@ -376,6 +376,7 @@ class SkinTemplate extends Skin { /** @var CreditsAction $action */ $action = Action::factory( 'credits', $this->getWikiPage(), $this->getContext() ); + '@phan-var CreditsAction $action'; $tpl->set( 'credits', $action->getCredits( $wgMaxCredits, $wgShowCreditsIfMax ) ); } else { @@ -884,6 +885,7 @@ class SkinTemplate extends Skin { $out = $this->getOutput(); $request = $this->getRequest(); $user = $this->getUser(); + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); $content_navigation = [ 'namespaces' => [], @@ -895,7 +897,7 @@ class SkinTemplate extends Skin { // parameters $action = $request->getVal( 'action', 'view' ); - $userCanRead = $title->quickUserCan( 'read', $user ); + $userCanRead = $permissionManager->quickUserCan( 'read', $user, $title ); // Avoid PHP 7.1 warning of passing $this by reference $skinTemplate = $this; @@ -965,8 +967,9 @@ class SkinTemplate extends Skin { } // Checks if user can edit the current page if it exists or create it otherwise - if ( $title->quickUserCan( 'edit', $user ) - && ( $title->exists() || $title->quickUserCan( 'create', $user ) ) + if ( $permissionManager->quickUserCan( 'edit', $user, $title ) && + ( $title->exists() || + $permissionManager->quickUserCan( 'create', $user, $title ) ) ) { // Builds CSS class for talk page links $isTalkClass = $isTalk ? ' istalk' : ''; @@ -1031,7 +1034,7 @@ class SkinTemplate extends Skin { 'href' => $title->getLocalURL( 'action=history' ), ]; - if ( $title->quickUserCan( 'delete', $user ) ) { + if ( $permissionManager->quickUserCan( 'delete', $user, $title ) ) { $content_navigation['actions']['delete'] = [ 'class' => ( $onPage && $action == 'delete' ) ? 'selected' : false, 'text' => wfMessageFallback( "$skname-action-delete", 'delete' ) @@ -1040,7 +1043,7 @@ class SkinTemplate extends Skin { ]; } - if ( $title->quickUserCan( 'move', $user ) ) { + if ( $permissionManager->quickUserCan( 'move', $user, $title ) ) { $moveTitle = SpecialPage::getTitleFor( 'Movepage', $title->getPrefixedDBkey() ); $content_navigation['actions']['move'] = [ 'class' => $this->getTitle()->isSpecial( 'Movepage' ) ? 'selected' : false, @@ -1051,13 +1054,14 @@ class SkinTemplate extends Skin { } } else { // article doesn't exist or is deleted - if ( $title->quickUserCan( 'deletedhistory', $user ) ) { + if ( $permissionManager->quickUserCan( 'deletedhistory', $user, $title ) ) { $n = $title->isDeleted(); if ( $n ) { $undelTitle = SpecialPage::getTitleFor( 'Undelete', $title->getPrefixedDBkey() ); // If the user can't undelete but can view deleted // history show them a "View .. deleted" tab instead. - $msgKey = $title->quickUserCan( 'undelete', $user ) ? 'undelete' : 'viewdeleted'; + $msgKey = $permissionManager->quickUserCan( 'undelete', + $user, $title ) ? 'undelete' : 'viewdeleted'; $content_navigation['actions']['undelete'] = [ 'class' => $this->getTitle()->isSpecial( 'Undelete' ) ? 'selected' : false, 'text' => wfMessageFallback( "$skname-action-$msgKey", "{$msgKey}_short" ) @@ -1068,9 +1072,10 @@ class SkinTemplate extends Skin { } } - if ( $title->quickUserCan( 'protect', $user ) && $title->getRestrictionTypes() && - MediaWikiServices::getInstance()->getPermissionManager() - ->getNamespaceRestrictionLevels( $title->getNamespace(), $user ) !== [ '' ] + if ( $permissionManager->quickUserCan( 'protect', $user, $title ) && + $title->getRestrictionTypes() && + $permissionManager->getNamespaceRestrictionLevels( $title->getNamespace(), + $user ) !== [ '' ] ) { $mode = $title->isProtected() ? 'unprotect' : 'protect'; $content_navigation['actions'][$mode] = [ @@ -1082,9 +1087,8 @@ class SkinTemplate extends Skin { } // Checks if the user is logged in - if ( $this->loggedin && MediaWikiServices::getInstance() - ->getPermissionManager() - ->userHasAllRights( $user, 'viewmywatchlist', 'editmywatchlist' ) + if ( $this->loggedin && $permissionManager->userHasAllRights( $user, + 'viewmywatchlist', 'editmywatchlist' ) ) { /** * The following actions use messages which, if made particular to