[Web] Prepare for oauth2
[Web] Some lib updates [Web] Allow to add a footer
This commit is contained in:
@@ -21,11 +21,12 @@ This extension can be used to...
|
||||
|
||||
Yes. All known issues have been reproduced, fixed and tested.
|
||||
|
||||
We use Travis CI to help ensure code quality. You can see real-time statistics below:
|
||||
We use GitHub Actions, Codecov, Codacy to help ensure code quality. You can see real-time statistics below:
|
||||
|
||||
[](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/results/php-mime-mail-parser/php-mime-mail-parser)
|
||||
[](https://codecov.io/gh/php-mime-mail-parser/php-mime-mail-parser)
|
||||
[](https://app.codacy.com/app/php-mime-mail-parser/php-mime-mail-parser)
|
||||
|
||||
[](https://travis-ci.com/php-mime-mail-parser/php-mime-mail-parser)
|
||||
[](https://coveralls.io/r/php-mime-mail-parser/php-mime-mail-parser)
|
||||
[](https://scrutinizer-ci.com/g/php-mime-mail-parser/php-mime-mail-parser)
|
||||
|
||||
## How do I install it?
|
||||
|
||||
|
10
data/web/inc/lib/vendor/php-mime-mail-parser/php-mime-mail-parser/compile_mailparse.sh
vendored
Executable file
10
data/web/inc/lib/vendor/php-mime-mail-parser/php-mime-mail-parser/compile_mailparse.sh
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
git clone https://github.com/php/pecl-mail-mailparse.git
|
||||
cd pecl-mail-mailparse
|
||||
phpize
|
||||
./configure
|
||||
sed -i 's/#if\s!HAVE_MBSTRING/#ifndef MBFL_MBFILTER_H/' ./mailparse.c
|
||||
make
|
||||
sudo mv modules/mailparse.so /home/travis/.phpenv/versions/7.3.2/lib/php/extensions/no-debug-zts-20180731/
|
||||
echo 'extension=mailparse.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace PhpMimeMailParser;
|
||||
|
||||
use function var_dump;
|
||||
|
||||
/**
|
||||
* Attachment of php-mime-mail-parser
|
||||
*
|
||||
@@ -237,7 +239,9 @@ class Attachment
|
||||
// Determine filename
|
||||
switch ($filenameStrategy) {
|
||||
case Parser::ATTACHMENT_RANDOM_FILENAME:
|
||||
$attachment_path = tempnam($attach_dir, '');
|
||||
$fileInfo = pathinfo($this->getFilename());
|
||||
$extension = empty($fileInfo['extension']) ? '' : '.'.$fileInfo['extension'];
|
||||
$attachment_path = $attach_dir.uniqid().$extension;
|
||||
break;
|
||||
case Parser::ATTACHMENT_DUPLICATE_THROW:
|
||||
case Parser::ATTACHMENT_DUPLICATE_SUFFIX:
|
||||
|
@@ -326,7 +326,7 @@ class Charset implements CharsetManager
|
||||
return mb_convert_encoding($encodedString, 'utf-8', 'iso-2022-jp-ms');
|
||||
}
|
||||
|
||||
if (array_search($charset, array_map('strtolower', mb_list_encodings()))) {
|
||||
if (array_search($charset, $this->getSupportedEncodings())) {
|
||||
return mb_convert_encoding($encodedString, 'utf-8', $charset);
|
||||
}
|
||||
}
|
||||
@@ -347,4 +347,24 @@ class Charset implements CharsetManager
|
||||
|
||||
return 'us-ascii';
|
||||
}
|
||||
|
||||
private function getSupportedEncodings()
|
||||
{
|
||||
return
|
||||
array_map(
|
||||
'strtolower',
|
||||
array_unique(
|
||||
array_merge(
|
||||
$enc = mb_list_encodings(),
|
||||
call_user_func_array(
|
||||
'array_merge',
|
||||
array_map(
|
||||
"mb_encoding_aliases",
|
||||
$enc
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -84,9 +84,9 @@ class MimePart implements \ArrayAccess
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
$this->part[] = $value;
|
||||
} else {
|
||||
$this->part[$offset] = $value;
|
||||
return;
|
||||
}
|
||||
$this->part[$offset] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -268,7 +268,7 @@ class Parser
|
||||
{
|
||||
if (isset($this->parts[1])) {
|
||||
$headers = $this->getPart('headers', $this->parts[1]);
|
||||
foreach ($headers as $name => &$value) {
|
||||
foreach ($headers as &$value) {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as &$v) {
|
||||
$v = $this->decodeSingleHeader($v);
|
||||
@@ -514,20 +514,17 @@ class Parser
|
||||
|
||||
if (isset($part['disposition-filename'])) {
|
||||
$filename = $this->decodeHeader($part['disposition-filename']);
|
||||
// Escape all potentially unsafe characters from the filename
|
||||
$filename = preg_replace('((^\.)|\/|(\.$))', '_', $filename);
|
||||
} elseif (isset($part['content-name'])) {
|
||||
// if we have no disposition but we have a content-name, it's a valid attachment.
|
||||
// we simulate the presence of an attachment disposition with a disposition filename
|
||||
$filename = $this->decodeHeader($part['content-name']);
|
||||
// Escape all potentially unsafe characters from the filename
|
||||
$filename = preg_replace('((^\.)|\/|(\.$))', '_', $filename);
|
||||
$disposition = 'attachment';
|
||||
} elseif (in_array($part['content-type'], $non_attachment_types, true)
|
||||
&& $disposition !== 'attachment') {
|
||||
// it is a message body, no attachment
|
||||
continue;
|
||||
} elseif (substr($part['content-type'], 0, 10) !== 'multipart/') {
|
||||
} elseif (substr($part['content-type'], 0, 10) !== 'multipart/'
|
||||
&& $part['content-type'] !== 'text/plain; (error)') {
|
||||
// if we cannot get it by getMessageBody(), we assume it is an attachment
|
||||
$disposition = 'attachment';
|
||||
}
|
||||
@@ -539,6 +536,9 @@ class Parser
|
||||
if ($filename == 'noname') {
|
||||
$nonameIter++;
|
||||
$filename = 'noname'.$nonameIter;
|
||||
} else {
|
||||
// Escape all potentially unsafe characters from the filename
|
||||
$filename = preg_replace('((^\.)|\/|[\n|\r|\n\r]|(\.$))', '_', $filename);
|
||||
}
|
||||
|
||||
$headersAttachments = $this->getPart('headers', $part);
|
||||
|
Reference in New Issue
Block a user