mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-02-06 14:04:24 +08:00
4cc2207513
Original unminified source code (dev folder - js, css, less) (fixes #6) Grunt build system Multiple identities correction (fixes #9) Compose html editor (fixes #12) New general settings - Loading Description New warning about default admin password Split general and login screen settings
59 lines
No EOL
1.3 KiB
PHP
59 lines
No EOL
1.3 KiB
PHP
<?php
|
|
|
|
namespace RainLoop\Providers\Settings;
|
|
|
|
class DefaultSettings implements \RainLoop\Providers\Settings\SettingsInterface
|
|
{
|
|
const FILE_NAME = 'settings';
|
|
|
|
/**
|
|
* @var \RainLoop\Providers\Storage
|
|
*/
|
|
private $oStorageProvider;
|
|
|
|
/**
|
|
* @param \RainLoop\Providers\Storage $oStorageProvider
|
|
*/
|
|
public function __construct(\RainLoop\Providers\Storage $oStorageProvider)
|
|
{
|
|
$this->oStorageProvider = $oStorageProvider;
|
|
}
|
|
|
|
/**
|
|
* @param \RainLoop\Account $oAccount
|
|
*
|
|
* @return array
|
|
*/
|
|
public function Load(\RainLoop\Account $oAccount)
|
|
{
|
|
$sValue = $this->oStorageProvider->Get($oAccount,
|
|
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
|
|
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME);
|
|
|
|
$aSettings = array();
|
|
if (\is_string($sValue))
|
|
{
|
|
$aData = \json_decode($sValue, true);
|
|
if (\is_array($aData))
|
|
{
|
|
$aSettings = $aData;
|
|
}
|
|
}
|
|
|
|
return $aSettings;
|
|
}
|
|
|
|
/**
|
|
* @param \RainLoop\Account $oAccount
|
|
* @param array $aSettings
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function Save(\RainLoop\Account $oAccount, array $aSettings)
|
|
{
|
|
return $this->oStorageProvider->Put($oAccount,
|
|
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
|
|
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME,
|
|
\json_encode($aSettings));
|
|
}
|
|
} |