(bug 54980) Remove toolbox UserRights if anon user
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index bb31bdf..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 ),
@@ -291,8 +296,8 @@ class SkinTemplate extends Skin {
                if ( $out->isSyndicated() ) {
                        $feeds = array();
                        foreach ( $out->getSyndicationLinks() as $format => $link ) {
-                               // Give grep a chance to find the usages: feed-atom, feed-rss
                                $feeds[$format] = array(
+                                       // Messages: feed-atom, feed-rss
                                        'text' => $this->msg( "feed-$format" )->text(),
                                        'href' => $link
                                );
@@ -589,8 +594,6 @@ class SkinTemplate extends Skin {
         * @return array
         */
        protected function buildPersonalUrls() {
-               global $wgSecureLogin;
-
                $title = $this->getTitle();
                $request = $this->getRequest();
                $pageurl = $title->getLocalURL();
@@ -618,10 +621,6 @@ class SkinTemplate extends Skin {
                        }
                }
 
-               if ( $wgSecureLogin && $request->detectProtocol() === 'https' ) {
-                       $a['wpStickHTTPS'] = true;
-               }
-
                $returnto = wfArrayToCgi( $a );
                if ( $this->loggedin ) {
                        $personal_urls['userpage'] = array(
@@ -1281,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 )
+                                       );
+                               }
                        }
                }
 
@@ -1302,10 +1303,6 @@ class SkinTemplate extends Skin {
        function getNameSpaceKey() {
                return $this->getTitle()->getNamespaceKey();
        }
-
-       public function commonPrintStylesheet() {
-               return false;
-       }
 }
 
 /**