mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Small fixes
This commit is contained in:
parent
d9dabab1dc
commit
86f855fa5b
2 changed files with 17 additions and 40 deletions
|
|
@ -11,7 +11,7 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
$this->addHook('filter.action-params', 'FilterActionParams');
|
$this->addHook('filter.action-params', 'FilterActionParams');
|
||||||
$this->addHook('ajax.action-pre-call', 'AjaxActionPreCall');
|
$this->addHook('ajax.action-pre-call', 'AjaxActionPreCall');
|
||||||
$this->addHook('filter.send-message', 'FilterSendMessage');
|
$this->addHook('filter.send-message', 'FilterSendMessage');
|
||||||
$this->addHook('main.fabrica[2]', 'MainFabrica');
|
$this->addHook('main.fabrica', 'MainFabrica');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -75,49 +75,30 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
public function FilterSendMessage(&$oMessage)
|
public function FilterSendMessage(&$oMessage)
|
||||||
{
|
{
|
||||||
if ($oMessage && $this->isDemoAccount($this->Manager()->Actions()->GetAccount()))
|
if ($oMessage && $this->isDemoAccount($this->Manager()->Actions()->GetAccount()))
|
||||||
{
|
|
||||||
$bError = true;
|
|
||||||
$oRcpt = $oMessage->GetRcpt();
|
|
||||||
if ($oRcpt && 0 < $oRcpt->Count())
|
|
||||||
{
|
|
||||||
$aRcpt =& $oRcpt->GetAsArray();
|
|
||||||
if (0 < \count($aRcpt))
|
|
||||||
{
|
|
||||||
$bError = false;
|
|
||||||
$sCheck = \strtolower(\trim($this->Config()->Get('plugin', 'email')));
|
|
||||||
foreach ($aRcpt as /* @var $oEmail \MailSo\Mime\Email */ $oEmail)
|
|
||||||
{
|
|
||||||
if ($sCheck !== \strtolower(\trim($oEmail->GetEmail())))
|
|
||||||
{
|
|
||||||
$bError = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($bError)
|
|
||||||
{
|
{
|
||||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DemoSendMessageError);
|
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DemoSendMessageError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param mixed $oDriver
|
* @param mixed $oDriver
|
||||||
*/
|
*/
|
||||||
public function MainFabrica($sName, &$oDriver, $oAccount)
|
public function MainFabrica($sName, &$oDriver)
|
||||||
{
|
{
|
||||||
switch ($sName)
|
switch ($sName)
|
||||||
{
|
{
|
||||||
case 'settings':
|
case 'storage':
|
||||||
case 'settings-local':
|
case 'storage-local':
|
||||||
if ($oAccount && \class_exists('\\RainLoop\\Providers\\Storage\\TemproryApcStorage') &&
|
if (\class_exists('\\RainLoop\\Providers\\Storage\\TemproryApcStorage') &&
|
||||||
\function_exists('apc_store') &&
|
\function_exists('apc_store'))
|
||||||
$this->isDemoAccount($oAccount))
|
{
|
||||||
|
$oAccount = $this->Manager()->Actions()->GetAccount();
|
||||||
|
if ($this->isDemoAccount($oAccount))
|
||||||
{
|
{
|
||||||
$oDriver = new \RainLoop\Providers\Storage\TemproryApcStorage(APP_PRIVATE_DATA.'storage',
|
$oDriver = new \RainLoop\Providers\Storage\TemproryApcStorage(APP_PRIVATE_DATA.'storage',
|
||||||
$sName === 'settings-local');
|
$sName === 'storage-local');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -250,20 +250,16 @@ class Actions
|
||||||
$oResult = new \RainLoop\Providers\Files\FileStorage(APP_PRIVATE_DATA.'storage/files');
|
$oResult = new \RainLoop\Providers\Files\FileStorage(APP_PRIVATE_DATA.'storage/files');
|
||||||
break;
|
break;
|
||||||
case 'storage':
|
case 'storage':
|
||||||
// RainLoop\Providers\Storage\IStorage
|
|
||||||
$oResult = new \RainLoop\Providers\Storage\FileStorage(APP_PRIVATE_DATA.'storage');
|
|
||||||
break;
|
|
||||||
case 'storage-local':
|
case 'storage-local':
|
||||||
// RainLoop\Providers\Storage\IStorage
|
// RainLoop\Providers\Storage\IStorage
|
||||||
$oResult = new \RainLoop\Providers\Storage\FileStorage(APP_PRIVATE_DATA.'storage', true);
|
$oResult = new \RainLoop\Providers\Storage\FileStorage(
|
||||||
|
APP_PRIVATE_DATA.'storage', 'storage-local' === $sName);
|
||||||
break;
|
break;
|
||||||
case 'settings':
|
case 'settings':
|
||||||
// RainLoop\Providers\Settings\ISettings
|
|
||||||
$oResult = new \RainLoop\Providers\Settings\DefaultSettings($this->StorageProvider());
|
|
||||||
break;
|
|
||||||
case 'settings-local':
|
case 'settings-local':
|
||||||
// RainLoop\Providers\Settings\ISettings
|
// RainLoop\Providers\Settings\ISettings
|
||||||
$oResult = new \RainLoop\Providers\Settings\DefaultSettings($this->StorageProvider(true));
|
$oResult = new \RainLoop\Providers\Settings\DefaultSettings(
|
||||||
|
$this->StorageProvider('settings-local' === $sName));
|
||||||
break;
|
break;
|
||||||
case 'login':
|
case 'login':
|
||||||
// \RainLoop\Providers\Login\LoginInterface
|
// \RainLoop\Providers\Login\LoginInterface
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue