Merge "Apply IP blocks to X-Forwarded-For header"
[lhc/web/wiklou.git] / includes / User.php
index 8809fe9..dc68502 100644 (file)
@@ -710,7 +710,7 @@ class User {
                                return 'passwordtooshort';
                        } elseif ( $wgContLang->lc( $password ) == $wgContLang->lc( $this->mName ) ) {
                                return 'password-name-match';
-                       } elseif ( isset( $blockedLogins[ $this->getName() ] ) && $password == $blockedLogins[ $this->getName() ] ) {
+                       } elseif ( isset( $blockedLogins[$this->getName()] ) && $password == $blockedLogins[$this->getName()] ) {
                                return 'password-login-forbidden';
                        } else {
                                //it seems weird returning true here, but this is because of the
@@ -1540,7 +1540,7 @@ class User {
                // Set the user limit key
                if ( $userLimit !== false ) {
                        wfDebug( __METHOD__ . ": effective user limit: $userLimit\n" );
-                       $keys[ wfMemcKey( 'limiter', $action, 'user', $id ) ] = $userLimit;
+                       $keys[wfMemcKey( 'limiter', $action, 'user', $id )] = $userLimit;
                }
 
                $triggered = false;
@@ -3682,7 +3682,7 @@ class User {
        protected function getTokenUrl( $page, $token ) {
                // Hack to bypass localization of 'Special:'
                $title = Title::makeTitle( NS_MAIN, "Special:$page/$token" );
-               return $title->getCanonicalUrl();
+               return $title->getCanonicalURL();
        }
 
        /**
@@ -3693,8 +3693,12 @@ class User {
         * @return bool
         */
        public function confirmEmail() {
-               $this->setEmailAuthenticationTimestamp( wfTimestampNow() );
-               wfRunHooks( 'ConfirmEmailComplete', array( $this ) );
+               // Check if it's already confirmed, so we don't touch the database
+               // and fire the ConfirmEmailComplete hook on redundant confirmations.
+               if ( !$this->isEmailConfirmed() ) {
+                       $this->setEmailAuthenticationTimestamp( wfTimestampNow() );
+                       wfRunHooks( 'ConfirmEmailComplete', array( $this ) );
+               }
                return true;
        }
 
@@ -4037,7 +4041,7 @@ class User {
                }
 
                // Re-map numeric keys of AddToSelf/RemoveFromSelf to the 'user' key for backwards compatibility
-               if( empty( $wgGroupsAddToSelf['user']) || $wgGroupsAddToSelf['user'] !== true ) {
+               if( empty( $wgGroupsAddToSelf['user'] ) || $wgGroupsAddToSelf['user'] !== true ) {
                        foreach( $wgGroupsAddToSelf as $key => $value ) {
                                if( is_int( $key ) ) {
                                        $wgGroupsAddToSelf['user'][] = $value;
@@ -4045,7 +4049,7 @@ class User {
                        }
                }
 
-               if( empty( $wgGroupsRemoveFromSelf['user']) || $wgGroupsRemoveFromSelf['user'] !== true ) {
+               if( empty( $wgGroupsRemoveFromSelf['user'] ) || $wgGroupsRemoveFromSelf['user'] !== true ) {
                        foreach( $wgGroupsRemoveFromSelf as $key => $value ) {
                                if( is_int( $key ) ) {
                                        $wgGroupsRemoveFromSelf['user'][] = $value;