Privacy/GDPR friendly version (removed: Social, Gravatar, Facebook, Google, Twitter, DropBox, OwnCloud)

Also removed: POP3, OAuth2 and update feature
Added: admin password_hash/password_verify
Requires: PHP 7.3+
Replaced: CRLF with LF
Replaced: pclZip with ZipArchive
This commit is contained in:
djmaze 2020-03-09 17:04:17 +01:00
parent 15ceddc202
commit 2cada68f41
293 changed files with 23728 additions and 85420 deletions

View file

@ -20,12 +20,9 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
protected $oLogger;
/**
* @param string $sStoragePath
* @param bool $bLocal = false
*
* @return void
*/
public function __construct($sStoragePath, $bLocal = false)
public function __construct(string $sStoragePath, bool $bLocal = false)
{
$this->sDataPath = \rtrim(\trim($sStoragePath), '\\/');
$this->bLocal = !!$bLocal;
@ -34,13 +31,9 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
/**
* @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType
* @param string $sKey
* @param string $sValue
*
* @return bool
* @param mixed $sValue
*/
public function Put($oAccount, $iStorageType, $sKey, $sValue)
public function Put($oAccount, int $iStorageType, string $sKey, $sValue) : bool
{
return false !== @\file_put_contents(
$this->generateFileName($oAccount, $iStorageType, $sKey, true), $sValue);
@ -48,13 +41,11 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
/**
* @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType
* @param string $sKey
* @param mixed $mDefault = false
*
* @return mixed
*/
public function Get($oAccount, $iStorageType, $sKey, $mDefault = false)
public function Get($oAccount, int $iStorageType, string $sKey, $mDefault = false)
{
$mValue = false;
$sFileName = $this->generateFileName($oAccount, $iStorageType, $sKey);
@ -68,12 +59,8 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
/**
* @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType
* @param string $sKey
*
* @return bool
*/
public function Clear($oAccount, $iStorageType, $sKey)
public function Clear($oAccount, int $iStorageType, string $sKey) : bool
{
$mResult = true;
$sFileName = $this->generateFileName($oAccount, $iStorageType, $sKey);
@ -87,10 +74,8 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
/**
* @param \RainLoop\Model\Account|string $oAccount
*
* @return bool
*/
public function DeleteStorage($oAccount)
public function DeleteStorage($oAccount) : bool
{
$sPath = $this->generateFileName($oAccount,
\RainLoop\Providers\Storage\Enumerations\StorageType::USER, 'xxx', false, true);
@ -111,24 +96,15 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
return true;
}
/**
* @return bool
*/
public function IsLocal()
public function IsLocal() : bool
{
return $this->bLocal;
}
/**
* @param \RainLoop\Model\Account|string|null $mAccount
* @param int $iStorageType
* @param string $sKey
* @param bool $bMkDir = false
* @param bool $bForDeleteAction = false
*
* @return string
*/
public function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false)
public function generateFileName($mAccount, int $iStorageType, string $sKey, bool $bMkDir = false, bool $bForDeleteAction = false) : string
{
if (null === $mAccount)
{
@ -196,8 +172,8 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
/**
* @param \MailSo\Log\Logger $oLogger
*/
public function SetLogger($oLogger)
public function SetLogger(?\MailSo\Log\Logger $oLogger)
{
$this->oLogger = $oLogger instanceof \MailSo\Log\Logger ? $oLogger : null;
$this->oLogger = $oLogger;
}
}

View file

@ -6,35 +6,22 @@ interface IStorage
{
/**
* @param \RainLoop\Model\Account|null $oAccount
* @param int $iStorageType
* @param string $sKey
* @param string $sValue
*
* @return bool
* @param mixed $sValue
*/
public function Put($oAccount, $iStorageType, $sKey, $sValue);
public function Put($oAccount, int $iStorageType, int $sKey, $sValue) : bool;
/**
* @param \RainLoop\Model\Account|null $oAccount
* @param int $iStorageType
* @param string $sKey
* @param mixed $mDefault = false
*
* @return mixed
*/
public function Get($oAccount, $iStorageType, $sKey, $mDefault = false);
public function Get($oAccount, int $iStorageType, string $sKey, $mDefault = false);
/**
* @param \RainLoop\Model\Account|null $oAccount
* @param int $iStorageType
* @param string $sKey
*
* @return bool
*/
public function Clear($oAccount, $iStorageType, $sKey);
public function Clear($oAccount, int $iStorageType, string $sKey) : bool;
/**
* @return bool
*/
public function IsLocal();
public function IsLocal() : bool;
}

View file

@ -6,26 +6,20 @@ class TemproryApcStorage extends \RainLoop\Providers\Storage\FileStorage
{
/**
* @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType
* @param string $sKey
* @param string $sValue
*
* @return bool
* @param mixed $sValue
*/
public function Put($oAccount, $iStorageType, $sKey, $sValue)
public function Put($oAccount, int $iStorageType, string $sKey, $sValue) : bool
{
return !!@\apc_store($this->generateFileName($oAccount, $iStorageType, $sKey, true), $sValue);
}
/**
* @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType
* @param string $sKey
* @param mixed $mDefault = false
*
* @return mixed
*/
public function Get($oAccount, $iStorageType, $sKey, $mDefault = false)
public function Get($oAccount, int $iStorageType, string $sKey, $mDefault = false)
{
$bValue = false;
$mValue = @\apc_fetch($this->generateFileName($oAccount, $iStorageType, $sKey), $bValue);
@ -39,12 +33,8 @@ class TemproryApcStorage extends \RainLoop\Providers\Storage\FileStorage
/**
* @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType
* @param string $sKey
*
* @return bool
*/
public function Clear($oAccount, $iStorageType, $sKey)
public function Clear($oAccount, int $iStorageType, string $sKey) : bool
{
@\apc_delete($this->generateFileName($oAccount, $iStorageType, $sKey));
@ -53,24 +43,16 @@ class TemproryApcStorage extends \RainLoop\Providers\Storage\FileStorage
/**
* @param \RainLoop\Model\Account|string $oAccount
*
* @return bool
*/
public function DeleteStorage($oAccount)
public function DeleteStorage($oAccount) : bool
{
return !!$oAccount;
}
/**
* @param \RainLoop\Model\Account|string|null $mAccount
* @param int $iStorageType
* @param string $sKey
* @param bool $bMkDir = false
* @param bool $bForDeleteAction = false
*
* @return string
*/
public function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false)
public function generateFileName($mAccount, int $iStorageType, string $sKey, bool $bMkDir = false, bool $bForDeleteAction = false) : string
{
$sFileName = parent::generateFileName($mAccount, $iStorageType, $sKey, false, false);
return $sFileName.'/'.\RainLoop\Utils::GetConnectionToken().'/';