Fixes nationalities deletion.
[platal.git] / modules / xnetgrp.php
index 0e1af54..215f45b 100644 (file)
@@ -164,10 +164,6 @@ class XnetGrpModule extends PLModule
                 $site = "";
             }
             if (S::admin()) {
-                $dom = XDB::iterator('SELECT  *
-                                        FROM  group_dom
-                                    ORDER BY  nom');
-                $page->assign('dom', $dom);
                 $page->assign('super', true);
 
                 if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) {
@@ -226,7 +222,15 @@ class XnetGrpModule extends PLModule
                 }
             }
 
-            pl_redirect('../'.Post::v('diminutif', $globals->asso('diminutif')).'/edit');
+            pl_redirect('../' . Post::v('diminutif', $globals->asso('diminutif')) . '/edit');
+        }
+
+        if (S::admin()) {
+            $dom = XDB::iterator('SELECT  *
+                                    FROM  group_dom
+                                ORDER BY  nom');
+            $page->assign('dom', $dom);
+            $page->assign('super', true);
         }
     }
 
@@ -727,18 +731,20 @@ class XnetGrpModule extends PLModule
 
         $may_update = may_update();
         $warning    = false;
-        foreach ($listes as $liste) {
-            if ($liste['sub'] == 2) {
-                if ($may_update) {
-                    $mmlist->mass_unsubscribe($liste['list'], Array($user->forlifeEmail()));
-                } else {
-                    $mmlist->unsubscribe($liste['list']);
+        if (is_array($listes)) {
+            foreach ($listes as $liste) {
+                if ($liste['sub'] == 2) {
+                    if ($may_update) {
+                        $mmlist->mass_unsubscribe($liste['list'], Array($user->forlifeEmail()));
+                    } else {
+                        $mmlist->unsubscribe($liste['list']);
+                    }
+                } elseif ($liste['sub']) {
+                    Platal::page()->trigWarning($user->fullName() . " a une"
+                                               ." demande d'inscription en cours sur la"
+                                               ." liste {$liste['list']}@ !");
+                    $warning = true;
                 }
-            } elseif ($liste['sub']) {
-                Platal::page()->trigWarning($user->fullName() . " a une"
-                                           ." demande d'inscription en cours sur la"
-                                           ." liste {$liste['list']}@ !");
-                $warning = true;
             }
         }