1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-25 17:01:43 +02:00

Intervention updated to v2.6.1

PHPMailer updated to v6.5.1
This commit is contained in:
Cameron
2021-09-27 10:48:29 -07:00
parent 320287f6ad
commit c15adc1f20
29 changed files with 402 additions and 130 deletions

46
composer.lock generated
View File

@@ -204,26 +204,26 @@
},
{
"name": "intervention/image",
"version": "2.5.1",
"version": "2.6.1",
"source": {
"type": "git",
"url": "https://github.com/Intervention/image.git",
"reference": "abbf18d5ab8367f96b3205ca3c89fb2fa598c69e"
"reference": "0925f10b259679b5d8ca58f3a2add9255ffcda45"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Intervention/image/zipball/abbf18d5ab8367f96b3205ca3c89fb2fa598c69e",
"reference": "abbf18d5ab8367f96b3205ca3c89fb2fa598c69e",
"url": "https://api.github.com/repos/Intervention/image/zipball/0925f10b259679b5d8ca58f3a2add9255ffcda45",
"reference": "0925f10b259679b5d8ca58f3a2add9255ffcda45",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"guzzlehttp/psr7": "~1.1",
"guzzlehttp/psr7": "~1.1 || ^2.0",
"php": ">=5.4.0"
},
"require-dev": {
"mockery/mockery": "~0.9.2",
"phpunit/phpunit": "^4.8 || ^5.7"
"phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15"
},
"suggest": {
"ext-gd": "to use GD library based image processing.",
@@ -272,9 +272,19 @@
],
"support": {
"issues": "https://github.com/Intervention/image/issues",
"source": "https://github.com/Intervention/image/tree/master"
"source": "https://github.com/Intervention/image/tree/2.6.1"
},
"time": "2019-11-02T09:15:47+00:00"
"funding": [
{
"url": "https://www.paypal.me/interventionphp",
"type": "custom"
},
{
"url": "https://github.com/Intervention",
"type": "github"
}
],
"time": "2021-07-22T14:31:53+00:00"
},
{
"name": "matthiasmullie/minify",
@@ -409,16 +419,16 @@
},
{
"name": "phpmailer/phpmailer",
"version": "v6.5.0",
"version": "v6.5.1",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c"
"reference": "dd803df5ad7492e1b40637f7ebd258fee5ca7355"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/a5b5c43e50b7fba655f793ad27303cd74c57363c",
"reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/dd803df5ad7492e1b40637f7ebd258fee5ca7355",
"reference": "dd803df5ad7492e1b40637f7ebd258fee5ca7355",
"shasum": ""
},
"require": {
@@ -430,10 +440,12 @@
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"doctrine/annotations": "^1.2",
"php-parallel-lint/php-console-highlighter": "^0.5.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.3.5",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.5.6",
"yoast/phpunit-polyfills": "^0.2.0"
"squizlabs/php_codesniffer": "^3.6.0",
"yoast/phpunit-polyfills": "^1.0.0"
},
"suggest": {
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
@@ -473,7 +485,7 @@
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.0"
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.1"
},
"funding": [
{
@@ -481,7 +493,7 @@
"type": "github"
}
],
"time": "2021-06-16T14:33:43+00:00"
"time": "2021-08-18T09:14:16+00:00"
},
{
"name": "psr/http-message",
@@ -596,5 +608,5 @@
"platform-overrides": {
"php": "5.6"
},
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.0.0"
}

View File

