Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/UserCredentials_body.php |
— | — | @@ -1,25 +1,27 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -class UserCredentialsPage extends SpecialPage |
5 | | -{ |
| 4 | +class UserCredentialsPage extends SpecialPage { |
| 5 | + |
6 | 6 | function __construct() { |
7 | 7 | parent::__construct( 'UserCredentials', 'lookupcredentials' ); |
8 | 8 | } |
9 | 9 | |
10 | 10 | function execute( $par ) { |
11 | | - global $wgRequest, $wgOut, $wgUser, $wgAccountRequestTypes; |
| 11 | + global $wgUser, $wgAccountRequestTypes; |
| 12 | + $out = $this->getOutput(); |
| 13 | + $request = $this->getRequest(); |
12 | 14 | |
13 | 15 | if ( !$wgUser->isAllowed( 'lookupcredentials' ) ) { |
14 | | - $wgOut->permissionRequired( 'lookupcredentials' ); |
| 16 | + $out->permissionRequired( 'lookupcredentials' ); |
15 | 17 | return; |
16 | 18 | } |
17 | 19 | |
18 | 20 | $this->setHeaders(); |
19 | 21 | |
20 | 22 | # A target user |
21 | | - $this->target = $wgRequest->getText( 'target' ); |
| 23 | + $this->target = $request->getText( 'target' ); |
22 | 24 | # Attachments |
23 | | - $this->file = $wgRequest->getVal( 'file' ); |
| 25 | + $this->file = $request->getVal( 'file' ); |
24 | 26 | |
25 | 27 | $this->skin = $wgUser->getSkin(); |
26 | 28 | |
— | — | @@ -31,11 +33,12 @@ |
32 | 34 | } else { |
33 | 35 | $this->showForm(); |
34 | 36 | } |
35 | | - $wgOut->addModules( 'ext.confirmAccount' ); // CSS |
| 37 | + $out->addModules( 'ext.confirmAccount' ); // CSS |
36 | 38 | } |
37 | 39 | |
38 | 40 | function showForm() { |
39 | | - global $wgOut, $wgScript; |
| 41 | + global $wgScript; |
| 42 | + $out = $this->getOutput(); |
40 | 43 | |
41 | 44 | $username = str_replace( '_', ' ', $this->target ); |
42 | 45 | $form = Xml::openElement( 'form', array( 'name' => 'stablization', 'action' => $wgScript, 'method' => 'get' ) ); |
— | — | @@ -48,21 +51,22 @@ |
49 | 52 | $form .= "</tr></table>"; |
50 | 53 | $form .= "</fieldset></form>\n"; |
51 | 54 | |
52 | | - $wgOut->addHTML( $form ); |
| 55 | + $out->addHTML( $form ); |
53 | 56 | } |
54 | 57 | |
55 | 58 | function showCredentials() { |
56 | | - global $wgOut, $wgUser, $wgLang, $wgAccountRequestTypes; |
| 59 | + global $wgUser, $wgLang, $wgAccountRequestTypes; |
| 60 | + $out = $this->getOutput(); |
57 | 61 | |
58 | 62 | $titleObj = SpecialPage::getTitleFor( 'UserCredentials' ); |
59 | 63 | |
60 | 64 | $row = $this->getRequest(); |
61 | 65 | if ( !$row ) { |
62 | | - $wgOut->addHTML( wfMsgHtml( 'usercredentials-badid' ) ); |
| 66 | + $out->addHTML( wfMsgHtml( 'usercredentials-badid' ) ); |
63 | 67 | return; |
64 | 68 | } |
65 | 69 | |
66 | | - $wgOut->addWikiText( wfMsg( "usercredentials-text" ) ); |
| 70 | + $out->addWikiText( wfMsg( "usercredentials-text" ) ); |
67 | 71 | |
68 | 72 | $user = User::newFromName( $this->target ); |
69 | 73 | |
— | — | @@ -161,7 +165,7 @@ |
162 | 166 | } |
163 | 167 | $form .= '</fieldset>'; |
164 | 168 | |
165 | | - $wgOut->addHTML( $form ); |
| 169 | + $out->addHTML( $form ); |
166 | 170 | } |
167 | 171 | |
168 | 172 | /** |
— | — | @@ -181,16 +185,19 @@ |
182 | 186 | * Show a private file requested by the visitor. |
183 | 187 | */ |
184 | 188 | function showFile( $key ) { |
185 | | - global $wgOut, $wgRequest, $wgConfirmAccountFSRepos, $IP; |
186 | | - $wgOut->disable(); |
| 189 | + global $wgConfirmAccountFSRepos, $IP; |
| 190 | + $out = $this->getOutput(); |
| 191 | + $request = $this->getRequest(); |
187 | 192 | |
| 193 | + $out->disable(); |
| 194 | + |
188 | 195 | # We mustn't allow the output to be Squid cached, otherwise |
189 | 196 | # if an admin previews a private image, and it's cached, then |
190 | 197 | # a user without appropriate permissions can toddle off and |
191 | 198 | # 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' ); |
195 | 202 | |
196 | 203 | require_once( "$IP/includes/StreamFile.php" ); |
197 | 204 | $repo = new FSRepo( $wgConfirmAccountFSRepos['accountcreds'] ); |
Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php |
— | — | @@ -1,10 +1,5 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
5 | | - echo "ConfirmAccount extension\n"; |
6 | | - exit( 1 ); |
7 | | -} |
8 | | - |
9 | 4 | class RequestAccountPage extends SpecialPage { |
10 | 5 | |
11 | 6 | function __construct() { |
— | — | @@ -12,39 +7,42 @@ |
13 | 8 | } |
14 | 9 | |
15 | 10 | function execute( $par ) { |
16 | | - global $wgUser, $wgOut, $wgRequest, $wgUseRealNamesOnly, |
| 11 | + global $wgUser, $wgUseRealNamesOnly, |
17 | 12 | $wgAccountRequestToS, $wgAccountRequestExtraInfo, $wgAccountRequestTypes; |
18 | 13 | # If a user cannot make accounts, don't let them request them either |
19 | 14 | global $wgAccountRequestWhileBlocked; |
| 15 | + |
| 16 | + $request = $this->getRequest(); |
| 17 | + $out = $this->getOutput(); |
20 | 18 | if ( !$wgAccountRequestWhileBlocked && $wgUser->isBlockedFromCreateAccount() ) { |
21 | | - $wgOut->blockedPage(); |
| 19 | + $out->blockedPage(); |
22 | 20 | return; |
23 | 21 | } |
24 | 22 | if ( wfReadOnly() ) { |
25 | | - $wgOut->readOnlyPage(); |
| 23 | + $out->readOnlyPage(); |
26 | 24 | return; |
27 | 25 | } |
28 | 26 | |
29 | 27 | $this->setHeaders(); |
30 | 28 | |
31 | | - $this->mRealName = trim( $wgRequest->getText( 'wpRealName' ) ); |
| 29 | + $this->mRealName = trim( $request->getText( 'wpRealName' ) ); |
32 | 30 | # 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' ); |
34 | 32 | $this->mUsername = trim( $this->mUsername ); |
35 | 33 | # 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' ); |
39 | 37 | # 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', '' ); |
42 | 40 | $this->mNotes = $wgAccountRequestExtraInfo ? |
43 | | - $wgRequest->getText( 'wpNotes', '' ) : ''; |
| 41 | + $request->getText( 'wpNotes', '' ) : ''; |
44 | 42 | $this->mUrls = $wgAccountRequestExtraInfo ? |
45 | | - $wgRequest->getText( 'wpUrls', '' ) : ''; |
| 43 | + $request->getText( 'wpUrls', '' ) : ''; |
46 | 44 | $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' ); |
49 | 47 | $this->mType = isset( $wgAccountRequestTypes[$this->mType] ) ? $this->mType : 0; |
50 | 48 | # Load areas user plans to be active in... |
51 | 49 | $this->mAreas = $this->mAreaSet = array(); |
— | — | @@ -54,7 +52,7 @@ |
55 | 53 | $set = explode( "|", $area, 2 ); |
56 | 54 | if ( $set[0] && isset( $set[1] ) ) { |
57 | 55 | $formName = "wpArea-" . htmlspecialchars( str_replace( ' ', '_', $set[0] ) ); |
58 | | - $this->mAreas[$formName] = $wgRequest->getInt( $formName, - 1 ); |
| 56 | + $this->mAreas[$formName] = $request->getInt( $formName, - 1 ); |
59 | 57 | # Make a simple list of interests |
60 | 58 | if ( $this->mAreas[$formName] > 0 ) |
61 | 59 | $this->mAreaSet[] = str_replace( '_', ' ', $set[0] ); |
— | — | @@ -62,12 +60,12 @@ |
63 | 61 | } |
64 | 62 | } |
65 | 63 | # We may be confirming an email address here |
66 | | - $emailCode = $wgRequest->getText( 'wpEmailToken' ); |
| 64 | + $emailCode = $request->getText( 'wpEmailToken' ); |
67 | 65 | |
68 | 66 | $this->skin = $wgUser->getSkin(); |
69 | 67 | |
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' ) ) ) { |
72 | 70 | $this->mPrevAttachment = $this->mPrevAttachment ? $this->mPrevAttachment : $this->mSrcName; |
73 | 71 | $this->doSubmit(); |
74 | 72 | } elseif ( $action == 'confirmemail' ) { |
— | — | @@ -75,27 +73,28 @@ |
76 | 74 | } else { |
77 | 75 | $this->showForm(); |
78 | 76 | } |
79 | | - $wgOut->addModules( 'ext.confirmAccount' ); // CSS |
| 77 | + $out->addModules( 'ext.confirmAccount' ); // CSS |
80 | 78 | } |
81 | 79 | |
82 | 80 | protected function showForm( $msg = '', $forgotFile = 0 ) { |
83 | | - global $wgOut, $wgUser, $wgUseRealNamesOnly, $wgAllowRealName; |
| 81 | + global $wgUser, $wgUseRealNamesOnly, $wgAllowRealName; |
84 | 82 | global $wgAccountRequestToS, $wgAccountRequestTypes, $wgAccountRequestExtraInfo, |
85 | 83 | $wgAllowAccountRequestFiles, $wgMakeUserPageFromBio; |
86 | 84 | |
87 | 85 | $this->mForgotAttachment = $forgotFile; |
88 | 86 | |
89 | | - $wgOut->setPagetitle( wfMsgHtml( "requestaccount" ) ); |
| 87 | + $out = $this->getOutput(); |
| 88 | + $out->setPagetitle( wfMsgHtml( "requestaccount" ) ); |
90 | 89 | # Output failure message if any |
91 | 90 | 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>' ); |
93 | 92 | } |
94 | 93 | # Give notice to users that are logged in |
95 | 94 | if ( $wgUser->getID() ) { |
96 | | - $wgOut->addWikiMsg( 'requestaccount-dup' ); |
| 95 | + $out->addWikiMsg( 'requestaccount-dup' ); |
97 | 96 | } |
98 | 97 | |
99 | | - $wgOut->addWikiMsg( 'requestaccount-text' ); |
| 98 | + $out->addWikiMsg( 'requestaccount-text' ); |
100 | 99 | |
101 | 100 | $form = Xml::openElement( 'form', array( 'method' => 'post', 'name' => 'accountrequest', |
102 | 101 | 'action' => $this->getTitle()->getLocalUrl(), 'enctype' => 'multipart/form-data' ) ); |
— | — | @@ -215,13 +214,14 @@ |
216 | 215 | $form .= "<p>" . Xml::submitButton( wfMsgHtml( 'requestaccount-submit' ) ) . "</p>"; |
217 | 216 | $form .= Xml::closeElement( 'form' ); |
218 | 217 | |
219 | | - $wgOut->addHTML( $form ); |
| 218 | + $out->addHTML( $form ); |
220 | 219 | |
221 | | - $wgOut->addWikiMsg( 'requestaccount-footer' ); |
| 220 | + $out->addWikiMsg( 'requestaccount-footer' ); |
222 | 221 | } |
223 | 222 | |
224 | 223 | protected function doSubmit() { |
225 | | - global $wgOut, $wgUser, $wgAuth, $wgAccountRequestThrottle; |
| 224 | + global $wgUser, $wgAuth, $wgAccountRequestThrottle; |
| 225 | + $out = $this->getOutput(); |
226 | 226 | # Now create a dummy user ($u) and check if it is valid |
227 | 227 | $name = trim( $this->mUsername ); |
228 | 228 | $u = User::newFromName( $name, 'creatable' ); |
— | — | @@ -375,7 +375,7 @@ |
376 | 376 | $result = ConfirmAccount::sendConfirmationMail( $u, wfGetIP(), $token, $expires ); |
377 | 377 | if ( !$result->isOK() ) { |
378 | 378 | $dbw->rollback(); // Nevermind |
379 | | - $error = wfMsg( 'mailerror', $wgOut->parse( $result->getWikiText() ) ); |
| 379 | + $error = wfMsg( 'mailerror', $out->parse( $result->getWikiText() ) ); |
380 | 380 | $this->showForm( $error ); |
381 | 381 | return false; |
382 | 382 | } |
— | — | @@ -397,10 +397,10 @@ |
398 | 398 | } |
399 | 399 | |
400 | 400 | 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(); |
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
— | — | @@ -418,8 +418,8 @@ |
419 | 419 | * @param int $limit number of accounts allowed to be requested from the same IP |
420 | 420 | */ |
421 | 421 | 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 ) ); |
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
— | — | @@ -428,7 +428,8 @@ |
429 | 429 | * @param int $limit number of accounts allowed to be requested from the same IP |
430 | 430 | */ |
431 | 431 | protected function confirmEmailToken( $code ) { |
432 | | - global $wgUser, $wgOut, $wgConfirmAccountContact, $wgPasswordSender; |
| 432 | + global $wgUser, $wgConfirmAccountContact, $wgPasswordSender; |
| 433 | + $out = $this->getOutput(); |
433 | 434 | # Confirm if this token is in the pending requests |
434 | 435 | $name = ConfirmAccount::requestNameFromEmailToken( $code ); |
435 | 436 | if ( $name !== false ) { |
— | — | @@ -448,8 +449,8 @@ |
449 | 450 | wfDebug( "Could not sent email to admin at $target\n" ); |
450 | 451 | } |
451 | 452 | } |
452 | | - $wgOut->addWikiMsg( 'request-account-econf' ); |
453 | | - $wgOut->returnToMain(); |
| 453 | + $out->addWikiMsg( 'request-account-econf' ); |
| 454 | + $out->returnToMain(); |
454 | 455 | return; |
455 | 456 | } |
456 | 457 | # Maybe the user confirmed after account was created... |
— | — | @@ -457,16 +458,16 @@ |
458 | 459 | if ( is_object( $user ) ) { |
459 | 460 | if ( $user->confirmEmail() ) { |
460 | 461 | $message = $wgUser->isLoggedIn() ? 'confirmemail_loggedin' : 'confirmemail_success'; |
461 | | - $wgOut->addWikiMsg( $message ); |
| 462 | + $out->addWikiMsg( $message ); |
462 | 463 | if ( !$wgUser->isLoggedIn() ) { |
463 | 464 | $title = SpecialPage::getTitleFor( 'Userlogin' ); |
464 | | - $wgOut->returnToMain( true, $title->getPrefixedUrl() ); |
| 465 | + $out->returnToMain( true, $title->getPrefixedUrl() ); |
465 | 466 | } |
466 | 467 | } else { |
467 | | - $wgOut->addWikiMsg( 'confirmemail_error' ); |
| 468 | + $out->addWikiMsg( 'confirmemail_error' ); |
468 | 469 | } |
469 | 470 | } else { |
470 | | - $wgOut->addWikiMsg( 'confirmemail_invalid' ); |
| 471 | + $out->addWikiMsg( 'confirmemail_invalid' ); |
471 | 472 | } |
472 | 473 | } |
473 | 474 | } |
Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/ConfirmAccount_body.php |
— | — | @@ -1,27 +1,23 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
5 | | - echo "ConfirmAccount extension\n"; |
6 | | - exit( 1 ); |
7 | | -} |
| 4 | +class ConfirmAccountsPage extends SpecialPage { |
8 | 5 | |
9 | | -class ConfirmAccountsPage extends SpecialPage |
10 | | -{ |
11 | | - |
12 | 6 | function __construct() { |
13 | 7 | parent::__construct('ConfirmAccounts','confirmaccount'); |
14 | 8 | } |
15 | 9 | |
16 | 10 | // @TODO: split out listlink mess |
17 | 11 | function execute( $par ) { |
18 | | - global $wgRequest, $wgOut, $wgUser, $wgAccountRequestTypes, $wgLang; |
| 12 | + global $wgUser, $wgAccountRequestTypes, $wgLang; |
19 | 13 | |
| 14 | + $request = $this->getRequest(); |
| 15 | + $out = $this->getOutput(); |
20 | 16 | if( !$wgUser->isAllowed( 'confirmaccount' ) ) { |
21 | | - $wgOut->permissionRequired( 'confirmaccount' ); |
| 17 | + $out->permissionRequired( 'confirmaccount' ); |
22 | 18 | return; |
23 | 19 | } |
24 | 20 | if( !$wgUser->getID() ) { |
25 | | - $wgOut->permissionRequired( 'user' ); |
| 21 | + $out->permissionRequired( 'user' ); |
26 | 22 | return; |
27 | 23 | } |
28 | 24 | |
— | — | @@ -39,27 +35,27 @@ |
40 | 36 | } |
41 | 37 | |
42 | 38 | # A target user |
43 | | - $this->acrID = $wgRequest->getIntOrNull( 'acrid' ); |
| 39 | + $this->acrID = $request->getIntOrNull( 'acrid' ); |
44 | 40 | # Attachments |
45 | | - $this->file = $wgRequest->getVal( 'file' ); |
| 41 | + $this->file = $request->getVal( 'file' ); |
46 | 42 | # For renaming to alot for collisions with other local requests |
47 | 43 | # that were added to some global $wgAuth system first. |
48 | | - $this->mUsername = trim( $wgRequest->getText( 'wpNewName' ) ); |
| 44 | + $this->mUsername = trim( $request->getText( 'wpNewName' ) ); |
49 | 45 | # Position sought |
50 | | - $this->mType = $wgRequest->getIntOrNull( 'wpType' ); |
| 46 | + $this->mType = $request->getIntOrNull( 'wpType' ); |
51 | 47 | $this->mType = ( !is_null($this->mType) && isset($wgAccountRequestTypes[$this->mType]) ) ? |
52 | 48 | $this->mType : null; |
53 | 49 | # For removing private info or such from bios |
54 | | - $this->mBio = $wgRequest->getText( 'wpNewBio' ); |
| 50 | + $this->mBio = $request->getText( 'wpNewBio' ); |
55 | 51 | # Held requests hidden by default |
56 | | - $this->showHeld = $wgRequest->getBool( 'wpShowHeld' ); |
| 52 | + $this->showHeld = $request->getBool( 'wpShowHeld' ); |
57 | 53 | # Show stale requests |
58 | | - $this->showStale = $wgRequest->getBool( 'wpShowStale' ); |
| 54 | + $this->showStale = $request->getBool( 'wpShowStale' ); |
59 | 55 | # For viewing rejected requests (stale requests count as rejected) |
60 | | - $this->showRejects = $wgRequest->getBool( 'wpShowRejects' ); |
| 56 | + $this->showRejects = $request->getBool( 'wpShowRejects' ); |
61 | 57 | |
62 | | - $this->submitType = $wgRequest->getVal( 'wpSubmitType' ); |
63 | | - $this->reason = $wgRequest->getText( 'wpReason' ); |
| 58 | + $this->submitType = $request->getVal( 'wpSubmitType' ); |
| 59 | + $this->reason = $request->getText( 'wpReason' ); |
64 | 60 | |
65 | 61 | # Load areas user plans to be active in... |
66 | 62 | $this->mAreas = $this->mAreaSet = array(); |
— | — | @@ -69,7 +65,7 @@ |
70 | 66 | $set = explode("|",$area,2); |
71 | 67 | if( $set[0] && isset($set[1]) ) { |
72 | 68 | $formName = "wpArea-" . htmlspecialchars(str_replace(' ','_',$set[0])); |
73 | | - $this->mAreas[$formName] = $wgRequest->getInt( $formName, -1 ); |
| 69 | + $this->mAreas[$formName] = $request->getInt( $formName, -1 ); |
74 | 70 | # Make a simple list of interests |
75 | 71 | if( $this->mAreas[$formName] > 0 ) |
76 | 72 | $this->mAreaSet[] = str_replace( '_', ' ', $set[0] ); |
— | — | @@ -130,12 +126,12 @@ |
131 | 127 | $titleObj = $this->getTitle(); |
132 | 128 | $viewall = $this->skin->makeKnownLinkObj( $titleObj, wfMsgHtml('confirmaccount-all') ); |
133 | 129 | |
134 | | - $wgOut->setSubtitle( "<strong>" . wfMsgHtml('confirmaccount-type') . " <i>" . |
| 130 | + $out->setSubtitle( "<strong>" . wfMsgHtml('confirmaccount-type') . " <i>" . |
135 | 131 | wfMsgHtml("confirmaccount-type-{$this->queueType}") . |
136 | 132 | "</i></strong> [{$listLink}] <strong>{$viewall}</strong>" ); |
137 | 133 | } |
138 | 134 | |
139 | | - if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
| 135 | + if( $request->wasPosted() && $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) { |
140 | 136 | $this->doSubmit(); |
141 | 137 | } elseif( $this->file ) { |
142 | 138 | $this->showFile( $this->file ); |
— | — | @@ -146,16 +142,18 @@ |
147 | 143 | } else { |
148 | 144 | $this->showQueues(); |
149 | 145 | } |
150 | | - $wgOut->addModules( 'ext.confirmAccount' ); // CSS |
| 146 | + $out->addModules( 'ext.confirmAccount' ); // CSS |
151 | 147 | } |
152 | 148 | |
153 | 149 | protected function showQueues() { |
154 | | - global $wgOut, $wgAccountRequestTypes, $wgLang; |
155 | | - $wgOut->addWikiMsg( 'confirmaccount-maintext' ); |
| 150 | + global $wgAccountRequestTypes, $wgLang; |
| 151 | + $out = $this->getOutput(); |
156 | 152 | |
157 | | - $wgOut->addHTML( '<p><strong>' . wfMsgHtml('confirmaccount-types') . '</strong></p>' ); |
158 | | - $wgOut->addHTML( '<ul>' ); |
| 153 | + $out->addWikiMsg( 'confirmaccount-maintext' ); |
159 | 154 | |
| 155 | + $out->addHTML( '<p><strong>' . wfMsgHtml('confirmaccount-types') . '</strong></p>' ); |
| 156 | + $out->addHTML( '<ul>' ); |
| 157 | + |
160 | 158 | $dbr = wfGetDB( DB_SLAVE ); |
161 | 159 | # List each queue |
162 | 160 | foreach( $wgAccountRequestTypes as $i => $params ) { |
— | — | @@ -185,29 +183,31 @@ |
186 | 184 | __METHOD__ ); |
187 | 185 | $rejects .= " [$count]"; |
188 | 186 | |
189 | | - $wgOut->addHTML( "<li><i>".wfMsgHtml("confirmaccount-type-$i")."</i> (" . |
| 187 | + $out->addHTML( "<li><i>".wfMsgHtml("confirmaccount-type-$i")."</i> (" . |
190 | 188 | $wgLang->pipeList( array( $open, $held, $rejects, $stale ) ) . ")</li>" ); |
191 | 189 | } |
192 | | - $wgOut->addHTML( '</ul>' ); |
| 190 | + $out->addHTML( '</ul>' ); |
193 | 191 | } |
194 | 192 | |
195 | 193 | protected function showForm( $msg='' ) { |
196 | | - global $wgOut, $wgUser, $wgLang, $wgAccountRequestTypes; |
| 194 | + global $wgUser, $wgLang, $wgAccountRequestTypes; |
| 195 | + $out = $this->getOutput(); |
| 196 | + |
197 | 197 | $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter ); |
198 | 198 | |
199 | | - $row = $this->getRequest(); |
| 199 | + $row = $this->getAccountRequest(); |
200 | 200 | 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 ); |
203 | 203 | return; |
204 | 204 | } |
205 | 205 | |
206 | 206 | # Output any failure message |
207 | 207 | 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>' ); |
209 | 209 | } |
210 | 210 | |
211 | | - $wgOut->addWikiMsg( 'confirmaccount-text' ); |
| 211 | + $out->addWikiMsg( 'confirmaccount-text' ); |
212 | 212 | |
213 | 213 | if( $row->acr_rejected ) { |
214 | 214 | $datim = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_rejected), true ); |
— | — | @@ -217,12 +217,12 @@ |
218 | 218 | htmlspecialchars($row->acr_comment) : wfMsgHtml('confirmaccount-noreason'); |
219 | 219 | # Auto-rejected requests have a user ID of zero |
220 | 220 | if( $row->acr_user ) { |
221 | | - $wgOut->addHTML('<p><b>'.wfMsgExt( 'confirmaccount-reject', array('parseinline'), |
| 221 | + $out->addHTML('<p><b>'.wfMsgExt( 'confirmaccount-reject', array('parseinline'), |
222 | 222 | 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> ' . |
224 | 224 | $reason . '</i></p>' ); |
225 | 225 | } else { |
226 | | - $wgOut->addHTML( "<p><i> $reason </i></p>" ); |
| 226 | + $out->addHTML( "<p><i> $reason </i></p>" ); |
227 | 227 | } |
228 | 228 | } elseif( $row->acr_held ) { |
229 | 229 | $datim = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_held), true ); |
— | — | @@ -230,9 +230,9 @@ |
231 | 231 | $time = $wgLang->time( wfTimestamp(TS_MW, $row->acr_held), true ); |
232 | 232 | $reason = $row->acr_comment ? $row->acr_comment : wfMsgHtml('confirmaccount-noreason'); |
233 | 233 | |
234 | | - $wgOut->addHTML('<p><b>'.wfMsgExt( 'confirmaccount-held', array('parseinline'), |
| 234 | + $out->addHTML('<p><b>'.wfMsgExt( 'confirmaccount-held', array('parseinline'), |
235 | 235 | 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> ' . |
237 | 237 | $reason . '</i></p>' ); |
238 | 238 | } |
239 | 239 | |
— | — | @@ -365,7 +365,7 @@ |
366 | 366 | $form .= Html::Hidden( 'wpEditToken', $wgUser->editToken() )."\n"; |
367 | 367 | $form .= Xml::closeElement( 'form' ); |
368 | 368 | |
369 | | - $wgOut->addHTML( $form ); |
| 369 | + $out->addHTML( $form ); |
370 | 370 | |
371 | 371 | global $wgMemc; |
372 | 372 | # Set a key to who is looking at this request. |
— | — | @@ -378,16 +378,19 @@ |
379 | 379 | * Show a private file requested by the visitor. |
380 | 380 | */ |
381 | 381 | 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(); |
384 | 385 | |
| 386 | + $out->disable(); |
| 387 | + |
385 | 388 | # We mustn't allow the output to be Squid cached, otherwise |
386 | 389 | # if an admin previews a private image, and it's cached, then |
387 | 390 | # a user without appropriate permissions can toddle off and |
388 | 391 | # 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' ); |
392 | 395 | |
393 | 396 | $repo = new FSRepo( $wgConfirmAccountFSRepos['accountreqs'] ); |
394 | 397 | $path = $repo->getZonePath( 'public' ).'/'. |
— | — | @@ -397,14 +400,15 @@ |
398 | 401 | } |
399 | 402 | |
400 | 403 | protected function doSubmit() { |
401 | | - global $wgOut, $wgUser; |
| 404 | + global $wgUser; |
| 405 | + $out = $this->getOutput(); |
402 | 406 | |
403 | 407 | $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter ); |
404 | 408 | |
405 | | - $row = $this->getRequest( true ); |
| 409 | + $row = $this->getAccountRequest( true ); |
406 | 410 | if( !$row ) { |
407 | | - $wgOut->addHTML( wfMsgHtml('confirmaccount-badid') ); |
408 | | - $wgOut->returnToMain( true, $titleObj ); |
| 411 | + $out->addHTML( wfMsgHtml('confirmaccount-badid') ); |
| 412 | + $out->returnToMain( true, $titleObj ); |
409 | 413 | return; |
410 | 414 | } |
411 | 415 | |
— | — | @@ -441,7 +445,7 @@ |
442 | 446 | } |
443 | 447 | |
444 | 448 | if( !$result->isOk() ) { |
445 | | - $error = wfMsg( 'mailerror', $wgOut->parse( $result->getWikiText() ) ); |
| 449 | + $error = wfMsg( 'mailerror', $out->parse( $result->getWikiText() ) ); |
446 | 450 | $this->showForm( $error ); |
447 | 451 | return false; |
448 | 452 | } |
— | — | @@ -596,7 +600,7 @@ |
597 | 601 | $error = ''; |
598 | 602 | |
599 | 603 | if( !$result->isOK() ) { |
600 | | - $error = wfMsg( 'mailerror', $wgOut->parse( $result->getWikiText() ) ); |
| 604 | + $error = wfMsg( 'mailerror', $out->parse( $result->getWikiText() ) ); |
601 | 605 | } |
602 | 606 | |
603 | 607 | # Safe to hook/log now... |
— | — | @@ -720,7 +724,7 @@ |
721 | 725 | ); |
722 | 726 | if( !$result->isOK() ) { |
723 | 727 | $dbw->rollback(); |
724 | | - $error = wfMsg( 'mailerror', $wgOut->parse( $result->getWikiText() ) ); |
| 728 | + $error = wfMsg( 'mailerror', $out->parse( $result->getWikiText() ) ); |
725 | 729 | $this->showForm( $error ); |
726 | 730 | return false; |
727 | 731 | } |
— | — | @@ -741,7 +745,7 @@ |
742 | 746 | /* |
743 | 747 | * Get requested account request row and load some fields |
744 | 748 | */ |
745 | | - function getRequest( $forUpdate = false ) { |
| 749 | + function getAccountRequest( $forUpdate = false ) { |
746 | 750 | if( !$this->acrID ) return false; |
747 | 751 | |
748 | 752 | $db = $forUpdate ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
— | — | @@ -806,28 +810,29 @@ |
807 | 811 | } |
808 | 812 | |
809 | 813 | protected function showSuccess( $titleObj, $name = null, $errors = array() ) { |
810 | | - global $wgOut; |
| 814 | + $out = $this->getOutput(); |
811 | 815 | |
812 | 816 | $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter ); |
813 | | - $wgOut->setPagetitle( wfMsgHtml('actioncomplete') ); |
| 817 | + $out->setPagetitle( wfMsgHtml('actioncomplete') ); |
814 | 818 | if( $this->submitType == 'accept' ) { |
815 | | - $wgOut->addWikiMsg( 'confirmaccount-acc', $name ); |
| 819 | + $out->addWikiMsg( 'confirmaccount-acc', $name ); |
816 | 820 | } elseif( $this->submitType == 'reject' || $this->submitType == 'spam' ) { |
817 | | - $wgOut->addWikiMsg( 'confirmaccount-rej' ); |
| 821 | + $out->addWikiMsg( 'confirmaccount-rej' ); |
818 | 822 | } else { |
819 | | - $wgOut->redirect( $titleObj->getFullUrl() ); |
| 823 | + $out->redirect( $titleObj->getFullUrl() ); |
820 | 824 | return; |
821 | 825 | } |
822 | 826 | # Output any errors |
823 | 827 | foreach( $errors as $error ) { |
824 | | - $wgOut->addHTML( '<p>' . $error . '</p>' ); |
| 828 | + $out->addHTML( '<p>' . $error . '</p>' ); |
825 | 829 | } |
826 | 830 | # Give link to see other requests |
827 | | - $wgOut->returnToMain( true, $titleObj ); |
| 831 | + $out->returnToMain( true, $titleObj ); |
828 | 832 | } |
829 | 833 | |
830 | 834 | protected function showList() { |
831 | | - global $wgOut, $wgUser, $wgLang; |
| 835 | + global $wgUser, $wgLang; |
| 836 | + $out = $this->getOutput(); |
832 | 837 | |
833 | 838 | $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter ); |
834 | 839 | |
— | — | @@ -837,24 +842,24 @@ |
838 | 843 | |
839 | 844 | if( $pager->getNumRows() ) { |
840 | 845 | if( $this->showStale ) { |
841 | | - $wgOut->addHTML( wfMsgExt('confirmaccount-list3', array('parse') ) ); |
| 846 | + $out->addHTML( wfMsgExt('confirmaccount-list3', array('parse') ) ); |
842 | 847 | } elseif( $this->showRejects ) { |
843 | | - $wgOut->addHTML( wfMsgExt('confirmaccount-list2', array('parse') ) ); |
| 848 | + $out->addHTML( wfMsgExt('confirmaccount-list2', array('parse') ) ); |
844 | 849 | } else { |
845 | | - $wgOut->addHTML( wfMsgExt('confirmaccount-list', array('parse') ) ); |
| 850 | + $out->addHTML( wfMsgExt('confirmaccount-list', array('parse') ) ); |
846 | 851 | } |
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() ); |
850 | 855 | } else { |
851 | 856 | if( $this->showRejects ) { |
852 | | - $wgOut->addHTML( wfMsgExt('confirmaccount-none-r', array('parse')) ); |
| 857 | + $out->addHTML( wfMsgExt('confirmaccount-none-r', array('parse')) ); |
853 | 858 | } elseif( $this->showStale ) { |
854 | | - $wgOut->addHTML( wfMsgExt('confirmaccount-none-e', array('parse')) ); |
| 859 | + $out->addHTML( wfMsgExt('confirmaccount-none-e', array('parse')) ); |
855 | 860 | } elseif( $this->showHeld ) { |
856 | | - $wgOut->addHTML( wfMsgExt('confirmaccount-none-h', array('parse')) ); |
| 861 | + $out->addHTML( wfMsgExt('confirmaccount-none-h', array('parse')) ); |
857 | 862 | } else { |
858 | | - $wgOut->addHTML( wfMsgExt('confirmaccount-none-o', array('parse')) ); |
| 863 | + $out->addHTML( wfMsgExt('confirmaccount-none-o', array('parse')) ); |
859 | 864 | } |
860 | 865 | } |
861 | 866 | |