|
From: FlorinCB <ory...@us...> - 2008-10-06 01:04:08
|
Update of /cvsroot/mxbb/core/includes/shared/phpbb2/includes In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12379 Modified Files: emailer.php Log Message: Added $emailer->use_html Index: emailer.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb2/includes/emailer.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** emailer.php 4 Oct 2008 07:04:25 -0000 1.3 --- emailer.php 6 Oct 2008 01:03:57 -0000 1.4 *************** *** 19,22 **** --- 19,30 ---- * ***************************************************************************/ + + + /** + * Modifications: + * Added $emailer->use_html method by OryNider + * + */ + // *************** *** 32,35 **** --- 40,44 ---- var $tpl_msg = array(); + var $use_html = false; function emailer($use_smtp) *************** *** 37,40 **** --- 46,50 ---- $this->reset(); $this->use_smtp = $use_smtp; + $this->use_html = false; $this->reply_to = $this->from = ''; } *************** *** 84,91 **** $this->extra_headers .= trim($headers) . "\n"; } function use_template($template_file, $template_lang = '') { ! global $board_config, $phpbb_root_path; if (trim($template_file) == '') --- 94,114 ---- $this->extra_headers .= trim($headers) . "\n"; } + + function set_mail_priority($priority = MAIL_NORMAL_PRIORITY) + { + $this->mail_priority = $priority; + } + + /** + * Set the email html + */ + function set_mail_html($html = false) + { + $this->use_html = $html; + } function use_template($template_file, $template_lang = '') { ! global $board_config, $phpbb_root_path, $module_root_path, $mx_root_path; if (trim($template_file) == '') *************** *** 101,113 **** if (empty($this->tpl_msg[$template_lang . $template_file])) { ! $tpl_file = $phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl'; ! if (!@file_exists(@$phpBB2->phpbb_realpath($tpl_file))) { ! $tpl_file = $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/email/' . $template_file . '.tpl'; ! if (!@file_exists(@$phpBB2->phpbb_realpath($tpl_file))) { ! mx_message_die(GENERAL_ERROR, 'Could not find email template file :: ' . $template_file, '', __LINE__, __FILE__); } } --- 124,136 ---- if (empty($this->tpl_msg[$template_lang . $template_file])) { ! $tpl_file = $module_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl'; ! if (!file_exists(realpath($tpl_file))) { ! $tpl_file = $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/email/' . $template_file . '.tpl'; ! if (!file_exists(realpath($tpl_file))) { ! mx_message_die(GENERAL_ERROR, 'Could not find email template file :: ' . $template_file . ' @:' . $tpl_file, '', __LINE__, __FILE__); } } *************** *** 115,119 **** if (!($fd = @fopen($tpl_file, 'r'))) { ! mx_message_die(GENERAL_ERROR, 'Failed opening template file :: ' . $tpl_file, '', __LINE__, __FILE__); } --- 138,142 ---- if (!($fd = @fopen($tpl_file, 'r'))) { ! mx_message_die(GENERAL_ERROR, 'Failed opening template file :: ' . $template_file . ' @:' . $tpl_file, '', __LINE__, __FILE__); } *************** *** 136,140 **** function send() { ! global $board_config, $lang, $phpEx, $phpbb_root_path, $db; // Escape all quotes, else the eval will fail. --- 159,163 ---- function send() { ! global $board_config, $lang, $phpEx, $phpbb_root_path, $db, $module_root_path; // Escape all quotes, else the eval will fail. *************** *** 144,148 **** // Set vars reset ($this->vars); ! while (list($key, $val) = each($this->vars)) { $$key = $val; --- 167,171 ---- // Set vars reset ($this->vars); ! while (list($key, $val) = each($this->vars)) { $$key = $val; *************** *** 153,157 **** // Clear vars reset ($this->vars); ! while (list($key, $val) = each($this->vars)) { unset($$key); --- 176,180 ---- // Clear vars reset ($this->vars); ! while (list($key, $val) = each($this->vars)) { unset($$key); *************** *** 193,204 **** // Build header ! $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : ''); ! // Send message ... removed $this->encode() from subject for time being if ( $this->use_smtp ) { ! if ( !defined('SMTP_INCLUDED') ) ! { ! include($phpbb_root_path . 'includes/smtp.' . $phpEx); } --- 216,234 ---- // Build header ! if ($this->use_html) ! { ! $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/html; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By Mx-Publisher\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : ''); ! } ! else ! { ! $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By Mx-Publisher\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : ''); ! } ! // Send message ... removed $this->encode() from subject for time being if ( $this->use_smtp ) { ! if (!defined('SMTP_INCLUDED')) ! { ! include($mx_root_path . 'includes/shared/phpbb2/includes/smtp.' . $phpEx); } *************** *** 209,229 **** $empty_to_header = ($to == '') ? TRUE : FALSE; $to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to; ! ! $result = @mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers); ! if (!$result && !$board_config['sendmail_fix'] && $empty_to_header) { $to = ' '; ! ! $sql = "UPDATE " . CONFIG_TABLE . " ! SET config_value = '1' ! WHERE config_name = 'sendmail_fix'"; ! if (!$db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Unable to update config table', '', __LINE__, __FILE__, $sql); ! } $board_config['sendmail_fix'] = 1; ! $result = @mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers); } } --- 239,274 ---- $empty_to_header = ($to == '') ? TRUE : FALSE; $to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to; ! ! $result = mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers); ! if (!$result && !$board_config['sendmail_fix'] && $empty_to_header) { $to = ' '; ! ! switch (PORTAL_BACKEND) { ! case 'phpbb2': ! ! $sql = "UPDATE " . CONFIG_TABLE . " ! SET config_value = '1' ! WHERE config_name = 'sendmail_fix'"; ! if (!$db->sql_query($sql)) ! { ! mx_message_die(GENERAL_ERROR, 'Unable to update config table', '', __LINE__, __FILE__, $sql); ! } ! break; ! ! case 'internal': ! case 'phpbb3': ! ! if (!$board_config['board_email']) ! { ! mx_message_die(GENERAL_ERROR, 'The is no default email adress configured were to notify the admin.', '', __LINE__, __FILE__, ''); ! } ! break; ! } $board_config['sendmail_fix'] = 1; ! $result = mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers); } } *************** *** 238,244 **** } ! // Encodes the given string for proper display for this encoding ... nabbed ! // from php.net and modified. There is an alternative encoding method which ! // may produce lesd output but it's questionable as to its worth in this // scenario IMO function encode($str) --- 283,289 ---- } ! // Encodes the given string for proper display for this encoding ... nabbed ! // from php.net and modified. There is an alternative encoding method which ! // may produce lesd output but it's questionable as to its worth in this // scenario IMO function encode($str) *************** *** 358,362 **** function encode_file($sourcefile) { ! if (is_readable($phpBB2->phpbb_realpath($sourcefile))) { $fd = fopen($sourcefile, "r"); --- 403,407 ---- function encode_file($sourcefile) { ! if (is_readable(realpath($sourcefile))) { $fd = fopen($sourcefile, "r"); |