Changeset 2278 for trunk/include/functions_mail.inc.php
- Timestamp:
- Mar 13, 2008, 2:43:45 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_mail.inc.php
r2262 r2278 171 171 * o theme: template to use [default get_default_template()] 172 172 */ 173 function get_mail_template($email_format, $args = array())173 function & get_mail_template($email_format, $args = array()) 174 174 { 175 175 $args = get_array_template_theme($args); 176 176 177 177 $mail_template = new Template(PHPWG_ROOT_PATH.'template/'.$args['template'], $args['theme']); 178 $mail_template->_old->set_rootdir(PHPWG_ROOT_PATH.'template/'.$args['template'].'/mail/'.$email_format); 179 $mail_template->smarty->template_dir = PHPWG_ROOT_PATH.'template/'.$args['template'].'/mail/'.$email_format; 180 178 $mail_template->set_template_dir(PHPWG_ROOT_PATH.'template/'.$args['template'].'/mail/'.$email_format); 181 179 return $mail_template; 182 180 } … … 298 296 { 299 297 // Check arguments 300 if 298 if 301 299 ( 302 300 empty($keyargs_subject) or … … 392 390 { 393 391 // Check arguments 394 if 392 if 395 393 ( 396 394 empty($group_id) or … … 476 474 (empty($dirname) ? '' : $dirname.'/').$tpl_shortname.'.tpl'); 477 475 478 $mail_template->assign _vars(476 $mail_template->assign( 479 477 trigger_event('mail_group_assign_vars', $assign_vars)); 480 478 … … 630 628 $mail_template->set_filename('mail_footer', 'footer.tpl'); 631 629 632 $mail_template->assign _vars(630 $mail_template->assign( 633 631 array( 634 632 //Header … … 655 653 if ($args['email_format'] == 'text/html') 656 654 { 657 $old_root = $mail_template->root; 658 659 if (is_file($mail_template->root.'/global-mail-css.tpl')) 655 if (is_file($mail_template->get_template_dir().'/global-mail-css.tpl')) 660 656 { 661 $mail_template->set_filename(' global_mail_css', 'global-mail-css.tpl');662 $mail_template->assign_var_from_handle('GLOBAL_MAIL_CSS', ' global_mail_css');657 $mail_template->set_filename('css', 'global-mail-css.tpl'); 658 $mail_template->assign_var_from_handle('GLOBAL_MAIL_CSS', 'css'); 663 659 } 664 660 665 $mail_template->root = PHPWG_ROOT_PATH.'template/'.$args['template'].'/theme/'.$args['theme']; 666 if (is_file($mail_template->root.'/mail-css.tpl')) 661 $root_abs_path = dirname(dirname(__FILE__)); 662 663 $file = $root_abs_path.'/template/'.$args['template'].'/theme/'.$args['theme'].'/mail-css.tpl'; 664 if (is_file($file)) 667 665 { 668 $mail_template->set_filename(' mail_css', 'mail-css.tpl');669 $mail_template->assign_var_from_handle('MAIL_CSS', ' mail_css');666 $mail_template->set_filename('css', $file); 667 $mail_template->assign_var_from_handle('MAIL_CSS', 'css'); 670 668 } 671 669 672 $ mail_template->root = PHPWG_ROOT_PATH.'template-common';673 if (is_file($ mail_template->root.'/local-mail-css.tpl'))670 $file = $root_abs_path.'/template-common/local-mail-css.tpl'; 671 if (is_file($file)) 674 672 { 675 $mail_template->set_filename(' local_mail_css', 'local-mail-css.tpl');676 $mail_template->assign_var_from_handle('LOCAL_MAIL_CSS', ' local_mail_css');673 $mail_template->set_filename('css', $file); 674 $mail_template->assign_var_from_handle('LOCAL_MAIL_CSS', 'css'); 677 675 } 678 679 $mail_template->root = $old_root;680 676 } 681 677 … … 771 767 } 772 768 773 /*Testing block 774 function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args) 775 { 776 global $user, $lang_info; 777 @mkdir(PHPWG_ROOT_PATH.'testmail'); 778 $filename = PHPWG_ROOT_PATH.'testmail/mail.'.$user['username'].'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme']; 769 /*Testing block*/ 770 /*function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args) 771 { 772 global $conf, $user, $lang_info; 773 $dir = $conf['local_data_dir'].'/tmp'; 774 @mkdir( $dir ); 775 $filename = $dir.'/mail.'.$user['username'].'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme']; 779 776 if ($args['content_format'] == 'text/plain') 780 777 { … … 786 783 } 787 784 $file = fopen($filename, 'w+'); 788 fwrite($file, $to );789 fwrite($file, $subject );785 fwrite($file, $to ."\n"); 786 fwrite($file, $subject ."\n"); 790 787 fwrite($file, $headers); 791 788 fwrite($file, $content); 792 789 fclose($file); 793 return true;794 } 795 add_event_handler('send_mail', 'pwg_send_mail_test', 0, 6);*/790 return $result; 791 } 792 add_event_handler('send_mail', 'pwg_send_mail_test', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 6);*/ 796 793 797 794
Note: See TracChangeset
for help on using the changeset viewer.