Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/utility/email_send.php
Show First 20 Lines • Show All 1952 Lines • ▼ Show 20 Line(s) | |||||
$value .= ', '; | $value .= ', '; | ||||
} | } | ||||
$value .= $this->QuotedPrintableEncode($name, $this->charset) . ' <' . $email . '>'; | $value .= $this->QuotedPrintableEncode($name, $this->charset) . ' <' . $email . '>'; | ||||
$this->SetHeader($header_name, $value); | $this->SetHeader($header_name, $value); | ||||
} | } | ||||
/** | /** | ||||
* Returns list of recipients from given header. | |||||
* | |||||
* @param string $header_name Header name. | |||||
* | |||||
* @return array | |||||
*/ | |||||
public function GetRecipientsByHeader($header_name) | |||||
{ | |||||
if ( !isset($this->headers[$header_name]) ) { | |||||
return array(); | |||||
} | |||||
$decoded_header = $this->decodeHeader($this->headers[$header_name]); | |||||
$recipients = $this->GetRecipients($decoded_header); | |||||
if ( $recipients === false ) { | |||||
return array(); | |||||
} | |||||
return $recipients; | |||||
} | |||||
/** | |||||
* Decodes header value. | |||||
* | |||||
* @param string $header_value Header value. | |||||
* | |||||
* @return string | |||||
*/ | |||||
protected function decodeHeader($header_value) | |||||
{ | |||||
while ( preg_match('/(=\?([^?]+)\?(Q|B)\?([^?]*)\?=)/i', $header_value, $matches) ) { | |||||
$encoded = $matches[1]; | |||||
$charset = $matches[2]; | |||||
$encoding = $matches[3]; | |||||
$text = $matches[4]; | |||||
switch ( strtoupper($encoding) ) { | |||||
case 'B': | |||||
$text = base64_decode($text); | |||||
break; | |||||
case 'Q': | |||||
$text = str_replace('_', ' ', $text); | |||||
preg_match_all('/=([a-f0-9]{2})/i', $text, $matches); | |||||
foreach ( $matches[1] as $value ) { | |||||
$text = str_replace('=' . $value, chr(hexdec($value)), $text); | |||||
} | |||||
break; | |||||
} | |||||
$header_value = mb_convert_encoding( | |||||
str_replace($encoded, $text, $header_value), | |||||
$this->charset, | |||||
$charset | |||||
); | |||||
} | |||||
return $header_value; | |||||
} | |||||
/** | |||||
* Sets "Subject" header. | * Sets "Subject" header. | ||||
* | * | ||||
* @param string $subject message subject | * @param string $subject message subject | ||||
*/ | */ | ||||
function SetSubject($subject) | function SetSubject($subject) | ||||
{ | { | ||||
$this->setEncodedHeader('Subject', $subject); | $this->setEncodedHeader('Subject', $subject); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Line(s) | |||||
* @param string $log_data | * @param string $log_data | ||||
* @return void | * @return void | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function setLogData($log_data) | public function setLogData($log_data) | ||||
{ | { | ||||
$this->_logData = $log_data; | $this->_logData = $log_data; | ||||
} | } | ||||
} | } | ||||
No newline at end of file |