From: Pierre Habouzit (MadCoder Date: Thu, 21 Apr 2005 14:26:29 +0000 (+0000) Subject: listes-create + alias-create fixes X-Git-Tag: xorg/old~182 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=88579fb0394ccd5b61838c5197459bcff9e880ec;p=platal.git listes-create + alias-create fixes git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-580 --- diff --git a/htdocs.net/groupe/alias-create.php b/htdocs.net/groupe/alias-create.php index f76b572..7094998 100644 --- a/htdocs.net/groupe/alias-create.php +++ b/htdocs.net/groupe/alias-create.php @@ -9,18 +9,18 @@ $page->assign('asso', $globals->asso()); if(Post::has('submit')) { if (!Post::has('liste')) { - $page->kill('champs «addresse souhaitée» vide'); + $page->trig_run('champs «addresse souhaitée» vide'); } $liste = Post::get('liste'); if (!preg_match("/^[a-zA-Z0-9\-]*$/", $liste)) { - $page->kill('le nom de l\'alias ne doit contenir que des lettres, chiffres et tirets'); + $page->trig_run('le nom de l\'alias ne doit contenir que des lettres, chiffres et tirets'); } $new = $liste.'@'.$globals->asso('mail_domain'); $res = $globals->xdb->query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new); $n = $res->fetchOneCell(); if($n) { - $page->kill('cet alias est déjà pris'); + $page->trig_run('cet alias est déjà pris'); } $globals->xdb->query('INSERT INTO x4dat.virtual (alias,type) VALUES({?}, "user")', $new); diff --git a/htdocs.net/groupe/listes-create.php b/htdocs.net/groupe/listes-create.php new file mode 100644 index 0000000..b65208a --- /dev/null +++ b/htdocs.net/groupe/listes-create.php @@ -0,0 +1,56 @@ +useMenu(); +$page->setType($globals->asso('cat')); +$page->assign('asso', $globals->asso()); + +if (Post::has('submit')) { + if (!Post::has('liste')) { + $page->trig_run('champs «addresse souhaitée» vide'); + } + + $liste = Post::get('liste'); + + if (!preg_match("/^[a-zA-Z0-9\-]*$/", $liste)) { + $page->trig_run('le nom de la liste ne doit contenir que des lettres, chiffres et tirets'); + } + + $new = $liste.'@'.$globals->asso('mail_domain'); + $res = $globals->xdb->query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new); + $n = $res->fetchOneCell(); + + if($n) { + $page->trig_run('cet alias est déjà pris'); + } + if(!Post::get('desc')) { + $page->trig_run('le sujet est vide'); + } + + require('xml-rpc-client.inc.php'); + require_once('lists.inc.php'); + $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $globals->asso('mail_domain')); + $ret = $client->create_list($liste, Post::get('desc'), Post::get('advertise'), Post::get('modlevel'), Post::get('inslevel'), array(Session::get('forlife')), array()); + + $dom = strtolower($asso["mail_domain"]); + $red = $dom.'_'.$liste; + + if($ret) { + $globals->xdb->execute('INSERT INTO x4dat.virtual (alias,type) VALUES({?},{?})', $liste.'@'.$dom, $liste); + $globals->xdb->execute('INSERT INTO x4dat.virtual_redirect (vid,redirect) VALUES ({?}, {?})', mysql_insert_id(), "$red+post@listes.polytechnique.org"); + $globals->xdb->execute('INSERT INTO x4dat.virtual (alias,type) VALUES({?},{?})', $liste.'-owner@'.$dom, $liste); + $globals->xdb->execute('INSERT INTO x4dat.virtual_redirect (vid,redirect) VALUES ({?}, {?})', mysql_insert_id(), "$red+owner@listes.polytechnique.org"); + $globals->xdb->execute('INSERT INTO x4dat.virtual (alias,type) VALUES({?},{?})', $liste.'-admin@'.$dom, $liste); + $globals->xdb->execute('INSERT INTO x4dat.virtual_redirect (vid,redirect) VALUES ({?}, {?})', mysql_insert_id(), "$red+admin@listes.polytechnique.org"); + $globals->xdb->execute('INSERT INTO x4dat.virtual (alias,type) VALUES({?},{?})', $liste.'-bounces@'.$dom, $liste); + $globals->xdb->execute('INSERT INTO x4dat.virtual_redirect (vid,redirect) VALUES ({?}, {?})', mysql_insert_id(), "$red+bounces@listes.polytechnique.org"); + header("Location: listes-admin.php?liste=$liste"); + } else { + $page->kill("Un problème est survenu, contacter support@m4x.org"); + } +} + +$page->run() + +?> diff --git a/templates/xnet/groupe/listes-create.tpl b/templates/xnet/groupe/listes-create.tpl new file mode 100644 index 0000000..acff263 --- /dev/null +++ b/templates/xnet/groupe/listes-create.tpl @@ -0,0 +1,100 @@ +{*************************************************************************** + * 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 * + ***************************************************************************} + +

{$asso.nom} : Création d'une liste de diffusion

+ +

+Note : Les listes de diffusion sont un outil particulièrement adapté pour des +échanges entre 6 personnes, ou plus (newsletter, débat interne au groupe ...). En revanche, elles +s'avèrent peu praticables pour des discussions plus restreintes. Il est alors préférable +d'utiliser un alias, à la gestion beaucoup plus souple. +

+

+D'autre part, il est impossible d'inscrire une liste de diffusion à une autre liste de diffusion. +Si tu as besoin de cette fonctionnalité, il faut alors impérativement utiliser +un alias qui, lui, est capable de regrouper plusieurs listes. +

+
+ + + + + + + + + + + + + + + + +
Caractéristiques de la Liste
Addresse souhaitée : + @{$asso.mail_domain} +
Sujet (bref) : + +
Propriétés : + + + + + + + + + + + + + + + + + + + +
visibilité : + publique + + privée +
diffusion : + libre + + restreinte + modérée +
inscription : + libre + + modérée +
+
+

+
+ +{* vim:set et sw=2 sts=2 sws=2: *}