Backport [1188], [1189] and [1190]
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 28 Nov 2006 18:18:18 +0000 (18:18 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 28 Nov 2006 18:18:18 +0000 (18:18 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1191 839d8a87-29fc-0310-9880-83ba4fa771e5

modules/auth.php
modules/lists.php

index dae0153..28463d6 100644 (file)
@@ -90,6 +90,7 @@ class AuthModule extends PLModule
 
             $res .= "</membres>\n\n";
 
+                       header('Content-Type: text/xml; charset="ISO-8859-1"');
             echo $res;
         }
         exit;
index caa7844..cc6a747 100644 (file)
@@ -603,23 +603,36 @@ class ListsModule extends PLModule
 
     function handler_delete(&$page, $liste = null)
     {
+        global $globals;
         if (is_null($liste)) {
             return PL_NOT_FOUND;
         }
 
-        $this->prepare_client($page);
+        $domain = $this->prepare_client($page);
+        if ($domain == $globals->mail->domain || $domain == $globals->mail->domain2) {
+            $domain = '';
+            $table  = 'aliases';
+            $type   = 'liste';
+        } else {
+            $domain = '@' . $domain;
+            $table  = 'virtual';
+            $type   = 'list';
+        }
 
         $page->changeTpl('listes/delete.tpl');
-
-        if (Post::v('valid') == 'OUI'
-        && $this->client->delete_list($liste, Post::b('del_archive')))
-        {
-            foreach (array('', '-owner', '-admin', '-bounces') as $app) {
-                XDB::execute("DELETE FROM  aliases
-                                              WHERE  type='liste' AND alias='{?}'",
-                                       $liste.$app);
+        if (Post::v('valid') == 'OUI') {
+            if ($this->client->delete_list($liste, Post::b('del_archive'))) {
+                foreach (array('', '-owner', '-admin', '-bounces') as $app) {
+                    XDB::execute("DELETE FROM  $table
+                                        WHERE  type={?} AND alias={?}",
+                                 $type, $liste.$app.$domain);
+                }
+                $page->assign('deleted', true);
+            } else {
+                $page->kill('Une erreur est survenue lors de la suppression de la liste.<br />'
+                         . 'Contact les administrateurs du site pour régler le problème : '
+                         . '<a href="mailto:support@polytechnique.org">support@polytechnique.org</a>');
             }
-            $page->assign('deleted', true);
         } elseif (list($details,$options) = $this->client->get_owner_options($liste)) {
             $page->assign_by_ref('details', $details);
             $page->assign_by_ref('options', $options);