예제 #1
0
 /**
  * Checks the autopromote condition for a user.
  */
 static function AutopromoteCondition($cond_type, $args, $user, &$result)
 {
     global $wgFbUserRightsFromGroup;
     switch ($cond_type) {
         case APCOND_FB_USER:
             $ids = FacebookDB::getFacebookIDs($user);
             $result = count($ids);
             break;
         case APCOND_FB_INGROUP:
             $type = 'member';
         case APCOND_FB_ISADMIN:
             if (empty($type)) {
                 $type = 'admin';
             }
             // If there's no group to pull rights from, the user can't be a member
             $result = false;
             if (!empty($wgFbUserRightsFromGroup)) {
                 $ids = FacebookDB::getFacebookIDs($user);
                 if (count($ids)) {
                     // Assume $user doesn't have more than one Facebook ID
                     $fbUser = new FacebookUser($ids[0]);
                     $rights = $fbUser->getGroupRights();
                     $result = $rights[$type];
                 }
             }
             // end switch
     }
     return true;
 }