* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
class Horde_Kolab_Storage_Factory
{
/**
* A set of parameters for this factory.
*
* @var array
*/
protected $_params;
/**
* Stores the driver once created.
*
* @todo Cleanup. Extract a driver factory to be placed in the driver
* namespace and allow to inject the driver within the storage factory.
*
* @var Horde_Kolab_Storage_Driver
*/
protected $_driver;
/**
* Constructor.
*
* @param array $params A set of parameters.
*
* - storage:
* - cache:
* - queries:
* - queryset:
* - driver: (string) The type of backend driver. One of "mock", "php",
* "pear", "horde", "horde-socket", and "roundcube".
* - params: (array) Backend specific connection parameters.
* - logger: (Horde_Log_Logger) An optional log handler.
* - log: (array) An array of log decorators. Possible values include:
* 'debug', 'driver_time', 'driver'.
* - format : (array)
* - factory: Name of the format parser factory class.
* - history: (Horde_History) A Horde_History driver.
* - history_prefix_generator: (Horde_Kolab_Storage_HistoryPrefix) An
* object that can provide prefix/collection mapping of the
* History system.
* - sync_strategy: (Horde_Kolab_Storage_Synchronization) The strategy
* object to use for determining when we should synchronize
* with the Kolab backend. If omitted,
* Horde_Kolab_Storage_Synchronization_OncePerSession strategy is
* used.
*
*/
public function __construct($params = array())
{
$this->_params = $params;
}
/**
* Create the storage handler.
*
* @return Horde_Kolab_Storage The storage handler.
*/
public function create()
{
if (isset($this->_params['storage'])) {
$sparams = $this->_params['storage'];
} else {
$sparams = array();
}
if (isset($this->_params['queries'])) {
$sparams['queries'] = $this->_params['queries'];
}
if (isset($this->_params['queryset'])) {
$queryset = $this->_params['queryset'];
$sparams['queryset'] = $this->_params['queryset'];
} else {
$queryset = array();
}
$cache = $this->createCache();
if (!empty($this->_params['cache'])) {
$storage = new Horde_Kolab_Storage_Cached(
$this->createDriver(),
new Horde_Kolab_Storage_QuerySet_Cached($this, $queryset, $cache),
$this,
$cache,
$this->_params['logger'],
$sparams
);
} else {
$storage = new Horde_Kolab_Storage_Uncached(
$this->createDriver(),
new Horde_Kolab_Storage_QuerySet_Uncached($this, $queryset),
$this,
$cache,
$this->_params['logger'],
$sparams
);
}
if (empty($this->_params['sync_strategy'])) {
$strategy = new Horde_Kolab_Storage_Synchronization_OncePerSession();
} else {
$strategy = $this->_params['sync_strategy'];
}
$storage = new Horde_Kolab_Storage_Decorator_Synchronization(
$storage, new Horde_Kolab_Storage_Synchronization($strategy)
);
return $storage;
}
/**
* Create the storage backend driver.
*
* @param array $params Any parameters that should overwrite the default
* parameters provided in the factory constructor.
*
* @return Horde_Kolab_Storage_Driver The storage handler.
*/
public function createDriver($params = array())
{
$params = array_merge($this->_params, $params);
if (!isset($params['driver'])) {
throw new Horde_Kolab_Storage_Exception(
Horde_Kolab_Storage_Translation::t(
'Missing "driver" parameter!'
)
);
}
if (isset($params['params'])) {
$config = (array)$params['params'];
} else {
$config = array();
}
if (empty($config['host'])) {
$config['host'] = 'localhost';
}
if (empty($config['port'])) {
$config['port'] = 143;
}
if (isset($this->_params['log'])
&& (in_array('debug', $this->_params['log'])
|| in_array('driver_time', $this->_params['log']))) {
$timer = new Horde_Support_Timer();
$timer->push();
}
switch ($params['driver']) {
case 'mock':
if (!isset($config['data'])) {
$config['data'] = array('user/test' => array());
}
$driver = new Horde_Kolab_Storage_Driver_Mock($this, $config);
break;
case 'horde':
case 'horde-php':
$driver = new Horde_Kolab_Storage_Driver_Imap($this, $config);
break;
case 'php':
$driver = new Horde_Kolab_Storage_Driver_Cclient($this, $config);
break;
case 'pear':
$driver = new Horde_Kolab_Storage_Driver_Pear($this, $config);
break;
case 'roundcube':
$driver = new Horde_Kolab_Storage_Driver_Rcube($this, $config);
break;
default:
throw new Horde_Kolab_Storage_Exception(
sprintf(
Horde_Kolab_Storage_Translation::t(
'Invalid "driver" parameter "%s". Please use one of "mock", "php", "pear", "horde", "horde-php", and "roundcube"!'
),
$params['driver']
)
);
}
if (isset($this->_params['log'])
&& (in_array('debug', $this->_params['log'])
|| in_array('driver', $this->_params['log']))) {
$driver = new Horde_Kolab_Storage_Driver_Decorator_Log(
$driver, $params['logger']
);
}
if (isset($this->_params['log'])
&& (in_array('debug', $this->_params['log'])
|| in_array('driver_time', $this->_params['log']))) {
$driver = new Horde_Kolab_Storage_Driver_Decorator_Timer(
$driver, $timer, $params['logger']
);
}
$this->_driver = $driver;
return $driver;
}
/**
* Create a namespace handler.
*
* @param string $type The namespace type.
* @param string $user The current user.
* @param array $params The parameters for the namespace.
*
* @return Horde_Kolab_Storage_Folder_Namespace The namespace handler.
*/
public function createNamespace($type, $user, array $params = array())
{
$class = 'Horde_Kolab_Storage_Folder_Namespace_' . Horde_String::ucfirst($type);
if (!class_exists($class)) {
throw new Horde_Kolab_Storage_Exception(
sprintf(
Horde_Kolab_Storage_Translation::t(
'Invalid "namespace" type "%s"!'
),
$type
)
);
}
return new $class($user, $params);
}
/**
* Create the cache handler.
*
* @return Horde_Kolab_Storage_Cache The cache handler.
*/
public function createCache()
{
if (isset($this->_params['cache'])) {
$params = $this->_params['cache'];
} else {
$params = array();
}
if ($params instanceof Horde_Cache) {
return new Horde_Kolab_Storage_Cache($params);
} else {
$cache = new Horde_Cache(
new Horde_Cache_Storage_File($params),
array('lifetime' => 0)
);
}
return new Horde_Kolab_Storage_Cache(
$cache
);
}
/**
* Create the history handler.
*
* @param string $user The current user.
*
* @return Horde_History The history handler.
*/
public function createHistory($user)
{
if (isset($this->_params['history']) &&
$this->_params['history'] instanceof Horde_History) {
return $this->_params['history'];
}
return new Horde_History_Mock($user);
}
/**
* Create a prefix factory.
*
* @todo This should probably be implemented by decorating/wrapping the
* Horde_History object but that can't be done in a clean BC way
* until Horde 6. So, until then implement a
* Horde_Kolab_Storage_History_Prefix interface.
*
* @return Horde_Kolab_Storage_HistoryPrefix|Horde_Support_Stub
*/
public function getHistoryPrefixGenerator()
{
if (isset($this->_params['history_prefix_generator'])) {
return $this->_params['history_prefix_generator'];
}
return new Horde_Support_Stub();
}
public function getDriver()
{
return $this->_driver;
}
} Horde_Kolab_Storage-2.2.3/lib/Horde/Kolab/Storage/Folder.php 0000664 0000765 0000024 00000004541 13025022224 020456 0 ustar
* @author Gunnar Wrobel
* @author Thomas Jarosch
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
/**
* The interface describing a Kolab folder.
*
* Copyright 2004-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Kolab
* @package Kolab_Storage
* @author Stuart Binge
* @author Gunnar Wrobel
* @author Thomas Jarosch
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
interface Horde_Kolab_Storage_Folder
{
/**
* Return the storage path of the folder.
*
* @return string The storage path of the folder.
*/
public function getPath();
/**
* Returns a readable title for this folder.
*
* @return string The folder title.
*/
public function getTitle();
/**
* Return the namespace type of the folder.
*
* @return string The namespace type of the folder.
*/
public function getNamespace();
/**
* Return the namespace prefix of the folder.
*
* @return string The namespace prefix of the folder.
*/
public function getPrefix();
/**
* Returns the owner of the folder.
*
* @return string The owner of this folder.
*/
public function getOwner();
/**
* Returns the folder path without namespace components.
*
* @return string The subpath of this folder.
*/
public function getSubpath();
/**
* Returns the folder parent.
*
* @return string The parent of this folder.
*/
public function getParent();
/**
* Is this a default folder?
*
* @return boolean Boolean that indicates the default status.
*/
public function isDefault();
/**
* The type of this folder.
*
* @return string The folder type.
*/
public function getType();
}
Horde_Kolab_Storage-2.2.3/lib/Horde/Kolab/Storage/HistoryPrefix.php 0000664 0000765 0000024 00000001553 13025022224 022062 0 ustar
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
/**
* Copyright 2015-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Kolab
* @package Kolab_Storage
* @author Michael J Rubinsky
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
interface Horde_Kolab_Storage_HistoryPrefix
{
public static function getPrefix(Horde_Kolab_Storage_Data $data);
}
Horde_Kolab_Storage-2.2.3/lib/Horde/Kolab/Storage/Object.php 0000664 0000765 0000024 00000047522 13025022224 020457 0 ustar
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
/**
* Represents a single Kolab object.
*
* @todo Clean up _attachments mess.
*
* @category Kolab
* @package Kolab_Storage
* @author Gunnar Wrobel
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
class Horde_Kolab_Storage_Object implements ArrayAccess, Serializable
{
/** Indicates an invalid object. */
const TYPE_INVALID = 'INVALID';
/** Indicates a missing Kolab data MIME part. */
const ERROR_MISSING_KOLAB_PART = 1;
/** Indicates an unreadable Kolab part. */
const ERROR_INVALID_KOLAB_PART = 2;
/** Serialization elements */
const SERIALIZATION_DATA = 'D';
const SERIALIZATION_ERRORS = 'E';
const SERIALIZATION_TYPE = 'T';
const SERIALIZATION_STRUCTURE = 'S';
const SERIALIZATION_FOLDER = 'F';
const SERIALIZATION_BACKENDID = 'B';
const SERIALIZATION_MIMEPARTID = 'P';
/**
* The driver for accessing the backend.
*
* @var Horde_Kolab_Storage_Driver
*/
protected $_driver;
/**
* The folder that holds the object within the backend.
*
* @var string
*/
protected $_folder;
/**
* The object ID within the backend.
*
* @var string
*/
protected $_backend_id;
/**
* The ID of the MIME part carrying the object data.
*
* @var string
*/
protected $_mime_part_id;
/**
* The object type.
*
* @var string
*/
protected $_type;
/**
* The MIME headers of the object envelope.
*
* @var Horde_Mime_Headers
*/
protected $_headers;
/**
* The message structure.
*
* @var Horde_Mime_Part
*/
protected $_structure;
/**
* The content string representing the object data.
*
* @var resource
*/
protected $_content;
/**
* The object data.
*
* @var array
*/
protected $_data = array();
/**
* The collection of parse errors (if any).
*
* @var array
*/
protected $_errors = array();
/**
* Return the driver for accessing the backend.
*
* @return Horde_Kolab_Storage_Driver The driver.
*/
protected function _getDriver()
{
if ($this->_driver === null) {
throw new Horde_Kolab_Storage_Object_Exception(
'The driver has not been set!'
);
}
return $this->_driver;
}
/**
* Set the driver for accessing the backend.
*
* @param Horde_Kolab_Storage_Driver $driver The driver.
*/
public function setDriver(Horde_Kolab_Storage_Driver $driver)
{
$this->_driver = $driver;
}
protected function _getFolder()
{
if (empty($this->_folder)) {
throw new Horde_Kolab_Storage_Object_Exception(
'The folder containing the object has been left unspecified!'
);
}
return $this->_folder;
}
/**
* @since Horde_Kolab_Storage 2.1.0
*/
public function getBackendId()
{
if (empty($this->_backend_id)) {
throw new Horde_Kolab_Storage_Object_Exception(
'The message containing the object has been left unspecified!'
);
}
return $this->_backend_id;
}
protected function _getMimePartId()
{
if (empty($this->_mime_part_id)) {
throw new Horde_Kolab_Storage_Object_Exception(
'There is no indication which message part might contain the object data!'
);
}
return $this->_mime_part_id;
}
/**
* Return the object type.
*
* @return string The object type.
*/
public function getType()
{
return $this->_type;
}
/**
* Return the MIME headers of the object envelope.
*
* @return Horde_Mime_Headers The MIME headers.
*/
public function getHeaders()
{
if ($this->_headers === null) {
$this->_headers = $this->_getDriver()->fetchHeaders(
$this->_getFolder(),
$this->getBackendId()
);
}
return $this->_headers;
}
/**
* Set the content representing the object data.
*
* @param resource $content The object content.
*/
public function setContent($content)
{
$this->_content = $content;
}
/**
* Fetch the raw content representing the object data.
*
* @return resource The raw object content.
*/
public function getContent()
{
if ($this->_content === null) {
$this->_content = $this->_getDriver()->fetchBodypart(
$this->_getFolder(),
$this->getBackendId(),
$this->_getMimePartId()
);
}
return $this->_content;
}
/**
* Return the current content value representing the object data. This call
* does not attempt to fetch the content from the backend.
*
* @return resource The raw object content.
*/
public function getCurrentContent()
{
return $this->_content;
}
/**
* Set the object data.
*
* @param array $data The object data.
*/
public function setData(array $data)
{
$this->_data = $data;
if (!isset($this->_data['uid'])) {
$this->getUid();
}
}
/**
* Fetch the object data.
*
* @return array The object data.
*/
public function getData()
{
return $this->_data;
}
/**
* Return the UID of the object. If no UID has been set a valid UID will be
* autogenerated.
*
* @return string The object UID.
*/
public function getUid()
{
if (!isset($this->_data['uid'])) {
$this->_data['uid'] = $this->generateUid();
}
return $this->_data['uid'];
}
/**
* Generate a unique object ID.
*
* @return string The unique ID.
*/
public function generateUid()
{
return strval(new Horde_Support_Uuid());
}
protected function addParseError($error, $message = '')
{
$this->_errors[$error] = $message;
}
public function getParseErrors()
{
return $this->_errors;
}
public function hasParseErrors()
{
return !empty($this->_errors);
}
/**
* Create a new object in the backend.
*
* @param Horde_Kolab_Storage_Folder $folder The folder to retrieve the
* data object from.
* @param Horde_Kolab_Storage_Object_Writer $data The data writer.
* @param string $type The type of object to be stored.
*
* @return boolean|string The return value of the append operation.
*/
public function create(Horde_Kolab_Storage_Folder $folder,
Horde_Kolab_Storage_Object_Writer $data,
$type)
{
$this->_folder = $folder->getPath();
$this->_type = $type;
$envelope = $this->createEnvelope();
$envelope->addPart($this->createFreshKolabPart($data->save($this)));
if (isset($this['_attachments'])) {
foreach ($this['_attachments'] as $name => $attachment) {
$part = new Horde_Mime_Part();
$part->setType($attachment['type']);
$part->setContents($attachment['content']);
$part->setName($name);
$envelope->addPart($part);
}
}
$envelope->buildMimeIds();
$this->_mime_part_id = Horde_Kolab_Storage_Object_MimeType::matchMimePartToObjectType(
$envelope, $this->getType()
);
return $this->_appendMessage($envelope, $this->createEnvelopeHeaders());
}
/**
* Loads the object from the backend.
*
* @param string $backend_id The object ID within the
* backend.
* @param Horde_Kolab_Storage_Folder $folder The folder to retrieve
* the data object from.
* @param Horde_Kolab_Storage_Object_Writer $data The data parser.
* @param Horde_Mime_Part $structure The MIME message
* structure of the object.
*/
public function load($backend_id,
Horde_Kolab_Storage_Folder $folder,
Horde_Kolab_Storage_Object_Writer $data,
Horde_Mime_Part $structure = null)
{
$this->_folder = $folder->getPath();
$this->_backend_id = $backend_id;
$result = Horde_Kolab_Storage_Object_MimeType::matchMimePartToFolderType(
$structure, $folder->getType()
);
/* No object content matching the folder type: Try fetching the header
* and look for a Kolab type deviating from the folder type. */
if ($result === false || $result[0] === false) {
$result = Horde_Kolab_Storage_Object_MimeType::matchMimePartToHeaderType(
$structure,
$this->getHeaders()
);
/* Seems to have no Kolab data part: mark invalid. */
if ($result === false || $result[0] === false) {
$this->_type = self::TYPE_INVALID;
$this->addParseError(self::ERROR_MISSING_KOLAB_PART);
return;
}
}
$this->_type = $result[1];
$mime_part = $structure->getPart($result[0]);
if (empty($mime_part)) {
$this->_type = self::TYPE_INVALID;
$this->addParseError(self::ERROR_MISSING_KOLAB_PART);
return;
}
$this->_mime_part_id = $result[0];
$mime_part->setContents($this->getContent(), array('encoding' => '8bit'));
$result = $data->load($mime_part->getContents(array('stream' => true)), $this);
if ($result instanceof Exception) {
$this->addParseError(self::ERROR_INVALID_KOLAB_PART, $result->getMessage());
} else {
foreach ($structure->getParts() as $part) {
if ($part->getMimeId() == $this->_mime_part_id ||
!$part->getName()) {
continue;
}
$this->_data['_attachments'][$part->getName()] = array(
'type' => $part->getType(),
'content' => $this->_getDriver()->fetchBodypart(
$this->_getFolder(),
$this->getBackendId(),
$part->getMimeId()
)
);
}
}
$this->_structure = $structure;
}
/**
* Store the modified object in the backend.
*
* @param Horde_Kolab_Storage_Folder $folder The folder to retrieve the
* data object from.
* @param Horde_Kolab_Storage_Object_Writer $data The data writer.
* @param Horde_Mime_Part $structure The MIME message structure of the object.
*
* @return boolean|string The return value of the append operation.
* @throws Horde_Kolab_Storage_Object_Exception
*/
public function save(Horde_Kolab_Storage_Object_Writer $data)
{
list($headers, $body) = $this->_getDriver()->fetchComplete(
$this->_getFolder(), $this->getBackendId()
);
$mime_id = Horde_Kolab_Storage_Object_MimeType::matchMimePartToObjectType(
$body, $this->getType()
);
if ($mime_id === false) {
throw new Horde_Kolab_Storage_Object_Exception(
sprintf(
'Missing expected mime type (%s) in object "%s" in folder "%s"!',
Horde_Kolab_Storage_Object_MimeType::getMimeTypeFromObjectType($this->getType()),
$this->getBackendId(),
$this->_getFolder()
)
);
}
$this->_content = $body->getPart($mime_id)->getContents(array('stream' => true));
$body->alterPart($mime_id, $this->createFreshKolabPart($data->save($this)));
$body->buildMimeIds();
// Update attachments.
if (isset($this['_attachments'])) {
foreach ($this['_attachments'] as $name => $attachment) {
foreach ($body->getParts() as $part) {
if ($part->getName() === $name) {
$body->removePart($part->getMimeId());
break;
}
}
if (!is_null($attachment)) {
$part = new Horde_Mime_Part();
$part->setType($attachment['type']);
$part->setContents($attachment['content']);
$part->setName($name);
$body->addPart($part);
}
$body->buildMimeIds();
}
}
$this->_mime_part_id = Horde_Kolab_Storage_Object_MimeType::matchMimePartToObjectType(
$body, $this->getType()
);
$old_uid = $this->getBackendId();
// Save message.
$result = $this->_appendMessage($body, $headers);
$this->_getDriver()->deleteMessages($this->_getFolder(), array($old_uid));
$this->_getDriver()->expunge($this->_getFolder());
return $result;
}
/**
* Append a new message.
*
* @param Horde_Mime_Part $message The message.
* @param Horde_Mime_Headers $headers The message headers.
*
* @return boolean|string The return value of the append operation.
* @throws Horde_Kolab_Storage_Object_Exception
*/
protected function _appendMessage(Horde_Mime_Part $message,
Horde_Mime_Headers $headers)
{
$result = $this->_getDriver()->appendMessage(
$this->_getFolder(),
$message->toString(
array(
'canonical' => true,
'stream' => true,
'headers' => $headers
)
)
);
if (is_object($result) || $result === false || $result === null) {
throw new Horde_Kolab_Storage_Object_Exception(
sprintf(
'Unexpected return value (%s) when creating an object in folder "%s"!',
print_r($result, true), $this->_getFolder()
)
);
}
if ($result !== true) {
$this->_backend_id = $result;
}
return $result;
}
/**
* Generates a new MIME messages that will wrap a Kolab groupware object.
*
* @return Horde_Mime_Part The new MIME message.
*/
protected function createEnvelope()
{
$envelope = new Horde_Mime_Part();
$envelope->setName('Kolab Groupware Data');
$envelope->setType('multipart/mixed');
$description = new Horde_Mime_Part();
$description->setName('Kolab Groupware Information');
$description->setType('text/plain');
$description->setDisposition('inline');
$description->setCharset('utf-8');
$description->setContents(
sprintf(
Horde_Kolab_Storage_Translation::t(
"This is a Kolab Groupware object. To view this object you will need an email client that understands the Kolab Groupware format. For a list of such email clients please visit %s"
),
'http://www.kolab.org/content/kolab-clients'
),
array('encoding' => 'quoted-printable')
);
$envelope->addPart($description);
return $envelope;
}
/**
* Generate the headers for the MIME envelope of a Kolab groupware object.
*
* @param string $user The current user.
*
* @return Horde_Mime_Headers The headers for the MIME envelope.
*/
protected function createEnvelopeHeaders()
{
$headers = new Horde_Mime_Headers();
$headers->setEOL("\r\n");
$headers->addHeader('From', $this->_getDriver()->getAuth());
$headers->addHeader('To', $this->_getDriver()->getAuth());
$headers->addHeader('Date', date('r'));
$headers->addHeader('Subject', $this->getUid());
$headers->addHeader('User-Agent', 'Horde_Kolab_Storage ' . Horde_Kolab_Storage::VERSION);
$headers->addHeader('MIME-Version', '1.0');
$headers->addHeader(
'X-Kolab-Type',
Horde_Kolab_Storage_Object_MimeType::getMimeTypeFromObjectType($this->getType())
);
return $headers;
}
/**
* Embed the Kolab content into a new MIME Part.
*
* @param resource $content The Kolab content.
*
* @return Horde_Mime_Part The MIME part that encapsules the Kolab content.
*/
protected function createFreshKolabPart($content)
{
$part = new Horde_Mime_Part();
$part->setCharset('utf-8');
$part->setDisposition('inline');
$part->setDispositionParameter('x-kolab-type', 'xml');
$part->setName('kolab.xml');
$part->setType(
Horde_Kolab_Storage_Object_MimeType::getMimeTypeFromObjectType($this->getType())
);
$part->setContents(
$content, array('encoding' => 'quoted-printable')
);
return $part;
}
/* ArrayAccess methods. */
public function offsetExists($offset)
{
return isset($this->_data[$offset]);
}
public function offsetGet($offset)
{
return isset($this->_data[$offset]) ? $this->_data[$offset] : '';
}
public function offsetSet($offset, $value)
{
$this->_data[$offset] = $value;
}
public function offsetUnset($offset)
{
unset($this->_data[$offset]);
}
/* Serializable methods. */
/**
* Serialization.
*
* @return string Serialized data.
*/
public function serialize()
{
return serialize(
array(
self::SERIALIZATION_DATA => $this->_data,
self::SERIALIZATION_ERRORS => $this->_errors,
self::SERIALIZATION_TYPE => $this->_type,
self::SERIALIZATION_FOLDER => $this->_folder,
self::SERIALIZATION_BACKENDID => $this->_backend_id,
self::SERIALIZATION_MIMEPARTID => $this->_mime_part_id,
)
);
}
/**
* Unserialization.
*
* @param string $data Serialized data.
*
* @throws Horde_Kolab_Storage_Object_Exception
*/
public function unserialize($data)
{
$data = @unserialize($data);
if (!is_array($data)) {
throw new Horde_Kolab_Storage_Object_Exception('Cache data invalid');
}
if (isset($data[self::SERIALIZATION_DATA])) {
$this->_data = $data[self::SERIALIZATION_DATA];
}
if (isset($data[self::SERIALIZATION_ERRORS])) {
$this->_errors = $data[self::SERIALIZATION_ERRORS];
}
if (isset($data[self::SERIALIZATION_TYPE])) {
$this->_type = $data[self::SERIALIZATION_TYPE];
}
if (isset($data[self::SERIALIZATION_FOLDER])) {
$this->_folder = $data[self::SERIALIZATION_FOLDER];
}
if (isset($data[self::SERIALIZATION_BACKENDID])) {
$this->_backend_id = $data[self::SERIALIZATION_BACKENDID];
}
if (isset($data[self::SERIALIZATION_MIMEPARTID])) {
$this->_mime_part_id = $data[self::SERIALIZATION_MIMEPARTID];
}
}
} Horde_Kolab_Storage-2.2.3/lib/Horde/Kolab/Storage/Queriable.php 0000664 0000765 0000024 00000002652 13025022224 021155 0 ustar
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
/**
* Marks a queriable class.
*
* Copyright 2010-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Kolab
* @package Kolab_Storage
* @author Gunnar Wrobel
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
interface Horde_Kolab_Storage_Queriable
{
/**
* Register a query to be updated if the underlying data changes.
*
* @param string $name The query name.
* @param Horde_Kolab_Storage_Query $query The query to register.
*/
public function registerQuery($name, Horde_Kolab_Storage_Query $query);
/**
* Return a registered query.
*
* @param string $name The query name.
*
* @return Horde_Kolab_Storage_Query The requested query.
*
* @throws Horde_Kolab_Storage_Exception In case the requested query does
* not exist.
*/
public function getQuery($name = null);
}
Horde_Kolab_Storage-2.2.3/lib/Horde/Kolab/Storage/Query.php 0000664 0000765 0000024 00000002406 13025022224 020346 0 ustar
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
/**
* Represents a query.
*
* Copyright 2010-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Kolab
* @package Kolab_Storage
* @author Gunnar Wrobel
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
interface Horde_Kolab_Storage_Query
{
/**
* Synchronize the query data with the information from the backend.
*
* @param array $params Additional parameters may contain:
* - current_sync: (integer) Timestamp of the current sync.
* - last_sync: (integer) Timestamp containing the time of last sync.
* - changes: (array) An array of arrays keyed by backend id
* containing information about each change.
*/
public function synchronize($params = array());
}
Horde_Kolab_Storage-2.2.3/lib/Horde/Kolab/Storage/QuerySet.php 0000664 0000765 0000024 00000001440 13025022224 021017 0 ustar
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
/**
* Represents a set of queries.
*
* Copyright 2011-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Kolab
* @package Kolab_Storage
* @author Gunnar Wrobel
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
interface Horde_Kolab_Storage_QuerySet
{
}
Horde_Kolab_Storage-2.2.3/lib/Horde/Kolab/Storage/Synchronization.php 0000664 0000765 0000024 00000003776 13025022224 022455 0 ustar
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
/**
* Handles synchronization with the backend.
*
* Copyright 2011-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Kolab
* @package Kolab_Storage
* @author Gunnar Wrobel
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
class Horde_Kolab_Storage_Synchronization
{
/**
* Synchronization strategy.
*
* @var Horde_Kolab_Storage_Synchronization
*/
protected $_strategy;
/**
* Constructor.
*
* @param Horde_Kolab_Storage_Synchronization $strategy Optional synchronization strategy.
*/
public function __construct(Horde_Kolab_Storage_Synchronization $strategy = null)
{
if ($strategy === null) {
$this->_strategy = new Horde_Kolab_Storage_Synchronization_OncePerSession();
} else {
$this->_strategy = $strategy;
}
}
/**
* Synchronize the provided list in case the selected synchronization
* strategy requires it.
*
* @param Horde_Kolab_Storage_List $list The list to synchronize.
*/
public function synchronizeList(Horde_Kolab_Storage_List_Tools $list)
{
$this->_strategy->synchronizeList($list);
}
/**
* Synchronize the provided data in case the selected synchronization
* strategy requires it.
*
* @param Horde_Kolab_Storage_Data $data The data to synchronize.
*/
public function synchronizeData(Horde_Kolab_Storage_Data $data)
{
$this->_strategy->synchronizeData($data);
}
} Horde_Kolab_Storage-2.2.3/lib/Horde/Kolab/Storage/Translation.php 0000664 0000765 0000024 00000001445 13025022224 021541 0 ustar
* @package Kolab_Storage
*/
class Horde_Kolab_Storage_Translation extends Horde_Translation_Autodetect
{
/**
* The translation domain
*
* @var string
*/
protected static $_domain = 'Horde_Kolab_Storage';
/**
* The absolute PEAR path to the translations for the default gettext handler.
*
* @var string
*/
protected static $_pearDirectory = '@data_dir@';
}
Horde_Kolab_Storage-2.2.3/lib/Horde/Kolab/Storage/Uncached.php 0000664 0000765 0000024 00000005744 13025022224 020763 0 ustar
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
/**
* The basic handler for accessing data from Kolab storage.
*
* Copyright 2004-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Kolab
* @package Kolab_Storage
* @author Gunnar Wrobel
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
class Horde_Kolab_Storage_Uncached
extends Horde_Kolab_Storage_Base
{
/**
* Create the folder list object.
*
* @param Horde_Kolab_Storage_Driver $master The primary connection driver.
* @param Horde_Kolab_Storage_Factory $factory The factory.
*
* @return Horde_Kolab_Storage_List The handler for the list of folders
* present in the Kolab backend.
*/
protected function _createList(Horde_Kolab_Storage_Driver $master,
Horde_Kolab_Storage_Factory $factory)
{
return new Horde_Kolab_Storage_List_Base($master, $factory);
}
/**
* Return a data handler for accessing data in the specified
* folder.
*
* @param mixed $folder The name of the folder or
* an instance representing
* the folder.
* @param Horde_Kolab_Storage_Driver $master The primary connection
* driver.
* @param Horde_Kolab_Storage_Factory $factory The factory.
* @param string $object_type The type of data we want
* to access in the folder.
* @param int $data_version Format version of the
* object data.
*
* @return Horde_Kolab_Data The data object.
*/
protected function _createData($folder,
Horde_Kolab_Storage_Driver $master,
Horde_Kolab_Storage_Factory $factory,
$object_type = null,
$data_version = 1)
{
$data = new Horde_Kolab_Storage_Data_Base(
$folder,
$master,
$factory,
$object_type,
$data_version
);
if (!empty($this->_logger)) {
return new Horde_Kolab_Storage_Data_Decorator_Log(
$data, $this->_logger);
}
return $data;
}
} Horde_Kolab_Storage-2.2.3/lib/Horde/Kolab/Storage.php 0000664 0000765 0000024 00000005540 13025022224 017243 0 ustar
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
/**
* The Horde_Kolab_Storage class provides the means to access the
* Kolab server storage for groupware objects.
*
* To get access to the folder handling you would do the following:
*
*
* require_once 'Horde/Kolab/Storage.php';
* $folder = Horde_Kolab_Storage::getFolder('INBOX/Calendar');
*
*
* or (in case you are dealing with share identifications):
*
*
* require_once 'Horde/Kolab/Storage.php';
* $folder = Horde_Kolab_Storage::getShare(Auth::getAuth(), 'event');
*
*
* To access data in a share (or folder) you need to retrieve the
* corresponding data object:
*
*
* require_once 'Horde/Kolab/Storage.php';
* $folder = Horde_Kolab_Storage::getShareData(Auth::getAuth(), 'event');
*
*
* Copyright 2004-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Kolab
* @package Kolab_Storage
* @author Gunnar Wrobel
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
interface Horde_Kolab_Storage
{
/** The package version */
const VERSION = '2.2.3';
/**
* Get the folder list object.
*
* @return Horde_Kolab_Storage_List The handler for the list of folders
* present in the Kolab backend.
*/
public function getList();
/**
* Get a folder list object for a "system" user.
*
* @param string $type The type of system user.
*
* @return Horde_Kolab_Storage_List The handler for the list of folders
* present in the Kolab backend.
*/
public function getSystemList($type);
/**
* Get a folder representation.
*
* @param string $folder The folder name.
*
* @return Horde_Kolab_Storage_Folder The Kolab folder object.
*/
public function getFolder($folder);
/**
* Return a data handler for accessing data in the specified
* folder.
*
* @param string $folder The name of the folder.
* @param string $object_type The type of data we want to
* access in the folder.
* @param int $data_version Format version of the object data.
*
* @return Horde_Kolab_Storage_Data The data object.
*/
public function getData($folder, $object_type = null, $data_version = 1);
}
Horde_Kolab_Storage-2.2.3/locale/ar/LC_MESSAGES/Horde_Kolab_Storage.mo 0000664 0000765 0000024 00000000604 13025022224 022103 0 ustar $ , 8 J 9 Project-Id-Version: Horde_Kolab_Storage
Report-Msgid-Bugs-To: dev@lists.horde.org
POT-Creation-Date: 2010-10-13 01:27+0200
PO-Revision-Date: 2010-10-13 01:27+0200
Last-Translator: Automatically generated
Language-Team: i18n@lists.horde.org
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Horde_Kolab_Storage-2.2.3/locale/ar/LC_MESSAGES/Horde_Kolab_Storage.po 0000664 0000765 0000024 00000004133 13025022224 022107 0 ustar # Arabic translations for Horde_Kolab_Storage module.
# Copyright 2010-2016 Horde LLC (http://www.horde.org/)
# This file is distributed under the same license as the Horde_Kolab_Storage module.
# Automatically generated, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: Horde_Kolab_Storage\n"
"Report-Msgid-Bugs-To: dev@lists.horde.org\n"
"POT-Creation-Date: 2010-10-13 01:27+0200\n"
"PO-Revision-Date: 2010-10-13 01:27+0200\n"
"Last-Translator: Automatically generated\n"
"Language-Team: i18n@lists.horde.org\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: lib/Horde/Kolab/Storage/Folder/Base.php:993
#: lib/Horde/Kolab/Storage/Folder/Base.php:999
#, php-format
msgid "Failed retrieving the message with ID %s. Original error: %s."
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Decorator/Trigger.php:228
#, php-format
msgid "Failed triggering folder %s. Error was: %s"
msgstr ""
#: lib/Horde/Kolab/Storage/Data.php:630
#, php-format
msgid "Kolab cache: Object uid %s does not exist in the cache!"
msgstr ""
#: lib/Horde/Kolab/Storage/Data.php:315
#, fuzzy, php-format
msgid "Old object %s does not exist."
msgstr "إن ملفات PO للغة %s غير موجودة"
#: lib/Horde/Kolab/Storage/Data.php:322
#, php-format
msgid "Old object %s does not map to a uid."
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Base.php:832
#, php-format
msgid ""
"The message with ID %s does not exist. This probably means that the Kolab "
"object has been modified by somebody else while you were editing it. Your "
"edits have been lost."
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Base.php:1054
#, php-format
msgid ""
"This is a Kolab Groupware object. To view this object you will need an email "
"client that understands the Kolab Groupware format. For a list of such email "
"clients please visit %s"
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Base.php:391
#, php-format
msgid "Unable to rename %s to %s: destination folder already exists"
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Decorator/Trigger.php:261
#, php-format
msgid "Unable to trigger URL %s. Response: %s"
msgstr ""
Horde_Kolab_Storage-2.2.3/locale/bg/LC_MESSAGES/Horde_Kolab_Storage.mo 0000664 0000765 0000024 00000000604 13025022224 022071 0 ustar $ , 8 J 9 Project-Id-Version: Horde_Kolab_Storage
Report-Msgid-Bugs-To: dev@lists.horde.org
POT-Creation-Date: 2010-10-13 01:27+0200
PO-Revision-Date: 2010-10-13 01:27+0200
Last-Translator: Automatically generated
Language-Team: i18n@lists.horde.org
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Horde_Kolab_Storage-2.2.3/locale/bg/LC_MESSAGES/Horde_Kolab_Storage.po 0000664 0000765 0000024 00000004167 13025022224 022104 0 ustar # Bulgarian translations for Horde_Kolab_Storage module.
# Copyright 2010-2016 Horde LLC (http://www.horde.org/)
# This file is distributed under the same license as the Horde_Kolab_Storage module.
# Automatically generated, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: Horde_Kolab_Storage\n"
"Report-Msgid-Bugs-To: dev@lists.horde.org\n"
"POT-Creation-Date: 2010-10-13 01:27+0200\n"
"PO-Revision-Date: 2010-10-13 01:27+0200\n"
"Last-Translator: Automatically generated\n"
"Language-Team: i18n@lists.horde.org\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: lib/Horde/Kolab/Storage/Folder/Base.php:993
#: lib/Horde/Kolab/Storage/Folder/Base.php:999
#, php-format
msgid "Failed retrieving the message with ID %s. Original error: %s."
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Decorator/Trigger.php:228
#, php-format
msgid "Failed triggering folder %s. Error was: %s"
msgstr ""
#: lib/Horde/Kolab/Storage/Data.php:630
#, php-format
msgid "Kolab cache: Object uid %s does not exist in the cache!"
msgstr ""
#: lib/Horde/Kolab/Storage/Data.php:315
#, fuzzy, php-format
msgid "Old object %s does not exist."
msgstr "Horde PO файл за локализация %s не съществува:"
#: lib/Horde/Kolab/Storage/Data.php:322
#, php-format
msgid "Old object %s does not map to a uid."
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Base.php:832
#, php-format
msgid ""
"The message with ID %s does not exist. This probably means that the Kolab "
"object has been modified by somebody else while you were editing it. Your "
"edits have been lost."
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Base.php:1054
#, php-format
msgid ""
"This is a Kolab Groupware object. To view this object you will need an email "
"client that understands the Kolab Groupware format. For a list of such email "
"clients please visit %s"
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Base.php:391
#, php-format
msgid "Unable to rename %s to %s: destination folder already exists"
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Decorator/Trigger.php:261
#, php-format
msgid "Unable to trigger URL %s. Response: %s"
msgstr ""
Horde_Kolab_Storage-2.2.3/locale/bs/LC_MESSAGES/Horde_Kolab_Storage.mo 0000664 0000765 0000024 00000000604 13025022224 022105 0 ustar $ , 8 J 9 Project-Id-Version: Horde_Kolab_Storage
Report-Msgid-Bugs-To: dev@lists.horde.org
POT-Creation-Date: 2010-10-13 01:27+0200
PO-Revision-Date: 2010-10-13 01:27+0200
Last-Translator: Automatically generated
Language-Team: i18n@lists.horde.org
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Horde_Kolab_Storage-2.2.3/locale/bs/LC_MESSAGES/Horde_Kolab_Storage.po 0000664 0000765 0000024 00000004043 13025022224 022111 0 ustar # Bosnian translations for Horde_Kolab_Storage module.
# Copyright 2010-2016 Horde LLC (http://www.horde.org/)
# This file is distributed under the same license as the Horde_Kolab_Storage module.
# Automatically generated, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: Horde_Kolab_Storage\n"
"Report-Msgid-Bugs-To: dev@lists.horde.org\n"
"POT-Creation-Date: 2010-10-13 01:27+0200\n"
"PO-Revision-Date: 2010-10-13 01:27+0200\n"
"Last-Translator: Automatically generated\n"
"Language-Team: i18n@lists.horde.org\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: lib/Horde/Kolab/Storage/Folder/Base.php:993
#: lib/Horde/Kolab/Storage/Folder/Base.php:999
#, php-format
msgid "Failed retrieving the message with ID %s. Original error: %s."
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Decorator/Trigger.php:228
#, php-format
msgid "Failed triggering folder %s. Error was: %s"
msgstr ""
#: lib/Horde/Kolab/Storage/Data.php:630
#, php-format
msgid "Kolab cache: Object uid %s does not exist in the cache!"
msgstr ""
#: lib/Horde/Kolab/Storage/Data.php:315
#, php-format
msgid "Old object %s does not exist."
msgstr ""
#: lib/Horde/Kolab/Storage/Data.php:322
#, php-format
msgid "Old object %s does not map to a uid."
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Base.php:832
#, php-format
msgid ""
"The message with ID %s does not exist. This probably means that the Kolab "
"object has been modified by somebody else while you were editing it. Your "
"edits have been lost."
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Base.php:1054
#, php-format
msgid ""
"This is a Kolab Groupware object. To view this object you will need an email "
"client that understands the Kolab Groupware format. For a list of such email "
"clients please visit %s"
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Base.php:391
#, php-format
msgid "Unable to rename %s to %s: destination folder already exists"
msgstr ""
#: lib/Horde/Kolab/Storage/Folder/Decorator/Trigger.php:261
#, php-format
msgid "Unable to trigger URL %s. Response: %s"
msgstr ""
Horde_Kolab_Storage-2.2.3/locale/ca/LC_MESSAGES/Horde_Kolab_Storage.mo 0000664 0000765 0000024 00000001727 13025022224 022073 0 ustar 4 L ` a <