mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-04 03:18:49 +03:00
\MailSo\Base\Utils::FunctionCallable is useless in PHP 8
This commit is contained in:
parent
1495ea984b
commit
681316e831
8 changed files with 12 additions and 23 deletions
|
|
@ -82,7 +82,7 @@ abstract class HtmlUtils
|
|||
|
||||
$oDoc->normalizeDocument();
|
||||
|
||||
if (\MailSo\Base\Utils::FunctionCallable('libxml_clear_errors')) {
|
||||
if (\function_exists('libxml_clear_errors')) {
|
||||
\libxml_clear_errors();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class Http
|
|||
{
|
||||
$sServerKey = 'HTTP_'.\strtoupper(\str_replace('-', '_', $sHeader));
|
||||
$sResultHeader = static::GetServer($sServerKey, '');
|
||||
if (!\strlen($sResultHeader) && Utils::FunctionCallable('apache_request_headers')) {
|
||||
if (!\strlen($sResultHeader) && \function_exists('apache_request_headers')) {
|
||||
$sHeaders = \apache_request_headers();
|
||||
if (isset($sHeaders[$sHeader])) {
|
||||
$sResultHeader = $sHeaders[$sHeader];
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ abstract class Utils
|
|||
if (null === $bValidateAction) {
|
||||
$iResetTimer = 0;
|
||||
|
||||
$bValidateAction = static::FunctionCallable('set_time_limit');
|
||||
$bValidateAction = \function_exists('set_time_limit');
|
||||
}
|
||||
|
||||
if ($bValidateAction && $iTimeToReset < $iTime - $iResetTimer) {
|
||||
|
|
@ -661,24 +661,13 @@ abstract class Utils
|
|||
public static function FunctionsCallable(array $aFunctionNames) : bool
|
||||
{
|
||||
foreach ($aFunctionNames as $sFunctionName) {
|
||||
if (!static::FunctionCallable($sFunctionName)) {
|
||||
if (!\function_exists($sFunctionName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static $disabled_functions = null;
|
||||
public static function FunctionCallable(string $sFunctionName) : bool
|
||||
{
|
||||
if (null === static::$disabled_functions) {
|
||||
static::$disabled_functions = \array_map('trim', \explode(',', \ini_get('disable_functions')));
|
||||
}
|
||||
return \function_exists($sFunctionName)
|
||||
&& !\in_array($sFunctionName, static::$disabled_functions);
|
||||
// && \is_callable($sFunctionName);
|
||||
}
|
||||
|
||||
public static function Sha1Rand(string $sAdditionalSalt = '') : string
|
||||
{
|
||||
return \sha1($sAdditionalSalt . \random_bytes(16));
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ class Message extends Part
|
|||
$sHostName = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
|
||||
}
|
||||
|
||||
if (empty($sHostName) && \MailSo\Base\Utils::FunctionCallable('php_uname')) {
|
||||
if (empty($sHostName) && \function_exists('php_uname')) {
|
||||
$sHostName = \php_uname('n');
|
||||
}
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ class Message extends Part
|
|||
|
||||
return '<'.
|
||||
\MailSo\Base\Utils::Sha1Rand($sHostName.
|
||||
(\MailSo\Base\Utils::FunctionCallable('getmypid') ? \getmypid() : '')).'@'.$sHostName.'>';
|
||||
(\function_exists('getmypid') ? \getmypid() : '')).'@'.$sHostName.'>';
|
||||
}
|
||||
|
||||
public function GetRootPart() : Part
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ abstract class NetClient
|
|||
|
||||
$this->writeLog((\microtime(true) - $this->iStartConnectTime).' (raw connection)', \LOG_DEBUG);
|
||||
|
||||
if ($this->rConnect && \MailSo\Base\Utils::FunctionCallable('stream_set_timeout')) {
|
||||
if ($this->rConnect && \function_exists('stream_set_timeout')) {
|
||||
\stream_set_timeout($this->rConnect, \max(5, $oSettings->timeout));
|
||||
}
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ abstract class NetClient
|
|||
public function EnableCrypto() : void
|
||||
{
|
||||
$bSuccess = false;
|
||||
if ($this->rConnect && \MailSo\Base\Utils::FunctionCallable('stream_socket_enable_crypto')) {
|
||||
if ($this->rConnect && \function_exists('stream_socket_enable_crypto')) {
|
||||
$crypto_method = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
|
||||
if (\defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && OPENSSL_VERSION_NUMBER >= 0x10101000) {
|
||||
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT;
|
||||
|
|
@ -212,7 +212,7 @@ abstract class NetClient
|
|||
|
||||
public function StreamContextParams() : array
|
||||
{
|
||||
return $this->rConnect && \MailSo\Base\Utils::FunctionCallable('stream_context_get_options')
|
||||
return $this->rConnect && \function_exists('stream_context_get_options')
|
||||
? \stream_context_get_params($this->rConnect) : false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ class Actions
|
|||
$this->logWrite(
|
||||
'[SM:' . APP_VERSION . '][IP:'
|
||||
. $oHttp->GetClientIp($this->oConfig->Get('labs', 'http_client_ip_check_proxy', false))
|
||||
. '][PID:' . (\MailSo\Base\Utils::FunctionCallable('getmypid') ? \getmypid() : 'unknown')
|
||||
. '][PID:' . (\function_exists('getmypid') ? \getmypid() : 'unknown')
|
||||
. '][' . \MailSo\Base\Http::GetServer('SERVER_SOFTWARE', '~')
|
||||
. '][' . \PHP_SAPI
|
||||
. '][Streams:' . \implode(',', \stream_get_transports())
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ trait AdminDomains
|
|||
}
|
||||
|
||||
if ($oDomain->SmtpSettings()->usePhpMail) {
|
||||
$mSmtpResult = \MailSo\Base\Utils::FunctionCallable('mail');
|
||||
$mSmtpResult = \function_exists('mail');
|
||||
if (!$mSmtpResult) {
|
||||
$sSmtpErrorDesc = 'PHP: mail() function is undefined';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -797,7 +797,7 @@ trait Messages
|
|||
$oAccount->SmtpConnectAndLogin($this->Plugins(), $oSmtpClient);
|
||||
|
||||
if ($oSmtpClient->Settings->usePhpMail) {
|
||||
if (!$sFrom || !\MailSo\Base\Utils::FunctionCallable('mail')) {
|
||||
if (!$sFrom || !\function_exists('mail')) {
|
||||
throw new ClientException(Notifications::CantSendMessage);
|
||||
}
|
||||
$oToCollection = $oMessage->GetTo();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue