aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();