<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
{
if ($action == 'yes') {
require_once 'emails.inc.php';
- $storage = new EmailStorage($this->user, 'imap');
- $storage->activate();
-
+ Email::activate_storage($this->user, 'imap');
$this->UpdateOnYes();
}
return 'Xorg/IMAP';
}
- public static function IsCandidate(User &$user, $candidate)
+ public static function IsCandidate(User $user, $candidate)
{
+ if (!$user->checkPerms(User::PERM_MAIL)) {
+ return false;
+ }
+
require_once 'emails.inc.php';
- $storage = new EmailStorage($user, 'imap');
- if ($storage->active) {
+ $active = Email::is_active_storage($user, 'imap')
+ if ($active) {
Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
}
- return !$storage->active;
+ return !$active;
}
}