mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-13 01:37:02 +02:00
Fixed issue #705
Change-Id: I602a88d24c2a482e6bebb5d6d7f4830843afec42 Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
@ -14,9 +14,9 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mime
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Decode.php 24593 2012-01-05 20:35:02Z matthew $
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -27,7 +27,7 @@ require_once 'Zend/Mime.php';
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Mime
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Mime_Decode
|
||||
@ -48,7 +48,7 @@ class Zend_Mime_Decode
|
||||
$body = str_replace("\r", '', $body);
|
||||
|
||||
$start = 0;
|
||||
$res = array();
|
||||
$res = array();
|
||||
// find every mime part limiter and cut out the
|
||||
// string before it.
|
||||
// the part before the first boundary string is discarded:
|
||||
@ -68,12 +68,13 @@ class Zend_Mime_Decode
|
||||
|
||||
// no more parts, find end boundary
|
||||
$p = strpos($body, '--' . $boundary . '--', $start);
|
||||
if ($p===false) {
|
||||
if ($p === false) {
|
||||
throw new Zend_Exception('Not a valid Mime Message: End Missing');
|
||||
}
|
||||
|
||||
// the remaining part also needs to be parsed:
|
||||
$res[] = substr($body, $start, $p-$start);
|
||||
$res[] = substr($body, $start, $p - $start);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -83,11 +84,13 @@ class Zend_Mime_Decode
|
||||
*
|
||||
* @param string $message raw message content
|
||||
* @param string $boundary boundary as found in content-type
|
||||
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
|
||||
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
|
||||
* @return array|null parts as array('header' => array(name => value), 'body' => content), null if no parts found
|
||||
* @throws Zend_Exception
|
||||
*/
|
||||
public static function splitMessageStruct($message, $boundary, $EOL = Zend_Mime::LINEEND)
|
||||
public static function splitMessageStruct(
|
||||
$message, $boundary, $EOL = Zend_Mime::LINEEND
|
||||
)
|
||||
{
|
||||
$parts = self::splitMime($message, $boundary);
|
||||
if (count($parts) <= 0) {
|
||||
@ -96,9 +99,12 @@ class Zend_Mime_Decode
|
||||
$result = array();
|
||||
foreach ($parts as $part) {
|
||||
self::splitMessage($part, $headers, $body, $EOL);
|
||||
$result[] = array('header' => $headers,
|
||||
'body' => $body );
|
||||
$result[] = array(
|
||||
'header' => $headers,
|
||||
'body' => $body
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -111,17 +117,28 @@ class Zend_Mime_Decode
|
||||
* @param string $message raw message with header and optional content
|
||||
* @param array $headers output param, array with headers as array(name => value)
|
||||
* @param string $body output param, content of message
|
||||
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
|
||||
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
|
||||
* @return null
|
||||
*/
|
||||
public static function splitMessage($message, &$headers, &$body, $EOL = Zend_Mime::LINEEND)
|
||||
public static function splitMessage(
|
||||
$message, &$headers, &$body, $EOL = Zend_Mime::LINEEND
|
||||
)
|
||||
{
|
||||
// check for valid header at first line
|
||||
$firstline = strtok($message, "\n");
|
||||
if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) {
|
||||
$headers = array();
|
||||
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r?
|
||||
$body = str_replace(array("\r", "\n"), array('', $EOL), $message);
|
||||
$body = str_replace(
|
||||
array(
|
||||
"\r",
|
||||
"\n"
|
||||
), array(
|
||||
'',
|
||||
$EOL
|
||||
), $message
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -129,20 +146,27 @@ class Zend_Mime_Decode
|
||||
// default is set new line
|
||||
if (strpos($message, $EOL . $EOL)) {
|
||||
list($headers, $body) = explode($EOL . $EOL, $message, 2);
|
||||
// next is the standard new line
|
||||
} else if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) {
|
||||
list($headers, $body) = explode("\r\n\r\n", $message, 2);
|
||||
// next is the other "standard" new line
|
||||
} else if ($EOL != "\n" && strpos($message, "\n\n")) {
|
||||
list($headers, $body) = explode("\n\n", $message, 2);
|
||||
// at last resort find anything that looks like a new line
|
||||
// next is the standard new line
|
||||
} else {
|
||||
@list($headers, $body) = @preg_split("%([\r\n]+)\\1%U", $message, 2);
|
||||
if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) {
|
||||
list($headers, $body) = explode("\r\n\r\n", $message, 2);
|
||||
// next is the other "standard" new line
|
||||
} else {
|
||||
if ($EOL != "\n" && strpos($message, "\n\n")) {
|
||||
list($headers, $body) = explode("\n\n", $message, 2);
|
||||
// at last resort find anything that looks like a new line
|
||||
} else {
|
||||
@list($headers, $body) =
|
||||
@preg_split("%([\r\n]+)\\1%U", $message, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$headers = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
|
||||
$headers = iconv_mime_decode_headers(
|
||||
$headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR
|
||||
);
|
||||
|
||||
if ($headers === false ) {
|
||||
if ($headers === false) {
|
||||
// an error occurs during the decoding
|
||||
return;
|
||||
}
|
||||
@ -162,7 +186,10 @@ class Zend_Mime_Decode
|
||||
$headers[$lower][] = $header;
|
||||
continue;
|
||||
}
|
||||
$headers[$lower] = array($headers[$lower], $header);
|
||||
$headers[$lower] = array(
|
||||
$headers[$lower],
|
||||
$header
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,20 +208,23 @@ class Zend_Mime_Decode
|
||||
/**
|
||||
* split a header field like content type in its different parts
|
||||
*
|
||||
* @param string $type header field
|
||||
* @param string $wantedPart the wanted part, else an array with all parts is returned
|
||||
* @param string $firstName key name for the first part
|
||||
* @return string|array wanted part or all parts as array($firstName => firstPart, partname => value)
|
||||
* @param string $field
|
||||
* @param string $wantedPart the wanted part, else an array with all parts is returned
|
||||
* @param int|string $firstName key name for the first part
|
||||
* @throws Zend_Exception
|
||||
* @return string|array wanted part or all parts as array($firstName => firstPart, partname => value)
|
||||
*/
|
||||
public static function splitHeaderField($field, $wantedPart = null, $firstName = 0)
|
||||
public static function splitHeaderField(
|
||||
$field, $wantedPart = null, $firstName = 0
|
||||
)
|
||||
{
|
||||
$wantedPart = strtolower($wantedPart);
|
||||
$firstName = strtolower($firstName);
|
||||
$firstName = strtolower($firstName);
|
||||
|
||||
// special case - a bit optimized
|
||||
if ($firstName === $wantedPart) {
|
||||
$field = strtok($field, ';');
|
||||
|
||||
return $field[0] == '"' ? substr($field, 1, -1) : $field;
|
||||
}
|
||||
|
||||
@ -211,8 +241,10 @@ class Zend_Mime_Decode
|
||||
if ($matches[2][$key][0] != '"') {
|
||||
return $matches[2][$key];
|
||||
}
|
||||
|
||||
return substr($matches[2][$key], 1, -1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -234,8 +266,8 @@ class Zend_Mime_Decode
|
||||
*
|
||||
* The charset of the returned string depends on your iconv settings.
|
||||
*
|
||||
* @param string encoded string
|
||||
* @return string decoded string
|
||||
* @param string $string Encoded string
|
||||
* @return string Decoded string
|
||||
*/
|
||||
public static function decodeQuotedPrintable($string)
|
||||
{
|
||||
|
@ -14,24 +14,23 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mime
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Zend_Exception
|
||||
*/
|
||||
require_once 'Zend/Exception.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Mime
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Mime_Exception extends Zend_Exception
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,11 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mime
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Message.php 24593 2012-01-05 20:35:02Z matthew $
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Zend_Mime
|
||||
*/
|
||||
@ -30,17 +29,26 @@ require_once 'Zend/Mime.php';
|
||||
*/
|
||||
require_once 'Zend/Mime/Part.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Mime
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Mime_Message
|
||||
{
|
||||
|
||||
/**
|
||||
* The Zend_Mime_Parts of the message
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_parts = array();
|
||||
|
||||
/**
|
||||
* The Zend_Mime object for the message
|
||||
*
|
||||
* @var Zend_Mime|null
|
||||
*/
|
||||
protected $_mime = null;
|
||||
|
||||
/**
|
||||
@ -134,7 +142,7 @@ class Zend_Mime_Message
|
||||
*/
|
||||
public function generateMessage($EOL = Zend_Mime::LINEEND)
|
||||
{
|
||||
if (! $this->isMultiPart()) {
|
||||
if (!$this->isMultiPart()) {
|
||||
$body = array_shift($this->_parts);
|
||||
$body = $body->getContent($EOL);
|
||||
} else {
|
||||
@ -146,9 +154,9 @@ class Zend_Mime_Message
|
||||
|
||||
foreach (array_keys($this->_parts) as $p) {
|
||||
$body .= $boundaryLine
|
||||
. $this->getPartHeaders($p, $EOL)
|
||||
. $EOL
|
||||
. $this->getPartContent($p, $EOL);
|
||||
. $this->getPartHeaders($p, $EOL)
|
||||
. $EOL
|
||||
. $this->getPartContent($p, $EOL);
|
||||
}
|
||||
|
||||
$body .= $mime->mimeEnd($EOL);
|
||||
@ -171,7 +179,8 @@ class Zend_Mime_Message
|
||||
/**
|
||||
* Get the headers of a given part as a string
|
||||
*
|
||||
* @param int $partnum
|
||||
* @param int $partnum
|
||||
* @param string $EOL
|
||||
* @return string
|
||||
*/
|
||||
public function getPartHeaders($partnum, $EOL = Zend_Mime::LINEEND)
|
||||
@ -182,7 +191,8 @@ class Zend_Mime_Message
|
||||
/**
|
||||
* Get the (encoded) content of a given part as a string
|
||||
*
|
||||
* @param int $partnum
|
||||
* @param int $partnum
|
||||
* @param string $EOL
|
||||
* @return string
|
||||
*/
|
||||
public function getPartContent($partnum, $EOL = Zend_Mime::LINEEND)
|
||||
@ -195,18 +205,19 @@ class Zend_Mime_Message
|
||||
*
|
||||
* Parts consist of the header and the body of each MIME part.
|
||||
*
|
||||
* @param string $body
|
||||
* @param string $boundary
|
||||
* @param string $body
|
||||
* @param string $boundary
|
||||
* @throws Zend_Exception
|
||||
* @return array
|
||||
*/
|
||||
protected static function _disassembleMime($body, $boundary)
|
||||
{
|
||||
$start = 0;
|
||||
$res = array();
|
||||
$res = array();
|
||||
// find every mime part limiter and cut out the
|
||||
// string before it.
|
||||
// the part before the first boundary string is discarded:
|
||||
$p = strpos($body, '--'.$boundary."\n", $start);
|
||||
$p = strpos($body, '--' . $boundary . "\n", $start);
|
||||
if ($p === false) {
|
||||
// no parts found!
|
||||
return array();
|
||||
@ -215,19 +226,21 @@ class Zend_Mime_Message
|
||||
// position after first boundary line
|
||||
$start = $p + 3 + strlen($boundary);
|
||||
|
||||
while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) {
|
||||
$res[] = substr($body, $start, $p-$start);
|
||||
while (($p = strpos($body, '--' . $boundary . "\n", $start))
|
||||
!== false) {
|
||||
$res[] = substr($body, $start, $p - $start);
|
||||
$start = $p + 3 + strlen($boundary);
|
||||
}
|
||||
|
||||
// no more parts, find end boundary
|
||||
$p = strpos($body, '--' . $boundary . '--', $start);
|
||||
if ($p===false) {
|
||||
if ($p === false) {
|
||||
throw new Zend_Exception('Not a valid Mime Message: End Missing');
|
||||
}
|
||||
|
||||
// the remaining part also needs to be parsed:
|
||||
$res[] = substr($body, $start, $p-$start);
|
||||
$res[] = substr($body, $start, $p - $start);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -235,12 +248,15 @@ class Zend_Mime_Message
|
||||
* Decodes a MIME encoded string and returns a Zend_Mime_Message object with
|
||||
* all the MIME parts set according to the given string
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $boundary
|
||||
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
|
||||
* @param string $message
|
||||
* @param string $boundary
|
||||
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
|
||||
* @throws Zend_Exception
|
||||
* @return Zend_Mime_Message
|
||||
*/
|
||||
public static function createFromMessage($message, $boundary, $EOL = Zend_Mime::LINEEND)
|
||||
public static function createFromMessage(
|
||||
$message, $boundary, $EOL = Zend_Mime::LINEEND
|
||||
)
|
||||
{
|
||||
require_once 'Zend/Mime/Decode.php';
|
||||
$parts = Zend_Mime_Decode::splitMessageStruct($message, $boundary, $EOL);
|
||||
@ -253,7 +269,7 @@ class Zend_Mime_Message
|
||||
/**
|
||||
* @todo check for characterset and filename
|
||||
*/
|
||||
switch(strtolower($key)) {
|
||||
switch (strtolower($key)) {
|
||||
case 'content-type':
|
||||
$newPart->type = $value;
|
||||
break;
|
||||
@ -261,7 +277,7 @@ class Zend_Mime_Message
|
||||
$newPart->encoding = $value;
|
||||
break;
|
||||
case 'content-id':
|
||||
$newPart->id = trim($value,'<>');
|
||||
$newPart->id = trim($value, '<>');
|
||||
break;
|
||||
case 'content-disposition':
|
||||
$newPart->disposition = $value;
|
||||
@ -276,11 +292,14 @@ class Zend_Mime_Message
|
||||
$newPart->language = $value;
|
||||
break;
|
||||
default:
|
||||
throw new Zend_Exception('Unknown header ignored for MimePart:' . $key);
|
||||
throw new Zend_Exception(
|
||||
'Unknown header ignored for MimePart:' . $key
|
||||
);
|
||||
}
|
||||
}
|
||||
$res->addPart($newPart);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,9 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mime
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Part.php 24593 2012-01-05 20:35:02Z matthew $
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -29,31 +29,100 @@ require_once 'Zend/Mime.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mime
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Mime_Part {
|
||||
class Zend_Mime_Part
|
||||
{
|
||||
|
||||
/**
|
||||
* Type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = Zend_Mime::TYPE_OCTETSTREAM;
|
||||
public $encoding = Zend_Mime::ENCODING_8BIT;
|
||||
public $id;
|
||||
public $disposition;
|
||||
public $filename;
|
||||
public $description;
|
||||
public $charset;
|
||||
public $boundary;
|
||||
public $location;
|
||||
public $language;
|
||||
protected $_content;
|
||||
protected $_isStream = false;
|
||||
|
||||
/**
|
||||
* Encoding
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $encoding = Zend_Mime::ENCODING_8BIT;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Disposition
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $disposition;
|
||||
|
||||
/**
|
||||
* Filename
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $filename;
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* Character set
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $charset;
|
||||
|
||||
/**
|
||||
* Boundary
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $boundary;
|
||||
|
||||
/**
|
||||
* Location
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $location;
|
||||
|
||||
/**
|
||||
* Language
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $language;
|
||||
|
||||
/**
|
||||
* Content
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $_content;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isStream = false;
|
||||
|
||||
/**
|
||||
* create a new Mime Part.
|
||||
* The (unencoded) content of the Part as passed
|
||||
* as a string or stream
|
||||
*
|
||||
* @param mixed $content String or Stream containing the content
|
||||
* @param mixed $content String or Stream containing the content
|
||||
*/
|
||||
public function __construct($content)
|
||||
{
|
||||
@ -79,21 +148,23 @@ class Zend_Mime_Part {
|
||||
*/
|
||||
public function isStream()
|
||||
{
|
||||
return $this->_isStream;
|
||||
return $this->_isStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* if this was created with a stream, return a filtered stream for
|
||||
* reading the content. very useful for large file attachments.
|
||||
*
|
||||
* @return stream
|
||||
* @return mixed Stream
|
||||
* @throws Zend_Mime_Exception if not a stream or unable to append filter
|
||||
*/
|
||||
public function getEncodedStream()
|
||||
{
|
||||
if (!$this->_isStream) {
|
||||
require_once 'Zend/Mime/Exception.php';
|
||||
throw new Zend_Mime_Exception('Attempt to get a stream from a string part');
|
||||
throw new Zend_Mime_Exception(
|
||||
'Attempt to get a stream from a string part'
|
||||
);
|
||||
}
|
||||
|
||||
//stream_filter_remove(); // ??? is that right?
|
||||
@ -110,9 +181,12 @@ class Zend_Mime_Part {
|
||||
);
|
||||
if (!is_resource($filter)) {
|
||||
require_once 'Zend/Mime/Exception.php';
|
||||
throw new Zend_Mime_Exception('Failed to append quoted-printable filter');
|
||||
throw new Zend_Mime_Exception(
|
||||
'Failed to append quoted-printable filter'
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case Zend_Mime::ENCODING_BASE64:
|
||||
$filter = stream_filter_append(
|
||||
$this->_content,
|
||||
@ -125,18 +199,24 @@ class Zend_Mime_Part {
|
||||
);
|
||||
if (!is_resource($filter)) {
|
||||
require_once 'Zend/Mime/Exception.php';
|
||||
throw new Zend_Mime_Exception('Failed to append base64 filter');
|
||||
throw new Zend_Mime_Exception(
|
||||
'Failed to append base64 filter'
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
|
||||
return $this->_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Content of the current Mime Part in the given encoding.
|
||||
*
|
||||
* @return String
|
||||
* @param string $EOL Line end; defaults to {@link Zend_Mime::LINEEND}
|
||||
* @throws Zend_Mime_Exception
|
||||
* @return string
|
||||
*/
|
||||
public function getContent($EOL = Zend_Mime::LINEEND)
|
||||
{
|
||||
@ -146,9 +226,10 @@ class Zend_Mime_Part {
|
||||
return Zend_Mime::encode($this->_content, $this->encoding, $EOL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the RAW unencoded content from this part
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawContent()
|
||||
@ -163,7 +244,7 @@ class Zend_Mime_Part {
|
||||
/**
|
||||
* Create and return the array of headers for this MIME part
|
||||
*
|
||||
* @access public
|
||||
* @param string $EOL Line end; defaults to {@link Zend_Mime::LINEEND}
|
||||
* @return array
|
||||
*/
|
||||
public function getHeadersArray($EOL = Zend_Mime::LINEEND)
|
||||
@ -177,17 +258,26 @@ class Zend_Mime_Part {
|
||||
|
||||
if ($this->boundary) {
|
||||
$contentType .= ';' . $EOL
|
||||
. " boundary=\"" . $this->boundary . '"';
|
||||
. " boundary=\"" . $this->boundary . '"';
|
||||
}
|
||||
|
||||
$headers[] = array('Content-Type', $contentType);
|
||||
$headers[] = array(
|
||||
'Content-Type',
|
||||
$contentType
|
||||
);
|
||||
|
||||
if ($this->encoding) {
|
||||
$headers[] = array('Content-Transfer-Encoding', $this->encoding);
|
||||
$headers[] = array(
|
||||
'Content-Transfer-Encoding',
|
||||
$this->encoding
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->id) {
|
||||
$headers[] = array('Content-ID', '<' . $this->id . '>');
|
||||
$headers[] = array(
|
||||
'Content-ID',
|
||||
'<' . $this->id . '>'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->disposition) {
|
||||
@ -195,19 +285,31 @@ class Zend_Mime_Part {
|
||||
if ($this->filename) {
|
||||
$disposition .= '; filename="' . $this->filename . '"';
|
||||
}
|
||||
$headers[] = array('Content-Disposition', $disposition);
|
||||
$headers[] = array(
|
||||
'Content-Disposition',
|
||||
$disposition
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->description) {
|
||||
$headers[] = array('Content-Description', $this->description);
|
||||
$headers[] = array(
|
||||
'Content-Description',
|
||||
$this->description
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->location) {
|
||||
$headers[] = array('Content-Location', $this->location);
|
||||
$headers[] = array(
|
||||
'Content-Location',
|
||||
$this->location
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->language){
|
||||
$headers[] = array('Content-Language', $this->language);
|
||||
if ($this->language) {
|
||||
$headers[] = array(
|
||||
'Content-Language',
|
||||
$this->language
|
||||
);
|
||||
}
|
||||
|
||||
return $headers;
|
||||
@ -216,7 +318,8 @@ class Zend_Mime_Part {
|
||||
/**
|
||||
* Return the headers for this part as a string
|
||||
*
|
||||
* @return String
|
||||
* @param string $EOL Line end; defaults to {@link Zend_Mime::LINEEND}
|
||||
* @return string
|
||||
*/
|
||||
public function getHeaders($EOL = Zend_Mime::LINEEND)
|
||||
{
|
||||
|
Reference in New Issue
Block a user