X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialChangeEmail.php;h=eae8e3a1483f461cc788978d43022c9a6c9d6ac6;hb=21b7b27f0379cff1b06efa95d27fa88684b65c57;hp=167d4e2c80296562495e1d4604d98da557b4a754;hpb=209fcaf4d497e7420b3286f4c502fbec9b2d73a8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index 167d4e2c80..eae8e3a148 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -27,10 +27,26 @@ * @ingroup SpecialPage */ class SpecialChangeEmail extends UnlistedSpecialPage { + + /** + * Users password + * @var string + */ + protected $mPassword; + + /** + * Users new email address + * @var string + */ + protected $mNewEmail; + public function __construct() { parent::__construct( 'ChangeEmail' ); } + /** + * @return Bool + */ function isListed() { global $wgAuth; return $wgAuth->allowPropChange( 'emailaddress' ); @@ -90,6 +106,9 @@ class SpecialChangeEmail extends UnlistedSpecialPage { $this->showForm(); } + /** + * @param $type string + */ protected function doReturnTo( $type = 'hard' ) { $titleObj = Title::newFromText( $this->getRequest()->getVal( 'returnto' ) ); if ( !$titleObj instanceof Title ) { @@ -102,11 +121,15 @@ class SpecialChangeEmail extends UnlistedSpecialPage { } } + /** + * @param $msg string + */ protected function error( $msg ) { $this->getOutput()->wrapWikiMsg( "
\n$1\n
", $msg ); } protected function showForm() { + global $wgRequirePasswordforEmailChange; $user = $this->getUser(); $oldEmailText = $user->getEmail() @@ -123,13 +146,20 @@ class SpecialChangeEmail extends UnlistedSpecialPage { Html::hidden( 'token', $user->getEditToken() ) . "\n" . Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" . $this->msg( 'changeemail-text' )->parseAsBlock() . "\n" . - Xml::openElement( 'table', array( 'id' => 'mw-changeemail-table' ) ) . "\n" . - $this->pretty( array( - array( 'wpName', 'username', 'text', $user->getName() ), - array( 'wpOldEmail', 'changeemail-oldemail', 'text', $oldEmailText ), - array( 'wpNewEmail', 'changeemail-newemail', 'input', $this->mNewEmail ), - array( 'wpPassword', 'yourpassword', 'password', $this->mPassword ), - ) ) . "\n" . + Xml::openElement( 'table', array( 'id' => 'mw-changeemail-table' ) ) . "\n" + ); + $items = array( + array( 'wpName', 'username', 'text', $user->getName() ), + array( 'wpOldEmail', 'changeemail-oldemail', 'text', $oldEmailText ), + array( 'wpNewEmail', 'changeemail-newemail', 'email', $this->mNewEmail ), + ); + if ( $wgRequirePasswordforEmailChange ) { + $items[] = array( 'wpPassword', 'changeemail-password', 'password', $this->mPassword ); + } + + $this->getOutput()->addHTML( + $this->pretty( $items ) . + "\n" . "