aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2007-02-12 23:21:23 +0000
committerrub <rub@piwigo.org>2007-02-12 23:21:23 +0000
commit9ceec74971f85022ad61699dc209d7044945b149 (patch)
tree4372d31f0ab0540c4a877cd70a1d8a4068f21657 /admin
parent62c1993adcfc257d98e47dc7efa8633209dbac3b (diff)
When not template are selected for mail, PWG uses default template..
Sent multi-part message in MIME format. (With only one part for the moment). Improvement pwg_mail function. git-svn-id: http://piwigo.org/svn/trunk@1809 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin')
-rw-r--r--admin/include/functions_notification_by_mail.inc.php31
-rw-r--r--admin/notification_by_mail.php21
2 files changed, 35 insertions, 17 deletions
diff --git a/admin/include/functions_notification_by_mail.inc.php b/admin/include/functions_notification_by_mail.inc.php
index 64358ec9e..10ffd15ae 100644
--- a/admin/include/functions_notification_by_mail.inc.php
+++ b/admin/include/functions_notification_by_mail.inc.php
@@ -257,12 +257,12 @@ function end_users_env_nbm()
*
* Return none
*/
-function set_user_on_env_nbm($user_id, $is_action_send)
+function set_user_on_env_nbm(&$nbm_user, $is_action_send)
{
global $user, $lang, $lang_info, $env_nbm;
$user = array();
- $user['id'] = $user_id;
+ $user['id'] = $nbm_user['user_id'];
$user = array_merge($user, getuserdata($user['id'], true));
list($user['template'], $user['theme']) = explode('/', $user['template']);
@@ -286,7 +286,11 @@ function set_user_on_env_nbm($user_id, $is_action_send)
if ($is_action_send)
{
- $env_nbm['mail_template'] = get_mail_template($env_nbm['email_format']);
+ $nbm_user['template'] = $user['template'];
+ $nbm_user['theme'] = $user['theme'];
+ $env_nbm['mail_template'] =
+ get_mail_template($env_nbm['email_format'],
+ array('template' => $nbm_user['template'], 'theme' => $nbm_user['theme']));
$env_nbm['mail_template']->set_filename('notification_by_mail', 'admin/notification_by_mail.tpl');
}
}
@@ -431,7 +435,7 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
if ($nbm_user['mail_address'] != '')
{
// set env nbm user
- set_user_on_env_nbm($nbm_user['user_id'], true);
+ set_user_on_env_nbm($nbm_user, true);
$subject = '['.$conf['gallery_title'].']: '.($is_subscribe ? l10n('nbm_object_subscribe'): l10n('nbm_object_unsubscribe'));
@@ -445,13 +449,20 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
$section_action_by, array('DUMMY' => 'dummy')
);
- if (pwg_mail(
+ if (pwg_mail
+ (
format_email($nbm_user['username'], $nbm_user['mail_address']),
- $env_nbm['send_as_mail_formated'],
- $subject,
- $env_nbm['mail_template']->parse('notification_by_mail', true),
- $env_nbm['email_format'], $env_nbm['email_format']
- ))
+ array
+ (
+ 'from' => $env_nbm['send_as_mail_formated'],
+ 'subject' => $subject,
+ 'email_format' => $env_nbm['email_format'],
+ 'content' => $env_nbm['mail_template']->parse('notification_by_mail', true),
+ 'content_format' => $env_nbm['email_format'],
+ 'template' => $nbm_user['template'],
+ 'theme' => $nbm_user['theme']
+ )
+ ))
{
inc_mail_sent_success($nbm_user);
}
diff --git a/admin/notification_by_mail.php b/admin/notification_by_mail.php
index a000fdb4b..33e5f59dd 100644
--- a/admin/notification_by_mail.php
+++ b/admin/notification_by_mail.php
@@ -273,7 +273,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
}
// set env nbm user
- set_user_on_env_nbm($nbm_user['user_id'], $is_action_send);
+ set_user_on_env_nbm($nbm_user, $is_action_send);
if ($is_action_send)
{
@@ -377,13 +377,20 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
'byebye', array('SEND_AS_NAME' => $env_nbm['send_as_name'])
);
- if (pwg_mail(
+ if (pwg_mail
+ (
format_email($nbm_user['username'], $nbm_user['mail_address']),
- $env_nbm['send_as_mail_formated'],
- $subject,
- $env_nbm['mail_template']->parse('notification_by_mail', true),
- $env_nbm['email_format'], $env_nbm['email_format']
- ))
+ array
+ (
+ 'from' => $env_nbm['send_as_mail_formated'],
+ 'subject' => $subject,
+ 'email_format' => $env_nbm['email_format'],
+ 'content' => $env_nbm['mail_template']->parse('notification_by_mail', true),
+ 'content_format' => $env_nbm['email_format'],
+ 'template' => $nbm_user['template'],
+ 'theme' => $nbm_user['theme']
+ )
+ ))
{
inc_mail_sent_success($nbm_user);