From: x2003bruneau Date: Tue, 28 Nov 2006 15:46:10 +0000 (+0000) Subject: Fix Xnet lists deletion X-Git-Tag: xorg/0.9.12~22 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=3892467cf8b88f0fa836be6b22ba1355bebaa2df;p=platal.git Fix Xnet lists deletion git-svn-id: svn+ssh://murphy/home/svn/platal/branches/platal-0.9.12@1188 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/modules/lists.php b/modules/lists.php index caa7844..0d712f9 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -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.
' + . 'Contact les administrateurs du site pour régler le problème : ' + . 'support@staff.polytechnique.org'); } - $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);