Allows to moderate the lists directly on the lists main page (use a bit of Ajax in...
[platal.git] / modules / lists.php
CommitLineData
bc4ad6aa 1<?php
2/***************************************************************************
3 * Copyright (C) 2003-2006 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
5 * *
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. *
10 * *
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. *
15 * *
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 *
18 * Foundation, Inc., *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
21
22class ListsModule extends PLModule
23{
24 var $client;
25
26 function handlers()
27 {
28 return array(
29 'lists' => $this->make_hook('lists', AUTH_MDP),
30 'lists/create' => $this->make_hook('create', AUTH_MDP),
31
32 'lists/members' => $this->make_hook('members', AUTH_COOKIE),
33 'lists/trombi' => $this->make_hook('trombi', AUTH_COOKIE),
34 'lists/archives' => $this->make_hook('archives', AUTH_COOKIE),
35
36 'lists/moderate' => $this->make_hook('moderate', AUTH_MDP),
37 'lists/admin' => $this->make_hook('admin', AUTH_MDP),
38 'lists/options' => $this->make_hook('options', AUTH_MDP),
39 'lists/delete' => $this->make_hook('delete', AUTH_MDP),
40
41 'lists/soptions' => $this->make_hook('soptions', AUTH_MDP),
42 'lists/check' => $this->make_hook('check', AUTH_MDP),
92423144 43 'admin/lists' => $this->make_hook('admin_all', AUTH_MDP, 'admin'),
bc4ad6aa 44 );
45 }
46
8d8f7607 47 function on_subscribe($forlife, $uid, $promo, $password)
48 {
49 $this->prepare_client(null);
50 $this->client->subscribe("promo$promo");
51 }
52
7b9d64a8 53 function prepare_client(&$page)
bc4ad6aa 54 {
0ec52d96 55 global $globals;
56
9bb8bf21 57 require_once dirname(__FILE__).'/lists/lists.inc.php';
bc4ad6aa 58
9bb8bf21 59 $this->client = new MMList(S::v('uid'), S::v('password'));
092945b4 60 return $globals->mail->domain;
bc4ad6aa 61 }
62
ae0508cb 63 function clean_html($res)
64 {
65 $res = html_entity_decode($res);
4e2929c6 66 $res = preg_replace('@<a[^>]*href=["\']([^ >]+)["\'][^>]*>([^<]*)</a>@ie',
67 "'\\2 [' . htmlentities('\\1') . ']'", $res);
ae0508cb 68 $res = preg_replace("@<(/br|p|/div)[^>]*>(\\s*\n)?@i", "\n", $res);
69 $res = trim(strip_tags($res));
70 $res = preg_replace("/\n(\\s*\n)+/", "\n\n", $res);
4e2929c6 71 return $res;
ae0508cb 72 }
73
bc4ad6aa 74 function handler_lists(&$page)
75 {
7b9d64a8 76 $this->prepare_client($page);
bc4ad6aa 77
78 $page->changeTpl('listes/index.tpl');
79 $page->assign('xorg_title','Polytechnique.org - Listes de diffusion');
80
81
82 if (Get::has('del')) {
5e2307dc 83 $this->client->unsubscribe(Get::v('del'));
8b00e0e0 84 pl_redirect('lists');
bc4ad6aa 85 }
86 if (Get::has('add')) {
5e2307dc 87 $this->client->subscribe(Get::v('add'));
8b00e0e0 88 pl_redirect('lists');
bc4ad6aa 89 }
90 if (Post::has('promo_add')) {
5e2307dc 91 $promo = Post::i('promo_add');
bc4ad6aa 92 if ($promo >= 1900 and $promo < 2100) {
93 $this->client->subscribe("promo$promo");
94 } else {
95 $page->trig("promo incorrecte, il faut une promo sur 4 chiffres.");
96 }
97 }
98 $listes = $this->client->get_lists();
99 $page->assign_by_ref('listes', $listes);
100 }
101
102 function handler_create(&$page)
103 {
bc4ad6aa 104 $page->changeTpl('listes/create.tpl');
105
5e2307dc 106 $owners = preg_split("/[\s]+/", Post::v('owners'), -1, PREG_SPLIT_NO_EMPTY);
107 $members = preg_split("/[\s]+/", Post::v('members'), -1, PREG_SPLIT_NO_EMPTY);
bc4ad6aa 108
109 // click on validate button 'add_owner_sub' or type <enter>
110 if (Post::has('add_owner_sub') && Post::has('add_owner')) {
111 require_once('user.func.inc.php');
112 // if we want to add an owner and then type <enter>, then both
113 // add_owner_sub and add_owner are filled.
e7545178 114 $oforlifes = get_users_forlife_list(Post::v('add_owner'), true);
115 $mforlifes = get_users_forlife_list(Post::v('add_member'), true);
116 if (!is_null($oforlifes)) {
117 $owners = array_merge($owners, $oforlifes);
118 }
119 // if we want to add a member and then type <enter>, then
120 // add_owner_sub is filled, whereas add_owner is empty.
121 if (!is_null($mforlifes)) {
122 $members = array_merge($members, $mforlifes);
bc4ad6aa 123 }
124 }
125
126 // click on validate button 'add_member_sub'
127 if (Post::has('add_member_sub') && Post::has('add_member')) {
128 require_once('user.func.inc.php');
e7545178 129 $forlifes = get_users_forlife_list(Post::v('add_member'), true);
130 if (!is_null($forlifes)) {
131 $members = array_merge($members, $forlifes);
bc4ad6aa 132 }
133 }
134
e7545178 135 ksort($owners);
136 $owners = array_unique($owners);
137 ksort($members);
138 $members = array_unique($members);
bc4ad6aa 139
140 $page->assign('owners', join(' ', $owners));
141 $page->assign('members', join(' ', $members));
142
143 if (!Post::has('submit')) {
144 return;
145 }
146
5e2307dc 147 $liste = Post::v('liste');
bc4ad6aa 148
149 if (empty($liste)) {
089a5801 150 $page->trig('champs «addresse souhaitée» vide');
bc4ad6aa 151 }
152 if (!preg_match("/^[a-zA-Z0-9\-]*$/", $liste)) {
153 $page->trig('le nom de la liste ne doit contenir que des lettres, chiffres et tirets');
154 }
155
08cce2ff 156 $res = XDB::query("SELECT COUNT(*) FROM aliases WHERE alias={?}", $liste);
bc4ad6aa 157 $n = $res->fetchOneCell();
158
159 if ($n) {
089a5801 160 $page->trig('cet alias est déjà pris');
bc4ad6aa 161 }
162
5e2307dc 163 if (!Post::v(desc)) {
bc4ad6aa 164 $page->trig('le sujet est vide');
165 }
166
167 if (!count($owners)) {
168 $page->trig('pas de gestionnaire');
169 }
170
171 if (count($members)<4) {
172 $page->trig('pas assez de membres');
173 }
174
175 if (!$page->nb_errs()) {
176 $page->assign('created', true);
177 require_once 'validations.inc.php';
cab08090 178 $req = new ListeReq(S::v('uid'), $liste,
5e2307dc 179 Post::v('desc'), Post::i('advertise'),
180 Post::i('modlevel'), Post::i('inslevel'),
bc4ad6aa 181 $owners, $members);
182 $req->submit();
183 }
184 }
185
186 function handler_members(&$page, $liste = null)
187 {
bc4ad6aa 188 if (is_null($liste)) {
189 return PL_NOT_FOUND;
190 }
191
7b9d64a8 192 $this->prepare_client($page);
bc4ad6aa 193
194 $page->changeTpl('listes/members.tpl');
195
196 if (Get::has('del')) {
197 $this->client->unsubscribe($liste);
8b00e0e0 198 pl_redirect('lists/members/'.$liste);
bc4ad6aa 199 }
200
201 if (Get::has('add')) {
202 $this->client->subscribe($liste);
8b00e0e0 203 pl_redirect('lists/members/'.$liste);
bc4ad6aa 204 }
205
206 $members = $this->client->get_members($liste);
207
5e2307dc 208 $tri_promo = !Env::b('alpha');
bc4ad6aa 209
210 if (list($det,$mem,$own) = $members) {
211 $membres = list_sort_members($mem, $tri_promo);
212 $moderos = list_sort_owners($own, $tri_promo);
213
214 $page->assign_by_ref('details', $det);
215 $page->assign_by_ref('members', $membres);
216 $page->assign_by_ref('owners', $moderos);
217 $page->assign('nb_m', count($mem));
218 } else {
089a5801 219 $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails");
bc4ad6aa 220 }
221 }
222
223 function _get_list($offset, $limit)
224 {
a3a049fc 225 global $platal;
bc4ad6aa 226 list($total, $members) = $this->client->get_members_limit($platal->argv[1], $offset, $limit);
227
228 $membres = Array();
229 foreach ($members as $member) {
230 list($m) = explode('@',$member[1]);
08cce2ff 231 $res = XDB::query("SELECT prenom,if (nom_usage='', nom, nom_usage) AS nom,
bc4ad6aa 232 promo, a.alias AS forlife
233 FROM auth_user_md5 AS u
234 INNER JOIN aliases AS a ON u.user_id = a.id
235 WHERE a.alias = {?}", $m);
236 if ($tmp = $res->fetchOneAssoc()) {
237 $membres[$tmp['nom']] = $tmp;
238 } else {
239 $membres[$member[0]] = array('addr' => $member[0]);
240 }
241 }
242 return array($total, $membres);
243 }
244
245 function handler_trombi(&$page, $liste = null)
246 {
bc4ad6aa 247 if (is_null($liste)) {
248 return PL_NOT_FOUND;
249 }
250
7b9d64a8 251 $this->prepare_client($page);
bc4ad6aa 252
253 $page->changeTpl('listes/trombi.tpl');
254
255 if (Get::has('del')) {
256 $this->client->unsubscribe($liste);
8b00e0e0 257 pl_redirect('lists/tromi/'.$liste);
bc4ad6aa 258 }
259 if (Get::has('add')) {
260 $this->client->subscribe($liste);
8b00e0e0 261 pl_redirect('lists/tromi/'.$liste);
bc4ad6aa 262 }
263
264 $owners = $this->client->get_owners($liste);
265
266 if (is_array($owners)) {
bc4ad6aa 267 $moderos = list_sort_owners($owners[1]);
268
269 $page->assign_by_ref('details', $owners[0]);
270 $page->assign_by_ref('owners', $moderos);
271
272 $trombi = new Trombi(array(&$this, '_get_list'));
273 $page->assign('trombi', $trombi);
274 } else {
089a5801 275 $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails");
bc4ad6aa 276 }
277 }
278
279 function handler_archives(&$page, $liste = null)
280 {
281 global $globals;
282
283 if (is_null($liste)) {
284 return PL_NOT_FOUND;
285 }
286
092945b4 287 $domain = $this->prepare_client($page);
bc4ad6aa 288
289 $page->changeTpl('listes/archives.tpl');
290
c99ef281 291 $page->addCssLink('lists.archives.css');
bc4ad6aa 292 if (list($det) = $this->client->get_members($liste)) {
293 if (substr($liste,0,5) != 'promo' && ($det['ins'] || $det['priv'])
294 && !$det['own'] && ($det['sub'] < 2))
295 {
296 $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter");
297 } elseif (Get::has('file')) {
5e2307dc 298 $file = Get::v('file');
299 $rep = Get::v('rep');
bc4ad6aa 300 if (strstr('/', $file)!==false || !preg_match(',^\d+/\d+$,', $rep)) {
301 $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter");
302 } else {
303 $page->assign('archives', $globals->lists->spool
304 ."/{$domain}{$globals->lists->vhost_sep}$liste/$rep/$file");
305 }
306 } else {
307 $archs = Array();
308 foreach (glob($globals->lists->spool
309 ."/{$domain}{$globals->lists->vhost_sep}$liste/*/*") as $rep)
310 {
311 if (preg_match(",/(\d*)/(\d*)$,", $rep, $matches)) {
312 $archs[intval($matches[1])][intval($matches[2])] = true;
313 }
314 }
315 $page->assign('archs', $archs);
316 $page->assign('range', range(1,12));
317 }
318 } else {
319 $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter");
320 }
321 }
322
323 function handler_moderate(&$page, $liste = null)
324 {
bc4ad6aa 325 if (is_null($liste)) {
326 return PL_NOT_FOUND;
327 }
328
092945b4 329 $domain = $this->prepare_client($page);
bc4ad6aa 330
331 $page->changeTpl('listes/moderate.tpl');
332
333 $page->register_modifier('qpd', 'quoted_printable_decode');
c8529706 334 $page->register_modifier('hdc', 'list_header_decode');
ae0508cb 335 $page->register_modifier('clean_html', array($this, 'clean_html'));
bc4ad6aa 336
337 if (Env::has('sadd')) { /* 4 = SUBSCRIBE */
5e2307dc 338 $this->client->handle_request($liste,Env::v('sadd'),4,'');
8b00e0e0 339 pl_redirect('lists/moderate/'.$liste);
bc4ad6aa 340 }
341
342 if (Post::has('sdel')) { /* 2 = REJECT */
5e2307dc 343 $this->client->handle_request($liste,Post::v('sdel'),2,Post::v('reason'));
bc4ad6aa 344 }
345
346 if (Env::has('mid')) {
5e2307dc 347 $mid = Env::v('mid');
bc4ad6aa 348 $mail = $this->client->get_pending_mail($liste, $mid);
349 $reason = '';
350
cab08090 351 $prenom = S::v('prenom');
352 $nom = S::v('nom');
bc4ad6aa 353
354 if (Env::has('mok')) {
355 $action = 1; /** 2 = ACCEPT **/
089a5801 356 $subject = "Message accepté";
357 $append .= "a été accepté par $prenom $nom.\n";
bc4ad6aa 358 } elseif (Env::has('mno')) {
359 $action = 2; /** 2 = REJECT **/
089a5801 360 $subject = "Message refusé";
5e2307dc 361 $reason = Post::v('reason');
089a5801 362 $append = "a été refusé par $prenom $nom avec la raison :\n\n"
bc4ad6aa 363 . $reason;
364 } elseif (Env::has('mdel')) {
365 $action = 3; /** 3 = DISCARD **/
089a5801 366 $subject = "Message supprimé";
367 $append = "a été supprimé par $prenom $nom.\n\n"
368 . "Rappel: il ne faut utiliser cette opération "
bc4ad6aa 369 . "que dans le cas de spams ou de virus !\n";
370 }
371
372 if (isset($action) && $this->client->handle_request($liste, $mid, $action, $reason)) {
373 $texte = "le message suivant :\n\n"
374 ." Auteur: {$mail['sender']}\n"
089a5801 375 ." Sujet : « {$mail['subj']} »\n"
376 ." Date : ".strftime("le %d %b %Y à %H:%M:%S", (int)$mail['stamp'])."\n\n"
bc4ad6aa 377 .$append;
378 require_once 'diogenes/diogenes.hermes.inc.php';
379 $mailer = new HermesMailer();
380 $mailer->addTo("$liste-owner@{$domain}");
381 $mailer->setFrom("$liste-bounces@{$domain}");
382 $mailer->addHeader('Reply-To', "$liste-owner@{$domain}");
383 $mailer->setSubject($subject);
384 $mailer->setTxtBody(wordwrap($texte,72));
385 $mailer->send();
386 Get::kill('mid');
387 }
388
389 if (Get::has('mid') && is_array($mail)) {
390 $msg = file_get_contents('/etc/mailman/fr/refuse.txt');
391 $msg = str_replace("%(adminaddr)s", "$liste-owner@{$domain}", $msg);
392 $msg = str_replace("%(request)s", "<< SUJET DU MAIL >>", $msg);
393 $msg = str_replace("%(reason)s", "<< TON EXPLICATION >>", $msg);
394 $msg = str_replace("%(listname)s", $liste, $msg);
395 $page->assign('msg', $msg);
396
397 $page->changeTpl('listes/moderate_mail.tpl');
398 $page->assign_by_ref('mail', $mail);
6a20c6a3 399 return;
bc4ad6aa 400 }
401
402 } elseif (Env::has('sid')) {
403
404 if (list($subs,$mails) = $this->client->get_pending_ops($liste)) {
405 foreach($subs as $user) {
5e2307dc 406 if ($user['id'] == Env::v('sid')) {
bc4ad6aa 407 $page->changeTpl('listes/moderate_sub.tpl');
6a20c6a3 408 $page->assign('del_user', $user);
409 return;
bc4ad6aa 410 }
411 }
412 }
413
414 }
415
416 if (list($subs,$mails) = $this->client->get_pending_ops($liste)) {
417 $page->assign_by_ref('subs', $subs);
418 $page->assign_by_ref('mails', $mails);
419 } else {
089a5801 420 $page->kill("La liste n'existe pas ou tu n'as pas le droit de la modérer");
bc4ad6aa 421 }
422 }
423
424 function handler_admin(&$page, $liste = null)
425 {
426 global $globals;
427
428 if (is_null($liste)) {
429 return PL_NOT_FOUND;
430 }
431
7b9d64a8 432 $this->prepare_client($page);
bc4ad6aa 433
434 $page->changeTpl('listes/admin.tpl');
435
436 if (Env::has('add_member')) {
bc4ad6aa 437 require_once('user.func.inc.php');
e7545178 438 $members = get_users_forlife_list(Env::v('add_member'));
bc4ad6aa 439 $arr = $this->client->mass_subscribe($liste, $members);
440 if (is_array($arr)) {
441 foreach($arr as $addr) {
442 $page->trig("{$addr[0]} inscrit.");
443 }
444 }
445 }
446
447 if (Env::has('del_member')) {
5e2307dc 448 if (strpos(Env::v('del_member'), '@') === false) {
bc4ad6aa 449 $this->client->mass_unsubscribe(
5e2307dc 450 $liste, array(Env::v('del_member').'@'.$globals->mail->domain));
bc4ad6aa 451 } else {
5e2307dc 452 $this->client->mass_unsubscribe($liste, array(Env::v('del_member')));
bc4ad6aa 453 }
8b00e0e0 454 pl_redirect('lists/admin/'.$liste);
bc4ad6aa 455 }
456
457 if (Env::has('add_owner')) {
458 require_once('user.func.inc.php');
e7545178 459 $owners = get_users_forlife_list(Env::v('add_owner'));
460 if ($owners) {
461 foreach ($owners as $login) {
462 if ($this->client->add_owner($liste, $login)) {
463 $page->trig($alias." ajouté aux modérateurs.");
464 }
bc4ad6aa 465 }
466 }
467 }
468
469 if (Env::has('del_owner')) {
5e2307dc 470 if (strpos(Env::v('del_owner'), '@') === false) {
471 $this->client->del_owner($liste, Env::v('del_owner').'@'.$globals->mail->domain);
bc4ad6aa 472 } else {
5e2307dc 473 $this->client->del_owner($liste, Env::v('del_owner'));
bc4ad6aa 474 }
8b00e0e0 475 pl_redirect('lists/admin/'.$liste);
bc4ad6aa 476 }
477
478 if (list($det,$mem,$own) = $this->client->get_members($liste)) {
bc4ad6aa 479 $membres = list_sort_members($mem, $tri_promo);
480 $moderos = list_sort_owners($own, $tri_promo);
481
482 $page->assign_by_ref('details', $det);
483 $page->assign_by_ref('members', $membres);
484 $page->assign_by_ref('owners', $moderos);
485 $page->assign('np_m', count($mem));
486
487 } else {
488 $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
489 }
490 }
491
492 function handler_options(&$page, $liste = null)
493 {
bc4ad6aa 494 if (is_null($liste)) {
495 return PL_NOT_FOUND;
496 }
497
7b9d64a8 498 $this->prepare_client($page);
bc4ad6aa 499
500 $page->changeTpl('listes/options.tpl');
501
502 if (Post::has('submit')) {
503 $values = $_POST;
504 $this->client->set_bogo_level($liste, intval($values['bogo_level']));
505 switch($values['moderate']) {
506 case '0':
507 $values['generic_nonmember_action'] = 0;
508 $values['default_member_moderation'] = 0;
509 break;
510 case '1':
511 $values['generic_nonmember_action'] = 1;
512 $values['default_member_moderation'] = 0;
513 break;
514 case '2':
515 $values['generic_nonmember_action'] = 1;
516 $values['default_member_moderation'] = 1;
517 break;
518 }
519 unset($values['submit'], $values['bogo_level'], $values['moderate']);
520 $values['send_goodbye_msg'] = !empty($values['send_goodbye_msg']);
521 $values['admin_notify_mchanges'] = !empty($values['admin_notify_mchanges']);
522 $values['subscribe_policy'] = empty($values['subscribe_policy']) ? 0 : 2;
523 if (isset($values['subject_prefix'])) {
524 $values['subject_prefix'] = trim($values['subject_prefix']).' ';
525 }
526 $this->client->set_owner_options($liste, $values);
5e2307dc 527 } elseif (isvalid_email(Post::v('atn_add'))) {
528 $this->client->add_to_wl($liste, Post::v('atn_add'));
bc4ad6aa 529 } elseif (Get::has('atn_del')) {
5e2307dc 530 $this->client->del_from_wl($liste, Get::v('atn_del'));
8b00e0e0 531 pl_redirect('lists/options/'.$liste);
bc4ad6aa 532 }
533
534 if (list($details,$options) = $this->client->get_owner_options($liste)) {
535 $page->assign_by_ref('details', $details);
536 $page->assign_by_ref('options', $options);
537 $page->assign('bogo_level', $this->client->get_bogo_level($liste));
538 } else {
539 $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
540 }
541 }
542
543 function handler_delete(&$page, $liste = null)
544 {
bc4ad6aa 545 if (is_null($liste)) {
546 return PL_NOT_FOUND;
547 }
548
7b9d64a8 549 $this->prepare_client($page);
bc4ad6aa 550
551 $page->changeTpl('listes/delete.tpl');
552
5e2307dc 553 if (Post::v('valid') == 'OUI'
554 && $this->client->delete_list($liste, Post::b('del_archive')))
bc4ad6aa 555 {
556 foreach (array('', '-owner', '-admin', '-bounces') as $app) {
08cce2ff 557 XDB::execute("DELETE FROM aliases
bc4ad6aa 558 WHERE type='liste' AND alias='{?}'",
80f44cfe 559 $liste.$app);
bc4ad6aa 560 }
561 $page->assign('deleted', true);
562 } elseif (list($details,$options) = $this->client->get_owner_options($liste)) {
563 $page->assign_by_ref('details', $details);
564 $page->assign_by_ref('options', $options);
565 $page->assign('bogo_level', $this->client->get_bogo_level($liste));
566 } else {
567 $page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
568 }
569 }
570
571 function handler_soptions(&$page, $liste = null)
572 {
bc4ad6aa 573 if (is_null($liste)) {
574 return PL_NOT_FOUND;
575 }
576
7b9d64a8 577 $this->prepare_client($page);
bc4ad6aa 578
579 $page->changeTpl('listes/soptions.tpl');
580
581 if (Post::has('submit')) {
582 $values = $_POST;
583 unset($values['submit']);
584 $values['advertised'] = empty($values['advertised']) ? false : true;
585 $values['archive'] = empty($values['archive']) ? false : true;
586 $this->client->set_admin_options($liste, $values);
587 }
588
589 if (list($details,$options) = $this->client->get_admin_options($liste)) {
590 $page->assign_by_ref('details', $details);
591 $page->assign_by_ref('options', $options);
592 } else {
593 $page->kill("La liste n'existe pas");
594 }
595 }
596
597 function handler_check(&$page, $liste = null)
598 {
bc4ad6aa 599 if (is_null($liste)) {
600 return PL_NOT_FOUND;
601 }
602
7b9d64a8 603 $this->prepare_client($page);
bc4ad6aa 604
605 $page->changeTpl('listes/check.tpl');
606
607 if (Post::has('correct')) {
608 $this->client->check_options($liste, true);
609 }
610
611 if (list($details,$options) = $this->client->check_options($liste)) {
612 $page->assign_by_ref('details', $details);
613 $page->assign_by_ref('options', $options);
614 } else {
615 $page->kill("La liste n'existe pas");
616 }
617 }
92423144 618
619 function handler_admin_all(&$page) {
163eddd2 620 $page->changeTpl('listes/admin_all.tpl');
92423144 621 $page->assign('xorg_title','Polytechnique.org - Administration - Mailing lists');
9bb8bf21 622
623 $client = new MMList(S::v('uid'), S::v('password'));
92423144 624 $listes = $client->get_all_lists();
9bb8bf21 625 $page->assign_by_ref('listes', $listes);
92423144 626 }
bc4ad6aa 627}
628
629?>