mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 07:27:04 +03:00
Remove useless NewInstance
Bugfix: BodyStructure->SearchCharset return value
This commit is contained in:
parent
82e560bc53
commit
693e0f4c10
61 changed files with 802 additions and 1345 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -5,7 +5,7 @@ namespace RainLoop;
|
|||
class Api
|
||||
{
|
||||
|
||||
private function __construct()
|
||||
function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -33,13 +33,13 @@ class Api
|
|||
static $oActions = null;
|
||||
if (null === $oActions)
|
||||
{
|
||||
$oActions = \RainLoop\Actions::NewInstance();
|
||||
$oActions = new Actions();
|
||||
}
|
||||
|
||||
return $oActions;
|
||||
}
|
||||
|
||||
public static function Config() : \RainLoop\Config\Application
|
||||
public static function Config() : Config\Application
|
||||
{
|
||||
return static::Actions()->Config();
|
||||
}
|
||||
|
|
@ -81,10 +81,10 @@ class Api
|
|||
$sSslCafile = static::Config()->Get('ssl', 'cafile', '');
|
||||
$sSslCapath = static::Config()->Get('ssl', 'capath', '');
|
||||
|
||||
\RainLoop\Utils::$CookieDefaultPath = static::Config()->Get('labs', 'cookie_default_path', '');
|
||||
Utils::$CookieDefaultPath = static::Config()->Get('labs', 'cookie_default_path', '');
|
||||
if (static::Config()->Get('labs', 'cookie_default_secure', false))
|
||||
{
|
||||
\RainLoop\Utils::$CookieDefaultSecure = true;
|
||||
Utils::$CookieDefaultSecure = true;
|
||||
}
|
||||
|
||||
if (!empty($sSslCafile) || !empty($sSslCapath))
|
||||
|
|
@ -164,8 +164,8 @@ class Api
|
|||
{
|
||||
$sSsoHash = \MailSo\Base\Utils::Sha1Rand(\md5($sEmail).\md5($sPassword));
|
||||
|
||||
return static::Actions()->Cacher()->Set(\RainLoop\KeyPathHelper::SsoCacherKey($sSsoHash),
|
||||
\RainLoop\Utils::EncodeKeyValuesQ(array(
|
||||
return static::Actions()->Cacher()->Set(KeyPathHelper::SsoCacherKey($sSsoHash),
|
||||
Utils::EncodeKeyValuesQ(array(
|
||||
'Email' => $sEmail,
|
||||
'Password' => $sPassword,
|
||||
'AdditionalOptions' => $aAdditionalOptions,
|
||||
|
|
@ -175,7 +175,7 @@ class Api
|
|||
|
||||
public static function ClearUserSsoHash(string $sSsoHash) : bool
|
||||
{
|
||||
return static::Actions()->Cacher()->Delete(\RainLoop\KeyPathHelper::SsoCacherKey($sSsoHash));
|
||||
return static::Actions()->Cacher()->Delete(KeyPathHelper::SsoCacherKey($sSsoHash));
|
||||
}
|
||||
|
||||
public static function ClearUserData(string $sEmail) : bool
|
||||
|
|
@ -204,7 +204,7 @@ class Api
|
|||
|
||||
public static function LogoutCurrentLogginedUser() : bool
|
||||
{
|
||||
\RainLoop\Utils::ClearCookie('rlsession');
|
||||
Utils::ClearCookie('rlsession');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class Account
|
|||
*/
|
||||
private $sParentEmail;
|
||||
|
||||
protected function __construct(string $sEmail, string $sLogin, string $sPassword,
|
||||
function __construct(string $sEmail, string $sLogin, string $sPassword,
|
||||
\RainLoop\Model\Domain $oDomain, string $sSignMeToken = '', string $sProxyAuthUser = '',
|
||||
string $sProxyAuthPassword = '', string $sClientCert = '')
|
||||
{
|
||||
|
|
@ -64,13 +64,6 @@ class Account
|
|||
$this->sParentEmail = '';
|
||||
}
|
||||
|
||||
public static function NewInstance(string $sEmail, string $sLogin, string $sPassword,
|
||||
\RainLoop\Model\Domain $oDomain, string $sSignMeToken = '', string $sProxyAuthUser = '',
|
||||
string $sProxyAuthPassword = '', string $sClientCert = '') : self
|
||||
{
|
||||
return new self($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken, $sProxyAuthUser, $sProxyAuthPassword, $sClientCert);
|
||||
}
|
||||
|
||||
public function Email() : string
|
||||
{
|
||||
return $this->sEmail;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class Domain
|
|||
*/
|
||||
private $sAliasName;
|
||||
|
||||
private function __construct(string $sName,
|
||||
function __construct(string $sName,
|
||||
string $sIncHost, int $iIncPort, int $iIncSecure, bool $bIncShortLogin,
|
||||
bool $bUseSieve, string $sSieveHost, int $iSievePort, int $iSieveSecure,
|
||||
string $sOutHost, int $iOutPort, int $iOutSecure, bool $bOutShortLogin,
|
||||
|
|
@ -128,19 +128,6 @@ class Domain
|
|||
$this->sAliasName = '';
|
||||
}
|
||||
|
||||
public static function NewInstance(string $sName,
|
||||
string $sIncHost, int $iIncPort, int $iIncSecure, bool $bIncShortLogin,
|
||||
bool $bUseSieve, string $sSieveHost, int $iSievePort, int $iSieveSecure,
|
||||
string $sOutHost, int $iOutPort, int $iOutSecure, bool $bOutShortLogin,
|
||||
bool $bOutAuth, bool $bOutUsePhpMail, string $sWhiteList = '') : self
|
||||
{
|
||||
return new self($sName,
|
||||
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
|
||||
$bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure,
|
||||
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
|
||||
$sWhiteList);
|
||||
}
|
||||
|
||||
public static function NewInstanceFromDomainConfigArray(string $sName, array $aDomain) : ?\RainLoop\Model\Domain
|
||||
{
|
||||
$oDomain = null;
|
||||
|
|
@ -172,7 +159,7 @@ class Domain
|
|||
$bIncShortLogin = !empty($aDomain['imap_short_login']);
|
||||
$bOutShortLogin = !empty($aDomain['smtp_short_login']);
|
||||
|
||||
$oDomain = self::NewInstance($sName,
|
||||
$oDomain = new self($sName,
|
||||
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
|
||||
$bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure,
|
||||
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Identity
|
|||
*/
|
||||
private $bSignatureInsertBefore;
|
||||
|
||||
protected function __construct(string $sId = '', string $sEmail = '')
|
||||
function __construct(string $sId = '', string $sEmail = '')
|
||||
{
|
||||
$this->sId = empty($sId) ? '' : $sId;
|
||||
$this->sEmail = empty($sEmail) ? '' : $sEmail;
|
||||
|
|
@ -50,16 +50,6 @@ class Identity
|
|||
$this->bSignatureInsertBefore = false;
|
||||
}
|
||||
|
||||
public static function NewInstance() : self
|
||||
{
|
||||
return new self();
|
||||
}
|
||||
|
||||
public static function NewInstanceFromAccount(\RainLoop\Model\Account $oAccount) : self
|
||||
{
|
||||
return new self('', $oAccount->Email());
|
||||
}
|
||||
|
||||
public function Id(bool $bFillOnEmpty = false) : string
|
||||
{
|
||||
return $bFillOnEmpty ? ('' === $this->sId ? '---' : $this->sId) : $this->sId;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Template
|
|||
*/
|
||||
private $bPopulateAlways;
|
||||
|
||||
protected function __construct(string $sId = '', string $sName = '', string $sBody = '')
|
||||
function __construct(string $sId = '', string $sName = '', string $sBody = '')
|
||||
{
|
||||
$this->sId = $sId;
|
||||
$this->sName = $sName;
|
||||
|
|
@ -32,11 +32,6 @@ class Template
|
|||
$this->bPopulateAlways = false;
|
||||
}
|
||||
|
||||
public static function NewInstance(string $sId = '', string $sName = '', string $sBody = '') : self
|
||||
{
|
||||
return new self($sId, $sName, $sBody);
|
||||
}
|
||||
|
||||
public function Id() : string
|
||||
{
|
||||
return $this->sId;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace RainLoop\Plugins;
|
|||
|
||||
class Helper
|
||||
{
|
||||
private function __construct()
|
||||
function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Property
|
|||
*/
|
||||
private $sPlaceholder;
|
||||
|
||||
private function __construct(string $sName)
|
||||
function __construct(string $sName)
|
||||
{
|
||||
$this->sName = $sName;
|
||||
$this->iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace RainLoop\Providers;
|
||||
|
||||
class Domain extends \RainLoop\Providers\AbstractProvider
|
||||
class Domain extends AbstractProvider
|
||||
{
|
||||
/**
|
||||
* @var \RainLoop\Providers\Domain\DomainInterface
|
||||
* @var Domain\DomainInterface
|
||||
*/
|
||||
private $oDriver;
|
||||
|
||||
|
|
@ -19,12 +19,12 @@ class Domain extends \RainLoop\Providers\AbstractProvider
|
|||
*/
|
||||
private $bAdmin;
|
||||
|
||||
public function __construct(\RainLoop\Providers\Domain\DomainInterface $oDriver,
|
||||
public function __construct(Domain\DomainInterface $oDriver,
|
||||
\RainLoop\Plugins\Manager $oPlugins)
|
||||
{
|
||||
$this->oDriver = $oDriver;
|
||||
$this->oPlugins = $oPlugins;
|
||||
$this->bAdmin = $this->oDriver instanceof \RainLoop\Providers\Domain\DomainAdminInterface;
|
||||
$this->bAdmin = $this->oDriver instanceof Domain\DomainAdminInterface;
|
||||
}
|
||||
|
||||
public function IsAdmin() : bool
|
||||
|
|
@ -140,7 +140,7 @@ class Domain extends \RainLoop\Providers\AbstractProvider
|
|||
}
|
||||
else
|
||||
{
|
||||
$oDomain = \RainLoop\Model\Domain::NewInstance(0 < strlen($sNameForTest) ? $sNameForTest : $sName,
|
||||
$oDomain = new \RainLoop\Model\Domain(0 < strlen($sNameForTest) ? $sNameForTest : $sName,
|
||||
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
|
||||
$bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure,
|
||||
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
|
||||
|
|
@ -207,7 +207,7 @@ class Domain extends \RainLoop\Providers\AbstractProvider
|
|||
}
|
||||
else
|
||||
{
|
||||
$oDomain = \RainLoop\Model\Domain::NewInstance(0 < strlen($sNameForTest) ? $sNameForTest : $sName,
|
||||
$oDomain = new \RainLoop\Model\Domain(0 < strlen($sNameForTest) ? $sNameForTest : $sName,
|
||||
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
|
||||
$bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure,
|
||||
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
|
||||
|
|
@ -226,6 +226,6 @@ class Domain extends \RainLoop\Providers\AbstractProvider
|
|||
|
||||
public function IsActive() : bool
|
||||
{
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Domain\DomainInterface;
|
||||
return $this->oDriver instanceof Domain\DomainInterface;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ class Filter
|
|||
$this->bStop = isset($aFilter['Stop']) ? '1' === (string) $aFilter['Stop'] : true;
|
||||
$this->bMarkAsRead = isset($aFilter['MarkAsRead']) ? '1' === (string) $aFilter['MarkAsRead'] : false;
|
||||
|
||||
$this->aConditions = \RainLoop\Providers\Filters\Classes\FilterCondition::CollectionFromJSON(
|
||||
$this->aConditions = FilterCondition::CollectionFromJSON(
|
||||
isset($aFilter['Conditions']) ? $aFilter['Conditions'] : array());
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
|
|||
$aModules = array();
|
||||
$aFilters = array();
|
||||
|
||||
$oSieveClient = \MailSo\Sieve\ManageSieveClient::NewInstance();
|
||||
$oSieveClient = new \MailSo\Sieve\ManageSieveClient();
|
||||
$oSieveClient->SetLogger($this->oLogger);
|
||||
$oSieveClient->SetTimeOuts(10, (int) $this->oConfig->Get('labs', 'sieve_timeout', 10));
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
|
|||
|
||||
public function Save(\RainLoop\Model\Account $oAccount, array $aFilters, string $sRaw = '', bool $bRawIsActive = false) : bool
|
||||
{
|
||||
$oSieveClient = \MailSo\Sieve\ManageSieveClient::NewInstance();
|
||||
$oSieveClient = new \MailSo\Sieve\ManageSieveClient();
|
||||
$oSieveClient->SetLogger($this->oLogger);
|
||||
$oSieveClient->SetTimeOuts(10, (int) \RainLoop\Api::Config()->Get('labs', 'sieve_timeout', 10));
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Settings;
|
||||
|
||||
class DefaultSettings implements \RainLoop\Providers\Settings\ISettings
|
||||
class DefaultSettings implements ISettings
|
||||
{
|
||||
const FILE_NAME = 'settings';
|
||||
const FILE_NAME_LOCAL = 'settings_local';
|
||||
|
|
@ -22,8 +22,8 @@ class DefaultSettings implements \RainLoop\Providers\Settings\ISettings
|
|||
$sValue = $this->oStorageProvider->Get($oAccount,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
|
||||
$this->oStorageProvider->IsLocal() ?
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME_LOCAL :
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME
|
||||
self::FILE_NAME_LOCAL :
|
||||
self::FILE_NAME
|
||||
);
|
||||
|
||||
if (\is_string($sValue))
|
||||
|
|
@ -43,8 +43,8 @@ class DefaultSettings implements \RainLoop\Providers\Settings\ISettings
|
|||
return $this->oStorageProvider->Put($oAccount,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
|
||||
$this->oStorageProvider->IsLocal() ?
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME_LOCAL :
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME,
|
||||
self::FILE_NAME_LOCAL :
|
||||
self::FILE_NAME,
|
||||
\json_encode($aSettings));
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ class DefaultSettings implements \RainLoop\Providers\Settings\ISettings
|
|||
return $this->oStorageProvider->Clear($oAccount,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
|
||||
$this->oStorageProvider->IsLocal() ?
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME_LOCAL :
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME);
|
||||
self::FILE_NAME_LOCAL :
|
||||
self::FILE_NAME);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ class Service
|
|||
*/
|
||||
private $oServiceActions;
|
||||
|
||||
private function __construct()
|
||||
function __construct()
|
||||
{
|
||||
$this->oHttp = \MailSo\Base\Http::SingletonInstance();
|
||||
$this->oActions = \RainLoop\Api::Actions();
|
||||
$this->oActions = Api::Actions();
|
||||
|
||||
$this->oServiceActions = new \RainLoop\ServiceActions($this->oHttp, $this->oActions);
|
||||
$this->oServiceActions = new ServiceActions($this->oHttp, $this->oActions);
|
||||
|
||||
if ($this->oActions->Config()->Get('debug', 'enable', false))
|
||||
{
|
||||
|
|
@ -72,8 +72,7 @@ class Service
|
|||
static $bOne = null;
|
||||
if (null === $bOne)
|
||||
{
|
||||
$oService = new self();
|
||||
$bOne = $oService->RunResult();
|
||||
$bOne = (new self)->RunResult();
|
||||
}
|
||||
|
||||
return $bOne;
|
||||
|
|
@ -141,9 +140,9 @@ class Service
|
|||
$bMobileDevice = false;
|
||||
if ($this->oActions->Config()->Get('labs', 'allow_mobile_version', false)) {
|
||||
$bUseMobileVersionForTablets = $this->oActions->Config()->Get('labs', 'use_mobile_version_for_tablets', false);
|
||||
$bMobileDevice = \RainLoop\UserAgent::isMobile() &&
|
||||
($bUseMobileVersionForTablets ? true : !\RainLoop\UserAgent::isTablet());
|
||||
$sMobileType = (string) \RainLoop\Utils::GetCookie(\RainLoop\Actions::RL_MOBILE_TYPE, '');
|
||||
$bMobileDevice = UserAgent::isMobile() &&
|
||||
($bUseMobileVersionForTablets ? true : !UserAgent::isTablet());
|
||||
$sMobileType = (string) Utils::GetCookie(Actions::RL_MOBILE_TYPE, '');
|
||||
switch ($sMobileType) {
|
||||
default:
|
||||
$bMobile = $bMobileDevice;
|
||||
|
|
@ -187,7 +186,7 @@ class Service
|
|||
// $aTemplateParameters['{{BaseTemplates}}'] = $this->oServiceActions->compileTemplates($bAdmin, false);
|
||||
$sResult = \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Index.html'), $aTemplateParameters);
|
||||
|
||||
$sResult = \RainLoop\Utils::ClearHtmlOutput($sResult);
|
||||
$sResult = Utils::ClearHtmlOutput($sResult);
|
||||
if (0 < \strlen($sCacheFileName))
|
||||
{
|
||||
$this->oActions->Cacher()->Set($sCacheFileName, $sResult);
|
||||
|
|
@ -203,7 +202,7 @@ class Service
|
|||
$sResult .= '][AGPLv3';
|
||||
$sResult .= '][cached:'.($bCached ? 'true' : 'false');
|
||||
// $sResult .= '][hash:'.$aTemplateParameters['{{BaseHash}}'];
|
||||
// $sResult .= '][session:'.\md5(\RainLoop\Utils::GetShortToken());
|
||||
// $sResult .= '][session:'.\md5(Utils::GetShortToken());
|
||||
|
||||
if ($bMobile)
|
||||
{
|
||||
|
|
@ -278,7 +277,7 @@ class Service
|
|||
$bAdmin ? '1' : '0',
|
||||
\md5($this->oActions->Config()->Get('cache', 'index', '')),
|
||||
$this->oActions->Plugins()->Hash(),
|
||||
\RainLoop\Utils::WebVersionPath(),
|
||||
Utils::WebVersionPath(),
|
||||
APP_VERSION,
|
||||
)).
|
||||
\implode('~', $aTemplateParameters)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class ServiceActions
|
|||
*/
|
||||
protected $sQuery;
|
||||
|
||||
public function __construct(\MailSo\Base\Http $oHttp, \RainLoop\Actions $oActions)
|
||||
public function __construct(\MailSo\Base\Http $oHttp, Actions $oActions)
|
||||
{
|
||||
$this->oHttp = $oHttp;
|
||||
$this->oActions = $oActions;
|
||||
|
|
@ -37,12 +37,12 @@ class ServiceActions
|
|||
return $this->oActions->Logger();
|
||||
}
|
||||
|
||||
public function Plugins() : \RainLoop\Plugins\Manager
|
||||
public function Plugins() : Plugins\Manager
|
||||
{
|
||||
return $this->oActions->Plugins();
|
||||
}
|
||||
|
||||
public function Config() : \RainLoop\Config\Application
|
||||
public function Config() : Config\Application
|
||||
{
|
||||
return $this->oActions->Config();
|
||||
}
|
||||
|
|
@ -52,12 +52,12 @@ class ServiceActions
|
|||
return $this->oActions->Cacher();
|
||||
}
|
||||
|
||||
public function StorageProvider() : \RainLoop\Providers\Storage
|
||||
public function StorageProvider() : Providers\Storage
|
||||
{
|
||||
return $this->oActions->StorageProvider();
|
||||
}
|
||||
|
||||
public function SettingsProvider() : \RainLoop\Providers\Settings
|
||||
public function SettingsProvider() : Providers\Settings
|
||||
{
|
||||
return $this->oActions->SettingsProvider();
|
||||
}
|
||||
|
|
@ -93,9 +93,9 @@ class ServiceActions
|
|||
{
|
||||
if ($this->oHttp->IsPost() &&
|
||||
$this->Config()->Get('security', 'csrf_protection', false) &&
|
||||
$this->oHttp->GetPost('XToken', '') !== \RainLoop\Utils::GetCsrfToken())
|
||||
$this->oHttp->GetPost('XToken', '') !== Utils::GetCsrfToken())
|
||||
{
|
||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::InvalidToken);
|
||||
throw new Exceptions\ClientException(Notifications::InvalidToken);
|
||||
}
|
||||
else if (!empty($sAction))
|
||||
{
|
||||
|
|
@ -143,7 +143,7 @@ class ServiceActions
|
|||
|
||||
if (!\is_array($aResponseItem))
|
||||
{
|
||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::UnknownError);
|
||||
throw new Exceptions\ClientException(Notifications::UnknownError);
|
||||
}
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
|
|
@ -156,7 +156,7 @@ class ServiceActions
|
|||
$aResponseItem = $this->oActions->ExceptionResponse(
|
||||
empty($sAction) ? 'Unknown' : $sAction, $oException);
|
||||
|
||||
if (\is_array($aResponseItem) && $oException instanceof \RainLoop\Exceptions\ClientException)
|
||||
if (\is_array($aResponseItem) && $oException instanceof Exceptions\ClientException)
|
||||
{
|
||||
if ('Folders' === $sAction)
|
||||
{
|
||||
|
|
@ -261,7 +261,7 @@ class ServiceActions
|
|||
{
|
||||
$aFile = null;
|
||||
$sInputName = 'uploader';
|
||||
$iError = \RainLoop\Enumerations\UploadError::UNKNOWN;
|
||||
$iError = Enumerations\UploadError::UNKNOWN;
|
||||
$iSizeLimit = (0 < $iSizeLimit ? $iSizeLimit : ((int) $oConfig->Get('webmail', 'attachment_size_limit', 0))) * 1024 * 1024;
|
||||
|
||||
$iError = UPLOAD_ERR_OK;
|
||||
|
|
@ -272,7 +272,7 @@ class ServiceActions
|
|||
|
||||
if (UPLOAD_ERR_OK === $iError && 0 < $iSizeLimit && $iSizeLimit < (int) $_FILES[$sInputName]['size'])
|
||||
{
|
||||
$iError = \RainLoop\Enumerations\UploadError::CONFIG_SIZE;
|
||||
$iError = Enumerations\UploadError::CONFIG_SIZE;
|
||||
}
|
||||
|
||||
if (UPLOAD_ERR_OK === $iError)
|
||||
|
|
@ -286,7 +286,7 @@ class ServiceActions
|
|||
}
|
||||
else
|
||||
{
|
||||
$iError = \RainLoop\Enumerations\UploadError::EMPTY_FILES_DATA;
|
||||
$iError = Enumerations\UploadError::EMPTY_FILES_DATA;
|
||||
}
|
||||
|
||||
if (\method_exists($this->oActions, $sAction) &&
|
||||
|
|
@ -304,7 +304,7 @@ class ServiceActions
|
|||
|
||||
if (!is_array($aResponseItem))
|
||||
{
|
||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::UnknownError);
|
||||
throw new Exceptions\ClientException(Notifications::UnknownError);
|
||||
}
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
|
|
@ -358,8 +358,8 @@ class ServiceActions
|
|||
{
|
||||
$this->oActions->verifyCacheByKey($sData);
|
||||
|
||||
$aData = \RainLoop\Utils::DecodeKeyValuesQ($sData);
|
||||
if (\is_array($aData) && !empty($aData['Token']) && !empty($aData['Url']) && $aData['Token'] === \RainLoop\Utils::GetConnectionToken())
|
||||
$aData = Utils::DecodeKeyValuesQ($sData);
|
||||
if (\is_array($aData) && !empty($aData['Token']) && !empty($aData['Url']) && $aData['Token'] === Utils::GetConnectionToken())
|
||||
{
|
||||
$iCode = 404;
|
||||
$sContentType = '';
|
||||
|
|
@ -429,12 +429,12 @@ class ServiceActions
|
|||
$sRawError = 'Empty action';
|
||||
}
|
||||
}
|
||||
catch (\RainLoop\Exceptions\ClientException $oException)
|
||||
catch (Exceptions\ClientException $oException)
|
||||
{
|
||||
$sRawError = 'Exception as result';
|
||||
switch ($oException->getCode())
|
||||
{
|
||||
case \RainLoop\Notifications::AuthError:
|
||||
case Notifications::AuthError:
|
||||
$sRawError = 'Authentication failed';
|
||||
break;
|
||||
}
|
||||
|
|
@ -478,7 +478,7 @@ class ServiceActions
|
|||
$sCacheFileName = '';
|
||||
if ($bCacheEnabled)
|
||||
{
|
||||
$sCacheFileName = \RainLoop\KeyPathHelper::LangCache(
|
||||
$sCacheFileName = KeyPathHelper::LangCache(
|
||||
$sLanguage, $bAdmim, $this->oActions->Plugins()->Hash());
|
||||
|
||||
$sResult = $this->Cacher()->Get($sCacheFileName);
|
||||
|
|
@ -518,7 +518,7 @@ class ServiceActions
|
|||
$sCacheFileName = '';
|
||||
if ($bCacheEnabled)
|
||||
{
|
||||
$sCacheFileName = \RainLoop\KeyPathHelper::TemplatesCache($bAdmin, $this->oActions->Plugins()->Hash());
|
||||
$sCacheFileName = KeyPathHelper::TemplatesCache($bAdmin, $this->oActions->Plugins()->Hash());
|
||||
$sResult = $this->Cacher()->Get($sCacheFileName);
|
||||
}
|
||||
|
||||
|
|
@ -555,7 +555,7 @@ class ServiceActions
|
|||
$sCacheFileName = '';
|
||||
if ($bCacheEnabled)
|
||||
{
|
||||
$sCacheFileName = \RainLoop\KeyPathHelper::PluginsJsCache($this->oActions->Plugins()->Hash());
|
||||
$sCacheFileName = KeyPathHelper::PluginsJsCache($this->oActions->Plugins()->Hash());
|
||||
$sResult = $this->Cacher()->Get($sCacheFileName);
|
||||
}
|
||||
|
||||
|
|
@ -613,7 +613,7 @@ class ServiceActions
|
|||
$sCacheFileName = '';
|
||||
if ($bCacheEnabled)
|
||||
{
|
||||
$sCacheFileName = \RainLoop\KeyPathHelper::CssCache($sTheme, $this->oActions->Plugins()->Hash());
|
||||
$sCacheFileName = KeyPathHelper::CssCache($sTheme, $this->oActions->Plugins()->Hash());
|
||||
$sResult = $this->Cacher()->Get($sCacheFileName);
|
||||
}
|
||||
|
||||
|
|
@ -638,7 +638,7 @@ class ServiceActions
|
|||
if (\file_exists($sThemeFile) && \file_exists($sThemeTemplateFile) && \file_exists($sThemeValuesFile))
|
||||
{
|
||||
$aResult[] = '@base: "'.
|
||||
($bCustomTheme ? \RainLoop\Utils::WebPath() : \RainLoop\Utils::WebVersionPath()).
|
||||
($bCustomTheme ? Utils::WebPath() : Utils::WebVersionPath()).
|
||||
'themes/'.$sRealTheme.'/";';
|
||||
|
||||
$aResult[] = \file_get_contents($sThemeValuesFile);
|
||||
|
|
@ -690,14 +690,14 @@ class ServiceActions
|
|||
|
||||
public function ServiceMobileVersion() : string
|
||||
{
|
||||
\RainLoop\Utils::SetCookie(\RainLoop\Actions::RL_MOBILE_TYPE, 'mobile');
|
||||
Utils::SetCookie(Actions::RL_MOBILE_TYPE, 'mobile');
|
||||
$this->oActions->Location('./');
|
||||
return '';
|
||||
}
|
||||
|
||||
public function ServiceDesktopVersion() : string
|
||||
{
|
||||
\RainLoop\Utils::SetCookie(\RainLoop\Actions::RL_MOBILE_TYPE, 'desktop');
|
||||
Utils::SetCookie(Actions::RL_MOBILE_TYPE, 'desktop');
|
||||
$this->oActions->Location('./');
|
||||
return '';
|
||||
}
|
||||
|
|
@ -719,7 +719,7 @@ class ServiceActions
|
|||
|
||||
\header('Content-Type: text/html; charset=utf-8');
|
||||
return \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/BadBrowser.html'), array(
|
||||
'{{BaseWebStaticPath}}' => \RainLoop\Utils::WebStaticPath(),
|
||||
'{{BaseWebStaticPath}}' => Utils::WebStaticPath(),
|
||||
'{{ErrorTitle}}' => $sTitle,
|
||||
'{{ErrorHeader}}' => $sTitle,
|
||||
'{{ErrorDesc}}' => $sDesc
|
||||
|
|
@ -766,11 +766,11 @@ class ServiceActions
|
|||
{
|
||||
$mData = null;
|
||||
|
||||
$sSsoSubData = $this->Cacher()->Get(\RainLoop\KeyPathHelper::SsoCacherKey($sSsoHash));
|
||||
$sSsoSubData = $this->Cacher()->Get(KeyPathHelper::SsoCacherKey($sSsoHash));
|
||||
if (!empty($sSsoSubData))
|
||||
{
|
||||
$mData = \RainLoop\Utils::DecodeKeyValuesQ($sSsoSubData);
|
||||
$this->Cacher()->Delete(\RainLoop\KeyPathHelper::SsoCacherKey($sSsoHash));
|
||||
$mData = Utils::DecodeKeyValuesQ($sSsoSubData);
|
||||
$this->Cacher()->Delete(KeyPathHelper::SsoCacherKey($sSsoHash));
|
||||
|
||||
if (\is_array($mData) && !empty($mData['Email']) && isset($mData['Password'], $mData['Time']) &&
|
||||
(0 === $mData['Time'] || \time() - 10 < $mData['Time']))
|
||||
|
|
@ -785,7 +785,7 @@ class ServiceActions
|
|||
{
|
||||
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
|
||||
|
||||
if ($oAccount instanceof \RainLoop\Model\Account && $aAdditionalOptions)
|
||||
if ($oAccount instanceof Model\Account && $aAdditionalOptions)
|
||||
{
|
||||
$bNeedToSettings = false;
|
||||
|
||||
|
|
@ -814,7 +814,7 @@ class ServiceActions
|
|||
|
||||
$this->oActions->AuthToken($oAccount);
|
||||
|
||||
$bLogout = !($oAccount instanceof \RainLoop\Model\Account);
|
||||
$bLogout = !($oAccount instanceof Model\Account);
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
{
|
||||
|
|
@ -848,7 +848,7 @@ class ServiceActions
|
|||
{
|
||||
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
|
||||
$this->oActions->AuthToken($oAccount);
|
||||
$bLogout = !($oAccount instanceof \RainLoop\Model\Account);
|
||||
$bLogout = !($oAccount instanceof Model\Account);
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
{
|
||||
|
|
@ -881,19 +881,19 @@ class ServiceActions
|
|||
|
||||
$aResult = array(
|
||||
'Action' => 'ExternalLogin',
|
||||
'Result' => $oAccount instanceof \RainLoop\Model\Account ? true : false,
|
||||
'Result' => $oAccount instanceof Model\Account ? true : false,
|
||||
'ErrorCode' => 0
|
||||
);
|
||||
|
||||
if (!$aResult['Result'])
|
||||
{
|
||||
if ($oException instanceof \RainLoop\Exceptions\ClientException)
|
||||
if ($oException instanceof Exceptions\ClientException)
|
||||
{
|
||||
$aResult['ErrorCode'] = $oException->getCode();
|
||||
}
|
||||
else
|
||||
{
|
||||
$aResult['ErrorCode'] = \RainLoop\Notifications::AuthError;
|
||||
$aResult['ErrorCode'] = Notifications::AuthError;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -914,7 +914,7 @@ class ServiceActions
|
|||
|
||||
$oAccount = $this->oActions->GetAccount();
|
||||
|
||||
if ($oAccount && $this->oActions->GetCapa(false, false, \RainLoop\Enumerations\Capa::ADDITIONAL_ACCOUNTS, $oAccount))
|
||||
if ($oAccount && $this->oActions->GetCapa(false, false, Enumerations\Capa::ADDITIONAL_ACCOUNTS, $oAccount))
|
||||
{
|
||||
$oAccountToLogin = null;
|
||||
$sEmail = empty($this->aPaths[2]) ? '' : \urldecode(\trim($this->aPaths[2]));
|
||||
|
|
@ -949,7 +949,7 @@ class ServiceActions
|
|||
public function ErrorTemplates(string $sTitle, string $sDesc, bool $bShowBackLink = true)
|
||||
{
|
||||
return strtr(file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Error.html'), array(
|
||||
'{{BaseWebStaticPath}}' => \RainLoop\Utils::WebStaticPath(),
|
||||
'{{BaseWebStaticPath}}' => Utils::WebStaticPath(),
|
||||
'{{ErrorTitle}}' => $sTitle,
|
||||
'{{ErrorHeader}}' => $sTitle,
|
||||
'{{ErrorDesc}}' => $sDesc,
|
||||
|
|
@ -1016,9 +1016,9 @@ class ServiceActions
|
|||
{
|
||||
$aTemplates = array();
|
||||
|
||||
\RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH.'app/templates/Views/Components', 'Component');
|
||||
\RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH.'app/templates/Views/'.($bAdmin ? 'Admin' : 'User'));
|
||||
\RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH.'app/templates/Views/Common');
|
||||
Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH.'app/templates/Views/Components', 'Component');
|
||||
Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH.'app/templates/Views/'.($bAdmin ? 'Admin' : 'User'));
|
||||
Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH.'app/templates/Views/Common');
|
||||
|
||||
$this->oActions->Plugins()->CompileTemplate($aTemplates, $bAdmin);
|
||||
|
||||
|
|
@ -1057,10 +1057,10 @@ class ServiceActions
|
|||
$sMoment = \preg_replace('/\/\/[^\n]+\n/', '', $sMoment);
|
||||
}
|
||||
|
||||
\RainLoop\Utils::ReadAndAddLang(APP_VERSION_ROOT_PATH.'app/localization/langs.yml', $aResultLang);
|
||||
\RainLoop\Utils::ReadAndAddLang(APP_VERSION_ROOT_PATH.'app/localization/'.
|
||||
Utils::ReadAndAddLang(APP_VERSION_ROOT_PATH.'app/localization/langs.yml', $aResultLang);
|
||||
Utils::ReadAndAddLang(APP_VERSION_ROOT_PATH.'app/localization/'.
|
||||
($bAdmin ? 'admin' : 'webmail').'/_source.en.yml', $aResultLang);
|
||||
\RainLoop\Utils::ReadAndAddLang(APP_VERSION_ROOT_PATH.'app/localization/'.
|
||||
Utils::ReadAndAddLang(APP_VERSION_ROOT_PATH.'app/localization/'.
|
||||
($bAdmin ? 'admin' : 'webmail').'/'.$sLanguage.'.yml', $aResultLang);
|
||||
|
||||
$this->Plugins()->ReadLang($sLanguage, $aResultLang);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class Utils
|
|||
|
||||
static $RsaKey = null;
|
||||
|
||||
private function __construct()
|
||||
function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue