[Web] Update libs

[Web] Update filename when downloading
master
andryyy 2020-05-18 21:15:51 +02:00
parent 11820a4d3a
commit 667bd48163
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
71 changed files with 362 additions and 546 deletions

View File

@ -96,7 +96,7 @@ if (!empty($_GET['id']) && ctype_alnum($_GET['id'])) {
}
}
if (isset($_GET['eml'])) {
$dl_filename = preg_replace('/[^a-z\d]/i', '_', $data['subject']);
$dl_filename = filter_var($data['subject'], FILTER_SANITIZE_STRING);
$dl_filename = strlen($dl_filename) > 30 ? substr($dl_filename,0,30) : $dl_filename;
header('Pragma: public');
header('Expires: 0');
@ -114,7 +114,7 @@ if (!empty($_GET['id']) && ctype_alnum($_GET['id'])) {
exit(json_encode('Forbidden'));
}
$dl_id = intval($_GET['att']);
$dl_filename = preg_replace('/[^a-z\d]/i', '_', $data['attachments'][$dl_id][0]);
$dl_filename = filter_var($data['attachments'][$dl_id][0], FILTER_SANITIZE_STRING);
$dl_filename = strlen($dl_filename) > 30 ? substr($dl_filename,0,30) : $dl_filename;
if (!is_dir($tmpdir . $dl_filename) && file_exists($tmpdir . $dl_filename)) {
header('Pragma: public');

View File

@ -66,30 +66,30 @@
},
{
"name": "ddeboer/imap",
"version": "1.8.0",
"version": "1.10.0",
"source": {
"type": "git",
"url": "https://github.com/ddeboer/imap.git",
"reference": "ff985d72916267cba2f944e7c9ee654c69893219"
"reference": "fc09dbf6fb9ba7317a95c719e45893efc4fe6bde"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ddeboer/imap/zipball/ff985d72916267cba2f944e7c9ee654c69893219",
"reference": "ff985d72916267cba2f944e7c9ee654c69893219",
"url": "https://api.github.com/repos/ddeboer/imap/zipball/fc09dbf6fb9ba7317a95c719e45893efc4fe6bde",
"reference": "fc09dbf6fb9ba7317a95c719e45893efc4fe6bde",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"ext-imap": "*",
"ext-mbstring": "*",
"php": "^7.1"
"php": "^7.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"phpstan/phpstan": "^0.11",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-strict-rules": "^0.11.0",
"phpunit/phpunit": "^7.5",
"friendsofphp/php-cs-fixer": "^2.16",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^8.5",
"zendframework/zend-mail": "^2.10"
},
"type": "library",
@ -107,13 +107,13 @@
"name": "David de Boer",
"email": "david@ddeboer.nl"
},
{
"name": "Community contributors",
"homepage": "https://github.com/ddeboer/imap/graphs/contributors"
},
{
"name": "Filippo Tessarotto",
"email": "zoeslam@gmail.com"
},
{
"name": "Community contributors",
"homepage": "https://github.com/ddeboer/imap/graphs/contributors"
}
],
"description": "Object-oriented IMAP for PHP",
@ -122,20 +122,20 @@
"imap",
"mail"
],
"time": "2019-04-15T09:18:52+00:00"
"time": "2020-01-24T08:15:24+00:00"
},
{
"name": "matthiasmullie/minify",
"version": "1.3.61",
"version": "1.3.63",
"source": {
"type": "git",
"url": "https://github.com/matthiasmullie/minify.git",
"reference": "d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751"
"reference": "9ba1b459828adc13430f4dd6c49dae4950dc4117"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",
"reference": "d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/9ba1b459828adc13430f4dd6c49dae4950dc4117",
"reference": "9ba1b459828adc13430f4dd6c49dae4950dc4117",
"shasum": ""
},
"require": {
@ -182,20 +182,20 @@
"minifier",
"minify"
],
"time": "2018-11-26T23:10:39+00:00"
"time": "2020-01-21T20:21:08+00:00"
},
{
"name": "matthiasmullie/path-converter",
"version": "1.1.2",
"version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/matthiasmullie/path-converter.git",
"reference": "5e4b121c8b9f97c80835c1d878b0812ba1d607c9"
"reference": "e7d13b2c7e2f2268e1424aaed02085518afa02d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/5e4b121c8b9f97c80835c1d878b0812ba1d607c9",
"reference": "5e4b121c8b9f97c80835c1d878b0812ba1d607c9",
"url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/e7d13b2c7e2f2268e1424aaed02085518afa02d9",
"reference": "e7d13b2c7e2f2268e1424aaed02085518afa02d9",
"shasum": ""
},
"require": {
@ -231,7 +231,7 @@
"paths",
"relative"
],
"time": "2018-10-25T15:19:41+00:00"
"time": "2019-02-05T23:41:09+00:00"
},
{
"name": "mustangostang/spyc",
@ -412,16 +412,16 @@
},
{
"name": "phpmailer/phpmailer",
"version": "v5.2.27",
"version": "v5.2.28",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "dde1db116511aa4956389d75546c5be4c2beb2a6"
"reference": "acba50393dd03da69a50226c139722af8b153b11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/dde1db116511aa4956389d75546c5be4c2beb2a6",
"reference": "dde1db116511aa4956389d75546c5be4c2beb2a6",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/acba50393dd03da69a50226c139722af8b153b11",
"reference": "acba50393dd03da69a50226c139722af8b153b11",
"shasum": ""
},
"require": {
@ -468,14 +468,14 @@
"LGPL-2.1"
],
"authors": [
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
@ -485,24 +485,38 @@
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"time": "2018-11-15T22:32:31+00:00"
"funding": [
{
"url": "https://marcus.bointon.com/donations/",
"type": "custom"
},
{
"url": "https://github.com/Synchro",
"type": "github"
},
{
"url": "https://www.patreon.com/marcusbointon",
"type": "patreon"
}
],
"time": "2020-03-19T14:29:37+00:00"
},
{
"name": "robthree/twofactorauth",
"version": "1.6.7",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/RobThree/TwoFactorAuth.git",
"reference": "3407c33775391fa8c36f7d766f26c5e59a736374"
"reference": "37983bf675c5baca09d19d6705170489d0df0002"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/RobThree/TwoFactorAuth/zipball/3407c33775391fa8c36f7d766f26c5e59a736374",
"reference": "3407c33775391fa8c36f7d766f26c5e59a736374",
"url": "https://api.github.com/repos/RobThree/TwoFactorAuth/zipball/37983bf675c5baca09d19d6705170489d0df0002",
"reference": "37983bf675c5baca09d19d6705170489d0df0002",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "@stable"
@ -536,7 +550,7 @@
"php",
"tfa"
],
"time": "2019-06-21T08:51:04+00:00"
"time": "2020-01-02T19:56:46+00:00"
},
{
"name": "soundasleep/html2text",
@ -633,5 +647,6 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
"platform-dev": [],
"plugin-api-version": "1.1.0"
}

View File

