aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/functions_mail.inc.php94
1 files changed, 65 insertions, 29 deletions
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php
index 4596d3ef9..ff75d86b6 100644
--- a/include/functions_mail.inc.php
+++ b/include/functions_mail.inc.php
@@ -99,6 +99,22 @@ function format_email($name, $email)
return $email;
}
}
+
+/**
+ * Returns an new mail template
+ *
+ * @param none
+ */
+function get_mail_template()
+{
+ global $conf;
+
+ // for mail, default template are used
+ list($tmpl, $thm) = explode('/', $conf['default_template']);
+ $mail_template = new Template(PHPWG_ROOT_PATH.'template/'.$tmpl, $thm);
+
+ return $mail_template;
+}
/**
* sends an email, using PhpWebGallery specific informations
@@ -146,30 +162,38 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
$headers.= 'Bcc: '.$conf_mail['formated_email_webmaster']."\n";
}
- list($tmpl, $thm) = explode('/', $conf['default_template']);
-
$content = '';
- if ($email_format == 'text/html')
+ if (!isset($conf_mail[$email_format][$lang_info['charset']]['header']))
{
- $template_mail = new Template(PHPWG_ROOT_PATH.'template/'.$tmpl, $thm);
+ if ($email_format == 'text/html')
+ {
+ $mail_template = get_mail_template();
- $template_mail->set_filenames(array('mail_header'=>'mail/header.tpl'));
+ $mail_template->set_filenames(array('mail_header'=>'mail/header.tpl'));
- $template_mail->assign_vars(
- array(
- 'BODY_ID' =>
- isset($page['body_id']) ?
- $page['body_id'] : '',
+ $mail_template->assign_vars(
+ array(
+ 'BODY_ID' =>
+ isset($page['body_id']) ?
+ $page['body_id'] : '',
- 'CONTENT_ENCODING' => $lang_info['charset'],
- 'LANG'=>$lang_info['code'],
- 'DIR'=>$lang_info['direction']
+ 'CONTENT_ENCODING' => $lang_info['charset'],
+ 'LANG'=>$lang_info['code'],
+ 'DIR'=>$lang_info['direction']
- ));
+ ));
- $content.= $template_mail->parse('mail_header', true);
+ $conf_mail[$email_format][$lang_info['charset']]['header'] =
+ $mail_template->parse('mail_header', true);
+ }
+ else
+ {
+ $conf_mail[$email_format][$lang_info['charset']]['header'] = '';
+ }
}
+
+ $content.= $conf_mail[$email_format][$lang_info['charset']]['header'];
if (($format_infos == 'text/plain') and ($email_format == 'text/html'))
{
@@ -180,24 +204,36 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
$content.= $infos;
}
- if ($email_format == 'text/plain')
- {
- $content.= $conf_mail['text_footer'];
- }
- else
+ if (!isset($conf_mail[$email_format][$lang_info['charset']]['footer']))
{
- $template_mail->set_filenames(array('mail_footer'=>'footer.tpl'));
+ if ($email_format == 'text/html')
+ {
+ $mail_template->set_filenames(array('mail_footer'=>'mail/footer.tpl'));
- $template_mail->assign_vars(
- array(
- 'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',
+ $mail_template->assign_vars(
+ array(
+ 'GALLERY_URL' =>
+ isset($page['gallery_url']) ?
+ $page['gallery_url'] : $conf['gallery_url'],
+ 'GALLERY_TITLE' =>
+ isset($page['gallery_title']) ?
+ $page['gallery_title'] : $conf['gallery_title'],
+ 'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',
- 'L_TITLE_MAIL' => urlencode(l10n('title_send_mail')),
- 'MAIL' => get_webmaster_mail_address()
- ));
+ 'L_TITLE_MAIL' => urlencode(l10n('title_send_mail')),
+ 'MAIL' => get_webmaster_mail_address()
+ ));
- $content.= $template_mail->parse('mail_footer', true);
- }
+ $conf_mail[$email_format][$lang_info['charset']]['footer'] =
+ $mail_template->parse('mail_footer', true);
+ }
+ else
+ {
+ $conf_mail[$email_format][$lang_info['charset']]['footer'] = $conf_mail['text_footer'];
+ }
+ }
+
+ $content.= $conf_mail[$email_format][$lang_info['charset']]['footer'];
if ($conf_mail['mail_options'])
{