Same for $this->user
[lhc/web/wiklou.git] / includes / Autopromote.php
index 4220bd9..b509742 100644 (file)
@@ -18,7 +18,7 @@ class Autopromote {
                        if( self::recCheckCondition( $cond, $user ) )
                                $promote[] = $group;
                }
-               return array_unique( $promote );
+               return $promote;
        }
 
        /**
@@ -85,8 +85,6 @@ class Autopromote {
                switch( $cond[0] ) {
                        case APCOND_EMAILCONFIRMED:
                                if( User::isValidEmailAddr( $user->getEmail() ) ) {
-                                       # FIXME: EMAILCONFIRMED is always true if
-                                       # wgEmailAuthentication if false, this is confusing.
                                        global $wgEmailAuthentication;
                                        if( $wgEmailAuthentication ) {
                                                return $user->getEmailAuthenticationTimestamp() ? true : false;
@@ -100,6 +98,9 @@ class Autopromote {
                        case APCOND_AGE:
                                $age = time() - wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
                                return $age >= $cond[1];
+                       case APCOND_INGROUPS:
+                               $groups = array_slice( $cond, 1 );
+                               return count( array_intersect( $groups, $user->getGroups() ) ) == count( $groups );
                        default:
                                $result = null;
                                wfRunHooks( 'AutopromoteCondition', array( $cond[0], array_slice( $cond, 1 ), $user, &$result ) );