|
From: Paul S. O. <ps...@us...> - 2002-06-10 01:51:37
|
Update of /cvsroot/phpbb/phpBB2/includes
In directory usw-pr-cvs1:/tmp/cvs-serv7520/includes
Modified Files:
emailer.php
Log Message:
Updates in line with 2.0.1
Index: emailer.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/emailer.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** emailer.php 20 Apr 2002 00:22:28 -0000 1.16
--- emailer.php 10 Jun 2002 01:51:35 -0000 1.17
***************
*** 39,44 ****
$this->tpl_file = NULL;
$this->address = NULL;
! $this->msg = "";
! $this->mimeOut = "";
}
--- 39,44 ----
$this->tpl_file = NULL;
$this->address = NULL;
! $this->msg = '';
! $this->mimeOut = '';
}
***************
*** 48,56 ****
function reset()
{
! $this->tpl_file = "";
! $this->address = "";
! $this->msg = "";
! $this->memOut = "";
! $this->vars = "";
}
--- 48,56 ----
function reset()
{
! $this->tpl_file = '';
! $this->address = '';
! $this->msg = '';
! $this->memOut = '';
! $this->vars = '';
}
***************
*** 60,70 ****
function email_address($address)
{
-
- $success = true;
-
$this->address = '';
$this->address .= $address;
-
- return $success;
}
--- 60,65 ----
***************
*** 85,112 ****
}
! function use_template($template_file, $template_lang = "")
{
global $board_config, $phpbb_root_path;
! if( $template_lang == "" )
{
$template_lang = $board_config['default_lang'];
}
! $template_file = $phpbb_root_path . "language/lang_" . $template_lang . "/email/" . $template_file . ".tpl";
! if( !file_exists($template_file) )
{
! message_die(GENERAL_ERROR, "Couldn't find template file: $template_file", "", __LINE__, __FILE__);
}
! else
{
! $this->tpl_file = $template_file;
! if( !$this->load_msg() )
! {
! message_die(GENERAL_ERROR, "Couldn't load template file: $template_file", "", __LINE__, __FILE__);
! }
}
! return TRUE;
}
--- 80,104 ----
}
! function use_template($template_file, $template_lang = '')
{
global $board_config, $phpbb_root_path;
! if ( $template_lang == '' )
{
$template_lang = $board_config['default_lang'];
}
! $this->tpl_file = $phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl';
! if ( !file_exists($this->tpl_file) )
{
! message_die(GENERAL_ERROR, 'Could not find email template file ' . $template_file, '', __LINE__, __FILE__);
}
!
! if ( !$this->load_msg() )
{
! message_die(GENERAL_ERROR, 'Could not load email template file ' . $template_file, '', __LINE__, __FILE__);
}
! return true;
}
***************
*** 116,148 ****
function load_msg()
{
! if ($this->tpl_file == NULL)
{
! message_die(GENERAL_ERROR, "No template file set", "", __LINE__, __FILE__);
}
! else
{
! if(!($fd = fopen($this->tpl_file, 'r')))
! {
! message_die(GENERAL_ERROR, "fopen failed opening template file", "", __LINE__, __FILE__);
! }
! else
! {
! $this->msg .= fread($fd, filesize($this->tpl_file));
! fclose($fd);
! }
}
! return TRUE;
}
function assign_vars($vars)
{
! if(empty($this->vars))
! {
! $this->vars = $vars;
! }
! else
! {
! $this->vars .= $vars;
! }
}
--- 108,130 ----
function load_msg()
{
! if ( $this->tpl_file == NULL )
{
! message_die(GENERAL_ERROR, 'No template file set', '', __LINE__, __FILE__);
}
!
! if ( !($fd = fopen($this->tpl_file, 'r')) )
{
! message_die(GENERAL_ERROR, 'Failed opening template file', '', __LINE__, __FILE__);
}
!
! $this->msg .= fread($fd, filesize($this->tpl_file));
! fclose($fd);
!
! return true;
}
function assign_vars($vars)
{
! $this->vars = ( empty($this->vars) ) ? $vars : $this->vars . $vars;
}
***************
*** 166,175 ****
//
$match = array();
! preg_match("/^(Subject:(.*?)[\r\n]+?)?(.*?)$/is", $this->msg, $match);
! $this->msg = ( isset($match[3]) ) ? trim($match[3]) : '';
$this->subject = ( $this->subject != '' ) ? $this->subject : trim($match[2]);
! return TRUE;
}
--- 148,158 ----
//
$match = array();
! preg_match("/^(Subject:(.*?)[\r\n]+?)?(Charset:(.*?)[\r\n]+?)?(.*?)$/is", $this->msg, $match);
! $this->msg = ( isset($match[5]) ) ? trim($match[5]) : '';
$this->subject = ( $this->subject != '' ) ? $this->subject : trim($match[2]);
+ $this->encoding = ( trim($match[4]) != '' ) ? trim($match[4]) : 'iso-8859-1';
! return true;
}
***************
*** 181,223 ****
global $phpEx, $phpbb_root_path;
! if ($this->address == NULL)
{
! message_die(GENERAL_ERROR, "No email address set", "", __LINE__, __FILE__);
}
! else
{
! if(!$this->parse_email())
! {
! return FALSE;
! }
! if($this->use_smtp)
! {
! if(!defined('SMTP_INCLUDED'))
! {
! include($phpbb_root_path . "includes/smtp.".$phpEx);
! }
! if(!smtpmail($this->address, $this->subject, $this->msg, $this->extra_headers))
! {
! message_die(GENERAL_ERROR, "Sending via SMTP failed", "", __LINE__, __FILE__);
! }
! }
! else
{
! @mail($this->address, $this->subject, $this->msg, $this->extra_headers);
}
}
! return TRUE;
}
//
! // Attach files via MIME.
//
! function attachFile($filename, $mimetype="application/octet-stream", $szFromAddress, $szFilenameToDisplay)
{
$mime_boundary = "--==================_846811060==_";
! $this->mailMsg = "--".$mime_boundary."\nContent-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n\n".$this->mailMsg;
if ($mime_filename)
--- 164,214 ----
global $phpEx, $phpbb_root_path;
! if ( $this->address == NULL )
{
! message_die(GENERAL_ERROR, 'No email address set', '', __LINE__, __FILE__);
}
!
! if ( !$this->parse_email() )
{
! return false;
! }
!
! //
! // Add date and encoding type
! //
! $universal_extra = "MIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . gmdate('D, d M Y H:i:s', time()) . " UT\n";
! $this->extra_headers = $universal_extra . $this->extra_headers;
!
! if ( $this->use_smtp )
! {
! if ( !defined('SMTP_INCLUDED') )
{
! include($phpbb_root_path . 'includes/smtp.' . $phpEx);
}
+
+ $result = smtpmail($this->address, $this->subject, $this->msg, $this->extra_headers);
+ }
+ else
+ {
+ $result = @mail($this->address, $this->subject, $this->msg, $this->extra_headers);
+ }
+
+ if ( !$result )
+ {
+ message_die(GENERAL_ERROR, 'Failed sending email', '', __LINE__, __FILE__);
}
! return true;
}
//
! // Attach files via MIME.
//
! function attachFile($filename, $mimetype = "application/octet-stream", $szFromAddress, $szFilenameToDisplay)
{
$mime_boundary = "--==================_846811060==_";
! $this->mailMsg = '--' . $mime_boundary . "\nContent-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n\n" . $this->mailMsg;
if ($mime_filename)
***************
*** 235,243 ****
$this->mimeOut .= "Content-Disposition: attachment;\n\tfilename=\"$szFilenameToDisplay\"\n\n";
! if ($mimetype == "message/rfc822")
{
$this->mimeOut .= "From: ".$szFromAddress."\n";
$this->mimeOut .= "To: ".$this->emailAddress."\n";
! $this->mimeOut .= "Date: ".date("D, d M Y G:i:s ").$this->getTimeZoneInEmailFormat()."\n";
$this->mimeOut .= "Reply-To:".$szFromAddress."\n";
$this->mimeOut .= "Subject: ".$this->mailSubject."\n";
--- 226,234 ----
$this->mimeOut .= "Content-Disposition: attachment;\n\tfilename=\"$szFilenameToDisplay\"\n\n";
! if ( $mimetype == "message/rfc822" )
{
$this->mimeOut .= "From: ".$szFromAddress."\n";
$this->mimeOut .= "To: ".$this->emailAddress."\n";
! $this->mimeOut .= "Date: ".date("D, d M Y H:i:s") . " UT\n";
$this->mimeOut .= "Reply-To:".$szFromAddress."\n";
$this->mimeOut .= "Subject: ".$this->mailSubject."\n";
|