New page to add users in the database
[platal.git] / modules / xnetlists.php
index 2a9ad7d..299d4cd 100644 (file)
@@ -70,6 +70,9 @@ class XnetListsModule extends ListsModule
     {
         global $globals;
 
+        if (!$globals->asso('mail_domain')) {
+            return PL_NOT_FOUND;
+        }
         $this->prepare_client($page);
 
         $page->changeTpl('xnetlists/index.tpl');
@@ -113,6 +116,9 @@ class XnetListsModule extends ListsModule
     {
         global $globals;
 
+        if (!$globals->asso('mail_domain')) {
+            return PL_NOT_FOUND;
+        }
         $this->prepare_client($page);
 
         $page->changeTpl('xnetlists/create.tpl');
@@ -163,22 +169,22 @@ class XnetListsModule extends ListsModule
         XDB::execute('INSERT INTO x4dat.virtual (alias,type)
                                 VALUES({?},{?})', $liste.'@'.$dom, 'list');
         XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
-                                VALUES ({?}, {?})', mysql_insert_id(),
+                                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 ({?}, {?})', mysql_insert_id(),
+                                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 ({?}, {?})', mysql_insert_id(),
+                                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 ({?}, {?})', mysql_insert_id(),
+                                VALUES ({?}, {?})', XDB::insertId(),
                                 "$red+bounces@listes.polytechnique.org");
 
         pl_redirect('lists/admin/'.$liste);
@@ -188,6 +194,9 @@ class XnetListsModule extends ListsModule
     {
         global $globals;
 
+        if (!$globals->asso('mail_domain')) {
+            return PL_NOT_FOUND;
+        }
         $this->prepare_client($page);
 
         $page->changeTpl('xnetlists/sync.tpl');
@@ -214,7 +223,8 @@ class XnetListsModule extends ListsModule
                      FROM  groupex.membres AS m
                 LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = m.uid )
                 LEFT JOIN  aliases         AS a ON ( a.id = m.uid AND a.type='a_vie' )
-                    WHERE  m.asso_id = {?}", $globals->asso('id'));
+                    WHERE  m.asso_id = {?}
+                 ORDER BY  promo, nom, prenom", $globals->asso('id'));
 
         $not_in_list = array();
 
@@ -229,7 +239,9 @@ class XnetListsModule extends ListsModule
 
     function handler_aadmin(&$page, $lfull = null)
     {
-        if (is_null($lfull)) {
+        global $globals;
+
+        if (!$globals->asso('mail_domain') || is_null($lfull)) {
             return PL_NOT_FOUND;
         }
 
@@ -305,6 +317,9 @@ class XnetListsModule extends ListsModule
     {
         global $globals;
 
+        if (!$globals->asso('mail_domain')) {
+            return PL_NOT_FOUND;
+        }
         new_groupadmin_page('xnet/groupe/alias-create.tpl');
 
         if (!Post::has('submit')) {