projects
/
platal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e1635d7
)
Notifies the user when an email is not valid.
author
Stéphane Jacob
<sj@m4x.org>
Fri, 13 Nov 2009 09:41:29 +0000
(10:41 +0100)
committer
Stéphane Jacob
<sj@m4x.org>
Fri, 13 Nov 2009 10:15:41 +0000
(11:15 +0100)
modules/email.php
patch
|
blob
|
blame
|
history
diff --git
a/modules/email.php
b/modules/email.php
index
272756f
..
0898aa4
100644
(file)
--- a/
modules/email.php
+++ b/
modules/email.php
@@
-424,8
+424,20
@@
class EmailModule extends PLModule
$cc = str_replace(';', ',', Env::t('cc'));
$bcc = str_replace(';', ',', Env::t('bcc'));
$cc = str_replace(';', ',', Env::t('cc'));
$bcc = str_replace(';', ',', Env::t('bcc'));
+ $email_regex = '/^[a-z0-9.\-+_\$]+@([\-.+_]?[a-z0-9])+$/i';
+ foreach (explode(',', $to . ',' . $cc . ',' . $bcc) as $email) {
+ $email = trim($email);
+ if ($email != '' && !preg_match($email_regex, $email)) {
+ $page->trigError("L'adresse email " . $email . ' est erronée.');
+ $error = true;
+ }
+ }
if (empty($to) && empty($cc) && empty($to2) && empty($bcc) && empty($cc2)) {
$page->trigError("Indique au moins un destinataire.");
if (empty($to) && empty($cc) && empty($to2) && empty($bcc) && empty($cc2)) {
$page->trigError("Indique au moins un destinataire.");
+ $error = true;
+ }
+
+ if ($error) {
$page->assign('uploaded_f', PlUpload::listFilenames(S::user()->login(), 'emails.send'));
} else {
$mymail = new PlMailer();
$page->assign('uploaded_f', PlUpload::listFilenames(S::user()->login(), 'emails.send'));
} else {
$mymail = new PlMailer();