}
// Check if the given email is known as dangerous
- $res = Xdb::iterRow("SELECT w.state, w.description, a.alias
- FROM emails AS e
- INNER JOIN emails_watch AS w ON (e.email = w.email AND w.state != 'safe')
- INNER JOIN aliases AS a ON (e.uid = a.id AND a.type = 'a_vie')
- WHERE e.email = {?}
- ORDER BY a.alias", Post::v('email'));
- $aliases = array();
- while(list($gstate, $gdescription, $alias) = $res->next()) {
- $state = $gstate;
- $description = $gdescription;
- $aliases[] = $alias;
- }
- if (count($aliases) != 0) {
+ $res = XDB::query("SELECT w.state, w.description
+ FROM emails_watch AS w
+ WHERE w.email = {?} AND w.state != 'safe'",
+ Post::v('email'));
+ $email_banned = false;
+ if ($res->numRows()) {
+ list($state, $description) = $res->fetchOneRow();
$alert .= "Email surveille propose a l'inscription - ";
+ $sub_state['email_desc'] = $description;
+ if ($state == 'dangerous') {
+ $email_banned = true;
+ }
}
if ($sub_state['watch']) {
$alter .= "Inscription d'un utilisateur surveillé - ";
$alert .= "Date de naissance incorrecte à l'inscription - ";
}
$sub_state['email'] = Post::v('email');
- if (check_ip('unsafe')) {
+ $ip_banned = check_ip('unsafe');
+ if ($ip_banned) {
+ $alert .= "Tentative d'inscription depuis une IP surveillee";
+ }
+ if ($email_banned || $ip_banned) {
+ global $globals;
$err = "Une erreur s'est produite lors de l'inscription."
. " Merci de contacter <a href='mailto:register@{$globals->mail->domain}>"
. " register@{$globals->mail->domain}</a>"
. " pour nous faire part de cette erreur";
- $alert .= "Tentative d'inscription depuis une IP surveillee";
} else {
$sub_state['step'] = 4;
if (count($sub_state['backs']) >= 3) {
}
$page->changeTpl('register/step'.intval($sub_state['step']).'.tpl');
if (isset($err)) {
- $page->trig($err);
+ $page->trigError($err);
}
}
$mymail->setSubject("Inscription de $prenom $nom (X$promo)");
$mymail->setFrom('"Webmaster Polytechnique.org" <web@' . $globals->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"
. " - sexe : $femme\n"
. " - ip : {$logger->ip} ({$logger->host})\n"
. ($logger->proxy_ip ? " - proxy : {$logger->proxy_ip} ({$logger->proxy_host})\n" : "")
- . "\n\n"
- . "Les marketings suivants avaient été effectués :\n"
- . implode("\n", $market);
+ . "\n\n";
+ 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 de mail de marketing.";
+ }
$mymail->setTxtBody($msg);
$mymail->send();
}
}
if (Post::v('imap')) {
require_once 'emails.inc.php';
- $storage = new MailStorageIMAP(S::v('uid'));
- $storage->enable();
+ $storage = new EmailStorage(S::v('uid'), 'imap');
+ $storage->activate();
}
pl_redirect('profile/edit');