now in the module
[platal.git] / htdocs.net / groupe / annuaire-admin.php
CommitLineData
3c8acb8e 1<?php
2
3require_once 'xnet.inc.php';
4require_once 'lists.inc.php';
5require_once 'xnet/mail.inc.php';
6
7new_groupadmin_page('xnet/groupe/annuaire-admin.tpl');
8$client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $globals->asso('mail_domain'));
83aaea24 9$lists = $client->get_lists();
10if (!$lists) $lists = array();
11$listes = array_map(create_function('$arr', 'return $arr["list"];'), $lists);
3c8acb8e 12
13$subscribers = array();
14
15foreach ($listes as $list) {
16 list(,$members) = $client->get_members($list);
17 $mails = array_map(create_function('$arr', 'return $arr[1];'), $members);
18 $subscribers = array_unique(array_merge($subscribers, $mails));
19}
20
21$not_in_group_x = array();
22$not_in_group_ext = array();
23
24foreach ($subscribers as $mail) {
25 $res = $globals->xdb->query(
26 'SELECT COUNT(*)
27 FROM groupex.membres AS m
28 LEFT JOIN auth_user_md5 AS u ON (m.uid=u.user_id AND m.uid<50000)
29 LEFT JOIN aliases AS a ON (a.id=u.user_id and a.type="a_vie")
30 WHERE asso_id = {?} AND
31 (m.email = {?} OR CONCAT(a.alias, "@polytechnique.org") = {?})',
32 $globals->asso('id'), $mail, $mail);
33 if ($res->fetchOneCell() == 0) {
34 if (strstr($mail, '@polytechnique.org') === false) {
35 $not_in_group_ext[] = $mail;
36 } else {
fc765bc9 37 $not_in_group_x[] = $mail;
3c8acb8e 38 }
39 }
40}
41
42$page->assign('not_in_group_ext', $not_in_group_ext);
43$page->assign('not_in_group_x', $not_in_group_x);
229cb653 44$page->assign('lists', $lists);
3c8acb8e 45$page->run();
46
47?>