aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/notification_by_mail.php17
-rw-r--r--include/functions_mail.inc.php79
-rw-r--r--include/picture_comment.inc.php14
-rw-r--r--register.php7
4 files changed, 92 insertions, 25 deletions
diff --git a/admin/notification_by_mail.php b/admin/notification_by_mail.php
index 33e5f59dd..738623b19 100644
--- a/admin/notification_by_mail.php
+++ b/admin/notification_by_mail.php
@@ -226,11 +226,6 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
$is_action_send = ($action == 'send');
- if (!isset($customize_mail_content))
- {
- $customize_mail_content = $conf['nbm_complementary_mail_content'];
- }
-
// disabled and null mail_address are not selected in the list
$data_users = get_user_notifications('send', $check_key_list);
@@ -244,6 +239,18 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
{
$datas = array();
+ if (!isset($customize_mail_content))
+ {
+ $customize_mail_content = $conf['nbm_complementary_mail_content'];
+ }
+
+ if ($conf['nbm_send_html_mail'] and !(strpos($customize_mail_content, '<') === 0))
+ {
+ // On HTML mail, detects if the content are HTML format.
+ // If it's plain text format, convert content to readable HTML
+ $customize_mail_content = nl2br(htmlentities($customize_mail_content));
+ }
+
// Prepare message after change language
if ($is_action_send)
{
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php
index d534c073b..f26af9a83 100644
--- a/include/functions_mail.inc.php
+++ b/include/functions_mail.inc.php
@@ -3,7 +3,7 @@
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
-// | Copyright (C) 2006 Ruben ARNAUD - team@phpwebgallery.net |
+// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
@@ -26,12 +26,6 @@
// | USA. |
// +-----------------------------------------------------------------------+
-/**
- * - Extract mail fonctions of password.php
- * - Modify pwg_mail (add pararameters + news fonctionnalities)
- * - Var conf_mail, function get_mail_configuration, format_email, pwg_mail
- */
-
// +-----------------------------------------------------------------------+
// | functions |
// +-----------------------------------------------------------------------+
@@ -99,7 +93,7 @@ function format_email($name, $email)
}
/**
- * Return an completed array template/theme
+ * Returns an completed array template/theme
* completed with $conf['default_template']
*
* @params:
@@ -161,12 +155,55 @@ function get_str_email_format($is_html)
}
/**
+ * Returns email of all administrator
+ *
+ * @return string
+ */
+function get_administrators_email()
+{
+ global $conf;
+
+ $result = array();
+
+ $query = '
+select
+ U.'.$conf['user_fields']['username'].' as username,
+ U.'.$conf['user_fields']['email'].' as mail_address
+from
+ '.USERS_TABLE.' as U,
+ '.USER_INFOS_TABLE.' as I
+where
+ I.user_id = U.'.$conf['user_fields']['id'].' and
+ I.status in (\'webmaster\', \'admin\') and
+ '.$conf['user_fields']['email'].' is not null
+order by
+ username
+';
+
+ $datas = pwg_query($query);
+ if (!empty($datas))
+ {
+ while ($admin = mysql_fetch_array($datas))
+ {
+ if (!empty($admin['mail_address']))
+ {
+ array_push($result, format_email($admin['username'], $admin['mail_address']));
+ }
+ }
+ }
+
+ return $result;
+}
+
+/**
* sends an email, using PhpWebGallery specific informations
*
* @param:
* - to: Receiver, or receivers of the mail.
* - args: function params of mail function:
- * o from: sender [default value webmaster email]
+ * o from: sender [default value webmaster email]
+ * o Cc: array of carbon copy receivers of the mail. [default value empty]
+ * o Bcc: array of blind carbon copy receivers of the mail. [default value empty]
* o subject [default value 'PhpWebGallery']
* o content: content of mail [default value '']
* o content_format: format of mail content [default value 'text/plain']
@@ -174,7 +211,6 @@ function get_str_email_format($is_html)
* o template: template to use [default $conf['default_template']]
* o theme: template to use [default $conf['default_template']]
*/
-//function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $infos_format = 'text/plain', $email_format = null)
function pwg_mail($to, $args = array())
{
global $conf, $conf_mail, $lang_info, $page;
@@ -221,6 +257,11 @@ function pwg_mail($to, $args = array())
{
$args['content_format'] = 'text/plain';
}
+
+ if ($conf_mail['send_bcc_mail_webmaster'])
+ {
+ $args['Bcc'][] = $conf_mail['formated_email_webmaster'];
+ }
if (($args['content_format'] == 'text/html') and ($args['email_format'] == 'text/plain'))
{
@@ -231,17 +272,23 @@ function pwg_mail($to, $args = array())
$args = array_merge($args, get_array_template_theme($args));
$headers = 'From: '.$args['from']."\n";
- $headers.= 'Reply-To: '.$args['from']."\n";
+ $headers.= 'Reply-To: '.$args['from']."\n";
+
+ if (!empty($args['Cc']))
+ {
+ $headers.= 'Cc: '.implode(',', $args['Cc'])."\n";
+ }
+
+ if (!empty($args['Bcc']))
+ {
+ $headers.= 'Bcc: '.implode(',', $args['Bcc'])."\n";
+ }
+
$headers.= 'Content-Type: multipart/alternative;'."\n";
$headers.= ' boundary="---='.$conf_mail['boundary_key'].'";'."\n";
$headers.= ' reply-type=original'."\n";
$headers.= 'MIME-Version: 1.0'."\n";
- if ($conf_mail['send_bcc_mail_webmaster'])
- {
- $headers.= 'Bcc: '.$conf_mail['formated_email_webmaster']."\n";
- }
-
$content = '';
if (!isset($conf_mail[$args['email_format']][$lang_info['charset']][$args['template']][$args['theme']]))
diff --git a/include/picture_comment.inc.php b/include/picture_comment.inc.php
index e9bad6f79..eb99f9f64 100644
--- a/include/picture_comment.inc.php
+++ b/include/picture_comment.inc.php
@@ -209,6 +209,7 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
{
include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+ $val_url = get_absolute_root_url().'comments.php?validate='.$comm['id'];
$del_url = get_absolute_root_url().'comments.php?delete='.$comm['id'];
$content =
@@ -216,6 +217,7 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
.'Comment: '.$comm['content']."\n"
.'IP: '.$comm['ip']."\n"
.'Browser: '.$comm['agent']."\n\n"
+ .'Validate: '.$val_url."\n"
.'Delete: '.$del_url."\n";
if ($comment_action!='validate')
{
@@ -223,8 +225,16 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
'Validate: '.get_absolute_root_url()
.'comments.php?validate='.$comm['id'];
}
- pwg_mail(get_webmaster_mail_address(),
- array('subject' => 'PWG comment by '.$comm['author'], 'content' => $content));
+ pwg_mail
+ (
+ format_email('administrators', get_webmaster_mail_address()),
+ array
+ (
+ 'subject' => 'PWG comment by '.$comm['author'],
+ 'content' => $content,
+ 'Bcc' => get_administrators_email()
+ )
+ );
}
}
else
diff --git a/register.php b/register.php
index 0d42a4795..1aeb6eb1d 100644
--- a/register.php
+++ b/register.php
@@ -70,11 +70,14 @@ if (isset($_POST['submit']))
.'Browser: '.$_SERVER['HTTP_USER_AGENT']."\n\n"
.l10n('admin').': '.$admin_url;
- pwg_mail(get_webmaster_mail_address(),
+ pwg_mail
+ (
+ format_email('administrators', get_webmaster_mail_address()),
array
(
'subject' => 'PWG '.l10n('register_title').' '.$username,
- 'content' => $content
+ 'content' => $content,
+ 'Bcc' => get_administrators_email()
)
);
}