Small fixes

This commit is contained in:
RainLoop Team 2015-02-12 23:56:06 +04:00
parent d9dabab1dc
commit 86f855fa5b
2 changed files with 17 additions and 40 deletions

View file

@ -11,7 +11,7 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin
$this->addHook('filter.action-params', 'FilterActionParams');
$this->addHook('ajax.action-pre-call', 'AjaxActionPreCall');
$this->addHook('filter.send-message', 'FilterSendMessage');
$this->addHook('main.fabrica[2]', 'MainFabrica');
$this->addHook('main.fabrica', 'MainFabrica');
}
/**
@ -76,29 +76,7 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin
{
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);
}
}
@ -106,18 +84,21 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin
* @param string $sName
* @param mixed $oDriver
*/
public function MainFabrica($sName, &$oDriver, $oAccount)
public function MainFabrica($sName, &$oDriver)
{
switch ($sName)
{
case 'settings':
case 'settings-local':
if ($oAccount && \class_exists('\\RainLoop\\Providers\\Storage\\TemproryApcStorage') &&
\function_exists('apc_store') &&
$this->isDemoAccount($oAccount))
case 'storage':
case 'storage-local':
if (\class_exists('\\RainLoop\\Providers\\Storage\\TemproryApcStorage') &&
\function_exists('apc_store'))
{
$oDriver = new \RainLoop\Providers\Storage\TemproryApcStorage(APP_PRIVATE_DATA.'storage',
$sName === 'settings-local');
$oAccount = $this->Manager()->Actions()->GetAccount();
if ($this->isDemoAccount($oAccount))
{
$oDriver = new \RainLoop\Providers\Storage\TemproryApcStorage(APP_PRIVATE_DATA.'storage',
$sName === 'storage-local');
}
}
break;
}

View file

@ -250,20 +250,16 @@ class Actions
$oResult = new \RainLoop\Providers\Files\FileStorage(APP_PRIVATE_DATA.'storage/files');
break;
case 'storage':
// RainLoop\Providers\Storage\IStorage
$oResult = new \RainLoop\Providers\Storage\FileStorage(APP_PRIVATE_DATA.'storage');
break;
case 'storage-local':
// 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;
case 'settings':
// RainLoop\Providers\Settings\ISettings
$oResult = new \RainLoop\Providers\Settings\DefaultSettings($this->StorageProvider());
break;
case 'settings-local':
// 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;
case 'login':
// \RainLoop\Providers\Login\LoginInterface