aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2006-12-19 22:05:01 +0000
committerrub <rub@piwigo.org>2006-12-19 22:05:01 +0000
commita7ce26153185c274a08fb52b07402c8afba6f128 (patch)
treec2b8123bc777f033445337b4944650c81d5b880a /include
parenta65dbaa784ebcda9a807226e5739ba02e1a2123c (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/functions_mail.inc.php25
-rw-r--r--include/functions_url.inc.php57
2 files changed, 75 insertions, 7 deletions
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php
index ff75d86b6..9850f9c6c 100644
--- a/include/functions_mail.inc.php
+++ b/include/functions_mail.inc.php
@@ -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,8 +225,8 @@ 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')),
- 'MAIL' => get_webmaster_mail_address()
+ 'TITLE_MAIL' => urlencode(l10n('title_send_mail')),
+ 'MAIL' => get_webmaster_mail_address()
));
$conf_mail[$email_format][$lang_info['charset']]['footer'] =
@@ -233,7 +238,13 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
}
}
- $content.= $conf_mail[$email_format][$lang_info['charset']]['footer'];
+ $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'])
{
diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php
index 0d2ea4a7e..2b561f3d4 100644
--- a/include/functions_url.inc.php
+++ b/include/functions_url.inc.php
@@ -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;
+ }
+ }
+}
+
?> \ No newline at end of file