r98270 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98269‎ | r98270 | r98271 >
Date:21:51, 27 September 2011
Author:aaron
Status:deferred
Tags:
Comment:
* Use getOutput() instead of $wgOut
* Use getRequest() instead of $wgRequest
* Renamed getRequest() account function to avoid conflict with parent
* Removed excess entry guards
Modified paths:
  • /trunk/extensions/ConfirmAccount/presentation/specialpages/actions/ConfirmAccount_body.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/presentation/specialpages/actions/UserCredentials_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/UserCredentials_body.php
@@ -1,25 +1,27 @@
22 <?php
33
4 -class UserCredentialsPage extends SpecialPage
5 -{
 4+class UserCredentialsPage extends SpecialPage {
 5+
66 function __construct() {
77 parent::__construct( 'UserCredentials', 'lookupcredentials' );
88 }
99
1010 function execute( $par ) {
11 - global $wgRequest, $wgOut, $wgUser, $wgAccountRequestTypes;
 11+ global $wgUser, $wgAccountRequestTypes;
 12+ $out = $this->getOutput();
 13+ $request = $this->getRequest();
1214
1315 if ( !$wgUser->isAllowed( 'lookupcredentials' ) ) {
14 - $wgOut->permissionRequired( 'lookupcredentials' );
 16+ $out->permissionRequired( 'lookupcredentials' );
1517 return;
1618 }
1719
1820 $this->setHeaders();
1921
2022 # A target user
21 - $this->target = $wgRequest->getText( 'target' );
 23+ $this->target = $request->getText( 'target' );
2224 # Attachments
23 - $this->file = $wgRequest->getVal( 'file' );
 25+ $this->file = $request->getVal( 'file' );
2426
2527 $this->skin = $wgUser->getSkin();
2628
@@ -31,11 +33,12 @@
3234 } else {
3335 $this->showForm();
3436 }
35 - $wgOut->addModules( 'ext.confirmAccount' ); // CSS
 37+ $out->addModules( 'ext.confirmAccount' ); // CSS
3638 }
3739
3840 function showForm() {
39 - global $wgOut, $wgScript;
 41+ global $wgScript;
 42+ $out = $this->getOutput();
4043
4144 $username = str_replace( '_', ' ', $this->target );
4245 $form = Xml::openElement( 'form', array( 'name' => 'stablization', 'action' => $wgScript, 'method' => 'get' ) );
@@ -48,21 +51,22 @@
4952 $form .= "</tr></table>";
5053 $form .= "</fieldset></form>\n";
5154
52 - $wgOut->addHTML( $form );
 55+ $out->addHTML( $form );
5356 }
5457
5558 function showCredentials() {
56 - global $wgOut, $wgUser, $wgLang, $wgAccountRequestTypes;
 59+ global $wgUser, $wgLang, $wgAccountRequestTypes;
 60+ $out = $this->getOutput();
5761
5862 $titleObj = SpecialPage::getTitleFor( 'UserCredentials' );
5963
6064 $row = $this->getRequest();
6165 if ( !$row ) {
62 - $wgOut->addHTML( wfMsgHtml( 'usercredentials-badid' ) );
 66+ $out->addHTML( wfMsgHtml( 'usercredentials-badid' ) );
6367 return;
6468 }
6569
66 - $wgOut->addWikiText( wfMsg( "usercredentials-text" ) );
 70+ $out->addWikiText( wfMsg( "usercredentials-text" ) );
6771
6872 $user = User::newFromName( $this->target );
6973
@@ -161,7 +165,7 @@
162166 }
163167 $form .= '</fieldset>';
164168
165 - $wgOut->addHTML( $form );
 169+ $out->addHTML( $form );
166170 }
167171
168172 /**
@@ -181,16 +185,19 @@
182186 * Show a private file requested by the visitor.
183187 */
184188 function showFile( $key ) {
185 - global $wgOut, $wgRequest, $wgConfirmAccountFSRepos, $IP;
186 - $wgOut->disable();
 189+ global $wgConfirmAccountFSRepos, $IP;
 190+ $out = $this->getOutput();
 191+ $request = $this->getRequest();
187192
 193+ $out->disable();
 194+
188195 # We mustn't allow the output to be Squid cached, otherwise
189196 # if an admin previews a private image, and it's cached, then
190197 # a user without appropriate permissions can toddle off and
191198 # nab the image, and Squid will serve it
192 - $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
193 - $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
194 - $wgRequest->response()->header( 'Pragma: no-cache' );
 199+ $request->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
 200+ $request->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
 201+ $request->response()->header( 'Pragma: no-cache' );
195202
196203 require_once( "$IP/includes/StreamFile.php" );
197204 $repo = new FSRepo( $wgConfirmAccountFSRepos['accountcreds'] );
Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php
@@ -1,10 +1,5 @@
22 <?php
33
4 -if ( !defined( 'MEDIAWIKI' ) ) {
5 - echo "ConfirmAccount extension\n";
6 - exit( 1 );
7 -}
8 -
94 class RequestAccountPage extends SpecialPage {
105
116 function __construct() {
@@ -12,39 +7,42 @@
138 }
149
1510 function execute( $par ) {
16 - global $wgUser, $wgOut, $wgRequest, $wgUseRealNamesOnly,
 11+ global $wgUser, $wgUseRealNamesOnly,
1712 $wgAccountRequestToS, $wgAccountRequestExtraInfo, $wgAccountRequestTypes;
1813 # If a user cannot make accounts, don't let them request them either
1914 global $wgAccountRequestWhileBlocked;
 15+
 16+ $request = $this->getRequest();
 17+ $out = $this->getOutput();
2018 if ( !$wgAccountRequestWhileBlocked && $wgUser->isBlockedFromCreateAccount() ) {
21 - $wgOut->blockedPage();
 19+ $out->blockedPage();
2220 return;
2321 }
2422 if ( wfReadOnly() ) {
25 - $wgOut->readOnlyPage();
 23+ $out->readOnlyPage();
2624 return;
2725 }
2826
2927 $this->setHeaders();
3028
31 - $this->mRealName = trim( $wgRequest->getText( 'wpRealName' ) );
 29+ $this->mRealName = trim( $request->getText( 'wpRealName' ) );
3230 # We may only want real names being used
33 - $this->mUsername = $wgUseRealNamesOnly ? $this->mRealName : $wgRequest->getText( 'wpUsername' );
 31+ $this->mUsername = $wgUseRealNamesOnly ? $this->mRealName : $request->getText( 'wpUsername' );
3432 $this->mUsername = trim( $this->mUsername );
3533 # Attachments...
36 - $this->initializeUpload( $wgRequest );
37 - $this->mPrevAttachment = $wgRequest->getText( 'attachment' );
38 - $this->mForgotAttachment = $wgRequest->getBool( 'forgotAttachment' );
 34+ $this->initializeUpload( $request );
 35+ $this->mPrevAttachment = $request->getText( 'attachment' );
 36+ $this->mForgotAttachment = $request->getBool( 'forgotAttachment' );
3937 # Other fields...
40 - $this->mEmail = trim( $wgRequest->getText( 'wpEmail' ) );
41 - $this->mBio = $wgRequest->getText( 'wpBio', '' );
 38+ $this->mEmail = trim( $request->getText( 'wpEmail' ) );
 39+ $this->mBio = $request->getText( 'wpBio', '' );
4240 $this->mNotes = $wgAccountRequestExtraInfo ?
43 - $wgRequest->getText( 'wpNotes', '' ) : '';
 41+ $request->getText( 'wpNotes', '' ) : '';
4442 $this->mUrls = $wgAccountRequestExtraInfo ?
45 - $wgRequest->getText( 'wpUrls', '' ) : '';
 43+ $request->getText( 'wpUrls', '' ) : '';
4644 $this->mToS = $wgAccountRequestToS ?
47 - $wgRequest->getBool( 'wpToS' ) : false;
48 - $this->mType = $wgRequest->getInt( 'wpType' );
 45+ $request->getBool( 'wpToS' ) : false;
 46+ $this->mType = $request->getInt( 'wpType' );
4947 $this->mType = isset( $wgAccountRequestTypes[$this->mType] ) ? $this->mType : 0;
5048 # Load areas user plans to be active in...
5149 $this->mAreas = $this->mAreaSet = array();
@@ -54,7 +52,7 @@
5553 $set = explode( "|", $area, 2 );
5654 if ( $set[0] && isset( $set[1] ) ) {
5755 $formName = "wpArea-" . htmlspecialchars( str_replace( ' ', '_', $set[0] ) );
58 - $this->mAreas[$formName] = $wgRequest->getInt( $formName, - 1 );
 56+ $this->mAreas[$formName] = $request->getInt( $formName, - 1 );
5957 # Make a simple list of interests
6058 if ( $this->mAreas[$formName] > 0 )
6159 $this->mAreaSet[] = str_replace( '_', ' ', $set[0] );
@@ -62,12 +60,12 @@
6361 }
6462 }
6563 # We may be confirming an email address here
66 - $emailCode = $wgRequest->getText( 'wpEmailToken' );
 64+ $emailCode = $request->getText( 'wpEmailToken' );
6765
6866 $this->skin = $wgUser->getSkin();
6967
70 - $action = $wgRequest->getVal( 'action' );
71 - if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
 68+ $action = $request->getVal( 'action' );
 69+ if ( $request->wasPosted() && $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
7270 $this->mPrevAttachment = $this->mPrevAttachment ? $this->mPrevAttachment : $this->mSrcName;
7371 $this->doSubmit();
7472 } elseif ( $action == 'confirmemail' ) {
@@ -75,27 +73,28 @@
7674 } else {
7775 $this->showForm();
7876 }
79 - $wgOut->addModules( 'ext.confirmAccount' ); // CSS
 77+ $out->addModules( 'ext.confirmAccount' ); // CSS
8078 }
8179
8280 protected function showForm( $msg = '', $forgotFile = 0 ) {
83 - global $wgOut, $wgUser, $wgUseRealNamesOnly, $wgAllowRealName;
 81+ global $wgUser, $wgUseRealNamesOnly, $wgAllowRealName;
8482 global $wgAccountRequestToS, $wgAccountRequestTypes, $wgAccountRequestExtraInfo,
8583 $wgAllowAccountRequestFiles, $wgMakeUserPageFromBio;
8684
8785 $this->mForgotAttachment = $forgotFile;
8886
89 - $wgOut->setPagetitle( wfMsgHtml( "requestaccount" ) );
 87+ $out = $this->getOutput();
 88+ $out->setPagetitle( wfMsgHtml( "requestaccount" ) );
9089 # Output failure message if any
9190 if ( $msg ) {
92 - $wgOut->addHTML( '<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>' );
 91+ $out->addHTML( '<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>' );
9392 }
9493 # Give notice to users that are logged in
9594 if ( $wgUser->getID() ) {
96 - $wgOut->addWikiMsg( 'requestaccount-dup' );
 95+ $out->addWikiMsg( 'requestaccount-dup' );
9796 }
9897
99 - $wgOut->addWikiMsg( 'requestaccount-text' );
 98+ $out->addWikiMsg( 'requestaccount-text' );
10099
101100 $form = Xml::openElement( 'form', array( 'method' => 'post', 'name' => 'accountrequest',
102101 'action' => $this->getTitle()->getLocalUrl(), 'enctype' => 'multipart/form-data' ) );
@@ -215,13 +214,14 @@
216215 $form .= "<p>" . Xml::submitButton( wfMsgHtml( 'requestaccount-submit' ) ) . "</p>";
217216 $form .= Xml::closeElement( 'form' );
218217
219 - $wgOut->addHTML( $form );
 218+ $out->addHTML( $form );
220219
221 - $wgOut->addWikiMsg( 'requestaccount-footer' );
 220+ $out->addWikiMsg( 'requestaccount-footer' );
222221 }
223222
224223 protected function doSubmit() {
225 - global $wgOut, $wgUser, $wgAuth, $wgAccountRequestThrottle;
 224+ global $wgUser, $wgAuth, $wgAccountRequestThrottle;
 225+ $out = $this->getOutput();
226226 # Now create a dummy user ($u) and check if it is valid
227227 $name = trim( $this->mUsername );
228228 $u = User::newFromName( $name, 'creatable' );
@@ -375,7 +375,7 @@
376376 $result = ConfirmAccount::sendConfirmationMail( $u, wfGetIP(), $token, $expires );
377377 if ( !$result->isOK() ) {
378378 $dbw->rollback(); // Nevermind
379 - $error = wfMsg( 'mailerror', $wgOut->parse( $result->getWikiText() ) );
 379+ $error = wfMsg( 'mailerror', $out->parse( $result->getWikiText() ) );
380380 $this->showForm( $error );
381381 return false;
382382 }
@@ -397,10 +397,10 @@
398398 }
399399
400400 protected function showSuccess() {
401 - global $wgOut;
402 - $wgOut->setPagetitle( wfMsg( "requestaccount" ) );
403 - $wgOut->addWikiMsg( 'requestaccount-sent' );
404 - $wgOut->returnToMain();
 401+ $out = $this->getOutput();
 402+ $out->setPagetitle( wfMsg( "requestaccount" ) );
 403+ $out->addWikiMsg( 'requestaccount-sent' );
 404+ $out->returnToMain();
405405 }
406406
407407 /**
@@ -418,8 +418,8 @@
419419 * @param int $limit number of accounts allowed to be requested from the same IP
420420 */
421421 protected function throttleHit( $limit ) {
422 - global $wgOut;
423 - $wgOut->addHTML( wfMsgExt( 'acct_request_throttle_hit', 'parsemag', $limit ) );
 422+ $out = $this->getOutput();
 423+ $out->addHTML( wfMsgExt( 'acct_request_throttle_hit', 'parsemag', $limit ) );
424424 }
425425
426426 /**
@@ -428,7 +428,8 @@
429429 * @param int $limit number of accounts allowed to be requested from the same IP
430430 */
431431 protected function confirmEmailToken( $code ) {
432 - global $wgUser, $wgOut, $wgConfirmAccountContact, $wgPasswordSender;
 432+ global $wgUser, $wgConfirmAccountContact, $wgPasswordSender;
 433+ $out = $this->getOutput();
433434 # Confirm if this token is in the pending requests
434435 $name = ConfirmAccount::requestNameFromEmailToken( $code );
435436 if ( $name !== false ) {
@@ -448,8 +449,8 @@
449450 wfDebug( "Could not sent email to admin at $target\n" );
450451 }
451452 }
452 - $wgOut->addWikiMsg( 'request-account-econf' );
453 - $wgOut->returnToMain();
 453+ $out->addWikiMsg( 'request-account-econf' );
 454+ $out->returnToMain();
454455 return;
455456 }
456457 # Maybe the user confirmed after account was created...
@@ -457,16 +458,16 @@
458459 if ( is_object( $user ) ) {
459460 if ( $user->confirmEmail() ) {
460461 $message = $wgUser->isLoggedIn() ? 'confirmemail_loggedin' : 'confirmemail_success';
461 - $wgOut->addWikiMsg( $message );
 462+ $out->addWikiMsg( $message );
462463 if ( !$wgUser->isLoggedIn() ) {
463464 $title = SpecialPage::getTitleFor( 'Userlogin' );
464 - $wgOut->returnToMain( true, $title->getPrefixedUrl() );
 465+ $out->returnToMain( true, $title->getPrefixedUrl() );
465466 }
466467 } else {
467 - $wgOut->addWikiMsg( 'confirmemail_error' );
 468+ $out->addWikiMsg( 'confirmemail_error' );
468469 }
469470 } else {
470 - $wgOut->addWikiMsg( 'confirmemail_invalid' );
 471+ $out->addWikiMsg( 'confirmemail_invalid' );
471472 }
472473 }
473474 }
Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/ConfirmAccount_body.php
@@ -1,27 +1,23 @@
22 <?php
33
4 -if ( !defined( 'MEDIAWIKI' ) ) {
5 - echo "ConfirmAccount extension\n";
6 - exit( 1 );
7 -}
 4+class ConfirmAccountsPage extends SpecialPage {
85
9 -class ConfirmAccountsPage extends SpecialPage
10 -{
11 -
126 function __construct() {
137 parent::__construct('ConfirmAccounts','confirmaccount');
148 }
159
1610 // @TODO: split out listlink mess
1711 function execute( $par ) {
18 - global $wgRequest, $wgOut, $wgUser, $wgAccountRequestTypes, $wgLang;
 12+ global $wgUser, $wgAccountRequestTypes, $wgLang;
1913
 14+ $request = $this->getRequest();
 15+ $out = $this->getOutput();
2016 if( !$wgUser->isAllowed( 'confirmaccount' ) ) {
21 - $wgOut->permissionRequired( 'confirmaccount' );
 17+ $out->permissionRequired( 'confirmaccount' );
2218 return;
2319 }
2420 if( !$wgUser->getID() ) {
25 - $wgOut->permissionRequired( 'user' );
 21+ $out->permissionRequired( 'user' );
2622 return;
2723 }
2824
@@ -39,27 +35,27 @@
4036 }
4137
4238 # A target user
43 - $this->acrID = $wgRequest->getIntOrNull( 'acrid' );
 39+ $this->acrID = $request->getIntOrNull( 'acrid' );
4440 # Attachments
45 - $this->file = $wgRequest->getVal( 'file' );
 41+ $this->file = $request->getVal( 'file' );
4642 # For renaming to alot for collisions with other local requests
4743 # that were added to some global $wgAuth system first.
48 - $this->mUsername = trim( $wgRequest->getText( 'wpNewName' ) );
 44+ $this->mUsername = trim( $request->getText( 'wpNewName' ) );
4945 # Position sought
50 - $this->mType = $wgRequest->getIntOrNull( 'wpType' );
 46+ $this->mType = $request->getIntOrNull( 'wpType' );
5147 $this->mType = ( !is_null($this->mType) && isset($wgAccountRequestTypes[$this->mType]) ) ?
5248 $this->mType : null;
5349 # For removing private info or such from bios
54 - $this->mBio = $wgRequest->getText( 'wpNewBio' );
 50+ $this->mBio = $request->getText( 'wpNewBio' );
5551 # Held requests hidden by default
56 - $this->showHeld = $wgRequest->getBool( 'wpShowHeld' );
 52+ $this->showHeld = $request->getBool( 'wpShowHeld' );
5753 # Show stale requests
58 - $this->showStale = $wgRequest->getBool( 'wpShowStale' );
 54+ $this->showStale = $request->getBool( 'wpShowStale' );
5955 # For viewing rejected requests (stale requests count as rejected)
60 - $this->showRejects = $wgRequest->getBool( 'wpShowRejects' );
 56+ $this->showRejects = $request->getBool( 'wpShowRejects' );
6157
62 - $this->submitType = $wgRequest->getVal( 'wpSubmitType' );
63 - $this->reason = $wgRequest->getText( 'wpReason' );
 58+ $this->submitType = $request->getVal( 'wpSubmitType' );
 59+ $this->reason = $request->getText( 'wpReason' );
6460
6561 # Load areas user plans to be active in...
6662 $this->mAreas = $this->mAreaSet = array();
@@ -69,7 +65,7 @@
7066 $set = explode("|",$area,2);
7167 if( $set[0] && isset($set[1]) ) {
7268 $formName = "wpArea-" . htmlspecialchars(str_replace(' ','_',$set[0]));
73 - $this->mAreas[$formName] = $wgRequest->getInt( $formName, -1 );
 69+ $this->mAreas[$formName] = $request->getInt( $formName, -1 );
7470 # Make a simple list of interests
7571 if( $this->mAreas[$formName] > 0 )
7672 $this->mAreaSet[] = str_replace( '_', ' ', $set[0] );
@@ -130,12 +126,12 @@
131127 $titleObj = $this->getTitle();
132128 $viewall = $this->skin->makeKnownLinkObj( $titleObj, wfMsgHtml('confirmaccount-all') );
133129
134 - $wgOut->setSubtitle( "<strong>" . wfMsgHtml('confirmaccount-type') . " <i>" .
 130+ $out->setSubtitle( "<strong>" . wfMsgHtml('confirmaccount-type') . " <i>" .
135131 wfMsgHtml("confirmaccount-type-{$this->queueType}") .
136132 "</i></strong> [{$listLink}] <strong>{$viewall}</strong>" );
137133 }
138134
139 - if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
 135+ if( $request->wasPosted() && $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
140136 $this->doSubmit();
141137 } elseif( $this->file ) {
142138 $this->showFile( $this->file );
@@ -146,16 +142,18 @@
147143 } else {
148144 $this->showQueues();
149145 }
150 - $wgOut->addModules( 'ext.confirmAccount' ); // CSS
 146+ $out->addModules( 'ext.confirmAccount' ); // CSS
151147 }
152148
153149 protected function showQueues() {
154 - global $wgOut, $wgAccountRequestTypes, $wgLang;
155 - $wgOut->addWikiMsg( 'confirmaccount-maintext' );
 150+ global $wgAccountRequestTypes, $wgLang;
 151+ $out = $this->getOutput();
156152
157 - $wgOut->addHTML( '<p><strong>' . wfMsgHtml('confirmaccount-types') . '</strong></p>' );
158 - $wgOut->addHTML( '<ul>' );
 153+ $out->addWikiMsg( 'confirmaccount-maintext' );
159154
 155+ $out->addHTML( '<p><strong>' . wfMsgHtml('confirmaccount-types') . '</strong></p>' );
 156+ $out->addHTML( '<ul>' );
 157+
160158 $dbr = wfGetDB( DB_SLAVE );
161159 # List each queue
162160 foreach( $wgAccountRequestTypes as $i => $params ) {
@@ -185,29 +183,31 @@
186184 __METHOD__ );
187185 $rejects .= " [$count]";
188186
189 - $wgOut->addHTML( "<li><i>".wfMsgHtml("confirmaccount-type-$i")."</i> (" .
 187+ $out->addHTML( "<li><i>".wfMsgHtml("confirmaccount-type-$i")."</i> (" .
190188 $wgLang->pipeList( array( $open, $held, $rejects, $stale ) ) . ")</li>" );
191189 }
192 - $wgOut->addHTML( '</ul>' );
 190+ $out->addHTML( '</ul>' );
193191 }
194192
195193 protected function showForm( $msg='' ) {
196 - global $wgOut, $wgUser, $wgLang, $wgAccountRequestTypes;
 194+ global $wgUser, $wgLang, $wgAccountRequestTypes;
 195+ $out = $this->getOutput();
 196+
197197 $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter );
198198
199 - $row = $this->getRequest();
 199+ $row = $this->getAccountRequest();
200200 if( !$row || $row->acr_rejected && !$this->showRejects ) {
201 - $wgOut->addHTML( wfMsgHtml('confirmaccount-badid') );
202 - $wgOut->returnToMain( true, $titleObj );
 201+ $out->addHTML( wfMsgHtml('confirmaccount-badid') );
 202+ $out->returnToMain( true, $titleObj );
203203 return;
204204 }
205205
206206 # Output any failure message
207207 if( $msg ) {
208 - $wgOut->addHTML( '<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>' );
 208+ $out->addHTML( '<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>' );
209209 }
210210
211 - $wgOut->addWikiMsg( 'confirmaccount-text' );
 211+ $out->addWikiMsg( 'confirmaccount-text' );
212212
213213 if( $row->acr_rejected ) {
214214 $datim = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_rejected), true );
@@ -217,12 +217,12 @@
218218 htmlspecialchars($row->acr_comment) : wfMsgHtml('confirmaccount-noreason');
219219 # Auto-rejected requests have a user ID of zero
220220 if( $row->acr_user ) {
221 - $wgOut->addHTML('<p><b>'.wfMsgExt( 'confirmaccount-reject', array('parseinline'),
 221+ $out->addHTML('<p><b>'.wfMsgExt( 'confirmaccount-reject', array('parseinline'),
222222 User::whoIs($row->acr_user), $datim, $date, $time ).'</b></p>');
223 - $wgOut->addHTML( '<p><strong>' . wfMsgHtml('confirmaccount-rational') . '</strong><i> ' .
 223+ $out->addHTML( '<p><strong>' . wfMsgHtml('confirmaccount-rational') . '</strong><i> ' .
224224 $reason . '</i></p>' );
225225 } else {
226 - $wgOut->addHTML( "<p><i> $reason </i></p>" );
 226+ $out->addHTML( "<p><i> $reason </i></p>" );
227227 }
228228 } elseif( $row->acr_held ) {
229229 $datim = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_held), true );
@@ -230,9 +230,9 @@
231231 $time = $wgLang->time( wfTimestamp(TS_MW, $row->acr_held), true );
232232 $reason = $row->acr_comment ? $row->acr_comment : wfMsgHtml('confirmaccount-noreason');
233233
234 - $wgOut->addHTML('<p><b>'.wfMsgExt( 'confirmaccount-held', array('parseinline'),
 234+ $out->addHTML('<p><b>'.wfMsgExt( 'confirmaccount-held', array('parseinline'),
235235 User::whoIs($row->acr_user), $datim, $date, $time ).'</b></p>');
236 - $wgOut->addHTML( '<p><strong>' . wfMsgHtml('confirmaccount-rational') . '</strong><i> ' .
 236+ $out->addHTML( '<p><strong>' . wfMsgHtml('confirmaccount-rational') . '</strong><i> ' .
237237 $reason . '</i></p>' );
238238 }
239239
@@ -365,7 +365,7 @@
366366 $form .= Html::Hidden( 'wpEditToken', $wgUser->editToken() )."\n";
367367 $form .= Xml::closeElement( 'form' );
368368
369 - $wgOut->addHTML( $form );
 369+ $out->addHTML( $form );
370370
371371 global $wgMemc;
372372 # Set a key to who is looking at this request.
@@ -378,16 +378,19 @@
379379 * Show a private file requested by the visitor.
380380 */
381381 protected function showFile( $key ) {
382 - global $wgOut, $wgRequest, $wgConfirmAccountFSRepos, $IP;
383 - $wgOut->disable();
 382+ global $wgConfirmAccountFSRepos, $IP;
 383+ $out = $this->getOutput();
 384+ $request = $this->getRequest();
384385
 386+ $out->disable();
 387+
385388 # We mustn't allow the output to be Squid cached, otherwise
386389 # if an admin previews a private image, and it's cached, then
387390 # a user without appropriate permissions can toddle off and
388391 # nab the image, and Squid will serve it
389 - $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
390 - $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
391 - $wgRequest->response()->header( 'Pragma: no-cache' );
 392+ $request->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
 393+ $request->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
 394+ $request->response()->header( 'Pragma: no-cache' );
392395
393396 $repo = new FSRepo( $wgConfirmAccountFSRepos['accountreqs'] );
394397 $path = $repo->getZonePath( 'public' ).'/'.
@@ -397,14 +400,15 @@
398401 }
399402
400403 protected function doSubmit() {
401 - global $wgOut, $wgUser;
 404+ global $wgUser;
 405+ $out = $this->getOutput();
402406
403407 $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter );
404408
405 - $row = $this->getRequest( true );
 409+ $row = $this->getAccountRequest( true );
406410 if( !$row ) {
407 - $wgOut->addHTML( wfMsgHtml('confirmaccount-badid') );
408 - $wgOut->returnToMain( true, $titleObj );
 411+ $out->addHTML( wfMsgHtml('confirmaccount-badid') );
 412+ $out->returnToMain( true, $titleObj );
409413 return;
410414 }
411415
@@ -441,7 +445,7 @@
442446 }
443447
444448 if( !$result->isOk() ) {
445 - $error = wfMsg( 'mailerror', $wgOut->parse( $result->getWikiText() ) );
 449+ $error = wfMsg( 'mailerror', $out->parse( $result->getWikiText() ) );
446450 $this->showForm( $error );
447451 return false;
448452 }
@@ -596,7 +600,7 @@
597601 $error = '';
598602
599603 if( !$result->isOK() ) {
600 - $error = wfMsg( 'mailerror', $wgOut->parse( $result->getWikiText() ) );
 604+ $error = wfMsg( 'mailerror', $out->parse( $result->getWikiText() ) );
601605 }
602606
603607 # Safe to hook/log now...
@@ -720,7 +724,7 @@
721725 );
722726 if( !$result->isOK() ) {
723727 $dbw->rollback();
724 - $error = wfMsg( 'mailerror', $wgOut->parse( $result->getWikiText() ) );
 728+ $error = wfMsg( 'mailerror', $out->parse( $result->getWikiText() ) );
725729 $this->showForm( $error );
726730 return false;
727731 }
@@ -741,7 +745,7 @@
742746 /*
743747 * Get requested account request row and load some fields
744748 */
745 - function getRequest( $forUpdate = false ) {
 749+ function getAccountRequest( $forUpdate = false ) {
746750 if( !$this->acrID ) return false;
747751
748752 $db = $forUpdate ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
@@ -806,28 +810,29 @@
807811 }
808812
809813 protected function showSuccess( $titleObj, $name = null, $errors = array() ) {
810 - global $wgOut;
 814+ $out = $this->getOutput();
811815
812816 $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter );
813 - $wgOut->setPagetitle( wfMsgHtml('actioncomplete') );
 817+ $out->setPagetitle( wfMsgHtml('actioncomplete') );
814818 if( $this->submitType == 'accept' ) {
815 - $wgOut->addWikiMsg( 'confirmaccount-acc', $name );
 819+ $out->addWikiMsg( 'confirmaccount-acc', $name );
816820 } elseif( $this->submitType == 'reject' || $this->submitType == 'spam' ) {
817 - $wgOut->addWikiMsg( 'confirmaccount-rej' );
 821+ $out->addWikiMsg( 'confirmaccount-rej' );
818822 } else {
819 - $wgOut->redirect( $titleObj->getFullUrl() );
 823+ $out->redirect( $titleObj->getFullUrl() );
820824 return;
821825 }
822826 # Output any errors
823827 foreach( $errors as $error ) {
824 - $wgOut->addHTML( '<p>' . $error . '</p>' );
 828+ $out->addHTML( '<p>' . $error . '</p>' );
825829 }
826830 # Give link to see other requests
827 - $wgOut->returnToMain( true, $titleObj );
 831+ $out->returnToMain( true, $titleObj );
828832 }
829833
830834 protected function showList() {
831 - global $wgOut, $wgUser, $wgLang;
 835+ global $wgUser, $wgLang;
 836+ $out = $this->getOutput();
832837
833838 $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter );
834839
@@ -837,24 +842,24 @@
838843
839844 if( $pager->getNumRows() ) {
840845 if( $this->showStale ) {
841 - $wgOut->addHTML( wfMsgExt('confirmaccount-list3', array('parse') ) );
 846+ $out->addHTML( wfMsgExt('confirmaccount-list3', array('parse') ) );
842847 } elseif( $this->showRejects ) {
843 - $wgOut->addHTML( wfMsgExt('confirmaccount-list2', array('parse') ) );
 848+ $out->addHTML( wfMsgExt('confirmaccount-list2', array('parse') ) );
844849 } else {
845 - $wgOut->addHTML( wfMsgExt('confirmaccount-list', array('parse') ) );
 850+ $out->addHTML( wfMsgExt('confirmaccount-list', array('parse') ) );
846851 }
847 - $wgOut->addHTML( $pager->getNavigationBar() );
848 - $wgOut->addHTML( $pager->getBody() );
849 - $wgOut->addHTML( $pager->getNavigationBar() );
 852+ $out->addHTML( $pager->getNavigationBar() );
 853+ $out->addHTML( $pager->getBody() );
 854+ $out->addHTML( $pager->getNavigationBar() );
850855 } else {
851856 if( $this->showRejects ) {
852 - $wgOut->addHTML( wfMsgExt('confirmaccount-none-r', array('parse')) );
 857+ $out->addHTML( wfMsgExt('confirmaccount-none-r', array('parse')) );
853858 } elseif( $this->showStale ) {
854 - $wgOut->addHTML( wfMsgExt('confirmaccount-none-e', array('parse')) );
 859+ $out->addHTML( wfMsgExt('confirmaccount-none-e', array('parse')) );
855860 } elseif( $this->showHeld ) {
856 - $wgOut->addHTML( wfMsgExt('confirmaccount-none-h', array('parse')) );
 861+ $out->addHTML( wfMsgExt('confirmaccount-none-h', array('parse')) );
857862 } else {
858 - $wgOut->addHTML( wfMsgExt('confirmaccount-none-o', array('parse')) );
 863+ $out->addHTML( wfMsgExt('confirmaccount-none-o', array('parse')) );
859864 }
860865 }
861866

Status & tagging log