2 /***************************************************************************
3 * Copyright (C) 2003-2004 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 require_once("xorg.inc.php");
23 if (!Env
::has('liste')) redirect('index.php');
24 $liste = strtolower(Env
::get('liste'));
26 new_skinned_page('listes/trombi.tpl', AUTH_COOKIE
);
27 require_once("trombi.inc.php");
28 require_once('lists.inc.php');
30 $client =& lists_xmlrpc(Session
::getInt('uid'), Session
::get('password'));
33 $client->unsubscribe($liste);
34 redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
37 $client->subscribe($liste);
38 redirect("{$_SERVER['PHP_SELF']}?liste=$liste");
41 function getList($offset,$limit)
43 global $client, $globals;
44 $liste = Env
::get('liste');
45 list($total,$members) = $client->get_members_limit($liste,$offset,$limit);
48 foreach ($members as $member) {
49 list($m) = explode('@',$member[1]);
50 $res = $globals->xdb
->query("SELECT prenom,IF(nom_usage='', nom, nom_usage) AS nom, promo, a.alias AS forlife
51 FROM auth_user_md5 AS u
52 INNER JOIN aliases AS a ON u.user_id = a.id
53 WHERE a.alias = {?}", $m);
54 if ($tmp = $res->fetchOneAssoc()) {
55 $membres[$tmp['nom']] = $tmp;
57 $membres[$member[0]] = Array('addr' => $member[0]);
60 return Array($total,$membres);
63 $owners = $client->get_owners($liste);
65 if(is_array($owners)) {
66 $moderos = list_sort_owners($owners[1]);
68 $page->assign_by_ref('details', $owners[0]);
69 $page->assign_by_ref('owners', $moderos);
71 $trombi = new Trombi('getList');
72 $page->assign_by_ref('trombi',$trombi);
74 $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails");