Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/UserCredentials_body.php |
— | — | @@ -7,11 +7,12 @@ |
8 | 8 | } |
9 | 9 | |
10 | 10 | function execute( $par ) { |
11 | | - global $wgUser, $wgAccountRequestTypes; |
| 11 | + global $wgAccountRequestTypes; |
12 | 12 | $out = $this->getOutput(); |
13 | 13 | $request = $this->getRequest(); |
| 14 | + $reqUser = $this->getUser(); |
14 | 15 | |
15 | | - if ( !$wgUser->isAllowed( 'lookupcredentials' ) ) { |
| 16 | + if ( !$reqUser->isAllowed( 'lookupcredentials' ) ) { |
16 | 17 | $out->permissionRequired( 'lookupcredentials' ); |
17 | 18 | return; |
18 | 19 | } |
— | — | @@ -23,7 +24,7 @@ |
24 | 25 | # Attachments |
25 | 26 | $this->file = $request->getVal( 'file' ); |
26 | 27 | |
27 | | - $this->skin = $wgUser->getSkin(); |
| 28 | + $this->skin = $reqUser->getSkin(); |
28 | 29 | |
29 | 30 | if ( $this->file ) { |
30 | 31 | $this->showFile( $this->file ); |
— | — | @@ -55,12 +56,13 @@ |
56 | 57 | } |
57 | 58 | |
58 | 59 | function showCredentials() { |
59 | | - global $wgUser, $wgLang, $wgAccountRequestTypes; |
| 60 | + global $wgLang, $wgAccountRequestTypes; |
| 61 | + $reqUser = $this->getUser(); |
60 | 62 | $out = $this->getOutput(); |
61 | 63 | |
62 | 64 | $titleObj = SpecialPage::getTitleFor( 'UserCredentials' ); |
63 | 65 | |
64 | | - $row = $this->getRequest(); |
| 66 | + $row = $this->getAccountData(); |
65 | 67 | if ( !$row ) { |
66 | 68 | $out->addHTML( wfMsgHtml( 'usercredentials-badid' ) ); |
67 | 69 | return; |
— | — | @@ -159,7 +161,7 @@ |
160 | 162 | $form .= ConfirmAccountsPage::parseLinks( $row->acd_urls ); |
161 | 163 | } |
162 | 164 | |
163 | | - if ( $wgUser->isAllowed( 'requestips' ) ) { |
| 165 | + if ( $reqUser->isAllowed( 'requestips' ) ) { |
164 | 166 | $blokip = SpecialPage::getTitleFor( 'blockip' ); |
165 | 167 | $form .= "<p>" . wfMsgHtml( 'usercredentials-ip' ) . " " . htmlspecialchars( $row->acd_ip ) . "</p>\n"; |
166 | 168 | } |
— | — | @@ -206,7 +208,7 @@ |
207 | 209 | wfStreamFile( $path ); |
208 | 210 | } |
209 | 211 | |
210 | | - function getRequest() { |
| 212 | + function getAccountData() { |
211 | 213 | $uid = User::idFromName( $this->target ); |
212 | 214 | if ( !$uid ) |
213 | 215 | return false; |
Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php |
— | — | @@ -7,14 +7,15 @@ |
8 | 8 | } |
9 | 9 | |
10 | 10 | function execute( $par ) { |
11 | | - global $wgUser, $wgUseRealNamesOnly, |
| 11 | + global $wgUseRealNamesOnly, |
12 | 12 | $wgAccountRequestToS, $wgAccountRequestExtraInfo, $wgAccountRequestTypes; |
13 | 13 | # If a user cannot make accounts, don't let them request them either |
14 | 14 | global $wgAccountRequestWhileBlocked; |
15 | 15 | |
| 16 | + $reqUser = $this->getUser(); |
16 | 17 | $request = $this->getRequest(); |
17 | 18 | $out = $this->getOutput(); |
18 | | - if ( !$wgAccountRequestWhileBlocked && $wgUser->isBlockedFromCreateAccount() ) { |
| 19 | + if ( !$wgAccountRequestWhileBlocked && $reqUser->isBlockedFromCreateAccount() ) { |
19 | 20 | $out->blockedPage(); |
20 | 21 | return; |
21 | 22 | } |
— | — | @@ -62,10 +63,10 @@ |
63 | 64 | # We may be confirming an email address here |
64 | 65 | $emailCode = $request->getText( 'wpEmailToken' ); |
65 | 66 | |
66 | | - $this->skin = $wgUser->getSkin(); |
| 67 | + $this->skin = $reqUser->getSkin(); |
67 | 68 | |
68 | 69 | $action = $request->getVal( 'action' ); |
69 | | - if ( $request->wasPosted() && $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) { |
| 70 | + if ( $request->wasPosted() && $reqUser->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) { |
70 | 71 | $this->mPrevAttachment = $this->mPrevAttachment ? $this->mPrevAttachment : $this->mSrcName; |
71 | 72 | $this->doSubmit(); |
72 | 73 | } elseif ( $action == 'confirmemail' ) { |
— | — | @@ -77,10 +78,12 @@ |
78 | 79 | } |
79 | 80 | |
80 | 81 | protected function showForm( $msg = '', $forgotFile = 0 ) { |
81 | | - global $wgUser, $wgUseRealNamesOnly, $wgAllowRealName; |
| 82 | + global $wgUseRealNamesOnly, $wgAllowRealName; |
82 | 83 | global $wgAccountRequestToS, $wgAccountRequestTypes, $wgAccountRequestExtraInfo, |
83 | 84 | $wgAllowAccountRequestFiles, $wgMakeUserPageFromBio; |
84 | 85 | |
| 86 | + $reqUser = $this->getUser(); |
| 87 | + |
85 | 88 | $this->mForgotAttachment = $forgotFile; |
86 | 89 | |
87 | 90 | $out = $this->getOutput(); |
— | — | @@ -90,7 +93,7 @@ |
91 | 94 | $out->addHTML( '<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>' ); |
92 | 95 | } |
93 | 96 | # Give notice to users that are logged in |
94 | | - if ( $wgUser->getID() ) { |
| 97 | + if ( $reqUser->getID() ) { |
95 | 98 | $out->addWikiMsg( 'requestaccount-dup' ); |
96 | 99 | } |
97 | 100 | |
— | — | @@ -198,7 +201,7 @@ |
199 | 202 | # FIXME: do this better... |
200 | 203 | global $wgConfirmAccountCaptchas, $wgCaptchaClass, $wgCaptchaTriggers; |
201 | 204 | if ( $wgConfirmAccountCaptchas && isset( $wgCaptchaClass ) |
202 | | - && $wgCaptchaTriggers['createaccount'] && !$wgUser->isAllowed( 'skipcaptcha' ) ) |
| 205 | + && $wgCaptchaTriggers['createaccount'] && !$reqUser->isAllowed( 'skipcaptcha' ) ) |
203 | 206 | { |
204 | 207 | $captcha = new $wgCaptchaClass; |
205 | 208 | # Hook point to add captchas |
— | — | @@ -208,7 +211,7 @@ |
209 | 212 | $form .= '</fieldset>'; |
210 | 213 | } |
211 | 214 | $form .= Html::Hidden( 'title', $this->getTitle()->getPrefixedDBKey() ) . "\n"; |
212 | | - $form .= Html::Hidden( 'wpEditToken', $wgUser->editToken() ) . "\n"; |
| 215 | + $form .= Html::Hidden( 'wpEditToken', $reqUser->editToken() ) . "\n"; |
213 | 216 | $form .= Html::Hidden( 'attachment', $this->mPrevAttachment ) . "\n"; |
214 | 217 | $form .= Html::Hidden( 'forgotAttachment', $this->mForgotAttachment ) . "\n"; |
215 | 218 | $form .= "<p>" . Xml::submitButton( wfMsgHtml( 'requestaccount-submit' ) ) . "</p>"; |
— | — | @@ -220,7 +223,8 @@ |
221 | 224 | } |
222 | 225 | |
223 | 226 | protected function doSubmit() { |
224 | | - global $wgUser, $wgAuth, $wgAccountRequestThrottle; |
| 227 | + global $wgAuth, $wgAccountRequestThrottle; |
| 228 | + $reqUser = $this->getUser(); |
225 | 229 | $out = $this->getOutput(); |
226 | 230 | # Now create a dummy user ($u) and check if it is valid |
227 | 231 | $name = trim( $this->mUsername ); |
— | — | @@ -247,7 +251,7 @@ |
248 | 252 | $wgCaptchaTriggers['createaccount'] = $old; |
249 | 253 | } |
250 | 254 | # No request spamming... |
251 | | - if ( $wgAccountRequestThrottle && $wgUser->isPingLimitable() ) { |
| 255 | + if ( $wgAccountRequestThrottle && $reqUser->isPingLimitable() ) { |
252 | 256 | global $wgMemc; |
253 | 257 | $key = wfMemcKey( 'acctrequest', 'ip', wfGetIP() ); |
254 | 258 | $value = $wgMemc->get( $key ); |
— | — | @@ -386,7 +390,7 @@ |
387 | 391 | $wgMemc->delete( $key ); |
388 | 392 | # No request spamming... |
389 | 393 | # BC: check if isPingLimitable() exists |
390 | | - if ( $wgAccountRequestThrottle && $wgUser->isPingLimitable() ) { |
| 394 | + if ( $wgAccountRequestThrottle && $reqUser->isPingLimitable() ) { |
391 | 395 | $key = wfMemcKey( 'acctrequest', 'ip', wfGetIP() ); |
392 | 396 | if ( !$value = $wgMemc->incr( $key ) ) { |
393 | 397 | $wgMemc->set( $key, 1, 86400 ); |
— | — | @@ -428,7 +432,8 @@ |
429 | 433 | * @param int $limit number of accounts allowed to be requested from the same IP |
430 | 434 | */ |
431 | 435 | protected function confirmEmailToken( $code ) { |
432 | | - global $wgUser, $wgConfirmAccountContact, $wgPasswordSender; |
| 436 | + global $wgConfirmAccountContact, $wgPasswordSender; |
| 437 | + $reqUser = $this->getUser(); |
433 | 438 | $out = $this->getOutput(); |
434 | 439 | # Confirm if this token is in the pending requests |
435 | 440 | $name = ConfirmAccount::requestNameFromEmailToken( $code ); |
— | — | @@ -457,9 +462,9 @@ |
458 | 463 | $user = User::newFromConfirmationCode( $code ); |
459 | 464 | if ( is_object( $user ) ) { |
460 | 465 | if ( $user->confirmEmail() ) { |
461 | | - $message = $wgUser->isLoggedIn() ? 'confirmemail_loggedin' : 'confirmemail_success'; |
| 466 | + $message = $reqUser->isLoggedIn() ? 'confirmemail_loggedin' : 'confirmemail_success'; |
462 | 467 | $out->addWikiMsg( $message ); |
463 | | - if ( !$wgUser->isLoggedIn() ) { |
| 468 | + if ( !$reqUser->isLoggedIn() ) { |
464 | 469 | $title = SpecialPage::getTitleFor( 'Userlogin' ); |
465 | 470 | $out->returnToMain( true, $title->getPrefixedUrl() ); |
466 | 471 | } |
Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/ConfirmAccount_body.php |
— | — | @@ -8,15 +8,16 @@ |
9 | 9 | |
10 | 10 | // @TODO: split out listlink mess |
11 | 11 | function execute( $par ) { |
12 | | - global $wgUser, $wgAccountRequestTypes, $wgLang; |
| 12 | + global $wgAccountRequestTypes, $wgLang; |
13 | 13 | |
| 14 | + $reqUser = $this->getUser(); |
14 | 15 | $request = $this->getRequest(); |
15 | 16 | $out = $this->getOutput(); |
16 | | - if( !$wgUser->isAllowed( 'confirmaccount' ) ) { |
| 17 | + if( !$reqUser->isAllowed( 'confirmaccount' ) ) { |
17 | 18 | $out->permissionRequired( 'confirmaccount' ); |
18 | 19 | return; |
19 | 20 | } |
20 | | - if( !$wgUser->getID() ) { |
| 21 | + if( !$reqUser->getID() ) { |
21 | 22 | $out->permissionRequired( 'user' ); |
22 | 23 | return; |
23 | 24 | } |
— | — | @@ -73,7 +74,7 @@ |
74 | 75 | } |
75 | 76 | } |
76 | 77 | |
77 | | - $this->skin = $wgUser->getSkin(); |
| 78 | + $this->skin = $reqUser->getSkin(); |
78 | 79 | |
79 | 80 | $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter ); |
80 | 81 | |
— | — | @@ -131,7 +132,7 @@ |
132 | 133 | "</i></strong> [{$listLink}] <strong>{$viewall}</strong>" ); |
133 | 134 | } |
134 | 135 | |
135 | | - if( $request->wasPosted() && $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) { |
| 136 | + if( $request->wasPosted() && $reqUser->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) { |
136 | 137 | $this->doSubmit(); |
137 | 138 | } elseif( $this->file ) { |
138 | 139 | $this->showFile( $this->file ); |
— | — | @@ -190,7 +191,8 @@ |
191 | 192 | } |
192 | 193 | |
193 | 194 | protected function showForm( $msg='' ) { |
194 | | - global $wgUser, $wgLang, $wgAccountRequestTypes; |
| 195 | + global $wgLang, $wgAccountRequestTypes; |
| 196 | + $reqUser = $this->getUser(); |
195 | 197 | $out = $this->getOutput(); |
196 | 198 | |
197 | 199 | $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter ); |
— | — | @@ -306,7 +308,7 @@ |
307 | 309 | "</textarea></p>\n"; |
308 | 310 | $form .= '</fieldset>'; |
309 | 311 | global $wgAccountRequestExtraInfo; |
310 | | - if ($wgAccountRequestExtraInfo || $wgUser->isAllowed( 'requestips' ) ) { |
| 312 | + if ($wgAccountRequestExtraInfo || $reqUser->isAllowed( 'requestips' ) ) { |
311 | 313 | $form .= '<fieldset>'; |
312 | 314 | $form .= '<legend>' . wfMsgHtml('confirmaccount-leg-other') . '</legend>'; |
313 | 315 | if( $wgAccountRequestExtraInfo ) { |
— | — | @@ -324,7 +326,7 @@ |
325 | 327 | $form .= "<p>".wfMsgHtml('confirmaccount-urls')."</p>\n"; |
326 | 328 | $form .= self::parseLinks($row->acr_urls); |
327 | 329 | } |
328 | | - if( $wgUser->isAllowed( 'requestips' ) ) { |
| 330 | + if( $reqUser->isAllowed( 'requestips' ) ) { |
329 | 331 | $blokip = SpecialPage::getTitleFor( 'Block' ); |
330 | 332 | $form .= "<p>".wfMsgHtml('confirmaccount-ip')." ".htmlspecialchars($row->acr_ip). |
331 | 333 | " (" . $this->skin->makeKnownLinkObj( $blokip, wfMsgHtml('blockip'), |
— | — | @@ -362,7 +364,7 @@ |
363 | 365 | $form .= Html::Hidden( 'action', 'reject' ); |
364 | 366 | $form .= Html::Hidden( 'acrid', $row->acr_id ); |
365 | 367 | $form .= Html::Hidden( 'wpShowRejects', $this->showRejects ); |
366 | | - $form .= Html::Hidden( 'wpEditToken', $wgUser->editToken() )."\n"; |
| 368 | + $form .= Html::Hidden( 'wpEditToken', $reqUser->editToken() )."\n"; |
367 | 369 | $form .= Xml::closeElement( 'form' ); |
368 | 370 | |
369 | 371 | $out->addHTML( $form ); |
— | — | @@ -371,7 +373,7 @@ |
372 | 374 | # Set a key to who is looking at this request. |
373 | 375 | # Have it expire in 10 minutes... |
374 | 376 | $key = wfMemcKey( 'acctrequest', 'view', $row->acr_id ); |
375 | | - $wgMemc->set( $key, $wgUser->getID(), 60*10 ); |
| 377 | + $wgMemc->set( $key, $reqUser->getID(), 60*10 ); |
376 | 378 | } |
377 | 379 | |
378 | 380 | /** |
— | — | @@ -400,7 +402,7 @@ |
401 | 403 | } |
402 | 404 | |
403 | 405 | protected function doSubmit() { |
404 | | - global $wgUser; |
| 406 | + $reqUser = $this->getUser(); |
405 | 407 | $out = $this->getOutput(); |
406 | 408 | |
407 | 409 | $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter ); |
— | — | @@ -422,7 +424,7 @@ |
423 | 425 | $dbw->begin(); |
424 | 426 | $dbw->update( 'account_requests', |
425 | 427 | array( 'acr_rejected' => $dbw->timestamp(), |
426 | | - 'acr_user' => $wgUser->getID(), |
| 428 | + 'acr_user' => $reqUser->getID(), |
427 | 429 | 'acr_comment' => ($this->submitType == 'spam') ? '' : $this->reason, |
428 | 430 | 'acr_deleted' => 1 ), |
429 | 431 | array( 'acr_id' => $this->acrID, 'acr_deleted' => 0 ), |
— | — | @@ -533,7 +535,7 @@ |
534 | 536 | 'acd_areas' => $row->acr_areas, |
535 | 537 | 'acd_registration' => $row->acr_registration, |
536 | 538 | 'acd_accepted' => $dbw->timestamp(), |
537 | | - 'acd_user' => $wgUser->getID(), |
| 539 | + 'acd_user' => $reqUser->getID(), |
538 | 540 | 'acd_comment' => $this->reason, |
539 | 541 | 'acd_id' => $acd_id ), |
540 | 542 | __METHOD__ |
— | — | @@ -687,7 +689,7 @@ |
688 | 690 | # Finally, done!!! |
689 | 691 | $this->showSuccess( $this->submitType, $user->getName(), array( $error ) ); |
690 | 692 | } elseif( $this->submitType === 'hold' ) { |
691 | | - global $wgUser; |
| 693 | + $reqUser = $this->getUser(); |
692 | 694 | |
693 | 695 | # Make proxy user to email a message |
694 | 696 | $u = User::newFromName( $row->acr_name, 'creatable' ); |
— | — | @@ -709,7 +711,7 @@ |
710 | 712 | $dbw->begin(); |
711 | 713 | $dbw->update( 'account_requests', |
712 | 714 | array( 'acr_held' => $dbw->timestamp(), |
713 | | - 'acr_user' => $wgUser->getID(), |
| 715 | + 'acr_user' => $reqUser->getID(), |
714 | 716 | 'acr_comment' => $this->reason ), |
715 | 717 | array( 'acr_id' => $this->acrID, 'acr_held IS NULL', 'acr_deleted' => 0 ), |
716 | 718 | __METHOD__ |
— | — | @@ -831,7 +833,8 @@ |
832 | 834 | } |
833 | 835 | |
834 | 836 | protected function showList() { |
835 | | - global $wgUser, $wgLang; |
| 837 | + global $wgLang; |
| 838 | + $reqUser = $this->getUser(); |
836 | 839 | $out = $this->getOutput(); |
837 | 840 | |
838 | 841 | $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter ); |
— | — | @@ -870,7 +873,8 @@ |
871 | 874 | } |
872 | 875 | |
873 | 876 | public function formatRow( $row ) { |
874 | | - global $wgLang, $wgUser, $wgUseRealNamesOnly, $wgAllowRealName; |
| 877 | + global $wgLang, $wgUseRealNamesOnly, $wgAllowRealName; |
| 878 | + $reqUser = $this->getUser(); |
875 | 879 | |
876 | 880 | $titleObj = SpecialPage::getTitleFor( 'ConfirmAccounts', $this->specialPageParameter ); |
877 | 881 | if( $this->showRejects || $this->showStale ) { |