Merge "Follow up: I1b017e13 - Fix Strict Standards"
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index b8b1654..a24ece5 100644 (file)
@@ -398,7 +398,7 @@ class SkinTemplate extends Skin {
                # not for special pages or file pages AND only when viewing AND if the page exists
                # (or is in MW namespace, because that has default content)
                if ( !in_array( $title->getNamespace(), array( NS_SPECIAL, NS_FILE ) ) &&
-                       in_array( $request->getVal( 'action', 'view' ), array( 'view', 'historysubmit' ) ) &&
+                       Action::getActionName( $this ) === 'view' &&
                        ( $title->exists() || $title->getNamespace() == NS_MEDIAWIKI ) ) {
                        $pageLang = $title->getPageViewLanguage();
                        $realBodyAttribs['lang'] = $pageLang->getHtmlCode();
@@ -555,7 +555,11 @@ class SkinTemplate extends Skin {
                # $this->getTitle() will just give Special:Badtitle, which is
                # not especially useful as a returnto parameter. Use the title
                # from the request instead, if there was one.
-               $page = Title::newFromURL( $request->getVal( 'title', '' ) );
+               if ( $this->getUser()->isAllowed( 'read' ) ) {
+                       $page = $this->getTitle();
+               } else {
+                       $page = Title::newFromText( $request->getVal( 'title', '' ) );
+               }
                $page = $request->getVal( 'returnto', $page );
                $a = array();
                if ( strval( $page ) !== '' ) {
@@ -1177,11 +1181,6 @@ class SkinTemplate extends Skin {
                                );
                        }
 
-                       $nav_urls['info'] = array(
-                               'text' => $this->msg( 'pageinfo-toolboxlink' )->text(),
-                               'href' => $out->getTitle()->getLocalURL( "action=info" )
-                       );
-
                        // Use the copy of revision ID in case this undocumented, shady hook tries to mess with internals
                        wfRunHooks( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink',
                                array( &$this, &$nav_urls, &$revid, &$revid ) );
@@ -1191,6 +1190,12 @@ class SkinTemplate extends Skin {
                        $nav_urls['whatlinkshere'] = array(
                                'href' => SpecialPage::getTitleFor( 'Whatlinkshere', $this->thispage )->getLocalUrl()
                        );
+
+                       $nav_urls['info'] = array(
+                               'text' => $this->msg( 'pageinfo-toolboxlink' )->text(),
+                               'href' => $this->getTitle()->getLocalURL( "action=info" )
+                       );
+
                        if ( $this->getTitle()->getArticleID() ) {
                                $nav_urls['recentchangeslinked'] = array(
                                        'href' => SpecialPage::getTitleFor( 'Recentchangeslinked', $this->thispage )->getLocalUrl()
@@ -1750,7 +1755,7 @@ abstract class BaseTemplate extends QuickTemplate {
                        foreach ( array( 'id', 'class', 'active', 'tag' ) as $k ) {
                                unset( $link[$k] );
                        }
-                       if ( isset( $item['id'] ) ) {
+                       if ( isset( $item['id'] ) && !isset( $item['single-id'] ) ) {
                                // The id goes on the <li> not on the <a> for single links
                                // but makeSidebarLink still needs to know what id to use when
                                // generating tooltips and accesskeys.
@@ -1772,6 +1777,13 @@ abstract class BaseTemplate extends QuickTemplate {
                        $attrs['class'] .= ' active';
                        $attrs['class'] = trim( $attrs['class'] );
                }
+
+               // A special case for the talk link in personal tools.
+               // See bug 41672 and 42337.
+               if ( $key === 'mytalk' ) {
+                       $html = $this->getMsg( 'parentheses' )->rawParams( $html )->escaped();
+               }
+
                return Html::rawElement( isset( $options['tag'] ) ? $options['tag'] : 'li', $attrs, $html );
        }