2 /***************************************************************************
3 * Copyright (C) 2003-2008 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 class ListsModule
extends PLModule
29 'lists' => $this->make_hook('lists', AUTH_MDP
),
30 'lists/ajax' => $this->make_hook('ajax', AUTH_MDP
, 'user', NO_AUTH
),
31 'lists/create' => $this->make_hook('create', AUTH_MDP
),
33 'lists/members' => $this->make_hook('members', AUTH_COOKIE
),
34 'lists/annu' => $this->make_hook('annu', AUTH_COOKIE
),
35 'lists/archives' => $this->make_hook('archives', AUTH_COOKIE
),
36 'lists/archives/rss' => $this->make_hook('rss', AUTH_PUBLIC
, 'user', NO_HTTPS
),
38 'lists/moderate' => $this->make_hook('moderate', AUTH_MDP
),
39 'lists/admin' => $this->make_hook('admin', AUTH_MDP
),
40 'lists/options' => $this->make_hook('options', AUTH_MDP
),
41 'lists/delete' => $this->make_hook('delete', AUTH_MDP
),
43 'lists/soptions' => $this->make_hook('soptions', AUTH_MDP
),
44 'lists/check' => $this->make_hook('check', AUTH_MDP
),
45 'admin/lists' => $this->make_hook('admin_all', AUTH_MDP
, 'admin'),
49 function on_subscribe($forlife, $uid, $promo, $password)
51 $this->prepare_client(null
);
52 $this->client
->subscribe("promo$promo");
55 function prepare_client(&$page)
59 require_once dirname(__FILE__
).'/lists/lists.inc.php';
61 $this->client
= new MMList(S
::v('uid'), S
::v('password'));
62 return $globals->mail
->domain
;
65 function get_pending_ops($domain, $list)
67 list($subs,$mails) = $this->client
->get_pending_ops($list);
68 $res = XDB
::query("SELECT mid
70 WHERE ml = {?} AND domain = {?}",
72 $mids = $res->fetchColumn();
73 foreach ($mails as $key=>$mail) {
74 if (in_array($mail['id'], $mids)) {
78 return array($subs, $mails);
81 function handler_lists(&$page)
83 function filter_owner($list)
88 function filter_member($list)
93 $domain = $this->prepare_client($page);
95 $page->changeTpl('lists/index.tpl');
96 $page->addJsLink('ajax.js');
97 $page->assign('xorg_title','Polytechnique.org - Listes de diffusion');
100 if (Get
::has('del')) {
101 $this->client
->unsubscribe(Get
::v('del'));
102 pl_redirect('lists');
104 if (Get
::has('add')) {
105 $this->client
->subscribe(Get
::v('add'));
106 pl_redirect('lists');
108 if (Post
::has('promo_add')) {
109 $promo = Post
::i('promo_add');
110 if ($promo >= 1900 and $promo < 2100) {
111 $this->client
->subscribe("promo$promo");
113 $page->trigSuccess("promo incorrecte, il faut une promo sur 4 chiffres.");
116 $listes = $this->client
->get_lists();
117 $owner = array_filter($listes, 'filter_owner');
118 $listes = array_diff_key($listes, $owner);
119 $member = array_filter($listes, 'filter_member');
120 $listes = array_diff_key($listes, $member);
121 foreach ($owner as $key=>$liste) {
122 list($subs,$mails) = $this->get_pending_ops($domain, $liste['list']);
123 $owner[$key]['subscriptions'] = $subs;
124 $owner[$key]['mails'] = $mails;
126 $page->register_modifier('hdc', 'list_header_decode');
127 $page->assign_by_ref('owner', $owner);
128 $page->assign_by_ref('member', $member);
129 $page->assign_by_ref('public', $listes);
132 function handler_ajax(&$page, $list = null
)
134 header('Content-Type: text/html; charset="UTF-8"');
135 $domain = $this->prepare_client($page);
136 $page->changeTpl('lists/liste.inc.tpl', NO_SKIN
);
137 if (Get
::has('unsubscribe')) {
138 $this->client
->unsubscribe($list);
140 if (Get
::has('subscribe')) {
141 $this->client
->subscribe($list);
143 if (Get
::has('sadd')) { /* 4 = SUBSCRIBE */
144 $this->client
->handle_request($list, Get
::v('sadd'), 4, '');
146 if (Get
::has('mid')) {
147 $this->moderate_mail($domain, $list, Get
::i('mid'));
150 list($liste, $members, $owners) = $this->client
->get_members($list);
152 list($subs,$mails) = $this->get_pending_ops($domain, $list);
153 $liste['subscriptions'] = $subs;
154 $liste['mails'] = $mails;
156 $page->register_modifier('hdc', 'list_header_decode');
157 $page->assign_by_ref('liste', $liste);
160 function handler_create(&$page)
162 $page->changeTpl('lists/create.tpl');
164 $owners = preg_split("/[\s]+/", Post
::v('owners'), -1, PREG_SPLIT_NO_EMPTY
);
165 $members = preg_split("/[\s]+/", Post
::v('members'), -1, PREG_SPLIT_NO_EMPTY
);
167 // click on validate button 'add_owner_sub' or type <enter>
168 if (Post
::has('add_owner_sub') && Post
::has('add_owner')) {
169 require_once('user.func.inc.php');
170 // if we want to add an owner and then type <enter>, then both
171 // add_owner_sub and add_owner are filled.
172 $oforlifes = get_users_forlife_list(Post
::v('add_owner'), true
);
173 $mforlifes = get_users_forlife_list(Post
::v('add_member'), true
);
174 if (!is_null($oforlifes)) {
175 $owners = array_merge($owners, $oforlifes);
177 // if we want to add a member and then type <enter>, then
178 // add_owner_sub is filled, whereas add_owner is empty.
179 if (!is_null($mforlifes)) {
180 $members = array_merge($members, $mforlifes);
184 // click on validate button 'add_member_sub'
185 if (Post
::has('add_member_sub') && Post
::has('add_member')) {
186 require_once('user.func.inc.php');
187 $forlifes = get_users_forlife_list(Post
::v('add_member'), true
);
188 if (!is_null($forlifes)) {
189 $members = array_merge($members, $forlifes);
194 $owners = array_unique($owners);
196 $members = array_unique($members);
198 $page->assign('owners', join(' ', $owners));
199 $page->assign('members', join(' ', $members));
201 if (!Post
::has('submit')) {
205 $asso = Post
::v('asso');
206 $liste = Post
::v('liste');
209 $page->trigError('Le champ «adresse souhaitée» est vide.');
211 if (!preg_match("/^[a-zA-Z0-9\-]*$/", $liste)) {
212 $page->trigError('Le nom de la liste ne doit contenir que des lettres non accentuées, chiffres et tirets.');
215 if (($asso == "binet") ||
($asso == "alias")) {
216 $promo = Post
::i('promo');
217 $domain = $promo . '.polytechnique.org';
219 if (($promo < 1921) ||
($promo > date('Y'))) {
220 $page->trigError('La promotion est mal renseignée, elle doit être du type : 2004.');
223 $new = $liste . '@' . $domain;
224 $res = XDB
::query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new);
227 if ($asso == "groupex") {
228 $groupex_name = Post
::v('groupex_name');
230 $res_groupe = XDB
::query('SELECT mail_domain FROM groupex.asso WHERE nom={?}', $groupex_name);
231 $domain = $res_groupe->fetchOneCell();
234 $page->trigError('Il n\'y a aucun groupe de ce nom sur Polytechnique.net.');
237 $new = $liste . '@' . $domain;
238 $res = XDB
::query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new);
240 $res = XDB
::query("SELECT COUNT(*) FROM aliases WHERE alias={?}", $liste);
241 $domain = "polytechnique.org";
245 $n = $res->fetchOneCell();
248 $page->trigError('Cette «adresse souhaitée» est déjà prise.');
251 if (!Post
::v('desc')) {
252 $page->trigError('Le sujet est vide.');
255 if (!count($owners)) {
256 $page->trigError('Il n\'y a pas de gestionnaire.');
259 if (count($members)<4) {
260 $page->trigError('Il n\'y a pas assez de membres.');
263 if (!$page->nb_errs()) {
264 $page->assign('created', true
);
265 require_once 'validations.inc.php';
266 $req = new ListeReq(S
::v('uid'), $asso, $liste, $domain,
267 Post
::v('desc'), Post
::i('advertise'),
268 Post
::i('modlevel'), Post
::i('inslevel'),
274 function handler_members(&$page, $liste = null
)
276 if (is_null($liste)) {
280 $this->prepare_client($page);
282 $page->changeTpl('lists/members.tpl');
284 if (Get
::has('del')) {
285 $this->client
->unsubscribe($liste);
286 pl_redirect('lists/members/'.$liste);
289 if (Get
::has('add')) {
290 $this->client
->subscribe($liste);
291 pl_redirect('lists/members/'.$liste);
294 $members = $this->client
->get_members($liste);
296 $tri_promo = !Env
::b('alpha');
298 if (list($det,$mem,$own) = $members) {
299 $membres = list_sort_members($mem, $tri_promo);
300 $moderos = list_sort_owners($own, $tri_promo);
302 $page->assign_by_ref('details', $det);
303 $page->assign_by_ref('members', $membres);
304 $page->assign_by_ref('owners', $moderos);
305 $page->assign('nb_m', count($mem));
307 $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails");
311 function handler_annu(&$page, $liste = null
, $action = null
, $subaction = null
)
313 if (is_null($liste)) {
317 $this->prepare_client($page);
319 if (Get
::has('del')) {
320 $this->client
->unsubscribe($liste);
321 pl_redirect('lists/annu/'.$liste);
323 if (Get
::has('add')) {
324 $this->client
->subscribe($liste);
325 pl_redirect('lists/annu/'.$liste);
328 $owners = $this->client
->get_owners($liste);
329 if (!is_array($owners)) {
330 $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails");
334 list(,$members) = $this->client
->get_members($liste);
336 foreach ($members as $m) {
339 require_once 'userset.inc.php';
340 $view = new ArraySet($users);
341 $view->addMod('trombi', 'Trombinoscope', true
, array('with_promo' => true
));
342 if (empty($GLOBALS['IS_XNET_SITE'])) {
343 $view->addMod('minifiche', 'Minifiches', false
);
345 $view->addMod('geoloc', 'Planisphère');
346 $view->apply("lists/annu/$liste", $page, $action, $subaction);
347 if ($action == 'geoloc' && $subaction) {
351 $page->changeTpl('lists/annu.tpl');
352 $moderos = list_sort_owners($owners[1]);
353 $page->assign_by_ref('details', $owners[0]);
354 $page->assign_by_ref('owners', $moderos);
357 function handler_archives(&$page, $liste = null
, $action = null
, $artid = null
)
361 if (is_null($liste)) {
365 $domain = $this->prepare_client($page);
367 $page->changeTpl('lists/archives.tpl');
369 if (list($det) = $this->client
->get_members($liste)) {
370 if (substr($liste,0,5) != 'promo' && ($det['ins'] ||
$det['priv'])
371 && !$det['own'] && ($det['sub'] < 2)) {
372 $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter.");
374 $get = Array('listname' => $liste, 'domain' => $domain);
375 if (Post
::has('updateall')) {
376 $get['updateall'] = Post
::v('updateall');
378 require_once 'banana/ml.inc.php';
379 get_banana_params($get, null
, $action, $artid);
380 run_banana($page, 'MLBanana', $get);
382 $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter.");
386 function handler_rss(&$page, $liste = null
, $alias = null
, $hash = null
)
388 require_once('rss.inc.php');
389 $uid = init_rss(null
, $alias, $hash);
390 if (!$uid ||
!$liste) {
394 $res = XDB
::query("SELECT user_id AS uid, password, alias AS forlife
395 FROM auth_user_md5 AS u
396 INNER JOIN aliases AS a ON (a.id = u.user_id AND a.type = 'a_vie')
397 WHERE u.user_id = {?}", $uid);
398 $row = $res->fetchOneAssoc();
399 $_SESSION = array_merge($row, $_SESSION);
401 $domain = $this->prepare_client($page);
402 if (list($det) = $this->client
->get_members($liste)) {
403 if (substr($liste,0,5) != 'promo' && ($det['ins'] ||
$det['priv'])
404 && !$det['own'] && ($det['sub'] < 2)) {
407 require_once('banana/ml.inc.php');
408 $banana = new MLBanana(S
::v('forlife'), Array('listname' => $liste, 'domain' => $domain, 'action' => 'rss2'));
414 function moderate_mail($domain, $liste, $mid)
416 if (Env
::has('mok')) {
418 } elseif (Env
::has('mno')) {
420 } elseif (Env
::has('mdel')) {
426 return XDB
::execute("INSERT IGNORE INTO ml_moderate
427 VALUES ({?}, {?}, {?}, {?}, {?}, NOW(), {?}, NULL)",
428 $liste, $domain, $mid, S
::i('uid'), $action, Post
::v('reason'));
431 function handler_moderate(&$page, $liste = null
)
433 if (is_null($liste)) {
437 $domain = $this->prepare_client($page);
439 $page->changeTpl('lists/moderate.tpl');
441 $page->register_modifier('hdc', 'list_header_decode');
443 if (Env
::has('sadd') || Env
::has('sdel')) {
444 if (Env
::has('sadd')) { /* 4 = SUBSCRIBE */
445 $sub = $this->client
->get_pending_sub($liste, Env
::v('sadd'));
446 $this->client
->handle_request($liste,Env
::v('sadd'),4,'');
449 if (Post
::has('sdel')) { /* 2 = REJECT */
450 $sub = $this->client
->get_pending_sub($liste, Env
::v('sdel'));
451 $this->client
->handle_request($liste, Post
::v('sdel'), 2, utf8_decode(Post
::v('reason')));
455 $mailer = new PlMailer();
456 $mailer->setFrom("$liste-bounces@{$domain}");
457 $mailer->addTo("$liste-owner@{$domain}");
458 $mailer->addHeader('Reply-To', "$liste-owner@{$domain}");
459 $mailer->setSubject("L'inscription de {$sub['name']} a été $info");
460 $text = "L'inscription de {$sub['name']} à la liste $liste@{$domain} a été $info par " . S
::v('prenom') . ' '
461 . S
::v('nom') . '(' . S
::v('promo') . ")\n";
462 if (trim(Post
::v('reason'))) {
463 $text .= "\nLa raison invoquée est :\n" . Post
::v('reason');
465 $mailer->setTxtBody(wordwrap($text, 72));
468 if (Env
::has('sadd')) {
469 pl_redirect('lists/moderate/'.$liste);
473 if (Post
::has('moderate_mails') && Post
::has('select_mails')) {
474 $mails = array_keys(Post
::v('select_mails'));
475 foreach($mails as $mail) {
476 $this->moderate_mail($domain, $liste, $mail);
478 } elseif (Env
::has('mid')) {
479 if (Get
::has('mid') && !Env
::has('mok') && !Env
::has('mdel')) {
480 $page->changeTpl('lists/moderate_mail.tpl');
481 require_once('banana/moderate.inc.php');
482 $params = array('listname' => $liste, 'domain' => $domain,
483 'artid' => Get
::i('mid'), 'part' => Get
::v('part'), 'action' => Get
::v('action'));
484 $params['client'] = $this->client
;
485 run_banana($page, 'ModerationBanana', $params);
487 $msg = file_get_contents('/etc/mailman/fr/refuse.txt');
488 $msg = str_replace("%(adminaddr)s", "$liste-owner@{$domain}", $msg);
489 $msg = str_replace("%(request)s", "<< SUJET DU MAIL >>", $msg);
490 $msg = str_replace("%(reason)s", "<< TON EXPLICATION >>", $msg);
491 $msg = str_replace("%(listname)s", $liste, $msg);
492 $page->assign('msg', $msg);
496 $mail = $this->moderate_mail($domain, $liste, Env
::i('mid'));
497 } elseif (Env
::has('sid')) {
498 if (list($subs,$mails) = $this->get_pending_ops($domain, $liste)) {
499 foreach($subs as $user) {
500 if ($user['id'] == Env
::v('sid')) {
501 $page->changeTpl('lists/moderate_sub.tpl');
502 $page->assign('del_user', $user);
510 if (list($subs,$mails) = $this->get_pending_ops($domain, $liste)) {
511 foreach ($mails as $key=>$mail) {
512 $mails[$key]['stamp'] = strftime("%Y%m%d%H%M%S", $mail['stamp']);
513 if ($mail['fromx']) {
514 $page->assign('with_fromx', true
);
516 $page->assign('with_nonfromx', true
);
519 $page->assign_by_ref('subs', $subs);
520 $page->assign_by_ref('mails', $mails);
522 $page->kill("La liste n'existe pas ou tu n'as pas le droit de la modérer");
526 static public function no_login_callback($login)
528 require_once 'user.func.inc.php';
529 global $list_unregistered, $globals;
531 $users = get_not_registered_user($login, true
);
532 if ($users && $users->total()) {
533 if (!isset($list_unregistered)) {
534 $list_unregistered = array();
536 $list_unregistered[$login] = $users;
538 list($name, $dom) = @explode
('@', $login);
539 if ($dom == $globals->mail
->domain ||
$dom == $globals->mail
->domain2
) {
540 _default_user_callback($login);
545 function handler_admin(&$page, $liste = null
)
549 if (is_null($liste)) {
553 $domain = $this->prepare_client($page);
555 $page->changeTpl('lists/admin.tpl');
557 if (Env
::has('send_mark')) {
558 $actions = Env
::v('mk_action');
559 $uids = Env
::v('mk_uid');
560 $mails = Env
::v('mk_email');
561 foreach ($actions as $key=>$action) {
566 case 'marketu': case 'markets':
567 require_once 'emails.inc.php';
568 $mail = valide_email($mails[$key]);
569 if (isvalid_email_redirection($mail)) {
570 $from = ($action == 'marketu') ?
'user' : 'staff';
571 $market = Marketing
::get($uids[$key], $mail);
573 $market = new Marketing($uids[$key], $mail, 'list', "$liste@$domain", $from, S
::v('uid'));
580 XDB
::execute('INSERT IGNORE INTO register_subs (uid, type, sub, domain)
581 VALUES ({?}, \'list\', {?}, {?})',
582 $uids[$key], $liste, $domain);
587 if (Env
::has('add_member')) {
588 require_once('user.func.inc.php');
589 $members = get_users_forlife_list(Env
::v('add_member'),
591 array('ListsModule', 'no_login_callback'));
592 $arr = $this->client
->mass_subscribe($liste, $members);
593 if (is_array($arr)) {
594 foreach($arr as $addr) {
595 $page->trigSuccess("{$addr[0]} inscrit.");
600 if (Env
::has('del_member')) {
601 if (strpos(Env
::v('del_member'), '@') === false
) {
602 $this->client
->mass_unsubscribe(
603 $liste, array(Env
::v('del_member').'@'.$globals->mail
->domain
));
605 $this->client
->mass_unsubscribe($liste, array(Env
::v('del_member')));
607 pl_redirect('lists/admin/'.$liste);
610 if (Env
::has('add_owner')) {
611 require_once('user.func.inc.php');
612 $owners = get_users_forlife_list(Env
::v('add_owner'), false
, array('ListsModule', 'no_login_callback'));
614 foreach ($owners as $login) {
615 if ($this->client
->add_owner($liste, $login)) {
616 $page->trigSuccess($alias." ajouté aux modérateurs.");
622 if (Env
::has('del_owner')) {
623 if (strpos(Env
::v('del_owner'), '@') === false
) {
624 $this->client
->del_owner($liste, Env
::v('del_owner').'@'.$globals->mail
->domain
);
626 $this->client
->del_owner($liste, Env
::v('del_owner'));
628 pl_redirect('lists/admin/'.$liste);
631 if (list($det,$mem,$own) = $this->client
->get_members($liste)) {
632 global $list_unregistered;
633 if ($list_unregistered) {
634 $page->assign_by_ref('unregistered', $list_unregistered);
636 $membres = list_sort_members($mem, @$tri_promo);
637 $moderos = list_sort_owners($own, @$tri_promo);
639 $page->assign_by_ref('details', $det);
640 $page->assign_by_ref('members', $membres);
641 $page->assign_by_ref('owners', $moderos);
642 $page->assign('np_m', count($mem));
645 $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer.<br />"
646 ." Si tu penses qu'il s'agit d'une erreur, "
647 ."<a href='mailto:support@polytechnique.org'>contact le support</a>");
651 function handler_options(&$page, $liste = null
)
653 if (is_null($liste)) {
657 $this->prepare_client($page);
659 $page->changeTpl('lists/options.tpl');
661 if (Post
::has('submit')) {
663 $values = array_map('utf8_decode', $values);
664 $spamlevel = intval($values['bogo_level']);
665 $unsurelevel = intval($values['unsure_level']);
666 if ($spamlevel == 0) {
669 if ($spamlevel > 3 ||
$spamlevel < 0 ||
$unsurelevel < 0 ||
$unsurelevel > 1) {
670 $page->trigError("Réglage de l'antispam non valide");
672 $this->client
->set_bogo_level($liste, ($spamlevel << 1) +
$unsurelevel);
674 switch($values['moderate']) {
676 $values['generic_nonmember_action'] = 0;
677 $values['default_member_moderation'] = 0;
680 $values['generic_nonmember_action'] = 1;
681 $values['default_member_moderation'] = 0;
684 $values['generic_nonmember_action'] = 1;
685 $values['default_member_moderation'] = 1;
688 unset($values['submit'], $values['bogo_level'], $values['moderate']);
689 $values['send_goodbye_msg'] = !empty($values['send_goodbye_msg']);
690 $values['admin_notify_mchanges'] = !empty($values['admin_notify_mchanges']);
691 $values['subscribe_policy'] = empty($values['subscribe_policy']) ?
0 : 2;
692 if (isset($values['subject_prefix'])) {
693 $values['subject_prefix'] = trim($values['subject_prefix']).' ';
695 $this->client
->set_owner_options($liste, $values);
696 } elseif (isvalid_email(Post
::v('atn_add'))) {
697 $this->client
->add_to_wl($liste, Post
::v('atn_add'));
698 } elseif (Get
::has('atn_del')) {
699 $this->client
->del_from_wl($liste, Get
::v('atn_del'));
700 pl_redirect('lists/options/'.$liste);
703 if (list($details,$options) = $this->client
->get_owner_options($liste)) {
704 $page->assign_by_ref('details', $details);
705 $page->assign_by_ref('options', $options);
706 $bogo_level = intval($this->client
->get_bogo_level($liste));
707 $page->assign('unsure_level', $bogo_level & 1);
708 $page->assign('bogo_level', $bogo_level >> 1);
710 $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
714 function handler_delete(&$page, $liste = null
)
717 if (is_null($liste)) {
721 $domain = $this->prepare_client($page);
722 if ($domain == $globals->mail
->domain ||
$domain == $globals->mail
->domain2
) {
727 $domain = '@' . $domain;
732 $page->changeTpl('lists/delete.tpl');
733 if (Post
::v('valid') == 'OUI') {
734 if ($this->client
->delete_list($liste, Post
::b('del_archive'))) {
735 foreach (array('', '-owner', '-admin', '-bounces', '-unsubscribe') as $app) {
736 XDB
::execute("DELETE FROM $table
737 WHERE type={?} AND alias={?}",
738 $type, $liste.$app.$domain);
740 $page->assign('deleted', true
);
742 $page->kill('Une erreur est survenue lors de la suppression de la liste.<br />'
743 . 'Contact les administrateurs du site pour régler le problème : '
744 . '<a href="mailto:support@polytechnique.org">support@polytechnique.org</a>');
746 } elseif (list($details,$options) = $this->client
->get_owner_options($liste)) {
747 $page->assign_by_ref('details', $details);
748 $page->assign_by_ref('options', $options);
749 $page->assign('bogo_level', $this->client
->get_bogo_level($liste));
751 $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
755 function handler_soptions(&$page, $liste = null
)
757 if (is_null($liste)) {
761 $this->prepare_client($page);
763 $page->changeTpl('lists/soptions.tpl');
765 if (Post
::has('submit')) {
767 $values = array_map('utf8_decode', $values);
768 unset($values['submit']);
769 $values['advertised'] = empty($values['advertised']) ? false
: true
;
770 $values['archive'] = empty($values['archive']) ? false
: true
;
771 $this->client
->set_admin_options($liste, $values);
774 if (list($details,$options) = $this->client
->get_admin_options($liste)) {
775 $page->assign_by_ref('details', $details);
776 $page->assign_by_ref('options', $options);
778 $page->kill("La liste n'existe pas");
782 function handler_check(&$page, $liste = null
)
784 if (is_null($liste)) {
788 $this->prepare_client($page);
790 $page->changeTpl('lists/check.tpl');
792 if (Post
::has('correct')) {
793 $this->client
->check_options($liste, true
);
796 if (list($details,$options) = $this->client
->check_options($liste)) {
797 $page->assign_by_ref('details', $details);
798 $page->assign_by_ref('options', $options);
800 $page->kill("La liste n'existe pas");
804 function handler_admin_all(&$page) {
805 $page->changeTpl('lists/admin_all.tpl');
806 $page->assign('xorg_title','Polytechnique.org - Administration - Mailing lists');
808 $client = new MMList(S
::v('uid'), S
::v('password'));
809 $listes = $client->get_all_lists();
810 $page->assign_by_ref('listes', $listes);
814 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: