* @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
*/
private $_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
*/
private $_driver;
/**
* Constructor.
*
* @param array $params A set of parameters.
*
* - driver : The type of backend driver. One of "mock", "php", "pear",
* "horde", "horde-socket", and "roundcube".
* - params : Backend specific connection parameters.
* - logger : An optional log handler.
* - timelog : An optional time keeping log handler.
* - format : Array
* - factory: Name of the format parser factory class.
*
*/
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
);
}
$storage = new Horde_Kolab_Storage_Decorator_Synchronization(
$storage, new Horde_Kolab_Storage_Synchronization()
);
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']
);
//$parser->setLogger($params['logger']);
}
/* if (!empty($params['ignore_parse_errors'])) { */
/* $parser->setLogger(false); */
/* } */
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_' . 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);
}
public function getDriver()
{
return $this->_driver;
}
} Horde_Kolab_Storage-2.0.5/lib/Horde/Kolab/Storage/Folder.php 0000664 0001750 0001750 00000004541 12207101545 021647 0 ustar jan jan
* @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-2013 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.0.5/lib/Horde/Kolab/Storage/Object.php 0000664 0001750 0001750 00000044261 12207101545 021645 0 ustar jan jan
* @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.
*
* Copyright 2011-2013 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_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
*/
private $_driver;
/**
* The folder that holds the object within the backend.
*
* @var string
*/
private $_folder;
/**
* The object ID within the backend.
*
* @var string
*/
private $_backend_id;
/**
* The ID of the MIME part carrying the object data.
*
* @var string
*/
private $_mime_part_id;
/**
* The object type.
*
* @var string
*/
private $_type;
/**
* The MIME headers of the object envelope.
*
* @var Horde_Mime_Headers
*/
private $_headers;
/**
* The message structure.
*
* @var Horde_Mime_Part
*/
private $_structure;
/**
* The content string representing the object data.
*
* @var resource
*/
private $_content;
/**
* The object data.
*
* @var array
*/
private $_data = array();
/**
* The collection of parse errors (if any).
*
* @var array
*/
private $_errors = array();
/**
* Return the driver for accessing the backend.
*
* @return Horde_Kolab_Storage_Driver The driver.
*/
private 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;
}
private 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;
}
private 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;
}
private 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());
}
private 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)));
$envelope->buildMimeIds();
$this->_mime_part_id = Horde_Kolab_Storage_Object_MimeType::matchMimePartToObjectType(
$envelope, $this->getType()
);
return $this->_appendMessage($envelope, $this->createEnvelopeHeaders());
}
/**
* Load 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,
$structure = null)
{
$this->_folder = $folder->getPath();
$this->_backend_id = $backend_id;
if (!$structure instanceOf Horde_Mime_Part) {
throw new Horde_Kolab_Storage_Data_Exception(
sprintf(
'The provided data is not of type Horde_Mime_Part but %s instead!',
get_class($structure)
)
);
}
$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());
$result = $data->load($mime_part->getContents(array('stream' => true)), $this);
if ($result instanceOf Exception) {
$this->addParseError(self::ERROR_INVALID_KOLAB_PART, $result->getMessage());
}
$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.
*/
public function save(Horde_Kolab_Storage_Object_Writer $data)
{
list($headers, $body) = $this->_driver->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()
)
);
}
$original = $body->getPart($mime_id);
$original->setContents(
$this->_driver->fetchBodypart($this->_getFolder(), $this->_getBackendId(), $mime_id)
);
$this->_content = $original->getContents(array('stream' => true));
$body->alterPart($mime_id, $this->createFreshKolabPart($data->save($this)));
$body->buildMimeIds();
$this->_mime_part_id = Horde_Kolab_Storage_Object_MimeType::matchMimePartToObjectType(
$body, $this->getType()
);
$old_uid = $this->_getBackendId();
$result = $this->_appendMessage($body, $headers);
$this->_driver->deleteMessages($this->_getFolder(), array($old_uid));
$this->_driver->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.
*/
private 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.
*/
private 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.
*/
private 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.
*/
private 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 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.0.5/lib/Horde/Kolab/Storage/Queriable.php 0000664 0001750 0001750 00000002705 12207101545 022345 0 ustar jan jan
* @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-2013 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.
*
* @return NULL
*/
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.0.5/lib/Horde/Kolab/Storage/Query.php 0000664 0001750 0001750 00000001755 12207101545 021545 0 ustar jan jan
* @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-2013 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.
*
* @return NULL
*/
public function synchronize($params = array());
}
Horde_Kolab_Storage-2.0.5/lib/Horde/Kolab/Storage/QuerySet.php 0000664 0001750 0001750 00000001440 12207101545 022210 0 ustar jan jan
* @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-2013 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.0.5/lib/Horde/Kolab/Storage/Synchronization.php 0000664 0001750 0001750 00000003774 12207101545 023644 0 ustar jan jan
* @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-2013 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
*/
private $_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.0.5/lib/Horde/Kolab/Storage/Translation.php 0000664 0001750 0001750 00000003330 12207101545 022725 0 ustar jan jan
* @package Kolab_Storage
*/
class Horde_Kolab_Storage_Translation extends Horde_Translation
{
/**
* Returns the translation of a message.
*
* @var string $message The string to translate.
*
* @return string The string translation, or the original string if no
* translation exists.
*/
static public function t($message)
{
self::$_domain = 'Horde_Kolab_Storage';
self::$_directory = '@data_dir@' == '@'.'data_dir'.'@' ? __DIR__ . '/../../../../locale' : '@data_dir@/Horde_Kolab_Storage/locale';
return parent::t($message);
}
/**
* Returns the plural translation of a message.
*
* @param string $singular The singular version to translate.
* @param string $plural The plural version to translate.
* @param integer $number The number that determines singular vs. plural.
*
* @return string The string translation, or the original string if no
* translation exists.
*/
static public function ngettext($singular, $plural, $number)
{
self::$_domain = 'Horde_Kolab_Storage';
self::$_directory = '@data_dir@' == '@'.'data_dir'.'@' ? __DIR__ . '/../../../../locale' : '@data_dir@/Horde_Kolab_Storage/locale';
return parent::ngettext($singular, $plural, $number);
}
}
Horde_Kolab_Storage-2.0.5/lib/Horde/Kolab/Storage/Uncached.php 0000664 0001750 0001750 00000005464 12207101545 022153 0 ustar jan jan
* @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-2013 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)
{
return new Horde_Kolab_Storage_Data_Base(
$folder,
$master,
$factory,
$object_type,
$data_version
);
}
} Horde_Kolab_Storage-2.0.5/lib/Horde/Kolab/Storage.php 0000664 0001750 0001750 00000005540 12207101545 020434 0 ustar jan jan
* @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-2013 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.0.5';
/**
* 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.0.5/locale/ar/LC_MESSAGES/Horde_Kolab_Storage.mo 0000644 0001750 0001750 00000000604 12207101545 023272 0 ustar jan jan $ , 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.0.5/locale/ar/LC_MESSAGES/Horde_Kolab_Storage.po 0000664 0001750 0001750 00000004133 12207101545 023300 0 ustar jan jan # Arabic translations for Horde_Kolab_Storage module.
# Copyright 2010-2013 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.0.5/locale/bg/LC_MESSAGES/Horde_Kolab_Storage.mo 0000644 0001750 0001750 00000000604 12207101545 023260 0 ustar jan jan $ , 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.0.5/locale/bg/LC_MESSAGES/Horde_Kolab_Storage.po 0000664 0001750 0001750 00000004167 12207101545 023275 0 ustar jan jan # Bulgarian translations for Horde_Kolab_Storage module.
# Copyright 2010-2013 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.0.5/locale/bs/LC_MESSAGES/Horde_Kolab_Storage.mo 0000644 0001750 0001750 00000000604 12207101545 023274 0 ustar jan jan $ , 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.0.5/locale/bs/LC_MESSAGES/Horde_Kolab_Storage.po 0000664 0001750 0001750 00000004043 12207101545 023302 0 ustar jan jan # Bosnian translations for Horde_Kolab_Storage module.
# Copyright 2010-2013 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.0.5/locale/ca/LC_MESSAGES/Horde_Kolab_Storage.mo 0000644 0001750 0001750 00000001727 12207101545 023262 0 ustar jan jan 4 L ` a <