mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-10 07:04:53 +08:00
Resolve #1850
This commit is contained in:
parent
d301b93b0d
commit
cd3398db20
10 changed files with 22 additions and 23 deletions
|
@ -150,7 +150,7 @@ class Logger extends \SplFixedArray
|
||||||
\E_USER_ERROR => \LOG_ERR,
|
\E_USER_ERROR => \LOG_ERR,
|
||||||
\E_USER_WARNING => \LOG_WARNING,
|
\E_USER_WARNING => \LOG_WARNING,
|
||||||
\E_USER_NOTICE => \LOG_NOTICE,
|
\E_USER_NOTICE => \LOG_NOTICE,
|
||||||
\E_STRICT => \LOG_CRIT,
|
// \E_STRICT => \LOG_CRIT,
|
||||||
\E_RECOVERABLE_ERROR => \LOG_ERR,
|
\E_RECOVERABLE_ERROR => \LOG_ERR,
|
||||||
\E_DEPRECATED => \LOG_INFO,
|
\E_DEPRECATED => \LOG_INFO,
|
||||||
\E_USER_DEPRECATED => \LOG_INFO
|
\E_USER_DEPRECATED => \LOG_INFO
|
||||||
|
@ -168,7 +168,7 @@ class Logger extends \SplFixedArray
|
||||||
\E_USER_ERROR => '-USER',
|
\E_USER_ERROR => '-USER',
|
||||||
\E_USER_WARNING => '-USER',
|
\E_USER_WARNING => '-USER',
|
||||||
\E_USER_NOTICE => '-USER',
|
\E_USER_NOTICE => '-USER',
|
||||||
\E_STRICT => '-STRICT',
|
// \E_STRICT => '-STRICT',
|
||||||
\E_RECOVERABLE_ERROR => '-RECOVERABLE',
|
\E_RECOVERABLE_ERROR => '-RECOVERABLE',
|
||||||
\E_DEPRECATED => '-DEPRECATED',
|
\E_DEPRECATED => '-DEPRECATED',
|
||||||
\E_USER_DEPRECATED => '-USER_DEPRECATED'
|
\E_USER_DEPRECATED => '-USER_DEPRECATED'
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace RainLoop\Plugins;
|
||||||
|
|
||||||
class Helper
|
class Helper
|
||||||
{
|
{
|
||||||
static public function ValidateWildcardValues(string $sString, string $sWildcardValues, string &$sFoundValue = null) : bool
|
static public function ValidateWildcardValues(string $sString, string $sWildcardValues, ?string &$sFoundValue = null) : bool
|
||||||
{
|
{
|
||||||
$sFoundValue = '';
|
$sFoundValue = '';
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ abstract class Base
|
||||||
/**
|
/**
|
||||||
* Verifies a signed text
|
* Verifies a signed text
|
||||||
*/
|
*/
|
||||||
public function verify(string $signed_text, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verify(string $signed_text, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ abstract class Base
|
||||||
/**
|
/**
|
||||||
* Verifies a signed file
|
* Verifies a signed file
|
||||||
*/
|
*/
|
||||||
public function verifyFile(string $filename, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verifyFile(string $filename, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ abstract class Base
|
||||||
/**
|
/**
|
||||||
* Verifies a signed file
|
* Verifies a signed file
|
||||||
*/
|
*/
|
||||||
public function verifyStream($fp, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verifyStream($fp, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -739,7 +739,7 @@ class PGP extends Base implements \SnappyMail\PGP\PGPInterface
|
||||||
/**
|
/**
|
||||||
* Verifies a signed text
|
* Verifies a signed text
|
||||||
*/
|
*/
|
||||||
public function verify(string $signed_text, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verify(string $signed_text, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
return $this->_verify($signed_text, $signature);
|
return $this->_verify($signed_text, $signature);
|
||||||
}
|
}
|
||||||
|
@ -747,7 +747,7 @@ class PGP extends Base implements \SnappyMail\PGP\PGPInterface
|
||||||
/**
|
/**
|
||||||
* Verifies a signed file
|
* Verifies a signed file
|
||||||
*/
|
*/
|
||||||
public function verifyFile(string $filename, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verifyFile(string $filename, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
$fp = \fopen($filename, 'rb');
|
$fp = \fopen($filename, 'rb');
|
||||||
try {
|
try {
|
||||||
|
@ -763,7 +763,7 @@ class PGP extends Base implements \SnappyMail\PGP\PGPInterface
|
||||||
/**
|
/**
|
||||||
* Verifies a signed file
|
* Verifies a signed file
|
||||||
*/
|
*/
|
||||||
public function verifyStream($fp, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verifyStream($fp, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
if (!$fp || !\is_resource($fp)) {
|
if (!$fp || !\is_resource($fp)) {
|
||||||
throw new \Exception('Invalid stream resource');
|
throw new \Exception('Invalid stream resource');
|
||||||
|
|
|
@ -589,7 +589,7 @@ class SMIME extends Base
|
||||||
/**
|
/**
|
||||||
* Verifies a signed text
|
* Verifies a signed text
|
||||||
*/
|
*/
|
||||||
public function verify(string $signed_text, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verify(string $signed_text, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
return $this->_verify($signed_text, $signature);
|
return $this->_verify($signed_text, $signature);
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ class SMIME extends Base
|
||||||
/**
|
/**
|
||||||
* Verifies a signed file
|
* Verifies a signed file
|
||||||
*/
|
*/
|
||||||
public function verifyFile(string $filename, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verifyFile(string $filename, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
$fp = \fopen($filename, 'rb');
|
$fp = \fopen($filename, 'rb');
|
||||||
try {
|
try {
|
||||||
|
@ -613,7 +613,7 @@ class SMIME extends Base
|
||||||
/**
|
/**
|
||||||
* Verifies a signed file
|
* Verifies a signed file
|
||||||
*/
|
*/
|
||||||
public function verifyStream($fp, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verifyStream($fp, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
if (!$fp || !\is_resource($fp)) {
|
if (!$fp || !\is_resource($fp)) {
|
||||||
throw new \Exception('Invalid stream resource');
|
throw new \Exception('Invalid stream resource');
|
||||||
|
|
|
@ -111,7 +111,7 @@ abstract class Request
|
||||||
|
|
||||||
abstract protected function __doRequest(string &$method, string &$request_url, &$body, array $extra_headers) : Response;
|
abstract protected function __doRequest(string &$method, string &$request_url, &$body, array $extra_headers) : Response;
|
||||||
|
|
||||||
public function doRequest($method, $request_url, $body = null, array $extra_headers = array()) : ?Response
|
public function doRequest($method, $request_url, /*string|array*/$body = null, array $extra_headers = array()) : ?Response
|
||||||
{
|
{
|
||||||
$method = \strtoupper($method);
|
$method = \strtoupper($method);
|
||||||
$url = $request_url;
|
$url = $request_url;
|
||||||
|
|
|
@ -6,9 +6,8 @@ use SnappyMail\HTTP\Response;
|
||||||
|
|
||||||
class CURL extends \SnappyMail\HTTP\Request
|
class CURL extends \SnappyMail\HTTP\Request
|
||||||
{
|
{
|
||||||
private
|
private array $response_headers = array();
|
||||||
$response_headers = array(),
|
private string $response_body = '';
|
||||||
$response_body = '';
|
|
||||||
|
|
||||||
public function supportsSSL() : bool
|
public function supportsSSL() : bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Response
|
||||||
$headers = array(), # The headers returned from the final_uri
|
$headers = array(), # The headers returned from the final_uri
|
||||||
$body; # The body returned from the final_uri
|
$body; # The body returned from the final_uri
|
||||||
|
|
||||||
function __construct(string $request_uri, int $status = 0, ?array $headers = null, $body = null)
|
function __construct(string $request_uri, int $status = 0, ?array $headers = null, string $body = '')
|
||||||
{
|
{
|
||||||
if ($headers) {
|
if ($headers) {
|
||||||
$name = null;
|
$name = null;
|
||||||
|
|
|
@ -365,7 +365,7 @@ class PECL implements \SnappyMail\PGP\PGPInterface
|
||||||
/**
|
/**
|
||||||
* Verifies a signed text
|
* Verifies a signed text
|
||||||
*/
|
*/
|
||||||
public function verify(string $signed_text, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verify(string $signed_text, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
$result = $this->GnuPG->verify($signed_text, $signature ?: false, $plaintext) ?: $this->gnupgError();
|
$result = $this->GnuPG->verify($signed_text, $signature ?: false, $plaintext) ?: $this->gnupgError();
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
@ -378,7 +378,7 @@ class PECL implements \SnappyMail\PGP\PGPInterface
|
||||||
/**
|
/**
|
||||||
* Verifies a signed file
|
* Verifies a signed file
|
||||||
*/
|
*/
|
||||||
public function verifyFile(string $filename, string $signature, string &$plaintext = null) /*: array|false*/
|
public function verifyFile(string $filename, string $signature, ?string &$plaintext = null) /*: array|false*/
|
||||||
{
|
{
|
||||||
return $this->GnuPG->verify(\file_get_contents($filename), $signature, $plaintext) ?: $this->gnupgError();
|
return $this->GnuPG->verify(\file_get_contents($filename), $signature, $plaintext) ?: $this->gnupgError();
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ class PECL implements \SnappyMail\PGP\PGPInterface
|
||||||
/**
|
/**
|
||||||
* Verifies a given resource
|
* Verifies a given resource
|
||||||
*/
|
*/
|
||||||
public function verifyStream(/*resource*/ $fp, string $signature, string &$plaintext = null) /*: array|false */
|
public function verifyStream(/*resource*/ $fp, string $signature, ?string &$plaintext = null) /*: array|false */
|
||||||
{
|
{
|
||||||
if (!$fp || !\is_resource($fp)) {
|
if (!$fp || !\is_resource($fp)) {
|
||||||
throw new \Exception('Invalid stream resource');
|
throw new \Exception('Invalid stream resource');
|
||||||
|
|
|
@ -39,7 +39,7 @@ interface PGPInterface
|
||||||
public function sign(string $plaintext) /*: string|false*/;
|
public function sign(string $plaintext) /*: string|false*/;
|
||||||
public function signFile(string $filename) /*: string|false*/;
|
public function signFile(string $filename) /*: string|false*/;
|
||||||
public function signStream($fp, /*string|resource*/ $output = null) /*: string|false*/;
|
public function signStream($fp, /*string|resource*/ $output = null) /*: string|false*/;
|
||||||
public function verify(string $signed_text, string $signature, string &$plaintext = null) /*: array|false*/;
|
public function verify(string $signed_text, string $signature, ?string &$plaintext = null) /*: array|false*/;
|
||||||
public function verifyFile(string $filename, string $signature, string &$plaintext = null) /*: array|false*/;
|
public function verifyFile(string $filename, string $signature, ?string &$plaintext = null) /*: array|false*/;
|
||||||
public function verifyStream(/*resource*/ $fp, string $signature, string &$plaintext = null) /*: array|false */;
|
public function verifyStream(/*resource*/ $fp, string $signature, ?string &$plaintext = null) /*: array|false */;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue