(bug 54980) Remove toolbox UserRights if anon user
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index 69e551e..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(
@@ -693,18 +692,15 @@ class SkinTemplate extends Skin {
                                : 'login';
                        $is_signup = $request->getText( 'type' ) == 'signup';
 
-                       # anonlogin & login are the same
-                       $proto = $wgSecureLogin ? PROTO_HTTPS : null;
-
                        $login_id = $this->showIPinHeader() ? 'anonlogin' : 'login';
                        $login_url = array(
                                'text' => $this->msg( $loginlink )->text(),
-                               'href' => self::makeSpecialUrl( 'Userlogin', $returnto, $proto ),
+                               'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
                                'active' => $title->isSpecial( 'Userlogin' ) && ( $loginlink == 'nav-login-createaccount' || !$is_signup ),
                        );
                        $createaccount_url = array(
                                'text' => $this->msg( 'createaccount' )->text(),
-                               'href' => self::makeSpecialUrl( 'Userlogin', "$returnto&type=signup", $proto ),
+                               'href' => self::makeSpecialUrl( 'Userlogin', "$returnto&type=signup" ),
                                'active' => $title->isSpecial( 'Userlogin' ) && $is_signup,
                        );
 
@@ -1284,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 )
+                                       );
+                               }
                        }
                }
 
@@ -1305,10 +1303,6 @@ class SkinTemplate extends Skin {
        function getNameSpaceKey() {
                return $this->getTitle()->getNamespaceKey();
        }
-
-       public function commonPrintStylesheet() {
-               return false;
-       }
 }
 
 /**