Changeset 1784 for trunk/include/functions_mail.inc.php
- Timestamp:
- Feb 6, 2007, 11:55:12 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 2 2 gal2 3 3 feed.xml 4 testmail
-
- Property svn:ignore
-
trunk/include/functions_mail.inc.php
r1726 r1784 65 65 format_email($conf['gallery_title'], $conf_mail['email_webmaster']); 66 66 67 // what to display at the bottom of each mail ?68 $conf_mail['text_footer'] =69 "\n\n-- \nPhpWebGallery ".($conf['show_version'] ? PHPWG_VERSION : '');70 71 67 return $conf_mail; 72 68 } … … 106 102 * @param none 107 103 */ 108 function get_mail_template( )104 function get_mail_template($email_format) 109 105 { 110 106 global $conf; … … 113 109 list($tmpl, $thm) = explode('/', $conf['default_template']); 114 110 $mail_template = new Template(PHPWG_ROOT_PATH.'template/'.$tmpl, $thm); 111 $mail_template->set_rootdir(PHPWG_ROOT_PATH.'template/'.$tmpl.'/mail/'.$email_format); 115 112 116 113 return $mail_template; … … 118 115 119 116 /** 117 * Return string email format (html or not) 118 * 119 * @param string format 120 */ 121 function get_str_email_format($is_html) 122 { 123 return ($is_html ? 'text/html' : 'text/plain'); 124 } 125 126 /** 120 127 * sends an email, using PhpWebGallery specific informations 121 128 */ 122 129 function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $format_infos = 'text/plain', $email_format = null) 123 130 { 124 global $conf, $conf_mail, $lang_info, $ user, $page;131 global $conf, $conf_mail, $lang_info, $page; 125 132 126 133 $cvt7b_subject = str_translate_to_ascii7bits($subject); … … 171 178 $content = ''; 172 179 173 if (!isset($conf_mail[$email_format][$lang_info['charset']]['header'])) 174 { 175 if ($email_format == 'text/html') 176 { 177 $mail_template = get_mail_template(); 178 179 $mail_template->set_filenames(array('mail_header'=>'mail/header.tpl')); 180 181 $mail_template->assign_vars( 182 array( 183 'BODY_ID' => 184 isset($page['body_id']) ? 185 $page['body_id'] : '', 186 187 'CONTENT_ENCODING' => $lang_info['charset'], 188 'LANG' => $lang_info['code'], 189 'DIR' => $lang_info['direction'] 190 )); 191 192 $conf_mail[$email_format][$lang_info['charset']]['header'] = 193 $mail_template->parse('mail_header', true); 194 } 195 else 196 { 197 $conf_mail[$email_format][$lang_info['charset']]['header'] = ''; 198 } 180 if (!isset($conf_mail[$email_format][$lang_info['charset']])) 181 { 182 if (!isset($mail_template)) 183 { 184 $mail_template = get_mail_template($email_format); 185 } 186 187 $mail_template->set_filename('mail_header', 'header.tpl'); 188 $mail_template->set_filename('mail_footer', 'footer.tpl'); 189 190 $mail_template->assign_vars( 191 array( 192 //Header 193 'BODY_ID' => 194 isset($page['body_id']) ? 195 $page['body_id'] : '', 196 197 'CONTENT_ENCODING' => $lang_info['charset'], 198 'LANG' => $lang_info['code'], 199 'DIR' => $lang_info['direction'], 200 201 // Footer 202 'GALLERY_URL' => 203 isset($page['gallery_url']) ? 204 $page['gallery_url'] : $conf['gallery_url'], 205 'GALLERY_TITLE' => 206 isset($page['gallery_title']) ? 207 $page['gallery_title'] : $conf['gallery_title'], 208 'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '', 209 'PHPWG_URL' => PHPWG_URL, 210 211 'TITLE_MAIL' => urlencode(l10n('title_send_mail')), 212 'MAIL' => get_webmaster_mail_address() 213 )); 214 215 // what are displayed on the header of each mail ? 216 $conf_mail[$email_format][$lang_info['charset']]['header'] = 217 $mail_template->parse('mail_header', true); 218 219 // what are displayed on the footer of each mail ? 220 $conf_mail[$email_format][$lang_info['charset']]['footer'] = 221 $mail_template->parse('mail_footer', true); 199 222 } 200 223 … … 208 231 { 209 232 $content.= $infos; 210 }211 212 if (!isset($conf_mail[$email_format][$lang_info['charset']]['footer']))213 {214 if ($email_format == 'text/html')215 {216 $mail_template->set_filenames(array('mail_footer'=>'mail/footer.tpl'));217 218 $mail_template->assign_vars(219 array(220 'GALLERY_URL' =>221 isset($page['gallery_url']) ?222 $page['gallery_url'] : $conf['gallery_url'],223 'GALLERY_TITLE' =>224 isset($page['gallery_title']) ?225 $page['gallery_title'] : $conf['gallery_title'],226 'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',227 'PHPWG_URL' => PHPWG_URL,228 229 'TITLE_MAIL' => urlencode(l10n('title_send_mail')),230 'MAIL' => get_webmaster_mail_address()231 ));232 233 $conf_mail[$email_format][$lang_info['charset']]['footer'] =234 $mail_template->parse('mail_footer', true);235 }236 else237 {238 $conf_mail[$email_format][$lang_info['charset']]['footer'] = $conf_mail['text_footer'];239 }240 233 } 241 234 … … 248 241 } 249 242 243 /*Testing block 244 { 245 global $user; 246 @mkdir(PHPWG_ROOT_PATH.'testmail'); 247 $filename = PHPWG_ROOT_PATH.'testmail/mail.'.$user['username']; 248 if ($format_infos == 'text/plain') 249 { 250 $filename .= '.txt'; 251 } 252 else 253 { 254 $filename .= '.html'; 255 } 256 $file = fopen($filename, 'w+'); 257 fwrite($file, $content); 258 fclose($file); 259 return true; 260 } 261 */ 262 250 263 if ($conf_mail['mail_options']) 251 264 {
Note: See TracChangeset
for help on using the changeset viewer.