From: Chad Horohoe Date: Tue, 7 Apr 2009 16:33:12 +0000 (+0000) Subject: First round of war on $wgTitle. Don't use it in Special Pages. We've got SpecialPage... X-Git-Tag: 1.31.0-rc.0~42201 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=8b88d701b54af8a2b2bb8191321b592df8c07d44;p=lhc%2Fweb%2Fwiklou.git First round of war on $wgTitle. Don't use it in Special Pages. We've got SpecialPage::getTitleFor() which returns the localized title 100% of the time. Use that. --- diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index 38181c0827..f141d96cb5 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -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', - 'HTML', - 'XML' . + 'HTML', + 'XML' . '
' . htmlspecialchars( $navText ) . '
' ) ) ); } else if ( $ot == 'xml' ) { @@ -61,9 +62,9 @@ function wfSpecialAllmessages() { echo wfAllMessagesMakeXml( $messages ); } else { $wgOut->addHTML( $wgLang->pipeList( array( - 'PHP', + 'PHP', 'HTML', - 'XML' + 'XML' ) ) ); $wgOut->addWikiText( $navText ); $wgOut->addHTML( wfAllMessagesMakeHTMLText( $messages ) ); diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 7be49500ad..5fbd436e26 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -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 { diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 70f701d569..55dd43e477 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -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 { diff --git a/includes/specials/SpecialFilepath.php b/includes/specials/SpecialFilepath.php index 4a724b1f35..8bc1c68bba 100644 --- a/includes/specials/SpecialFilepath.php +++ b/includes/specials/SpecialFilepath.php @@ -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' ) . diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 457e03b4d8..c8f15ae1d0 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -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" ); diff --git a/includes/specials/SpecialIpblocklist.php b/includes/specials/SpecialIpblocklist.php index 004a6e8c96..ae808e3d5c 100644 --- a/includes/specials/SpecialIpblocklist.php +++ b/includes/specials/SpecialIpblocklist.php @@ -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 ) . diff --git a/includes/specials/SpecialListUserRestrictions.php b/includes/specials/SpecialListUserRestrictions.php index 98e7111f1f..eacc810299 100644 --- a/includes/specials/SpecialListUserRestrictions.php +++ b/includes/specials/SpecialListUserRestrictions.php @@ -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 .= "
"; - $s .= Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() ); + $s .= Xml::hidden( 'title', SpecialPage::getTitleFor('ListUserRestrictions')->getPrefixedDbKey() ); $s .= Xml::label( wfMsgHtml( 'listuserrestrictions-type' ), 'type' ) . ' ' . self::typeSelector( 'type', $wgRequest->getVal( 'type' ), 'type' ); $s .= ' '; diff --git a/includes/specials/SpecialMIMEsearch.php b/includes/specials/SpecialMIMEsearch.php index cdfde24ea5..4672b0a3ad 100644 --- a/includes/specials/SpecialMIMEsearch.php +++ b/includes/specials/SpecialMIMEsearch.php @@ -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 ) . ' ' . diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php index f4a42ef48d..e40e83ec48 100644 --- a/includes/specials/SpecialPreferences.php +++ b/includes/specials/SpecialPreferences.php @@ -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() ) { diff --git a/includes/specials/SpecialRemoveRestrictions.php b/includes/specials/SpecialRemoveRestrictions.php index ded6cbe3d7..75645e70d7 100644 --- a/includes/specials/SpecialRemoveRestrictions.php +++ b/includes/specials/SpecialRemoveRestrictions.php @@ -1,9 +1,9 @@ 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( '' . wfMsgExt( 'removerestrictions-success', 'parseinline', $r->getSubjectText() ) . '' ); - $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( "
" ); } diff --git a/includes/specials/SpecialRestrictUser.php b/includes/specials/SpecialRestrictUser.php index b946cde83e..361cd91440 100644 --- a/includes/specials/SpecialRestrictUser.php +++ b/includes/specials/SpecialRestrictUser.php @@ -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' ) ) . "
"; if( $error ) $s .= '

' . $error . '

'; - $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 .= "
"; @@ -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() ) ); diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 3bc8709c98..bf70c1d373 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -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 = '' . $pageLink . ''; diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index 3f485bd8ac..be008525c6 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -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 ); }