aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_mail.inc.php
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2007-03-16 12:08:25 +0000
committerrub <rub@piwigo.org>2007-03-16 12:08:25 +0000
commit837138918295869327ea93d06d508d7c26c2ebea (patch)
tree6b3272c96ca7ecdc28f2977d2b174d95d7f1a8f5 /include/functions_mail.inc.php
parent9caab555c83d16b6c4ddbdaad5378e8563b1a16b (diff)
Fix bug: Don't invoke mail function when there aren't recipient.
git-svn-id: http://piwigo.org/svn/trunk@1914 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_mail.inc.php')
-rw-r--r--include/functions_mail.inc.php110
1 files changed, 60 insertions, 50 deletions
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php
index 539656bbf..07764f006 100644
--- a/include/functions_mail.inc.php
+++ b/include/functions_mail.inc.php
@@ -5,8 +5,7 @@
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
-// | file : $RCSfile$
+// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
@@ -289,31 +288,34 @@ order by
}
}
}
-
- $keyargs_content_admin_info = array
- (
- get_l10n_args('Connected user: %s', $user['username']),
- get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']),
- get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT'])
- );
-
- switch_lang_to($conf['default_language']);
-
- $return = pwg_mail
- (
- '',
- array
- (
- 'Bcc' => $admins,
- 'subject' => '['.$conf['gallery_title'].'] '.l10n_args($keyargs_subject),
- 'content' =>
- l10n_args($keyargs_content)."\n\n"
- .l10n_args($keyargs_content_admin_info)."\n",
- 'content_format' => 'text/plain'
- )
- ) and $return;
- switch_lang_back();
+ if (count($admins) > 0)
+ {
+ $keyargs_content_admin_info = array
+ (
+ get_l10n_args('Connected user: %s', $user['username']),
+ get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']),
+ get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT'])
+ );
+
+ switch_lang_to($conf['default_language']);
+
+ $return = pwg_mail
+ (
+ '',
+ array
+ (
+ 'Bcc' => $admins,
+ 'subject' => '['.$conf['gallery_title'].'] '.l10n_args($keyargs_subject),
+ 'content' =>
+ l10n_args($keyargs_content)."\n\n"
+ .l10n_args($keyargs_content_admin_info)."\n",
+ 'content_format' => 'text/plain'
+ )
+ ) and $return;
+
+ switch_lang_back();
+ }
return $return;
}
@@ -399,29 +401,32 @@ WHERE
}
}
- switch_lang_to($elem['language']);
-
- $mail_template = get_mail_template($email_format, $elem);
- $mail_template->set_filename($tpl_shortname,
- (IN_ADMIN ? 'admin/' : '').$tpl_shortname.'.tpl');
- $mail_template->assign_vars($assign_vars);
-
- $return = pwg_mail
- (
- '',
- array
- (
- 'Bcc' => $Bcc,
- 'subject' => l10n_args($keyargs_subject),
- 'email_format' => $email_format,
- 'content' => $mail_template->parse($tpl_shortname, true),
- 'content_format' => $email_format,
- 'template' => $elem['template'],
- 'theme' => $elem['theme']
- )
- ) and $return;
-
- switch_lang_back();
+ if (count($Bcc) > 0)
+ {
+ switch_lang_to($elem['language']);
+
+ $mail_template = get_mail_template($email_format, $elem);
+ $mail_template->set_filename($tpl_shortname,
+ (IN_ADMIN ? 'admin/' : '').$tpl_shortname.'.tpl');
+ $mail_template->assign_vars($assign_vars);
+
+ $return = pwg_mail
+ (
+ '',
+ array
+ (
+ 'Bcc' => $Bcc,
+ 'subject' => l10n_args($keyargs_subject),
+ 'email_format' => $email_format,
+ 'content' => $mail_template->parse($tpl_shortname, true),
+ 'content_format' => $email_format,
+ 'template' => $elem['template'],
+ 'theme' => $elem['theme']
+ )
+ ) and $return;
+
+ switch_lang_back();
+ }
}
}
@@ -450,7 +455,12 @@ WHERE
function pwg_mail($to, $args = array())
{
global $conf, $conf_mail, $lang_info, $page;
-
+
+ if (empty($to) and empty($args['Cc']) and empty($args['Bcc']))
+ {
+ return true;
+ }
+
if (!isset($conf_mail))
{
$conf_mail = get_mail_configuration();