git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-580
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);
--- /dev/null
+<?php
+require 'xnet.inc.php';
+
+new_groupadmin_page('xnet/groupe/listes-create.tpl');
+$page->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 <a href='mailto:support@m4x.org'>support@m4x.org</a>");
+ }
+}
+
+$page->run()
+
+?>
--- /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 *
+ ***************************************************************************}
+
+<h1>{$asso.nom} : Création d'une liste de diffusion</h1>
+
+<p class="descr">
+<strong>Note :</strong> 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 <a href="alias-create.php">un alias</a>, à la gestion beaucoup plus souple.
+</p>
+<p class="descr">
+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 <strong>impérativement</strong> utiliser
+<a href="alias-create.php">un alias</a> qui, lui, est capable de regrouper plusieurs listes.
+</p>
+<form action='{$smarty.server.PHP_SELF}' method='post'>
+ <table>
+ <tr>
+ <th colspan='2'>Caractéristiques de la Liste</th>
+ </tr>
+ <tr>
+ <td><strong>Addresse souhaitée :</strong></td>
+ <td>
+ <input type='text' name='liste' value='{$smarty.post.liste}' />@{$asso.mail_domain}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Sujet (bref) :</strong></td>
+ <td>
+ <input type='text' name='desc' size='40' value="{$smarty.post.desc}" />
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Propriétés :</strong></td>
+ <td>
+ <table style='width: 100%'>
+ <tr>
+ <td>visibilité :</td>
+ <td>
+ <input type='radio' name='advertise' value='0'
+ {if $smarty.post.advertise && $smarty.post}checked='checked'{/if} />publique
+ </td>
+ <td>
+ <input type='radio' name='advertise' value='1'
+ {if !$smarty.post.advertise || !$smarty.post}checked='checked'{/if} />privée
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>diffusion :</td>
+ <td>
+ <input type='radio' name='modlevel' value='0'
+ {if !$smarty.post.modlevel}checked='checked'{/if} />libre
+ </td>
+ <td>
+ <input type='radio' name='modlevel' value='1'
+ {if $smarty.post.modlevel eq 1}checked='checked'{/if} />restreinte
+ </td>
+ <td><input type='radio' name='modlevel' value='2'
+ {if $smarty.post.modlevel eq 2}checked='checked'{/if} />modérée
+ </td>
+ </tr>
+ <tr>
+ <td>inscription :</td>
+ <td>
+ <input type='radio' name='inslevel' value='0'
+ {if !$smarty.post.inslevel && $smarty.post}checked='checked'{/if} />libre
+ </td>
+ <td>
+ <input type='radio' name='inslevel' value='1'
+ {if $smarty.post.inslevel || !$smarty.post}checked='checked'{/if} />modérée
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <p class="center"><input name='submit' type='submit' value="Créer !" /></p>
+</form>
+
+{* vim:set et sw=2 sts=2 sws=2: *}