X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fregister%2Fregister.inc.php;h=f7a5c4ea7c3b47a5a259a20c25a5ed09499052c9;hb=1f58ccb1e75eca08fbd04971d617ea372bc77b5a;hp=585200a2e1ab67521a3e589ddc05d140b8e853db;hpb=0c50ac76147e7c3bffa90501559bdef63bb689e3;p=platal.git
diff --git a/modules/register/register.inc.php b/modules/register/register.inc.php
index 585200a..f7a5c4e 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)) {
+ $nom = $_nom;
+ $prenom = $_prenom;
$ourid = $_uid;
$ourmat = $_mat;
return true;
@@ -151,25 +153,24 @@ function create_aliases (&$sub)
global $globals;
extract ($sub);
- require_once "xorg.misc.inc.php";
- $mailorg = make_username($prenom, $nom);
+ $mailorg = make_username($prenom, $nom);
$mailorg2 = $mailorg.sprintf(".%02u", ($promo%100));
- $forlife = make_forlife($prenom, $nom, $promo);
- $res = XDB::query('SELECT COUNT(*) FROM aliases WHERE alias={?}', $forlife);
- if ($res->fetchOneCell() > 0) {
- return "Tu as un homonyme dans ta promo, il faut traiter ce cas manuellement.
".
- "envoie un mail à mail->domain}\">" .
- "support@{$globals->mail->domain} en expliquant ta situation.";
+ $res = XDB::query("SELECT hruid FROM auth_user_md5 WHERE user_id = {?} AND hruid != ''", $uid);
+ if ($res->numRows() == 0) {
+ return "Tu n'as pas d'adresse à vie pré-attribuée.
"
+ . "Envoie un mail à mail->domain}\">"
+ . "support@{$globals->mail->domain} en expliquant ta situation.";
+ } else {
+ // TODO: at the moment forlife == hruid, however we'll have to change
+ // that behaviour when masters will be on plat/al.
+ $forlife = $res->fetchOneCell();
}
- $res = XDB::query('SELECT id, type, expire FROM aliases WHERE alias={?}', $mailorg);
-
- if ( $res->numRows() ) {
-
+ $res = XDB::query('SELECT id, 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) ) {
+ 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);
@@ -185,7 +186,7 @@ function create_aliases (&$sub)
"Bonjour,\n\n".
"Un homonyme vient de s'inscrire. La politique de Polytechnique.org est de fournir des\n".
- "adresses mail devinables, nous ne pouvons donc pas conserver ton alias '$mailorg' qui\n".
+ "adresses email devinables, nous ne pouvons donc pas conserver ton alias '$mailorg' qui\n".
"correspond maintenant à deux personnes.\n\n".
"Tu gardes tout de même l'usage de cet alias pour un mois encore à compter de ce jour.\n\n".