Stage 2 of war on $wgTitle!! Make OutputPage, Skin and children rely on mTitle rather...
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 9 Apr 2009 02:22:36 +0000 (02:22 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 9 Apr 2009 02:22:36 +0000 (02:22 +0000)
includes/OutputPage.php
includes/Skin.php
includes/SkinTemplate.php
includes/Wiki.php
skins/CologneBlue.php
skins/Standard.php

index caa40be..1e54354 100644 (file)
@@ -35,6 +35,7 @@ class OutputPage {
        var $mParseWarnings = array();
        var $mSquidMaxage = 0;
        var $mRevisionId = null;
+       protected $mTitle = null;
 
        /**
         * An array of stylesheet filenames (relative from skins path), with options
@@ -332,6 +333,21 @@ class OutputPage {
 
                $this->setHTMLTitle( wfMsg( 'pagetitle', $name ) );
        }
+       
+       public function setTitle( $t ) {
+               $this->mTitle = $t;
+       }
+       
+       public function getTitle() {
+               if ( $this->mTitle instanceof Title ) {
+                       return $this->mTitle;
+               }
+               else {
+                       wfDebug( __METHOD__ . ' called and $mTitle is null. Return $wgTitle for sanity' );
+                       global $wgTitle;
+                       return $wgTitle;
+               }
+       }
 
        public function getHTMLTitle() { return $this->mHTMLtitle; }
        public function getPageTitle() { return $this->mPagetitle; }
@@ -485,8 +501,7 @@ class OutputPage {
         * @param bool   $linestart
         */
        public function addWikiText( $text, $linestart = true ) {
-               global $wgTitle;
-               $this->addWikiTextTitle($text, $wgTitle, $linestart);
+               $this->addWikiTextTitle( $text, $this->getTitle(), $linestart );
        }
 
        public function addWikiTextWithTitle($text, &$title, $linestart = true) {
@@ -522,7 +537,7 @@ class OutputPage {
         * @param ParserOutput object &$parserOutput
         */
        public function addParserOutputNoText( &$parserOutput ) {
-               global $wgTitle, $wgExemptFromUserRobotsControl, $wgContentNamespaces;
+               global $wgExemptFromUserRobotsControl, $wgContentNamespaces;
 
                $this->mLanguageLinks += $parserOutput->getLanguageLinks();
                $this->addCategoryLinks( $parserOutput->getCategories() );
@@ -534,7 +549,7 @@ class OutputPage {
                } else {
                        $bannedNamespaces = $wgExemptFromUserRobotsControl;
                }
-               if( !in_array( $wgTitle->getNamespace(), $bannedNamespaces ) ) {
+               if( !in_array( $this->getTitle()->getNamespace(), $bannedNamespaces ) ) {
                        # FIXME (bug 14900): This overrides $wgArticleRobotPolicies, and it
                        # shouldn't
                        $this->setIndexPolicy( $parserOutput->getIndexPolicy() );
@@ -615,17 +630,15 @@ class OutputPage {
         * @deprecated use addWikiTextTidy()
         */
        public function addSecondaryWikiText( $text, $linestart = true ) {
-               global $wgTitle;
                wfDeprecated( __METHOD__ );
-               $this->addWikiTextTitleTidy($text, $wgTitle, $linestart);
+               $this->addWikiTextTitleTidy($text, $this->getTitle(), $linestart);
        }
 
        /**
         * Add wikitext with tidy enabled
         */
        public function addWikiTextTidy(  $text, $linestart = true ) {
-               global $wgTitle;
-               $this->addWikiTextTitleTidy($text, $wgTitle, $linestart);
+               $this->addWikiTextTitleTidy($text, $this->getTitle(), $linestart);
        }
 
 
@@ -649,13 +662,13 @@ class OutputPage {
         * @param bool   $interface ??
         */
        public function parse( $text, $linestart = true, $interface = false ) {
-               global $wgParser, $wgTitle;
-               if( is_null( $wgTitle ) ) {
-                       throw new MWException( 'Empty $wgTitle in ' . __METHOD__ );
+               global $wgParser;
+               if( is_null( $this->getTitle() ) ) {
+                       throw new MWException( 'Empty $mTitle in ' . __METHOD__ );
                }
                $popts = $this->parserOptions();
                if ( $interface) { $popts->setInterfaceMessage(true); }
-               $parserOutput = $wgParser->parse( $text, $wgTitle, $popts,
+               $parserOutput = $wgParser->parse( $text, $this->getTitle(), $popts,
                        $linestart, true, $this->mRevisionId );
                if ( $interface) { $popts->setInterfaceMessage(false); }
                return $parserOutput->getText();
@@ -833,7 +846,7 @@ class OutputPage {
                global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType;
                global $wgJsMimeType, $wgUseAjax, $wgAjaxWatch;
                global $wgEnableMWSuggest, $wgUniversalEditButton;
-               global $wgArticle, $wgTitle;
+               global $wgArticle;
 
                if( $this->mDoNothing ){
                        return;
@@ -941,20 +954,20 @@ class OutputPage {
                }
 
                if( $wgUniversalEditButton ) {
-                       if( isset( $wgArticle ) && isset( $wgTitle ) && $wgTitle->quickUserCan( 'edit' )
-                               && ( $wgTitle->exists() || $wgTitle->quickUserCan( 'create' ) ) ) {
+                       if( isset( $wgArticle ) && $this->getTitle() && $this->getTitle()->quickUserCan( 'edit' )
+                               && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create' ) ) ) {
                                // Original UniversalEditButton
                                $this->addLink( array(
                                        'rel' => 'alternate',
                                        'type' => 'application/x-wiki',
                                        'title' => wfMsg( 'edit' ),
-                                       'href' => $wgTitle->getLocalURL( 'action=edit' )
+                                       'href' => $this->getTitle()->getLocalURL( 'action=edit' )
                                ) );
                                // Alternate edit link
                                $this->addLink( array(
                                        'rel' => 'edit',
                                        'title' => wfMsg( 'edit' ),
-                                       'href' => $wgTitle->getLocalURL( 'action=edit' )
+                                       'href' => $this->getTitle()->getLocalURL( 'action=edit' )
                                ) );
                        }
                }
@@ -1032,7 +1045,7 @@ class OutputPage {
         * @return nothing
         */
        function blockedPage( $return = true ) {
-               global $wgUser, $wgContLang, $wgTitle, $wgLang;
+               global $wgUser, $wgContLang, $wgLang;
 
                $this->setPageTitle( wfMsg( 'blockedtitle' ) );
                $this->setRobotPolicy( 'noindex,nofollow' );
@@ -1082,7 +1095,7 @@ class OutputPage {
 
                # Don't auto-return to special pages
                if( $return ) {
-                       $return = $wgTitle->getNamespace() > -1 ? $wgTitle : NULL;
+                       $return = $this->getTitle()->getNamespace() > -1 ? $this->getTitle() : null;
                        $this->returnToMain( null, $return );
                }
        }
@@ -1095,9 +1108,8 @@ class OutputPage {
         * @param array $params Message parameters
         */
        public function showErrorPage( $title, $msg, $params = array() ) {
-               global $wgTitle;
-               if ( isset($wgTitle) ) {
-                       $this->mDebugtext .= 'Original title: ' . $wgTitle->getPrefixedText() . "\n";
+               if ( $this->getTitle() ) {
+                       $this->mDebugtext .= 'Original title: ' . $this->getTitle()->getPrefixedText() . "\n";
                }
                $this->setPageTitle( wfMsg( $title ) );
                $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) );
@@ -1121,10 +1133,8 @@ class OutputPage {
         */
        public function showPermissionsErrorPage( $errors, $action = null )
        {
-               global $wgTitle;
-
                $this->mDebugtext .= 'Original title: ' .
-               $wgTitle->getPrefixedText() . "\n";
+               $this->getTitle()->getPrefixedText() . "\n";
                $this->setPageTitle( wfMsg( 'permissionserrors' ) );
                $this->setHTMLTitle( wfMsg( 'permissionserrors' ) );
                $this->setRobotPolicy( 'noindex,nofollow' );
@@ -1204,7 +1214,7 @@ class OutputPage {
         * Produce the stock "please login to use the wiki" page
         */
        public function loginToUse() {
-               global $wgUser, $wgTitle, $wgContLang;
+               global $wgUser, $wgContLang;
 
                if( $wgUser->isLoggedIn() ) {
                        $this->permissionRequired( 'read' );
@@ -1219,9 +1229,9 @@ class OutputPage {
                $this->setArticleFlag( false );
 
                $loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
-               $loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $wgTitle->getPrefixedUrl() );
+               $loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $this->getTitle()->getPrefixedUrl() );
                $this->addHTML( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) );
-               $this->addHTML( "\n<!--" . $wgTitle->getPrefixedUrl() . "-->" );
+               $this->addHTML( "\n<!--" . $this->getTitle()->getPrefixedUrl() . "-->" );
 
                # Don't return to the main page if the user can't read it
                # otherwise we'll end up in a pointless loop
@@ -1285,7 +1295,7 @@ class OutputPage {
         * @param array  $reasons   List of reasons for this error, as returned by Title::getUserPermissionsErrors().
         */
        public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
-               global $wgUser, $wgTitle;
+               global $wgUser;
                $skin = $wgUser->getSkin();
 
                $this->setRobotPolicy( 'noindex,nofollow' );
@@ -1301,7 +1311,7 @@ class OutputPage {
                        // Permissions error
                        if( $source ) {
                                $this->setPageTitle( wfMsg( 'viewsource' ) );
-                               $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
+                               $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $this->getTitle() ) ) );
                        } else {
                                $this->setPageTitle( wfMsg( 'badaccess' ) );
                        }
@@ -1328,7 +1338,7 @@ class OutputPage {
 
                        // Show templates used by this article
                        $skin = $wgUser->getSkin();
-                       $article = new Article( $wgTitle );
+                       $article = new Article( $this->getTitle() );
                        $this->addHTML( "<div class='templatesUsed'>
 {$skin->formatTemplates( $article->getUsedTemplates() )}
 </div>
@@ -1338,8 +1348,8 @@ class OutputPage {
                # If the title doesn't exist, it's fairly pointless to print a return
                # link to it.  After all, you just tried editing it and couldn't, so
                # what's there to do there?
-               if( $wgTitle->exists() ) {
-                       $this->returnToMain( null, $wgTitle );
+               if( $this->getTitle()->exists() ) {
+                       $this->returnToMain( null, $this->getTitle() );
                }
        }
 
@@ -1457,8 +1467,7 @@ class OutputPage {
         * @param ParserOutput &$parserOutput
         */
        private function addKeywords( &$parserOutput ) {
-               global $wgTitle;
-               $this->addKeyword( $wgTitle->getPrefixedText() );
+               $this->addKeyword( $this->getTitle()->getPrefixedText() );
                $count = 1;
                $links2d =& $parserOutput->getLinks();
                if ( !is_array( $links2d ) ) {
@@ -1480,7 +1489,7 @@ class OutputPage {
        public function headElement( Skin $sk ) {
                global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
                global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
-               global $wgUser, $wgContLang, $wgUseTrackbacks, $wgTitle, $wgStyleVersion;
+               global $wgUser, $wgContLang, $wgUseTrackbacks, $wgStyleVersion;
 
                $this->addMeta( "http:Content-type", "$wgMimeType; charset={$wgOutputEncoding}" );
                $this->addStyle( 'common/wikiprintable.css', 'print' );
@@ -1517,7 +1526,7 @@ class OutputPage {
                }
 
                if ($wgUseTrackbacks && $this->isArticleRelated())
-                       $ret .= $wgTitle->trackbackRDF();
+                       $ret .= $this->getTitle()->trackbackRDF();
 
                $ret .= "</head>\n";
                return $ret;
@@ -1572,7 +1581,6 @@ class OutputPage {
                }
 
                if( $wgFeed ) {
-                       global $wgTitle;
                        foreach( $this->getSyndicationLinks() as $format => $link ) {
                                # Use the page name for the title (accessed through $wgTitle since
                                # there's no other way).  In principle, this could lead to issues
@@ -1582,7 +1590,7 @@ class OutputPage {
                                $tags[] = $this->feedLink(
                                        $format,
                                        $link,
-                                       wfMsg( "page-{$format}-feed", $wgTitle->getPrefixedText() ) ); # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
+                                       wfMsg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() ) ); # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
                        }
 
                        # Recent changes feed should appear on every page (except recentchanges, 
@@ -1604,7 +1612,7 @@ class OutputPage {
                                                wfMsg( "site-{$type}-feed", $wgSitename ) );
                                }
                        }
-                       else if ( $wgTitle->getPrefixedText() != $rctitle->getPrefixedText() ) {
+                       else if ( $this->getTitle()->getPrefixedText() != $rctitle->getPrefixedText() ) {
                                foreach( $wgFeedClasses as $format => $class ) {
                                        $tags[] = $this->feedLink(
                                                $format,
@@ -1622,7 +1630,7 @@ class OutputPage {
         * @return array associating format keys with URLs
         */
        public function getSyndicationLinks() {
-               global $wgTitle, $wgFeedClasses;
+               global $wgFeedClasses;
                $links = array();
 
                if( $this->isSyndicated() ) {
@@ -1633,7 +1641,7 @@ class OutputPage {
                        }
 
                        foreach( $wgFeedClasses as $format => $class ) {
-                               $links[$format] = $wgTitle->getLocalUrl( "feed=$format{$appendQuery}" );
+                               $links[$format] = $this->getTitle()->getLocalUrl( "feed=$format{$appendQuery}" );
                        }
                }
                return $links;
@@ -1767,7 +1775,6 @@ class OutputPage {
         * for when rate limiting has triggered.
         */
        public function rateLimited() {
-               global $wgTitle;
 
                $this->setPageTitle(wfMsg('actionthrottled'));
                $this->setRobotPolicy( 'noindex,follow' );
@@ -1778,7 +1785,7 @@ class OutputPage {
                $this->setStatusCode(503);
                $this->addWikiMsg( 'actionthrottledtext' );
 
-               $this->returnToMain( null, $wgTitle );
+               $this->returnToMain( null, $this->getTitle() );
        }
 
        /**
index b0e72f0..fcba435 100644 (file)
@@ -176,6 +176,8 @@ class Skin extends Linker {
 
                wfProfileIn( __METHOD__ );
 
+               $this->mTitle = $out->getTitle();
+
                # Generally the order of the favicon and apple-touch-icon links
                # should not matter, but Konqueror (3.5.9 at least) incorrectly
                # uses whichever one appears later in the HTML source.  Make sure
@@ -209,18 +211,18 @@ class Skin extends Linker {
         * Preload the existence of three commonly-requested pages in a single query
         */
        function preloadExistence() {
-               global $wgUser, $wgTitle;
+               global $wgUser;
 
                // User/talk link
                $titles = array( $wgUser->getUserPage(), $wgUser->getTalkPage() );
 
                // Other tab link
-               if ( $wgTitle->getNamespace() == NS_SPECIAL ) {
+               if ( $this->mTitle->getNamespace() == NS_SPECIAL ) {
                        // nothing
-               } elseif ( $wgTitle->isTalkPage() ) {
-                       $titles[] = $wgTitle->getSubjectPage();
+               } elseif ( $this->mTitle->isTalkPage() ) {
+                       $titles[] = $this->mTitle->getSubjectPage();
                } else {
-                       $titles[] = $wgTitle->getTalkPage();
+                       $titles[] = $this->mTitle->getTalkPage();
                }
 
                $lb = new LinkBatch( $titles );
@@ -228,7 +230,7 @@ class Skin extends Linker {
        }
 
        function addMetadataLinks( OutputPage $out ) {
-               global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
+               global $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
                global $wgRightsPage, $wgRightsUrl;
 
                if( $out->isArticleRelated() ) {
@@ -237,14 +239,14 @@ class Skin extends Linker {
                                $out->addMetadataLink( array(
                                        'title' => 'Creative Commons',
                                        'type' => 'application/rdf+xml',
-                                       'href' => $wgTitle->getLocalURL( 'action=creativecommons' ) )
+                                       'href' => $this->mTitle->getLocalURL( 'action=creativecommons' ) )
                                );
                        }
                        if( $wgEnableDublinCoreRdf ) {
                                $out->addMetadataLink( array(
                                        'title' => 'Dublin Core',
                                        'type' => 'application/rdf+xml',
-                                       'href' => $wgTitle->getLocalURL( 'action=dublincore' ) )
+                                       'href' => $this->mTitle->getLocalURL( 'action=dublincore' ) )
                                );
                        }
                }
@@ -267,8 +269,7 @@ class Skin extends Linker {
        }
 
        function setMembers(){
-               global $wgTitle, $wgUser;
-               $this->mTitle = $wgTitle;
+               global $wgUser;
                $this->mUser = $wgUser;
                $this->userpage = $wgUser->getUserPage()->getPrefixedText();
                $this->usercss = false;
@@ -331,11 +332,12 @@ class Skin extends Linker {
         * @param array $data Associative array containing one element:
         *     skinname => the skin name
         * The odd calling convention is for backwards compatibility
+        * @TODO @FIXME Make this not depend on $wgTitle!
         */
        static function makeGlobalVariablesScript( $data ) {
-               global $wgScript, $wgStylePath, $wgUser;
+               global $wgScript, $wgTitle, $wgStylePath, $wgUser;
                global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
-               global $wgTitle, $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
+               global $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
                global $wgBreakFrames, $wgRequest, $wgVariantArticlePath, $wgActionPaths;
                global $wgUseAjax, $wgAjaxWatch;
                global $wgVersion, $wgEnableAPI, $wgEnableWriteAPI;
@@ -455,13 +457,13 @@ class Skin extends Linker {
         * @private
         */
        function userCanPreview( $action ) {
-               global $wgTitle, $wgRequest, $wgUser;
+               global $wgRequest, $wgUser;
 
                if( $action != 'submit' )
                        return false;
                if( !$wgRequest->wasPosted() )
                        return false;
-               if( !$wgTitle->userCanEditCssJsSubpage() )
+               if( !$this->mTitle->userCanEditCssJsSubpage() )
                        return false;
                return $wgUser->matchEditToken(
                        $wgRequest->getVal( 'wpEditToken' ) );
@@ -639,17 +641,17 @@ END;
        }
 
        function getBodyOptions() {
-               global $wgUser, $wgTitle, $wgOut, $wgRequest, $wgContLang;
+               global $wgUser, $wgOut, $wgRequest, $wgContLang;
 
                extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
 
-               if ( 0 != $wgTitle->getNamespace() ) {
+               if ( 0 != $this->mTitle->getNamespace() ) {
                        $a = array( 'bgcolor' => '#ffffec' );
                }
                else $a = array( 'bgcolor' => '#FFFFFF' );
                if( $wgOut->isArticle() && $wgUser->getOption( 'editondblclick' ) &&
-                 $wgTitle->quickUserCan( 'edit' ) ) {
-                       $s = $wgTitle->getFullURL( $this->editUrlOptions() );
+                 $this->mTitle->quickUserCan( 'edit' ) ) {
+                       $s = $this->mTitle->getFullURL( $this->editUrlOptions() );
                        $s = 'document.location = "' .Xml::escapeJsString( $s ) .'";';
                        $a += array( 'ondblclick' => $s );
                }
@@ -657,7 +659,7 @@ END;
                $a['class'] =
                        'mediawiki' .
                        ' '.( $wgContLang->isRTL() ? 'rtl' : 'ltr' ).
-                       ' '.$this->getPageClasses( $wgTitle ) .
+                       ' '.$this->getPageClasses( $this->mTitle ) .
                        ' skin-'. Sanitizer::escapeClass( $this->getSkinName() );
                return $a;
        }
@@ -754,7 +756,7 @@ END;
 
 
        function getCategoryLinks() {
-               global $wgOut, $wgTitle, $wgUseCategoryBrowser;
+               global $wgOut, $wgUseCategoryBrowser;
                global $wgContLang, $wgUser;
 
                if( count( $wgOut->mCategoryLinks ) == 0 ) return '';
@@ -784,7 +786,7 @@ END;
                if ( isset( $allCats['hidden'] ) ) {
                        if ( $wgUser->getBoolOption( 'showhiddencats' ) ) {
                                $class ='mw-hidden-cats-user-shown';
-                       } elseif ( $wgTitle->getNamespace() == NS_CATEGORY ) {
+                       } elseif ( $this->mTitle->getNamespace() == NS_CATEGORY ) {
                                $class = 'mw-hidden-cats-ns-shown';
                        } else {
                                $class = 'mw-hidden-cats-hidden';
@@ -801,7 +803,7 @@ END;
                        $s .= '<br /><hr />';
 
                        # get a big array of the parents tree
-                       $parenttree = $wgTitle->getParentCategoryTree();
+                       $parenttree = $this->mTitle->getParentCategoryTree();
                        # Skin object passed by reference cause it can not be
                        # accessed under the method subfunction drawCategoryBrowser
                        $tempout = explode( "\n", Skin::drawCategoryBrowser( $parenttree, $this ) );
@@ -929,8 +931,7 @@ END;
 
        /** @return string Retrievied from HTML text */
        function printSource() {
-               global $wgTitle;
-               $url = htmlspecialchars( $wgTitle->getFullURL() );
+               $url = htmlspecialchars( $this->mTitle->getFullURL() );
                return wfMsg( 'retrievedfrom', '<a href="'.$url.'">'.$url.'</a>' );
        }
 
@@ -943,7 +944,7 @@ END;
        function doAfterContent() { return '</div></div>'; }
 
        function pageTitleLinks() {
-               global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
+               global $wgOut, $wgUser, $wgRequest, $wgLang;
 
                $oldid = $wgRequest->getVal( 'oldid' );
                $diff = $wgRequest->getVal( 'diff' );
@@ -960,9 +961,9 @@ END;
                }
 
                if ( $wgOut->isArticleRelated() ) {
-                       if ( $wgTitle->getNamespace() == NS_FILE ) {
-                               $name = $wgTitle->getDBkey();
-                               $image = wfFindFile( $wgTitle );
+                       if ( $this->mTitle->getNamespace() == NS_FILE ) {
+                               $name = $this->mTitle->getDBkey();
+                               $image = wfFindFile( $this->mTitle );
                                if( $image ) {
                                        $link = htmlspecialchars( $image->getURL() );
                                        $style = $this->getInternalLinkAttributes( $link, $name );
@@ -971,14 +972,14 @@ END;
                        }
                }
                if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
-                       $s[] .= $this->makeKnownLinkObj( $wgTitle,
+                       $s[] .= $this->makeKnownLinkObj( $this->mTitle,
                                        wfMsg( 'currentrev' ) );
                }
 
                if ( $wgUser->getNewtalk() ) {
                        # do not show "You have new messages" text when we are viewing our
                        # own talk page
-                       if( !$wgTitle->equals( $wgUser->getTalkPage() ) ) {
+                       if( !$this->mTitle->equals( $wgUser->getTalkPage() ) ) {
                                $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessageslink' ), 'redirect=no' );
                                $dl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' );
                                $s[] = '<strong>'. wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
@@ -996,10 +997,10 @@ END;
        }
 
        function getUndeleteLink() {
-               global $wgUser, $wgTitle, $wgContLang, $wgLang, $action;
+               global $wgUser, $wgContLang, $wgLang, $action;
                if(     $wgUser->isAllowed( 'deletedhistory' ) &&
-                       ( ( $wgTitle->getArticleId() == 0 ) || ( $action == 'history' ) ) &&
-                       ( $n = $wgTitle->isDeleted() ) ){
+                       ( ( $this->mTitle->getArticleId() == 0 ) || ( $action == 'history' ) ) &&
+                       ( $n = $this->mTitle->isDeleted() ) ){
                        if ( $wgUser->isAllowed( 'undelete' ) ) {
                                $msg = 'thisisdeleted';
                        } else {
@@ -1007,7 +1008,7 @@ END;
                        }
                        return wfMsg( $msg,
                                $this->makeKnownLinkObj(
-                                       SpecialPage::getTitleFor( 'Undelete', $wgTitle->getPrefixedDBkey() ),
+                                       SpecialPage::getTitleFor( 'Undelete', $this->mTitle->getPrefixedDBkey() ),
                                        wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $wgLang->formatNum( $n ) ) ) );
                }
                return '';
@@ -1054,9 +1055,9 @@ END;
                if( !wfRunHooks( 'SkinSubPageSubtitle', array( &$subpages ) ) )
                        return $subpages;
 
-               global $wgOut, $wgTitle;
-               if( $wgOut->isArticle() && MWNamespace::hasSubpages( $wgTitle->getNamespace() ) ) {
-                       $ptext = $wgTitle->getPrefixedText();
+               global $wgOut;
+               if( $wgOut->isArticle() && MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) {
+                       $ptext = $this->mTitle->getPrefixedText();
                        if( preg_match( '/\//', $ptext ) ) {
                                $links = explode( '/', $ptext );
                                array_pop( $links );
@@ -1096,7 +1097,7 @@ END;
        }
 
        function nameAndLogin() {
-               global $wgUser, $wgTitle, $wgLang, $wgContLang;
+               global $wgUser, $wgLang, $wgContLang;
 
                $logoutPage = $wgContLang->specialPage( 'Userlogout' );
 
@@ -1113,7 +1114,7 @@ END;
                                $ret .= wfMsg( 'notloggedin' );
                        }
 
-                       $returnTo = $wgTitle->getPrefixedDBkey();
+                       $returnTo = $this->mTitle->getPrefixedDBkey();
                        $query = array();
                        if ( $logoutPage != $returnTo ) {
                                $query['returnto'] = $returnTo;
@@ -1127,7 +1128,7 @@ END;
                                wfMsg( $loginlink ), array(), $query
                        );
                } else {
-                       $returnTo = $wgTitle->getPrefixedDBkey();
+                       $returnTo = $this->mTitle->getPrefixedDBkey();
                        $talkLink = $this->link( $wgUser->getTalkPage(),
                                $wgLang->getNsText( NS_TALK ) );
 
@@ -1246,7 +1247,7 @@ END;
        function variantLinks() {
                $s = '';
                /* show links to different language variants */
-               global $wgDisableLangConversion, $wgLang, $wgContLang, $wgTitle;
+               global $wgDisableLangConversion, $wgLang, $wgContLang;
                $variants = $wgContLang->getVariants();
                if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
                        foreach( $variants as $code ) {
@@ -1255,7 +1256,7 @@ END;
                                        continue;
                                $s = $wgLang->pipeList( array(
                                        $s,
-                                       '<a href="' . $wgTitle->escapeLocalUrl( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>'
+                                       '<a href="' . $this->mTitle->escapeLocalUrl( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>'
                                ) );
                        }
                }
@@ -1263,7 +1264,7 @@ END;
        }
 
        function bottomLinks() {
-               global $wgOut, $wgUser, $wgTitle, $wgUseTrackbacks;
+               global $wgOut, $wgUser, $wgUseTrackbacks;
                $sep = wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n";
 
                $s = '';
@@ -1280,10 +1281,10 @@ END;
                        if( $wgUseTrackbacks )
                                $element[] = $this->trackbackLink();
 
-                       if ( $wgTitle->getNamespace() == NS_USER
-                           || $wgTitle->getNamespace() == NS_USER_TALK ){
-                               $id = User::idFromName( $wgTitle->getText() );
-                               $ip = User::isIP( $wgTitle->getText() );
+                       if ( $this->mTitle->getNamespace() == NS_USER
+                           || $this->mTitle->getNamespace() == NS_USER_TALK ){
+                               $id = User::idFromName( $this->mTitle->getText() );
+                               $ip = User::isIP( $this->mTitle->getText() );
 
                                if( $id || $ip ) { # both anons and non-anons have contri list
                                        $element[] = $this->userContribsLink();
@@ -1295,7 +1296,7 @@ END;
                        
                        $s = implode( $element, $sep );
 
-                       if ( $wgTitle->getArticleId() ) {
+                       if ( $this->mTitle->getArticleId() ) {
                                $s .= "\n<br />";
                                if( $wgUser->isAllowed( 'delete' ) ) { $s .= $this->deleteThisPage(); }
                                if( $wgUser->isAllowed( 'protect' ) ) { $s .= $sep . $this->protectThisPage(); }
@@ -1309,7 +1310,7 @@ END;
 
        function pageStats() {
                global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser;
-               global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgTitle, $wgPageShowWatchingUsers;
+               global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgPageShowWatchingUsers;
 
                $oldid = $wgRequest->getVal( 'oldid' );
                $diff = $wgRequest->getVal( 'diff' );
@@ -1336,7 +1337,7 @@ END;
                        $dbr = wfGetDB( DB_SLAVE );
                        $res = $dbr->select( 'watchlist',
                                array( 'COUNT(*) AS n' ),
-                               array( 'wl_title' => $dbr->strencode( $wgTitle->getDBkey() ), 'wl_namespace' => $wgTitle->getNamespace() ),
+                               array( 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ), 'wl_namespace' => $this->mTitle->getNamespace() ),
                                __METHOD__
                        );
                        $x = $dbr->fetchObject( $res );
@@ -1514,20 +1515,20 @@ END;
        }
 
        function editThisPage() {
-               global $wgOut, $wgTitle;
+               global $wgOut;
 
                if ( !$wgOut->isArticleRelated() ) {
                        $s = wfMsg( 'protectedpage' );
                } else {
-                       if( $wgTitle->quickUserCan( 'edit' ) && $wgTitle->exists() ) {
+                       if( $this->mTitle->quickUserCan( 'edit' ) && $this->mTitle->exists() ) {
                                $t = wfMsg( 'editthispage' );
-                       } elseif( $wgTitle->quickUserCan( 'create' ) && !$wgTitle->exists() ) {
+                       } elseif( $this->mTitle->quickUserCan( 'create' ) && !$this->mTitle->exists() ) {
                                $t = wfMsg( 'create-this-page' );
                        } else {
                                $t = wfMsg( 'viewsource' );
                        }
 
-                       $s = $this->makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() );
+                       $s = $this->makeKnownLinkObj( $this->mTitle, $t, $this->editUrlOptions() );
                }
                return $s;
        }
@@ -1550,13 +1551,13 @@ END;
        }
 
        function deleteThisPage() {
-               global $wgUser, $wgTitle, $wgRequest;
+               global $wgUser, $wgRequest;
 
                $diff = $wgRequest->getVal( 'diff' );
-               if ( $wgTitle->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
+               if ( $this->mTitle->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
                        $t = wfMsg( 'deletethispage' );
 
-                       $s = $this->makeKnownLinkObj( $wgTitle, $t, 'action=delete' );
+                       $s = $this->makeKnownLinkObj( $this->mTitle, $t, 'action=delete' );
                } else {
                        $s = '';
                }
@@ -1564,18 +1565,18 @@ END;
        }
 
        function protectThisPage() {
-               global $wgUser, $wgTitle, $wgRequest;
+               global $wgUser, $wgRequest;
 
                $diff = $wgRequest->getVal( 'diff' );
-               if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('protect') ) {
-                       if ( $wgTitle->isProtected() ) {
+               if ( $this->mTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('protect') ) {
+                       if ( $this->mTitle->isProtected() ) {
                                $t = wfMsg( 'unprotectthispage' );
                                $q = 'action=unprotect';
                        } else {
                                $t = wfMsg( 'protectthispage' );
                                $q = 'action=protect';
                        }
-                       $s = $this->makeKnownLinkObj( $wgTitle, $t, $q );
+                       $s = $this->makeKnownLinkObj( $this->mTitle, $t, $q );
                } else {
                        $s = '';
                }
@@ -1583,11 +1584,11 @@ END;
        }
 
        function watchThisPage() {
-               global $wgOut, $wgTitle;
+               global $wgOut;
                ++$this->mWatchLinkNum;
 
                if ( $wgOut->isArticleRelated() ) {
-                       if ( $wgTitle->userIsWatching() ) {
+                       if ( $this->mTitle->userIsWatching() ) {
                                $t = wfMsg( 'unwatchthispage' );
                                $q = 'action=unwatch';
                                $id = 'mw-unwatch-link' . $this->mWatchLinkNum;
@@ -1596,7 +1597,7 @@ END;
                                $q = 'action=watch';
                                $id = 'mw-watch-link' . $this->mWatchLinkNum;
                        }
-                       $s = $this->makeKnownLinkObj( $wgTitle, $t, $q, '', '', " id=\"$id\"" );
+                       $s = $this->makeKnownLinkObj( $this->mTitle, $t, $q, '', '', " id=\"$id\"" );
                } else {
                        $s = wfMsg( 'notanarticle' );
                }
@@ -1604,11 +1605,9 @@ END;
        }
 
        function moveThisPage() {
-               global $wgTitle;
-
-               if ( $wgTitle->quickUserCan( 'move' ) ) {
+               if ( $this->mTitle->quickUserCan( 'move' ) ) {
                        return $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
-                         wfMsg( 'movethispage' ), 'target=' . $wgTitle->getPrefixedURL() );
+                         wfMsg( 'movethispage' ), 'target=' . $this->mTitle->getPrefixedURL() );
                } else {
                        // no message if page is protected - would be redundant
                        return '';
@@ -1616,25 +1615,19 @@ END;
        }
 
        function historyLink() {
-               global $wgTitle;
-
-               return $this->link( $wgTitle, wfMsg( 'history' ),
+               return $this->link( $this->mTitle, wfMsg( 'history' ),
                        array( 'rel' => 'archives' ), array( 'action' => 'history' ) );
        }
 
        function whatLinksHere() {
-               global $wgTitle;
-
                return $this->makeKnownLinkObj(
-                       SpecialPage::getTitleFor( 'Whatlinkshere', $wgTitle->getPrefixedDBkey() ),
+                       SpecialPage::getTitleFor( 'Whatlinkshere', $this->mTitle->getPrefixedDBkey() ),
                        wfMsg( 'whatlinkshere' ) );
        }
 
        function userContribsLink() {
-               global $wgTitle;
-
                return $this->makeKnownLinkObj(
-                       SpecialPage::getTitleFor( 'Contributions', $wgTitle->getDBkey() ),
+                       SpecialPage::getTitleFor( 'Contributions', $this->mTitle->getDBkey() ),
                        wfMsg( 'contributions' ) );
        }
 
@@ -1646,29 +1639,24 @@ END;
        }
 
        function emailUserLink() {
-               global $wgTitle;
-
                return $this->makeKnownLinkObj(
-                       SpecialPage::getTitleFor( 'Emailuser', $wgTitle->getDBkey() ),
+                       SpecialPage::getTitleFor( 'Emailuser', $this->mTitle->getDBkey() ),
                        wfMsg( 'emailuser' ) );
        }
 
        function watchPageLinksLink() {
-               global $wgOut, $wgTitle;
-
+               global $wgOut;
                if ( ! $wgOut->isArticleRelated() ) {
                        return '(' . wfMsg( 'notanarticle' ) . ')';
                } else {
                        return $this->makeKnownLinkObj(
-                               SpecialPage::getTitleFor( 'Recentchangeslinked', $wgTitle->getPrefixedDBkey() ),
+                               SpecialPage::getTitleFor( 'Recentchangeslinked', $this->mTitle->getPrefixedDBkey() ),
                                wfMsg( 'recentchangeslinked' ) );
                }
        }
 
        function trackbackLink() {
-               global $wgTitle;
-
-               return '<a href="' . $wgTitle->trackbackURL() . '">'
+               return '<a href="' . $this->mTitle->trackbackURL() . '">'
                        . wfMsg( 'trackbacklink' ) . '</a>';
        }
 
@@ -1706,17 +1694,15 @@ END;
        }
 
        function talkLink() {
-               global $wgTitle;
-
-               if ( NS_SPECIAL == $wgTitle->getNamespace() ) {
+               if ( NS_SPECIAL == $this->mTitle->getNamespace() ) {
                        # No discussion links for special pages
                        return '';
                }
 
                $linkOptions = array();
 
-               if( $wgTitle->isTalkPage() ) {
-                       $link = $wgTitle->getSubjectPage();
+               if( $this->mTitle->isTalkPage() ) {
+                       $link = $this->mTitle->getSubjectPage();
                        switch( $link->getNamespace() ) {
                                case NS_MAIN:
                                        $text = wfMsg( 'articlepage' );
@@ -1749,7 +1735,7 @@ END;
                                        $text = wfMsg( 'articlepage' );
                        }
                } else {
-                       $link = $wgTitle->getTalkPage();
+                       $link = $this->mTitle->getTalkPage();
                        $text = wfMsg( 'talkpage' );
                }
 
@@ -1759,21 +1745,21 @@ END;
        }
 
        function commentLink() {
-               global $wgTitle, $wgOut;
+               global $wgOut;
 
-               if ( $wgTitle->getNamespace() == NS_SPECIAL ) {
+               if ( $this->mTitle->getNamespace() == NS_SPECIAL ) {
                        return '';
                }
 
                # __NEWSECTIONLINK___ changes behaviour here
                # If it's present, the link points to this page, otherwise
                # it points to the talk page
-               if( $wgTitle->isTalkPage() ) {
-                       $title = $wgTitle;
+               if( $this->mTitle->isTalkPage() ) {
+                       $title = $this->mTitle;
                } elseif( $wgOut->showNewSectionLink() ) {
-                       $title = $wgTitle;
+                       $title = $this->mTitle;
                } else {
-                       $title = $wgTitle->getTalkPage();
+                       $title = $this->mTitle->getTalkPage();
                }
 
                return $this->makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit&section=new' );
index 526b549..a4e5e2e 100644 (file)
@@ -134,7 +134,7 @@ class SkinTemplate extends Skin {
         * @param $out OutputPage
         */
        function outputPage( OutputPage $out ) {
-               global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang;
+               global $wgArticle, $wgUser, $wgLang, $wgContLang;
                global $wgScript, $wgStylePath, $wgContLanguageCode;
                global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
                global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
@@ -231,7 +231,7 @@ class SkinTemplate extends Skin {
                        $tpl->set( 'feeds', false );
                }
                if( $wgUseTrackbacks && $out->isArticleRelated() ) {
-                       $tpl->set( 'trackbackhtml', $wgTitle->trackbackRDF() );
+                       $tpl->set( 'trackbackhtml', $out->getTitle()->trackbackRDF() );
                } else {
                        $tpl->set( 'trackbackhtml', null );
                }
@@ -488,9 +488,10 @@ class SkinTemplate extends Skin {
         * @private
         */
        function buildPersonalUrls() {
-               global $wgTitle, $wgRequest;
+               global $wgOut, $wgRequest;
 
-               $pageurl = $wgTitle->getLocalURL();
+               $title = $wgOut->getTitle();
+               $pageurl = $title->getLocalURL();
                wfProfileIn( __METHOD__ );
 
                /* set up the default links for the personal toolbar */
@@ -547,7 +548,7 @@ class SkinTemplate extends Skin {
                        $personal_urls['logout'] = array(
                                'text' => wfMsg( 'userlogout' ),
                                'href' => self::makeSpecialUrl( 'Userlogout',
-                                       $wgTitle->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}"
+                                       $title->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}"
                                ),
                                'active' => false
                        );
@@ -575,18 +576,18 @@ class SkinTemplate extends Skin {
                                $personal_urls['anonlogin'] = array(
                                        'text' => wfMsg( $loginlink ),
                                        'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ),
-                                       'active' => $wgTitle->isSpecial( 'Userlogin' )
+                                       'active' => $title->isSpecial( 'Userlogin' )
                                );
                        } else {
                                $personal_urls['login'] = array(
                                        'text' => wfMsg( $loginlink ),
                                        'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ),
-                                       'active' => $wgTitle->isSpecial( 'Userlogin' )
+                                       'active' => $title->isSpecial( 'Userlogin' )
                                );
                        }
                }
-
-               wfRunHooks( 'PersonalUrls', array( &$personal_urls, &$wgTitle ) );
+               
+               wfRunHooks( 'PersonalUrls', array( &$personal_urls, &$title ) );
                wfProfileOut( __METHOD__ );
                return $personal_urls;
        }
@@ -848,7 +849,7 @@ class SkinTemplate extends Skin {
         * @private
         */
        function buildNavUrls() {
-               global $wgUseTrackbacks, $wgTitle, $wgUser, $wgRequest;
+               global $wgUseTrackbacks, $wgOut, $wgUser, $wgRequest;
                global $wgEnableUploads, $wgUploadNavigationUrl;
 
                wfProfileIn( __METHOD__ );
@@ -886,7 +887,7 @@ class SkinTemplate extends Skin {
                        if ( $this->mRevisionId ) {
                                $nav_urls['permalink'] = array(
                                        'text' => wfMsg( 'permalink' ),
-                                       'href' => $wgTitle->getLocalURL( "oldid=$this->mRevisionId" )
+                                       'href' => $wgOut->getTitle()->getLocalURL( "oldid=$this->mRevisionId" )
                                );
                        }
 
@@ -910,7 +911,7 @@ class SkinTemplate extends Skin {
                        }
                        if( $wgUseTrackbacks )
                                $nav_urls['trackbacklink'] = array(
-                                       'href' => $wgTitle->trackbackURL()
+                                       'href' => $wgOut->getTitle()->trackbackURL()
                                );
                }
 
@@ -1088,10 +1089,10 @@ class QuickTemplate {
         * @private
         */
        function msgWiki( $str ) {
-               global $wgParser, $wgTitle, $wgOut;
+               global $wgParser, $wgOut;
 
                $text = $this->translator->translate( $str );
-               $parserOutput = $wgParser->parse( $text, $wgTitle,
+               $parserOutput = $wgParser->parse( $text, $wgOut->getTitle(),
                        $wgOut->parserOptions(), true );
                echo $parserOutput->getText();
        }
index 38f19c9..24a9955 100644 (file)
@@ -52,6 +52,9 @@ class MediaWiki {
         */
        function initialize( &$title, &$article, &$output, &$user, $request ) {
                wfProfileIn( __METHOD__ );
+               
+               $output->setTitle( $title );
+               
                if( !$this->preliminaryChecks( $title, $output, $request ) ) {
                        wfProfileOut( __METHOD__ );
                        return;
index 4fdffc1..21bc1dc 100644 (file)
@@ -123,11 +123,11 @@ class SkinCologneBlue extends Skin {
        }
 
        function sysLinks() {
-               global $wgUser, $wgLang, $wgContLang, $wgTitle;
+               global $wgUser, $wgLang, $wgContLang, $wgOut;
                $li = $wgContLang->specialPage( 'Userlogin' );
                $lo = $wgContLang->specialPage( 'Userlogout' );
 
-               $rt = $wgTitle->getPrefixedURL();
+               $rt = $wgOut->getTitle()->getPrefixedURL();
                if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
                        $q = '';
                } else {
@@ -163,9 +163,9 @@ class SkinCologneBlue extends Skin {
         * @access private
         */
        function quickBar(){
-               global $wgOut, $wgTitle, $wgUser, $wgEnableUploads;
+               global $wgOut, $wgUser, $wgEnableUploads;
 
-               $tns = $wgTitle->getNamespace();
+               $tns = $wgOut->getTitle()->getNamespace();
 
                $s = "\n<div id='quickbar'>";
 
@@ -228,7 +228,7 @@ class SkinCologneBlue extends Skin {
                          . $sep . $this->watchPageLinksLink();
 
                        if( $tns == NS_USER || $tns == NS_USER_TALK ) {
-                               $id = User::idFromName( $wgTitle->getText() );
+                               $id = User::idFromName( $wgOut->getTitle()->getText() );
                                if( $id != 0 ) {
                                        $s .= $sep . $this->userContribsLink();
                                        if( $this->showEmailUser( $id ) ) {
index 3da5645..5c0cc5e 100644 (file)
@@ -130,14 +130,14 @@ class SkinStandard extends Skin {
        }
 
        function quickBar() {
-               global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang;
+               global $wgOut, $wgUser, $wgRequest, $wgContLang;
                global $wgEnableUploads, $wgRemoteUploads;
 
                wfProfileIn( __METHOD__ );
 
                $action = $wgRequest->getText( 'action' );
                $wpPreview = $wgRequest->getBool( 'wpPreview' );
-               $tns = $wgTitle->getNamespace();
+               $tns = $wgOut->getTitle()->getNamespace();
 
                $s = "\n<div id='quickbar'>";
                $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
@@ -165,7 +165,7 @@ class SkinStandard extends Skin {
                }
                // only show watchlist link if logged in
                $s .= "\n<hr class='sep' />";
-               $articleExists = $wgTitle->getArticleId();
+               $articleExists = $wgOut->getTitle()->getArticleId();
                if ( $wgOut->isArticle() || $action == 'edit' || $action == 'history' || $wpPreview ) {
                        if( $wgOut->isArticle() ) {
                                $s .= '<strong>' . $this->editThisPage() . '</strong>';
@@ -210,13 +210,13 @@ class SkinStandard extends Skin {
                                                        $text = wfMsg( 'articlepage' );
                                        }
 
-                                       $link = $wgTitle->getText();
+                                       $link = $wgOut->getTitle()->getText();
                                        if( $nstext = $wgContLang->getNsText( $tns ) ) { # add namespace if necessary
                                                $link = $nstext . ':' . $link;
                                        }
 
                                        $s .= $this->makeLink( $link, $text );
-                               } elseif( $wgTitle->getNamespace() != NS_SPECIAL ) {
+                               } elseif( $wgOut->getTitle()->getNamespace() != NS_SPECIAL ) {
                                        # we just throw in a "New page" text to tell the user that he's in edit mode,
                                        # and to avoid messing with the separator that is prepended to the next item
                                        $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>';
@@ -225,8 +225,8 @@ class SkinStandard extends Skin {
                        }
 
                        # "Post a comment" link
-                       if( ( $wgTitle->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
-                               $s .= '<br />' . $this->makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit&section=new' );
+                       if( ( $wgOut->getTitle()->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
+                               $s .= '<br />' . $this->makeKnownLinkObj( $wgOut->getTitle(), wfMsg( 'postcomment' ), 'action=edit&section=new' );
                        
                        #if( $tns%2 && $action!='edit' && !$wpPreview) {
                                #$s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit&section=new');
@@ -242,7 +242,7 @@ class SkinStandard extends Skin {
                                if( $action != 'edit' && $action != 'submit' ){
                                        $s .= $sep . $this->watchThisPage();
                                }
-                               if ( $wgTitle->userCan( 'edit' ) )
+                               if ( $wgOut->getTitle()->userCan( 'edit' ) )
                                        $s .= $sep . $this->moveThisPage();
                        }
                        if ( $wgUser->isAllowed( 'delete' ) and $articleExists ) {
@@ -259,11 +259,11 @@ class SkinStandard extends Skin {
                                $s .= $sep . $this->watchPageLinksLink();
                        }
 
-                       if ( NS_USER == $wgTitle->getNamespace()
-                               || $wgTitle->getNamespace() == NS_USER_TALK ) {
+                       if ( NS_USER == $wgOut->getTitle()->getNamespace()
+                               || $wgOut->getTitle()->getNamespace() == NS_USER_TALK ) {
 
-                               $id = User::idFromName( $wgTitle->getText() );
-                               $ip = User::isIP( $wgTitle->getText() );
+                               $id = User::idFromName( $wgOut->getTitle()->getText() );
+                               $ip = User::isIP( $wgOut->getTitle()->getText() );
 
                                if( $id || $ip ){
                                        $s .= $sep . $this->userContribsLink();