* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: index.php,v 1.1 2004-09-10 11:52:36 x2000habouzit Exp $
+ $Id: index.php,v 1.2 2004-09-21 15:40:35 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
-new_skinned_page('listes/index.tpl', AUTH_COOKIE);
+new_skinned_page('listes/index.tpl', AUTH_MDP);
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($_GET['del'])) { $client->unsubscribe($_GET['del']); header('Location: index.php'); }
+if(isset($_GET['add'])) { $client->subscribe($_GET['add']); header('Location: index.php'); }
$listes = $client->get_lists();
$page->assign_by_ref('listes',$listes);
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: liste.php,v 1.5 2004-09-20 20:04:37 x2000habouzit Exp $
+ $Id: liste.php,v 1.6 2004-09-21 15:40:35 x2000habouzit Exp $
***************************************************************************/
if(empty($_REQUEST['liste'])) header('Location: index.php');
-$liste = $_REQUEST['liste'];
+$liste = strtolower($_REQUEST['liste']);
require("auto.prepend.inc.php");
new_skinned_page('listes/liste.tpl', AUTH_MDP, true);
if(isset($_REQUEST['welc'])) $client->set_welcome($liste, $_REQUEST['welc']);
if(isset($_REQUEST['add_member']) && isset($_REQUEST['member'])) {
- if(list($added) = $client->mass_subscribe($liste, Array($_REQUEST['member']))) {
- $members = $client->get_members($liste);
- include_once("diogenes.mailer.inc.php");
- $mailer = new DiogenesMailer("\"Mailing list $liste\" <$liste-owner@polytechnique.org>",
- "\"{$added[0]}\" <{$added[1]}>",
- "Bienvenue sur la liste de diffusion $liste@polytechnique.org");
- $mailer->setBody($members[0]['welc']);
- $mailer->send();
- }
+ $client->mass_subscribe($liste, Array($_REQUEST['member']));
}
if(isset($_REQUEST['del_member']) && isset($_REQUEST['member'])) {
mysql_free_result($res);
}
-if(empty($members)) $members = $client->get_members($liste);
+$members = $client->get_members($liste);
if(is_array($members)) {
$membres = Array();
foreach($members[1] as $member) {
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: moderate.php,v 1.1 2004-09-20 20:04:37 x2000habouzit Exp $
+ $Id: moderate.php,v 1.2 2004-09-21 15:40:35 x2000habouzit Exp $
***************************************************************************/
if(empty($_REQUEST['liste'])) header('Location: index.php');
-$liste = $_REQUEST['liste'];
+$liste = strtolower($_REQUEST['liste']);
require("auto.prepend.inc.php");
include('xml-rpc-client.inc.php');
$client = new xmlrpc_client("http://{$_SESSION['uid']}:$pass@localhost:4949");
if(!$client->is_admin($liste)) header('Location: index.php');
-
-if(isset($_REQUEST['mid'])) {
+
+if(isset($_REQUEST['sadd'])) {
+ $client->handle_request($liste,$_REQUEST['sadd'],4,''); /** 4 is the magic for SUBSCRIBE see Defaults.py **/
+ header("Location: moderate.php?liste=$liste");
+}
+
+if(isset($_POST['sdel'])) {
+ $client->handle_request($liste,$_POST['sdel'],2,stripslashes($_POST['reason'])); /** 2 is the magic for REJECT see Defaults.py **/
+}
+
+if(isset($_REQUEST['sid'])) {
+ $sid = $_REQUEST['sid'];
+ if(list($subs,$mails) = $client->get_pending_ops($liste)) {
+ foreach($subs as $user) {
+ if($user['id'] == $sid) $u = $user;
+ }
+ }
+
+ if($u) {
+ new_skinned_page('listes/moderate_sub.tpl', AUTH_MDP, true);
+ $page->assign('del_user',$user);
+ } else {
+ new_skinned_page('listes/moderate.tpl', AUTH_MDP, true);
+ $page->assign_by_ref('subs', $subs);
+ $page->assign_by_ref('mails', $mails);
+ }
+} elseif(isset($_REQUEST['mid'])) {
$mid = $_REQUEST['mid'];
new_skinned_page('listes/moderate_mail.tpl', AUTH_MDP, true);
$mail = $client->get_pending_mail($liste,$mid);
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: trombi.php,v 1.1 2004-09-10 23:13:04 x2000habouzit Exp $
+ $Id: trombi.php,v 1.2 2004-09-21 15:40:35 x2000habouzit Exp $
***************************************************************************/
if(empty($_REQUEST['liste'])) header('Location: index.php');
-$liste = $_REQUEST['liste'];
+$liste = strtolower($_REQUEST['liste']);
require("auto.prepend.inc.php");
new_skinned_page('listes/trombi.tpl', AUTH_COOKIE, true);
#* Foundation, Inc., *
#* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
#***************************************************************************
-# $Id: mailman-rpc.py,v 1.20 2004-09-20 20:04:37 x2000habouzit Exp $
+# $Id: mailman-rpc.py,v 1.21 2004-09-21 15:40:35 x2000habouzit Exp $
#***************************************************************************
import base64, MySQLdb, os
except:
return 0
try:
- if ( mlist.subscribe_policy in (0,1) ) or is_admin_on(userdesc, perms, mlist):
+ if ( mlist.subscribe_policy in (0,1) ) or ( userdesc.address in mlist.owner ) or ( mm_cfg.ADMIN_ML_OWNER in mlist.owner ):
result = 2
- mlist.ApprovedAddMember(userdesc,0,0)
+ mlist.ApprovedAddMember(userdesc)
else:
result = 1
try:
except:
return 0
try:
- mlist.ApprovedDeleteMember(userdesc.address, None, 0, 0)
+ mlist.ApprovedDeleteMember(userdesc.address)
mlist.Save()
mlist.Unlock()
return 1
if forlife+'@polytechnique.org' in members:
continue
userd = UserDesc(forlife+'@polytechnique.org', name, None, 0)
- mlist.ApprovedAddMember(userd,0,0)
+ mlist.ApprovedAddMember(userd)
added.append( (userd.fullname, userd.address) )
mlist.Save()
finally:
if not is_admin_on(userdesc, perms, mlist):
return 0
- map(lambda user: mlist.ApprovedDeleteMember(user+'@polytechnique.org', None, 0, 0), users)
+ map(lambda user: mlist.ApprovedDeleteMember(user+'@polytechnique.org'), users)
mlist.Save()
finally:
mlist.Unlock()
try:
if not is_admin_on(userdesc, perms, mlist):
return 0
- mlist.HandleRequest(int(id),value,comment)
+ mlist.HandleRequest(int(id),int(value),comment)
+ mlist.Save()
+ mlist.Unlock()
return 1
except:
+ mlist.Unlock()
return 0
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: liste.tpl,v 1.7 2004-09-20 20:04:38 x2000habouzit Exp $
+ $Id: liste.tpl,v 1.8 2004-09-21 15:40:36 x2000habouzit Exp $
***************************************************************************}
{dynamic}
</table>
{/if}
-{if $details.you > 1 || ($details.priv>1 && $smarty.session.perms eq admin)}
+{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,
Un message est adressé automatiquement à toute personne ajoutée à la liste de diffusion. Voici le
message actuellement envoyé : il est modifiable à volonté !
</p>
-<p>
-L'objet du mail est "Bienvenue sur la liste de diffusion {$details.name} !"<br />
-Et si la personne fait "répondre à", le message arrive aux modérateurs de la liste.
-</p>
<form method='post' action='{$smarty.server.REQUEST_URI}'>
<div class='center'>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: listes.inc.tpl,v 1.1 2004-09-20 21:31:29 x2000habouzit Exp $
+ $Id: listes.inc.tpl,v 1.2 2004-09-21 15:40:36 x2000habouzit Exp $
***************************************************************************}
-<form action='{$smarty.server.PHP_SELF}'>
- <table class='bicol' cellpadding='0' cellspacing='0'>
- <tr>
- <th>Liste</th>
- <th>Description</th>
- <th>Diffusion</th>
- <th>Inscription</th>
- </tr>
- {foreach from=$listes item=liste}
- {if $liste.priv >= $min && $liste.priv <= $max|default:$min}
- <tr class='{cycle values="impair,pair"}'>
- <td>
- <a href='liste.php?liste={$liste.list}'>{$liste.list}</a>
- {if $liste.you>1}[<a href='moderate.php?liste={$liste.list}'>mod</a>]{/if}
- </td>
- <td>{$liste.desc}</td>
- <td class='center'>{if $liste.diff}modérée{else}libre{/if}</td>
- <td class='right'>
- {if $liste.you is odd}
- {if $liste.ins}inscrit{/if} <input type='checkbox' checked='checked' name='{$liste.desc}' />
- {elseif $liste.ins}
- <input type='submit' name='{$liste.desc}' value='demander' />
- {else}
- <input type='checkbox' name='{$liste.desc}' />
- {/if}
- </td>
- </tr>
- {/if}
- {/foreach}
- </table>
-</form>
+<table class='bicol' cellpadding='0' cellspacing='0'>
+ <tr>
+ <th>Liste</th>
+ <th>Description</th>
+ <th>Diffusion</th>
+ <th>Inscription</th>
+ <th></th>
+ </tr>
+ {foreach from=$listes item=liste}
+ {if $liste.priv >= $min && $liste.priv <= $max|default:$min}
+ <tr class='{cycle values="impair,pair"}'>
+ <td>
+ <a href='liste.php?liste={$liste.list}'>{$liste.list}</a>
+ {if $liste.you>1}[<a href='moderate.php?liste={$liste.list}'>mod</a>]{/if}
+ </td>
+ <td>{$liste.desc}</td>
+ <td class='center'>{if $liste.diff}modérée{else}libre{/if}</td>
+ <td class='center'>{if $liste.ins}modérée{else}libre{/if}</td>
+ <td class='right'>
+ {if $liste.you is odd}
+ <a href='{$smarty.server.PHP_SELF}?del={$liste.list}'>me désinscrire</a>
+ {elseif $liste.ins}
+ <a href='{$smarty.server.PHP_SELF}?add={$liste.list}'>m'inscrire</a>
+ {/if}
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+</table>
{* vim:set et sw=2 sts=2 sws=2: *}
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: moderate.tpl,v 1.2 2004-09-20 21:31:29 x2000habouzit Exp $
+ $Id: moderate.tpl,v 1.3 2004-09-21 15:40:36 x2000habouzit Exp $
***************************************************************************}
{dynamic}
</div>
{if $subs|@count}
+<table class='bicol' cellpadding='0' cellspacing='0'>
+ <tr>
+ <th>Nom</th>
+ <th>Adresse</th>
+ <th></th>
+ </tr>
+ {foreach from=$subs item=s}
+ <tr class='{cycle values="pair,impair"}'>
+ <td>{$s.name}</td>
+ <td>{$s.addr}</td>
+ <td class='action'>
+ <a href='?liste={$smarty.request.liste}&sadd={$s.id}'>ajouter</a>
+ <a href='?liste={$smarty.request.liste}&sid={$s.id}'>refuser</a>
+ </td>
+ </tr>
+ {/foreach}
+</table>
{else}
<p>pas d'inscriptions en attente de modération</p>
{/if}
<td class='right'>{$m.size}o</td>
<td class='right'>{$m.stamp|date_format:"%H:%M:%S<br />%d %b %Y"}</td>
<td class='action'>
- <a href='{$smarty.server.PHP_SELF}?liste={$smarty.request.liste}&mid={$m.id}'>voir</a>
+ <a href='?liste={$smarty.request.liste}&mid={$m.id}'>voir</a>
</td>
</tr>
{/foreach}
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: moderate_mail.tpl,v 1.1 2004-09-20 20:04:38 x2000habouzit Exp $
+ $Id: moderate_mail.tpl,v 1.2 2004-09-21 15:40:36 x2000habouzit Exp $
***************************************************************************}
{dynamic}
{/dynamic}
-{* vim:settd>{$mail et sw=2 sts=2 sws=2: *}
+{* vim:set et sw=2 sts=2 sws=2: *}
--- /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: moderate_sub.tpl,v 1.1 2004-09-21 15:40:36 x2000habouzit Exp $
+ ***************************************************************************}
+
+{dynamic}
+
+{if $no_list}
+
+<p class='erreur'>La liste n'existe pas ou tu n'as pas le droit de la modérer</p>
+
+{else}
+
+<div class='rubrique'>
+ Refuser l'inscription d'un utilisateur
+</div>
+
+<form method='post' action='?liste={$smarty.request.liste}'>
+ <table class='tinybicol' cellpadding='0' cellspacing='0'>
+ <tr>
+ <th class='titre'>refuser l'inscription de :</th>
+ </tr>
+ <tr>
+ <td>{$del_user.name}</td>
+ </tr>
+ <tr>
+ <td>raison:
+ <textarea cols='50' rows='10' name='reason'></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td class='center'>
+ <input type='hidden' name='sdel' value='{$del_user.id}' />
+ <input type='submit' value='Refuser !' />
+ </td>
+ </tr>
+ </table>
+</form>
+
+{/if}
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}