From 94590511073104fbf5b565cf988e76182021ef47 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 22 Feb 2010 13:47:48 +0100 Subject: [PATCH] Adapts site inscription. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/profile.php | 21 +- classes/user.php | 19 -- configs/mails.conf | 11 +- modules/admin.php | 6 +- modules/register.php | 338 ++++++++++----------- modules/register/register.inc.php | 253 +++++++-------- templates/register/breadcrumb.tpl | 2 +- .../register/{inscrire.mail.tpl => end.mail.tpl} | 2 +- templates/register/end.tpl | 2 +- templates/register/lostalias.mail.tpl | 48 +++ templates/register/marketer.mail.tpl | 39 +++ templates/register/registration.mail.tpl | 47 +++ templates/register/step1.tpl | 2 +- templates/register/step2.tpl | 14 +- templates/register/step3.tpl | 18 +- templates/register/step4.tpl | 4 +- .../{inscription.reussie.tpl => success.mail.tpl} | 2 +- 17 files changed, 468 insertions(+), 360 deletions(-) rename templates/register/{inscrire.mail.tpl => end.mail.tpl} (98%) create mode 100644 templates/register/lostalias.mail.tpl create mode 100644 templates/register/marketer.mail.tpl create mode 100644 templates/register/registration.mail.tpl rename templates/register/{inscription.reussie.tpl => success.mail.tpl} (97%) diff --git a/classes/profile.php b/classes/profile.php index 1853fa4..8087474 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -429,6 +429,25 @@ class Profile return User::getSilent($this); } + public function compareNames($firstname, $lastname) + { + $_lastname = mb_strtoupper($this->lastName()); + $_firstname = mb_strtoupper($this->firstName()); + $lastname = mb_strtoupper($lastname); + $firstname = mb_strtoupper($firstname); + + $isOk = (mb_strtoupper($_firstname) == mb_strtoupper($firstname)); + $tokens = preg_split("/[ \-']/", $lastname, -1, PREG_SPLIT_NO_EMPTY); + $maxlen = 0; + + foreach ($tokens as $str) { + $isOk &= (strpos($_lastname, $str) !== false); + $maxlen = max($maxlen, strlen($str)); + } + + return ($isOk && ($maxlen > 2 || $maxlen == strlen($_lastname))); + } + private static function fetchProfileData(array $pids, $respect_order = true) { if (count($pids) == 0) { @@ -647,7 +666,7 @@ class Profile public static function getXorgId($schoolId) { - if (!preg_match('/^[0-9]{6}$/', $xorgId)) { + if (!preg_match('/^[0-9]{6}$/', $schoolId)) { return null; } diff --git a/classes/user.php b/classes/user.php index fb5a52b..77bacbf 100644 --- a/classes/user.php +++ b/classes/user.php @@ -629,25 +629,6 @@ class User extends PlUser $uids = call_user_func_array(array('XDB', 'fetchColumn'), $args); return self::getBulkUsersWithUIDs($uids, null, null, $fetchProfile); } - - public static function compareNames($firstname, $lastname, $_firstname, $_lastname) - { - $_lastname = mb_strtoupper($_lastname); - $_firstname = mb_strtoupper($_firstname); - $lastname = mb_strtoupper($lastname); - $firstname = mb_strtoupper($firstname); - - $isOk = (mb_strtoupper($_firstname) == mb_strtoupper($firstname)); - $tokens = preg_split("/[ \-']/", $lastname, -1, PREG_SPLIT_NO_EMPTY); - $maxlen = 0; - - foreach ($tokens as $str) { - $isOk &= (strpos($_lastname, $str) !== false); - $maxlen = max($maxlen, strlen($str)); - } - - return ($isOk && ($maxlen > 2 || $maxlen == strlen($_lastname))); - } } /** Iterator over a set of Users diff --git a/configs/mails.conf b/configs/mails.conf index 29bdd72..45d993d 100644 --- a/configs/mails.conf +++ b/configs/mails.conf @@ -17,7 +17,8 @@ from=support+edu@polytechnique.org to=support@polytechnique.org [inscription] -from=support@polytechnique.org +from="Support Polytechnique.org" +cc="Support Polytechnique.org" [emails_broken] from="Polytechnique.org" @@ -39,6 +40,9 @@ to=non-geoloc@staff.polytechnique.org from="Amicale des Anciens de l'X" replyto=reponses@amicale.polytechnique.org +[marketing] +from="Marketing Polytechnique.org" + [payment_ready] from="Gestion des paiements" @@ -57,3 +61,8 @@ cc=validation+googleapps@polytechnique.org [xnet_unsubscription] from="Gestion des groupes X sur Polytechnique.net" + +[registration] +from="Webmaster Polytechnique.org" +to=registration+watch@staff.m4x.org +replyto=registration+watch@staff.m4x.org diff --git a/modules/admin.php b/modules/admin.php index b085138..3bf9b1b 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -702,14 +702,14 @@ class AdminModule extends PLModule $lines = explode("\n", Env::t('people')); $separator = Env::t('separator'); $promotion = Env::i('promotion'); - $nameTypes = DirEnum::getOptionsArray(DirEnum::NAMETYPES); + $nameTypes = DirEnum::getOptions(DirEnum::NAMETYPES); $nameTypes = array_flip($nameTypes); if (Env::t('add_type') == 'promo') { $type = 'x'; - $eduSchools = DirEnum::getOptionsArray(DirEnum::EDUSCHOOLS); + $eduSchools = DirEnum::getOptions(DirEnum::EDUSCHOOLS); $eduSchools = array_flip($eduSchools); - $eduDegrees = DirEnum::getOptionsArray(DirEnum::EDUDEGREES); + $eduDegrees = DirEnum::getOptions(DirEnum::EDUDEGREES); $eduDegrees = array_flip($eduDegrees); var_dump($eduDegrees); switch (Env::t('edu_type')) { diff --git a/modules/register.php b/modules/register.php index 8f50516..2ce6266 100644 --- a/modules/register.php +++ b/modules/register.php @@ -24,27 +24,26 @@ class RegisterModule extends PLModule function handlers() { return array( - 'register' => $this->make_hook('register', AUTH_PUBLIC), - 'register/end' => $this->make_hook('end', AUTH_PUBLIC), + 'register' => $this->make_hook('register', AUTH_PUBLIC), + 'register/end' => $this->make_hook('end', AUTH_PUBLIC), ); } function handler_register(&$page, $hash = null) { - $alert = null; - $sub_state = S::v('sub_state', array()); - if (!isset($sub_state['step'])) { - $sub_state['step'] = 0; + $alert = null; + $subState = new PlDict(S::v('subState', array())); + if (!$subState->has('step')) { + $subState->set('step', 0); } - if (!isset($sub_state['backs'])) { - $sub_state['backs'] = array(); + if (!$subState->has('backs')) { + $subState->set('backs', new PlDict()); } - if (Get::has('back') && Get::i('back') < $sub_state['step']) { - $sub_state['step'] = max(0, Get::i('back')); - $state = $sub_state; - unset($state['backs']); - $sub_state['backs'][] = $state; - if (count($sub_state['backs']) == 3) { + if (Get::has('back') && Get::i('back') < $subState->i('step')) { + $subState->set('step', max(0, Get::i('back'))); + $subState->v('back')->set($subState->v('back')->count() + 1, $subState->dict()); + $subState->v('back')->kill('back'); + if ($subState->v('backs')->count() == 3) { $alert .= "Tentative d'inscription très hésitante - "; } } @@ -52,10 +51,10 @@ class RegisterModule extends PLModule if ($hash) { require_once 'directory.enums.inc.php'; - $nameTypes = DirEnum::getOptionsArray(DirEnum::NAMETYPES); + $nameTypes = DirEnum::getOptions(DirEnum::NAMETYPES); $nameTypes = array_flip($nameTypes); - $res = XDB::query("SELECT a.uid, pd.promo, pnl.name AS lastname, pnf.name AS firstname, p.xorg_id, - p.birthdate_ref, FIND_IN_SET('watch', a.flags) + $res = XDB::query("SELECT a.uid, pd.promo, pnl.name AS lastname, pnf.name AS firstname, p.xorg_id AS xorgid, + p.birthdate_ref AS birthdateRef, FIND_IN_SET('watch', a.flags) AS watch, m.hash FROM register_marketing AS m INNER JOIN accounts AS a ON (m.uid = a.uid) INNER JOIN account_profiles AS ap ON (a.uid = ap.id AND FIND_IN_SET('owner', ap.perms)) @@ -66,61 +65,54 @@ class RegisterModule extends PLModule WHERE m.hash = {?}", $nameTypes['name_ini'], $nameTypes['firstname_ini'], $hash); - if (list($uid, $promo, $lastname, $firstname, $xorgid, $birthdate, $watch) = $res->fetchOneRow()) { - $sub_state['uid'] = $uid; - $sub_state['hash'] = $hash; - $sub_state['yearpromo'] = substr($promo, 1, 4); - $sub_state['promo'] = $promo; - $sub_state['lastname'] = $lastname; - $sub_state['firstname'] = $firstname; - $sub_state['xorgid'] = $xorgid; - $sub_state['birthdate_ref'] = $birthdate; - $sub_state['watch'] = $watch; + if ($res->numRows() == 1) { + $subState->merge($res->fetchOneRow()); + $subState->set('yearpromo', substr($subState->s('promo'), 1, 4)); XDB::execute('REPLACE INTO register_mstats (uid,sender,success) SELECT m.uid, m.sender, 0 FROM register_marketing AS m WHERE m.hash', - $sub_state['hash']); + $subState->s('hash')); } } - switch ($sub_state['step']) { + switch ($subState->i('step')) { case 0: $wp = new PlWikiPage('Reference.Charte'); $wp->buildCache(); if (Post::has('step1')) { - $sub_state['step'] = 1; - if (isset($sub_state['hash'])) { - $sub_state['step'] = 3; + $subState->set('step', 1); + if ($subState->has('hash')) { + $subState->set('step', 3); $this->load('register.inc.php'); - create_aliases($sub_state); + createAliases($subState); } } break; case 1: - if (Post::has('promo')) { - $promo = Post::t('edu_type') . Post::t('promo'); - $yearpromo = Post::i('promo'); + if (Post::has('yearpromo')) { + $promo = Post::t('edu_type') . Post::t('yearpromo'); + $yearpromo = Post::i('yearpromo'); $res = XDB::query("SELECT COUNT(*) - FROM accounts AS a - INNER JOIN account_profile AS pa ON (a.uid = pa.uid AND FIND_IN_SET('owner', ap.perms)) - INNER JOIN profile AS p ON (p.pid = pa.pid) - INNER JOIN profile_display AS pd ON (p.pid = pd.pid) + FROM accounts AS a + INNER JOIN account_profiles AS ap ON (a.uid = ap.uid AND FIND_IN_SET('owner', ap.perms)) + INNER JOIN profiles AS p ON (p.pid = ap.pid) + INNER JOIN profile_display AS pd ON (p.pid = pd.pid) WHERE a.state = 'pending' AND p.deathdate IS NULL AND pd.promo = {?}", $promo); if (!$res->fetchOneCell()) { $error = 'La promotion saisie est incorrecte ou tous les camarades de cette promotion sont inscrits !'; } else { - $sub_state['step'] = 2; - $sub_state['promo'] = $promo; - $sub_state['yearpromo'] = $yearpromo; + $subState->set('step', 2); + $subState->set('promo', $promo); + $subState->set('yearpromo', $yearpromo); if ($yearpromo >= 1996 && $yearpromo < 2000) { - $sub_state['schoolid'] = ($yearpromo % 100) * 10 . '???'; + $subState->set('schoolid', ($yearpromo % 100) * 10 . '???'); } elseif($yearpromo >= 2000) { - $sub_state['schoolid'] = 100 + ($yearpromo % 100) . '???'; + $subState->set('schoolid', 100 + ($yearpromo % 100) . '???'); } } } @@ -129,18 +121,18 @@ class RegisterModule extends PLModule case 2: if (count($_POST)) { $this->load('register.inc.php'); - $sub_state['firstname'] = Post::v('firstname'); - $sub_state['lastname'] = Post::v('lastname'); - $sub_state['schoolid'] = Post::v('schoolid'); - $error = check_new_user($sub_state); + $subState->set('firstname', Post::t('firstname')); + $subState->set('lastname', Post::t('lastname')); + $subState->set('schoolid', Post::i('schoolid')); + $error = checkNewUser($subState); if ($error !== true) { break; } - $error = create_aliases($sub_state); + $error = createAliases($subState); if ($error === true) { unset($error); - $sub_state['step'] = 3; + $subState->set('step', 3); } } break; @@ -155,12 +147,12 @@ class RegisterModule extends PLModule if (!isvalid_email(Post::v('email'))) { $error[] = "Le champ 'Email' n'est pas valide."; } elseif (!isvalid_email_redirection(Post::v('email'))) { - $error[] = $sub_state['forlife'] . ' doit renvoyer vers un email existant ' + $error[] = $subState->s('forlife') . ' doit renvoyer vers un email existant ' . 'valide, en particulier, il ne peut pas être renvoyé vers lui-même.'; } // Validate the birthday format and range. - $birth = trim(Env::v('birthdate')); + $birth = Post::t('birthdate'); if (!preg_match('@^[0-3]?\d/[01]?\d/(19|20)?\d{2}$@', $birth)) { $error[] = "La 'Date de naissance' n'est pas correcte."; } else { @@ -171,11 +163,11 @@ class RegisterModule extends PLModule $birth[2] += 1900; } $year = $birth[2]; - $promo = (int) $sub_state['promo']; + $promo = $subState->i('yearpromo'); if ($year > $promo - 15 || $year < $promo - 30) { $error[] = "La 'Date de naissance' n'est pas correcte."; $alert = "Date de naissance incorrecte à l'inscription - "; - $sub_state['wrong_naissance'] = $birth; + $subState->set('wrong_birthdate', $birth); } } @@ -186,7 +178,7 @@ class RegisterModule extends PLModule $services[] = $service; } } - $sub_state['services'] = $services; + $subState->set('services', $services); // Validate the password. if (!Post::v('response2', false)) { @@ -194,70 +186,70 @@ class RegisterModule extends PLModule } // Check if the given email is known as dangerous. - $res = XDB::query("SELECT w.state, w.description - FROM email_watch AS w - WHERE w.email = {?} AND w.state != 'safe'", + $res = XDB::query("SELECT state, description + FROM email_watch + WHERE email = {?} AND state != 'safe'", Post::v('email')); - $email_banned = false; + $bannedEmail = false; if ($res->numRows()) { list($state, $description) = $res->fetchOneRow(); $alert .= "Email surveillé proposé à l'inscription - "; - $sub_state['email_desc'] = $description; + $subState->set('email_desc', $description); if ($state == 'dangerous') { - $email_banned = true; + $bannedEmail = true; } } - if ($sub_state['watch']) { + if ($subState->has('watch')) { $alert .= "Inscription d'un utilisateur surveillé - "; } - if (($ip_banned = check_ip('unsafe'))) { + if (($bannedIp = check_ip('unsafe'))) { unset($error); } if (isset($error)) { $error = join('
', $error); } else { - $sub_state['birthdate'] = sprintf("%04d-%02d-%02d", - intval($birth[2]), intval($birth[1]), intval($birth[0])); - $sub_state['email'] = Post::v('email'); - $sub_state['password'] = Post::v('response2'); + $subState->set('birthdate', sprintf("%04d-%02d-%02d", + intval($birth[2]), intval($birth[1]), intval($birth[0]))); + $subState->set('email', Post::t('email')); + $subState->set('password', Post::t('response2')); // Update the current alert if the birthdate is incorrect, // or if the IP address of the user has been banned. - if ($sub_state['birthdate_ref'] != '0000-00-00' - && $sub_state['birthdate_ref'] != $sub_state['birthdate']) { + if ($subState->s('birthdateRef') != '0000-00-00' + && $subState->s('birthdateRef') != $subState->s('birthdate')) { $alert .= "Date de naissance incorrecte à l'inscription - "; } - if ($ip_banned) { + if ($bannedIp) { $alert .= "Tentative d'inscription depuis une IP surveillée"; } // Prevent banned user from actually registering; save the current state for others. - if ($email_banned || $ip_banned) { + if ($bannedEmail || $bannedIp) { global $globals; $error = "Une erreur s'est produite lors de l'inscription." . " Merci de contacter = 3) { + $subState->set('step', 4); + if ($subState->count('backs') >= 3) { $alert .= "Fin d'une inscription hésitante."; } - finish_ins($sub_state); + finishRegistration($subState); } } } break; } - $_SESSION['sub_state'] = $sub_state; + $_SESSION['subState'] = $subState->dict(); if (!empty($alert)) { send_warning_mail($alert); } - $page->changeTpl('register/step'.intval($sub_state['step']).'.tpl'); + $page->changeTpl('register/step' . $subState->i('step') . '.tpl'); $page->addJsLink('motdepasse.js'); if (isset($error)) { $page->trigError($error); @@ -267,7 +259,7 @@ class RegisterModule extends PLModule function handler_end(&$page, $hash = null) { global $globals; - $_SESSION['sub_state'] = array('step' => 5); + $_SESSION['subState'] = array('step' => 5); // Reject registration requests from unsafe IP addresses (and remove the // registration information from the database, to prevent IP changes). @@ -278,18 +270,25 @@ class RegisterModule extends PLModule return PL_FORBIDDEN; } - // /* TODO */ + require_once 'directory.enums.inc.php'; + $nameTypes = DirEnum::getOptions(DirEnum::NAMETYPES); + $nameTypes = array_flip($nameTypes); + // Retrieve the pre-registration information using the url-provided // authentication token. - if ($hash) { - $res = XDB::query( - "SELECT r.uid, r.forlife, r.bestalias, r.mailorg2, - r.password, r.email, r.services, r.naissance, u.nom, u.prenom, - u.promo, FIND_IN_SET('femme', u.flags), u.naissance_ini - FROM register_pending AS r - INNER JOIN auth_user_md5 AS u ON r.uid = u.user_id - WHERE hash = {?} AND hash != 'INSCRIT'", $hash); - } + $res = XDB::query("SELECT r.uid, p.pid, r.forlife, r.bestalias, r.mailorg2, + r.password, r.email, r.services, r.naissance, + pnl.name AS lastname, pnf.name AS firstname, + pd.promo, p.sex, p.birthdate_ref + FROM register_pending AS r + INNER JOIN accounts AS a ON (r.uid = a.uid) + INNER JOIN account_profiles AS ap ON (a.uid = ap.uid AND FIND_IN_SET('owner', ap.perms)) + INNER JOIN profiles AS p ON (p.pid = ap.uid) + INNER JOIN profile_name AS pnl ON (p.pid = pnl.pid AND pnl.typeid = {?}) + INNER JOIN profile_name AS pnf ON (p.pid = pnf.pid AND pnf.typeid = {?}) + INNER JOIN profile_display AS pd ON (p.pid = pd.pid) + WHERE hash = {?} AND hash != 'INSCRIT'", + $nameTypes['name_ini'], $nameTypes['firstname_ini'], $hash); if (!$hash || $res->numRows() == 0) { $page->kill("

Cette adresse n'existe pas, ou plus, sur le serveur.

Causes probables :

@@ -299,28 +298,27 @@ class RegisterModule extends PLModule
  • Tu as peut-être mal copié l'adresse reçue par email, vérifie-la à la main.
  • Tu as peut-être attendu trop longtemps pour - confirmer. Les pré-inscriptions sont annulées + confirmer. Les pré-inscriptions sont annulées tous les 30 jours.
  • Tu es en fait déjà inscrit.
  • "); } - list($uid, $forlife, $bestalias, $mailorg2, $password, $email, $services, - $naissance, $nom, $prenom, $promo, $femme, $naiss_ini) = $res->fetchOneRow(); + list($uid, $pid, $forlife, $bestalias, $emailXorg2, $password, $email, $services, + $birthdate, $lastname, $firstname, $promo, $sex, $birthdate_ref) = $res->fetchOneRow(); + $yearpromo = substr($promo, 1, 4); // Prepare the template for display. $page->changeTpl('register/end.tpl'); $page->addJsLink('do_challenge_response_logged.js'); $page->assign('forlife', $forlife); - $page->assign('prenom', $prenom); - $page->assign('femme', $femme); + $page->assign('firstname', $firstname); // Check if the user did enter a valid password; if not (or if none is found), // get her an information page. - if (Env::has('response')) { - require_once 'secure_hash.inc.php'; - $expected_response = hash_encrypt("$forlife:$password:" . S::v('challenge')); - if (Env::v('response') != $expected_response) { + if (Post::has('response')) { + $expected_response = sha1("$forlife:$password:" . S::v('challenge')); + if (Post::v('response') != $expected_response) { $page->trigError("Mot de passe invalide."); S::logger($uid)->log('auth_fail', 'bad password (register/end)'); return; @@ -332,56 +330,57 @@ class RegisterModule extends PLModule // // Create the user account. // - XDB::execute("UPDATE auth_user_md5 - SET password = {?}, perms = 'user', - date = NOW(), naissance = {?}, date_ins = NOW() - WHERE user_id = {?}", $password, $naissance, $uid); - XDB::execute("REPLACE INTO auth_user_quick (user_id) VALUES ({?})", $uid); + XDB::execute("UPDATE accounts + SET password = {?}, state = 'active', + registration_date = NOW() + WHERE uid = {?}", $password, $uid); + XDB::execute("UPDATE profiles + SET birthdate = {?}, last_change = NOW() + WHERE pid = {?}", $birthdate, $pid); XDB::execute("INSERT INTO aliases (uid, alias, type) VALUES ({?}, {?}, 'a_vie')", $uid, $forlife); XDB::execute("INSERT INTO aliases (uid, alias, type, flags) VALUES ({?}, {?}, 'alias', 'bestalias')", $uid, $bestalias); - if ($mailorg2) { + if ($emailXorg2) { XDB::execute("INSERT INTO aliases (uid, alias, type) - VALUES ({?}, {?}, 'alias')", $uid, $mailorg2); + VALUES ({?}, {?}, 'alias')", $uid, $emailXorg2); } // Add the registration email address as first and only redirection. require_once 'emails.inc.php'; - $user = User::getSilent($uid); + $user = User::getSilentWithUID($uid); $redirect = new Redirect($user); $redirect->add_email($email); // Try to start a session (so the user don't have to log in); we will use // the password available in Post:: to authenticate the user. - Platal::session()->start(AUTH_MDP); + $success = Platal::session()->start(AUTH_MDP); // Subscribe the user to the services she did request at registration time. foreach (explode(',', $services) as $service) { switch ($service) { case 'ax_letter': Platal::load('axletter', 'axletter.inc.php'); - AXLetter::subscribe(S::user()->id()); + AXLetter::subscribe($uid); break; case 'imap': - $user = S::user(); $storage = new EmailStorage($user, 'imap'); $storage->activate(); break; case 'ml_promo': - $r = XDB::query('SELECT id FROM groups WHERE diminutif = {?}', S::user()->promo()); + $r = XDB::query('SELECT id FROM groups WHERE diminutif = {?}', $yearpromo); if ($r->numRows()) { $asso_id = $r->fetchOneCell(); XDB::execute('REPLACE INTO group_members (uid, asso_id) VALUES ({?}, {?})', - S::user()->id(), $asso_id); - $mmlist = new MMList(S::user()->id(), S::v('password')); + $uid, $asso_id); + $mmlist = new MMList($uid, S::v('password')); $mmlist->subscribe("promo" . S::v('promo')); } break; case 'nl': require_once 'newsletter.inc.php'; - NewsLetter::subscribe(); + NewsLetter::subscribe($uid); break; } } @@ -393,36 +392,42 @@ class RegisterModule extends PLModule WHERE uid = {?}", $uid); // Congratulate our newly registered user by email. - $mymail = new PlMailer('register/inscription.reussie.tpl'); + $mymail = new PlMailer('register/success.mail.tpl'); $mymail->assign('forlife', $forlife); - $mymail->assign('prenom', $prenom); + $mymail->assign('firstname', $firstname); $mymail->send(); // Index the user, to allow her to appear in searches. Profile::rebuildSearchTokens($uid); // Notify other users which were watching for her arrival. - require_once 'notifs.inc.php'; - register_watch_op($uid, WATCH_INSCR); - inscription_notifs_base($uid); + XDB::execute('REPLACE INTO contacts (uid, contact) + SELECT uid, ni_id + FROM watch_nonins + WHERE ni_id = {?}', $uid); + XDB::execute('DELETE FROM watch_nonins + WHERE ni_id = {?}', $uid); + Platal::session()->updateNbNotifs(); // Forcibly register the new user on default forums. - $promo_forum = 'xorg.promo.x' . $promo; - $registered_forums = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements', $promo_forum); - foreach ($registered_forums as $forum) { - XDB::execute("INSERT INTO #forums#.abos (fid,uid) + $promoForum = 'xorg.promo.' . strtolower($promo); + $registeredForums = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements', $promoForum); + foreach ($registeredForums as $forum) { + XDB::execute("INSERT INTO forum_subs (fid, uid) SELECT fid, {?} - FROM #forums#.list - WHERE nom = {?}", - $uid, $val); + FROM forums + WHERE name = {?}", + $uid, $val); // Notify the newsgroup admin of the promotion forum needs be created. - if (XDB::affectedRows() == 0 && $forum == $promo_forum) { - $res = XDB::query("SELECT SUM(perms IN ('admin','user') AND deces = 0), COUNT(*) - FROM auth_user_md5 - WHERE promo = {?}", $promo); - list($promo_registered_count, $promo_count) = $res->fetchOneRow(); - if ($promo_registered_count > 0.2 * $promo_count) { + if (XDB::affectedRows() == 0 && $forum == $promoForum) { + $promoFull = new UserFilter(new UFC_Promo('=', UserFilter::DISPLAY, $promo)); + $promoRegistered = new UserFilter(new PFC_And( + new UFC_Promo('=', UserFilter::DISPLAY, $promo), + new UFC_Registered(true), + new PFC_Not(new UFC_Dead()) + )); + if ($promoRegistered->getTotalCount() > 0.2 * $promoFull->getTotalCount()) { $mymail = new PlMailer('admin/forums-promo.mail.tpl'); $mymail->assign('promo', $promo); $mymail->send(); @@ -438,63 +443,44 @@ class RegisterModule extends PLModule // // Email the referrer(s) of this new user. - $res = XDB::iterRow( - "SELECT sa.alias, IF(s.nom_usage,s.nom_usage,s.nom) AS nom, - s.prenom, FIND_IN_SET('femme', s.flags) AS femme, - GROUP_CONCAT(m.email SEPARATOR ', ') AS mails, MAX(m.last) AS dateDernier - FROM register_marketing AS m - INNER JOIN auth_user_md5 AS s ON (m.sender = s.user_id) - INNER JOIN aliases AS sa ON (sa.uid = m.sender - AND FIND_IN_SET('bestalias', sa.flags)) - WHERE m.uid = {?} - GROUP BY m.sender - ORDER BY dateDernier DESC", $uid); + $res = XDB::iterRow("SELECT sender, GROUP_CONCAT(email SEPARATOR ', ') AS mails, MAX(last) AS lastDate + FROM register_marketing + WHERE uid = {?} + GROUP BY sender + ORDER BY lastDate DESC", $uid); XDB::execute("UPDATE register_mstats SET success = NOW() WHERE uid = {?}", $uid); - $market = array(); - while (list($salias, $snom, $sprenom, $sfemme, $mails, $dateDernier) = $res->next()) { - $market[] = " - par $snom $sprenom sur $mails (le plus récemment le $dateDernier)"; - $mymail = new PlMailer(); - $mymail->setSubject("$prenom $nom s'est inscrit à Polytechnique.org !"); - $mymail->setFrom('"Marketing Polytechnique.org" mail->domain . '>'); - $mymail->addTo("\"$sprenom $snom\" <$salias@{$globals->mail->domain}>"); - $msg = ($sfemme?'Chère':'Cher')." $sprenom,\n\n" - . "Nous t'écrivons pour t'informer que $prenom $nom (X$promo), " - . "que tu avais incité".($femme?'e':'')." à s'inscrire à Polytechnique.org, " - . "vient à l'instant de terminer son inscription.\n\n" - . "Merci de ta participation active à la reconnaissance de ce site !!!\n\n" - . "Bien cordialement,\n" - . "-- \n" - . "L'équipe Polytechnique.org"; + while (list($senderid, $maketingEmails, $lastDate) = $res->next()) { + $sender = User::getWithUID($senderid); + $market[] = " - par $sender->fullName() sur $maketingEmails (le plus récemment le $lastDate)"; + $mymail = new PlMailer('register/marketer.mail.tpl'); + $mymail->setSubject("$firstname $lastname s'est inscrit à Polytechnique.org !"); + $mymail->addTo("\"$sender->fullName()\" <$sender->bestEmail()@{$globals->mail->domain}>"); + $mymail->assign('sender', $sender); + $mymail->assign('firstname', $firstname); + $mymail->assign('lastname', $lastname); + $mymail->assign('promo', $promo); + $mymail->assign('sex', $sex); $mymail->setTxtBody(wordwrap($msg, 72)); $mymail->send(); } // Email the plat/al administrators about the registration. if ($globals->register->notif) { - $mymail = new PlMailer(); - $mymail->setSubject("Inscription de $prenom $nom (X$promo)"); - $mymail->setFrom('"Webmaster Polytechnique.org" mail->domain . '>'); - $mymail->addTo($globals->register->notif); - $mymail->addHeader('Reply-To', $globals->register->notif); - $msg = "$prenom $nom (X$promo) a terminé son inscription avec les données suivantes :\n" - . " - nom : $nom\n" - . " - prenom : $prenom\n" - . " - promo : $promo\n" - . " - naissance : $naissance (date connue : $naiss_ini)\n" - . " - forlife : $forlife\n" - . " - email : $email\n" - . " - sexe : $femme\n" - . " - ip : " . S::logger()->ip . " (" . S::logger()->host . ")\n" - . (S::logger()->proxy_ip ? " - proxy : " . S::logger()->proxy_ip . " (" . S::logger()->proxy_host . ")\n" : "") - . "\n\n"; + $mymail = new PlMailer('register/registration.mail.tpl'); + $mymail->setSubject("Inscription de $firstname $lastname ($promo)"); + $mymail->assign('firstname', $firstname); + $mymail->assign('lastname', $lastname); + $mymail->assign('promo', $promo); + $mymail->assign('sex', $sex); + $mymail->assign('birthdate', $birthdate); + $mymail->assign('birthdate_ref', $birthdate_ref); + $mymail->assign('forlife', $forlife); + $mymail->assign('email', $email); if (count($market) > 0) { - $msg .= "Les marketings suivants avaient été effectués :\n" - . implode("\n", $market); - } else { - $msg .= "$prenom $nom n'a jamais reçu d'email de marketing."; + $mymail->assign('market', implode("\n", $market)); } $mymail->setTxtBody($msg); $mymail->send(); diff --git a/modules/register/register.inc.php b/modules/register/register.inc.php index a5abd6a..4506edd 100644 --- a/modules/register/register.inc.php +++ b/modules/register/register.inc.php @@ -19,210 +19,189 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -// {{{ function check_mat +// {{{ function checkId -function check_mat($promo, $mat, &$nom, &$prenom, &$ourmat, &$ourid, &$watch, &$naiss) +function checkId(&$subState) { - if (!preg_match('/^[0-9][0-9][0-9][0-9][0-9][0-9]$/', $mat)) { - return "Le matricule doit comporter 6 chiffres."; + $subState->set('xorgid', Profile::getXorgId($subState->i('schoolid'))); + if (!$subState->v('xorgid')) { + return 'Le matricule est incorrect.'; } - $year = intval(substr($mat, 0, 3)); - $rang = intval(substr($mat, 3, 3)); - if ($year > 200) { $year /= 10; }; - if ($year < 96) { - return "ton matricule est incorrect"; - } else { - $ourmat = sprintf('%04u%04u', 1900+$year, $rang); - } + $uf = new UserFilter(new PFC_And( + new UFC_UID($subState->i('xorg_id')), + new PFC_Not(new UFC_Dead()) + )); + $user = $uf->getProfiles(); - $res = XDB::query( - 'SELECT user_id, promo, perms IN ("admin","user"), nom, prenom, FIND_IN_SET(\'watch\', flags), naissance_ini - FROM auth_user_md5 - WHERE matricule={?} and deces = 0', $ourmat); - 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"; } + if ($user->__get('state') == 'active') { + return "Tu es déjà inscrit ou ton matricule est incorrect !"; + } + if ($user->promo() != $subState->s('promo')) { + return 'Le matricule est incorrect.'; + } - if (!user_cmp($prenom, $nom, $_prenom, $_nom)) { - return "erreur dans l'identification. Réessaie, il y a une erreur quelque part !"; + if (!$user->compareNames($subState->s('firstname'), $subState->s('lastname'))) { + return "Erreur dans l'identification. Réessaie, il y a une erreur quelque part !"; } - $nom = $_nom; - $prenom = $_prenom; - $ourid = $uid; + $subState->set('lastname', $user->lastName()); + $subState->set('firstname', $user->firstName()); + $subState->set('uid', $user->id()); + $subState->set('watch', $user->watch()); + $subState->set('birthdateRef', $user->profile->__get('birthdate_ref')); return true; } // }}} -// {{{ function check_old_mat +// {{{ function checkOldId -function check_old_mat($promo, $mat, &$nom, &$prenom, &$ourmat, &$ourid, &$watch, &$naiss) +function checkOldId(&$subState) { - $res = XDB::iterRow( - '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, $naiss) = $res->next()) { - if (user_cmp($prenom, $nom, $_prenom, $_nom)) { - $nom = $_nom; - $prenom = $_prenom; - $ourid = $_uid; - $ourmat = $_mat; + $uf = new UserFilter(new PFC_And( + new PFC_Not(new UFC_Dead()), + new UFC_Promo('=', UserFilter::DISPLAY, $subState->s('promo')), + new PFC_Not(new UFC_Registered(true)) + )); + $it = $uf->iterProfiles(); + while ($profile = $it->next()) { + if ($profile->compareNames($subState->s('firstname'), $subState->s('lastname'))) { + $subState->set('lastname', $profile->lastName()); + $subState->set('firstname', $profile->firstName()); + $subState->set('uid', $profile->owner()->id()); + $subState->set('watch', $profile->owner()->watch()); + $subState->set('birthdateRef', $profile->__get('birthdate_ref')); + $subState->set('xorgid', $profile->__get('xorg_id')); return true; } } - $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.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)) { - $ourid = $_uid; - $ourmat = $_mat; - return "Tu es vraisemblablement déjà inscrit !"; + $uf = new UserFilter(new PFC_And( + new PFC_Not(new UFC_Dead()), + new UFC_Promo('=', UserFilter::DISPLAY, $subState->s('promo')), + new UFC_Registered(true) + )); + $it = $uf->iterProfiles(); + while ($profile = $it->next()) { + if ($profile->compareNames($subState->s('firstname'), $subState->s('lastname'))) { + $subState->set('uid', $profile->owner()->id()); + $subState->set('watch', $profile->owner()->watch()); + $subState->set('birthdateRef', $profile->__get('birthdate_ref')); + $subState->set('xorgid', $profile->__get('xorg_id')); + return 'Tu es vraisemblablement déjà inscrit !'; } } - return "erreur: vérifie que tu as bien orthographié ton nom !"; + return 'Erreur : vérifie que tu as bien orthographié ton nom !'; } // }}} -// {{{ function check_new_user +// {{{ function checkNewUser -function check_new_user(&$sub) +function checkNewUser(&$subState) { - extract($sub); - - $prenom = preg_replace("/[ \t]+/", ' ', trim($prenom)); - $prenom = preg_replace("/--+/", '-', $prenom); - $prenom = preg_replace("/''+/", '\'', $prenom); - $prenom = make_firstname_case($prenom); - - $nom = preg_replace("/[ \t]+/", ' ', trim($nom)); - $nom = preg_replace("/--+/", '-', $nom); - $nom = preg_replace("/''+/", '\'', $nom); - $nom = mb_strtoupper($nom); - - if ($promo >= 1996) { - $res = check_mat($promo, $mat, $nom, $prenom, $ourmat, $ourid, $watch, $naiss); + $firstname = preg_replace("/[ \t]+/", ' ', $subState->t('firstname')); + $firstname = preg_replace("/--+/", '-', $firstname); + $firstname = preg_replace("/''+/", '\'', $firstname); + $subState->set('firstname', PlUser::fixFirstnameCase($firstname)); + + $lastname = preg_replace("/[ \t]+/", ' ', $subState->t('lastname')); + $lastname = preg_replace("/--+/", '-', $lastname); + $lastname = preg_replace("/''+/", '\'', $lastname); + $subState->set('lastname', mb_strtoupper($lastname)); + + if ($subState->i('yearpromo') >= 1996) { + $res = checkId($subState); } else { - $res = check_old_mat($promo, $mat, $nom, $prenom, $ourmat, $ourid, $watch, $naiss); + $res = checkOldId($subState); + } + if ($res !== true) { + return $res; } - if ($res !== true) { return $res; } - - $sub['nom'] = $nom; - $sub['prenom'] = $prenom; - $sub['ourmat'] = $ourmat; - $sub['uid'] = $ourid; - $sub['watch'] = $watch; - $sub['naissance_ini'] = $naiss; return true; } // }}} -// {{{ function create_aliases +// {{{ function createAliases -function create_aliases (&$sub) +function createAliases(&$subState) { global $globals; - extract ($sub); - $mailorg = makeUsername($prenom, $nom); - $mailorg2 = $mailorg.sprintf(".%02u", ($promo%100)); + $emailXorg = PlUser::makeUserName($subState->t('firstname'), $subState->t('lastname')); + $emailXorg2 = $emailXorg . sprintf(".%02u", ($subState->i('yearpromo') % 100)); - $res = XDB::query("SELECT hruid FROM auth_user_md5 WHERE user_id = {?} AND hruid != ''", $uid); + $res = XDB::query("SELECT hruid + FROM accounts + WHERE uid = {?} AND hruid != ''", $subState->i('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 uid, type, expire FROM aliases WHERE alias={?}', $mailorg); + $res = XDB::query('SELECT uid, type, expire + FROM aliases + WHERE alias = {?}', $emailXorg); 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 homonyms (homonyme_id, uid) VALUES ({?},{?})', $h_id, $h_id); - XDB::execute('REPLACE INTO homonyms (homonyme_id, uid) VALUES ({?},{?})', $h_id, $uid); - $res = XDB::query("SELECT alias FROM aliases WHERE uid={?} AND expire IS NULL", $h_id); + XDB::execute('UPDATE aliases + SET expire = ADDDATE(NOW(), INTERVAL 1 MONTH) + WHERE alias = {?}', $emailXorg); + XDB::execute('REPLACE INTO homonyms (homonyme_id, uid) + VALUES ({?}, {?})', $h_id, $h_id); + XDB::execute('REPLACE INTO homonyms (homonyme_id, uid) + 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(); - $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" mail->domain . '>'); - $msg = - "Bonjour,\n\n". - - "Un homonyme vient de s'inscrire. La politique de Polytechnique.org est de fournir des\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". - - "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\""; + $mailer = new PlMailer('register/lostalias.mail.tpl'); + $mailer->addTo($emailXorg . '@' . $globals->mail->domain); + $mailer->setSubject("Perte de ton alias $emailXorg dans un mois !"); + $mailer->assign('emailXorg', $emailXorg); + $mailer->assign('als', join(', ', $als)); $mailer->SetTxtBody(wordwrap($msg,72)); $mailer->send(); } - $sub['forlife'] = $forlife; - $sub['bestalias'] = $mailorg2; - $sub['mailorg2'] = null; + $subState->set('forlife', $forlife); + $subState->set('bestalias', $emailXorg2); + $subState->set('emailXorg2', null); } else { - $sub['forlife'] = $forlife; - $sub['bestalias'] = $mailorg; - $sub['mailorg2'] = $mailorg2; + $subState->set('forlife', $forlife); + $subState->set('bestalias', $emailXorg); + $subState->set('emailXorg2', $emailXorg2); } return true; } // }}} -// {{{ function finish_ins +// {{{ function finishRegistration -function finish_ins($sub_state) +function finishRegistration($subState) { global $globals; - extract($sub_state); $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, 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); + XDB::execute('REPLACE INTO register_pending (uid, forlife, bestalias, mailorg2, password, + email, date, relance, naissance, hash, services) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?}, {?})', + $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'))); + + $mymail = new PlMailer('register/end.mail.tpl'); + $mymail->assign('emailXorg', $subState->s('bestalias')); + $mymail->assign('lemail', $subState->s('email')); $mymail->assign('baseurl', $globals->baseurl); - $mymail->assign('hash', $hash); - $mymail->assign('subj', $bestalias."@" . $globals->mail->domain); + $mymail->assign('hash', $hash); + $mymail->assign('subj', $subState->s('bestalias') . '@' . $globals->mail->domain); $mymail->send(); } diff --git a/templates/register/breadcrumb.tpl b/templates/register/breadcrumb.tpl index 3fdd0e7..8eba2fc 100644 --- a/templates/register/breadcrumb.tpl +++ b/templates/register/breadcrumb.tpl @@ -20,7 +20,7 @@ {* *} {**************************************************************************} -{assign var="step" value=$smarty.session.sub_state.step} +{assign var="step" value=$smarty.session.subState.step}
    Procédure d'inscription : {if !$step}{/if}Charte{if !$step}{/if} Â» diff --git a/templates/register/inscrire.mail.tpl b/templates/register/end.mail.tpl similarity index 98% rename from templates/register/inscrire.mail.tpl rename to templates/register/end.mail.tpl index 4ed4adf..b736519 100644 --- a/templates/register/inscrire.mail.tpl +++ b/templates/register/end.mail.tpl @@ -32,7 +32,7 @@ Ton inscription sur Polytechnique.org est presque terminée ! Après activation, tes paramètres de connexion seront : -identifiant : {$mailorg} +identifiant : {$emailXorg} mot de passe : celui que tu as choisi Rends-toi maintenant sur la page web suivante afin d'activer ta pré-inscription : diff --git a/templates/register/end.tpl b/templates/register/end.tpl index 6535950..1824dd6 100644 --- a/templates/register/end.tpl +++ b/templates/register/end.tpl @@ -24,7 +24,7 @@

    Confirmation de ton inscription

    -

    Merci {$prenom} d'avoir choisi de t'inscrire. Pour finaliser ton inscription, +

    Merci {$firstname} d'avoir choisi de t'inscrire. Pour finaliser ton inscription, il te suffit de taper ton mot de passe ci-dessous. Tu pourras ensuite librement accéder au site, et à notre annuaire en ligne !

    diff --git a/templates/register/lostalias.mail.tpl b/templates/register/lostalias.mail.tpl new file mode 100644 index 0000000..b688901 --- /dev/null +++ b/templates/register/lostalias.mail.tpl @@ -0,0 +1,48 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2010 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + +{config_load file="mails.conf" section="inscrire"} +{if $mail_part eq 'head'} +{subject text="$subj"} +{from full=#from#} +{from full=#cc#} +{to addr="$lemail"} +{elseif $mail_part eq 'text'} +Bonjour, + +Un homonyme vient de s'inscrire. La politique de Polytechnique.org est de fournir des adresses email devinables, nous ne pouvons donc pas +conserver ton alias {$emailXorg} qui correspond maintenant à deux personnes. + +Tu gardes tout de même l'usage de cet alias pour un mois encore à compter de ce jour. + +Lorsque cet alias sera désactivé, l'adresse {$emailXorg}@polytechnique.org renverra vers un robot qui indiquera qu'il y a plusieurs personnes portant le même nom ; cela évite que l'un des homonymes reçoive des courriels destinés à l'autre. + +Pour te connecter au site, tu pourras utiliser comme identifiant n'importe lequel de tes autres alias : {$als}. +Commence dès aujourd'hui à communiquer à tes correspondants la nouvelle adresse que tu comptes utiliser ! + +En nous excusant pour le désagrément occasionné, +Cordialement, +-- +L'équipe de Polytechnique.org +Le portail des élèves & anciens élèves de l'X +{/if} +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/register/marketer.mail.tpl b/templates/register/marketer.mail.tpl new file mode 100644 index 0000000..41de1bc --- /dev/null +++ b/templates/register/marketer.mail.tpl @@ -0,0 +1,39 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2010 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + +{config_load file="mails.conf" section="marketing"} +{if $mail_part eq 'head'} +{subject text="$subj"} +{from full=#from#} +{to addr="$lemail"} +{elseif $mail_part eq 'text'} +{if $sender->isFemale()}Chère{else}Cher{/if} {$sender->firstName()}, + +Nous t'écrivons pour t'informer que {$firstname} {$lastname} ({$promo}), que tu avais incité{if $sex eq PlUser::GENDER_FEMALE}e{/if} à s'inscrire à Polytechnique.org, vient à l'instant de terminer son inscription. + +Merci de ta participation active à la reconnaissance de ce site !!! + +Bien cordialement, +-- +L'équipe Polytechnique.org +{/if} +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/register/registration.mail.tpl b/templates/register/registration.mail.tpl new file mode 100644 index 0000000..4b6a380 --- /dev/null +++ b/templates/register/registration.mail.tpl @@ -0,0 +1,47 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2010 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + +{config_load file="mails.conf" section="registration"} +{if $mail_part eq 'head'} +{subject text="$subj"} +{from full=#from#} +{to addr=#to#} +{if isset(#replyto#)}{add_header name='Reply-To' value=#replyto#}{/if} +{elseif $mail_part eq 'text'} +{$firstname} {$lastname} ({$promo}) a terminé son inscription avec les données suivantes : + - nom : {$lastname} + - prenom : {$firstname} + - promo : {$promo} + - naissance : {$birthdate} (date connue : {$birthdate_ref}) + - forlife : {$forlife} + - email : {$email} + - sexe : {$sex} + - ip : {S::logger()->ip} ({S::logger()->host}) +{if S::logger()->proxy_ip} - proxy : {S::logger()->proxy_ip} ({S::logger()->proxy_host}){/if} + + +{if $market}Les marketings suivants avaient été effectués : +{$market} +{else}{$firstname} {$lastname} n'a jamais reçu d'email de marketing. +{/if} +{/if} +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/register/step1.tpl b/templates/register/step1.tpl index 351b444..dd44fc2 100644 --- a/templates/register/step1.tpl +++ b/templates/register/step1.tpl @@ -39,7 +39,7 @@ Donne ta promotion sur 4 chiffres : - + diff --git a/templates/register/step2.tpl b/templates/register/step2.tpl index 299bc58..bd86370 100644 --- a/templates/register/step2.tpl +++ b/templates/register/step2.tpl @@ -30,8 +30,8 @@
    - {if $smarty.session.sub_state.promo >= 1996} - {assign var="promo" value=$smarty.session.sub_state.promo} + {if $smarty.session.subState.yearpromo >= 1996} + {assign var="promo" value=$smarty.session.subState.yearpromo} @@ -40,8 +40,8 @@ Matricule X : @@ -73,7 +73,7 @@ Nom (à l'X) @@ -81,7 +81,7 @@ Prénom @@ -89,7 +89,7 @@ Promotion diff --git a/templates/register/step3.tpl b/templates/register/step3.tpl index 2e74695..d781942 100644 --- a/templates/register/step3.tpl +++ b/templates/register/step3.tpl @@ -22,24 +22,24 @@ {include file="register/breadcrumb.tpl"} -{if $smarty.session.sub_state.forlife} +{if $smarty.session.subState.forlife}

    Formulaire de pré-inscription

    - {if $smarty.session.sub_state.mailorg2} + {if $smarty.session.subState.emailXorg2}

    Tu n'as pour le moment aucun homonyme dans notre base de données. Nous allons - donc te donner l'adresse {$smarty.session.sub_state.bestalias}@{#globals.mail.domain#}, - en plus de ton adresse à vie {$smarty.session.sub_state.forlife}@{#globals.mail.domain#}. - Note que tu pourrais perdre l'adresse {$smarty.session.sub_state.bestalias}@{#globals.mail.domain#} + donc te donner l'adresse {$smarty.session.subState.bestalias}@{#globals.mail.domain#}, + en plus de ton adresse à vie {$smarty.session.subState.forlife}@{#globals.mail.domain#}. + Note que tu pourrais perdre l'adresse {$smarty.session.subState.bestalias}@{#globals.mail.domain#} si un homonyme s'inscrivait, même si cela reste assez rare.

    {else}

    Tu as déjà un homonyme inscrit dans notre base de données, dans une autre promotion. Nous allons - donc te donner l'adresse {$smarty.session.sub_state.bestalias}@{#globals.mail.domain#}, en plus - de ton adresse à vie {$smarty.session.sub_state.forlife}@{#globals.mail.domain#}. + donc te donner l'adresse {$smarty.session.subState.bestalias}@{#globals.mail.domain#}, en plus + de ton adresse à vie {$smarty.session.subState.forlife}@{#globals.mail.domain#}.

    {/if} @@ -80,7 +80,7 @@ jour/mois/année @@ -118,7 +118,7 @@
    de recevoir les informations plus spécifiques de ta promotion pour pouvoir participer plus facilement aux événements - qu'elle organise. Nous t'inscrivons donc dans le groupe de la promotion {$smarty.session.sub_state.promo}. + qu'elle organise. Nous t'inscrivons donc dans le groupe de la promotion {$smarty.session.subState.promo}.
    diff --git a/templates/register/step4.tpl b/templates/register/step4.tpl index 9f035fd..e9b71a9 100644 --- a/templates/register/step4.tpl +++ b/templates/register/step4.tpl @@ -29,14 +29,14 @@ La pré-inscription que tu viens de soumettre a été enregistrée.

    Les instructions te permettant de valider ton inscription viennent de t'être envoyés -à l'adresse {$smarty.session.sub_state.email}. +à l'adresse {$smarty.session.subState.email}.

    Tu n'as que quelques jours pour suivre ces instructions. Ensuite, la pré-inscription est effacée automatiquement de notre base de données et il faut tout recommencer.

    -Si tu ne reçois rien, vérifie bien l'adresse {$smarty.session.sub_state.email}. +Si tu ne reçois rien, vérifie bien l'adresse {$smarty.session.subState.email}. En particulier, vérifie si l'email n'a pas été rejeté par ton filtre anti-spam. L'adresse d'expéditeur est register@polytechnique.org.

    diff --git a/templates/register/inscription.reussie.tpl b/templates/register/success.mail.tpl similarity index 97% rename from templates/register/inscription.reussie.tpl rename to templates/register/success.mail.tpl index 2c8fa8f..2d81b0b 100644 --- a/templates/register/inscription.reussie.tpl +++ b/templates/register/success.mail.tpl @@ -27,7 +27,7 @@ {subject text="Bienvenue parmi les X sur le web !"} {elseif $mail_part eq 'text'} -{$prenom}, félicitations pour ton inscription ! +{$firstname}, félicitations pour ton inscription ! Tu as maintenant accès à l'annuaire en ligne, aux services de listes de diffusion, aux infos promo, etc. N'oublie pas de mettre ta fiche-annuaire -- 2.1.4
    matricule
    - +
    - +
    - +
    - +
    - + (demandée si tu perds ton mot de passe)