First round of war on $wgTitle. Don't use it in Special Pages. We've got SpecialPage...
authorChad Horohoe <demon@users.mediawiki.org>
Tue, 7 Apr 2009 16:33:12 +0000 (16:33 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Tue, 7 Apr 2009 16:33:12 +0000 (16:33 +0000)
13 files changed:
includes/specials/SpecialAllmessages.php
includes/specials/SpecialContributions.php
includes/specials/SpecialDeletedContributions.php
includes/specials/SpecialFilepath.php
includes/specials/SpecialImport.php
includes/specials/SpecialIpblocklist.php
includes/specials/SpecialListUserRestrictions.php
includes/specials/SpecialMIMEsearch.php
includes/specials/SpecialPreferences.php
includes/specials/SpecialRemoveRestrictions.php
includes/specials/SpecialRestrictUser.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialWhatlinkshere.php

index 38181c0..f141d96 100644 (file)
@@ -9,7 +9,7 @@
  * Constructor.
  */
 function wfSpecialAllmessages() {
-       global $wgOut, $wgRequest, $wgMessageCache, $wgTitle;
+       global $wgOut, $wgRequest, $wgMessageCache;
        global $wgUseDatabaseMessages, $wgLang;
 
        # The page isn't much use if the MediaWiki namespace is not being used
@@ -47,12 +47,13 @@ function wfSpecialAllmessages() {
 
        wfProfileIn( __METHOD__ . '-output' );
        $wgOut->addScriptFile( 'allmessages.js' );
+       $title = SpecialPage::getTitleFor( 'Allmessages' );
        if ( $ot == 'php' ) {
                $navText .= wfAllMessagesMakePhp( $messages );
                $wgOut->addHTML( $wgLang->pipeList( array(
                        'PHP',
-                       '<a href="' . $wgTitle->escapeLocalUrl( 'ot=html' ) . '">HTML</a>',
-                       '<a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' .
+                       '<a href="' . $title->escapeLocalUrl( 'ot=html' ) . '">HTML</a>',
+                       '<a href="' . $title->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' .
                        '<pre>' . htmlspecialchars( $navText ) . '</pre>'
                ) ) );
        } else if ( $ot == 'xml' ) {
@@ -61,9 +62,9 @@ function wfSpecialAllmessages() {
                echo wfAllMessagesMakeXml( $messages );
        } else {
                $wgOut->addHTML( $wgLang->pipeList( array(
-                       '<a href="' . $wgTitle->escapeLocalUrl( 'ot=php' ) . '">PHP</a>',
+                       '<a href="' . $title->escapeLocalUrl( 'ot=php' ) . '">PHP</a>',
                        'HTML',
-                       '<a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>'
+                       '<a href="' . $title->escapeLocalUrl( 'ot=xml' ) . '">XML</a>'
                ) ) );
                $wgOut->addWikiText( $navText );
                $wgOut->addHTML( wfAllMessagesMakeHTMLText( $messages ) );
index 7be4950..5fbd436 100644 (file)
@@ -203,9 +203,9 @@ class SpecialContributions extends SpecialPage {
         * @param $this->opts Array: the options to be included.
         */
        protected function getForm() {
-               global $wgScript, $wgTitle;
+               global $wgScript;
        
-               $this->opts['title'] = $wgTitle->getPrefixedText();
+               $this->opts['title'] = SpecialPage::getTitleFor( 'Contributions' )->getPrefixedText();
                if( !isset( $this->opts['target'] ) ) {
                        $this->opts['target'] = '';
                } else {
index 70f701d..55dd43e 100644 (file)
@@ -333,9 +333,9 @@ class DeletedContributionsPage extends SpecialPage {
         * @param $options Array: the options to be included.
         */
        function getForm( $options ) {
-               global $wgScript, $wgTitle, $wgRequest;
+               global $wgScript, $wgRequest;
 
-               $options['title'] = $wgTitle->getPrefixedText();
+               $options['title'] = SpecialPage::getTitleFor( 'DeletedContributions' )->getPrefixedText();
                if ( !isset( $options['target'] ) ) {
                        $options['target'] = '';
                } else {
index 4a724b1..8bc1c68 100644 (file)
@@ -37,13 +37,13 @@ class FilepathForm {
        }
 
        function execute() {
-               global $wgOut, $wgTitle, $wgScript;
+               global $wgOut, $wgScript;
 
                $wgOut->addHTML(
                        Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'specialfilepath' ) ) .
                        Xml::openElement( 'fieldset' ) .
                        Xml::element( 'legend', null, wfMsg( 'filepath' ) ) .
-                       Xml::hidden( 'title', $wgTitle->getPrefixedText() ) .
+                       Xml::hidden( 'title', SpecialPage::getTitleFor( 'Filepath' )->getPrefixedText() ) .
                        Xml::inputLabel( wfMsg( 'filepath-page' ), 'file', 'file', 25, is_object( $this->mTitle ) ? $this->mTitle->getText() : '' ) . ' ' .
                        Xml::submitButton( wfMsg( 'filepath-submit' ) ) . "\n" .
                        Xml::closeElement( 'fieldset' ) .
index 457e03b..c8f15ae 100644 (file)
@@ -132,11 +132,11 @@ class SpecialImport extends SpecialPage {
        }
 
        private function showForm() {
-               global $wgUser, $wgOut, $wgRequest, $wgTitle, $wgImportSources, $wgExportMaxLinkDepth;
+               global $wgUser, $wgOut, $wgRequest, $wgImportSources, $wgExportMaxLinkDepth;
                if( !$wgUser->isAllowed( 'import' ) && !$wgUser->isAllowed( 'importupload' ) )
                        return $wgOut->permissionRequired( 'import' );
 
-               $action = $wgTitle->getLocalUrl( 'action=submit' );
+               $action = SpecialPage::getTitleFor( 'Import' )->getLocalUrl( 'action=submit' );
 
                if( $wgUser->isAllowed( 'importupload' ) ) {
                        $wgOut->addWikiMsg( "importtext" );
index 004a6e8..ae808e3 100644 (file)
@@ -306,7 +306,7 @@ class IPUnblockForm {
        }
 
        function searchForm() {
-               global $wgTitle, $wgScript, $wgRequest, $wgLang;
+               global $wgScript, $wgRequest, $wgLang;
 
                $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) );
                $nondefaults = array();
@@ -334,7 +334,7 @@ class IPUnblockForm {
 
                return
                        Xml::tags( 'form', array( 'action' => $wgScript ),
-                               Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() ) .
+                               Xml::hidden( 'title', SpecialPage::getTitleFor( 'Ipblocklist' )->getPrefixedDbKey() ) .
                                Xml::openElement( 'fieldset' ) .
                                Xml::element( 'legend', null, wfMsg( 'ipblocklist-legend' ) ) .
                                Xml::inputLabel( wfMsg( 'ipblocklist-username' ), 'ip', 'ip', /* size */ false, $this->ip ) .
index 98e7111..eacc810 100644 (file)
@@ -23,12 +23,12 @@ function wfSpecialListUserRestrictions() {
 
 class SpecialListUserRestrictionsForm {
        public function getHTML() {
-               global $wgRequest, $wgScript, $wgTitle;
+               global $wgRequest, $wgScript;
                $action = htmlspecialchars( $wgScript );
                $s = '';
                $s .= Xml::fieldset( wfMsg( 'listuserrestrictions-legend' ) );
                $s .= "<form action=\"{$action}\">";
-               $s .= Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() );
+               $s .= Xml::hidden( 'title', SpecialPage::getTitleFor('ListUserRestrictions')->getPrefixedDbKey() );
                $s .= Xml::label( wfMsgHtml( 'listuserrestrictions-type' ), 'type' ) . '&nbsp;' .
                        self::typeSelector( 'type', $wgRequest->getVal( 'type' ), 'type' );
                $s .= '&nbsp;';
index cdfde24..4672b0a 100644 (file)
@@ -83,12 +83,12 @@ class MIMEsearchPage extends QueryPage {
  * Output the HTML search form, and constructs the MIMEsearchPage object.
  */
 function wfSpecialMIMEsearch( $par = null ) {
-       global $wgRequest, $wgTitle, $wgOut;
+       global $wgRequest, $wgOut;
 
        $mime = isset( $par ) ? $par : $wgRequest->getText( 'mime' );
 
        $wgOut->addHTML(
-               Xml::openElement( 'form', array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => $wgTitle->getLocalUrl() ) ) .
+               Xml::openElement( 'form', array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => SpecialPage::getTitleFor( 'MIMEsearch' )->getLocalUrl() ) ) .
                Xml::openElement( 'fieldset' ) .
                Xml::element( 'legend', null, wfMsg( 'mimesearch' ) ) .
                Xml::inputLabel( wfMsg( 'mimetype' ), 'mime', 'mime', 20, $mime ) . ' ' .
index f4a42ef..e40e83e 100644 (file)
@@ -104,10 +104,11 @@ class PreferencesForm {
        }
 
        function execute() {
-               global $wgUser, $wgOut, $wgTitle;
+               global $wgUser, $wgOut;
 
                if ( $wgUser->isAnon() ) {
-                       $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext', array($wgTitle->getPrefixedDBkey()) );
+                       $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext', 
+                                               array( SpecialPage::getTitleFor( 'Preferences' )->getPrefixedDBkey() ) );
                        return;
                }
                if ( wfReadOnly() ) {
index ded6cbe..75645e7 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
 function wfSpecialRemoveRestrictions() {
-       global $wgOut, $wgRequest, $wgUser, $wgLang, $wgTitle;
+       global $wgOut, $wgRequest, $wgUser, $wgLang;
        $sk = $wgUser->getSkin();
-
+       $title = SpecialPage::getTitleFor( 'RemoveRestrictions' );
        $id = $wgRequest->getVal( 'id' );
        if( !is_numeric( $id ) ) {
                $wgOut->addWikiMsg( 'removerestrictions-noid' );
@@ -36,11 +36,11 @@ function wfSpecialRemoveRestrictions() {
        if( $result )
                $wgOut->addHTML( '<strong class="success">' . wfMsgExt( 'removerestrictions-success',
                        'parseinline', $r->getSubjectText() ) . '</strong>' );
-       $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => $wgTitle->getLocalUrl( array( 'id' => $id ) ),
+       $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => $title->getLocalUrl( array( 'id' => $id ) ),
                'method' => 'post' ) ) );
        $wgOut->addHTML( Xml::buildForm( $form, 'removerestrictions-submit' ) );
        $wgOut->addHTML( Xml::hidden( 'id', $r->getId() ) );
-       $wgOut->addHTML( Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() ) );
+       $wgOut->addHTML( Xml::hidden( 'title', $title->getPrefixedDbKey() ) );
        $wgOut->addHTML( Xml::hidden( 'edittoken', $wgUser->editToken() ) );
        $wgOut->addHTML( "</form></fieldset>" );
 }
index b946cde..361cd91 100644 (file)
@@ -36,12 +36,12 @@ function wfSpecialRestrictUser( $par = null ) {
 
 class RestrictUserForm {
        public static function selectUserForm( $val = null, $error = null ) {
-               global $wgScript, $wgTitle;
+               global $wgScript;
                $action = htmlspecialchars( $wgScript );
                $s  = Xml::fieldset( wfMsg( 'restrictuser-userselect' ) ) . "<form action=\"{$action}\">";
                if( $error )
                        $s .= '<p>' . $error . '</p>';
-               $s .= Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() );
+               $s .= Xml::hidden( 'title', SpecialPage::getTitleFor( 'RestrictUser' )->getPrefixedDbKey() );
                $form = array( 'restrictuser-user' => Xml::input( 'user', false, $val ) );
                $s .= Xml::buildForm( $form, 'restrictuser-go' );
                $s .= "</form></fieldset>";
@@ -59,7 +59,7 @@ class RestrictUserForm {
        }
 
        public static function pageRestrictionForm( $uid, $user, $oldRestrictions ) {
-               global $wgOut, $wgTitle, $wgRequest, $wgUser;
+               global $wgOut, $wgRequest, $wgUser;
                $error = '';
                $success = false;
                if( $wgRequest->wasPosted() && $wgRequest->getVal( 'type' ) == UserRestriction::PAGE &&
@@ -86,7 +86,7 @@ class RestrictUserForm {
 
                self::printSuccessError( $success, $error );
 
-               $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => $wgTitle->getLocalUrl(),
+               $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => SpecialPage::getTitleFor( 'RestrictUser' )->getLocalUrl(),
                        'method' => 'post' ) ) );
                $wgOut->addHTML( Xml::hidden( 'type', UserRestriction::PAGE ) );
                $wgOut->addHTML( Xml::hidden( 'edittoken', $wgUser->editToken() ) );
@@ -130,7 +130,7 @@ class RestrictUserForm {
        }
 
        public static function namespaceRestrictionForm( $uid, $user, $oldRestrictions ) {
-               global $wgOut, $wgTitle, $wgRequest, $wgUser, $wgContLang;
+               global $wgOut, $wgRequest, $wgUser, $wgContLang;
                $error = '';
                $success = false;
                if( $wgRequest->wasPosted() && $wgRequest->getVal( 'type' ) == UserRestriction::NAMESPACE &&
@@ -154,7 +154,7 @@ class RestrictUserForm {
 
                self::printSuccessError( $success, $error );
 
-               $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => $wgTitle->getLocalUrl(),
+               $wgOut->addHTML( Xml::openElement( 'form', array( 'action' => SpecialPage::getTitleFor( 'RestrictUser' )->getLocalUrl(),
                        'method' => 'post' ) ) );
                $wgOut->addHTML( Xml::hidden( 'type', UserRestriction::NAMESPACE ) );
                $wgOut->addHTML( Xml::hidden( 'edittoken', $wgUser->editToken() ) );
index 3bc8709..bf70c1d 100644 (file)
@@ -659,7 +659,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         * @returns string
         */
        private function fileLine( $file ) {
-               global $wgLang, $wgTitle;
+               global $wgLang;
 
                $target = $this->page->getPrefixedText();
                $date = $wgLang->timeanddate( $file->getTimestamp(), true  );
@@ -671,7 +671,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        if( !$file->userCan(File::DELETED_FILE) ) {
                                $pageLink = $date;
                        } else {
-                               $pageLink = $this->skin->makeKnownLinkObj( $wgTitle, $date,
+                               $pageLink = $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Revisiondelete' ), $date,
                                        "target=$target&file=$file->sha1.".$file->getExtension() );
                        }
                        $pageLink = '<span class="history-deleted">' . $pageLink . '</span>';
index 3f485bd..be00852 100644 (file)
@@ -346,7 +346,7 @@ class WhatLinksHerePage {
        }
 
        function whatlinkshereForm() {
-               global $wgScript, $wgTitle;
+               global $wgScript;
 
                // We get nicer value from the title object
                $this->opts->consumeValue( 'target' );
@@ -360,7 +360,7 @@ class WhatLinksHerePage {
                $f = Xml::openElement( 'form', array( 'action' => $wgScript ) );
                
                # Values that should not be forgotten
-               $f .= Xml::hidden( 'title', $wgTitle->getPrefixedText() );
+               $f .= Xml::hidden( 'title', SpecialPage::getTitleFor( 'Whatlinkshere' )->getPrefixedText() );
                foreach ( $this->opts->getUnconsumedValues() as $name => $value ) {
                        $f .= Xml::hidden( $name, $value );
                }