#545: Should be better with this
[platal.git] / modules / xnetgrp.php
index 8e70782..ee3aaa7 100644 (file)
@@ -55,7 +55,7 @@ function get_infos($email)
                          CONCAT(b.alias, '@m4x.org') AS email,
                          CONCAT(b.alias, '@polytechnique.org') AS email2,
                          m.perms='admin' AS perms, m.origine,
-                         FIND_IN_SET(flags, 'femme') AS sexe
+                         FIND_IN_SET(u.flags, 'femme') AS sexe
                    FROM  auth_user_md5   AS u
              INNER JOIN  aliases         AS a ON ( u.user_id = a.id AND a.type != 'homonyme' )
              INNER JOIN  aliases         AS b ON ( u.user_id = b.id AND b.type = 'a_vie' )
@@ -730,6 +730,7 @@ class XnetGrpModule extends PLModule
 
     function handler_admin_member_new_ajax(&$page)
     {
+        header('Content-Type: text/html; charset="iso-8859-15"');
         $page->changeTpl('xnet/groupe/membres-new-search.tpl', NO_SKIN);
         list($nom, $prenom) = str_replace(array('-', ' ', "'"), '%', array(Env::v('nom'), Env::v('prenom')));
         $where = "perms = 'pending'";
@@ -739,8 +740,10 @@ class XnetGrpModule extends PLModule
         if (!empty($prenom)) {
             $where .= " AND prenom LIKE '%$prenom%'";
         }
-        if (is_numeric(Env::v('promo'))) {
+        if (preg_match('/^[0-9]{4}$/', Env::v('promo'))) {
             $where .= " AND promo = " . Env::i('promo');
+        } elseif (Env::has('promo')) {
+            return;
         }
         $res = XDB::iterator("SELECT user_id, nom, prenom, promo
                                 FROM auth_user_md5