X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fregister%2Fregister.inc.php;h=971d35f121cf859315a1eda4779bf028bd5ab251;hb=fe13bc1d7ba9f72d452ec07baf8538a74b7c67b8;hp=f7a5c4ea7c3b47a5a259a20c25a5ed09499052c9;hpb=c3c43c0ebe734e2b43b5d5fdb6010d08358bc34b;p=platal.git diff --git a/modules/register/register.inc.php b/modules/register/register.inc.php index f7a5c4e..971d35f 100644 --- a/modules/register/register.inc.php +++ b/modules/register/register.inc.php @@ -1,6 +1,6 @@ next()) { if (user_cmp($prenom, $nom, $_prenom, $_nom)) { @@ -126,7 +126,7 @@ function check_new_user(&$sub) $nom = preg_replace("/[ \t]+/", ' ', trim($nom)); $nom = preg_replace("/--+/", '-', $nom); $nom = preg_replace("/''+/", '\'', $nom); - $nom = strtoupper(replace_accent($nom)); + $nom = mb_strtoupper($nom); if ($promo >= 1996) { $res = check_mat($promo, $mat, $nom, $prenom, $ourmat, $ourid, $watch, $naiss); @@ -153,7 +153,7 @@ function create_aliases (&$sub) global $globals; extract ($sub); - $mailorg = make_username($prenom, $nom); + $mailorg = makeUsername($prenom, $nom); $mailorg2 = $mailorg.sprintf(".%02u", ($promo%100)); $res = XDB::query("SELECT hruid FROM auth_user_md5 WHERE user_id = {?} AND hruid != ''", $uid); @@ -167,14 +167,14 @@ function create_aliases (&$sub) $forlife = $res->fetchOneCell(); } - $res = XDB::query('SELECT id, type, expire FROM aliases WHERE alias={?}', $mailorg); + $res = XDB::query('SELECT uid, type, expire FROM aliases WHERE alias={?}', $mailorg); if ($res->numRows()) { list($h_id, $h_type, $expire) = $res->fetchOneRow(); if ($h_type != 'homonyme' and empty($expire)) { XDB::execute('UPDATE aliases SET expire=ADDDATE(NOW(),INTERVAL 1 MONTH) WHERE alias={?}', $mailorg); - XDB::execute('REPLACE INTO homonymes (homonyme_id,user_id) VALUES ({?},{?})', $h_id, $h_id); - XDB::execute('REPLACE INTO homonymes (homonyme_id,user_id) VALUES ({?},{?})', $h_id, $uid); - $res = XDB::query("SELECT alias FROM aliases WHERE id={?} AND expire IS NULL", $h_id); + XDB::execute('REPLACE INTO homonyms (homonyme_id,user_id) VALUES ({?},{?})', $h_id, $h_id); + XDB::execute('REPLACE INTO homonyms (homonyme_id,user_id) VALUES ({?},{?})', $h_id, $uid); + $res = XDB::query("SELECT alias FROM aliases WHERE uid={?} AND expire IS NULL", $h_id); $als = $res->fetchColumn(); $mailer = new PlMailer(); @@ -229,23 +229,20 @@ function finish_ins($sub_state) { global $globals; extract($sub_state); - require_once('secure_hash.inc.php'); - - $pass = rand_pass(); - $pass_encrypted = hash_encrypt($pass); - $hash = rand_url_id(12); - - XDB::execute('UPDATE auth_user_md5 SET last_known_email={?} WHERE matricule = {?}', $email, $mat); + $hash = rand_url_id(12); + XDB::execute( + "UPDATE auth_user_md5 + SET last_known_email = {?} + WHERE matricule = {?}", $email, $mat); XDB::execute( - "REPLACE INTO register_pending (uid, forlife, bestalias, mailorg2, password, email, date, relance, naissance, hash) - VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?})", - $uid, $forlife, $bestalias, $mailorg2, $pass_encrypted, $email, $naissance, $hash); + "REPLACE INTO register_pending (uid, forlife, bestalias, mailorg2, password, email, date, relance, naissance, hash, services) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?}, {?})", + $uid, $forlife, $bestalias, $mailorg2, $password, $email, $naissance, $hash, implode(',', $services)); $mymail = new PlMailer('register/inscrire.mail.tpl'); $mymail->assign('mailorg', $bestalias); $mymail->assign('lemail', $email); - $mymail->assign('pass', $pass); $mymail->assign('baseurl', $globals->baseurl); $mymail->assign('hash', $hash); $mymail->assign('subj', $bestalias."@" . $globals->mail->domain);