Index: trunk/extensions/ConfirmAccount/dataclasses/ConfirmAccount.class.php |
— | — | @@ -92,6 +92,33 @@ |
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
| 96 | + * Generate a new e-mail confirmation token and send a confirmation |
| 97 | + * mail to the user's given address. |
| 98 | + * |
| 99 | + * @param User $user |
| 100 | + * @param string $ip User IP address |
| 101 | + * @param string $token |
| 102 | + * @param string $expiration |
| 103 | + * @return mixed True on success, a Status object on failure. |
| 104 | + */ |
| 105 | + public static function sendConfirmationMail( User $user, $ip, $token, $expiration ) { |
| 106 | + global $wgContLang; |
| 107 | + $url = self::confirmationTokenUrl( $token ); |
| 108 | + $lang = $user->getOption( 'language' ); |
| 109 | + return $user->sendMail( |
| 110 | + wfMessage( 'requestaccount-email-subj' )->inLanguage( $lang )->text(), |
| 111 | + wfMessage( 'requestaccount-email-body', |
| 112 | + $ip, |
| 113 | + $user->getName(), |
| 114 | + $url, |
| 115 | + $wgContLang->timeanddate( $expiration, false ) , |
| 116 | + $wgContLang->date( $expiration, false ) , |
| 117 | + $wgContLang->time( $expiration, false ) |
| 118 | + )->inLanguage( $lang )->text() |
| 119 | + ); |
| 120 | + } |
| 121 | + |
| 122 | + /** |
96 | 123 | * Verifies that it's ok to include the uploaded file |
97 | 124 | * |
98 | 125 | * @param string $tmpfile the full path of the temporary file to verify |
Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php |
— | — | @@ -372,7 +372,7 @@ |
373 | 373 | $dbw->begin(); |
374 | 374 | $req->insertOn(); |
375 | 375 | # Send confirmation, required! |
376 | | - $result = $this->sendConfirmationMail( $u, $token, $expires ); |
| 376 | + $result = ConfirmAccount::sendConfirmationMail( $u, wfGetIP(), $token, $expires ); |
377 | 377 | if ( !$result->isOK() ) { |
378 | 378 | $dbw->rollback(); // Nevermind |
379 | 379 | $error = wfMsg( 'mailerror', $wgOut->parse( $result->getWikiText() ) ); |
— | — | @@ -485,26 +485,4 @@ |
486 | 486 | ); |
487 | 487 | return $reqID; |
488 | 488 | } |
489 | | - |
490 | | - /** |
491 | | - * Generate a new e-mail confirmation token and send a confirmation |
492 | | - * mail to the user's given address. |
493 | | - * |
494 | | - * @param User $user |
495 | | - * @param string $token |
496 | | - * @param string $expiration |
497 | | - * @return mixed True on success, a Status object on failure. |
498 | | - */ |
499 | | - protected function sendConfirmationMail( $user, $token, $expiration ) { |
500 | | - global $wgContLang; |
501 | | - $url = ConfirmAccount::confirmationTokenUrl( $token ); |
502 | | - return $user->sendMail( wfMsg( 'requestaccount-email-subj' ), |
503 | | - wfMsg( 'requestaccount-email-body', |
504 | | - wfGetIP(), |
505 | | - $user->getName(), |
506 | | - $url, |
507 | | - $wgContLang->timeanddate( $expiration, false ) , |
508 | | - $wgContLang->date( $expiration, false ) , |
509 | | - $wgContLang->time( $expiration, false ) ) ); |
510 | | - } |
511 | 489 | } |