Index: trunk/extensions/SignupAPI/includes/ApiSignup.php |
— | — | @@ -39,13 +39,13 @@ |
40 | 40 | wfSetupSession(); |
41 | 41 | } |
42 | 42 | |
43 | | - $signupForm = new SignupForm( $req ); |
| 43 | + $signupForm = new SpecialUserSignup( $req ); |
44 | 44 | |
45 | 45 | global $wgCookiePrefix, $wgUser; |
46 | 46 | |
47 | 47 | $signupRes = $signupForm->addNewAccountInternal(); |
48 | 48 | switch( $signupRes ) { |
49 | | - case SignupForm::SUCCESS: |
| 49 | + case SpecialUserSignup::SUCCESS: |
50 | 50 | //$signupForm->initUser($signupForm->mUser); |
51 | 51 | |
52 | 52 | wfRunHooks( 'AddNewAccount', array( $wgUser, false ) ); |
— | — | @@ -66,75 +66,75 @@ |
67 | 67 | $result['sessionid'] = session_id(); |
68 | 68 | break; |
69 | 69 | |
70 | | - case SignupForm::INVALID_DOMAIN: |
| 70 | + case SpecialUserSignup::INVALID_DOMAIN: |
71 | 71 | $result['result'] = 'WrongPassword'; |
72 | 72 | $result['domain']= $signupForm->mDomain; |
73 | 73 | break; |
74 | 74 | |
75 | | - case SignupForm::READ_ONLY_PAGE: |
| 75 | + case SpecialUserSignup::READ_ONLY_PAGE: |
76 | 76 | $result['result'] = 'ReadOnlyPage'; |
77 | 77 | break; |
78 | 78 | |
79 | | - case SignupForm::NO_COOKIES: |
| 79 | + case SpecialUserSignup::NO_COOKIES: |
80 | 80 | $result['result'] = 'NoCookies'; |
81 | 81 | break; |
82 | 82 | |
83 | | - case SignupForm::NEED_TOKEN: |
| 83 | + case SpecialUserSignup::NEED_TOKEN: |
84 | 84 | $result['result'] = 'NeedToken'; |
85 | 85 | $result['token'] = $signupForm->getCreateaccountToken(); |
86 | 86 | $result['cookieprefix'] = $wgCookiePrefix; |
87 | 87 | $result['sessionid'] = session_id(); |
88 | 88 | break; |
89 | 89 | |
90 | | - case SignupForm::WRONG_TOKEN: |
| 90 | + case SpecialUserSignup::WRONG_TOKEN: |
91 | 91 | $result['result'] = 'WrongToken'; |
92 | 92 | break; |
93 | 93 | |
94 | | - case SignupForm::INSUFFICIENT_PERMISSION: |
| 94 | + case SpecialUserSignup::INSUFFICIENT_PERMISSION: |
95 | 95 | $result['result'] = 'InsufficientPermission'; |
96 | 96 | break; |
97 | 97 | |
98 | | - case SignupForm::CREATE_BLOCKED: |
| 98 | + case SpecialUserSignup::CREATE_BLOCKED: |
99 | 99 | $result['result'] = 'CreateBlocked'; |
100 | 100 | break; |
101 | 101 | |
102 | | - case SignupForm::IP_BLOCKED: |
| 102 | + case SpecialUserSignup::IP_BLOCKED: |
103 | 103 | $result['result'] = 'IPBlocked'; |
104 | 104 | break; |
105 | 105 | |
106 | | - case SignupForm::NO_NAME: |
| 106 | + case SpecialUserSignup::NO_NAME: |
107 | 107 | $result['result'] = 'NoName'; |
108 | 108 | break; |
109 | 109 | |
110 | | - case SignupForm::USER_EXISTS: |
| 110 | + case SpecialUserSignup::USER_EXISTS: |
111 | 111 | $result['result'] = 'UserExists'; |
112 | 112 | break; |
113 | 113 | |
114 | | - case SignupForm::WRONG_RETYPE: |
| 114 | + case SpecialUserSignup::WRONG_RETYPE: |
115 | 115 | $result['result'] = 'WrongRetype'; |
116 | 116 | break; |
117 | 117 | |
118 | | - case SignupForm::INVALID_PASS: |
| 118 | + case SpecialUserSignup::INVALID_PASS: |
119 | 119 | $result['result'] = 'InvalidPass'; |
120 | 120 | break; |
121 | 121 | |
122 | | - case SignupForm::NO_EMAIL: |
| 122 | + case SpecialUserSignup::NO_EMAIL: |
123 | 123 | $result['result'] = 'NoEmail'; |
124 | 124 | break; |
125 | 125 | |
126 | | - case SignupForm::INVALID_EMAIL: |
| 126 | + case SpecialUserSignup::INVALID_EMAIL: |
127 | 127 | $result['result'] = 'InvalidEmail'; |
128 | 128 | break; |
129 | 129 | |
130 | | - case SignupForm::BLOCKED_BY_HOOK: |
| 130 | + case SpecialUserSignup::BLOCKED_BY_HOOK: |
131 | 131 | $result['result'] = 'BlockedByHook'; |
132 | 132 | break; |
133 | 133 | |
134 | | - case SignupForm::EXTR_DB_ERROR: |
| 134 | + case SpecialUserSignup::EXTR_DB_ERROR: |
135 | 135 | $result['result'] = 'ExternalDBError'; |
136 | 136 | break; |
137 | 137 | |
138 | | - case SignupForm::THROTLLED: |
| 138 | + case SpecialUserSignup::THROTLLED: |
139 | 139 | $result['result'] = 'Throttled'; |
140 | 140 | break; |
141 | 141 | |
Index: trunk/extensions/SignupAPI/includes/SpecialUserSignup.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | var $mAction, $mCreateaccount, $mCreateaccountMail; |
55 | 55 | var $mRemember, $mEmail, $mDomain, $mLanguage; |
56 | 56 | var $mSkipCookieCheck, $mReturnToQuery, $mToken, $mStickHTTPS; |
57 | | - var $mType, $mReason, $mRealName; |
| 57 | + var $mType, $mReason, $mRealName, $mUsername; |
58 | 58 | var $abortError = ''; |
59 | 59 | var $tempUser, $mConfirmationMailStatus, $mRunCookieRedirect, $mRunCreationConfirmation; |
60 | 60 | var $mSourceAction, $mSourceNS, $msourceArticle; |
— | — | @@ -198,9 +198,11 @@ |
199 | 199 | |
200 | 200 | /** |
201 | 201 | * @private |
| 202 | + * |
| 203 | + * @param $tempUser User |
202 | 204 | */ |
203 | | - function addNewAccount($tempUser) { |
204 | | - global $wgUser, $wgEmailAuthentication, $wgOut; |
| 205 | + function addNewAccount( $tempUser ) { |
| 206 | + global $wgUser, $wgEmailAuthentication; |
205 | 207 | |
206 | 208 | # If we showed up language selection links, and one was in use, be |
207 | 209 | # smart (and sensible) and save that language as the user's preference |
— | — | @@ -243,9 +245,9 @@ |
244 | 246 | * @private |
245 | 247 | */ |
246 | 248 | function addNewAccountInternal() { |
247 | | - global $wgUser, $wgOut; |
| 249 | + global $wgUser; |
248 | 250 | global $wgMemc, $wgAccountCreationThrottle; |
249 | | - global $wgAuth, $wgMinimalPasswordLength; |
| 251 | + global $wgAuth; |
250 | 252 | global $wgEmailConfirmToEdit; |
251 | 253 | |
252 | 254 | // If the user passes an invalid domain, something is fishy |
— | — | @@ -266,7 +268,6 @@ |
267 | 269 | } |
268 | 270 | |
269 | 271 | if ( wfReadOnly() ) { |
270 | | - |
271 | 272 | return self::READ_ONLY_PAGE; |
272 | 273 | } |
273 | 274 | |
— | — | @@ -646,7 +647,6 @@ |
647 | 648 | return; |
648 | 649 | } |
649 | 650 | |
650 | | - |
651 | 651 | if ( $this->mUsername == '' ) { |
652 | 652 | if ( $wgUser->isLoggedIn() ) { |
653 | 653 | $this->mUsername = $wgUser->getName(); |
— | — | @@ -752,18 +752,12 @@ |
753 | 753 | /** |
754 | 754 | * @private |
755 | 755 | * |
756 | | - * @param $tempUserser User |
| 756 | + * @param $tempUser User |
757 | 757 | * |
758 | 758 | * @return Boolean |
759 | 759 | */ |
760 | | - function showCreateOrLoginLink( &$tempUserser ) { |
761 | | - if( $this->mType == 'signup' ) { |
762 | | - return true; |
763 | | - } elseif( $tempUserser->isAllowed( 'createaccount' ) ) { |
764 | | - return true; |
765 | | - } else { |
766 | | - return false; |
767 | | - } |
| 760 | + function showCreateOrLoginLink( $tempUser ) { |
| 761 | + return $this->mType == 'signup' || $tempUser->isAllowed( 'createaccount' ); |
768 | 762 | } |
769 | 763 | |
770 | 764 | /** |