alias-create + fixes
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Thu, 21 Apr 2005 13:57:37 +0000 (13:57 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:28:41 +0000 (23:28 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-579

htdocs.net/groupe/alias-create.php [new file with mode: 0644]
templates/xnet/groupe/alias-create.tpl [new file with mode: 0644]
templates/xnet/groupe/listes.tpl

diff --git a/htdocs.net/groupe/alias-create.php b/htdocs.net/groupe/alias-create.php
new file mode 100644 (file)
index 0000000..f76b572
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+require 'xnet.inc.php';
+
+new_groupadmin_page('xnet/groupe/alias-create.tpl');
+$page->useMenu();
+$page->setType($globals->asso('cat'));
+
+$page->assign('asso', $globals->asso());
+
+if(Post::has('submit')) {
+    if (!Post::has('liste')) {
+        $page->kill('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');
+    }
+
+    $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');
+    }
+  
+    $globals->xdb->query('INSERT INTO x4dat.virtual (alias,type) VALUES({?}, "user")', $new);
+    header("Location: alias-admin.php?liste=$new");
+}
+
+$page->run();
+
+?>
diff --git a/templates/xnet/groupe/alias-create.tpl b/templates/xnet/groupe/alias-create.tpl
new file mode 100644 (file)
index 0000000..782ca14
--- /dev/null
@@ -0,0 +1,61 @@
+{***************************************************************************
+ *  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>Création d'un alias</h1>
+<p class='descr'>
+Les alias sont concus pour répondre aux problèmes suivants :
+</p>
+<ul class='descr'>
+  <li>
+  redirections pour les postes des gens au sein du groupe : par exemple il est pratique d'avoir un alias
+  president@..., ou bien tresorier@... qui pointent tout le temps vers la bonne personne du groupe.
+  Une sorte d'adresse de «redirection à vie».
+  </li>
+  <li>
+  listes de diffusions pour de petits nombres de personnes (bureau@ ...)
+  </li>
+  <li>
+  listes à vie courte (liste créée pour l'organisation d'un évenement ponctuel par exemple)
+  </li>
+  <li>
+  fédérer plusieurs listes/alias sous un même nom (ce que ne peuvent faire les listes de diffusion).
+  </li>
+</ul>
+
+<p class='descr'>
+Pour les autres besoins de communications (notament pour un grand nombre de personnes, et pour bénéficier des outils
+de modération), il est recommandé de créer <a href="listes-create.php">une liste de diffusion</a>.
+</p>
+<form action='{$smarty.server.PHP_SELF}' method='post'>
+  <table border='1'>
+    <tr>
+      <th colspan='2'>Caractéristiques de l'alias</th>
+    </tr>
+    <tr>
+      <td><strong>Addresse&nbsp;souhaitée&nbsp;:</strong></td>
+      <td>
+        <input type='text' name='liste' value='{$smarty.post.liste}' />@{$asso.mail_domain}
+      </td>
+    </tr>
+  </table>
+  <center><p><input name='submit' type='submit' value="Créer !" /></p></center>
+</form>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
index 3f96996..1c0773a 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************}
 
-
 {if $smarty.get.del_alias}
 
 <p class="error">Est tu sur de supprimer l'alias {$smarty.get.del_alias} ?</p>
-<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method="post">
+<form action='{$smarty.server.PHP_SELF}' method="post">
   <div class="center">
     <input type='submit' value="Oui, je suis sur" />
     <input type='hidden' name='del_alias' value="{$smarty.get.del_alias}" />
@@ -82,7 +81,6 @@ croix verte te permet de t'inscrire, apr
   {foreachelse}
   <tr><td colspan='6'>Pas de listes pour ce groupe</td></tr>
   {/foreach}
-  {/if}
 </table>
 
 <p class="descr">
@@ -109,4 +107,6 @@ t'emp
 <p>Aucun alias pour ce groupe</p>
 {/if}
 
+{/if}
+
 {* vim:set et sw=2 sts=2 sws=2: *}