aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_mail.inc.php
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2006-12-09 00:43:23 +0000
committerrub <rub@piwigo.org>2006-12-09 00:43:23 +0000
commit262ee7d11954930a47a8cf359be91c554de36db8 (patch)
tree06b70cdb87a01fa58808ee139b2413665f7c1a7a /include/functions_mail.inc.php
parent7eb74b3b12ca78eed57ea0cdc3cc80c7d1107c6c (diff)
Feature Issue ID 0000598:
Possibility to send HTML mail Optimize, fix little bugs and add footer information NBM: Replace // by / on subscribe/unsubscribe link git-svn-id: http://piwigo.org/svn/trunk@1645 68402e56-0260-453c-a942-63ccdbb3a9ee
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'])
{