mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-28 12:19:57 +03:00
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
This commit is contained in:
parent
7eb74b3b12
commit
262ee7d119
3 changed files with 69 additions and 32 deletions
|
@ -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";
|
||||
|
||||
|
|
|
@ -100,6 +100,22 @@ function format_email($name, $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,17 +162,17 @@ 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 (!isset($conf_mail[$email_format][$lang_info['charset']]['header']))
|
||||
{
|
||||
if ($email_format == 'text/html')
|
||||
{
|
||||
$template_mail = new Template(PHPWG_ROOT_PATH.'template/'.$tmpl, $thm);
|
||||
$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(
|
||||
$mail_template->assign_vars(
|
||||
array(
|
||||
'BODY_ID' =>
|
||||
isset($page['body_id']) ?
|
||||
|
@ -168,8 +184,16 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
|
|||
|
||||
));
|
||||
|
||||
$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')
|
||||
if (!isset($conf_mail[$email_format][$lang_info['charset']]['footer']))
|
||||
{
|
||||
$content.= $conf_mail['text_footer'];
|
||||
}
|
||||
else
|
||||
if ($email_format == 'text/html')
|
||||
{
|
||||
$template_mail->set_filenames(array('mail_footer'=>'footer.tpl'));
|
||||
$mail_template->set_filenames(array('mail_footer'=>'mail/footer.tpl'));
|
||||
|
||||
$template_mail->assign_vars(
|
||||
$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()
|
||||
));
|
||||
|
||||
$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'])
|
||||
{
|
||||
|
|
|
@ -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 -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue