From 61de0a27d382324fb55f3c148979a0bd16202706 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sun, 24 Oct 2004 13:49:02 +0000 Subject: [PATCH] 1-click moderation --- ChangeLog | 4 +++- htdocs/listes/admin.php | 13 ++++++++++--- htdocs/listes/moderate.php | 16 ++++++++++------ templates/listes/admin.tpl | 6 +++++- templates/listes/moderate.tpl | 22 +++++++++++++++++++--- 5 files changed, 47 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8db0923..8bc667a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,9 @@ Changes : * Lists : - auto-moderate/discard mails detected as SPAM by bogofilter. -MC - - alpha-sort on listes/admin.php page (members gestion). -MC + - improve header/subject decoding. -MC + - alpha-sort on listes/admin.php + msgs for each operations. -MC + - 1-click moderation for accept and reject cases. -MC * Usability : - all now have title (closes: FS#99). -MC diff --git a/htdocs/listes/admin.php b/htdocs/listes/admin.php index 7adf3b6..2bd6221 100644 --- a/htdocs/listes/admin.php +++ b/htdocs/listes/admin.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: admin.php,v 1.6 2004-10-23 21:31:46 x2000habouzit Exp $ + $Id: admin.php,v 1.7 2004-10-24 13:49:02 x2000habouzit Exp $ ***************************************************************************/ if(empty($_REQUEST['liste'])) header('Location: index.php'); @@ -31,11 +31,16 @@ 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); + +$err = Array(); $client = new xmlrpc_client("http://{$_SESSION['uid']}:$pass@localhost:4949"); if(isset($_REQUEST['add_member'])) { - $client->mass_subscribe('polytechnique.org', $liste, Array($_REQUEST['add_member'])); + $arr = $client->mass_subscribe('polytechnique.org', $liste, Array($_REQUEST['add_member'])); + if(is_array($arr)) { + foreach($arr as $addr) $err[] = "{$addr[0]} inscrit."; + } } if(isset($_REQUEST['del_member'])) { @@ -44,7 +49,8 @@ if(isset($_REQUEST['del_member'])) { } if(isset($_REQUEST['add_owner'])) { - $client->add_owner('polytechnique.org', $liste, $_REQUEST['add_owner']); + if($client->add_owner('polytechnique.org', $liste, $_REQUEST['add_owner'])) + $err = $_REQUEST['add_owner']." ajouté aux modérateurs."; } if(isset($_REQUEST['del_owner'])) { @@ -89,5 +95,6 @@ if(list($det,$mem,$own) = $client->get_members('polytechnique.org', $liste)) { } else $page->assign('no_list',true); +$page->assign('err', $err); $page->run(); ?> diff --git a/htdocs/listes/moderate.php b/htdocs/listes/moderate.php index 78c799c..86933f9 100644 --- a/htdocs/listes/moderate.php +++ b/htdocs/listes/moderate.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: moderate.php,v 1.9 2004-10-24 12:54:44 x2000habouzit Exp $ + $Id: moderate.php,v 1.10 2004-10-24 13:49:02 x2000habouzit Exp $ ***************************************************************************/ if(empty($_REQUEST['liste'])) header('Location: index.php'); @@ -48,14 +48,15 @@ if(isset($_POST['sdel'])) { /** 2 is the magic for REJECT see Defaults.py **/ } -if(isset($_POST['mid'])) { - include_once('diogenes.mailer.inc.php'); - $mid = $_POST['mid']; - if(isset($_POST['mok'])) { +if(isset($_REQUEST['mid'])) { + $mid = $_REQUEST['mid']; + if(isset($_REQUEST['mok'])) { + unset($_GET['mid']); $client->handle_request('polytechnique.org', $liste,$mid,1,''); /** 1 = APPROVE **/ } elseif(isset($_POST['mno'])) { $reason = stripslashes($_POST['reason']); if($client->handle_request('polytechnique.org', $liste,$mid,2,$reason)) { /** 2 = REJECT **/ + include_once('diogenes.mailer.inc.php'); $mailer = new DiogenesMailer("$liste-bounces@polytechnique.org", "$liste-owner@polytechnique.org", "Message refusé"); $texte = "le message a été refusé par {$_SESSION['prenom']} {$_SESSION['nom']} avec la raison :\n" @@ -63,8 +64,10 @@ if(isset($_POST['mid'])) { $mailer->setBody(wordwrap($texte,72)); $mailer->send(); } - } elseif(isset($_POST['mdel'])) { + } elseif(isset($_REQUEST['mdel'])) { + unset($_GET['mid']); if($client->handle_request('polytechnique.org', $liste,$mid,3,'')) { /** 3 = DISCARD **/ + include_once('diogenes.mailer.inc.php'); $mailer = new DiogenesMailer("$liste-bounces@polytechnique.org", "$liste-owner@polytechnique.org", "Message supprimé"); $texte = "le message a été supprimé par {$_SESSION['prenom']} {$_SESSION['nom']}.\n\n" @@ -76,6 +79,7 @@ if(isset($_POST['mid'])) { } if(isset($_REQUEST['sid'])) { + $sid = $_REQUEST['sid']; if(list($subs,$mails) = $client->get_pending_ops('polytechnique.org', $liste)) { foreach($subs as $user) { diff --git a/templates/listes/admin.tpl b/templates/listes/admin.tpl index 432d569..1ba3b9f 100644 --- a/templates/listes/admin.tpl +++ b/templates/listes/admin.tpl @@ -17,7 +17,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: admin.tpl,v 1.11 2004-10-23 21:33:40 x2000habouzit Exp $ + $Id: admin.tpl,v 1.12 2004-10-24 13:49:03 x2000habouzit Exp $ ***************************************************************************} {dynamic} @@ -55,6 +55,10 @@ Pour entrer un utilisateur, il faut remplir les champs pr c'est-à-dire "prenom.nom" ou "prenom.nom.promo"

+{foreach from=$err item=e} +

{$e}

+{/foreach} +
modérateurs de la liste
diff --git a/templates/listes/moderate.tpl b/templates/listes/moderate.tpl index 0542fec..2bb19a6 100644 --- a/templates/listes/moderate.tpl +++ b/templates/listes/moderate.tpl @@ -17,7 +17,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: moderate.tpl,v 1.13 2004-10-24 12:54:44 x2000habouzit Exp $ + $Id: moderate.tpl,v 1.14 2004-10-24 13:49:03 x2000habouzit Exp $ ***************************************************************************} {dynamic} @@ -76,6 +76,21 @@ {if $mails|@count} + + @@ -87,12 +102,13 @@ {foreach from=$mails item=m} - + + accepter
+ rejeter {/foreach}
émetteur
{$m.sender}{$m.subj}{$m.subj|default:"[pas de sujet]"} {$m.size}o {$m.stamp|date_format:"%H:%M:%S
%d %b %Y"}
voir -
-- 2.1.4