Merge "Followup I4049b666: "Removing prefix exception for HTMLCheckMatrix""
[lhc/web/wiklou.git] / includes / specials / SpecialChangeEmail.php
index e678259..7fc4a17 100644 (file)
@@ -27,7 +27,6 @@
  * @ingroup SpecialPage
  */
 class SpecialChangeEmail extends UnlistedSpecialPage {
-
        /**
         * Users password
         * @var string
@@ -45,7 +44,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
        }
 
        /**
-        * @return Bool
+        * @return bool
         */
        function isListed() {
                global $wgAuth;
@@ -55,6 +54,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
 
        /**
         * Main execution point
+        * @param string $par
         */
        function execute( $par ) {
                global $wgAuth;
@@ -114,7 +114,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
        }
 
        /**
-        * @param $type string
+        * @param string $type
         */
        protected function doReturnTo( $type = 'hard' ) {
                $titleObj = Title::newFromText( $this->getRequest()->getVal( 'returnto' ) );
@@ -129,14 +129,13 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
        }
 
        /**
-        * @param $msg string
+        * @param string $msg
         */
        protected function error( $msg ) {
                $this->getOutput()->wrapWikiMsg( "<p class='error'>\n$1\n</p>", $msg );
        }
 
        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 );
                }
 
@@ -181,7 +180,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
        }
 
        /**
-        * @param $fields array
+        * @param array $fields
         * @return string
         */
        protected function pretty( $fields ) {
@@ -215,13 +214,13 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
        }
 
        /**
-        * @param $user User
-        * @param $pass string
-        * @param $newaddr string
-        * @return bool|string true or string on success, false on failure
+        * @param User $user
+        * @param string $pass
+        * @param string $newaddr
+        * @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,13 +231,19 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
                $throttleCount = LoginForm::incLoginThrottle( $user->getName() );
                if ( $throttleCount === true ) {
                        $lang = $this->getLanguage();
-                       $this->error( array( 'changeemail-throttled', $lang->formatDuration( $wgPasswordAttemptThrottle['seconds'] ) ) );
+                       $throttleInfo = $this->getConfig()->get( 'PasswordAttemptThrottle' );
+                       $this->error( array(
+                               'changeemail-throttled',
+                               $lang->formatDuration( $throttleInfo['seconds'] )
+                       ) );
 
                        return false;
                }
 
-               global $wgRequirePasswordforEmailChange;
-               if ( $wgRequirePasswordforEmailChange && !$user->checkTemporaryPassword( $pass ) && !$user->checkPassword( $pass ) ) {
+               if ( $this->getConfig()->get( 'RequirePasswordforEmailChange' )
+                       && !$user->checkTemporaryPassword( $pass )
+                       && !$user->checkPassword( $pass )
+               ) {
                        $this->error( 'wrongpassword' );
 
                        return false;