* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: liste.php,v 1.4 2004-09-11 15:11:13 x2000habouzit Exp $
+ $Id: liste.php,v 1.5 2004-09-20 20:04:37 x2000habouzit Exp $
***************************************************************************/
if(empty($_REQUEST['liste'])) header('Location: index.php');
$liste = $_REQUEST['liste'];
require("auto.prepend.inc.php");
-new_skinned_page('listes/liste.tpl', AUTH_COOKIE, true);
+new_skinned_page('listes/liste.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']}");
$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'])) {
--- /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: moderate.php,v 1.1 2004-09-20 20:04:37 x2000habouzit Exp $
+ ***************************************************************************/
+
+if(empty($_REQUEST['liste'])) header('Location: index.php');
+$liste = $_REQUEST['liste'];
+
+require("auto.prepend.inc.php");
+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(!$client->is_admin($liste)) header('Location: index.php');
+
+if(isset($_REQUEST['mid'])) {
+ $mid = $_REQUEST['mid'];
+ new_skinned_page('listes/moderate_mail.tpl', AUTH_MDP, true);
+ $mail = $client->get_pending_mail($liste,$mid);
+ if(is_array($mail)) {
+ $page->assign_by_ref('mail', $mail);
+ }
+} else {
+ new_skinned_page('listes/moderate.tpl', AUTH_MDP, true);
+
+ if(list($subs,$mails) = $client->get_pending_ops($liste)) {
+ $page->assign_by_ref('subs', $subs);
+ $page->assign_by_ref('mails', $mails);
+ }
+}
+$page->run();
+?>
#* Foundation, Inc., *
#* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
#***************************************************************************
-# $Id: mailman-rpc.py,v 1.19 2004-09-19 21:09:12 x2000habouzit Exp $
+# $Id: mailman-rpc.py,v 1.20 2004-09-20 20:04:37 x2000habouzit Exp $
#***************************************************************************
import base64, MySQLdb, os
from Mailman import mm_cfg
from Mailman import i18n
from Mailman.UserDesc import UserDesc
+from Mailman.ListAdmin import readMessage
+from email.Iterators import typed_subpart_iterator
class AuthFailed(Exception): pass
'id' : id,
'sender': sender,
'size' : size,
+ 'subj' : subject,
'stamp' : ptime
})
except:
try:
if not is_admin_on(userdesc, perms, mlist):
return 0
- mlist.HandleRequest(id,value,comment)
+ mlist.HandleRequest(int(id),value,comment)
return 1
except:
return 0
+def get_pending_mail((userdesc,perms),listname,id,raw=0):
+ try:
+ mlist = MailList.MailList(listname)
+ except:
+ return 0
+ try:
+ if not is_admin_on(userdesc, perms, mlist):
+ return 0
+ ptime, sender, subject, reason, filename, msgdata = mlist.GetRecord(int(id))
+ fpath = os.path.join(mm_cfg.DATA_DIR, filename)
+ size = os.path.getsize(fpath)
+ msg = readMessage(fpath)
+ mlist.Unlock()
+
+ if raw:
+ return str(msg)
+ results = []
+ for part in typed_subpart_iterator(msg,'text','plain'):
+ results.append (part.get_payload(decode=1))
+ return {'id' : id,
+ 'sender': sender,
+ 'size' : size,
+ 'subj' : subject,
+ 'stamp' : ptime,
+ 'parts' : results }
+ except:
+ mlist.Unlock()
+ return 0
+
+def is_admin((userdesc,perms),listname):
+ try:
+ mlist = MailList.MailList(listname, lock=0)
+ except:
+ return 0
+ return is_admin_on(userdesc, perms, mlist)
+
################################################################################
#
# INIT
server.register_function(set_welcome)
server.register_function(get_pending_ops)
server.register_function(handle_request)
+server.register_function(get_pending_mail)
+server.register_function(is_admin)
server.serve_forever()
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: liste.tpl,v 1.6 2004-09-11 15:11:14 x2000habouzit Exp $
+ $Id: liste.tpl,v 1.7 2004-09-20 20:04:38 x2000habouzit Exp $
***************************************************************************}
{dynamic}
modérateurs de la liste
</div>
+{if $owners|@count}
<table class='tinybicol' cellpadding='0' cellspacing='0'>
{foreach from=$owners item=xs key=promo}
<tr>
</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>
</tr>
{/foreach}
</table>
+{/if}
{if $details.you > 1 || ($details.priv>1 && $smarty.session.perms eq admin)}
<div class='rubrique'>
--- /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.tpl,v 1.1 2004-09-20 20:04:38 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'>
+ Inscriptions en attente de modération
+</div>
+
+<div class='rubrique'>
+ Mails en attente de modération
+</div>
+
+<table class='bicol' cellpadding='0' cellspacing='0'>
+ <tr>
+ <th>émetteur</th>
+ <th>sujet</th>
+ <th>taille</th>
+ <th>date</th>
+ <th></th>
+ </tr>
+ {foreach from=$mails item=m}
+ <tr class='{cycle values="pair,impair"}'>
+ <td>{$m.sender}</td>
+ <td>{$m.subj}</td>
+ <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>
+ </td>
+ </tr>
+ {/foreach}
+</table>
+
+{/if}
+
+{/dynamic}
+
+{* 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_mail.tpl,v 1.1 2004-09-20 20:04:38 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'>
+ Propriétés du mail en attente
+</div>
+
+<table class='tinybicol' cellpadding='0' cellspacing='0'>
+ <tr>
+ <td class='titre'>émetteur</td>
+ <td>{$mail.sender}</td>
+ </tr>
+ <tr>
+ <td class='titre'>sujet</td>
+ <td>{$mail.subj}</td>
+ </tr>
+ <tr>
+ <td class='titre'>taille</td>
+ <td>{$mail.size} octets</td>
+ </tr>
+ <tr>
+ <td class='titre'>date</td>
+ <td>{$mail.stamp|date_format:"%H:%M:%S le %d %b %Y"}</td>
+ </tr>
+</table>
+
+<div class='rubrique'>
+ Contenu du mail en attente
+</div>
+
+{if $mail.parts|@count}
+<table class='bicol' cellpadding='0' cellspacing='0'>
+ {foreach from=$mail.parts item=part key=i}
+ <tr><th>Partie n°{$i}</th></tr>
+ <tr class='{cycle values="impair,pair"}'>
+ <td><pre>{$part|regex_replace:"!\\n-- *\\n(.*?)$!sm":"</pre><hr style='width:98%;margin:1%'/><pre>\\1"}</pre></td>
+ </tr>
+ {/foreach}
+</table>
+{/if}
+
+{/if}
+
+{/dynamic}
+
+{* vim:settd>{$mail et sw=2 sts=2 sws=2: *}