aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2013-11-06 15:43:41 +0000
committermistic100 <mistic@piwigo.org>2013-11-06 15:43:41 +0000
commit7a5e31e40127c401520d62499830a14537cd9c03 (patch)
tree4758ad0f260c9cd45ff295c6a1f84b04dec98d23
parentb768047019615e7c80f6292514219c7335b0ee1d (diff)
feature 2995: New email template
rewrite pwg_mail_group() and pwg_mail_notification_admins() new function pwg_mail_admins() add complete template management in pwg_mail() TODO : font-size problem in Thunderbird git-svn-id: http://piwigo.org/svn/trunk@25357 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/album_notification.php33
-rw-r--r--include/config_default.inc.php2
-rw-r--r--include/functions_comment.inc.php66
-rw-r--r--include/functions_mail.inc.php386
-rw-r--r--include/functions_user.inc.php14
-rw-r--r--themes/default/template/mail/text/html/mail-css-clear.tpl2
-rw-r--r--themes/default/template/mail/text/html/mail-css-dark.tpl2
-rw-r--r--themes/default/template/mail/text/html/notification_admin.tpl7
-rw-r--r--themes/default/template/mail/text/plain/notification_admin.tpl6
9 files changed, 267 insertions, 251 deletions
diff --git a/admin/album_notification.php b/admin/album_notification.php
index d4070c2d7..0239dbac8 100644
--- a/admin/album_notification.php
+++ b/admin/album_notification.php
@@ -80,28 +80,29 @@ SELECT id, file, path, representative_ext
$img_url = '';
}
- // TODO Mettre un array pour traduction subjet
pwg_mail_group(
$_POST['group'],
- get_str_email_format(true), /* TODO add a checkbox in order to choose format*/
- get_l10n_args('[%s] Visit album %s',
- array($conf['gallery_title'], $category['name'])),
- 'cat_group_info',
- array
- (
- 'IMG_URL' => $img_url,
- 'CAT_NAME' => $category['name'],
- 'LINK' => make_index_url(
- array(
+ array(
+ 'subject' => l10n('[%s] Visit album %s', $conf['gallery_title'], $category['name']),
+ // TODO : change this language variable to 'Visit album %s'
+ // TODO : 'language_selected' => ....
+ ),
+ array(
+ 'filename' => 'cat_group_info',
+ 'assign' => array(
+ 'IMG_URL' => $img_url,
+ 'CAT_NAME' => $category['name'],
+ 'LINK' => make_index_url(array(
'category' => array(
'id' => $category['id'],
'name' => $category['name'],
'permalink' => $category['permalink']
- ))),
- 'CPL_CONTENT' => empty($_POST['mail_content'])
- ? '' : stripslashes($_POST['mail_content'])
- ),
- '' /* TODO Add listbox in order to choose Language selected */);
+ )
+ )),
+ 'CPL_CONTENT' => empty($_POST['mail_content']) ? '' : stripslashes($_POST['mail_content']),
+ )
+ )
+ );
unset_make_full_url();
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index 7e6b65cf3..2ecfd226b 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -285,7 +285,7 @@ $conf['mail_sender_name'] = '';
$conf['mail_sender_email'] = '';
// set true to allow text/html emails
-$conf['allow_html_email'] = true;
+$conf['mail_allow_html'] = true;
// 'clear' or 'dark'
$conf['mail_theme'] = 'clear';
diff --git a/include/functions_comment.inc.php b/include/functions_comment.inc.php
index 9ea597672..344a56335 100644
--- a/include/functions_comment.inc.php
+++ b/include/functions_comment.inc.php
@@ -232,25 +232,22 @@ INSERT INTO '.COMMENTS_TABLE.'
$comment_url = get_absolute_root_url().'comments.php?comment_id='.$comm['id'];
- $keyargs_content = array
- (
- get_l10n_args('Author: %s', stripslashes($comm['author']) ),
- get_l10n_args('Email: %s', stripslashes($comm['email']) ),
- get_l10n_args('Comment: %s', stripslashes($comm['content']) ),
- get_l10n_args('', ''),
- get_l10n_args('Manage this user comment: %s', $comment_url)
+ $content = array(
+ l10n('Author: %s', stripslashes($comm['author']) ),
+ l10n('Email: %s', stripslashes($comm['email']) ),
+ l10n('Comment: %s', stripslashes($comm['content']) ),
+ '',
+ l10n('Manage this user comment: %s', $comment_url),
);
if ('moderate' == $comment_action)
{
- $keyargs_content[] = get_l10n_args('', '');
- $keyargs_content[] = get_l10n_args('(!) This comment requires validation', '');
+ $content[] = l10n('(!) This comment requires validation');
}
- pwg_mail_notification_admins
- (
- get_l10n_args('Comment by %s', stripslashes($comm['author']) ),
- $keyargs_content
+ pwg_mail_notification_admins(
+ l10n('Comment by %s', stripslashes($comm['author']) ),
+ implode("\n", $content)
);
}
}
@@ -376,20 +373,17 @@ $user_where_clause.'
$comment_url = get_absolute_root_url().'comments.php?comment_id='.$comment['comment_id'];
- $keyargs_content = array
- (
- get_l10n_args('Author: %s', stripslashes($GLOBALS['user']['username']) ),
- get_l10n_args('Comment: %s', stripslashes($comment['content']) ),
- get_l10n_args('', ''),
- get_l10n_args('Manage this user comment: %s', $comment_url),
- get_l10n_args('', ''),
- get_l10n_args('(!) This comment requires validation', ''),
+ $content = array(
+ l10n('Author: %s', stripslashes($GLOBALS['user']['username']) ),
+ l10n('Comment: %s', stripslashes($comment['content']) ),
+ '',
+ l10n('Manage this user comment: %s', $comment_url),
+ l10n('(!) This comment requires validation'),
);
- pwg_mail_notification_admins
- (
- get_l10n_args('Comment by %s', stripslashes($GLOBALS['user']['username']) ),
- $keyargs_content
+ pwg_mail_notification_admins(
+ l10n('Comment by %s', stripslashes($GLOBALS['user']['username']) ),
+ implode("\n", $content)
);
}
// just mail admin
@@ -416,24 +410,24 @@ function email_admin($action, $comment)
include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
- $keyargs_content = array();
- $keyargs_content[] = get_l10n_args('Author: %s', $comment['author']);
+ $content = array(
+ l10n('Author: %s', $comment['author']),
+ );
+
if ($action=='delete')
{
- $keyargs_content[] = get_l10n_args('This author removed the comment with id %d',
- $comment['comment_id']
- );
+ $content[] = l10n('This author removed the comment with id %d', $comment['comment_id']);
}
else
{
- $keyargs_content[] = get_l10n_args('This author modified following comment:', '');
- $keyargs_content[] = get_l10n_args('Comment: %s', $comment['content']);
+ $content[] = l10n('This author modified following comment:');
+ $content[] = l10n('Comment: %s', $comment['content']);
}
- pwg_mail_notification_admins(get_l10n_args('Comment by %s',
- $comment['author']),
- $keyargs_content
- );
+ pwg_mail_notification_admins(
+ l10n('Comment by %s', $comment['author']),
+ implode("\n", $content)
+ );
}
function get_comment_author_id($comment_id, $die_on_error=true)
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php
index 57ac3ef86..f36819152 100644
--- a/include/functions_mail.inc.php
+++ b/include/functions_mail.inc.php
@@ -47,7 +47,7 @@ function get_mail_sender_email()
/**
* Returns an array of mail configuration parameters :
* - send_bcc_mail_webmaster
- * - allow_html_email
+ * - mail_allow_html
* - use_smtp
* - smtp_host
* - smtp_user
@@ -64,7 +64,7 @@ function get_mail_configuration()
$conf_mail = array(
'send_bcc_mail_webmaster' => $conf['send_bcc_mail_webmaster'],
- 'allow_html_email' => $conf['allow_html_email'],
+ 'mail_allow_html' => $conf['mail_allow_html'],
'mail_theme' => $conf['mail_theme'],
'use_smtp' => !empty($conf['smtp_host']),
'smtp_host' => $conf['smtp_host'],
@@ -253,118 +253,117 @@ function switch_lang_back()
}
/**
- * Returns email of all administrator
- *
- * @return string
- */
-/*
- * send en notification email to all administrators
- * if a administrator is doing action,
- * he's be removed to email list
- *
- * @param:
- * - keyargs_subject: mail subject on l10n_args format
- * - keyargs_content: mail content on l10n_args format
- * - send_technical_details: send user IP and browser
- *
- * @return boolean (Ok or not)
+ * Send a notification email to all administrators
+ * current user (if admin) is not notified
+ * @param string $subject
+ * @param string $content
+ * @param boolean $send_technical_details - send user IP and browser
+ * @return boolean
*/
-function pwg_mail_notification_admins($keyargs_subject, $keyargs_content, $send_technical_details=true)
+function pwg_mail_notification_admins($subject, $content, $send_technical_details=true)
{
+ if (empty($subject) or empty($content))
+ {
+ return false;
+ }
+
+ // for backward compatibility < 2.6
+ if (is_array($subject))
+ {
+ $subject = l10n_args($subject);
+ }
+ if (is_array($content))
+ {
+ $content = l10n_args($content);
+ }
+
global $conf, $user;
- // Check arguments
- if (empty($keyargs_subject) or empty($keyargs_content))
+ $tpl_vars = array();
+ if ($send_technical_details)
+ {
+ $tpl_vars['TECHNICAL'] =
+ l10n('Connected user: %s', stripslashes($user['username'])) ."\n".
+ l10n('IP: %s', $_SERVER['REMOTE_ADDR']) . "\n" .
+ l10n('Browser: %s', $_SERVER['HTTP_USER_AGENT']);
+ }
+
+ return pwg_mail_admins(
+ array(
+ 'subject' => '['. $conf['gallery_title'] .'] '. $subject,
+ 'mail_title' => $conf['gallery_title'],
+ 'mail_subtitle' => $subject,
+ 'content' => $content,
+ 'content_format' => 'text/plain',
+ ),
+ array(
+ 'filename' => 'notification_admin',
+ 'assign' => $tpl_vars,
+ )
+ );
+}
+
+/**
+ * Send a email to all administrators
+ * current user (if admin) is excluded
+ * @see pwg_mail()
+ *
+ * @param array $args - as in pwg_mail()
+ * @param array $tpl - as in pwg_mail()
+ * @return boolean
+ */
+function pwg_mail_admins($args=array(), $tpl=array())
+{
+ if (empty($args['content']) and empty($tpl))
{
return false;
}
+ global $conf, $user;
$return = true;
- $admins = array();
-
+ // get admins (except ourself)
$query = '
SELECT
- u.'.$conf['user_fields']['username'].' AS username,
- u.'.$conf['user_fields']['email'].' AS mail_address
+ u.'.$conf['user_fields']['username'].' AS name,
+ u.'.$conf['user_fields']['email'].' AS email
FROM '.USERS_TABLE.' AS u
- JOIN '.USER_INFOS_TABLE.' AS i ON i.user_id = u.'.$conf['user_fields']['id'].'
+ JOIN '.USER_INFOS_TABLE.' AS i
+ ON i.user_id = u.'.$conf['user_fields']['id'].'
WHERE i.status in (\'webmaster\', \'admin\')
- AND '.$conf['user_fields']['email'].' IS NOT NULL
+ AND u.'.$conf['user_fields']['email'].' IS NOT NULL
AND i.user_id <> '.$user['id'].'
ORDER BY username
;';
+ $admins = array_from_query($query);
- $datas = pwg_query($query);
- if (!empty($datas))
+ if (empty($admins))
{
- while ($admin = pwg_db_fetch_assoc($datas))
- {
- if (!empty($admin['mail_address']))
- {
- $admins[] = format_email($admin['username'], $admin['mail_address']);
- }
- }
+ return $return;
}
- if (count($admins) > 0)
- {
- switch_lang_to(get_default_language());
+ switch_lang_to(get_default_language());
- $content = l10n_args($keyargs_content)."\n";
- if ($send_technical_details)
- {
- $keyargs_content_admin_info = array(
- get_l10n_args('Connected user: %s', stripslashes($user['username'])),
- get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']),
- get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT'])
- );
-
- $content.= "\n".l10n_args($keyargs_content_admin_info)."\n";
- }
+ $return = pwg_mail($admins, $args, $tpl);
- $return = pwg_mail(
- implode(', ', $admins),
- array(
- 'subject' => '['.$conf['gallery_title'].'] '.l10n_args($keyargs_subject),
- 'content' => $content,
- 'content_format' => 'text/plain',
- 'email_format' => 'text/html',
- )
- );
-
- switch_lang_back();
- }
+ switch_lang_back();
return $return;
}
-/*
- * send en email to user's group
- *
- * @param:
- * - group_id: mail are sent to group with this Id
- * - email_format: mail format
- * - keyargs_subject: mail subject on l10n_args format
- * - tpl_shortname: short template name without extension
- * - assign_vars: array used to assign_vars to mail template
- * - language_selected: send mail only to user with this selected language
+/**
+ * Send an email to a group
+ * @see pwg_mail()
*
- * @return boolean (Ok or not)
+ * @param int $group_id
+ * @param array $args - as in pwg_mail()
+ * @option string language_selected - filters users of the group by language
+ * @param array $tpl - as in pwg_mail()
+ * @return boolean
*/
-function pwg_mail_group(
- $group_id, $email_format, $keyargs_subject,
- $tpl_shortname,
- $assign_vars = array(), $language_selected = '')
-{
- // Check arguments
- if
- (
- empty($group_id) or
- empty($email_format) or
- empty($keyargs_subject) or
- empty($tpl_shortname)
- )
+function pwg_mail_group($group_id, $args=array(), $tpl=array())
+{
+ if (empty($group_id) or ( empty($args['content']) and empty($tpl) ))
{
return false;
}
@@ -372,94 +371,65 @@ function pwg_mail_group(
global $conf;
$return = true;
+ // get distinct languages of targeted users
$query = '
-SELECT
- distinct language, theme
-FROM
- '.USER_GROUP_TABLE.' as ug
- INNER JOIN '.USERS_TABLE.' as u ON '.$conf['user_fields']['id'].' = ug.user_id
- INNER JOIN '.USER_INFOS_TABLE.' as ui ON ui.user_id = ug.user_id
-WHERE
- '.$conf['user_fields']['email'].' IS NOT NULL
- AND group_id = '.$group_id;
-
- if (!empty($language_selected))
+SELECT DISTINCT language
+ FROM '.USER_GROUP_TABLE.' AS ug
+ INNER JOIN '.USERS_TABLE.' AS u
+ ON '.$conf['user_fields']['id'].' = ug.user_id
+ INNER JOIN '.USER_INFOS_TABLE.' AS ui
+ ON ui.user_id = ug.user_id
+ WHERE group_id = '.$group_id.'
+ AND '.$conf['user_fields']['email'].' <> ""';
+ if (!empty($args['language_selected']))
{
$query .= '
- AND language = \''.$language_selected.'\'';
+ AND language = \''.$args['language_selected'].'\'';
}
$query .= '
;';
+ $languages = array_from_query($query, 'language');
- $result = pwg_query($query);
-
- if (pwg_db_num_rows($result) > 0)
+ if (empty($languages))
{
- $list = array();
- while ($row = pwg_db_fetch_assoc($result))
- {
- $list[] = $row;
- }
+ return $return;
+ }
- foreach ($list as $elem)
- {
- $query = '
+ foreach ($languages as $language)
+ {
+ // get subset of users in this group for a specific language
+ $query = '
SELECT
- u.'.$conf['user_fields']['username'].' as username,
- u.'.$conf['user_fields']['email'].' as mail_address
-FROM
- '.USER_GROUP_TABLE.' as ug
- INNER JOIN '.USERS_TABLE.' as u ON '.$conf['user_fields']['id'].' = ug.user_id
- INNER JOIN '.USER_INFOS_TABLE.' as ui ON ui.user_id = ug.user_id
-WHERE
- '.$conf['user_fields']['email'].' IS NOT NULL
- AND group_id = '.$group_id.'
- AND language = \''.$elem['language'].'\'
- AND theme = \''.$elem['theme'].'\'
+ u.'.$conf['user_fields']['username'].' AS name,
+ u.'.$conf['user_fields']['email'].' AS email
+ FROM '.USER_GROUP_TABLE.' AS ug
+ INNER JOIN '.USERS_TABLE.' AS u
+ ON '.$conf['user_fields']['id'].' = ug.user_id
+ INNER JOIN '.USER_INFOS_TABLE.' AS ui
+ ON ui.user_id = ug.user_id
+ WHERE group_id = '.$group_id.'
+ AND '.$conf['user_fields']['email'].' <> ""
+ AND language = \''.$language.'\'
;';
+ $users = array_from_query($query);
- $result = pwg_query($query);
+ if (empty($users))
+ {
+ continue;
+ }
- if (pwg_db_num_rows($result) > 0)
- {
- $Bcc = array();
- while ($row = pwg_db_fetch_assoc($result))
- {
- if (!empty($row['mail_address']))
- {
- $Bcc[] = format_email(stripslashes($row['username']), $row['mail_address']);
- }
- }
+ switch_lang_to($language);
- if (count($Bcc) > 0)
- {
- switch_lang_to($elem['language']);
-
- $mail_template = get_mail_template($email_format, $elem['theme']);
- $mail_template->set_filename($tpl_shortname, $tpl_shortname.'.tpl');
-
- $mail_template->assign(
- trigger_event('mail_group_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,
- 'theme' => $elem['theme']
- )
- ) and $return;
+ $return&= pwg_mail(null,
+ array_merge(
+ $args,
+ array('Bcc' => $users)
+ ),
+ $tpl
+ );
- switch_lang_back();
- }
- }
- }
+ switch_lang_back();
}
return $return;
@@ -473,17 +443,21 @@ WHERE
* 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 'Piwigo']
- * o content: content of mail [default value '']
- * o content_format: format of mail content [default value 'text/plain']
- * o email_format: global mail format [default value $conf_mail['default_email_format']]
+ * o subject [default value 'Piwigo']
+ * o content: content of mail [default value '']
+ * o content_format: format of mail content [default value 'text/plain']
+ * o email_format: global mail format [default value $conf_mail['default_email_format']]
* o theme: theme to use [default value $conf_mail['mail_theme']]
* o mail_title: main title of the mail [default value $conf['gallery_title']]
* o mail_subtitle: subtitle of the mail [default value subject]
+ * @param array $tpl - use these options to define a custom content template file
+ * o filename
+ * o dirname (optional)
+ * o assign (optional)
*
* @return boolean
*/
-function pwg_mail($to, $args = array())
+function pwg_mail($to, $args=array(), $tpl=array())
{
global $conf, $conf_mail, $lang_info, $page;
@@ -571,6 +545,16 @@ function pwg_mail($to, $args = array())
{
$args['content'] = '';
}
+
+ // try to decompose subject like "[....] ...."
+ if (!isset($args['mail_title']) and !isset($args['mail_subtitle']))
+ {
+ if (preg_match('#^\[(.*)\](.*)$#', $args['subject'], $matches))
+ {
+ $args['mail_title'] = $matches[1];
+ $args['mail_subtitle'] = $matches[2];
+ }
+ }
if (!isset($args['mail_title']))
{
$args['mail_title'] = $conf['gallery_title'];
@@ -587,7 +571,7 @@ function pwg_mail($to, $args = array())
}
$content_type_list = array();
- if ($conf_mail['allow_html_email'] and @$args['email_format'] != 'text/plain')
+ if ($conf_mail['mail_allow_html'] and @$args['email_format'] != 'text/plain')
{
$content_type_list[] = 'text/html';
}
@@ -598,7 +582,7 @@ function pwg_mail($to, $args = array())
{
// key compose of indexes witch allow to cache mail data
$cache_key = $content_type.'-'.$lang_info['code'];
- $cache_key.= '-'.crc32(@$args['mail_title'] . @$args['mail_subtitle']);
+ $cache_key.= '-'.crc32(@$args['mail_title'] . @$args['mail_subtitle']); // TODO: find a way to not cache by mail_title
if (!isset($conf_mail[$cache_key]))
{
@@ -608,11 +592,12 @@ function pwg_mail($to, $args = array())
$conf_mail[$cache_key]['theme'] = get_mail_template($content_type);
trigger_action('before_parse_mail_template', $cache_key, $content_type);
}
+ $template = &$conf_mail[$cache_key]['theme'];
- $conf_mail[$cache_key]['theme']->set_filename('mail_header', 'header.tpl');
- $conf_mail[$cache_key]['theme']->set_filename('mail_footer', 'footer.tpl');
+ $template->set_filename('mail_header', 'header.tpl');
+ $template->set_filename('mail_footer', 'footer.tpl');
- $conf_mail[$cache_key]['theme']->assign(
+ $template->assign(
array(
'GALLERY_URL' => get_gallery_home_url(),
'GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'],
@@ -627,31 +612,33 @@ function pwg_mail($to, $args = array())
if ($content_type == 'text/html')
{
- if ($conf_mail[$cache_key]['theme']->smarty->template_exists('global-mail-css.tpl'))
+ if ($template->smarty->template_exists('global-mail-css.tpl'))
{
- $conf_mail[$cache_key]['theme']->set_filename('css', 'global-mail-css.tpl');
- $conf_mail[$cache_key]['theme']->assign_var_from_handle('GLOBAL_MAIL_CSS', 'css');
+ $template->set_filename('css', 'global-mail-css.tpl');
+ $template->assign_var_from_handle('GLOBAL_MAIL_CSS', 'css');
}
- if ($conf_mail[$cache_key]['theme']->smarty->template_exists('mail-css-'. $args['theme'] .'.tpl'))
+ if ($template->smarty->template_exists('mail-css-'. $args['theme'] .'.tpl'))
{
- $conf_mail[$cache_key]['theme']->set_filename('css', 'mail-css-'. $args['theme'] .'.tpl');
- $conf_mail[$cache_key]['theme']->assign_var_from_handle('MAIL_CSS', 'css');
+ $template->set_filename('css', 'mail-css-'. $args['theme'] .'.tpl');
+ $template->assign_var_from_handle('MAIL_CSS', 'css');
}
}
- $conf_mail[$cache_key]['header'] = $conf_mail[$cache_key]['theme']->parse('mail_header', true);
- $conf_mail[$cache_key]['footer'] = $conf_mail[$cache_key]['theme']->parse('mail_footer', true);
+ $conf_mail[$cache_key]['header'] = $template->parse('mail_header', true);
+ $conf_mail[$cache_key]['footer'] = $template->parse('mail_footer', true);
}
// Header
$contents[$content_type] = $conf_mail[$cache_key]['header'];
// Content
+ // Stored in a temp variable, if a content template is used it will be assigned
+ // to the $CONTENT template variable, otherwise it will be appened to the mail
if ($args['content_format'] == 'text/plain' and $content_type == 'text/html')
{
// convert plain text to html
- $contents[$content_type].=
+ $mail_content =
'<p>'.
nl2br(
preg_replace(
@@ -665,11 +652,39 @@ function pwg_mail($to, $args = array())
else if ($args['content_format'] == 'text/html' and $content_type == 'text/plain')
{
// convert html text to plain text
- $contents[$content_type].= strip_tags($args['content']);
+ $mail_content = strip_tags($args['content']);
}
else
{
- $contents[$content_type].= $args['content'];
+ $mail_content = $args['content'];
+ }
+
+ // Runtime template
+ if (isset($tpl['filename']))
+ {
+ $template = &$conf_mail[$cache_key]['theme'];
+ if (isset($tpl['dirname']))
+ {
+ $template->set_template_dir($tpl['dirname'] .'/'. $content_type);
+ }
+ if ($template->smarty->template_exists($tpl['filename'] .'.tpl'))
+ {
+ $template->set_filename($tpl['filename'], $tpl['filename'] .'.tpl');
+ if (!empty($tpl['assign']))
+ {
+ $template->assign($tpl['assign']);
+ }
+ $template->assign('CONTENT', $mail_content);
+ $contents[$content_type].= $template->parse($tpl['filename'], true);
+ }
+ else
+ {
+ $contents[$content_type].= $mail_content;
+ }
+ }
+ else
+ {
+ $contents[$content_type].= $mail_content;
}
// Footer
@@ -750,7 +765,10 @@ function pwg_mail($to, $args = array())
*/
function pwg_send_mail($result, $to, $subject, $content, $headers)
{
- trigger_error('pwg_send_mail function is deprecated', E_USER_NOTICE);
+ if (is_admin())
+ {
+ trigger_error('pwg_send_mail function is deprecated', E_USER_NOTICE);
+ }
if (!$result)
{
@@ -766,16 +784,6 @@ function pwg_send_mail($result, $to, $subject, $content, $headers)
}
/**
- * @deprecated 2.6
- */
-function move_ccs_rules_to_body($content)
-{
- trigger_error('move_ccs_rules_to_body function is deprecated, use move_css_to_body', E_USER_NOTICE);
-
- return move_css_to_body($content);
-}
-
-/**
* Moves CSS rules contained in the <style> tag to inline CSS
* (for compatibility with Gmail and such clients)
* @since 2.6
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index f6e2cd925..a71335e74 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -229,16 +229,16 @@ SELECT id
include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
$admin_url = get_absolute_root_url().'admin.php?page=user_list&username='.$login;
- $keyargs_content = array(
- get_l10n_args('User: %s', stripslashes($login)),
- get_l10n_args('Email: %s', $_POST['mail_address']),
- get_l10n_args('', ''),
- get_l10n_args('Admin: %s', $admin_url)
+ $content = array(
+ l10n('User: %s', stripslashes($login) ),
+ l10n('Email: %s', $_POST['mail_address']),
+ '',
+ l10n('Admin: %s', $admin_url),
);
pwg_mail_notification_admins(
- get_l10n_args('Registration of %s', stripslashes($login)),
- $keyargs_content
+ l10n('Registration of %s', stripslashes($login) ),
+ implode("\n", $content)
);
}
diff --git a/themes/default/template/mail/text/html/mail-css-clear.tpl b/themes/default/template/mail/text/html/mail-css-clear.tpl
index b23c2b5d3..98b0337d9 100644
--- a/themes/default/template/mail/text/html/mail-css-clear.tpl
+++ b/themes/default/template/mail/text/html/mail-css-clear.tpl
@@ -14,7 +14,7 @@ html, body, #bodyTable {
/* main block */
#header {
background:#eee;
- background:radial-gradient(ellipse at center, #fefefe, #e5e5e5);
+ background-image:radial-gradient(ellipse at center, #fefefe, #e5e5e5);
border-top:4px solid #f70;
text-align:center;
text-shadow:1px 1px 0px #fff;
diff --git a/themes/default/template/mail/text/html/mail-css-dark.tpl b/themes/default/template/mail/text/html/mail-css-dark.tpl
index 8299b5ad5..d35c698c5 100644
--- a/themes/default/template/mail/text/html/mail-css-dark.tpl
+++ b/themes/default/template/mail/text/html/mail-css-dark.tpl
@@ -14,7 +14,7 @@ html, body, #bodyTable {
/* main block */
#header {
background:#444;
- background:radial-gradient(ellipse at center, #555, #333);
+ background-image:radial-gradient(ellipse at center, #555, #333);
border:1px solid #000;
border-top:4px solid #f70;
text-align:center;
diff --git a/themes/default/template/mail/text/html/notification_admin.tpl b/themes/default/template/mail/text/html/notification_admin.tpl
new file mode 100644
index 000000000..2cd3483b0
--- /dev/null
+++ b/themes/default/template/mail/text/html/notification_admin.tpl
@@ -0,0 +1,7 @@
+{$CONTENT}
+
+{if isset($TECHNICAL)}
+<p style="margin-top:10px;font-size:10px;">
+{$TECHNICAL|nl2br}
+</p>
+{/if} \ No newline at end of file
diff --git a/themes/default/template/mail/text/plain/notification_admin.tpl b/themes/default/template/mail/text/plain/notification_admin.tpl
new file mode 100644
index 000000000..b7d552626
--- /dev/null
+++ b/themes/default/template/mail/text/plain/notification_admin.tpl
@@ -0,0 +1,6 @@
+{$CONTENT}
+
+{if isset($TECHNICAL)}
+-----------------------------
+{$TECHNICAL}
+{/if} \ No newline at end of file