maybe the most wanted feature (ask Jacques Levin, or JMY ...).
[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'));
9$listes = array_map(create_function('$arr', 'return $arr["list"];'), $client->get_lists());
10
11$subscribers = array();
12
13foreach ($listes as $list) {
14 list(,$members) = $client->get_members($list);
15 $mails = array_map(create_function('$arr', 'return $arr[1];'), $members);
16 $subscribers = array_unique(array_merge($subscribers, $mails));
17}
18
19$not_in_group_x = array();
20$not_in_group_ext = array();
21
22foreach ($subscribers as $mail) {
23 $res = $globals->xdb->query(
24 'SELECT COUNT(*)
25 FROM groupex.membres AS m
26 LEFT JOIN auth_user_md5 AS u ON (m.uid=u.user_id AND m.uid<50000)
27 LEFT JOIN aliases AS a ON (a.id=u.user_id and a.type="a_vie")
28 WHERE asso_id = {?} AND
29 (m.email = {?} OR CONCAT(a.alias, "@polytechnique.org") = {?})',
30 $globals->asso('id'), $mail, $mail);
31 if ($res->fetchOneCell() == 0) {
32 if (strstr($mail, '@polytechnique.org') === false) {
33 $not_in_group_ext[] = $mail;
34 } else {
35 $not_in_group_x = $mail;
36 }
37 }
38}
39
40$page->assign('not_in_group_ext', $not_in_group_ext);
41$page->assign('not_in_group_x', $not_in_group_x);
42$page->run();
43
44?>