(bug 54980) Remove toolbox UserRights if anon user
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index e3ef6ac..44cafe9 100644 (file)
@@ -131,6 +131,7 @@ class SkinTemplate extends Skin {
        public function getLanguages() {
                global $wgHideInterlanguageLinks;
                $out = $this->getOutput();
+               $userLang = $this->getLanguage();
 
                # Language links
                $language_urls = array();
@@ -151,10 +152,14 @@ class SkinTemplate extends Skin {
                                                $ilLangName = $this->formatLanguageName( $ilLangName );
                                        }
 
+                                       // CLDR extension or similar is required to localize the language name;
+                                       // otherwise we'll end up with the autonym again.
+                                       $ilLangLocalName = Language::fetchLanguageName( $ilInterwikiCode, $userLang->getCode() );
+
                                        $language_urls[] = array(
                                                'href' => $languageLinkTitle->getFullURL(),
                                                'text' => $ilLangName,
-                                               'title' => $languageLinkTitle->getText(),
+                                               'title' => wfMessage( 'tooltip-iwiki', $languageLinkTitle->getText(), $ilLangLocalName )->escaped(),
                                                'class' => $class,
                                                'lang' => wfBCP47( $ilInterwikiCode ),
                                                'hreflang' => wfBCP47( $ilInterwikiCode ),
@@ -1275,12 +1280,14 @@ class SkinTemplate extends Skin {
                                );
                        }
 
-                       $sur = new UserrightsPage;
-                       $sur->setContext( $this->getContext() );
-                       if ( $sur->userCanExecute( $this->getUser() ) ) {
-                               $nav_urls['userrights'] = array(
-                                       'href' => self::makeSpecialUrlSubpage( 'Userrights', $rootUser )
-                               );
+                       if ( !$user->isAnon() ) {
+                               $sur = new UserrightsPage;
+                               $sur->setContext( $this->getContext() );
+                               if ( $sur->userCanExecute( $this->getUser() ) ) {
+                                       $nav_urls['userrights'] = array(
+                                               'href' => self::makeSpecialUrlSubpage( 'Userrights', $rootUser )
+                                       );
+                               }
                        }
                }
 
@@ -1296,10 +1303,6 @@ class SkinTemplate extends Skin {
        function getNameSpaceKey() {
                return $this->getTitle()->getNamespaceKey();
        }
-
-       public function commonPrintStylesheet() {
-               return false;
-       }
 }
 
 /**