From: Kunal Mehta Date: Sun, 3 Aug 2014 21:30:20 +0000 (-0700) Subject: SpecialChangeEmail: Use Config instead of globals X-Git-Tag: 1.31.0-rc.0~14611^2 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=3458a407ec5b5b47516d3def9c8567a5f5a8928f;p=lhc%2Fweb%2Fwiklou.git SpecialChangeEmail: Use Config instead of globals Change-Id: I8c2f6ec440839ebd0a48726c10867eec26946435 --- diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index c57e33b4bc..7fc4a17508 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -136,7 +136,6 @@ class SpecialChangeEmail extends UnlistedSpecialPage { } protected function showForm() { - global $wgRequirePasswordforEmailChange; $user = $this->getUser(); $oldEmailText = $user->getEmail() @@ -160,7 +159,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage { array( 'wpOldEmail', 'changeemail-oldemail', 'text', $oldEmailText ), array( 'wpNewEmail', 'changeemail-newemail', 'email', $this->mNewEmail ), ); - if ( $wgRequirePasswordforEmailChange ) { + if ( $this->getConfig()->get( 'RequirePasswordforEmailChange' ) ) { $items[] = array( 'wpPassword', 'changeemail-password', 'password', $this->mPassword ); } @@ -221,7 +220,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage { * @return bool|string True or string on success, false on failure */ protected function attemptChange( User $user, $pass, $newaddr ) { - global $wgAuth, $wgPasswordAttemptThrottle; + global $wgAuth; if ( $newaddr != '' && !Sanitizer::validateEmail( $newaddr ) ) { $this->error( 'invalidemailaddress' ); @@ -232,16 +231,16 @@ class SpecialChangeEmail extends UnlistedSpecialPage { $throttleCount = LoginForm::incLoginThrottle( $user->getName() ); if ( $throttleCount === true ) { $lang = $this->getLanguage(); + $throttleInfo = $this->getConfig()->get( 'PasswordAttemptThrottle' ); $this->error( array( 'changeemail-throttled', - $lang->formatDuration( $wgPasswordAttemptThrottle['seconds'] ) + $lang->formatDuration( $throttleInfo['seconds'] ) ) ); return false; } - global $wgRequirePasswordforEmailChange; - if ( $wgRequirePasswordforEmailChange + if ( $this->getConfig()->get( 'RequirePasswordforEmailChange' ) && !$user->checkTemporaryPassword( $pass ) && !$user->checkPassword( $pass ) ) {