@@ -29,7 +29,7 @@ private static $installed = array (
'aliases' =>
array (
),
'reference' => '7beae22f44f50501bd888f180c425dc75915c8af',
'reference' => '320287f6ad576aa36e5768420504fc1c4d689ff8',
'name' => 'e107inc/e107',
),
'versions' =>
@@ -41,7 +41,7 @@ private static $installed = array (
'aliases' =>
array (
),
'reference' => '7beae22f44f50501bd888f180c425dc75915c8af',
'reference' => '320287f6ad576aa36e5768420504fc1c4d689ff8',
),
'guzzlehttp/psr7' =>
array (
@@ -72,12 +72,12 @@ private static $installed = array (
),
'intervention/image' =>
array (
'pretty_version' => '2.5.1',
'version' => '2.5.1.0',
'pretty_version' => '2.6.1',
'version' => '2.6.1.0',
'aliases' =>
array (
),
'reference' => 'abbf18d5ab8367f96b3205ca3c89fb2fa598c69e',
'reference' => '0925f10b259679b5d8ca58f3a2add9255ffcda45',
),
'matthiasmullie/minify' =>
array (
@@ -99,12 +99,12 @@ private static $installed = array (
),
'phpmailer/phpmailer' =>
array (
'pretty_version' => 'v6.5.0',
'version' => '6.5.0.0',
'pretty_version' => 'v6.5.1',
'version' => '6.5.1.0',
'aliases' =>
array (
),
'reference' => 'a5b5c43e50b7fba655f793ad27303cd74c57363c',
'reference' => 'dd803df5ad7492e1b40637f7ebd258fee5ca7355',
),
'psr/http-message' =>
array (

View File

@@ -203,34 +203,34 @@
},
{
"name": "intervention/image",
"version": "2.5.1",
"version_normalized": "2.5.1.0",
"version": "2.6.1",
"version_normalized": "2.6.1.0",
"source": {
"type": "git",
"url": "https://github.com/Intervention/image.git",
"reference": "abbf18d5ab8367f96b3205ca3c89fb2fa598c69e"
"reference": "0925f10b259679b5d8ca58f3a2add9255ffcda45"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Intervention/image/zipball/abbf18d5ab8367f96b3205ca3c89fb2fa598c69e",
"reference": "abbf18d5ab8367f96b3205ca3c89fb2fa598c69e",
"url": "https://api.github.com/repos/Intervention/image/zipball/0925f10b259679b5d8ca58f3a2add9255ffcda45",
"reference": "0925f10b259679b5d8ca58f3a2add9255ffcda45",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"guzzlehttp/psr7": "~1.1",
"guzzlehttp/psr7": "~1.1 || ^2.0",
"php": ">=5.4.0"
},
"require-dev": {
"mockery/mockery": "~0.9.2",
"phpunit/phpunit": "^4.8 || ^5.7"
"phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15"
},
"suggest": {
"ext-gd": "to use GD library based image processing.",
"ext-imagick": "to use Imagick based image processing.",
"intervention/imagecache": "Caching extension for the Intervention Image library"
},
"time": "2019-11-02T09:15:47+00:00",
"time": "2021-07-22T14:31:53+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -274,8 +274,18 @@
],
"support": {
"issues": "https://github.com/Intervention/image/issues",
"source": "https://github.com/Intervention/image/tree/master"
"source": "https://github.com/Intervention/image/tree/2.6.1"
},
"funding": [
{
"url": "https://www.paypal.me/interventionphp",
"type": "custom"
},
{
"url": "https://github.com/Intervention",
"type": "github"
}
],
"install-path": "../intervention/image"
},
{
@@ -417,17 +427,17 @@
},
{
"name": "phpmailer/phpmailer",
"version": "v6.5.0",
"version_normalized": "6.5.0.0",
"version": "v6.5.1",
"version_normalized": "6.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c"
"reference": "dd803df5ad7492e1b40637f7ebd258fee5ca7355"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/a5b5c43e50b7fba655f793ad27303cd74c57363c",
"reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/dd803df5ad7492e1b40637f7ebd258fee5ca7355",
"reference": "dd803df5ad7492e1b40637f7ebd258fee5ca7355",
"shasum": ""
},
"require": {
@@ -439,10 +449,12 @@
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"doctrine/annotations": "^1.2",
"php-parallel-lint/php-console-highlighter": "^0.5.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.3.5",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.5.6",
"yoast/phpunit-polyfills": "^0.2.0"
"squizlabs/php_codesniffer": "^3.6.0",
"yoast/phpunit-polyfills": "^1.0.0"
},
"suggest": {
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
@@ -452,7 +464,7 @@
"stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
},
"time": "2021-06-16T14:33:43+00:00",
"time": "2021-08-18T09:14:16+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -484,7 +496,7 @@
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.0"
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.1"
},
"funding": [
{

View File

@@ -6,7 +6,7 @@
'aliases' =>
array (
),
'reference' => '7beae22f44f50501bd888f180c425dc75915c8af',
'reference' => '320287f6ad576aa36e5768420504fc1c4d689ff8',
'name' => 'e107inc/e107',
),
'versions' =>
@@ -18,7 +18,7 @@
'aliases' =>
array (
),
'reference' => '7beae22f44f50501bd888f180c425dc75915c8af',
'reference' => '320287f6ad576aa36e5768420504fc1c4d689ff8',
),
'guzzlehttp/psr7' =>
array (
@@ -49,12 +49,12 @@
),
'intervention/image' =>
array (
'pretty_version' => '2.5.1',
'version' => '2.5.1.0',
'pretty_version' => '2.6.1',
'version' => '2.6.1.0',
'aliases' =>
array (
),
'reference' => 'abbf18d5ab8367f96b3205ca3c89fb2fa598c69e',
'reference' => '0925f10b259679b5d8ca58f3a2add9255ffcda45',
),
'matthiasmullie/minify' =>
array (
@@ -76,12 +76,12 @@
),
'phpmailer/phpmailer' =>
array (
'pretty_version' => 'v6.5.0',
'version' => '6.5.0.0',
'pretty_version' => 'v6.5.1',
'version' => '6.5.1.0',
'aliases' =>
array (
),
'reference' => 'a5b5c43e50b7fba655f793ad27303cd74c57363c',
'reference' => 'dd803df5ad7492e1b40637f7ebd258fee5ca7355',
),
'psr/http-message' =>
array (

View File

@@ -14,10 +14,10 @@
"require": {
"php": ">=5.4.0",
"ext-fileinfo": "*",
"guzzlehttp/psr7": "~1.1"
"guzzlehttp/psr7": "~1.1 || ^2.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8 || ^5.7",
"phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15",
"mockery/mockery": "~0.9.2"
},
"suggest": {

View File

@@ -69,6 +69,7 @@ abstract class AbstractDecoder
$options = [
'http' => [
'method'=>"GET",
'protocol_version'=>1.1, // force use HTTP 1.1 for service mesh environment with envoy
'header'=>"Accept-language: en\r\n".
"User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2\r\n"
]
@@ -140,6 +141,10 @@ abstract class AbstractDecoder
return (get_resource_type($this->data) == 'gd');
}
if ($this->data instanceof \GdImage) {
return true;
}
return false;
}
@@ -290,7 +295,7 @@ abstract class AbstractDecoder
}
$pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P<data>.+)$/";
preg_match($pattern, $data_url, $matches);
preg_match($pattern, str_replace(["\n", "\r"], '', $data_url), $matches);
if (is_array($matches) && array_key_exists('data', $matches)) {
return base64_decode($matches['data']);

View File

@@ -104,8 +104,12 @@ abstract class AbstractDriver
*/
private function getCommandClassName($name)
{
$name = mb_convert_case($name[0], MB_CASE_UPPER, 'utf-8') . mb_substr($name, 1, mb_strlen($name));
if (extension_loaded('mbstring')) {
$name = mb_strtoupper(mb_substr($name, 0, 1)) . mb_substr($name, 1);
} else {
$name = strtoupper(substr($name, 0, 1)) . substr($name, 1);
}
$drivername = $this->getDriverName();
$classnameLocal = sprintf('\Intervention\Image\%s\Commands\%sCommand', $drivername, ucfirst($name));
$classnameGlobal = sprintf('\Intervention\Image\Commands\%sCommand', ucfirst($name));

View File

@@ -84,6 +84,13 @@ abstract class AbstractEncoder
*/
abstract protected function processWebp();
/**
* Processes and returns image as Avif encoded string
*
* @return string
*/
abstract protected function processAvif();
/**
* Process a given image
*
@@ -117,9 +124,11 @@ abstract class AbstractEncoder
case 'jpg':
case 'jpeg':
case 'image/jp2':
case 'image/jpg':
case 'image/jpeg':
case 'image/pjpeg':
case 'image/jfif':
$this->result = $this->processJpeg();
break;
@@ -168,10 +177,15 @@ abstract class AbstractEncoder
case 'image/x-webp':
$this->result = $this->processWebp();
break;
case 'avif':
case 'image/avif':
$this->result = $this->processAvif();
break;
default:
throw new NotSupportedException(
"Encoding format ({$format}) is not supported."
"Encoding format ({$this->format}) is not supported."
);
}

View File

@@ -46,6 +46,13 @@ abstract class AbstractFont
*/
public $valign;
/**
* Space between text characters
*
* @var float
*/
public $kerning = 0;
/**
* Path to TTF or GD library internal font file of the text
*
@@ -73,7 +80,7 @@ abstract class AbstractFont
/**
* Create a new instance of Font
*
* @param Strinf $text Text to be written
* @param String $text Text to be written
*/
public function __construct($text = null)
{
@@ -218,6 +225,27 @@ abstract class AbstractFont
return $this->valign;
}
/**
* Set text kerning
*
* @param string $kerning
* @return void
*/
public function kerning($kerning)
{
$this->kerning = $kerning;
}
/**
* Get kerning
*
* @return float
*/
public function getKerning()
{
return $this->kerning;
}
/**
* Set path to font file
*

View File

@@ -28,7 +28,17 @@ class ExifCommand extends AbstractCommand
// try to read exif data from image file
try {
$data = @exif_read_data($image->dirname . '/' . $image->basename);
if ($image->dirname && $image->basename) {
$stream = $image->dirname . '/' . $image->basename;
} elseif (version_compare(PHP_VERSION, '7.2.0', '>=')) {
// https://www.php.net/manual/en/function.exif-read-data.php#refsect1-function.exif-read-data-changelog
$stream = $image->stream()->detach();
} else {
// https://bugs.php.net/bug.php?id=65187
$stream = $image->encode('data-url')->encoded;
}
$data = @exif_read_data($stream);
if (!is_null($key) && is_array($data)) {
$data = array_key_exists($key, $data) ? $data[$key] : false;

View File

@@ -15,11 +15,25 @@ class StreamCommand extends AbstractCommand
{
$format = $this->argument(0)->value();
$quality = $this->argument(1)->between(0, 100)->value();
$data = $image->encode($format, $quality)->getEncoded();
$this->setOutput(\GuzzleHttp\Psr7\stream_for(
$image->encode($format, $quality)->getEncoded()
));
$this->setOutput($this->getStream($data));
return true;
}
}
/**
* Create stream from given data
*
* @param string $data
* @return \Psr\Http\Message\StreamInterface
*/
protected function getStream($data)
{
if (class_exists(\GuzzleHttp\Psr7\Utils::class)) {
return \GuzzleHttp\Psr7\Utils::streamFor($data); // guzzlehttp/psr7 >= 2.0
}
return \GuzzleHttp\Psr7\stream_for($data); // guzzlehttp/psr7 < 2.0
}
}

View File

@@ -20,7 +20,7 @@ class RotateCommand extends AbstractCommand
$color = new Color($color);
// restrict rotations beyond 360 degrees, since the end result is the same
$angle %= 360;
$angle = fmod($angle, 360);
// rotate image
$image->setCore(imagerotate($image->getCore(), $angle, $color->getInt()));

View File

@@ -55,9 +55,25 @@ class Decoder extends \Intervention\Image\AbstractDecoder
$core = @imagecreatefromwebp($path);
break;
case 'image/bmp':
case 'image/ms-bmp':
case 'image/x-bitmap':
case 'image/x-bmp':
case 'image/x-ms-bmp':
case 'image/x-win-bitmap':
case 'image/x-windows-bmp':
case 'image/x-xbitmap':
if (! function_exists('imagecreatefrombmp')) {
throw new NotReadableException(
"Unsupported image type. GD/PHP installation does not support BMP format."
);
}
$core = @imagecreatefrombmp($path);
break;
default:
throw new NotReadableException(
"Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files."
sprintf("Unsupported image type %s. GD driver is only able to decode JPG, PNG, GIF, BMP or WebP files.", strtolower($mime))
);
}

