X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fregister%2Fregister.inc.php;h=585200a2e1ab67521a3e589ddc05d140b8e853db;hb=0c50ac76147e7c3bffa90501559bdef63bb689e3;hp=3b475f4d960ade80285adcfc48293a6dd0cd872d;hpb=a11b5424c205a5d5d0ffe010270eb2e61c7ef406;p=platal.git
diff --git a/modules/register/register.inc.php b/modules/register/register.inc.php
index 3b475f4..585200a 100644
--- a/modules/register/register.inc.php
+++ b/modules/register/register.inc.php
@@ -1,6 +1,6 @@
fetchOneRow();
+ list ($uid, $_promo, $_already, $_nom, $_prenom, $watch, $naiss) = $res->fetchOneRow();
if ($_already) { return "tu es déjà inscrit ou ton matricule est incorrect !"; }
if ($_promo != $promo) { return "erreur de matricule"; }
@@ -80,13 +80,13 @@ function check_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid, &$watch)
// }}}
// {{{ function check_old_mat
-function check_old_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid, &$watch)
+function check_old_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid, &$watch, &$naiss)
{
$res = XDB::iterRow(
- 'SELECT user_id, nom, prenom, matricule, FIND_IN_SET(\'watch\', flags)
+ 'SELECT user_id, nom, prenom, matricule, FIND_IN_SET(\'watch\', flags), naissance_ini
FROM auth_user_md5
WHERE promo={?} AND deces=0 AND perms="pending"', $promo);
- while (list($_uid, $_nom, $_prenom, $_mat, $watch) = $res->next()) {
+ while (list($_uid, $_nom, $_prenom, $_mat, $watch, $naiss) = $res->next()) {
if (user_cmp($prenom, $nom, $_prenom, $_nom)) {
$ourid = $_uid;
$ourmat = $_mat;
@@ -95,11 +95,11 @@ function check_old_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid, &$watch)
}
$res = XDB::iterRow(
- 'SELECT user_id, nom, prenom, matricule, alias, FIND_IN_SET(\'watch\', u.flags)
+ '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))
WHERE promo={?} AND deces=0 AND perms IN ("user","admin")', $promo);
- while (list($_uid, $_nom, $_prenom, $_mat, $alias, $watch) = $res->next()) {
+ while (list($_uid, $_nom, $_prenom, $_mat, $alias, $watch, $naiss) = $res->next()) {
if (user_cmp($prenom, $nom, $_prenom, $_nom)) {
$ourid = $_uid;
$ourmat = $_mat;
@@ -127,9 +127,9 @@ function check_new_user(&$sub)
$nom = strtoupper(replace_accent($nom));
if ($promo >= 1996) {
- $res = check_mat($promo, $mat, $nom, $prenom, $ourmat, $ourid, $watch);
+ $res = check_mat($promo, $mat, $nom, $prenom, $ourmat, $ourid, $watch, $naiss);
} else {
- $res = check_old_mat($promo, $mat, $nom, $prenom, $ourmat, $ourid, $watch);
+ $res = check_old_mat($promo, $mat, $nom, $prenom, $ourmat, $ourid, $watch, $naiss);
}
if ($res !== true) { return $res; }
@@ -138,6 +138,7 @@ function check_new_user(&$sub)
$sub['ourmat'] = $ourmat;
$sub['uid'] = $ourid;
$sub['watch'] = $watch;
+ $sub['naissance_ini'] = $naiss;
return true;
}
@@ -147,6 +148,7 @@ function check_new_user(&$sub)
function create_aliases (&$sub)
{
+ global $globals;
extract ($sub);
require_once "xorg.misc.inc.php";
@@ -157,9 +159,10 @@ function create_aliases (&$sub)
$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 à support@polytechnique.org en expliquant ta situation.";
+ "envoie un mail à mail->domain}\">" .
+ "support@{$globals->mail->domain} en expliquant ta situation.";
}
-
+
$res = XDB::query('SELECT id, type, expire FROM aliases WHERE alias={?}', $mailorg);
if ( $res->numRows() ) {
@@ -174,31 +177,31 @@ function create_aliases (&$sub)
$als = $res->fetchColumn();
$mailer = new PlMailer();
- $mailer->setFrom('"Support Polytechnique.org" ');
- $mailer->addTo("$mailorg@polytechnique.org");
+ $mailer->setFrom('"Support Polytechnique.org" mail->domain . '>');
+ $mailer->addTo("$mailorg@" . $globals->mail->domain);
$mailer->setSubject("perte de ton alias $mailorg dans un mois !");
- $mailer->addCc('"Support Polytechnique.org" ');
+ $mailer->addCc('"Support Polytechnique.org" mail->domain . '>');
$msg =
"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".
"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".
-
+
"Lorsque cet alias sera désactivé, l'adresse $mailorg@polytechnique.org renverra vers un \n".
"robot qui indiquera qu'il y a plusieurs personnes portant le même nom ;\n".
"cela évite que l'un des homonymes reçoive des courriels destinés à l'autre.\n\n".
-
+
"Pour te connecter au site, tu pourras utiliser comme identifiant n'importe lequel de tes\n".
"autres alias :\n".
" ".join(', ', $als)."\n";
"Commence dès aujourd'hui à communiquer à tes correspondants la nouvelle adresse que tu comptes utiliser !\n\n".
-
+
"En nous excusant pour le désagrément occasionné,\n".
"Cordialement,\n\n".
-
+
"-- \n".
"L'équipe de Polytechnique.org\n".
"\"Le portail des élèves & anciens élèves de l'X\"";
@@ -228,9 +231,9 @@ function finish_ins($sub_state)
require_once('secure_hash.inc.php');
$pass = rand_pass();
- $pass_encrypted = hash_encrypt($pass_clair);
+ $pass_encrypted = hash_encrypt($pass);
$hash = rand_url_id(12);
-
+
XDB::execute('UPDATE auth_user_md5 SET last_known_email={?} WHERE matricule = {?}', $email, $mat);
XDB::execute(
@@ -244,7 +247,7 @@ function finish_ins($sub_state)
$mymail->assign('pass', $pass);
$mymail->assign('baseurl', $globals->baseurl);
$mymail->assign('hash', $hash);
- $mymail->assign('subj', $bestalias."@polytechnique.org");
+ $mymail->assign('subj', $bestalias."@" . $globals->mail->domain);
$mymail->send();
}