aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--admin/include/functions_notification_by_mail.inc.php4
-rw-r--r--include/functions_mail.inc.php94
-rw-r--r--template/yoga/mail/footer.tpl3
3 files changed, 69 insertions, 32 deletions
diff --git a/admin/include/functions_notification_by_mail.inc.php b/admin/include/functions_notification_by_mail.inc.php
index 17283212e..4bd2cfba3 100644
--- a/admin/include/functions_notification_by_mail.inc.php
+++ b/admin/include/functions_notification_by_mail.inc.php
@@ -324,8 +324,8 @@ function get_mail_content_subscribe_unsubcribe($nbm_user)
$page['root_path'] = 'http://'.$_SERVER['HTTP_HOST'].cookie_path();
$content .= "___________________________________________________\n\n";
- $content .= sprintf(l10n('nbm_content_unsubscribe_link'), add_url_params(get_root_url().'/nbm.php', array('unsubscribe' => $nbm_user['check_key'])))."\n";
- $content .= sprintf(l10n('nbm_content_subscribe_link'), add_url_params(get_root_url().'/nbm.php', array('subscribe' => $nbm_user['check_key'])))."\n";
+ $content .= sprintf(l10n('nbm_content_unsubscribe_link'), add_url_params(get_root_url().'nbm.php', array('unsubscribe' => $nbm_user['check_key'])))."\n";
+ $content .= sprintf(l10n('nbm_content_subscribe_link'), add_url_params(get_root_url().'nbm.php', array('subscribe' => $nbm_user['check_key'])))."\n";
$content .= sprintf(l10n('nbm_content_subscribe_unsubscribe_contact'), $env_nbm['send_as_mail_address'])."\n";
$content .= "___________________________________________________\n\n\n\n";
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'])
{
diff --git a/template/yoga/mail/footer.tpl b/template/yoga/mail/footer.tpl
index 1110dacdf..e0faa92f2 100644
--- a/template/yoga/mail/footer.tpl
+++ b/template/yoga/mail/footer.tpl
@@ -4,10 +4,11 @@
contact us on http://phpwebgallery.net to find a solution on how
to show the origin of the script...-->
+ <a href="{GALLERY_URL}" class="back">{GALLERY_TITLE}</a> -
{lang:powered_by} <a href="http://www.phpwebgallery.net" class="back">PhpWebGallery</a>
{VERSION}
- {lang:send_mail}
- <a href="mailto:{contact.MAIL}?subject={L_TITLE_MAIL}">{lang:Webmaster}</a>
+ <a href="mailto:{MAIL}?subject={L_TITLE_MAIL}">{lang:Webmaster}</a>
</div> <!-- copyright -->
</div> <!-- the_page -->