0337d704 |
1 | <?php |
2 | |
3 | require_once 'xnet.inc.php'; |
4 | |
5 | new_group_page('xnet/groupe/listes.tpl'); |
6 | |
7 | require_once('lists.inc.php'); |
8 | $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $globals->asso('mail_domain')); |
9 | |
10 | |
11 | if(Get::has('del')) { |
12 | $client->unsubscribe(Get::get('del')); |
fa36e526 |
13 | redirect('listes.php'); |
0337d704 |
14 | } |
15 | if(Get::has('add')) { |
16 | $client->subscribe(Get::get('add')); |
fa36e526 |
17 | redirect('listes.php'); |
0337d704 |
18 | } |
19 | if(Post::has('promo_add')) { |
20 | $promo = Post::getInt('promo_add'); |
21 | if ($promo>=1900 and $promo<2100) { |
22 | $client->subscribe("promo$promo"); |
23 | } else { |
24 | $page->trig("promo incorrecte, il faut une promo sur 4 chiffres."); |
25 | } |
26 | } |
27 | |
28 | |
29 | if (Post::has('del_alias') && may_update()) { |
30 | $alias = Post::get('del_alias'); |
31 | // prevent group admin from erasing aliases from other groups |
32 | $alias = substr($alias, 0, strpos($alias, '@')).'@'.$globals->asso('mail_domain'); |
33 | $globals->xdb->query( |
34 | 'DELETE FROM x4dat.virtual_redirect, x4dat.virtual |
35 | USING x4dat.virtual AS v |
36 | LEFT JOIN x4dat.virtual_redirect USING(vid) |
37 | WHERE v.alias={?}', $alias); |
38 | $page->trig(Post::get('del_alias')." supprimé !"); |
39 | } |
40 | |
41 | $listes = $client->get_lists(); |
42 | $page->assign('listes',$listes); |
43 | |
44 | $alias = $globals->xdb->iterator( |
45 | 'SELECT alias,type |
46 | FROM x4dat.virtual |
47 | WHERE alias |
48 | LIKE {?} AND type="user" |
49 | ORDER BY alias', '%@'.$globals->asso('mail_domain')); |
50 | $page->assign('alias', $alias); |
51 | |
52 | $page->assign('may_update', may_update()); |
53 | |
54 | $page->run(); |
55 | ?> |