View File

@@ -66,6 +66,9 @@ class Encoder extends \Intervention\Image\AbstractEncoder
}
ob_start();
imagepalettetotruecolor($this->image->getCore());
imagealphablending($this->image->getCore(), true);
imagesavealpha($this->image->getCore(), true);
imagewebp($this->image->getCore(), null, $this->quality);
$this->image->mime = defined('IMAGETYPE_WEBP') ? image_type_to_mime_type(IMAGETYPE_WEBP) : 'image/webp';
$buffer = ob_get_contents();
@@ -93,9 +96,19 @@ class Encoder extends \Intervention\Image\AbstractEncoder
*/
protected function processBmp()
{
throw new NotSupportedException(
"BMP format is not supported by Gd Driver."
);
if ( ! function_exists('imagebmp')) {
throw new NotSupportedException(
"BMP format is not supported by PHP installation."
);
}
ob_start();
imagebmp($this->image->getCore());
$this->image->mime = defined('IMAGETYPE_BMP') ? image_type_to_mime_type(IMAGETYPE_BMP) : 'image/bmp';
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
/**
@@ -121,4 +134,16 @@ class Encoder extends \Intervention\Image\AbstractEncoder
"PSD format is not supported by Gd Driver."
);
}
/**
* Processes and returns encoded image as AVIF string
*
* @return string
*/
protected function processAvif()
{
throw new NotSupportedException(
"AVIF format is not supported by Gd Driver."
);
}
}

