[Web] Prepare for oauth2

[Web] Some lib updates
[Web] Allow to add a footer
This commit is contained in:
andryyy
2019-09-28 20:00:04 +02:00
parent 3811866ea0
commit 7a85abdb42
176 changed files with 18448 additions and 504 deletions

View File

@@ -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:
[![Actions Status](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/badge/php-mime-mail-parser/php-mime-mail-parser?style=flat-square)](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/results/php-mime-mail-parser/php-mime-mail-parser)
[![Coverage](https://img.shields.io/codecov/c/gh/php-mime-mail-parser/php-mime-mail-parser?style=flat-square)](https://codecov.io/gh/php-mime-mail-parser/php-mime-mail-parser)
[![Code Quality](https://img.shields.io/codacy/grade/4e0e44fee21147ddbdd18ff976251875?style=flat-square)](https://app.codacy.com/app/php-mime-mail-parser/php-mime-mail-parser)
[![Build Status](https://img.shields.io/travis/php-mime-mail-parser/php-mime-mail-parser/master.svg?style=flat-square)](https://travis-ci.com/php-mime-mail-parser/php-mime-mail-parser)
[![Coverage](https://img.shields.io/coveralls/php-mime-mail-parser/php-mime-mail-parser.svg?style=flat-square)](https://coveralls.io/r/php-mime-mail-parser/php-mime-mail-parser)
[![Quality Score](https://img.shields.io/scrutinizer/g/php-mime-mail-parser/php-mime-mail-parser.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-mime-mail-parser/php-mime-mail-parser)
## How do I install it?

View 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

View File

@@ -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:

View File

@@ -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
)
)
)
)
);
}
}

View File

@@ -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;
}
/**

View File

@@ -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);