Apply Nicco's style footer to HTML mail.

Add 2 news functions to indicate to build URL with full path

git-svn-id: http://piwigo.org/svn/trunk@1676 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rub 2006-12-19 22:05:01 +00:00
commit a7ce261531
4 changed files with 82 additions and 24 deletions

View file

@ -312,16 +312,11 @@ function display_counter_info()
function get_mail_content_subscribe_unsubcribe($nbm_user)
{
global $page, $env_nbm;
global $env_nbm;
$content = "\n\n\n";
if ( isset($page['root_path']) )
{
$save_root_path = $page['root_path'];
}
$page['root_path'] = 'http://'.$_SERVER['HTTP_HOST'].cookie_path();
set_make_full_url();
$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";
@ -329,14 +324,7 @@ function get_mail_content_subscribe_unsubcribe($nbm_user)
$content .= sprintf(l10n('nbm_content_subscribe_unsubscribe_contact'), $env_nbm['send_as_mail_address'])."\n";
$content .= "___________________________________________________\n\n\n\n";
if (isset($save_root_path))
{
$page['root_path'] = $save_root_path;
}
else
{
unset($page['root_path']);
}
unset_make_full_url();
return $content;
}

View file

@ -121,7 +121,7 @@ function get_mail_template()
*/
function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $format_infos = 'text/plain', $email_format = null)
{
global $conf, $conf_mail, $lang_info, $user;
global $conf, $conf_mail, $lang_info, $user, $page;
$cvt7b_subject = str_translate_to_ascii7bits($subject);
@ -141,6 +141,12 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
return false;
}
// Compute root_path in order have complete path
if ($email_format == 'text/html')
{
set_make_full_url();
}
$to = format_email('', $to);
if ($from == '')
@ -179,9 +185,8 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
$page['body_id'] : '',
'CONTENT_ENCODING' => $lang_info['charset'],
'LANG'=>$lang_info['code'],
'DIR'=>$lang_info['direction']
'LANG' => $lang_info['code'],
'DIR' => $lang_info['direction']
));
$conf_mail[$email_format][$lang_info['charset']]['header'] =
@ -220,7 +225,7 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
$page['gallery_title'] : $conf['gallery_title'],
'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',
'L_TITLE_MAIL' => urlencode(l10n('title_send_mail')),
'TITLE_MAIL' => urlencode(l10n('title_send_mail')),
'MAIL' => get_webmaster_mail_address()
));
@ -235,6 +240,12 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
$content.= $conf_mail[$email_format][$lang_info['charset']]['footer'];
// Undo Compute root_path in order have complete path
if ($email_format == 'text/html')
{
unset_make_full_url();
}
if ($conf_mail['mail_options'])
{
$options = '-f '.$conf_mail['email_webmaster'];

View file

@ -396,4 +396,61 @@ function make_section_in_url($params)
return $section_string;
}
/**
* Indicate to build url with full path
*
* @param null
* @return null
*/
function set_make_full_url()
{
global $page;
if (!isset($page['save_root_path']))
{
if (isset($page['root_path']))
{
$page['save_root_path']['path'] = $page['root_path'];
}
$page['save_root_path']['count'] = 1;
$page['root_path'] = 'http://'.$_SERVER['HTTP_HOST'].cookie_path();
}
else
{
$page['save_root_path']['count'] += 1;
}
}
/**
* Restore old parameter to build url with full path
*
* @param null
* @return null
*/
function unset_make_full_url()
{
global $page;
if (isset($page['save_root_path']))
{
if ($page['save_root_path']['count'] == 1)
{
if (isset($page['save_root_path']['path']))
{
$page['root_path'] = $page['save_root_path']['path'];
}
else
{
unset($page['root_path']);
}
unset($page['save_root_path']);
}
else
{
$page['save_root_path']['count'] -= 1;
}
}
}
?>

View file

@ -5,10 +5,12 @@
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>
<a href="http://www.phpwebgallery.net" class="back" title="{lang:powered_by}">
<img src="{pwg_root}{themeconf:icon_dir}/pwg_footer.png" alt="{lang:powered_by}">
</a>
{VERSION}
- {lang:send_mail}
<a href="mailto:{MAIL}?subject={L_TITLE_MAIL}">{lang:Webmaster}</a>
<a href="mailto:{MAIL}?subject={TITLE_MAIL}">{lang:Webmaster}</a>
</div> <!-- copyright -->
</div> <!-- the_page -->