}
}
+ // Register the optional services requested by the user.
+ $services = array();
+ foreach (array('ax_letter', 'imap', 'ml_promo', 'nl') as $service) {
+ if (Post::b($service)) {
+ $services[] = $service;
+ }
+ }
+ $sub_state['services'] = $services;
+
// Validate the password.
if (!Post::v('response2', false)) {
$err[] = "Le mot de passe n'est pas valide.";
if ($hash) {
$res = XDB::query(
"SELECT r.uid, r.forlife, r.bestalias, r.mailorg2,
- r.password, r.email, r.naissance, u.nom, u.prenom,
+ 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
</ol>");
}
- list($uid, $forlife, $bestalias, $mailorg2, $password, $email,
+ list($uid, $forlife, $bestalias, $mailorg2, $password, $email, $services,
$naissance, $nom, $prenom, $promo, $femme, $naiss_ini) = $res->fetchOneRow();
// Prepare the template for display.
$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);
+
+ // 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();
+ break;
+ case 'imap':
+ require_once 'emails.inc.php';
+ $user = S::user();
+ $storage = new EmailStorage($user, 'imap');
+ $storage->activate();
+ break;
+ case 'ml_promo':
+ $r = XDB::query('SELECT id FROM groupex.asso WHERE diminutif = {?}', S::user()->promo());
+ if ($r->numRows()) {
+ $asso_id = $r->fetchOneCell();
+ XDB::execute('REPLACE INTO groupex.membres (uid, asso_id)
+ VALUES ({?}, {?})',
+ S::user()->id(), $asso_id);
+ $mmlist = new MMList(S::user()->id(), S::v('password'));
+ $mmlist->subscribe("promo" . S::v('promo'));
+ }
+ break;
+ case 'nl':
+ require_once 'newsletter.inc.php';
+ NewsLetter::subscribe();
+ break;
+ }
+ }
+
// Log the registration in the user session.
S::logger($uid)->log('inscription', $email);
XDB::execute("UPDATE register_pending
// Update the global registration count stats.
$globals->updateNbIns();
- // 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);
-
//
// Update collateral data sources, and inform watchers by email.
//
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);
{checkpasswd prompt="password" text="Terminer la pré-inscription"}
</td>
</tr>
+ </table>
+ <table class="bicol">
<tr>
- <td colspan="2" class="center">
+ <th>Services supplémentaires</th>
+ </tr>
+ <tr class="impair">
+ <td>Pour profiter pleinement de ta nouvelle inscription, nous te proposons :</td>
+ </tr>
+ <tr class="pair">
+ <td>
+ <dl>
+ <dt><label><input type="checkbox" checked="checked" name="nl" /> lettre mensuelle</label></dt>
+ <dd>
+ de recevoir chaque mois la lettre mensuelle de Polytechnique.org contenant les activités et nouvelles de la communauté des X.
+ </dd>
+ <dt><label><input type="checkbox" checked="checked" name="ax_letter" /> envois de l'AX</label></dt>
+ <dd>
+ de recevoir les informations importantes de l'AX.
+ </dd>
+ <dt><label><input type="checkbox" checked="checked" name="ml_promo" /> ta promotion</label></dt>
+ <dd>
+ 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}.
+ </dd>
+ <dt><label><input type="checkbox" checked="checked" name="imap" />sauvegardes d'emails</label></dt>
+ <dd>
+ d'avoir un accès de secours aux 30 derniers jours d'emails reçus sur ton adresse Polytechnique.org.
+ </dd>
+ </dl>
+ </td>
+ </tr>
+ <tr class="impair">
+ <td>Valider mon inscription :</td>
+ </tr>
+ <tr class="impair">
+ <td class="center">
<input type="submit" name="submitn" value="Continuer" onclick="EncryptedResponseInNestedForm(); return false;" />
</td>
</tr>