From c63105671cdbe12ea807ad5d9999e306a96cb7cf Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 10 Aug 2008 21:50:42 +0200 Subject: [PATCH] Move isvalid_email_redirection in emails.inc.php. Signed-off-by: Florent Bruneau --- core | 2 +- include/emails.inc.php | 11 +++++++++++ modules/marketing.php | 3 ++- modules/register.php | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core b/core index 12ccfec..ab6d7d8 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 12ccfec732e22546728674652a0a4caeeec08f60 +Subproject commit ab6d7d83467fc5e19755550d36144b26a9a29fb7 diff --git a/include/emails.inc.php b/include/emails.inc.php index be0b6fd..792d099 100644 --- a/include/emails.inc.php +++ b/include/emails.inc.php @@ -63,6 +63,17 @@ function valide_email($str) return $ident . '@' . $dom; } +// function isvalid_email_redirection() {{{1 +/** vérifie si une adresse email convient comme adresse de redirection + * @param $email l'adresse email a verifier + * @return BOOL + */ +function isvalid_email_redirection($email) +{ + return isvalid_email($email) && + !preg_match("/@(polytechnique\.(org|edu)|melix\.(org|net)|m4x\.org)$/", $email); +} + // class Bogo {{{1 // The Bogo class represents a spam filtering level in plat/al architecture. class Bogo diff --git a/modules/marketing.php b/modules/marketing.php index c854069..9507cf5 100644 --- a/modules/marketing.php +++ b/modules/marketing.php @@ -198,8 +198,8 @@ class MarketingModule extends PLModule $page->assign('user', $user); $email = null; + require_once 'emails.inc.php'; if (Post::has('mail')) { - require_once 'emails.inc.php'; $email = valide_email(Post::v('mail')); } if (Post::has('valide') && isvalid_email_redirection($email)) { @@ -270,6 +270,7 @@ class MarketingModule extends PLModule S::assert_xsrf_token(); $email = trim(Post::v('mail')); + require_once 'emails.inc.php'; if (!isvalid_email_redirection($email)) { $page->trigError("Email invalide !"); } else { diff --git a/modules/register.php b/modules/register.php index cb15051..dab11eb 100644 --- a/modules/register.php +++ b/modules/register.php @@ -137,6 +137,7 @@ class RegisterModule extends PLModule case 3: if (count($_POST)) { require_once(dirname(__FILE__) . '/register/register.inc.php'); + require_once 'emails.inc.php'; if (!isvalid_email(Post::v('email'))) { $err[] = "Le champ 'E-mail' n'est pas valide."; } elseif (!isvalid_email_redirection(Post::v('email'))) { -- 2.1.4