View File

@@ -82,6 +82,13 @@ class Font extends \Intervention\Image\AbstractFont
if ($this->hasApplicableFontFile()) {
// imagettfbbox() converts numeric entities to their respective
// character. Preserve any originally double encoded entities to be
// represented as is.
// eg: &amp;#160; will render &#160; rather than its character.
$this->text = preg_replace('/&(#(?:x[a-fA-F0-9]+|[0-9]+);)/', '&#38;\1', $this->text);
$this->text = mb_encode_numericentity($this->text, array(0x0080, 0xffff, 0, 0xffff), 'UTF-8');
// get bounding box with angle 0
$box = imagettfbbox($this->getPointSize(), 0, $this->file, $this->text);
@@ -253,4 +260,18 @@ class Font extends \Intervention\Image\AbstractFont
imagestring($image->getCore(), $this->getInternalFont(), $posx, $posy, $this->text, $color->getInt());
}
}
/**
* Set text kerning
*
* @param string $kerning
* @return void
*/
public function kerning($kerning)
{
throw new \Intervention\Image\Exception\NotSupportedException(
"Kerning is not supported by GD driver."
);
}
}

View File

@@ -77,7 +77,7 @@ class ImageServiceProviderLaravelRecent extends ServiceProvider
// imagecache route
if (is_string(config('imagecache.route'))) {
$filename_pattern = '[ \w\\.\\/\\-\\@\(\)]+';
$filename_pattern = '[ \w\\.\\/\\-\\@\(\)\=]+';
// route to access template applied image file
$app['router']->get(config('imagecache.route').'/{template}/{filename}', [

View File

@@ -20,7 +20,7 @@ class RotateCommand extends AbstractCommand
$color = new Color($color);
// restrict rotations beyond 360 degrees, since the end result is the same
$angle %= 360;
$angle = fmod($angle, 360);
// rotate image
$image->getCore()->rotateImage($color->getPixel(), ($angle * -1));

View File

@@ -47,6 +47,8 @@ class Encoder extends AbstractEncoder
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_PNG);
return $imagick->getImagesBlob();
}
@@ -66,6 +68,8 @@ class Encoder extends AbstractEncoder
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_GIF);
return $imagick->getImagesBlob();
}
@@ -111,6 +115,8 @@ class Encoder extends AbstractEncoder
$imagick->setCompressionQuality($this->quality);
$imagick->setImageCompressionQuality($this->quality);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_TIFF_II);
return $imagick->getImagesBlob();
}
@@ -130,6 +136,8 @@ class Encoder extends AbstractEncoder
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_BMP);
return $imagick->getImagesBlob();
}
@@ -149,6 +157,8 @@ class Encoder extends AbstractEncoder
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_ICO);
return $imagick->getImagesBlob();
}
@@ -168,6 +178,30 @@ class Encoder extends AbstractEncoder
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_PSD);
return $imagick->getImagesBlob();
}
protected function processAvif()
{
if ( ! \Imagick::queryFormats('AVIF')) {
throw new NotSupportedException(
"AVIF format is not supported by Imagick installation."
);
}
$format = 'avif';
$compression = \Imagick::COMPRESSION_UNDEFINED;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$imagick->setCompressionQuality($this->quality);
$imagick->setImageCompressionQuality($this->quality);
return $imagick->getImagesBlob();
}
}

