예제 #1
0
 public static function IsCandidate(User $user, $candidate)
 {
     $profile = $user->profile();
     if (!$profile) {
         return false;
     }
     // We only test if the user is in her promotion group for it is too
     // expensive to check if she is in the corresponding ML as well.
     $res = XDB::query('SELECT  COUNT(*)
                          FROM  group_members
                         WHERE  uid = {?} AND asso_id = (SELECT  id
                                                           FROM  groups
                                                          WHERE  diminutif = {?})', $user->id(), $user->profile()->yearPromo());
     $mlCount = $res->fetchOneCell();
     if ($mlCount) {
         Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
     }
     if ($mlCount == 0) {
         $mlist = MailingList::promo($user->profile()->yearPromo());
         try {
             $mlist->getMembersLimit(0, 0);
         } catch (Exception $e) {
             return false;
         }
     }
     return false;
 }
예제 #2
0
파일: ml.inc.php 프로젝트: Ekleog/platal
 public static function IsCandidate(User $user, $candidate)
 {
     $res = XDB::query("SELECT  COUNT(*) AS lists\n                             FROM  register_subs\n                            WHERE  uid = {?} AND type = 'list'", $user->id());
     $mlCount = $res->fetchOneCell();
     if (!$mlCount) {
         Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
     }
     return $mlCount > 0;
 }
예제 #3
0
 public static function IsCandidate(User $user, $candidate)
 {
     require_once 'newsletter.inc.php';
     $isSubscribed = NewsLetter::forGroup(NewsLetter::GROUP_AX)->subscriptionState();
     if ($isSubscribed) {
         Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
     }
     return !$isSubscribed;
 }
예제 #4
0
 public static function IsCandidate(User $user, $candidate)
 {
     if (!$user->checkPerms(User::PERM_MAIL)) {
         return false;
     }
     require_once 'emails.inc.php';
     $active = Email::is_active_storage($user, 'imap');
     if ($active) {
         Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
     }
     return !$active;
 }
예제 #5
0
파일: gapps.inc.php 프로젝트: Ekleog/platal
 public static function IsCandidate(User $user, $candidate)
 {
     if (!$user->checkPerms(User::PERM_MAIL)) {
         return false;
     }
     require_once 'googleapps.inc.php';
     $isSubscribed = GoogleAppsAccount::account_status($user->id());
     if ($isSubscribed == 'disabled') {
         $isSubscribed = false;
     }
     if ($isSubscribed) {
         Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
     }
     return !$isSubscribed;
 }