X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fskins%2FSkinTemplate.php;h=d1345b8e64b90f0e8a6f4314e96299106b1742de;hb=8390e37efc4b42a1ba3d3102bd78208a30cfccf2;hp=5d6197e7ac70d05882a6f7fafb1facb94a552937;hpb=5b202d729d540bdabbf74c3faf8e3ce5e946cbb1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index 5d6197e7ac..d1345b8e64 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -62,12 +62,10 @@ class SkinTemplate extends Skin { * roughly equivalent to PHPTAL 0.7. * * @param string $classname - * @param bool|string $repository Subdirectory where we keep template files - * @param bool|string $cache_dir * @return QuickTemplate * @private */ - function setupTemplate( $classname, $repository = false, $cache_dir = false ) { + function setupTemplate( $classname ) { return new $classname( $this->getConfig() ); } @@ -179,7 +177,7 @@ class SkinTemplate extends Skin { $user = $this->getUser(); $title = $this->getTitle(); - $tpl = $this->setupTemplate( $this->template, 'skins' ); + $tpl = $this->setupTemplate( $this->template ); $this->thispage = $title->getPrefixedDBkey(); $this->titletxt = $title->getPrefixedText(); @@ -256,7 +254,7 @@ class SkinTemplate extends Skin { * @return QuickTemplate The template to be executed by outputPage */ protected function prepareQuickTemplate() { - global $wgScript, $wgStylePath, $wgMimeType, $wgJsMimeType, + global $wgScript, $wgStylePath, $wgMimeType, $wgSitename, $wgLogo, $wgMaxCredits, $wgShowCreditsIfMax, $wgArticlePath, $wgScriptPath, $wgServer; @@ -306,7 +304,6 @@ class SkinTemplate extends Skin { } $tpl->set( 'mimetype', $wgMimeType ); - $tpl->set( 'jsmimetype', $wgJsMimeType ); $tpl->set( 'charset', 'UTF-8' ); $tpl->set( 'wgScript', $wgScript ); $tpl->set( 'skinname', $this->skinname ); @@ -588,6 +585,7 @@ class SkinTemplate extends Skin { $request = $this->getRequest(); $pageurl = $title->getLocalURL(); $authManager = AuthManager::singleton(); + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); /* set up the default links for the personal toolbar */ $personal_urls = []; @@ -707,7 +705,7 @@ class SkinTemplate extends Skin { ]; // No need to show Talk and Contributions to anons if they can't contribute! - if ( User::groupHasPermission( '*', 'edit' ) ) { + if ( $permissionManager->groupHasPermission( '*', 'edit' ) ) { // Because of caching, we can't link directly to the IP talk and // contributions pages. Instead we use the special page shortcuts // (which work correctly regardless of caching). This means we can't @@ -735,7 +733,7 @@ class SkinTemplate extends Skin { } if ( $authManager->canAuthenticateNow() ) { - $key = User::groupHasPermission( '*', 'read' ) + $key = $permissionManager->groupHasPermission( '*', 'read' ) ? 'login' : 'login-private'; $personal_urls[$key] = $login_url; @@ -1071,8 +1069,8 @@ class SkinTemplate extends Skin { } if ( $title->quickUserCan( 'protect', $user ) && $title->getRestrictionTypes() && - MediaWikiServices::getInstance()->getNamespaceInfo()-> - getRestrictionLevels( $title->getNamespace(), $user ) !== [ '' ] + MediaWikiServices::getInstance()->getPermissionManager() + ->getNamespaceRestrictionLevels( $title->getNamespace(), $user ) !== [ '' ] ) { $mode = $title->isProtected() ? 'unprotect' : 'protect'; $content_navigation['actions'][$mode] = [ @@ -1084,7 +1082,10 @@ class SkinTemplate extends Skin { } // Checks if the user is logged in - if ( $this->loggedin && $user->isAllowedAll( 'viewmywatchlist', 'editmywatchlist' ) ) { + if ( $this->loggedin && MediaWikiServices::getInstance() + ->getPermissionManager() + ->userHasAllRights( $user, 'viewmywatchlist', 'editmywatchlist' ) + ) { /** * The following actions use messages which, if made particular to * the any specific skins, would break the Ajax code which makes this @@ -1278,6 +1279,7 @@ class SkinTemplate extends Skin { $nav_urls['contributions'] = false; $nav_urls['log'] = false; $nav_urls['blockip'] = false; + $nav_urls['mute'] = false; $nav_urls['emailuser'] = false; $nav_urls['userrights'] = false; @@ -1355,6 +1357,13 @@ class SkinTemplate extends Skin { } if ( !$user->isAnon() ) { + if ( $this->getUser()->isRegistered() && $this->getConfig()->get( 'EnableSpecialMute' ) ) { + $nav_urls['mute'] = [ + 'text' => $this->msg( 'mute-preferences' )->text(), + 'href' => self::makeSpecialUrlSubpage( 'Mute', $rootUser ) + ]; + } + $sur = new UserrightsPage; $sur->setContext( $this->getContext() ); $canChange = $sur->userCanChangeRights( $user );