From 4b0cf4e453902b1a6529c5e3309f6d3927f3f4d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 1 Mar 2010 00:38:58 +0100 Subject: [PATCH] Fixes a few issues in the new registration process. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/register.php | 9 +++++---- modules/register/register.inc.php | 26 +++++++++++++------------- templates/register/end.mail.tpl | 4 ++-- templates/register/lostalias.mail.tpl | 2 -- templates/register/marketer.mail.tpl | 2 -- templates/register/registration.mail.tpl | 5 ++--- 6 files changed, 22 insertions(+), 26 deletions(-) diff --git a/modules/register.php b/modules/register.php index 2ce6266..e2810cb 100644 --- a/modules/register.php +++ b/modules/register.php @@ -57,8 +57,8 @@ class RegisterModule extends PLModule 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)) - INNER JOIN profiles AS p ON (p.pid = ap.id) + 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_display AS pd ON (p.pid = pd.pid) 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 = {?}) @@ -199,7 +199,7 @@ class RegisterModule extends PLModule $bannedEmail = true; } } - if ($subState->has('watch')) { + if ($subState->i('watch') != 0) { $alert .= "Inscription d'un utilisateur surveillé - "; } @@ -234,7 +234,7 @@ class RegisterModule extends PLModule . " pour nous faire part de cette erreur."; } else { $subState->set('step', 4); - if ($subState->count('backs') >= 3) { + if ($subState->v('backs')->count() >= 3) { $alert .= "Fin d'une inscription hésitante."; } finishRegistration($subState); @@ -479,6 +479,7 @@ class RegisterModule extends PLModule $mymail->assign('birthdate_ref', $birthdate_ref); $mymail->assign('forlife', $forlife); $mymail->assign('email', $email); + $mymail->assign('logger', S::logger()); if (count($market) > 0) { $mymail->assign('market', implode("\n", $market)); } diff --git a/modules/register/register.inc.php b/modules/register/register.inc.php index 4506edd..a54b053 100644 --- a/modules/register/register.inc.php +++ b/modules/register/register.inc.php @@ -32,24 +32,24 @@ function checkId(&$subState) new UFC_UID($subState->i('xorg_id')), new PFC_Not(new UFC_Dead()) )); - $user = $uf->getProfiles(); + $profile = $uf->getProfile(); - if ($user->__get('state') == 'active') { + if ($profile->__get('state') == 'active') { return "Tu es déjà inscrit ou ton matricule est incorrect !"; } - if ($user->promo() != $subState->s('promo')) { + if ($profile->promo() != $subState->s('promo')) { return 'Le matricule est incorrect.'; } - if (!$user->compareNames($subState->s('firstname'), $subState->s('lastname'))) { + if (!$profile->compareNames($subState->s('firstname'), $subState->s('lastname'))) { return "Erreur dans l'identification. Réessaie, il y a une erreur quelque part !"; } - $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')); + $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')); return true; } @@ -69,7 +69,7 @@ function checkOldId(&$subState) $subState->set('lastname', $profile->lastName()); $subState->set('firstname', $profile->firstName()); $subState->set('uid', $profile->owner()->id()); - $subState->set('watch', $profile->owner()->watch()); + $subState->set('watch', $profile->owner()->watch); $subState->set('birthdateRef', $profile->__get('birthdate_ref')); $subState->set('xorgid', $profile->__get('xorg_id')); return true; @@ -85,7 +85,7 @@ function checkOldId(&$subState) 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('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 !'; @@ -198,10 +198,10 @@ function finishRegistration($subState) $mymail = new PlMailer('register/end.mail.tpl'); $mymail->assign('emailXorg', $subState->s('bestalias')); - $mymail->assign('lemail', $subState->s('email')); + $mymail->assign('to', $subState->s('email')); $mymail->assign('baseurl', $globals->baseurl); $mymail->assign('hash', $hash); - $mymail->assign('subj', $subState->s('bestalias') . '@' . $globals->mail->domain); + $mymail->assign('subject', $subState->s('bestalias') . '@' . $globals->mail->domain); $mymail->send(); } diff --git a/templates/register/end.mail.tpl b/templates/register/end.mail.tpl index f9bf321..cc2cd0d 100644 --- a/templates/register/end.mail.tpl +++ b/templates/register/end.mail.tpl @@ -22,9 +22,9 @@ {config_load file="mails.conf" section="inscrire"} {if $mail_part eq 'head'} -{subject text="$subj"} +{subject text="$subject"} {from full=#from#} -{to addr="$lemail"} +{to addr="$to"} {elseif $mail_part eq 'text'} Bonjour, diff --git a/templates/register/lostalias.mail.tpl b/templates/register/lostalias.mail.tpl index 6bc31c2..e3c7d96 100644 --- a/templates/register/lostalias.mail.tpl +++ b/templates/register/lostalias.mail.tpl @@ -22,10 +22,8 @@ {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, diff --git a/templates/register/marketer.mail.tpl b/templates/register/marketer.mail.tpl index e0f1a3b..191dff1 100644 --- a/templates/register/marketer.mail.tpl +++ b/templates/register/marketer.mail.tpl @@ -22,9 +22,7 @@ {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()}, diff --git a/templates/register/registration.mail.tpl b/templates/register/registration.mail.tpl index 4b6a380..2dc0c2c 100644 --- a/templates/register/registration.mail.tpl +++ b/templates/register/registration.mail.tpl @@ -22,7 +22,6 @@ {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} @@ -35,8 +34,8 @@ - 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} + - ip : {$logger->ip} ({$logger->host}) +{if $logger->proxy_ip} - proxy : {$logger->proxy_ip} ({$logger->proxy_host}){/if} {if $market}Les marketings suivants avaient été effectués : -- 2.1.4