Branch 'roundcubemail-plugins-kolab-format2-horde5' - 3 commits - plugins/libkolab
Thomas Brüderli
bruederli at kolabsys.com
Thu Nov 15 17:00:42 CET 2012
plugins/libkolab/lib/Horde_Kolab_Format_XML_configuration.php | 88 ++++------
plugins/libkolab/lib/kolab_format.php | 10 -
2 files changed, 48 insertions(+), 50 deletions(-)
New commits:
commit 7f8689813ece2df2fcc4d72c7b833e536b674e22
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Nov 15 17:00:14 2012 +0100
Add implementation for Configuration objects in Horde 5
diff --git a/plugins/libkolab/lib/Horde_Kolab_Format_XML_configuration.php b/plugins/libkolab/lib/Horde_Kolab_Format_XML_configuration.php
index c80fbd3..e9631c2 100644
--- a/plugins/libkolab/lib/Horde_Kolab_Format_XML_configuration.php
+++ b/plugins/libkolab/lib/Horde_Kolab_Format_XML_configuration.php
@@ -1,11 +1,20 @@
<?php
-
/**
- * Kolab XML handler for configuration (KEP:9).
+ * Implementation for configuration objects in the Kolab XML format (KEP:9 and KEP:16)
+ *
+ * PHP version 5
*
- * @author Aleksander Machniak <machniak at kolabsys.com>
+ * @category Kolab
+ * @package Kolab_Format
+ * @author Aleksander Machniak <machniak at kolabsys.com>
+ * @author Thomas Bruederli <bruederli at kolabsys.com>
+ * @license http://www.gnu.org/licenses/agpl-3.0.html AGPL 3
+ */
+
+/**
+ * Kolab XML handler for client preferences.
*
- * Copyright (C) 2011, Kolab Systems AG <contact at kolabsys.com>
+ * Copyright (C) 2012, Kolab Systems AG <contact at kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -19,58 +28,47 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Kolab
+ * @package Kolab_Format
+ * @author Aleksander Machniak <machniak at kolabsys.com>
+ * @author Thomas Bruederli <bruederli at kolabsys.com>
+ * @license http://www.gnu.org/licenses/agpl-3.0.html AGPL 3
*/
-class Horde_Kolab_Format_XML_configuration extends Horde_Kolab_Format_XML {
+class Horde_Kolab_Format_Xml_Configuration extends Horde_Kolab_Format_Xml
+{
/**
- * Specific data fields for the configuration object
+ * The name of the root element.
*
- * @var Kolab
+ * @var string
*/
- var $_fields_specific;
-
- var $_root_version = 2.1;
+ protected $_root_name = 'configuration';
/**
- * Constructor
+ * Specific data fields for the prefs object
+ *
+ * @var Kolab
*/
- function Horde_Kolab_Format_XML_configuration($params = array())
- {
- $this->_root_name = 'configuration';
-
- // Specific configuration fields, in kolab format specification order
- $this->_fields_specific = array(
- 'application' => array (
- 'type' => HORDE_KOLAB_XML_TYPE_STRING,
- 'value' => HORDE_KOLAB_XML_VALUE_MAYBE_MISSING,
- ),
- 'type' => array(
- 'type' => HORDE_KOLAB_XML_TYPE_STRING,
- 'value' => HORDE_KOLAB_XML_VALUE_NOT_EMPTY,
- ),
- );
+ protected $_fields_specific = array(
+ 'application' => 'Horde_Kolab_Format_Xml_Type_String_MaybeMissing',
+ 'type' => 'Horde_Kolab_Format_Xml_Type_String',
+ );
+ function __construct(
+ Horde_Kolab_Format_Xml_Parser $parser,
+ Horde_Kolab_Format_Factory $factory,
+ $params = null
+ )
+ {
// Dictionary fields
if (!empty($params['subtype']) && preg_match('/^dictionary.*/', $params['subtype'])) {
- $this->_fields_specific = array_merge($this->_fields_specific, array(
- 'language' => array (
- 'type' => HORDE_KOLAB_XML_TYPE_STRING,
- 'value' => HORDE_KOLAB_XML_VALUE_NOT_EMPTY,
- ),
- 'e' => array(
- 'type' => HORDE_KOLAB_XML_TYPE_MULTIPLE,
- 'value' => HORDE_KOLAB_XML_VALUE_NOT_EMPTY,
- 'array' => array(
- 'type' => HORDE_KOLAB_XML_TYPE_STRING,
- 'value' => HORDE_KOLAB_XML_VALUE_NOT_EMPTY,
- ),
- ),
- ));
+ $this->_fields_specific += array(
+ 'language' => 'Horde_Kolab_Format_Xml_Type_String',
+ 'e' => 'Horde_Kolab_Format_Xml_Type_Multiple_String',
+ );
}
- parent::Horde_Kolab_Format_XML($params);
-
- unset($this->_fields_basic['body']);
- unset($this->_fields_basic['categories']);
- unset($this->_fields_basic['sensitivity']);
+ parent::__construct($parser, $factory, $params);
}
}
+
commit 0d85f300873ea9f566af1356ae6fe96cb688c6e8
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Nov 15 16:59:47 2012 +0100
Save datetime values in UTC to maintain compatibility with older Kolab clients
diff --git a/plugins/libkolab/lib/kolab_format.php b/plugins/libkolab/lib/kolab_format.php
index c96b67b..438e905 100644
--- a/plugins/libkolab/lib/kolab_format.php
+++ b/plugins/libkolab/lib/kolab_format.php
@@ -97,10 +97,7 @@ abstract class kolab_format
{
// use timezone information from datetime of global setting
if (!$tz && $tz !== false) {
- if ($datetime instanceof DateTime)
- $tz = $datetime->getTimezone();
- if (!$tz)
- $tz = self::$timezone;
+ $tz = self::$timezone;
}
$result = null;
@@ -115,6 +112,9 @@ abstract class kolab_format
}
if ($datetime instanceof DateTime) {
+ // always save dates in UTC for compatibility reasons
+ if (!$dateonly && !$datetime->_dateonly && $tz !== false)
+ $datetime->setTimezone(new DateTimeZone('UTC'));
$result = array('date' => $datetime, 'date-only' => $dateonly || $datetime->_dateonly);
}
commit fb015801244a2eb0fc28aad94b768ea67f885381
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Nov 15 15:36:17 2012 +0100
Keep generated UIDs lowercase
diff --git a/plugins/libkolab/lib/kolab_format.php b/plugins/libkolab/lib/kolab_format.php
index e8967f8..c96b67b 100644
--- a/plugins/libkolab/lib/kolab_format.php
+++ b/plugins/libkolab/lib/kolab_format.php
@@ -263,7 +263,7 @@ abstract class kolab_format
protected function generate_uid()
{
$rc = rcube::get_instance();
- return strtoupper(md5(time() . uniqid(rand())) . '-' . substr(md5($rc->user ? $rc->user->get_username() : rand()), 0, 16));
+ return md5(time() . uniqid(rand())) . '-' . substr(md5($rc->user ? $rc->user->get_username() : rand()), 0, 16);
}
/**
More information about the commits
mailing list