Merge commit 'origin/platal-0.10.0'
[platal.git] / include / user.func.inc.php
index ee2cb39..1cbd1f9 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -103,8 +103,10 @@ function get_not_registered_user($login, $iterator = false)
         return null;
     }
     @list($prenom, $nom, $promo) = explode('.', $login);
-    $where = 'REPLACE(REPLACE(REPLACE(nom, " ", ""), "-", ""), "\'", "") LIKE CONCAT("%", {?}, "%")
-          AND  REPLACE(REPLACE(REPLACE(prenom, " ", ""), "-", ""), "\'", "") LIKE CONCAT("%", {?}, "%")';
+    $where = 'REPLACE(REPLACE(REPLACE(nom, " ", ""), "-", ""), "\'", "")
+              LIKE CONCAT("%", REPLACE(REPLACE(REPLACE({?}, " ", ""), "-", ""), "\'", ""), "%")
+              AND  REPLACE(REPLACE(REPLACE(prenom, " ", ""), "-", ""), "\'", "")
+              LIKE CONCAT("%", REPLACE(REPLACE(REPLACE({?}, " ", ""), "-", ""), "\'", ""), "%")';
     if ($promo) {
         if (preg_match('/^[0-9]{2}$/', $promo)) {
             $where .= 'AND MOD(promo, 100) = {?}';
@@ -536,8 +538,10 @@ function set_user_details_addresses($uid, $adrs) {
         $adrid = 0;
     }
     foreach ($adrs as $adr) {
-        add_user_address($uid, $adrid, $adr);
-        ++$adrid;
+        if (!@$adr['remove']) {
+            add_user_address($uid, $adrid, $adr);
+            ++$adrid;
+        }
     }
     require_once 'geoloc.inc.php';
     localize_addresses($uid);
@@ -555,8 +559,10 @@ function set_user_details_pro($uid, $pros)
         $entrid = 0;
     }
     foreach ($pros as $pro) {
-        add_user_pro($uid, $entrid, $pro);
-        ++$entrid;
+        if (!@$pro['remove']) {
+            add_user_pro($uid, $entrid, $pro);
+            ++$entrid;
+        }
     }
 }