View File

@@ -37,6 +37,7 @@ class Font extends AbstractFont
$draw->setFontSize($this->size);
$draw->setFillColor($color->getPixel());
$draw->setTextKerning($this->kerning);
// align horizontal
switch (strtolower($this->align)) {
@@ -70,7 +71,7 @@ class Font extends AbstractFont
case 'top':
// calculate box size
$dimensions = $image->getCore()->queryFontMetrics($draw, $this->text, false);
$posy = $posy + $dimensions['textHeight'] * 0.65;
$posy = $posy + $dimensions['characterHeight'];
break;
}
}

View File

@@ -338,8 +338,8 @@ class Size
case 'middle':
case 'center-center':
case 'middle-middle':
$x = intval($this->width / 2);
$y = intval($this->height / 2);
$x = intval($this->width / 2) + $offset_x;
$y = intval($this->height / 2) + $offset_y;
break;
default:

View File

@@ -2,7 +2,12 @@
# PHPMailer A full-featured email creation and transfer class for PHP
[![Test status](https://github.com/PHPMailer/PHPMailer/workflows/Tests/badge.svg)](https://github.com/PHPMailer/PHPMailer/actions) [![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) [![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![API Docs](https://github.com/phpmailer/phpmailer/workflows/Docs/badge.svg)](https://phpmailer.github.io/PHPMailer/)
[![Test status](https://github.com/PHPMailer/PHPMailer/workflows/Tests/badge.svg)](https://github.com/PHPMailer/PHPMailer/actions)
[![codecov.io](https://codecov.io/gh/PHPMailer/PHPMailer/branch/master/graph/badge.svg?token=iORZpwmYmM)](https://codecov.io/gh/PHPMailer/PHPMailer)
[![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer)
[![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer)
[![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer)
[![API Docs](https://github.com/phpmailer/phpmailer/workflows/Docs/badge.svg)](https://phpmailer.github.io/PHPMailer/)
## Features
- Probably the world's most popular code for sending email from PHP!
@@ -17,7 +22,7 @@
- Protects against header injection attacks
- Error messages in over 50 languages!
- DKIM and S/MIME signing support
- Compatible with PHP 5.5 and later, including PHP 8.0
- Compatible with PHP 5.5 and later, including PHP 8.1
- Namespaced to prevent name clashes
- Much more!
@@ -39,7 +44,7 @@ This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lg
PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file:
```json
"phpmailer/phpmailer": "^6.2"
"phpmailer/phpmailer": "^6.5"
```
or run
@@ -89,7 +94,7 @@ use PHPMailer\PHPMailer\Exception;
//Load Composer's autoloader
require 'vendor/autoload.php';
//Instantiation and passing `true` enables exceptions
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
@@ -100,8 +105,8 @@ try {
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'user@example.com'; //SMTP username
$mail->Password = 'secret'; //SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$mail->Port = 587; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
$mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
//Recipients
$mail->setFrom('from@example.com', 'Mailer');

View File

@@ -1 +1 @@
6.5.0
6.5.1

View File

@@ -34,10 +34,12 @@
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"doctrine/annotations": "^1.2",
"php-parallel-lint/php-console-highlighter": "^0.5.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.3.5",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.5.6",
"yoast/phpunit-polyfills": "^0.2.0"
"squizlabs/php_codesniffer": "^3.6.0",
"yoast/phpunit-polyfills": "^1.0.0"
},
"suggest": {
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
@@ -60,6 +62,10 @@
"license": "LGPL-2.1-only",
"scripts": {
"check": "./vendor/bin/phpcs",
"test": "./vendor/bin/phpunit"
"test": "./vendor/bin/phpunit --no-coverage",
"coverage": "./vendor/bin/phpunit",
"lint": [
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php,phps --exclude vendor --exclude .git --exclude build"
]
}
}

View File

@@ -5,24 +5,25 @@
* @package PHPMailer
* @author Mitsuhiro Yoshida <http://mitstek.com/>
* @author Yoshi Sakai <http://bluemooninc.jp/>
* @author Arisophy <https://github.com/arisophy/>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTPエラー: 認証できませんでした。';
$PHPMAILER_LANG['connect_host'] = 'SMTPエラー: SMTPホストに接続できませんでした。';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTPエラー: データが受け付けられませんでした。';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['empty_message'] = 'メール本文が空です。';
$PHPMAILER_LANG['encoding'] = '不明なエンコーディング: ';
$PHPMAILER_LANG['execute'] = '実行できませんでした: ';
$PHPMAILER_LANG['file_access'] = 'ファイルにアクセスできません: ';
$PHPMAILER_LANG['file_open'] = 'ファイルエラー: ファイルを開けません: ';
$PHPMAILER_LANG['from_failed'] = 'Fromアドレスを登録する際にエラーが発生しました: ';
$PHPMAILER_LANG['instantiate'] = 'メール関数が正常に動作しませんでした。';
//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: ';
$PHPMAILER_LANG['invalid_address'] = '不正なメールアドレス: ';
$PHPMAILER_LANG['provide_address'] = '少なくとも1つメールアドレスを 指定する必要があります。';
$PHPMAILER_LANG['mailer_not_supported'] = ' メーラーがサポートされていません。';
$PHPMAILER_LANG['recipients_failed'] = 'SMTPエラー: 次の受信者アドレスに 間違いがあります: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
$PHPMAILER_LANG['signing'] = '署名エラー: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP接続に失敗しました。';
$PHPMAILER_LANG['smtp_error'] = 'SMTPサーバーエラー: ';
$PHPMAILER_LANG['variable_set'] = '変数が存在しません: ';
$PHPMAILER_LANG['extension_missing'] = '拡張機能が見つかりません: ';

View File

@@ -7,23 +7,28 @@
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP-fout: authenticatie mislukt.';
$PHPMAILER_LANG['buggy_php'] = 'PHP versie gededecteerd die onderhavig is aan een bug die kan resulteren in gecorrumpeerde berichten. Om dit te voorkomen, gebruik SMTP voor het verzenden van berichten, zet de mail.add_x_header optie in uw php.ini file uit, gebruik MacOS of Linux, of pas de gebruikte PHP versie aan naar versie 7.0.17+ or 7.1.3+.';
$PHPMAILER_LANG['connect_host'] = 'SMTP-fout: kon niet verbinden met SMTP-host.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-fout: data niet geaccepteerd.';
$PHPMAILER_LANG['empty_message'] = 'Berichttekst is leeg';
$PHPMAILER_LANG['encoding'] = 'Onbekende codering: ';
$PHPMAILER_LANG['execute'] = 'Kon niet uitvoeren: ';
$PHPMAILER_LANG['extension_missing'] = 'Extensie afwezig: ';
$PHPMAILER_LANG['file_access'] = 'Kreeg geen toegang tot bestand: ';
$PHPMAILER_LANG['file_open'] = 'Bestandsfout: kon bestand niet openen: ';
$PHPMAILER_LANG['from_failed'] = 'Het volgende afzendersadres is mislukt: ';
$PHPMAILER_LANG['instantiate'] = 'Kon mailfunctie niet initialiseren.';
$PHPMAILER_LANG['invalid_address'] = 'Ongeldig adres: ';
$PHPMAILER_LANG['invalid_header'] = 'Ongeldige header naam of waarde';
$PHPMAILER_LANG['invalid_hostentry'] = 'Ongeldige hostentry: ';
$PHPMAILER_LANG['invalid_host'] = 'Ongeldige host: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wordt niet ondersteund.';
$PHPMAILER_LANG['provide_address'] = 'Er moet minstens één ontvanger worden opgegeven.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP-fout: de volgende ontvangers zijn mislukt: ';
$PHPMAILER_LANG['signing'] = 'Signeerfout: ';
$PHPMAILER_LANG['smtp_code'] = 'SMTP code: ';
$PHPMAILER_LANG['smtp_code_ex'] = 'Aanvullende SMTP informatie: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Verbinding mislukt.';
$PHPMAILER_LANG['smtp_detail'] = 'Detail: ';
$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfout: ';
$PHPMAILER_LANG['variable_set'] = 'Kan de volgende variabele niet instellen of resetten: ';
$PHPMAILER_LANG['extension_missing'] = 'Extensie afwezig: ';

View File

@@ -35,6 +35,6 @@ class Exception extends \Exception
*/
public function errorMessage()
{
return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n";
return '<strong>' . htmlspecialchars($this->getMessage(), ENT_COMPAT | ENT_HTML401) . "</strong><br />\n";
}
}

View File

@@ -103,14 +103,14 @@ class PHPMailer
*
* @var string
*/
public $From = 'root@localhost';
public $From = '';
/**
* The From name of the message.
*
* @var string
*/
public $FromName = 'Root User';
public $FromName = '';
/**
* The envelope sender of the message.
@@ -689,7 +689,7 @@ class PHPMailer
protected $boundary = [];
/**
* The array of available languages.
* The array of available text strings for the current language.
*
* @var array
*/
@@ -750,7 +750,7 @@ class PHPMailer
*
* @var string
*/
const VERSION = '6.5.0';
const VERSION = '6.5.1';
/**
* Error severity: message only, continue processing.
@@ -1188,25 +1188,33 @@ class PHPMailer
*
* @return array
*/
public static function parseAddresses($addrstr, $useimap = true)
public static function parseAddresses($addrstr, $useimap = true, $charset = self::CHARSET_ISO88591)
{
$addresses = [];
if ($useimap && function_exists('imap_rfc822_parse_adrlist')) {
//Use this built-in parser if it's available
$list = imap_rfc822_parse_adrlist($addrstr, '');
// Clear any potential IMAP errors to get rid of notices being thrown at end of script.
imap_errors();
foreach ($list as $address) {
if (
('.SYNTAX-ERROR.' !== $address->host) && static::validateAddress(
$address->mailbox . '@' . $address->host
)
'.SYNTAX-ERROR.' !== $address->host &&
static::validateAddress($address->mailbox . '@' . $address->host)
) {
//Decode the name part if it's present and encoded
if (
property_exists($address, 'personal') &&
extension_loaded('mbstring') &&
preg_match('/^=\?.*\?=$/', $address->personal)
//Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled
defined('MB_CASE_UPPER') &&
preg_match('/^=\?.*\?=$/s', $address->personal)
) {
$origCharset = mb_internal_encoding();
mb_internal_encoding($charset);
//Undo any RFC2047-encoded spaces-as-underscores
$address->personal = str_replace('_', '=20', $address->personal);
//Decode the name
$address->personal = mb_decode_mimeheader($address->personal);
mb_internal_encoding($origCharset);
}
$addresses[] = [
@@ -1234,9 +1242,16 @@ class PHPMailer
$email = trim(str_replace('>', '', $email));
$name = trim($name);
if (static::validateAddress($email)) {
//Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled
//If this name is encoded, decode it
if (preg_match('/^=\?.*\?=$/', $name)) {
if (defined('MB_CASE_UPPER') && preg_match('/^=\?.*\?=$/s', $name)) {
$origCharset = mb_internal_encoding();
mb_internal_encoding($charset);
//Undo any RFC2047-encoded spaces-as-underscores
$name = str_replace('_', '=20', $name);
//Decode the name
$name = mb_decode_mimeheader($name);
mb_internal_encoding($origCharset);
}
$addresses[] = [
//Remove any surrounding quotes and spaces from the name
@@ -1508,12 +1523,7 @@ class PHPMailer
&& ini_get('mail.add_x_header') === '1'
&& stripos(PHP_OS, 'WIN') === 0
) {
trigger_error(
'Your version of PHP is affected by a bug that may result in corrupted messages.' .
' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' .
' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.',
E_USER_WARNING
);
trigger_error($this->lang('buggy_php'), E_USER_WARNING);
}
try {
@@ -1724,7 +1734,7 @@ class PHPMailer
fwrite($mail, $header);
fwrite($mail, $body);
$result = pclose($mail);
$addrinfo = static::parseAddresses($toAddr);
$addrinfo = static::parseAddresses($toAddr, true, $this->charSet);
$this->doCallback(
($result === 0),
[[$addrinfo['address'], $addrinfo['name']]],
@@ -1884,7 +1894,7 @@ class PHPMailer
if ($this->SingleTo && count($toArr) > 1) {
foreach ($toArr as $toAddr) {
$result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
$addrinfo = static::parseAddresses($toAddr);
$addrinfo = static::parseAddresses($toAddr, true, $this->charSet);
$this->doCallback(
$result,
[[$addrinfo['address'], $addrinfo['name']]],
@@ -2181,14 +2191,15 @@ class PHPMailer
/**
* Set the language for error messages.
* Returns false if it cannot load the language file.
* The default language is English.
*
* @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
* Optionally, the language code can be enhanced with a 4-character
* script annotation and/or a 2-character country annotation.
* @param string $lang_path Path to the language file directory, with trailing separator (slash).D
* Do not set this from user input!
*
* @return bool
* @return bool Returns true if the requested language was loaded, false otherwise.
*/
public function setLanguage($langcode = 'en', $lang_path = '')
{
@@ -2211,44 +2222,77 @@ class PHPMailer
//Define full set of translatable strings in English
$PHPMAILER_LANG = [
'authenticate' => 'SMTP Error: Could not authenticate.',
'buggy_php' => 'Your version of PHP is affected by a bug that may result in corrupted messages.' .
' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' .
' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.',
'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
'data_not_accepted' => 'SMTP Error: data not accepted.',
'empty_message' => 'Message body empty',
'encoding' => 'Unknown encoding: ',
'execute' => 'Could not execute: ',
'extension_missing' => 'Extension missing: ',
'file_access' => 'Could not access file: ',
'file_open' => 'File Error: Could not open file: ',
'from_failed' => 'The following From address failed: ',
'instantiate' => 'Could not instantiate mail function.',
'invalid_address' => 'Invalid address: ',
'invalid_header' => 'Invalid header name or value',
'invalid_hostentry' => 'Invalid hostentry: ',
'invalid_host' => 'Invalid host: ',
'mailer_not_supported' => ' mailer is not supported.',
'provide_address' => 'You must provide at least one recipient email address.',
'recipients_failed' => 'SMTP Error: The following recipients failed: ',
'signing' => 'Signing Error: ',
'smtp_code' => 'SMTP code: ',
'smtp_code_ex' => 'Additional SMTP info: ',
'smtp_connect_failed' => 'SMTP connect() failed.',
'smtp_detail' => 'Detail: ',
'smtp_error' => 'SMTP server error: ',
'variable_set' => 'Cannot set or reset variable: ',
'extension_missing' => 'Extension missing: ',
];
if (empty($lang_path)) {
//Calculate an absolute path so it can work if CWD is not here
$lang_path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR;
}
//Validate $langcode
if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) {
$foundlang = true;
$langcode = strtolower($langcode);
if (
!preg_match('/^(?P<lang>[a-z]{2})(?P<script>_[a-z]{4})?(?P<country>_[a-z]{2})?$/', $langcode, $matches)
&& $langcode !== 'en'
) {
$foundlang = false;
$langcode = 'en';
}
$foundlang = true;
$lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
//There is no English translation file
if ('en' !== $langcode) {
//Make sure language file path is readable
if (!static::fileIsAccessible($lang_file)) {
$langcodes = [];
if (!empty($matches['script']) && !empty($matches['country'])) {
$langcodes[] = $matches['lang'] . $matches['script'] . $matches['country'];
}
if (!empty($matches['country'])) {
$langcodes[] = $matches['lang'] . $matches['country'];
}
if (!empty($matches['script'])) {
$langcodes[] = $matches['lang'] . $matches['script'];
}
$langcodes[] = $matches['lang'];
//Try and find a readable language file for the requested language.
$foundFile = false;
foreach ($langcodes as $code) {
$lang_file = $lang_path . 'phpmailer.lang-' . $code . '.php';
if (static::fileIsAccessible($lang_file)) {
$foundFile = true;
break;
}
}
if ($foundFile === false) {
$foundlang = false;
} else {
//$foundlang = include $lang_file;
$lines = file($lang_file);
foreach ($lines as $line) {
//Translation file lines look like this:
@@ -2283,6 +2327,10 @@ class PHPMailer
*/
public function getTranslations()
{
if (empty($this->language)) {
$this->setLanguage(); // Set the default language.
}
return $this->language;
}
@@ -2551,7 +2599,17 @@ class PHPMailer
//Only allow a custom message ID if it conforms to RFC 5322 section 3.6.4
//https://tools.ietf.org/html/rfc5322#section-3.6.4
if ('' !== $this->MessageID && preg_match('/^<.*@.*>$/', $this->MessageID)) {
if (
'' !== $this->MessageID &&
preg_match(
'/^<((([a-z\d!#$%&\'*+\/=?^_`{|}~-]+(\.[a-z\d!#$%&\'*+\/=?^_`{|}~-]+)*)' .
'|("(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21\x23-\x5B\x5D-\x7E])' .
'|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*"))@(([a-z\d!#$%&\'*+\/=?^_`{|}~-]+' .
'(\.[a-z\d!#$%&\'*+\/=?^_`{|}~-]+)*)|(\[(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]' .
'|[\x21-\x5A\x5E-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*\])))>$/Di',
$this->MessageID
)
) {
$this->lastMessageID = $this->MessageID;
} else {
$this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname());
@@ -3935,13 +3993,13 @@ class PHPMailer
if (!empty($lasterror['error'])) {
$msg .= $this->lang('smtp_error') . $lasterror['error'];
if (!empty($lasterror['detail'])) {
$msg .= ' Detail: ' . $lasterror['detail'];
$msg .= ' ' . $this->lang('smtp_detail') . $lasterror['detail'];
}
if (!empty($lasterror['smtp_code'])) {
$msg .= ' SMTP code: ' . $lasterror['smtp_code'];
$msg .= ' ' . $this->lang('smtp_code') . $lasterror['smtp_code'];
}
if (!empty($lasterror['smtp_code_ex'])) {
$msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex'];
$msg .= ' ' . $this->lang('smtp_code_ex') . $lasterror['smtp_code_ex'];
}
}
}
@@ -4002,7 +4060,7 @@ class PHPMailer
empty($host)
|| !is_string($host)
|| strlen($host) > 256
|| !preg_match('/^([a-zA-Z\d.-]*|\[[a-fA-F\d:]+])$/', $host)
|| !preg_match('/^([a-zA-Z\d.-]*|\[[a-fA-F\d:]+\])$/', $host)
) {
return false;
}
@@ -4079,11 +4137,11 @@ class PHPMailer
list($name, $value) = explode(':', $name, 2);
}
$name = trim($name);
$value = trim($value);
$value = (null === $value) ? '' : trim($value);
//Ensure name is not empty, and that neither name nor value contain line breaks
if (empty($name) || strpbrk($name . $value, "\r\n") !== false) {
if ($this->exceptions) {
throw new Exception('Invalid header name or value');
throw new Exception($this->lang('invalid_header'));
}
return false;
@@ -4237,7 +4295,8 @@ class PHPMailer
*
* @param string $html The HTML text to convert
* @param bool|callable $advanced Any boolean value to use the internal converter,
* or provide your own callable for custom conversion
* or provide your own callable for custom conversion.
* *Never* pass user-supplied data into this parameter
*
* @return string
*/

View File

@@ -46,7 +46,7 @@ class POP3
*
* @var string
*/
const VERSION = '6.5.0';
const VERSION = '6.5.1';
/**
* Default POP3 port number.

View File

@@ -35,7 +35,7 @@ class SMTP
*
* @var string
*/
const VERSION = '6.5.0';
const VERSION = '6.5.1';
/**
* SMTP line break constant.