@ -279,7 +279,7 @@ class ClassLoader
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
@ -377,7 +377,7 @@ class ClassLoader
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {

View File

@ -13,6 +13,9 @@ class ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {

View File

@ -61,34 +61,34 @@
},
{
"name": "ddeboer/imap",
"version": "1.8.0",
"version_normalized": "1.8.0.0",
"version": "1.10.0",
"version_normalized": "1.10.0.0",
"source": {
"type": "git",
"url": "https://github.com/ddeboer/imap.git",
"reference": "ff985d72916267cba2f944e7c9ee654c69893219"
"reference": "fc09dbf6fb9ba7317a95c719e45893efc4fe6bde"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ddeboer/imap/zipball/ff985d72916267cba2f944e7c9ee654c69893219",
"reference": "ff985d72916267cba2f944e7c9ee654c69893219",
"url": "https://api.github.com/repos/ddeboer/imap/zipball/fc09dbf6fb9ba7317a95c719e45893efc4fe6bde",
"reference": "fc09dbf6fb9ba7317a95c719e45893efc4fe6bde",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"ext-imap": "*",
"ext-mbstring": "*",
"php": "^7.1"
"php": "^7.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"phpstan/phpstan": "^0.11",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-strict-rules": "^0.11.0",
"phpunit/phpunit": "^7.5",
"friendsofphp/php-cs-fixer": "^2.16",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^8.5",
"zendframework/zend-mail": "^2.10"
},
"time": "2019-04-15T09:18:52+00:00",
"time": "2020-01-24T08:15:24+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -105,13 +105,13 @@
"name": "David de Boer",
"email": "david@ddeboer.nl"
},
{
"name": "Community contributors",
"homepage": "https://github.com/ddeboer/imap/graphs/contributors"
},
{
"name": "Filippo Tessarotto",
"email": "zoeslam@gmail.com"
},
{
"name": "Community contributors",
"homepage": "https://github.com/ddeboer/imap/graphs/contributors"
}
],
"description": "Object-oriented IMAP for PHP",
@ -123,17 +123,17 @@
},
{
"name": "matthiasmullie/minify",
"version": "1.3.61",
"version_normalized": "1.3.61.0",
"version": "1.3.63",
"version_normalized": "1.3.63.0",
"source": {
"type": "git",
"url": "https://github.com/matthiasmullie/minify.git",
"reference": "d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751"
"reference": "9ba1b459828adc13430f4dd6c49dae4950dc4117"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",
"reference": "d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/9ba1b459828adc13430f4dd6c49dae4950dc4117",
"reference": "9ba1b459828adc13430f4dd6c49dae4950dc4117",
"shasum": ""
},
"require": {
@ -149,7 +149,7 @@
"suggest": {
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
},
"time": "2018-11-26T23:10:39+00:00",
"time": "2020-01-21T20:21:08+00:00",
"bin": [
"bin/minifycss",
"bin/minifyjs"
@ -185,17 +185,17 @@
},
{
"name": "matthiasmullie/path-converter",
"version": "1.1.2",
"version_normalized": "1.1.2.0",
"version": "1.1.3",
"version_normalized": "1.1.3.0",
"source": {
"type": "git",
"url": "https://github.com/matthiasmullie/path-converter.git",
"reference": "5e4b121c8b9f97c80835c1d878b0812ba1d607c9"
"reference": "e7d13b2c7e2f2268e1424aaed02085518afa02d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/5e4b121c8b9f97c80835c1d878b0812ba1d607c9",
"reference": "5e4b121c8b9f97c80835c1d878b0812ba1d607c9",
"url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/e7d13b2c7e2f2268e1424aaed02085518afa02d9",
"reference": "e7d13b2c7e2f2268e1424aaed02085518afa02d9",
"shasum": ""
},
"require": {
@ -205,7 +205,7 @@
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"time": "2018-10-25T15:19:41+00:00",
"time": "2019-02-05T23:41:09+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -419,17 +419,17 @@
},
{
"name": "phpmailer/phpmailer",
"version": "v5.2.27",
"version_normalized": "5.2.27.0",
"version": "v5.2.28",
"version_normalized": "5.2.28.0",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "dde1db116511aa4956389d75546c5be4c2beb2a6"
"reference": "acba50393dd03da69a50226c139722af8b153b11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/dde1db116511aa4956389d75546c5be4c2beb2a6",
"reference": "dde1db116511aa4956389d75546c5be4c2beb2a6",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/acba50393dd03da69a50226c139722af8b153b11",
"reference": "acba50393dd03da69a50226c139722af8b153b11",
"shasum": ""
},
"require": {
@ -459,7 +459,7 @@
"suggest": {
"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
},
"time": "2018-11-15T22:32:31+00:00",
"time": "2020-03-19T14:29:37+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -478,14 +478,14 @@
"LGPL-2.1"
],
"authors": [
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
@ -494,30 +494,44 @@
"name": "Brent R. Matzelle"
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP"
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"funding": [
{
"url": "https://marcus.bointon.com/donations/",
"type": "custom"
},
{
"url": "https://github.com/Synchro",
"type": "github"
},
{
"url": "https://www.patreon.com/marcusbointon",
"type": "patreon"
}
]
},
{
"name": "robthree/twofactorauth",
"version": "1.6.7",
"version_normalized": "1.6.7.0",
"version": "1.7.0",
"version_normalized": "1.7.0.0",
"source": {
"type": "git",
"url": "https://github.com/RobThree/TwoFactorAuth.git",
"reference": "3407c33775391fa8c36f7d766f26c5e59a736374"
"reference": "37983bf675c5baca09d19d6705170489d0df0002"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/RobThree/TwoFactorAuth/zipball/3407c33775391fa8c36f7d766f26c5e59a736374",
"reference": "3407c33775391fa8c36f7d766f26c5e59a736374",
"url": "https://api.github.com/repos/RobThree/TwoFactorAuth/zipball/37983bf675c5baca09d19d6705170489d0df0002",
"reference": "37983bf675c5baca09d19d6705170489d0df0002",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "@stable"
},
"time": "2019-06-21T08:51:04+00:00",
"time": "2020-01-02T19:56:46+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {

View File

@ -1,6 +1,44 @@
# Change Log
# Changelog
## [1.10.0](https://github.com/ddeboer/imap/tree/1.10.0) (2020-01-24)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.9.0...1.10.0)
**Implemented enhancements:**
- Handle comments \(CFWS\) in Date header + not-valid formats [\#439](https://github.com/ddeboer/imap/pull/439) ([pupaxxo](https://github.com/pupaxxo))
- Support PHP 7.4, require PHP 7.2 [\#433](https://github.com/ddeboer/imap/pull/433) ([Slamdunk](https://github.com/Slamdunk))
**Closed issues:**
- Invalid Date header when trying to fetching date on not RFC compliant emails [\#438](https://github.com/ddeboer/imap/issues/438)
**Merged pull requests:**
- Clear the last used mailbox cache when closing a connection [\#447](https://github.com/ddeboer/imap/pull/447) ([dhzavann](https://github.com/dhzavann))
- README: update PHP version to match composer.json [\#441](https://github.com/ddeboer/imap/pull/441) ([Slamdunk](https://github.com/Slamdunk))
- Typo [\#440](https://github.com/ddeboer/imap/pull/440) ([OskarStark](https://github.com/OskarStark))
## [1.9.0](https://github.com/ddeboer/imap/tree/1.9.0) (2019-11-25)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.8.0...1.9.0)
**Implemented enhancements:**
- Quota: let's also test the numbers [\#431](https://github.com/ddeboer/imap/pull/431) ([Slamdunk](https://github.com/Slamdunk))
- Add getQuota method using imap\_get\_quotaroot to Connection class [\#430](https://github.com/ddeboer/imap/pull/430) ([arkadiusjonczek](https://github.com/arkadiusjonczek))
**Closed issues:**
- markAsSeen\(\) not work [\#415](https://github.com/ddeboer/imap/issues/415)
**Merged pull requests:**
- CS Fix: strip redundant php docs [\#428](https://github.com/ddeboer/imap/pull/428) ([Slamdunk](https://github.com/Slamdunk))
- Fix: Variable name [\#412](https://github.com/ddeboer/imap/pull/412) ([localheinz](https://github.com/localheinz))
## [1.8.0](https://github.com/ddeboer/imap/tree/1.8.0) (2019-04-15)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.7.2...1.8.0)
**Implemented enhancements:**
@ -8,6 +46,7 @@
- Add phpstan-strict-rules, expose PartiInterface::getDescription\(\) [\#409](https://github.com/ddeboer/imap/pull/409) ([Slamdunk](https://github.com/Slamdunk))
## [1.7.2](https://github.com/ddeboer/imap/tree/1.7.2) (2019-04-12)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.7.1...1.7.2)
**Fixed bugs:**
@ -15,6 +54,7 @@
- Handle message/rfc822 when content-disposition is missing [\#410](https://github.com/ddeboer/imap/pull/410) ([Daredzik](https://github.com/Daredzik))
## [1.7.1](https://github.com/ddeboer/imap/tree/1.7.1) (2019-03-18)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.7.0...1.7.1)
**Fixed bugs:**
@ -23,6 +63,7 @@
- imap\_search/imap\_sort: default params must not be passed if unspecified [\#406](https://github.com/ddeboer/imap/pull/406) ([Slamdunk](https://github.com/Slamdunk))
## [1.7.0](https://github.com/ddeboer/imap/tree/1.7.0) (2019-03-04)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.6.0...1.7.0)
**Implemented enhancements:**
@ -44,6 +85,7 @@
- Add Feature Requests to README.md [\#394](https://github.com/ddeboer/imap/pull/394) ([Slamdunk](https://github.com/Slamdunk))
## [1.6.0](https://github.com/ddeboer/imap/tree/1.6.0) (2018-12-04)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.5.5...1.6.0)
**Implemented enhancements:**
@ -68,6 +110,7 @@
- Caching IMAP server connections [\#88](https://github.com/ddeboer/imap/issues/88)
## [1.5.5](https://github.com/ddeboer/imap/tree/1.5.5) (2018-08-21)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.5.4...1.5.5)
**Fixed bugs:**
@ -76,6 +119,7 @@
- Handle plain/text attachments without Content-Type header [\#367](https://github.com/ddeboer/imap/pull/367) ([Slamdunk](https://github.com/Slamdunk))
## [1.5.4](https://github.com/ddeboer/imap/tree/1.5.4) (2018-08-19)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.5.3...1.5.4)
**Fixed bugs:**
@ -84,6 +128,7 @@
- Support RFC2231 attachment filenames [\#366](https://github.com/ddeboer/imap/pull/366) ([Slamdunk](https://github.com/Slamdunk))
## [1.5.3](https://github.com/ddeboer/imap/tree/1.5.3) (2018-07-20)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.5.2...1.5.3)
**Fixed bugs:**
@ -91,6 +136,7 @@
- Dates: handle UT timezone [\#361](https://github.com/ddeboer/imap/pull/361) ([Slamdunk](https://github.com/Slamdunk))
## [1.5.2](https://github.com/ddeboer/imap/tree/1.5.2) (2018-07-10)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.5.1...1.5.2)
**Fixed bugs:**
@ -99,6 +145,7 @@
- Handle invalid headers [\#359](https://github.com/ddeboer/imap/pull/359) ([Slamdunk](https://github.com/Slamdunk))
## [1.5.1](https://github.com/ddeboer/imap/tree/1.5.1) (2018-05-04)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.5.0...1.5.1)
**Fixed bugs:**
@ -107,13 +154,19 @@
- Fix handle of attachment messages with attachments [\#343](https://github.com/ddeboer/imap/pull/343) ([Slamdunk](https://github.com/Slamdunk))
## [1.5.0](https://github.com/ddeboer/imap/tree/1.5.0) (2018-03-26)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.4.1...1.5.0)
**Implemented enhancements:**
- ImapResource: cache last opened mailbox [\#328](https://github.com/ddeboer/imap/pull/328) ([Slamdunk](https://github.com/Slamdunk))
**Fixed bugs:**
- AbstractPart::isAttachment\(\) handle unknown part type [\#302](https://github.com/ddeboer/imap/pull/302) ([Slamdunk](https://github.com/Slamdunk))
## [1.4.1](https://github.com/ddeboer/imap/tree/1.4.1) (2018-03-22)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.4.0...1.4.1)
**Fixed bugs:**
@ -126,6 +179,7 @@
- Add entry in README about Mailbox::addMessage [\#325](https://github.com/ddeboer/imap/pull/325) ([soywod](https://github.com/soywod))
## [1.4.0](https://github.com/ddeboer/imap/tree/1.4.0) (2018-03-19)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.3.1...1.4.0)
**Implemented enhancements:**
@ -139,6 +193,7 @@
- imap\_mime\_header\_decode may return false [\#322](https://github.com/ddeboer/imap/pull/322) ([Slamdunk](https://github.com/Slamdunk))
## [1.3.1](https://github.com/ddeboer/imap/tree/1.3.1) (2018-03-09)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.3.0...1.3.1)
**Implemented enhancements:**
@ -150,6 +205,7 @@
- getServerString\(\) with no port [\#311](https://github.com/ddeboer/imap/issues/311)
## [1.3.0](https://github.com/ddeboer/imap/tree/1.3.0) (2018-02-28)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.2.3...1.3.0)
**Implemented enhancements:**
@ -165,18 +221,19 @@
- README.md: add `Unknown search criterion: OR` note [\#304](https://github.com/ddeboer/imap/pull/304) ([Slamdunk](https://github.com/Slamdunk))
## [1.2.3](https://github.com/ddeboer/imap/tree/1.2.3) (2018-02-09)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.2.2...1.2.3)
**Fixed bugs:**
- $part-\>type can be 9 [\#301](https://github.com/ddeboer/imap/issues/301)
- AbstractPart::isAttachment\(\) handle unknown part type [\#302](https://github.com/ddeboer/imap/pull/302) ([Slamdunk](https://github.com/Slamdunk))
**Merged pull requests:**
- README.md: code-coverage has higher priority than Scrutinizer [\#300](https://github.com/ddeboer/imap/pull/300) ([Slamdunk](https://github.com/Slamdunk))
## [1.2.2](https://github.com/ddeboer/imap/tree/1.2.2) (2018-02-05)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.2.1...1.2.2)
**Implemented enhancements:**
@ -189,6 +246,7 @@
- Don't handle multiplart as an attachment [\#298](https://github.com/ddeboer/imap/pull/298) ([Slamdunk](https://github.com/Slamdunk))
## [1.2.1](https://github.com/ddeboer/imap/tree/1.2.1) (2018-01-29)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.2.0...1.2.1)
**Implemented enhancements:**
@ -203,6 +261,7 @@
- MessageIterator: forbid raw calls [\#290](https://github.com/ddeboer/imap/pull/290) ([Slamdunk](https://github.com/Slamdunk))
## [1.2.0](https://github.com/ddeboer/imap/tree/1.2.0) (2018-01-15)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.1.2...1.2.0)
**Implemented enhancements:**
@ -222,6 +281,7 @@
- Appending mail with options [\#279](https://github.com/ddeboer/imap/issues/279)
## [1.1.2](https://github.com/ddeboer/imap/tree/1.1.2) (2017-12-12)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.1.1...1.1.2)
**Fixed bugs:**
@ -230,6 +290,7 @@
- Support Microsoft charset values [\#271](https://github.com/ddeboer/imap/pull/271) ([Slamdunk](https://github.com/Slamdunk))
## [1.1.1](https://github.com/ddeboer/imap/tree/1.1.1) (2017-11-10)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.1.0...1.1.1)
**Implemented enhancements:**
@ -245,12 +306,11 @@
- README.md: add timeout note [\#263](https://github.com/ddeboer/imap/pull/263) ([Slamdunk](https://github.com/Slamdunk))
## [1.1.0](https://github.com/ddeboer/imap/tree/1.1.0) (2017-11-06)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.0.8...1.1.0)
**Implemented enhancements:**
- Headers: no catchable exception [\#246](https://github.com/ddeboer/imap/issues/246)
- imap\_thread [\#113](https://github.com/ddeboer/imap/issues/113)
- Deprecate MessageInterface::maskAsSeen\(\) in favour of MessageInterface::markAsSeen\(\) [\#255](https://github.com/ddeboer/imap/pull/255) ([Slamdunk](https://github.com/Slamdunk))
- Lazy load structured Headers [\#250](https://github.com/ddeboer/imap/pull/250) ([Slamdunk](https://github.com/Slamdunk))
- Implement imap\_thread [\#249](https://github.com/ddeboer/imap/pull/249) ([Slamdunk](https://github.com/Slamdunk))
@ -268,14 +328,21 @@
- README.md: add Table of Contents with Travis checker [\#234](https://github.com/ddeboer/imap/pull/234) ([Slamdunk](https://github.com/Slamdunk))
## [1.0.8](https://github.com/ddeboer/imap/tree/1.0.8) (2017-10-27)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.0.7...1.0.8)
**Implemented enhancements:**
- Headers: no catchable exception [\#246](https://github.com/ddeboer/imap/issues/246)
- imap\_thread [\#113](https://github.com/ddeboer/imap/issues/113)
**Fixed bugs:**
- \[TypeError\] Return value of Ddeboer\Imap\Message\AbstractMessage::getId\(\) must be of the type string, null returned [\#253](https://github.com/ddeboer/imap/issues/253)
- BasicMessageInterface::getId\(\) can be null [\#254](https://github.com/ddeboer/imap/pull/254) ([Slamdunk](https://github.com/Slamdunk))
## [1.0.7](https://github.com/ddeboer/imap/tree/1.0.7) (2017-10-16)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.0.6...1.0.7)
**Fixed bugs:**
@ -284,6 +351,7 @@
- IMAP resource must be checked at every call for mailbox context [\#247](https://github.com/ddeboer/imap/pull/247) ([Slamdunk](https://github.com/Slamdunk))
## [1.0.6](https://github.com/ddeboer/imap/tree/1.0.6) (2017-10-12)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.0.5...1.0.6)
**Fixed bugs:**
@ -293,6 +361,7 @@
- Message: From header can be absent [\#242](https://github.com/ddeboer/imap/pull/242) ([Slamdunk](https://github.com/Slamdunk))
## [1.0.5](https://github.com/ddeboer/imap/tree/1.0.5) (2017-10-12)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.0.4...1.0.5)
**Fixed bugs:**
@ -300,6 +369,7 @@
- Use set\_error\_handler with late exception [\#240](https://github.com/ddeboer/imap/pull/240) ([Slamdunk](https://github.com/Slamdunk))
## [1.0.4](https://github.com/ddeboer/imap/tree/1.0.4) (2017-10-11)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.0.3...1.0.4)
**Implemented enhancements:**
@ -312,6 +382,7 @@
- Relay also iconv during decoding [\#238](https://github.com/ddeboer/imap/pull/238) ([Slamdunk](https://github.com/Slamdunk))
## [1.0.3](https://github.com/ddeboer/imap/tree/1.0.3) (2017-10-11)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.0.2...1.0.3)
**Fixed bugs:**
@ -319,6 +390,7 @@
- Attachment::getFilename\(\) may be null on inline-att, widen return type [\#235](https://github.com/ddeboer/imap/pull/235) ([wujku](https://github.com/wujku))
## [1.0.2](https://github.com/ddeboer/imap/tree/1.0.2) (2017-10-06)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.0.1...1.0.2)
**Fixed bugs:**
@ -327,6 +399,7 @@
- Do not charset-decode attachments [\#231](https://github.com/ddeboer/imap/pull/231) ([Slamdunk](https://github.com/Slamdunk))
## [1.0.1](https://github.com/ddeboer/imap/tree/1.0.1) (2017-10-05)
[Full Changelog](https://github.com/ddeboer/imap/compare/1.0.0...1.0.1)
**Fixed bugs:**
@ -335,6 +408,7 @@
- If charset is not specified defaults to "us-ascii" [\#227](https://github.com/ddeboer/imap/pull/227) ([Slamdunk](https://github.com/Slamdunk))
## [1.0.0](https://github.com/ddeboer/imap/tree/1.0.0) (2017-10-04)
[Full Changelog](https://github.com/ddeboer/imap/compare/0.5.2...1.0.0)
**Implemented enhancements:**
@ -435,6 +509,7 @@
- README.md updates [\#178](https://github.com/ddeboer/imap/pull/178) ([Slamdunk](https://github.com/Slamdunk))
## [0.5.2](https://github.com/ddeboer/imap/tree/0.5.2) (2015-12-03)
[Full Changelog](https://github.com/ddeboer/imap/compare/0.5.1...0.5.2)
**Closed issues:**
@ -451,6 +526,7 @@
- Make sure imap connection are reopened [\#79](https://github.com/ddeboer/imap/pull/79) ([joserobleda](https://github.com/joserobleda))
## [0.5.1](https://github.com/ddeboer/imap/tree/0.5.1) (2015-02-01)
[Full Changelog](https://github.com/ddeboer/imap/compare/0.5.0...0.5.1)
**Closed issues:**
@ -466,6 +542,7 @@
- Add support for attachments without content disposition [\#70](https://github.com/ddeboer/imap/pull/70) ([ddeboer](https://github.com/ddeboer))
## [0.5.0](https://github.com/ddeboer/imap/tree/0.5.0) (2015-01-24)
[Full Changelog](https://github.com/ddeboer/imap/compare/0.4.0...0.5.0)
**Closed issues:**
@ -476,6 +553,7 @@
- How get I getMessages but newest first ... [\#11](https://github.com/ddeboer/imap/issues/11)
## [0.4.0](https://github.com/ddeboer/imap/tree/0.4.0) (2015-01-04)
[Full Changelog](https://github.com/ddeboer/imap/compare/0.3.1...0.4.0)
**Closed issues:**
@ -496,6 +574,7 @@
- fixed typo [\#45](https://github.com/ddeboer/imap/pull/45) ([xelan](https://github.com/xelan))
## [0.3.1](https://github.com/ddeboer/imap/tree/0.3.1) (2014-08-11)
[Full Changelog](https://github.com/ddeboer/imap/compare/0.3.0...0.3.1)
**Merged pull requests:**
@ -503,6 +582,7 @@
- \imap\_header dosen't work with UID [\#44](https://github.com/ddeboer/imap/pull/44) ([ysramirez](https://github.com/ysramirez))
## [0.3.0](https://github.com/ddeboer/imap/tree/0.3.0) (2014-08-10)
[Full Changelog](https://github.com/ddeboer/imap/compare/0.2...0.3.0)
**Closed issues:**
@ -522,9 +602,13 @@
- Fixed typo [\#32](https://github.com/ddeboer/imap/pull/32) ([abhinavkumar940](https://github.com/abhinavkumar940))
## [0.2](https://github.com/ddeboer/imap/tree/0.2) (2013-11-24)
[Full Changelog](https://github.com/ddeboer/imap/compare/0.1...0.2)
## [0.1](https://github.com/ddeboer/imap/tree/0.1) (2013-11-22)
[Full Changelog](https://github.com/ddeboer/imap/compare/c02d49cdb9246901bb00d211a0f2aba208f6fab6...0.1)
**Closed issues:**
- Prevent setting SEEN flag [\#20](https://github.com/ddeboer/imap/issues/20)
@ -550,4 +634,4 @@
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*

View File

@ -6,7 +6,7 @@
[![Latest Stable Version](https://poser.pugx.org/ddeboer/imap/v/stable.svg)](https://packagist.org/packages/ddeboer/imap)
[![Total Downloads](https://poser.pugx.org/ddeboer/imap/downloads.png)](https://packagist.org/packages/ddeboer/imap)
A PHP 7.1+ library to read and process e-mails over IMAP.
A PHP 7.2+ library to read and process e-mails over IMAP.
This library requires [IMAP](https://secure.php.net/manual/en/book.imap.php),
[iconv](https://secure.php.net/manual/en/book.iconv.php) and
@ -159,10 +159,10 @@ function:
```php
$today = new DateTimeImmutable();
$lastMonth = $today->sub(new DateInterval('P30D'));
$thirtyDaysAgo = $today->sub(new DateInterval('P30D'));
$messages = $mailbox->getMessages(
new Ddeboer\Imap\Search\Date\Since($lastMonth),
new Ddeboer\Imap\Search\Date\Since($thirtyDaysAgo),
\SORTDATE, // Sort criteria
true // Descending order
);

View File

@ -22,17 +22,17 @@
}
],
"require": {
"php": "^7.1",
"php": "^7.2",
"ext-iconv": "*",
"ext-imap": "*",
"ext-mbstring": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"phpstan/phpstan": "^0.11",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-strict-rules": "^0.11.0",
"phpunit/phpunit": "^7.5",
"friendsofphp/php-cs-fixer": "^2.16",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^8.5",
"zendframework/zend-mail": "^2.10"
},
"autoload": {

View File

@ -8,6 +8,7 @@ use Ddeboer\Imap\Exception\CreateMailboxException;
use Ddeboer\Imap\Exception\DeleteMailboxException;
use Ddeboer\Imap\Exception\ImapGetmailboxesException;
use Ddeboer\Imap\Exception\ImapNumMsgException;
use Ddeboer\Imap\Exception\ImapQuotaException;
use Ddeboer\Imap\Exception\InvalidResourceException;
use Ddeboer\Imap\Exception\MailboxDoesNotExistException;
@ -39,9 +40,6 @@ final class Connection implements ConnectionInterface
/**
* Constructor.
*
* @param ImapResourceInterface $resource
* @param string $server
*
* @throws \InvalidArgumentException
*/
public function __construct(ImapResourceInterface $resource, string $server)
@ -52,8 +50,6 @@ final class Connection implements ConnectionInterface
/**
* Get IMAP resource.
*
* @return ImapResourceInterface
*/
public function getResource(): ImapResourceInterface
{
@ -62,8 +58,6 @@ final class Connection implements ConnectionInterface
/**
* Delete all messages marked for deletion.
*
* @return bool
*/
public function expunge(): bool
{
@ -72,16 +66,46 @@ final class Connection implements ConnectionInterface
/**
* Close connection.
*
* @param int $flag
*
* @return bool
*/
public function close(int $flag = 0): bool
{
$this->resource->clearLastMailboxUsedCache();
return \imap_close($this->resource->getStream(), $flag);
}
/**
* Get Mailbox quota.
*/
public function getQuota(string $root = 'INBOX'): array
{
$errorMessage = null;
$errorNumber = 0;
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber): bool {
$errorMessage = $message;
$errorNumber = $nr;
return true;
});
$return = \imap_get_quotaroot($this->resource->getStream(), $root);
\restore_error_handler();
if (false === $return || null !== $errorMessage) {
throw new ImapQuotaException(
\sprintf(
'IMAP Quota request failed for "%s"%s',
$root,
null !== $errorMessage ? ': ' . $errorMessage : ''
),
$errorNumber
);
}
return $return;
}
/**
* Get a list of mailboxes (also known as folders).
*
@ -105,8 +129,6 @@ final class Connection implements ConnectionInterface
* Check that a mailbox with the given name exists.
*
* @param string $name Mailbox name
*
* @return bool
*/
public function hasMailbox(string $name): bool
{
@ -121,8 +143,6 @@ final class Connection implements ConnectionInterface
* @param string $name Mailbox name
*
* @throws MailboxDoesNotExistException If mailbox does not exist
*
* @return MailboxInterface
*/
public function getMailbox(string $name): MailboxInterface
{
@ -153,8 +173,6 @@ final class Connection implements ConnectionInterface
* Check if the connection is still active.
*
* @throws InvalidResourceException If connection was closed
*
* @return bool
*/
public function ping(): bool
{
@ -164,11 +182,7 @@ final class Connection implements ConnectionInterface
/**
* Create mailbox.
*
* @param string $name
*
* @throws CreateMailboxException
*
* @return MailboxInterface
*/
public function createMailbox(string $name): MailboxInterface
{
@ -185,8 +199,6 @@ final class Connection implements ConnectionInterface
/**
* Create mailbox.
*
* @param MailboxInterface $mailbox
*
* @throws DeleteMailboxException
*/
public function deleteMailbox(MailboxInterface $mailbox): void

View File

@ -11,34 +11,29 @@ interface ConnectionInterface extends \Countable
{
/**
* Get IMAP resource.
*
* @return ImapResourceInterface
*/
public function getResource(): ImapResourceInterface;
/**
* Delete all messages marked for deletion.
*
* @return bool
*/
public function expunge(): bool;
/**
* Close connection.
*
* @param int $flag
*
* @return bool
*/
public function close(int $flag = 0): bool;
/**
* Check if the connection is still active.
*
* @return bool
*/
public function ping(): bool;
/**
* Get Mailbox quota.
*/
public function getQuota(string $root = 'INBOX'): array;
/**
* Get a list of mailboxes (also known as folders).
*
@ -50,8 +45,6 @@ interface ConnectionInterface extends \Countable
* Check that a mailbox with the given name exists.
*
* @param string $name Mailbox name
*
* @return bool
*/
public function hasMailbox(string $name): bool;
@ -59,24 +52,16 @@ interface ConnectionInterface extends \Countable
* Get a mailbox by its name.
*
* @param string $name Mailbox name
*
* @return MailboxInterface
*/
public function getMailbox(string $name): MailboxInterface;
/**
* Create mailbox.
*
* @param string $name
*
* @return MailboxInterface
*/
public function createMailbox(string $name): MailboxInterface;
/**
* Create mailbox.
*
* @param MailboxInterface $mailbox
* Delete mailbox.
*/
public function deleteMailbox(MailboxInterface $mailbox): void;
}

View File

@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
namespace Ddeboer\Imap\Exception;
final class ImapQuotaException extends AbstractException
{
}

View File

@ -49,8 +49,6 @@ final class Mailbox implements MailboxInterface
/**
* Get mailbox decoded name.
*
* @return string
*/
public function getName(): string
{
@ -59,8 +57,6 @@ final class Mailbox implements MailboxInterface
/**
* Get mailbox encoded path.
*
* @return string
*/
public function getEncodedName(): string
{
@ -72,8 +68,6 @@ final class Mailbox implements MailboxInterface
/**
* Get mailbox encoded full name.
*
* @return string
*/
public function getFullEncodedName(): string
{
@ -82,8 +76,6 @@ final class Mailbox implements MailboxInterface
/**
* Get mailbox attributes.
*
* @return int
*/
public function getAttributes(): int
{
@ -92,8 +84,6 @@ final class Mailbox implements MailboxInterface
/**
* Get mailbox delimiter.
*
* @return string
*/
public function getDelimiter(): string
{
@ -118,10 +108,6 @@ final class Mailbox implements MailboxInterface
/**
* Get Mailbox status.
*
* @param null|int $flags
*
* @return \stdClass
*/
public function getStatus(int $flags = null): \stdClass
{
@ -139,8 +125,6 @@ final class Mailbox implements MailboxInterface
*
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
* @param array|MessageIterator|string $numbers Message numbers
*
* @return bool
*/
public function setFlag(string $flag, $numbers): bool
{
@ -152,8 +136,6 @@ final class Mailbox implements MailboxInterface
*
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
* @param array|MessageIterator|string $numbers Message numbers
*
* @return bool
*/
public function clearFlag(string $flag, $numbers): bool
{
@ -164,8 +146,6 @@ final class Mailbox implements MailboxInterface
* Get message ids.
*
* @param ConditionInterface $search Search expression (optional)
*
* @return MessageIteratorInterface
*/
public function getMessages(ConditionInterface $search = null, int $sortCriteria = null, bool $descending = false, string $charset = null): MessageIteratorInterface
{
@ -217,8 +197,6 @@ final class Mailbox implements MailboxInterface
* Get message iterator for a sequence.
*
* @param string $sequence Message numbers
*
* @return MessageIteratorInterface
*/
public function getMessageSequence(string $sequence): MessageIteratorInterface
{
@ -242,8 +220,6 @@ final class Mailbox implements MailboxInterface
* Get a message by message number.
*
* @param int $number Message number
*
* @return MessageInterface
*/
public function getMessage(int $number): MessageInterface
{
@ -252,8 +228,6 @@ final class Mailbox implements MailboxInterface
/**
* Get messages in this mailbox.
*
* @return MessageIteratorInterface
*/
public function getIterator(): MessageIteratorInterface
{
@ -262,12 +236,6 @@ final class Mailbox implements MailboxInterface
/**
* Add a message to the mailbox.
*
* @param string $message
* @param null|string $options
* @param null|DateTimeInterface $internalDate
*
* @return bool
*/
public function addMessage(string $message, string $options = null, DateTimeInterface $internalDate = null): bool
{
@ -288,12 +256,12 @@ final class Mailbox implements MailboxInterface
/**
* Returns a tree of threaded message for the current Mailbox.
*
* @return array
*/
public function getThread(): array
{
\set_error_handler(static function () {});
\set_error_handler(static function (): bool {
return true;
});
/** @var array|false $tree */
$tree = \imap_thread($this->resource->getStream());
@ -337,8 +305,6 @@ final class Mailbox implements MailboxInterface
* Prepare message ids for the use with bulk functions.
*
* @param array|MessageIterator|string $messageIds Message numbers
*
* @return string
*/
private function prepareMessageIds($messageIds): string
{

View File

@ -14,45 +14,31 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
{
/**
* Get mailbox decoded name.
*
* @return string
*/
public function getName(): string;
/**
* Get mailbox encoded path.
*
* @return string
*/
public function getEncodedName(): string;
/**
* Get mailbox encoded full name.
*
* @return string
*/
public function getFullEncodedName(): string;
/**
* Get mailbox attributes.
*
* @return int
*/
public function getAttributes(): int;
/**
* Get mailbox delimiter.
*
* @return string
*/
public function getDelimiter(): string;
/**
* Get Mailbox status.
*
* @param null|int $flags
*
* @return \stdClass
*/
public function getStatus(int $flags = null): \stdClass;
@ -61,8 +47,6 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
*
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
* @param array|MessageIterator|string $numbers Message numbers
*
* @return bool
*/
public function setFlag(string $flag, $numbers): bool;
@ -71,8 +55,6 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
*
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
* @param array|MessageIterator|string $numbers Message numbers
*
* @return bool
*/
public function clearFlag(string $flag, $numbers): bool;
@ -80,8 +62,6 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
* Get message ids.
*
* @param ConditionInterface $search Search expression (optional)
*
* @return MessageIteratorInterface
*/
public function getMessages(ConditionInterface $search = null, int $sortCriteria = null, bool $descending = false, string $charset = null): MessageIteratorInterface;
@ -89,8 +69,6 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
* Get message iterator for a sequence.
*
* @param string $sequence Message numbers
*
* @return MessageIteratorInterface
*/
public function getMessageSequence(string $sequence): MessageIteratorInterface;
@ -98,33 +76,21 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
* Get a message by message number.
*
* @param int $number Message number
*
* @return MessageInterface
*/
public function getMessage(int $number): MessageInterface;
/**
* Get messages in this mailbox.
*
* @return MessageIteratorInterface
*/
public function getIterator(): MessageIteratorInterface;
/**
* Add a message to the mailbox.
*
* @param string $message
* @param null|string $options
* @param null|DateTimeInterface $internalDate
*
* @return bool
*/
public function addMessage(string $message, string $options = null, DateTimeInterface $internalDate = null): bool;
/**
* Returns a tree of threaded message for the current Mailbox.
*
* @return array
*/
public function getThread(): array;

View File

@ -73,9 +73,11 @@ final class Message extends Message\AbstractMessage implements MessageInterface
$errorMessage = null;
$errorNumber = 0;
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber) {
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber): bool {
$errorMessage = $message;
$errorNumber = $nr;
return true;
});
$structure = \imap_fetchstructure(
@ -99,8 +101,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Ensure message exists.
*
* @param int $messageNumber
*/
protected function assertMessageExists(int $messageNumber): void
{
@ -132,8 +132,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Get raw message headers.
*
* @return string
*/
public function getRawHeaders(): string
{
@ -166,8 +164,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Get message headers.
*
* @return Message\Headers
*/
public function getHeaders(): Message\Headers
{
@ -196,8 +192,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Get message recent flag value (from headers).
*
* @return null|string
*/
public function isRecent(): ?string
{
@ -206,8 +200,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Get message unseen flag value (from headers).
*
* @return bool
*/
public function isUnseen(): bool
{
@ -216,8 +208,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Get message flagged flag value (from headers).
*
* @return bool
*/
public function isFlagged(): bool
{
@ -226,8 +216,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Get message answered flag value (from headers).
*
* @return bool
*/
public function isAnswered(): bool
{
@ -236,8 +224,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Get message deleted flag value (from headers).
*
* @return bool
*/
public function isDeleted(): bool
{
@ -246,8 +232,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Get message draft flag value (from headers).
*
* @return bool
*/
public function isDraft(): bool
{
@ -256,8 +240,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Has the message been marked as read?
*
* @return bool
*/
public function isSeen(): bool
{
@ -267,8 +249,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Mark message as seen.
*
* @return bool
*
* @deprecated since version 1.1, to be removed in 2.0
*/
public function maskAsSeen(): bool
@ -280,8 +260,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Mark message as seen.
*
* @return bool
*/
public function markAsSeen(): bool
{
@ -291,8 +269,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Move message to another mailbox.
*
* @param MailboxInterface $mailbox
*
* @throws MessageCopyException
*/
public function copy(MailboxInterface $mailbox): void
@ -308,8 +284,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
/**
* Move message to another mailbox.
*
* @param MailboxInterface $mailbox
*
* @throws MessageMoveException
*/
public function move(MailboxInterface $mailbox): void
@ -355,8 +329,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
* Set Flag Message.
*
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
*
* @return bool
*/
public function setFlag(string $flag): bool
{
@ -371,8 +343,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
* Clear Flag Message.
*
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
*
* @return bool
*/
public function clearFlag(string $flag): bool
{

View File

@ -15,8 +15,6 @@ abstract class AbstractMessage extends AbstractPart
/**
* Get message headers.
*
* @return Headers
*/
abstract public function getHeaders(): Headers;
@ -24,8 +22,6 @@ abstract class AbstractMessage extends AbstractPart
* Get message id.
*
* A unique message id in the form <...>
*
* @return null|string
*/
final public function getId(): ?string
{
@ -34,8 +30,6 @@ abstract class AbstractMessage extends AbstractPart
/**
* Get message sender (from headers).
*
* @return null|EmailAddress
*/
final public function getFrom(): ?EmailAddress
{
@ -106,8 +100,6 @@ abstract class AbstractMessage extends AbstractPart
/**
* Get date (from headers).
*
* @return null|\DateTimeImmutable
*/
final public function getDate(): ?\DateTimeImmutable
{
@ -120,11 +112,13 @@ abstract class AbstractMessage extends AbstractPart
$alteredValue = $dateHeader;
$alteredValue = \str_replace(',', '', $alteredValue);
$alteredValue = (string) \preg_replace('/^[a-zA-Z]+ ?/', '', $alteredValue);
$alteredValue = (string) \preg_replace('/ +\(.*\)/', '', $alteredValue);
$alteredValue = (string) \preg_replace('/\(.*\)/', '', $alteredValue);
$alteredValue = (string) \preg_replace('/\bUT\b/', 'UTC', $alteredValue);
if (0 === \preg_match('/\d\d:\d\d:\d\d.* [\+\-]\d\d:?\d\d/', $alteredValue)) {
$alteredValue .= ' +0000';
}
// Handle numeric months
$alteredValue = (string) \preg_replace('/^(\d\d) (\d\d) (\d\d(?:\d\d)?) /', '$3-$2-$1 ', $alteredValue);
try {
$date = new \DateTimeImmutable($alteredValue);
@ -147,8 +141,6 @@ abstract class AbstractMessage extends AbstractPart
/**
* Get message subject (from headers).
*
* @return null|string
*/
final public function getSubject(): ?string
{
@ -157,8 +149,6 @@ abstract class AbstractMessage extends AbstractPart
/**
* Get message In-Reply-To (from headers).
*
* @return array
*/
final public function getInReplyTo(): array
{
@ -169,8 +159,6 @@ abstract class AbstractMessage extends AbstractPart
/**
* Get message References (from headers).
*
* @return array
*/
final public function getReferences(): array
{
@ -181,8 +169,6 @@ abstract class AbstractMessage extends AbstractPart
/**
* Get body HTML.
*
* @return null|string
*/
final public function getBodyHtml(): ?string
{
@ -203,8 +189,6 @@ abstract class AbstractMessage extends AbstractPart
/**
* Get body text.
*
* @return null|string
*/
final public function getBodyText(): ?string
{
@ -237,11 +221,6 @@ abstract class AbstractMessage extends AbstractPart
return $this->attachments;
}
/**
* @param PartInterface $part
*
* @return array
*/
private static function gatherAttachments(PartInterface $part): array
{
$attachments = [];
@ -259,8 +238,6 @@ abstract class AbstractMessage extends AbstractPart
/**
* Does this message have attachments?
*
* @return bool
*/
final public function hasAttachments(): bool
{
@ -269,8 +246,6 @@ abstract class AbstractMessage extends AbstractPart
/**
* @param \stdClass[] $addresses
*
* @return array
*/
private function decodeEmailAddresses(array $addresses): array
{
@ -284,11 +259,6 @@ abstract class AbstractMessage extends AbstractPart
return $return;
}
/**
* @param \stdClass $value
*
* @return EmailAddress
*/
private function decodeEmailAddress(\stdClass $value): EmailAddress
{
return new EmailAddress($value->mailbox, $value->host, $value->personal);

View File

@ -157,8 +157,6 @@ abstract class AbstractPart implements PartInterface
/**
* Get message number (from headers).
*
* @return int
*/
final public function getNumber(): int
{
@ -169,8 +167,6 @@ abstract class AbstractPart implements PartInterface
/**
* Ensure message exists.
*
* @param int $messageNumber
*/
protected function assertMessageExists(int $messageNumber): void
{
@ -186,8 +182,6 @@ abstract class AbstractPart implements PartInterface
/**
* Part structure.
*
* @return \stdClass
*/
final public function getStructure(): \stdClass
{
@ -205,8 +199,6 @@ abstract class AbstractPart implements PartInterface
/**
* Part parameters.
*
* @return Parameters
*/
final public function getParameters(): Parameters
{
@ -217,8 +209,6 @@ abstract class AbstractPart implements PartInterface
/**
* Part charset.
*
* @return null|string
*/
final public function getCharset(): ?string
{
@ -229,8 +219,6 @@ abstract class AbstractPart implements PartInterface
/**
* Part type.
*
* @return null|string
*/
final public function getType(): ?string
{
@ -241,8 +229,6 @@ abstract class AbstractPart implements PartInterface
/**
* Part subtype.
*
* @return null|string
*/
final public function getSubtype(): ?string
{
@ -253,8 +239,6 @@ abstract class AbstractPart implements PartInterface
/**
* Part encoding.
*
* @return null|string
*/
final public function getEncoding(): ?string
{
@ -265,8 +249,6 @@ abstract class AbstractPart implements PartInterface
/**
* Part disposition.
*
* @return null|string
*/
final public function getDisposition(): ?string
{
@ -277,8 +259,6 @@ abstract class AbstractPart implements PartInterface
/**
* Part description.
*
* @return null|string
*/
final public function getDescription(): ?string
{
@ -301,8 +281,6 @@ abstract class AbstractPart implements PartInterface
/**
* Part lines.
*
* @return null|string
*/
final public function getLines(): ?string
{
@ -313,8 +291,6 @@ abstract class AbstractPart implements PartInterface
/**
* Get raw part content.
*
* @return string
*/
final public function getContent(): string
{
@ -327,8 +303,6 @@ abstract class AbstractPart implements PartInterface
/**
* Get content part number.
*
* @return string
*/
protected function getContentPartNumber(): string
{
@ -337,8 +311,6 @@ abstract class AbstractPart implements PartInterface
/**
* Get part number.
*
* @return string
*/
final public function getPartNumber(): string
{
@ -347,8 +319,6 @@ abstract class AbstractPart implements PartInterface
/**
* Get decoded part content.
*
* @return string
*/
final public function getDecodedContent(): string
{
@ -382,10 +352,6 @@ abstract class AbstractPart implements PartInterface
/**
* Get raw message content.
*
* @param string $partNumber
*
* @return string
*/
final protected function doGetContent(string $partNumber): string
{
@ -462,7 +428,7 @@ abstract class AbstractPart implements PartInterface
/**
* Move to next part.
*
* @return int
* @return void
*/
final public function next()
{
@ -472,7 +438,7 @@ abstract class AbstractPart implements PartInterface
/**
* Reset part key.
*
* @return int
* @return void
*/
final public function rewind()
{
@ -556,10 +522,6 @@ abstract class AbstractPart implements PartInterface
/**
* Check if the given part is an attachment.
*
* @param \stdClass $part
*
* @return bool
*/
private static function isAttachment(\stdClass $part): bool
{

View File

@ -13,8 +13,6 @@ final class Attachment extends AbstractPart implements AttachmentInterface
{
/**
* Get attachment filename.
*
* @return null|string
*/
public function getFilename(): ?string
{
@ -39,8 +37,6 @@ final class Attachment extends AbstractPart implements AttachmentInterface
/**
* Is this attachment also an Embedded Message?
*
* @return bool
*/
public function isEmbeddedMessage(): bool
{
@ -51,8 +47,6 @@ final class Attachment extends AbstractPart implements AttachmentInterface
* Return embedded message.
*
* @throws NotEmbeddedMessageException
*
* @return EmbeddedMessageInterface
*/
public function getEmbeddedMessage(): EmbeddedMessageInterface
{

View File

@ -11,8 +11,6 @@ interface AttachmentInterface extends PartInterface
{
/**
* Get attachment filename.
*
* @return null|string
*/
public function getFilename(): ?string;
@ -25,15 +23,11 @@ interface AttachmentInterface extends PartInterface
/**
* Is this attachment also an Embedded Message?
*
* @return bool
*/
public function isEmbeddedMessage(): bool;
/**
* Return embedded message.
*
* @return EmbeddedMessageInterface
*/
public function getEmbeddedMessage(): EmbeddedMessageInterface;
}

View File

@ -8,8 +8,6 @@ interface BasicMessageInterface extends PartInterface
{
/**
* Get raw message headers.
*
* @return string
*/
public function getRawHeaders(): string;
@ -22,8 +20,6 @@ interface BasicMessageInterface extends PartInterface
/**
* Get message headers.
*
* @return Headers
*/
public function getHeaders(): Headers;
@ -31,15 +27,11 @@ interface BasicMessageInterface extends PartInterface
* Get message id.
*
* A unique message id in the form <...>
*
* @return null|string
*/
public function getId(): ?string;
/**
* Get message sender (from headers).
*
* @return null|EmailAddress
*/
public function getFrom(): ?EmailAddress;
@ -87,8 +79,6 @@ interface BasicMessageInterface extends PartInterface
/**
* Get date (from headers).
*
* @return null|\DateTimeImmutable
*/
public function getDate(): ?\DateTimeImmutable;
@ -101,22 +91,16 @@ interface BasicMessageInterface extends PartInterface
/**
* Get message subject (from headers).
*
* @return null|string
*/
public function getSubject(): ?string;
/**
* Get message In-Reply-To (from headers).
*
* @return array
*/
public function getInReplyTo(): array;
/**
* Get message References (from headers).
*
* @return array
*/
public function getReferences(): array;
@ -129,8 +113,6 @@ interface BasicMessageInterface extends PartInterface
/**
* Get body text.
*
* @return null|string
*/
public function getBodyText(): ?string;
@ -143,8 +125,6 @@ interface BasicMessageInterface extends PartInterface
/**
* Does this message have attachments?
*
* @return bool
*/
public function hasAttachments(): bool;
}

View File

@ -29,11 +29,6 @@ final class EmailAddress
*/
private $address;
/**
* @param string $mailbox
* @param null|string $hostname
* @param null|string $name
*/
public function __construct(string $mailbox, string $hostname = null, string $name = null)
{
$this->mailbox = $mailbox;
@ -55,8 +50,6 @@ final class EmailAddress
/**
* Returns address with person name.
*
* @return string
*/
public function getFullAddress(): string
{
@ -68,9 +61,6 @@ final class EmailAddress
return $address;
}
/**
* @return string
*/
public function getMailbox(): string
{
return $this->mailbox;

View File

@ -23,8 +23,6 @@ final class EmbeddedMessage extends AbstractMessage implements EmbeddedMessageIn
/**
* Get message headers.
*
* @return Headers
*/
public function getHeaders(): Headers
{
@ -37,8 +35,6 @@ final class EmbeddedMessage extends AbstractMessage implements EmbeddedMessageIn
/**
* Get raw message headers.
*
* @return string
*/
public function getRawHeaders(): string
{
@ -66,8 +62,6 @@ final class EmbeddedMessage extends AbstractMessage implements EmbeddedMessageIn
/**
* Get content part number.
*
* @return string
*/
protected function getContentPartNumber(): string
{

View File

@ -11,8 +11,6 @@ final class Headers extends Parameters
{
/**
* Constructor.
*
* @param \stdClass $headers
*/
public function __construct(\stdClass $headers)
{
@ -29,8 +27,6 @@ final class Headers extends Parameters
/**
* Get header.
*
* @param string $key
*
* @return mixed
*/
public function get(string $key)
@ -41,7 +37,6 @@ final class Headers extends Parameters
/**
* Parse header.
*
* @param string $key
* @param mixed $value
*
* @return mixed

View File

@ -14,9 +14,6 @@ class Parameters extends \ArrayIterator
'filename*' => 'filename',
];
/**
* @param array $parameters
*/
public function __construct(array $parameters = [])
{
parent::__construct();
@ -24,9 +21,6 @@ class Parameters extends \ArrayIterator
$this->add($parameters);
}
/**
* @param array $parameters
*/
public function add(array $parameters = []): void
{
foreach ($parameters as $parameter) {
@ -40,8 +34,6 @@ class Parameters extends \ArrayIterator
}
/**
* @param string $key
*
* @return mixed
*/
public function get(string $key)
@ -51,10 +43,6 @@ class Parameters extends \ArrayIterator
/**
* Decode value.
*
* @param string $value
*
* @return string
*/
final protected function decode(string $value): string
{

View File

@ -33,50 +33,36 @@ interface PartInterface extends \RecursiveIterator
/**
* Get message number (from headers).
*
* @return int
*/
public function getNumber(): int;
/**
* Part charset.
*
* @return null|string
*/
public function getCharset(): ?string;
/**
* Part type.
*
* @return null|string
*/
public function getType(): ?string;
/**
* Part subtype.
*
* @return null|string
*/
public function getSubtype(): ?string;
/**
* Part encoding.
*
* @return null|string
*/
public function getEncoding(): ?string;
/**
* Part disposition.
*
* @return null|string
*/
public function getDisposition(): ?string;
/**
* Part description.
*
* @return null|string
*/
public function getDescription(): ?string;
@ -89,43 +75,31 @@ interface PartInterface extends \RecursiveIterator
/**
* Part lines.
*
* @return null|string
*/
public function getLines(): ?string;
/**
* Part parameters.
*
* @return Parameters
*/
public function getParameters(): Parameters;
/**
* Get raw part content.
*
* @return string
*/
public function getContent(): string;
/**
* Get decoded part content.
*
* @return string
*/
public function getDecodedContent(): string;
/**
* Part structure.
*
* @return \stdClass
*/
public function getStructure(): \stdClass;
/**
* Get part number.
*
* @return string
*/
public function getPartNumber(): string;

View File

@ -265,8 +265,6 @@ final class Transcoder
*
* @param string $text Text to decode
* @param string $fromCharset Original charset
*
* @return string
*/
public static function decode(string $text, string $fromCharset): string
{
@ -288,7 +286,9 @@ final class Transcoder
$fromCharset = self::$charsetAliases[$lowercaseFromCharset];
}
\set_error_handler(static function () {});
\set_error_handler(static function (): bool {
return true;
});
$iconvDecodedText = \iconv($fromCharset, 'UTF-8', $text);
if (false === $iconvDecodedText) {
@ -303,9 +303,11 @@ final class Transcoder
$errorMessage = null;
$errorNumber = 0;
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber) {
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber): bool {
$errorMessage = $message;
$errorNumber = $nr;
return true;
});
$decodedText = \mb_convert_encoding($text, 'UTF-8', $fromCharset);

View File

@ -11,87 +11,63 @@ interface MessageInterface extends Message\BasicMessageInterface
{
/**
* Get raw part content.
*
* @return string
*/
public function getContent(): string;
/**
* Get message recent flag value (from headers).
*
* @return null|string
*/
public function isRecent(): ?string;
/**
* Get message unseen flag value (from headers).
*
* @return bool
*/
public function isUnseen(): bool;
/**
* Get message flagged flag value (from headers).
*
* @return bool
*/
public function isFlagged(): bool;
/**
* Get message answered flag value (from headers).
*
* @return bool
*/
public function isAnswered(): bool;
/**
* Get message deleted flag value (from headers).
*
* @return bool
*/
public function isDeleted(): bool;
/**
* Get message draft flag value (from headers).
*
* @return bool
*/
public function isDraft(): bool;
/**
* Has the message been marked as read?
*
* @return bool
*/
public function isSeen(): bool;
/**
* Mark message as seen.
*
* @return bool
*
* @deprecated since version 1.1, to be removed in 2.0
*/
public function maskAsSeen(): bool;
/**
* Mark message as seen.
*
* @return bool
*/
public function markAsSeen(): bool;
/**
* Move message to another mailbox.
*
* @param MailboxInterface $mailbox
*/
public function copy(MailboxInterface $mailbox): void;
/**
* Move message to another mailbox.
*
* @param MailboxInterface $mailbox
*/
public function move(MailboxInterface $mailbox): void;
@ -109,8 +85,6 @@ interface MessageInterface extends Message\BasicMessageInterface
* Set Flag Message.
*
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
*
* @return bool
*/
public function setFlag(string $flag): bool;
@ -118,8 +92,6 @@ interface MessageInterface extends Message\BasicMessageInterface
* Clear Flag Message.
*
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
*
* @return bool
*/
public function clearFlag(string $flag): bool;
}

View File

@ -26,8 +26,6 @@ final class MessageIterator extends \ArrayIterator implements MessageIteratorInt
/**
* Get current message.
*
* @return MessageInterface
*/
public function current(): MessageInterface
{

View File

@ -8,8 +8,6 @@ interface MessageIteratorInterface extends \Iterator
{
/**
* Get current message.
*
* @return MessageInterface
*/
public function current(): MessageInterface;
}

View File

@ -38,8 +38,6 @@ abstract class AbstractDate implements ConditionInterface
/**
* Converts the condition to a string that can be sent to the IMAP server.
*
* @return string
*/
final public function toString(): string
{
@ -48,8 +46,6 @@ abstract class AbstractDate implements ConditionInterface
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
abstract protected function getKeyword(): string;
}

View File

@ -29,8 +29,6 @@ abstract class AbstractText implements ConditionInterface
/**
* Converts the condition to a string that can be sent to the IMAP server.
*
* @return string
*/
final public function toString(): string
{
@ -39,8 +37,6 @@ abstract class AbstractText implements ConditionInterface
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
abstract protected function getKeyword(): string;
}

View File

@ -11,8 +11,6 @@ interface ConditionInterface
{
/**
* Converts the condition to a string that can be sent to the IMAP server.
*
* @return string
*/
public function toString(): string;
}

View File

@ -14,8 +14,6 @@ final class Before extends AbstractDate
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -14,8 +14,6 @@ final class On extends AbstractDate
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -14,8 +14,6 @@ final class Since extends AbstractDate
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -15,8 +15,6 @@ final class Bcc extends AbstractText
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -15,8 +15,6 @@ final class Cc extends AbstractText
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -14,8 +14,6 @@ final class From extends AbstractText
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -15,8 +15,6 @@ final class To extends AbstractText
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -14,8 +14,6 @@ final class Answered implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -14,8 +14,6 @@ final class Flagged implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -14,8 +14,6 @@ final class Recent implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -14,8 +14,6 @@ final class Seen implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -14,8 +14,6 @@ final class Unanswered implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -14,8 +14,6 @@ final class Unflagged implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -14,8 +14,6 @@ final class Unseen implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -14,8 +14,6 @@ final class All implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -38,12 +38,10 @@ final class OrConditions implements ConditionInterface
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{
$conditions = \array_map(static function (ConditionInterface $condition) {
$conditions = \array_map(static function (ConditionInterface $condition): string {
return $condition->toString();
}, $this->conditions);

View File

@ -24,9 +24,6 @@ final class RawExpression implements ConditionInterface
$this->expression = $expression;
}
/**
* @return string
*/
public function toString(): string
{
return $this->expression;

View File

@ -14,8 +14,6 @@ final class Deleted implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -13,8 +13,6 @@ final class NewMessage implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -13,8 +13,6 @@ final class Old implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -14,8 +14,6 @@ final class Undeleted implements ConditionInterface
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
public function toString(): string
{

View File

@ -14,8 +14,6 @@ final class Body extends AbstractText
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -14,8 +14,6 @@ final class Keyword extends AbstractText
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -14,8 +14,6 @@ final class Subject extends AbstractText
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -14,8 +14,6 @@ final class Text extends AbstractText
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -14,8 +14,6 @@ final class Unkeyword extends AbstractText
{
/**
* Returns the keyword that the condition represents.
*
* @return string
*/
protected function getKeyword(): string
{

View File

@ -22,8 +22,6 @@ final class SearchExpression implements ConditionInterface
* Adds a new condition to the expression.
*
* @param ConditionInterface $condition the condition to be added
*
* @return self
*/
public function addCondition(ConditionInterface $condition): self
{
@ -34,12 +32,10 @@ final class SearchExpression implements ConditionInterface
/**
* Converts the expression to a string that can be sent to the IMAP server.
*
* @return string
*/
public function toString(): string
{
$conditions = \array_map(static function (ConditionInterface $condition) {
$conditions = \array_map(static function (ConditionInterface $condition): string {
return $condition->toString();
}, $this->conditions);

View File

@ -80,16 +80,16 @@ final class Server implements ServerInterface
* @param string $password Password
*
* @throws AuthenticationFailedException
*
* @return ConnectionInterface
*/
public function authenticate(string $username, string $password): ConnectionInterface
{
$errorMessage = null;
$errorNumber = 0;
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber) {
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber): bool {
$errorMessage = $message;
$errorNumber = $nr;
return true;
});
$resource = \imap_open(
@ -133,8 +133,6 @@ final class Server implements ServerInterface
/**
* Glues hostname, port and flags and returns result.
*
* @return string
*/
private function getServerString(): string
{

View File

@ -14,8 +14,6 @@ interface ServerInterface
*
* @param string $username Username
* @param string $password Password
*
* @return ConnectionInterface
*/
public function authenticate(string $username, string $password): ConnectionInterface;
}

View File

@ -525,7 +525,7 @@ class CSS extends Minify
);
return preg_replace_callback(
'/(?<=[: ])('.implode(array_keys($colors), '|').')(?=[; }])/i',
'/(?<=[: ])('.implode('|', array_keys($colors)).')(?=[; }])/i',
function ($match) use ($colors) {
return $colors[strtoupper($match[0])];
},
@ -708,7 +708,8 @@ class CSS extends Minify
return $placeholder.$rest;
};
$this->registerPattern('/calc(\(.+?)(?=$|;|calc\()/', $callback);
$this->registerPattern('/calc(\(.+?)(?=$|;|}|calc\()/', $callback);
$this->registerPattern('/calc(\(.+?)(?=$|;|}|calc\()/m', $callback);
}
/**

View File

@ -99,6 +99,44 @@ abstract class Minify
return $this;
}
/**
* Add a file to be minified.
*
* @param string|string[] $data
*
* @return static
*
* @throws IOException
*/
public function addFile($data /* $data = null, ... */)
{
// bogus "usage" of parameter $data: scrutinizer warns this variable is
// not used (we're using func_get_args instead to support overloading),
// but it still needs to be defined because it makes no sense to have
// this function without argument :)
$args = array($data) + func_get_args();
// this method can be overloaded
foreach ($args as $path) {
if (is_array($path)) {
call_user_func_array(array($this, 'addFile'), $path);
continue;
}
// redefine var
$path = (string) $path;
// check if we can read the file
if (!$this->canImportFile($path)) {
throw new IOException('The file "'.$path.'" could not be opened for reading. Check if PHP has enough permissions.');
}
$this->add($path);
}
return $this;
}
/**
* Minify the data & (optionally) saves it to a file.
*

View File

@ -71,6 +71,14 @@ class Converter implements ConverterInterface
// deal with different operating systems' directory structure
$path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $path), '/');
// remove leading current directory.
if (substr($path, 0, 2) === './') {
$path = substr($path, 2);
}
// remove references to current directory in the path.
$path = str_replace('/./', '/', $path);
/*
* Example:
* /home/forkcms/frontend/cache/compiled_templates/../../core/layout/css/../images/img.gif

View File

@ -1 +1 @@
5.2.27
5.2.28

View File

@ -31,7 +31,7 @@ class PHPMailer
* The PHPMailer Version number.
* @var string
*/
public $Version = '5.2.27';
public $Version = '5.2.28';
/**
* Email priority.
@ -2711,7 +2711,10 @@ class PHPMailer
if (!self::isPermittedPath($path) or !file_exists($path)) {
throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
}
$magic_quotes = false;
if( version_compare(PHP_VERSION, '7.4.0', '<') ) {
$magic_quotes = get_magic_quotes_runtime();
}
if ($magic_quotes) {
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
set_magic_quotes_runtime(false);

View File

@ -34,7 +34,7 @@ class POP3
* @var string
* @access public
*/
public $Version = '5.2.27';
public $Version = '5.2.28';
/**
* Default POP3 port number.

View File

@ -30,7 +30,7 @@ class SMTP
* The PHPMailer SMTP version number.
* @var string
*/
const VERSION = '5.2.27';
const VERSION = '5.2.28';
/**
* SMTP line break constant.
@ -81,7 +81,7 @@ class SMTP
* @deprecated Use the `VERSION` constant instead
* @see SMTP::VERSION
*/
public $Version = '5.2.27';
public $Version = '5.2.28';
/**
* SMTP server port number.

View File

@ -1,12 +1,12 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
before_script:
- composer install

View File

@ -10,7 +10,7 @@ PHP library for [two-factor (or multi-factor) authentication](http://en.wikipedi
## Requirements
* Tested on PHP 5.4 up to 7.2
* Tested on PHP 5.6 up to 7.4
* [cURL](http://php.net/manual/en/book.curl.php) when using the provided `ImageChartsQRCodeProvider` (default), `QRServerProvider` or `QRicketProvider` but you can also provide your own QR-code provider.
* [random_bytes()](http://php.net/manual/en/function.random-bytes.php), [MCrypt](http://php.net/manual/en/book.mcrypt.php), [OpenSSL](http://php.net/manual/en/book.openssl.php) or [Hash](http://php.net/manual/en/book.hash.php) depending on which built-in RNG you use (TwoFactorAuth will try to 'autodetect' and use the best available); however: feel free to provide your own (CS)RNG.

View File

@ -1,7 +1,7 @@
{
"name": "robthree/twofactorauth",
"description": "Two Factor Authentication",
"version": "1.6.7",
"version": "1.7.0",
"type": "library",
"keywords": [ "Authentication", "Two Factor Authentication", "Multi Factor Authentication", "TFA", "MFA", "PHP", "Authenticator", "Authy" ],
"homepage": "https://github.com/RobThree/TwoFactorAuth",
@ -18,7 +18,7 @@
"source": "https://github.com/RobThree/TwoFactorAuth"
},
"require": {
"php": ">=5.3.0"
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "@stable"

View File

@ -11,7 +11,7 @@ class NTPTimeProvider implements ITimeProvider
public $port;
public $timeout;
function __construct($host = 'pool.ntp.org', $port = 123, $timeout = 1)
function __construct($host = 'time.google.com', $port = 123, $timeout = 1)
{
$this->host = $host;
@ -28,6 +28,7 @@ class NTPTimeProvider implements ITimeProvider
try {
/* Create a socket and connect to NTP server */
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, ['sec' => $this->timeout, 'usec' => 0]);
socket_connect($sock, $this->host, $this->port);
/* Send request */
@ -35,7 +36,8 @@ class NTPTimeProvider implements ITimeProvider
socket_send($sock, $msg, strlen($msg), 0);
/* Receive response and close socket */
socket_recv($sock, $recv, 48, MSG_WAITALL);
if (socket_recv($sock, $recv, 48, MSG_WAITALL) === false)
throw new \Exception(socket_strerror(socket_last_error($sock)));
socket_close($sock);
/* Interpret response */