Update core
[platal.git] / modules / register / register.inc.php
index bf186a1..c32d35a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -21,7 +21,7 @@
 
 // {{{ function checkId
 
-function checkId(&$subState)
+function checkId($subState)
 {
     $subState->set('xorgid', Profile::getXorgId($subState->i('schoolid')));
     if (!$subState->v('xorgid')) {
@@ -57,7 +57,7 @@ function checkId(&$subState)
 // }}}
 // {{{ function checkOldId
 
-function checkOldId(&$subState)
+function checkOldId($subState)
 {
     $uf = new UserFilter(new PFC_And(
             new PFC_Not(new UFC_Dead()),
@@ -98,7 +98,7 @@ function checkOldId(&$subState)
 // }}}
 // {{{ function checkNewUser
 
-function checkNewUser(&$subState)
+function checkNewUser($subState)
 {
     $firstname = preg_replace("/[ \t]+/", ' ', $subState->t('firstname'));
     $firstname = preg_replace("/--+/", '-', $firstname);
@@ -125,7 +125,7 @@ function checkNewUser(&$subState)
 // }}}
 // {{{ function createAliases
 
-function createAliases(&$subState)
+function createAliases($subState)
 {
     global $globals;
 
@@ -198,9 +198,12 @@ function finishRegistration($subState)
     global $globals;
 
     $hash = rand_url_id(12);
-    XDB::execute('INSERT IGNORE INTO  register_pending (uid, forlife, bestalias, mailorg2, password,
-                                                        email, date, relance, naissance, hash, services)
-                              VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?}, {?})',
+    XDB::execute('INSERT INTO  register_pending (uid, forlife, bestalias, mailorg2, password,
+                                                 email, date, relance, naissance, hash, services)
+                              VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?}, {?})
+                              ON DUPLICATE KEY UPDATE password=VALUES(password), email=VALUES(email),
+                                                      date=VALUES(date), naissance=VALUES(naissance),
+                                                      hash=VALUES(hash), services=VALUES(services)',
                  $subState->i('uid'), $subState->s('forlife'), $subState->s('bestalias'),
                  $subState->s('emailXorg2'), $subState->s('password'), $subState->s('email'),
                  $subState->s('birthdate'), $hash, implode(',', $subState->v('services')));