X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Femails.inc.php;h=2d24ccdc7aa504cd85155fa1d89ab42ff4242d11;hb=ced003168bf3b75a29313c727fe28d65cb03057c;hp=f285f08858ef8adf46cbe4a91e4d8f2aa41e6743;hpb=12a587df92f7bc9efeb91c1a2d27f763070b8609;p=platal.git diff --git a/include/emails.inc.php b/include/emails.inc.php index f285f08..2d24ccd 100644 --- a/include/emails.inc.php +++ b/include/emails.inc.php @@ -1,6 +1,6 @@ user = &$user; $this->sufficient = true; - list($this->email, $flags, $this->rewrite, $this->panne, $this->last, $this->panne_level) = $row; + list($this->email, $flags, $this->rewrite, $this->allow_rewrite, $this->hash, $this->panne, $this->last, $this->panne_level) = $row; $this->display_email = $this->email; $this->active = ($flags == 'active'); $this->broken = ($flags == 'panne'); @@ -227,6 +229,22 @@ class EmailRedirection extends Email } XDB::execute('UPDATE emails SET rewrite = {?} WHERE uid = {?} AND email = {?}', $rewrite, $this->user->id(), $this->email); $this->rewrite = $rewrite; + if (!$this->allow_rewrite) { + global $globals; + if (empty($this->hash)) { + $this->hash = rand_url_id(); + XDB::execute("UPDATE emails + SET hash = {?} + WHERE uid = {?} AND email = {?}", $this->hash, $this->user->id(), $this->email); + } + $mail = new PlMailer('emails/rewrite-in.mail.tpl'); + $mail->assign('mail', $this); + $mail->assign('user', $this->user); + $mail->assign('baseurl', $globals->baseurl); + $mail->assign('sitename', $globals->core->sitename); + $mail->assign('to', $this->email); + $mail->send($this->user->isEmailFormatHtml()); + } return; } @@ -388,7 +406,7 @@ class Redirect $this->bogo = new Bogo($user); // Adds third-party email redirections. - $res = XDB::iterRow("SELECT email, flags, rewrite, panne, last, panne_level + $res = XDB::iterRow("SELECT email, flags, rewrite, allow_rewrite, hash, panne, last, panne_level FROM emails WHERE uid = {?} AND flags != 'filter'", $user->id()); $this->emails = Array(); @@ -452,7 +470,7 @@ class Redirect return SUCCESS; } } - $this->emails[] = new EmailRedirection($this->user, array($email, 'active', '', '0000-00-00', '0000-00-00', 0)); + $this->emails[] = new EmailRedirection($this->user, array($email, 'active', '', 0, null, '0000-00-00', '0000-00-00', 0)); // security stuff check_email($email, "Ajout d'une adresse surveillée aux redirections de " . $this->user->login());