X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Freminder%2Fml.inc.php;h=82446541553b5df05a6a3b6613bde1f03ade391e;hb=26ba053e75092d038f571b77eaf3005509da0648;hp=81a47662cd49c6f6f44a340e282f06c6ddc1c5dd;hpb=0e4b87b287fc40f2d33be0379980e16d6fa30055;p=platal.git diff --git a/include/reminder/ml.inc.php b/include/reminder/ml.inc.php index 81a4766..8244654 100644 --- a/include/reminder/ml.inc.php +++ b/include/reminder/ml.inc.php @@ -1,6 +1,6 @@ next()) { if (array_shift($subs) == "$sub@$domain") { - list($sub, $domain) = explode('@', $list); if ($domain != $current_domain) { $current_domain = $domain; - $client = new MMList(S::v('uid'), S::v('password'), $domain); } + $client = new MMList(S::user(), $domain); $client->subscribe($sub); } } @@ -59,13 +58,9 @@ class ReminderMl extends Reminder } } - protected function GetDisplayText() {} - - public function Display(&$page) + public function Prepare($page) { - header('Content-Type: text/html; charset=utf-8'); - $page->changeTpl('reminder/ml.tpl', NO_SKIN); - $page->assign('baseurl', $this->GetBaseUrl()); + parent::Prepare($page); $res = XDB::iterRow("SELECT sub, domain FROM register_subs @@ -77,7 +72,7 @@ class ReminderMl extends Reminder while (list($sub, $domain) = $res->next()) { if ($current_domain != $domain) { $current_domain = $domain; - $client = new MMList(S::v('uid'), S::v('password'), $domain); + $client = new MMList(S::user(), $domain); } list($details, ) = $client->get_members($sub); $lists["$sub@$domain"] = $details; @@ -85,14 +80,27 @@ class ReminderMl extends Reminder $page->assign_by_ref('lists', $lists); } - public static function IsCandidate(User &$user, $candidate) + public function template() { - $res = XDB::execute("SELECT COUNT(*) AS lists - FROM register_subs - WHERE uid = {?} AND type = 'list'", - $user->id()); + return 'reminder/ml.tpl'; + } + public function title() + { + return "Inscription aux listes de diffusion"; + } + + public static function IsCandidate(User $user, $candidate) + { + $res = XDB::query("SELECT COUNT(*) AS lists + FROM register_subs + WHERE uid = {?} AND type = 'list'", + $user->id()); - return $res->fetchOneCell(); + $mlCount = $res->fetchOneCell(); + if (!$mlCount) { + Reminder::MarkCandidateAsAccepted($user->id(), $candidate); + } + return ($mlCount > 0); } }