<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
function user_cmp($prenom, $nom, $_prenom, $_nom)
{
- $_nom = strtoupper(replace_accent($_nom));
- $_prenom = strtoupper(replace_accent($_prenom));
- $nom = strtoupper(replace_accent($nom));
- $prenom = strtoupper(replace_accent($prenom));
+ $_nom = mb_strtoupper($_nom);
+ $_prenom = mb_strtoupper($_prenom);
+ $nom = mb_strtoupper($nom);
+ $prenom = mb_strtoupper($prenom);
- $is_ok = strtoupper($_prenom) == strtoupper($prenom);
+ $is_ok = mb_strtoupper($_prenom) == mb_strtoupper($prenom);
$tokens = preg_split("/[ \-']/", $nom, -1, PREG_SPLIT_NO_EMPTY);
$maxlen = 0;
$res = XDB::iterRow(
'SELECT user_id, nom, prenom, matricule, alias, FIND_IN_SET(\'watch\', u.flags), naissance_ini
FROM auth_user_md5 AS u
- INNER JOIN aliases AS a ON (u.user_id = a.id and FIND_IN_SET("bestalias", a.flags))
+ INNER JOIN aliases AS a ON (u.user_id = a.uid and FIND_IN_SET("bestalias", a.flags))
WHERE promo={?} AND deces=0 AND perms IN ("user","admin")', $promo);
while (list($_uid, $_nom, $_prenom, $_mat, $alias, $watch, $naiss) = $res->next()) {
if (user_cmp($prenom, $nom, $_prenom, $_nom)) {
$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);
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);
$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();
{
global $globals;
extract($sub_state);
- require_once('secure_hash.inc.php');
$hash = rand_url_id(12);
XDB::execute(
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, $password, $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);