Index: trunk/phase3/includes/specials/SpecialChangeEmail.php |
— | — | @@ -41,27 +41,22 @@ |
42 | 42 | */ |
43 | 43 | function execute( $par ) { |
44 | 44 | global $wgAuth; |
| 45 | + |
45 | 46 | $this->checkReadOnly(); |
46 | 47 | |
47 | | - $request = $this->getRequest(); |
48 | | - $this->mPassword = $request->getVal( 'wpPassword' ); |
49 | | - $this->mNewEmail = $request->getVal( 'wpNewEmail' ); |
50 | | - |
51 | 48 | $this->setHeaders(); |
52 | 49 | $this->outputHeader(); |
53 | 50 | |
54 | | - $out = $this->getOutput(); |
55 | | - $out->disallowUserJs(); |
56 | | - |
57 | | - $user = $this->getUser(); |
58 | | - |
59 | 51 | if ( !$wgAuth->allowPropChange( 'emailaddress' ) ) { |
60 | | - $this->error( wfMsgExt( 'cannotchangeemail', 'parseinline' ) ); |
| 52 | + $this->error( 'cannotchangeemail' ); |
61 | 53 | return; |
62 | 54 | } |
63 | 55 | |
| 56 | + $user = $this->getUser(); |
| 57 | + $request = $this->getRequest(); |
| 58 | + |
64 | 59 | if ( !$request->wasPosted() && !$user->isLoggedIn() ) { |
65 | | - $this->error( wfMsg( 'changeemail-no-info' ) ); |
| 60 | + $this->error( 'changeemail-no-info' ); |
66 | 61 | return; |
67 | 62 | } |
68 | 63 | |
— | — | @@ -70,6 +65,12 @@ |
71 | 66 | return; |
72 | 67 | } |
73 | 68 | |
| 69 | + $out = $this->getOutput(); |
| 70 | + $out->disallowUserJs(); |
| 71 | + |
| 72 | + $this->mPassword = $request->getVal( 'wpPassword' ); |
| 73 | + $this->mNewEmail = $request->getVal( 'wpNewEmail' ); |
| 74 | + |
74 | 75 | if ( $request->wasPosted() |
75 | 76 | && $user->matchEditToken( $request->getVal( 'token' ) ) ) |
76 | 77 | { |
— | — | @@ -101,7 +102,7 @@ |
102 | 103 | } |
103 | 104 | |
104 | 105 | protected function error( $msg ) { |
105 | | - $this->getOutput()->addHTML( Xml::element('p', array( 'class' => 'error' ), $msg ) ); |
| 106 | + $this->getOutput()->wrapWikiMsg( "<p class='error'>\n$1\n</p>", $msg ); |
106 | 107 | } |
107 | 108 | |
108 | 109 | protected function showForm() { |
— | — | @@ -109,10 +110,10 @@ |
110 | 111 | |
111 | 112 | $oldEmailText = $user->getEmail() |
112 | 113 | ? $user->getEmail() |
113 | | - : wfMsg( 'changeemail-none' ); |
| 114 | + : $this->msg( 'changeemail-none' )->text(); |
114 | 115 | |
115 | 116 | $this->getOutput()->addHTML( |
116 | | - Xml::fieldset( wfMsg( 'changeemail-header' ) ) . |
| 117 | + Xml::fieldset( $this->msg( 'changeemail-header' )->text() ) . |
117 | 118 | Xml::openElement( 'form', |
118 | 119 | array( |
119 | 120 | 'method' => 'post', |
— | — | @@ -120,7 +121,7 @@ |
121 | 122 | 'id' => 'mw-changeemail-form' ) ) . "\n" . |
122 | 123 | Html::hidden( 'token', $user->getEditToken() ) . "\n" . |
123 | 124 | Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" . |
124 | | - wfMsgExt( 'changeemail-text', array( 'parse' ) ) . "\n" . |
| 125 | + $this->msg( 'changeemail-text' )->parseAsBlock() . "\n" . |
125 | 126 | Xml::openElement( 'table', array( 'id' => 'mw-changeemail-table' ) ) . "\n" . |
126 | 127 | $this->pretty( array( |
127 | 128 | array( 'wpName', 'username', 'text', $user->getName() ), |
— | — | @@ -131,8 +132,8 @@ |
132 | 133 | "<tr>\n" . |
133 | 134 | "<td></td>\n" . |
134 | 135 | '<td class="mw-input">' . |
135 | | - Xml::submitButton( wfMsg( 'changeemail-submit' ) ) . |
136 | | - Xml::submitButton( wfMsg( 'changeemail-cancel' ), array( 'name' => 'wpCancel' ) ) . |
| 136 | + Xml::submitButton( $this->msg( 'changeemail-submit' )->text() ) . |
| 137 | + Xml::submitButton( $this->msg( 'changeemail-cancel' )->text(), array( 'name' => 'wpCancel' ) ) . |
137 | 138 | "</td>\n" . |
138 | 139 | "</tr>\n" . |
139 | 140 | Xml::closeElement( 'table' ) . |
— | — | @@ -157,9 +158,9 @@ |
158 | 159 | $out .= "<tr>\n"; |
159 | 160 | $out .= "\t<td class='mw-label'>"; |
160 | 161 | if ( $type != 'text' ) { |
161 | | - $out .= Xml::label( wfMsg( $label ), $name ); |
| 162 | + $out .= Xml::label( $this->msg( $label )->text(), $name ); |
162 | 163 | } else { |
163 | | - $out .= wfMsgHtml( $label ); |
| 164 | + $out .= $this->msg( $label )->escaped(); |
164 | 165 | } |
165 | 166 | $out .= "</td>\n"; |
166 | 167 | $out .= "\t<td class='mw-input'>"; |
— | — | @@ -175,18 +176,18 @@ |
176 | 177 | */ |
177 | 178 | protected function attemptChange( User $user, $pass, $newaddr ) { |
178 | 179 | if ( $newaddr != '' && !Sanitizer::validateEmail( $newaddr ) ) { |
179 | | - $this->error( wfMsgExt( 'invalidemailaddress', 'parseinline' ) ); |
| 180 | + $this->error( 'invalidemailaddress' ); |
180 | 181 | return false; |
181 | 182 | } |
182 | 183 | |
183 | 184 | $throttleCount = LoginForm::incLoginThrottle( $user->getName() ); |
184 | 185 | if ( $throttleCount === true ) { |
185 | | - $this->error( wfMsgHtml( 'login-throttled' ) ); |
| 186 | + $this->error( 'login-throttled' ); |
186 | 187 | return false; |
187 | 188 | } |
188 | 189 | |
189 | 190 | if ( !$user->checkTemporaryPassword( $pass ) && !$user->checkPassword( $pass ) ) { |
190 | | - $this->error( wfMsgHtml( 'wrongpassword' ) ); |
| 191 | + $this->error( 'wrongpassword' ); |
191 | 192 | return false; |
192 | 193 | } |
193 | 194 | |