Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: class_mailhandler.php 3855 2008-05-20 14:08:16Z Tikitiki $
| * $Id: class_mailhandler.php 4098 2008-08-10 03:18:01Z chris $
|
*/
/**
| */
/**
|
Zeile 95 | Zeile 95 |
---|
{ global $parser, $lang, $mybb;
|
{ global $parser, $lang, $mybb;
|
$this->headers = preg_replace("#(\r\n|\r|\n)#s", $this->delimiter, $this->headers); $this->message = preg_replace("#(\r\n|\r|\n)#s", $this->delimiter, $this->message);
| $this->message = '';
|
$this->headers = $headers;
if($from)
| $this->headers = $headers;
if($from)
|
Zeile 144 | Zeile 142 |
---|
function set_message($message, $message_text="") { if($this->parse_format == "html" || $this->parse_format == "both")
|
function set_message($message, $message_text="") { if($this->parse_format == "html" || $this->parse_format == "both")
|
{
| {
|
$this->set_html_headers($message, $message_text); } else
| $this->set_html_headers($message, $message_text); } else
|
Zeile 152 | Zeile 150 |
---|
$this->message = $message; $this->set_plain_headers(); }
|
$this->message = $message; $this->set_plain_headers(); }
|
}
| }
|
/** * Sets and formats the email subject.
|
/** * Sets and formats the email subject.
|
*
| *
|
* @param string subject */ function set_subject($subject) { $this->subject = $this->cleanup($subject);
|
* @param string subject */ function set_subject($subject) { $this->subject = $this->cleanup($subject);
|
| $this->subject = $this->utf8_encode($subject);
|
}
/** * Sets and formats the recipient address. * * @param string to
|
}
/** * Sets and formats the recipient address. * * @param string to
|
*/
| */
|
function set_to($to) { $to = $this->cleanup($to);
| function set_to($to) { $to = $this->cleanup($to);
|
Zeile 191 | Zeile 190 |
---|
*/ function set_html_headers($message, $message_text="") {
|
*/ function set_html_headers($message, $message_text="") {
|
if(!$message_text)
| if(!$message_text && $this->parse_format == 'both')
|
{ $message_text = strip_tags($message); }
|
{ $message_text = strip_tags($message); }
|
$mime_boundary = "=_NextPart".md5(TIME_NOW);
$this->headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"{$this->delimiter}"; $this->message = "This is a multi-part message in MIME format.{$this->delimiter}{$this->delimiter}";
$this->message .= "--{$mime_boundary}{$this->delimiter}"; $this->message .= "Content-Type: text/plain; charset=\"{$this->charset}\"{$this->delimiter}"; $this->message .= "Content-Transfer-Encoding: 8bit{$this->delimiter}{$this->delimiter}"; $this->message .= $message_text."{$this->delimiter}{$this->delimiter}"; $this->message .= "--{$mime_boundary}{$this->delimiter}{$this->delimiter}"; $this->message .= "Content-Type: text/html; charset=\"{$this->charset}\"{$this->delimiter}"; $this->message .= "Content-Transfer-Encoding: 8bit{$this->delimiter}{$this->delimiter}"; $this->message .= $message."{$this->delimiter}{$this->delimiter}"; $this->message .= "--{$mime_boundary}--{$this->delimiter}{$this->delimiter}"; }
| if($this->parse_format == 'both') { $mime_boundary = "=_NextPart".md5(TIME_NOW);
$this->headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"{$this->delimiter}"; $this->message = "This is a multi-part message in MIME format.{$this->delimiter}{$this->delimiter}";
$this->message .= "--{$mime_boundary}{$this->delimiter}"; $this->message .= "Content-Type: text/plain; charset=\"{$this->charset}\"{$this->delimiter}"; $this->message .= "Content-Transfer-Encoding: 8bit{$this->delimiter}{$this->delimiter}"; $this->message .= $message_text."{$this->delimiter}{$this->delimiter}";
$this->message .= "--{$mime_boundary}{$this->delimiter}";
$this->message .= "Content-Type: text/html; charset=\"{$this->charset}\"{$this->delimiter}"; $this->message .= "Content-Transfer-Encoding: 8bit{$this->delimiter}{$this->delimiter}"; $this->message .= $message."{$this->delimiter}{$this->delimiter}";
$this->message .= "--{$mime_boundary}--{$this->delimiter}{$this->delimiter}"; } else { $this->headers .= "Content-Type: text/html; charset=\"{$this->charset}\"{$this->delimiter}"; $this->headers .= "Content-Transfer-Encoding: 8bit{$this->delimiter}{$this->delimiter}"; $this->message = $message."{$this->delimiter}{$this->delimiter}"; } }
|
/** * Sets the common headers.
| /** * Sets the common headers.
|
Zeile 224 | Zeile 232 |
---|
// Build mail headers if(!trim($this->from)) {
|
// Build mail headers if(!trim($this->from)) {
|
$this->from = "\"{$mybb->settings['bbname']}\" <{$mybb->settings['adminemail']}>";
| $this->from = '"'.$this->utf8_encode($mybb->settings['bbname'].'"'); $this->from .= " <{$mybb->settings['adminemail']}>";
|
}
$this->headers .= "From: {$this->from}{$this->delimiter}"; if($mybb->settings['returnemail'])
|
}
$this->headers .= "From: {$this->from}{$this->delimiter}"; if($mybb->settings['returnemail'])
|
{
| {
|
$this->headers .= "Return-Path: {$mybb->settings['returnemail']}{$this->delimiter}";
|
$this->headers .= "Return-Path: {$mybb->settings['returnemail']}{$this->delimiter}";
|
$this->headers .= "Reply-To: {$mybb->settings['adminemail']}{$this->delimiter}"; }
| $this->headers .= "Reply-To: {$mybb->settings['adminemail']}{$this->delimiter}"; }
|
else { $this->headers .= "Return-Path: {$mybb->settings['adminemail']}{$this->delimiter}"; $this->headers .= "Reply-To: {$mybb->settings['adminemail']}{$this->delimiter}";
|
else { $this->headers .= "Return-Path: {$mybb->settings['adminemail']}{$this->delimiter}"; $this->headers .= "Reply-To: {$mybb->settings['adminemail']}{$this->delimiter}";
|
}
| }
|
if(isset($_SERVER['SERVER_NAME'])) { $http_host = $_SERVER['SERVER_NAME']; } else if(isset($_SERVER['HTTP_HOST']))
|
if(isset($_SERVER['SERVER_NAME'])) { $http_host = $_SERVER['SERVER_NAME']; } else if(isset($_SERVER['HTTP_HOST']))
|
{
| {
|
$http_host = $_SERVER['HTTP_HOST']; } else
| $http_host = $_SERVER['HTTP_HOST']; } else
|
Zeile 254 | Zeile 263 |
---|
}
$msg_id = md5(uniqid(TIME_NOW)) . "@" . $http_host;
|
}
$msg_id = md5(uniqid(TIME_NOW)) . "@" . $http_host;
|
|
|
$this->headers .= "Message-ID: <{$msg_id}>{$this->delimiter}"; $this->headers .= "Content-Transfer-Encoding: 8bit{$this->delimiter}"; $this->headers .= "X-Priority: 3{$this->delimiter}";
| $this->headers .= "Message-ID: <{$msg_id}>{$this->delimiter}"; $this->headers .= "Content-Transfer-Encoding: 8bit{$this->delimiter}"; $this->headers .= "X-Priority: 3{$this->delimiter}";
|
Zeile 264 | Zeile 273 |
---|
{ $_SERVER['PHP_SELF'] = str_replace($mybb->config['admin_dir']."/", "admin-", $_SERVER['PHP_SELF']); }
|
{ $_SERVER['PHP_SELF'] = str_replace($mybb->config['admin_dir']."/", "admin-", $_SERVER['PHP_SELF']); }
|
$this->headers .= "X-MyBB-Script: {$http_host}{$_SERVER['PHP_SELF']}{$this->delimeter}";
| $this->headers .= "X-MyBB-Script: {$http_host}{$_SERVER['PHP_SELF']}{$this->delimiter}";
|
$this->headers .= "MIME-Version: 1.0{$this->delimiter}"; }
| $this->headers .= "MIME-Version: 1.0{$this->delimiter}"; }
|
Zeile 304 | Zeile 313 |
---|
$string = str_replace(array("\r", "\n", "\r\n"), "", $string); $string = trim($string); return $string;
|
$string = str_replace(array("\r", "\n", "\r\n"), "", $string); $string = trim($string); return $string;
|
| } /** * Encode a string based on the character set enabled. Used to encode subjects * and recipients in email messages going out so that they show up correctly * in email clients. * * @param string The string to be encoded. * @return string The encoded string. */ function utf8_encode($string) { $encoded_string = $string; if(strtolower($this->charset) == 'utf-8' && preg_match('/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff]/', $string)) { // Define start delimimter, end delimiter and spacer $end = "?="; $start = "=?" . $this->charset . "?B?"; $spacer = $end . ' ' . $start;
// Determine length of encoded text within chunks and ensure length is even (should NOT use the my_strlen functions) $length = 75 - strlen($start) - strlen($end); $length = floor($length/4) * 4;
// Encode the string and split it into chunks with spacers after each chunk $encoded_string = base64_encode($encoded_string); $encoded_string = chunk_split($encoded_string, $length, $spacer);
// Remove trailing spacer and add start and end delimiters $spacer = preg_quote($spacer); $encoded_string = preg_replace("/" . $spacer . "$/", "", $encoded_string); $encoded_string = $start . $encoded_string . $end; } return $encoded_string;
|
} } ?>
| } } ?>
|