--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************
+ $Id: admin.php,v 1.1 2004-09-21 16:14:35 x2000habouzit Exp $
+ ***************************************************************************/
+
+if(empty($_REQUEST['liste'])) header('Location: index.php');
+$liste = strtolower($_REQUEST['liste']);
+
+require("auto.prepend.inc.php");
+new_skinned_page('listes/admin.tpl', AUTH_MDP, true);
+include('xml-rpc-client.inc.php');
+
+$res = $globals->db->query("SELECT password FROM auth_user_md5 WHERE user_id={$_SESSION['uid']}");
+list($pass) = mysql_fetch_row($res);
+mysql_free_result($res);
+
+$client = new xmlrpc_client("http://{$_SESSION['uid']}:$pass@localhost:4949");
+
+if(isset($_REQUEST['welc'])) $client->set_welcome($liste, $_REQUEST['welc']);
+
+if(isset($_REQUEST['add_member']) && isset($_REQUEST['member'])) {
+ $client->mass_subscribe($liste, Array($_REQUEST['member']));
+}
+
+if(isset($_REQUEST['del_member']) && isset($_REQUEST['member'])) {
+ $res = $globals->db->query("SELECT b.alias
+ FROM aliases AS a
+ INNER JOIN aliases AS b ON (a.id=b.id AND b.type='a_vie')
+ WHERE a.alias='{$_REQUEST['member']}'");
+ if($forlife = mysql_fetch_row($res)) {
+ $client->mass_unsubscribe($liste, $forlife);
+ }
+ mysql_free_result($res);
+}
+
+if(isset($_REQUEST['add_owner']) && isset($_REQUEST['owner'])) {
+ $client->add_owner($liste, $_REQUEST['owner']);
+}
+
+if(isset($_REQUEST['del_owner']) && isset($_REQUEST['owner'])) {
+ $res = $globals->db->query("SELECT b.alias
+ FROM aliases AS a
+ INNER JOIN aliases AS b ON (a.id=b.id AND b.type='a_vie')
+ WHERE a.alias='{$_REQUEST['owner']}'");
+ if(list($forlife) = mysql_fetch_row($res)) {
+ $client->del_owner($liste, $forlife);
+ }
+ mysql_free_result($res);
+}
+
+$members = $client->get_members($liste);
+if(is_array($members)) {
+ $membres = Array();
+ foreach($members[1] as $member) {
+ if(preg_match('/^([^.]*.[^.]*.(\d\d\d\d))@polytechnique.org$/', $member[1], $matches)) {
+ $membres[$matches[2]][] = Array('n' => $member[0], 'l' => $matches[1]);
+ } else {
+ $membres[0][] = Array('l' => $member[1]);
+ }
+ }
+ ksort($membres);
+
+ $moderos = Array();
+ foreach($members[2] as $owner) {
+ list($m) = split('@',$owner);
+ $res = $globals->db->query("SELECT CONCAT(prenom, ' ', nom), promo
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS a ON u.user_id = a.id
+ WHERE a.alias = '$m'");
+ if(list($nom, $promo) = mysql_fetch_row($res)) {
+ $moderos[$promo][] = Array('n' => $nom, 'l' => $m);
+ } else {
+ $moderos[0][] = Array('l' => $owner);
+ }
+ mysql_free_result($res);
+ }
+ ksort($moderos);
+
+ $page->assign_by_ref('details', $members[0]);
+ $page->assign_by_ref('members', $membres);
+ $page->assign_by_ref('owners', $moderos);
+
+} else
+ $page->assign('no_list',true);
+
+$page->run();
+?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: liste.php,v 1.6 2004-09-21 15:40:35 x2000habouzit Exp $
+ $Id: liste.php,v 1.7 2004-09-21 16:14:35 x2000habouzit Exp $
***************************************************************************/
if(empty($_REQUEST['liste'])) header('Location: index.php');
$liste = strtolower($_REQUEST['liste']);
require("auto.prepend.inc.php");
-new_skinned_page('listes/liste.tpl', AUTH_MDP, true);
+new_skinned_page('listes/liste.tpl', AUTH_COOKIE, true);
include('xml-rpc-client.inc.php');
$res = $globals->db->query("SELECT password FROM auth_user_md5 WHERE user_id={$_SESSION['uid']}");
mysql_free_result($res);
$client = new xmlrpc_client("http://{$_SESSION['uid']}:$pass@localhost:4949");
-
-if(isset($_REQUEST['welc'])) $client->set_welcome($liste, $_REQUEST['welc']);
-
-if(isset($_REQUEST['add_member']) && isset($_REQUEST['member'])) {
- $client->mass_subscribe($liste, Array($_REQUEST['member']));
-}
-
-if(isset($_REQUEST['del_member']) && isset($_REQUEST['member'])) {
- $res = $globals->db->query("SELECT b.alias
- FROM aliases AS a
- INNER JOIN aliases AS b ON (a.id=b.id AND b.type='a_vie')
- WHERE a.alias='{$_REQUEST['member']}'");
- if($forlife = mysql_fetch_row($res)) {
- $client->mass_unsubscribe($liste, $forlife);
- }
- mysql_free_result($res);
-}
-
-if(isset($_REQUEST['add_owner']) && isset($_REQUEST['owner'])) {
- $client->add_owner($liste, $_REQUEST['owner']);
-}
-
-if(isset($_REQUEST['del_owner']) && isset($_REQUEST['owner'])) {
- $res = $globals->db->query("SELECT b.alias
- FROM aliases AS a
- INNER JOIN aliases AS b ON (a.id=b.id AND b.type='a_vie')
- WHERE a.alias='{$_REQUEST['owner']}'");
- if(list($forlife) = mysql_fetch_row($res)) {
- $client->del_owner($liste, $forlife);
- }
- mysql_free_result($res);
-}
-
$members = $client->get_members($liste);
+
if(is_array($members)) {
$membres = Array();
foreach($members[1] as $member) {
#!/usr/bin/env python
#***************************************************************************
-#* Copyright (C) 2namelytechnique.org *
+#* Copyright (C) 2004 polytechnique.org *
#* http://opensource.polytechnique.org/ *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* Foundation, Inc., *
#* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
#***************************************************************************
-# $Id: mailman-rpc.py,v 1.21 2004-09-21 15:40:35 x2000habouzit Exp $
+# $Id: mailman-rpc.py,v 1.22 2004-09-21 16:14:35 x2000habouzit Exp $
#***************************************************************************
import base64, MySQLdb, os
except:
continue
is_member = userdesc.address in mlist.getRegularMemberKeys()
- is_owner = userdesc.address in mlist.owner
is_admin = mm_cfg.ADMIN_ML_OWNER in mlist.owner
- if ( mlist.advertised ) or ( perms == 'admin' and is_admin ) or is_member or is_owner:
+ is_owner = ( perms == 'admin' and is_admin ) or ( userdesc.address in mlist.owner )
+ if mlist.advertised or is_member or is_owner:
result.append( {
'list' : name,
'desc' : mlist.description,
mlist = MailList.MailList(listname, lock=0)
except:
return 0
- if ( mlist.advertised ) or ( is_admin_on(userdesc, perms, mlist) ) or ( userdesc.address in members ):
+ is_member = userdesc.address in members
+ is_admin = mm_cfg.ADMIN_ML_OWNER in mlist.owner
+ is_owner = ( perms == 'admin' and is_admin ) or ( userdesc.address in mlist.owner )
+ if mlist.advertised or is_member or is_owner or ( perms == 'admin' ):
members = mlist.getRegularMemberKeys()
members.sort()
- is_member = userdesc.address in members
- is_owner = userdesc.address in mlist.owner
details = { 'addr' : listname+'@polytechnique.org',
'desc' : mlist.description,
'diff' : mlist.generic_nonmember_action,
'ins' : mlist.subscribe_policy > 0,
- 'priv' : (1-mlist.advertised)+2*(mm_cfg.ADMIN_ML_OWNER in mlist.owner),
+ 'priv' : (1-mlist.advertised)+2*is_admin,
'welc' : mlist.welcome_msg,
'you' : is_member + 2*is_owner
}
--- /dev/null
+{***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************
+ $Id: admin.tpl,v 1.1 2004-09-21 16:14:35 x2000habouzit Exp $
+ ***************************************************************************}
+
+{dynamic}
+
+{if $no_list}
+
+<p class='erreur'>La liste n'existe pas ou tu n'as pas le droit d'en voir les détails</p>
+
+{else}
+
+<div class="rubrique">
+ Liste {$smarty.request.liste}
+</div>
+
+<table class='tinybicol' cellpadding='0' cellspacing='0'>
+ <tr>
+ <td class='titre'> Adresse </td>
+ <td>{mailto address=$details.addr}</td>
+ </tr>
+ <tr>
+ <td class='titre'> Sujet </td>
+ <td>{$details.desc}</td>
+ </tr>
+ <tr>
+ <td class='titre'> Visibilité </td>
+ <td>{if $details.priv eq 0}publique{elseif $details.priv eq 1}privée{else}admin{/if}</td>
+ </tr>
+ <tr>
+ <td class='titre'> Diffusion </td>
+ <td>{if $details.diff}modérée{else}libre{/if}</td>
+ </tr>
+ <tr>
+ <td class='titre'> Inscription </td>
+ <td>{if $details.ins}modérée{else}libre{/if}</td>
+ </tr>
+ <tr>
+ <td colspan='2' class='center'>
+ <a href='trombi.php?liste={$smarty.request.liste}'>trombino de la liste</a> (page longue à charger)
+ </td>
+ </tr>
+</table>
+
+<div class='rubrique'>
+ modérateurs de la liste
+</div>
+
+{if $owners|@count}
+<table class='tinybicol' cellpadding='0' cellspacing='0'>
+ {foreach from=$owners item=xs key=promo}
+ <tr>
+ <td class='titre'>{if $promo}{$promo}{else}non-X{/if}</td>
+ <td>
+ {foreach from=$xs item=x}
+ {if $promo}
+ <a href="javascript:x()" onclick="popWin('{"fiche.php"|url}?user={$x.l}')">{$x.n}</a><br />
+ {else}
+ {$x.l}<br />
+ {/if}
+ {/foreach}
+ </td>
+ </tr>
+ {/foreach}
+</table>
+{/if}
+
+<div class='rubrique'>
+ membres de la liste
+</div>
+
+{if $members|@count}
+<table class='bicol' cellpadding='0' cellspacing='0'>
+ {foreach from=$members item=xs key=promo}
+ <tr>
+ <td class='titre'>{if $promo}{$promo}{else}non-X{/if}</td>
+ <td>
+ {foreach from=$xs item=x}
+ {if $promo}
+ <a href="javascript:x()" onclick="popWin('{"fiche.php"|url}?user={$x.l}')">{$x.n}</a><br />
+ {else}
+ {$x.l}<br />
+ {/if}
+ {/foreach}
+ </td>
+ </tr>
+ {/foreach}
+</table>
+{/if}
+
+{if $details.you > 1 || $smarty.session.perms eq admin}
+<div class='rubrique'>
+ Administrer la liste
+</div>
+{if $details.priv < 2}
+<p class='erreur'>
+Tu n'es pas administrateur de la liste, mais du site.
+</p>
+{/if}
+
+<p><strong>modération :</strong> <a href='moderate.php?liste={$smarty.request.liste}'>modérer la liste</a></p>
+
+<p>
+Pour entrer un utilisateur, il faut remplir les champs prévus à cet effet par son login,
+c'est-à-dire "prenom.nom" ou "prenom.nom.promo"
+</p>
+
+<form method='post' action='{$smarty.server.REQUEST_URI}'>
+ <table class='tinybicol'>
+ <tr>
+ <th>modifier les abonnés</th>
+ <th>modifier les modérateurs</th>
+ </tr>
+ <tr>
+ <td>
+ <input type='text' name='member' />
+ </td>
+ <td>
+ <input type='text' name='owner' />
+ </td>
+ </tr>
+ <tr class='center'>
+ <td>
+ <input type='submit' name='add_member' value='ajouter' />
+
+ <input type='submit' name='del_member' value='supprimer' />
+ </td>
+ <td>
+ <input type='submit' name='add_owner' value='ajouter' />
+
+ <input type='submit' name='del_owner' value='supprimer' />
+ </td>
+ </tr>
+ </table>
+</form>
+
+<p>
+Un message est adressé automatiquement à toute personne ajoutée à la liste de diffusion. Voici le
+message actuellement envoyé : il est modifiable à volonté !
+</p>
+
+<form method='post' action='{$smarty.server.REQUEST_URI}'>
+ <div class='center'>
+ <textarea cols='50' rows='8' name='welc'>{$details.welc}</textarea><br />
+ <input type='submit' name='update' value='mettre à jour' />
+ </div>
+</form>
+
+{/if}
+
+{/if}
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: liste.tpl,v 1.8 2004-09-21 15:40:36 x2000habouzit Exp $
+ $Id: liste.tpl,v 1.9 2004-09-21 16:14:35 x2000habouzit Exp $
***************************************************************************}
{dynamic}
</table>
{/if}
-{if $details.you > 1 || $smarty.session.perms eq admin}
-<div class='rubrique'>
- Administrer la liste
-</div>
-{if $details.priv < 2}
-<p class='erreur'>
-Tu n'es pas administrateur de la liste, mais du site.
-</p>
-{/if}
-
-<p><strong>modération :</strong> <a href='moderate.php?liste={$smarty.request.liste}'>modérer la liste</a></p>
-
-<p>
-Pour entrer un utilisateur, il faut remplir les champs prévus à cet effet par son login,
-c'est-à-dire "prenom.nom" ou "prenom.nom.promo"
-</p>
-
-<form method='post' action='{$smarty.server.REQUEST_URI}'>
- <table class='tinybicol'>
- <tr>
- <th>modifier les abonnés</th>
- <th>modifier les modérateurs</th>
- </tr>
- <tr>
- <td>
- <input type='text' name='member' />
- </td>
- <td>
- <input type='text' name='owner' />
- </td>
- </tr>
- <tr class='center'>
- <td>
- <input type='submit' name='add_member' value='ajouter' />
-
- <input type='submit' name='del_member' value='supprimer' />
- </td>
- <td>
- <input type='submit' name='add_owner' value='ajouter' />
-
- <input type='submit' name='del_owner' value='supprimer' />
- </td>
- </tr>
- </table>
-</form>
-
-<p>
-Un message est adressé automatiquement à toute personne ajoutée à la liste de diffusion. Voici le
-message actuellement envoyé : il est modifiable à volonté !
-</p>
-
-<form method='post' action='{$smarty.server.REQUEST_URI}'>
- <div class='center'>
- <textarea cols='50' rows='8' name='welc'>{$details.welc}</textarea><br />
- <input type='submit' name='update' value='mettre à jour' />
- </div>
-</form>
-
-{/if}
-
{/if}
{/dynamic}
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: listes.inc.tpl,v 1.2 2004-09-21 15:40:36 x2000habouzit Exp $
+ $Id: listes.inc.tpl,v 1.3 2004-09-21 16:14:35 x2000habouzit Exp $
***************************************************************************}
<table class='bicol' cellpadding='0' cellspacing='0'>
{if $liste.priv >= $min && $liste.priv <= $max|default:$min}
<tr class='{cycle values="impair,pair"}'>
<td>
+ {if $liste.you>1}
+ <a href='admin.php?liste={$liste.list}'>{$liste.list}</a>
+ [<a href='moderate.php?liste={$liste.list}'>mod</a>]
+ {elseif $smarty.session.perms eq admin}
+ <a href='admin.php?liste={$liste.list}'>{$liste.list}</a>
+ <span class='erreur'>[<a href='moderate.php?liste={$liste.list}'>mod</a>]</span>
+ {else}
<a href='liste.php?liste={$liste.list}'>{$liste.list}</a>
- {if $liste.you>1}[<a href='moderate.php?liste={$liste.list}'>mod</a>]{/if}
+ {/if}
</td>
<td>{$liste.desc}</td>
<td class='center'>{if $liste.diff}modérée{else}libre{/if}</td>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: trombi.tpl,v 1.1 2004-09-10 23:13:04 x2000habouzit Exp $
+ $Id: trombi.tpl,v 1.2 2004-09-21 16:14:35 x2000habouzit Exp $
***************************************************************************}
{dynamic}
</tr>
<tr>
<td colspan='2' class='center'>
+ {if $details.you > 1 || $smarty.session.perms eq admin}
+ <a href='admin.php?liste={$smarty.request.liste}'>Page de la liste</a>
+ {else}
<a href='liste.php?liste={$smarty.request.liste}'>Page de la liste</a>
+ {/if}
</td>
</tr>
</table>