gui fixes

Change-Id: I5592a96f486f64404f044b2199e74284fd2e46fd
Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
SJ
2016-09-15 22:08:04 +02:00
parent 338571d299
commit 91fbeebc0f
4 changed files with 69 additions and 54 deletions

View File

@ -92,6 +92,10 @@ class Zend_Mail_Protocol_Imap
$errno = 0;
$errstr = '';
/*
* http://stackoverflow.com/questions/32211301/ssl-error-ssl3-get-server-certificatecertificate-verify-failed
*/
$contextOptions = array(
'ssl' => array(
'verify_peer' => false,

View File

@ -124,43 +124,7 @@ class Zend_Mime_Decode
$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
);
return;
}
// find an empty line between headers and body
// 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
} else {
@list($headers, $body) =
@preg_split("%([\r\n]+)\\1%U", $message, 2);
}
}
}
self::splitMessageRaw($message, $headers, $body, $EOL);
$headers = iconv_mime_decode_headers(
$headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR
@ -273,4 +237,53 @@ class Zend_Mime_Decode
{
return quoted_printable_decode($string);
}
/**
cut the original splitMessage() function to get the raw headers, SJ
*/
public static function splitMessageRaw(
$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
);
return;
}
// find an empty line between headers and body
// 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
} else {
@list($headers, $body) =
@preg_split("%([\r\n]+)\\1%U", $message, 2);
}
}
}
}
}