Prepare activation of liste-unsubscribe
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 10 Dec 2007 21:43:03 +0000 (22:43 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 10 Dec 2007 21:43:03 +0000 (22:43 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
include/validations/listes.inc.php
modules/lists.php
modules/xnetlists.php

index ffa56ee..74c9074 100644 (file)
@@ -112,7 +112,7 @@ class ListeReq extends Validate
                                   $this->owners, $this->members);
         $liste = strtolower($this->liste);
         if ($ret) {
-            foreach(Array($liste, $liste."-owner", $liste."-admin", $liste."-bounces") as $l) {
+            foreach(Array($liste, $liste."-owner", $liste."-admin", $liste."-bounces", $liste."-unsubscribe") as $l) {
                 XDB::execute("INSERT INTO aliases (alias,type) VALUES({?}, 'liste')", $l);
             }
         }
index 14769a3..72fac4f 100644 (file)
@@ -681,7 +681,7 @@ class ListsModule extends PLModule
         $page->changeTpl('lists/delete.tpl');
         if (Post::v('valid') == 'OUI') {
             if ($this->client->delete_list($liste, Post::b('del_archive'))) {
-                foreach (array('', '-owner', '-admin', '-bounces') as $app) {
+                foreach (array('', '-owner', '-admin', '-bounces', '-unsubscribe') as $app) {
                     XDB::execute("DELETE FROM  $table
                                         WHERE  type={?} AND alias={?}",
                                  $type, $liste.$app.$domain);
index f087b54..a962a38 100644 (file)
@@ -164,27 +164,15 @@ class XnetListsModule extends ListsModule
                         ."<a href='mailto:support@m4x.org'>support@m4x.org</a>");
             return;
         }
-        XDB::execute('INSERT INTO x4dat.virtual (alias,type)
-                                VALUES({?},{?})', $liste.'@'.$dom, 'list');
-        XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
-                                VALUES ({?}, {?})', XDB::insertId(),
-                               "$red+post@listes.polytechnique.org");
-        XDB::execute('INSERT INTO x4dat.virtual (alias,type)
-                                VALUES({?},{?})', $liste.'-owner@'.$dom, 'list');
-        XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
-                                VALUES ({?}, {?})', XDB::insertId(),
-                               "$red+owner@listes.polytechnique.org");
-        XDB::execute('INSERT INTO x4dat.virtual (alias,type)
-                                VALUES({?},{?})', $liste.'-admin@'.$dom, 'list');
-        XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
-                                VALUES ({?}, {?})', XDB::insertId(),
-                               "$red+admin@listes.polytechnique.org");
-        XDB::execute('INSERT INTO x4dat.virtual (alias,type)
-                                VALUES({?},{?})', $liste.'-bounces@'.$dom, 'list');
-        XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
-                                VALUES ({?}, {?})', XDB::insertId(),
-                                "$red+bounces@listes.polytechnique.org");
-
+        foreach (array('', 'owner', 'admin', 'bounces', 'unsubscribe') as $app) {
+            $mdir = $app == '' ? '+post' : '+' . $app;
+            $app  = '-' . $app;
+            XDB::execute('INSERT INTO x4dat.virtual (alias,type)
+                                    VALUES({?},{?})', $liste. $app . '@'.$dom, 'list');
+            XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
+                                    VALUES ({?}, {?})', XDB::insertId(),
+                                   $red . $mdir . '@listes.polytechnique.org');
+        }
         pl_redirect('lists/admin/'.$liste);
     }