Index: trunk/phase3/includes/specials/SpecialEmailuser.php |
— | — | @@ -29,11 +29,11 @@ |
30 | 30 | class SpecialEmailUser extends UnlistedSpecialPage { |
31 | 31 | protected $mTarget; |
32 | 32 | |
33 | | - public function __construct(){ |
| 33 | + public function __construct() { |
34 | 34 | parent::__construct( 'Emailuser' ); |
35 | 35 | } |
36 | 36 | |
37 | | - protected function getFormFields(){ |
| 37 | + protected function getFormFields() { |
38 | 38 | global $wgUser; |
39 | 39 | return array( |
40 | 40 | 'From' => array( |
— | — | @@ -119,12 +119,12 @@ |
120 | 120 | } |
121 | 121 | // Got a valid target user name? Else ask for one. |
122 | 122 | $ret = self::getTarget( $this->mTarget ); |
123 | | - if( ! $ret instanceof User ){ |
| 123 | + if( !$ret instanceof User ) { |
124 | 124 | if( $this->mTarget != '' ) { |
125 | | - $ret = ( $ret == 'notarget' ) ? 'emailnotarget' : ( $ret . 'text' ) ; |
126 | | - $wgOut->addHtml ( '<p class="error">' . wfMessage( $ret )->parse() . '</p>' ); |
| 125 | + $ret = ( $ret == 'notarget' ) ? 'emailnotarget' : ( $ret . 'text' ); |
| 126 | + $wgOut->addHTML( '<p class="error">' . wfMessage( $ret )->parse() . '</p>' ); |
127 | 127 | } |
128 | | - $wgOut->addHtml (self::userForm( $this->mTarget ) ); |
| 128 | + $wgOut->addHTML( self::userForm( $this->mTarget ) ); |
129 | 129 | return false; |
130 | 130 | } |
131 | 131 | |
— | — | @@ -138,15 +138,15 @@ |
139 | 139 | $form->setWrapperLegend( wfMsgExt( 'email-legend', 'parsemag' ) ); |
140 | 140 | $form->loadData(); |
141 | 141 | |
142 | | - if( !wfRunHooks( 'EmailUserForm', array( &$form ) ) ){ |
| 142 | + if( !wfRunHooks( 'EmailUserForm', array( &$form ) ) ) { |
143 | 143 | return false; |
144 | 144 | } |
145 | 145 | |
146 | | - $wgOut->setPagetitle( wfMsg( 'emailpage' ) ); |
| 146 | + $wgOut->setPageTitle( wfMsg( 'emailpage' ) ); |
147 | 147 | $result = $form->show(); |
148 | 148 | |
149 | | - if( $result === true || ( $result instanceof Status && $result->isGood() ) ){ |
150 | | - $wgOut->setPagetitle( wfMsg( 'emailsent' ) ); |
| 149 | + if( $result === true || ( $result instanceof Status && $result->isGood() ) ) { |
| 150 | + $wgOut->setPageTitle( wfMsg( 'emailsent' ) ); |
151 | 151 | $wgOut->addWikiMsg( 'emailsenttext' ); |
152 | 152 | $wgOut->returnToMain( false, $this->mTargetObj->getUserPage() ); |
153 | 153 | } |
— | — | @@ -168,10 +168,10 @@ |
169 | 169 | if( !$nu instanceof User || !$nu->getId() ) { |
170 | 170 | wfDebug( "Target is invalid user.\n" ); |
171 | 171 | return 'notarget'; |
172 | | - } else if ( !$nu->isEmailConfirmed() ) { |
| 172 | + } elseif ( !$nu->isEmailConfirmed() ) { |
173 | 173 | wfDebug( "User has no valid email.\n" ); |
174 | 174 | return 'noemail'; |
175 | | - } else if ( !$nu->canReceiveEmail() ) { |
| 175 | + } elseif ( !$nu->canReceiveEmail() ) { |
176 | 176 | wfDebug( "User does not allow user emails.\n" ); |
177 | 177 | return 'nowikiemail'; |
178 | 178 | } |
— | — | @@ -188,7 +188,7 @@ |
189 | 189 | */ |
190 | 190 | public static function getPermissionsError( $user, $editToken ) { |
191 | 191 | global $wgEnableEmail, $wgEnableUserEmail; |
192 | | - if( !$wgEnableEmail || !$wgEnableUserEmail ){ |
| 192 | + if( !$wgEnableEmail || !$wgEnableUserEmail ) { |
193 | 193 | return 'usermaildisabled'; |
194 | 194 | } |
195 | 195 | |
— | — | @@ -196,7 +196,7 @@ |
197 | 197 | return 'badaccess'; |
198 | 198 | } |
199 | 199 | |
200 | | - if( !$user->isEmailConfirmed() ){ |
| 200 | + if( !$user->isEmailConfirmed() ) { |
201 | 201 | return 'mailnologin'; |
202 | 202 | } |
203 | 203 | |
— | — | @@ -219,19 +219,19 @@ |
220 | 220 | |
221 | 221 | return null; |
222 | 222 | } |
223 | | - |
| 223 | + |
224 | 224 | /** |
225 | 225 | * Form to ask for target user name. |
226 | | - * @author purodha |
227 | | - * @param $name string User name submitted. |
228 | | - * @return string form asking for user name. |
| 226 | + * |
| 227 | + * @param $name String: user name submitted. |
| 228 | + * @return String: form asking for user name. |
229 | 229 | */ |
230 | 230 | static function userForm( $name ) { |
231 | | - $string = Xml::openElement( 'form', array( 'method' => 'get', 'action' => '', 'id' => 'askusername' ) ) . |
| 231 | + $string = Xml::openElement( 'form', array( 'method' => 'get', 'action' => '', 'id' => 'askusername' ) ) . |
232 | 232 | Xml::openElement( 'fieldset' ) . |
233 | 233 | Html::rawElement( 'legend', null, wfMessage( 'emailtarget' )->parse() ) . |
234 | | - Xml::inputLabel( wfMessage('emailusername')->text(), 'target', 'emailusertarget', 30, $name ) . ' ' . |
235 | | - Xml::submitButton( wfMessage('emailusernamesubmit')->text() ) . |
| 234 | + Xml::inputLabel( wfMessage( 'emailusername' )->text(), 'target', 'emailusertarget', 30, $name ) . ' ' . |
| 235 | + Xml::submitButton( wfMessage( 'emailusernamesubmit' )->text() ) . |
236 | 236 | Xml::closeElement( 'fieldset' ) . |
237 | 237 | Xml::closeElement( 'form' ) . "\n"; |
238 | 238 | return $string; |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | global $wgUser, $wgUserEmailUseReplyTo; |
251 | 251 | |
252 | 252 | $target = self::getTarget( $data['Target'] ); |
253 | | - if( !$target instanceof User ){ |
| 253 | + if( !$target instanceof User ) { |
254 | 254 | return wfMsgExt( $target . 'text', 'parse' ); |
255 | 255 | } |
256 | 256 | $to = new MailAddress( $target ); |