mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
ckeditor fixes
demo-plugin TemproryApcStorage
This commit is contained in:
parent
000711086a
commit
844afadd6f
40 changed files with 2371 additions and 197 deletions
|
|
@ -627,13 +627,8 @@ class PdoAddressBook
|
|||
if (0 < \strlen($sSearch))
|
||||
{
|
||||
$sCustomSearch = $this->specialConvertSearchValueCustomPhone($sSearch);
|
||||
if ('%%' === $sCustomSearch)
|
||||
{
|
||||
// TODO fix this
|
||||
$sCustomSearch = '';
|
||||
}
|
||||
|
||||
$sSearchTypes = implode(',', array(
|
||||
$sSearchTypes = \implode(',', array(
|
||||
PropertyType::EMAIl, PropertyType::FIRST_NAME, PropertyType::LAST_NAME, PropertyType::NICK_NAME,
|
||||
PropertyType::PHONE, PropertyType::WEB_PAGE
|
||||
));
|
||||
|
|
@ -1501,7 +1496,8 @@ SQLITEINITIAL;
|
|||
*/
|
||||
private function specialConvertSearchValueCustomPhone($sSearch)
|
||||
{
|
||||
return '%'.\preg_replace('/[^\d]/', '', $sSearch).'%';
|
||||
$sResult = '%'.\preg_replace('/[^\d]/', '', $sSearch).'%';
|
||||
return '%%' === $sResult ? '' : $sResult;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ namespace RainLoop\Providers;
|
|||
class Files extends \RainLoop\Providers\AbstractProvider
|
||||
{
|
||||
/**
|
||||
* @var \RainLoop\Providers\Files\FilesInterface
|
||||
* @var \RainLoop\Providers\Files\IFiles
|
||||
*/
|
||||
private $oDriver;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(\RainLoop\Providers\Files\FilesInterface $oDriver)
|
||||
public function __construct(\RainLoop\Providers\Files\IFiles $oDriver)
|
||||
{
|
||||
$this->oDriver = $oDriver;
|
||||
}
|
||||
|
|
@ -121,6 +121,6 @@ class Files extends \RainLoop\Providers\AbstractProvider
|
|||
*/
|
||||
public function IsActive()
|
||||
{
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Files\FilesInterface;
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Files\IFiles;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Files;
|
||||
|
||||
class DefaultStorage implements \RainLoop\Providers\Files\FilesInterface
|
||||
class FileStorage implements \RainLoop\Providers\Files\IFiles
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Files;
|
||||
|
||||
interface FilesInterface
|
||||
interface IFiles
|
||||
{
|
||||
/**
|
||||
* @param \RainLoop\Model\Account $oAccount
|
||||
|
|
@ -5,16 +5,16 @@ namespace RainLoop\Providers;
|
|||
class Settings extends \RainLoop\Providers\AbstractProvider
|
||||
{
|
||||
/**
|
||||
* @var \RainLoop\Providers\Settings\SettingsInterface
|
||||
* @var \RainLoop\Providers\Settings\ISettings
|
||||
*/
|
||||
private $oDriver;
|
||||
|
||||
/**
|
||||
* @param \RainLoop\Providers\Settings\SettingsInterface $oDriver
|
||||
* @param \RainLoop\Providers\Settings\ISettings $oDriver
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(\RainLoop\Providers\Settings\SettingsInterface $oDriver)
|
||||
public function __construct(\RainLoop\Providers\Settings\ISettings $oDriver)
|
||||
{
|
||||
$this->oDriver = $oDriver;
|
||||
}
|
||||
|
|
@ -47,6 +47,6 @@ class Settings extends \RainLoop\Providers\AbstractProvider
|
|||
*/
|
||||
public function IsActive()
|
||||
{
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Settings\SettingsInterface;
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Settings\ISettings;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Settings;
|
||||
|
||||
class DefaultSettings implements \RainLoop\Providers\Settings\SettingsInterface
|
||||
class DefaultSettings implements \RainLoop\Providers\Settings\ISettings
|
||||
{
|
||||
const FILE_NAME = 'settings';
|
||||
const FILE_NAME_LOCAL = 'settings_local';
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Settings;
|
||||
|
||||
interface SettingsInterface
|
||||
interface ISettings
|
||||
{
|
||||
/**
|
||||
* @param \RainLoop\Model\Account $oAccount
|
||||
|
|
@ -5,14 +5,14 @@ namespace RainLoop\Providers;
|
|||
class Storage extends \RainLoop\Providers\AbstractProvider
|
||||
{
|
||||
/**
|
||||
* @var \RainLoop\Providers\Storage\StorageInterface
|
||||
* @var \RainLoop\Providers\Storage\IStorage
|
||||
*/
|
||||
private $oDriver;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(\RainLoop\Providers\Storage\StorageInterface $oDriver)
|
||||
public function __construct(\RainLoop\Providers\Storage\IStorage $oDriver)
|
||||
{
|
||||
$this->oDriver = $oDriver;
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ class Storage extends \RainLoop\Providers\AbstractProvider
|
|||
*/
|
||||
public function IsActive()
|
||||
{
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Storage\StorageInterface;
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Storage\IStorage;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -110,7 +110,7 @@ class Storage extends \RainLoop\Providers\AbstractProvider
|
|||
*/
|
||||
public function IsLocal()
|
||||
{
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Storage\StorageInterface &&
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Storage\IStorage &&
|
||||
$this->oDriver->IsLocal();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Storage;
|
||||
|
||||
class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
|
||||
class FileStorage implements \RainLoop\Providers\Storage\IStorage
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
|
|
@ -14,6 +14,11 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
|
|||
*/
|
||||
private $bLocal;
|
||||
|
||||
/**
|
||||
* @var \MailSo\Log\Logger
|
||||
*/
|
||||
protected $oLogger;
|
||||
|
||||
/**
|
||||
* @param string $sStoragePath
|
||||
* @param bool $bLocal = false
|
||||
|
|
@ -24,6 +29,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
|
|||
{
|
||||
$this->sDataPath = \rtrim(\trim($sStoragePath), '\\/');
|
||||
$this->bLocal = !!$bLocal;
|
||||
$this->oLogger = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -122,7 +128,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
private function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false)
|
||||
public function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false)
|
||||
{
|
||||
if (null === $mAccount)
|
||||
{
|
||||
|
|
@ -186,4 +192,12 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
|
|||
|
||||
return $sFilePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Log\Logger $oLogger
|
||||
*/
|
||||
public function SetLogger($oLogger)
|
||||
{
|
||||
$this->oLogger = $oLogger instanceof \MailSo\Log\Logger ? $oLogger : null;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Storage;
|
||||
|
||||
interface StorageInterface
|
||||
interface IStorage
|
||||
{
|
||||
/**
|
||||
* @param \RainLoop\Model\Account|null $oAccount
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
namespace RainLoop\Providers\Storage;
|
||||
|
||||
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
|
||||
*/
|
||||
public function Put($oAccount, $iStorageType, $sKey, $sValue)
|
||||
{
|
||||
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)
|
||||
{
|
||||
$bValue = false;
|
||||
$mValue = @\apc_fetch($this->generateFileName($oAccount, $iStorageType, $sKey), $bValue);
|
||||
if (!$bValue)
|
||||
{
|
||||
$mValue = $mDefault;
|
||||
}
|
||||
|
||||
return $mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \RainLoop\Model\Account|string|null $oAccount
|
||||
* @param int $iStorageType
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function Clear($oAccount, $iStorageType, $sKey)
|
||||
{
|
||||
@\apc_delete($this->generateFileName($oAccount, $iStorageType, $sKey));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \RainLoop\Model\Account|string $oAccount
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function DeleteStorage($oAccount)
|
||||
{
|
||||
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)
|
||||
{
|
||||
$sFileName = parent::generateFileName($mAccount, $iStorageType, $sKey, false, false);
|
||||
return $sFileName.'/'.\RainLoop\Utils::GetConnectionToken().'/';
|
||||
}
|
||||
}
|
||||
|
|
@ -5,12 +5,12 @@ namespace RainLoop\Providers;
|
|||
class Suggestions extends \RainLoop\Providers\AbstractProvider
|
||||
{
|
||||
/**
|
||||
* @var \RainLoop\Providers\Suggestions\SuggestionsInterface
|
||||
* @var \RainLoop\Providers\Suggestions\ISuggestions
|
||||
*/
|
||||
private $oDriver;
|
||||
|
||||
/**
|
||||
* @param \RainLoop\Providers\Suggestions\SuggestionsInterface|null $oDriver = null
|
||||
* @param \RainLoop\Providers\Suggestions\ISuggestions|null $oDriver = null
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -37,6 +37,6 @@ class Suggestions extends \RainLoop\Providers\AbstractProvider
|
|||
*/
|
||||
public function IsActive()
|
||||
{
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Suggestions\SuggestionsInterface;
|
||||
return $this->oDriver instanceof \RainLoop\Providers\Suggestions\ISuggestions;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Suggestions;
|
||||
|
||||
interface SuggestionsInterface
|
||||
interface ISuggestions
|
||||
{
|
||||
/**
|
||||
* @param \RainLoop\Model\Account $oAccount
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
namespace RainLoop\Providers\Suggestions;
|
||||
|
||||
class OwnCloudSuggestions implements \RainLoop\Providers\Suggestions\SuggestionsInterface
|
||||
class OwnCloudSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions
|
||||
{
|
||||
/**
|
||||
* @var \MailSo\Log\Logger
|
||||
*/
|
||||
private $oLogger;
|
||||
protected $oLogger;
|
||||
|
||||
/**
|
||||
* @param \RainLoop\Model\Account $oAccount
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Suggestions;
|
||||
|
||||
class TestSuggestions implements \RainLoop\Providers\Suggestions\SuggestionsInterface
|
||||
class TestSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions
|
||||
{
|
||||
/**
|
||||
* @param \RainLoop\Model\Account $oAccount
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue