Projects
Kolab:16
kolab-syncroton-old
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
kolab-syncroton.spec
Changed
@@ -34,10 +34,9 @@ %endif %global _ap_sysconfdir %{_sysconfdir}/%{httpd_name} -%global upstream_version 2.4.2 Name: kolab-syncroton -Version: 2.4.2.16 +Version: 2.3.22 Release: 1%{?dist} Summary: ActiveSync for Kolab Groupware @@ -45,32 +44,49 @@ License: LGPLv2 URL: http://www.syncroton.org -Source0: %{name}-%{upstream_version}.tar.gz +Source0: https://mirror.kolabenterprise.com/pub/releases/%{name}-%{version}.tar.gz Source1: kolab-syncroton.logrotate Source2: plesk.kolab_syncroton.inc.php +Patch0: 0002-Report-INVALID_SOURCE-if-the-move-fails.patch BuildArch: noarch +# Use this build requirement to make sure we are using +# up to date vendorized copies of the plugins. +%if 0%{?plesk} < 1 +BuildRequires: roundcubemail-plugin-kolab_auth >= 3.2 +%endif +BuildRequires: roundcubemail-plugin-kolab_folders >= 3.2 +BuildRequires: roundcubemail-plugin-libcalendaring >= 3.2 +BuildRequires: roundcubemail-plugin-libkolab >= 3.2 + %if 0%{?rhel} < 8 %if 0%{?suse_version} BuildRequires: roundcubemail Requires: php Requires: php-pear-Auth_SASL Requires: php-pear-MDB2_Driver_mysqli +Requires: php-pear-Net_IDNA2 Requires: php-pear-Net_SMTP Requires: php-pear-Net_Socket %else -BuildRequires: roundcubemail >= 1.5 Requires: php-common >= 5.3 Requires: php-pear-Auth-SASL Requires: php-pear-MDB2-Driver-mysqli +Requires: php-pear-Net-IDNA2 Requires: php-pear-Net-SMTP Requires: php-pear-Net-Socket %endif %endif -Requires: roundcubemail Requires: logrotate +Requires: roundcubemail(core) +%if 0%{?plesk} < 1 +Requires: roundcubemail-plugin-kolab_auth >= 3.2 +%endif +Requires: roundcubemail-plugin-kolab_folders >= 3.2 +Requires: roundcubemail-plugin-libcalendaring >= 3.2 +Requires: roundcubemail-plugin-libkolab >= 3.2 %if 0%{?rhel} < 8 Requires: php-kolabformat Requires: php-pear-MDB2 @@ -83,8 +99,8 @@ and Tasks though this package - based on Syncroton technology. %prep -%setup -q -n %{name}-%{upstream_version} -#%patch0 -p1 +%setup -q -n %{name}-%{version} +%patch0 -p1 %build @@ -172,12 +188,8 @@ fi fi -if -f "/usr/lib/systemd/system/php-fpm.service" ; then - /bin/systemctl reload php-fpm.service || : -fi - /usr/share/roundcubemail/bin/updatedb.sh \ - --dir /usr/share/doc/kolab-syncroton/SQL/ \ + --dir /usr/share/doc/kolab-syncroton-%{version}/SQL/ \ --package syncroton \ >/dev/null 2>&1 || : @@ -198,15 +210,6 @@ %attr(0770,%{httpd_user},%{httpd_group}) %{_var}/log/%{name} %changelog -* Thu Jul 27 2023 Christian Mollekopf <mollekopf@apheleia-it.ch> - 2.4.2-1 -- Release version 2.4.2 - -* Mon Jul 17 2023 Christian Mollekopf <mollekopf@apheleia-it.ch> - 2.4.1-1 -- Release version 2.4.1 - -* Wed May 10 2023 Christian Mollekopf <mollekopf@apheleia-it.ch> - 2.4.0-1 -- Release version 2.4.0 - * Fri Feb 04 2022 Jeroen van Meeuwen <vanmeeuwen@apheleia-it.ch> - 2.3.22-1 - Release version 2.3.22
View file
0002-Report-INVALID_SOURCE-if-the-move-fails.patch
Added
@@ -0,0 +1,36 @@ +From 0a8e797ea62be331a2530440e45cc1c9edc786ee Mon Sep 17 00:00:00 2001 +From: Christian Mollekopf <mollekopf@apheleia-it.ch> +Date: Tue, 30 Aug 2022 16:21:45 +0200 +Subject: PATCH 2/2 Report INVALID_SOURCE if the move fails + +A nonexistent source message is at least one reason for the failure, +and returning SUCCESS without a destination msgid is clearly not +correct. +May fix an iphone issue where it keeps sending the same move command +over and over. +--- + lib/ext/Syncroton/Command/MoveItems.php | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/lib/ext/Syncroton/Command/MoveItems.php b/lib/ext/Syncroton/Command/MoveItems.php +index 73e57dd..3f89b34 100644 +--- a/lib/ext/Syncroton/Command/MoveItems.php ++++ b/lib/ext/Syncroton/Command/MoveItems.php +@@ -79,9 +79,12 @@ class Syncroton_Command_MoveItems extends Syncroton_Command_Wbxml + $dataController = Syncroton_Data_Factory::factory($sourceFolder->class, $this->_device, $this->_syncTimeStamp); + $newId = $dataController->moveItem($move'srcFldId', $move'srcMsgId', $move'dstFldId'); + ++ if (!$newId) { ++ throw new Syncroton_Exception_Status_MoveItems(Syncroton_Exception_Status_MoveItems::INVALID_SOURCE); ++ } ++ + $response->appendChild($this->_outputDom->createElementNS('uri:Move', 'Status', Syncroton_Command_MoveItems::STATUS_SUCCESS)); +- if ($newId) +- $response->appendChild($this->_outputDom->createElementNS('uri:Move', 'DstMsgId', $newId)); ++ $response->appendChild($this->_outputDom->createElementNS('uri:Move', 'DstMsgId', $newId)); + } catch (Syncroton_Exception_Status $e) { + $response->appendChild($this->_outputDom->createElementNS('uri:Move', 'Status', $e->getCode())); + } catch (Exception $e) { +-- +2.37.1 +
View file
buildtarball.sh
Deleted
@@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -VERSION=2.4.2 -GIT_REF=master -NAME=kolab-syncroton-$VERSION - -ROOT_DIR=$(pwd) - -rm -Rf /tmp/$NAME -mkdir /tmp/$NAME -cd /tmp/$NAME - -rm -f $NAME.tar.gz - -d "$NAME" && rm -rf "$NAME" -git clone --branch master ssh://git@git.kolab.org/diffusion/S/syncroton.git $NAME -pushd $NAME -git reset --hard $GIT_REF -git archive --prefix=$NAME/ -o "$ROOT_DIR/$NAME.tar.gz" HEAD - -cd "$PWD"
View file
debian.changelog
Changed
@@ -1,33 +1,3 @@ -kolab-syncroton (2.4.2.16-0~kolab1) unstable; urgency=low - - * Release version 2.4.2 - - -- Christian Mollekopf <mollekopf@apheleia-it.ch> Thu, 27 July 2023 15:13:40 +0200 - -kolab-syncroton (2.4.1-0~kolab1) unstable; urgency=low - - * Release version 2.4.1 - - -- Christian Mollekopf <mollekopf@apheleia-it.ch> Mon, 17 July 2023 15:13:40 +0200 - -kolab-syncroton (2.4.0-0~kolab1) unstable; urgency=low - - * Release version 2.4.0 - - -- Christian Mollekopf <mollekopf@apheleia-it.ch> Wed, 10 May 2023 15:13:40 +0200 - -kolab-syncroton (2.3.23-0~kolab1) unstable; urgency=low - - * Release version 2.3.23 - - -- Christian Mollekopf <mollekopf@apheleia-it.ch> Wed, 19 Apr 2023 15:13:40 +0200 - -kolab-syncroton (2.3.22-1~kolab1) unstable; urgency=low - - * Fixed timezone issue - - -- Christian Mollekopf <mollekopf@apheleia-it.ch> Mon, 19 Dec 2022 15:13:40 +0200 - kolab-syncroton (2.3.22-0~kolab1) unstable; urgency=low * Release version 2.3.22
View file
debian.control
Changed
@@ -10,7 +10,19 @@ Package: kolab-syncroton Architecture: all -Depends: roundcubemail-core, +Depends: php-auth-sasl, + php-mail-mime, + php-mdb2 (>= 2.5.0), + php-net-idna2, + php-net-smtp, + php-net-socket, + php-cli | php5-cli, + php-mysql | php5-mysql, + roundcubemail-core, + roundcubemail-plugin-kolab-folders (>= 3.1.12), + roundcubemail-plugin-libcalendaring (>= 3.1.12), + roundcubemail-plugin-libkolab (>= 3.1.12), + zendframework | zend-framework, ${misc:Depends} Description: ActiveSync for Kolab Groupware Kolab Groupware provides ActiveSync for Calendars,
View file
kolab-syncroton-2.4.2.tar.gz/README.md -> kolab-syncroton-2.3.22.tar.gz/README.md
Changed
@@ -41,33 +41,5 @@ package as document root as well as the /Microsoft-Server-ActiveSync alias. See docs/kolab-syncroton.conf for an example Apache config. - -FOR DEVELOPERS (TESTING) -======================== - -Steps 1-5 from the installation procedure need to be done. - -To check code quality run: `vendor/bin/phpstan analyse` - -To check code style run: `vendor/bin/php-cs-fixer fix --dry-run --diff --verbose` - -To run the Unit test suite goto `tests/` and run `../vendor/bin/phpunit --testsuite=Unit` - -To run the integration tests you have to follow these steps: - -1. Prepare a test account on the Kolab server and add this to config/config.inc.php: -``` -$config'activesync_test_username' = 'user@domain.tld'; -$config'activesync_test_password' = 'password'; -``` - - Don't forget to configure also `imap_host`, `activesync_dav_server` and `activesync_storage`. - All other options should use the default values. - -2. Start the syncroton server: `php -S localhost:8000` - -3. Goto `tests/` and run `../vendor/bin/phpunit --testsuite=Sync` - - 1: http://getcomposer.org 2: https://github.com/roundcube/roundcubemail/blob/master/program/lib/Roundcube/README.md)
View file
kolab-syncroton-2.4.2.tar.gz/composer.json-dist -> kolab-syncroton-2.3.22.tar.gz/composer.json-dist
Changed
@@ -2,28 +2,27 @@ "name": "kolab/syncroton", "description": "The ActiveSync Service for Kolab", "license": "AGPL-3.0+", + "repositories": + { + "type": "vcs", + "url": "https://git.kolab.org/diffusion/PNL/php-net_ldap.git" + } + , "require": { - "php": ">=7.2.0", - "kolab/net_ldap3": "dev-master", + "php": ">=5.4.0", "pear/pear-core-minimal": "~1.10.1", "pear/net_socket": "~1.2.1", "pear/auth_sasl": "~1.1.0", - "pear/http_request2": "~2.5.0", "pear/net_idna2": "~0.2.0", "pear/mail_mime": "~1.10.0", "pear/net_smtp": "~1.7.1", "pear/net_ldap2": "~2.2.0", "pear/net_sieve": "~1.4.0", - "roundcube/rtf-html-php": "~2.1", - "sabre/vobject": "~4.5.1", - "zf1s/zend-controller": "~1.12.20", + "kolab/net_ldap3": "dev-master", "zf1s/zend-json": "~1.12.20", "zf1s/zend-log": "~1.12.20" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.0", - "guzzlehttp/guzzle": "^7.3.0", - "phpstan/phpstan": "^1.2", - "phpunit/phpunit": "^8 || ^9" + "phpunit/phpunit": "^4.8 || ^5.7 || ^6 || ^7" } }
View file
kolab-syncroton-2.4.2.tar.gz/config/config.inc.php.dist -> kolab-syncroton-2.3.22.tar.gz/config/config.inc.php.dist
Changed
@@ -27,7 +27,7 @@ // List of global addressbooks (GAL) // Note: If empty 'autocomplete_addressbooks' setting will be used -$config'activesync_addressbooks' = ; +$config'activesync_addressbooks' = array(); // ActiveSync => Roundcube contact fields map for GAL search /* Default: array( @@ -67,10 +67,10 @@ // List of Roundcube plugins // WARNING: Not all plugins used in Roundcube can be listed here -$config'activesync_plugins' = +$config'activesync_plugins' = array( 'libcalendaring', - 'libkolab', -; + 'libkolab' +); // Defines for how many seconds we'll sleep between every // action for detecting changes in folders. Default: 60 @@ -106,7 +106,7 @@ // When set to an array folder hierarchies are used on all devices not listed here. // When set to null an old whitelist approach will be used where we do opposite // action and enable folder hierarchies only on device types known to support it. -$config'activesync_multifolder_blacklist' = ; +$config'activesync_multifolder_blacklist' = array(); // Blacklist overwrites for specified object type. If set to an array // it will have a precedence over 'activesync_multifolder_blacklist' list only for that type. @@ -114,7 +114,7 @@ // in that case use $config'activesync_multifolder_blacklist_contact' = array('windowsoutlook'); $config'activesync_multifolder_blacklist_mail' = null; $config'activesync_multifolder_blacklist_event' = null; -$config'activesync_multifolder_blacklist_contact' = 'windowsoutlook'; +$config'activesync_multifolder_blacklist_contact' = array('windowsoutlook'); $config'activesync_multifolder_blacklist_note' = null; $config'activesync_multifolder_blacklist_task' = null;
View file
kolab-syncroton-2.4.2.tar.gz/docs/SQL/mysql.initial.sql -> kolab-syncroton-2.3.22.tar.gz/docs/SQL/mysql.initial.sql
Changed
@@ -59,8 +59,6 @@ `counter` int(11) NOT NULL DEFAULT '0', `lastsync` datetime DEFAULT NULL, `pendingdata` longblob, - `client_id_map` longblob DEFAULT NULL, - `extra_data` longblob DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `device_id--type--counter` (`device_id`,`type`,`counter`), CONSTRAINT `syncroton_synckey::device_id--syncroton_device::id` FOREIGN KEY (`device_id`) REFERENCES `syncroton_device` (`id`) ON DELETE CASCADE ON UPDATE CASCADE @@ -97,6 +95,16 @@ PRIMARY KEY (`id`) ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */; +CREATE TABLE IF NOT EXISTS `syncroton_modseq` ( + `device_id` varchar(40) NOT NULL, + `folder_id` varchar(40) NOT NULL, + `synctime` datetime NOT NULL, + `data` longblob, + PRIMARY KEY (`device_id`,`folder_id`,`synctime`), + KEY `syncroton_modseq::device_id` (`device_id`), + CONSTRAINT `syncroton_modseq::device_id--syncroton_device::id` FOREIGN KEY (`device_id`) REFERENCES `syncroton_device` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */; + CREATE TABLE IF NOT EXISTS `syncroton_relations_state` ( `device_id` varchar(40) NOT NULL, `folder_id` varchar(40) NOT NULL, @@ -115,4 +123,4 @@ PRIMARY KEY(`name`) ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */; -INSERT INTO `system` (`name`, `value`) VALUES ('syncroton-version', '2024031100'); +INSERT INTO `system` (`name`, `value`) VALUES ('syncroton-version', '2014101300');
View file
kolab-syncroton-2.3.22.tar.gz/docs/SQL/oracle
Added
+(directory)
View file
kolab-syncroton-2.3.22.tar.gz/docs/SQL/oracle.initial.sql
Added
@@ -0,0 +1,113 @@ +CREATE TABLE "syncroton_policy" ( + "id" varchar(40) NOT NULL PRIMARY KEY, + "name" varchar(255) NOT NULL, + "description" varchar(255) DEFAULT NULL, + "policy_key" varchar(64) NOT NULL, + "json_policy" clob DEFAULT NULL +); + +CREATE TABLE "syncroton_device" ( + "id" varchar(40) NOT NULL PRIMARY KEY, + "deviceid" varchar(64) NOT NULL, + "devicetype" varchar(64) NOT NULL, + "owner_id" varchar(40) NOT NULL, + "acsversion" varchar(40) NOT NULL, + "policykey" varchar(64) DEFAULT NULL, + "policy_id" varchar(40) DEFAULT NULL, + "useragent" varchar(255) DEFAULT NULL, + "imei" varchar(255) DEFAULT NULL, + "model" varchar(255) DEFAULT NULL, + "friendlyname" varchar(255) DEFAULT NULL, + "os" varchar(255) DEFAULT NULL, + "oslanguage" varchar(255) DEFAULT NULL, + "phonenumber" varchar(255) DEFAULT NULL, + "pinglifetime" integer DEFAULT NULL, + "remotewipe" integer DEFAULT 0, + "pingfolder" clob DEFAULT NULL, + "lastsynccollection" clob DEFAULT NULL, + "lastping" timestamp DEFAULT NULL, + "contactsfilter_id" varchar(40) DEFAULT NULL, + "calendarfilter_id" varchar(40) DEFAULT NULL, + "tasksfilter_id" varchar(40) DEFAULT NULL, + "emailfilter_id" varchar(40) DEFAULT NULL +); + +CREATE UNIQUE INDEX "syncroton_device_owner_id_idx" ON "syncroton_device" ("owner_id", "deviceid"); + + +CREATE TABLE "syncroton_folder" ( + "id" varchar(40) NOT NULL PRIMARY KEY, + "device_id" varchar(40) NOT NULL + REFERENCES "syncroton_device" ("id") ON DELETE CASCADE, + "class" varchar(64) NOT NULL, + "folderid" varchar(254) NOT NULL, + "parentid" varchar(254) DEFAULT NULL, + "displayname" varchar(254) NOT NULL, + "type" integer NOT NULL, + "creation_time" timestamp NOT NULL, + "lastfiltertype" integer DEFAULT NULL, + "supportedfields" clob DEFAULT NULL +); + +CREATE UNIQUE INDEX "syncroton_folder_device_id_idx" ON "syncroton_folder" ("device_id", "class", "folderid"); + + +CREATE TABLE "syncroton_synckey" ( + "id" varchar(40) NOT NULL PRIMARY KEY, + "device_id" varchar(40) NOT NULL + REFERENCES "syncroton_device" ("id") ON DELETE CASCADE, + "type" varchar(64) DEFAULT NULL, + "counter" integer DEFAULT 0 NOT NULL, + "lastsync" timestamp DEFAULT NULL, + "pendingdata" clob +); + +CREATE UNIQUE INDEX "syncroton_synckey_device_idx" ON "syncroton_synckey" ("device_id", "type", "counter"); + +CREATE TABLE "syncroton_content" ( + "id" varchar(40) NOT NULL PRIMARY KEY, + "device_id" varchar(40) NOT NULL + REFERENCES "syncroton_device" ("id") ON DELETE CASCADE, + "folder_id" varchar(40) NOT NULL, + "contentid" varchar(128) NOT NULL, + "creation_time" timestamp DEFAULT NULL, + "creation_synckey" integer NOT NULL, + "is_deleted" smallint DEFAULT 0 +); + +CREATE UNIQUE INDEX "syncroton_content_device_idx" ON "syncroton_content" ("device_id", "folder_id", "contentid"); + +CREATE TABLE "syncroton_data" ( + "id" varchar(40) NOT NULL PRIMARY KEY, + "class" varchar(40) NOT NULL, + "folder_id" varchar(40) NOT NULL, + "data" clob +); + +CREATE TABLE "syncroton_data_folder" ( + "id" varchar(40) NOT NULL PRIMARY KEY, + "type" integer NOT NULL, + "name" varchar(255) NOT NULL, + "owner_id" varchar(40) NOT NULL, + "parent_id" varchar(40) DEFAULT NULL +); + +CREATE TABLE "syncroton_modseq" ( + "device_id" varchar(40) NOT NULL + REFERENCES "syncroton_device" ("id") ON DELETE CASCADE, + "folder_id" varchar(40) NOT NULL, + "synctime" timestamp NOT NULL, + "data" clob, + PRIMARY KEY ("device_id", "folder_id", "synctime") +); + +CREATE TABLE "syncroton_relations_state" ( + "device_id" varchar(40) NOT NULL + REFERENCES "syncroton_device" ("id") ON DELETE CASCADE, + "folder_id" varchar(40) NOT NULL, + "synctime" timestamp NOT NULL, + "data" clob, + PRIMARY KEY ("device_id", "folder_id", "synctime") +); + +INSERT INTO "system" ("name", "value") VALUES ('syncroton-version', '2014101300');
View file
kolab-syncroton-2.3.22.tar.gz/docs/SQL/oracle/2014101300.sql
Added
@@ -0,0 +1,8 @@ +CREATE TABLE "syncroton_relations_state" ( + "device_id" varchar(40) NOT NULL + REFERENCES "syncroton_device" ("id") ON DELETE CASCADE, + "folder_id" varchar(40) NOT NULL, + "synctime" timestamp NOT NULL, + "data" clob, + PRIMARY KEY ("device_id", "folder_id", "synctime") +);
View file
kolab-syncroton-2.4.2.tar.gz/index.php -> kolab-syncroton-2.3.22.tar.gz/index.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | |
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Backend/ABackend.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Backend/ABackend.php
Changed
@@ -128,7 +128,7 @@ unset($data$key); if (!empty($value) && preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $value)) { # 2012-08-12 07:43:26 - $value = new DateTime($value, new DateTimeZone('UTC')); + $value = new DateTime($value, new DateTimeZone('utc')); } $data$this->_toCamelCase($key, false) = $value;
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Backend/IDevice.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Backend/IDevice.php
Changed
@@ -20,9 +20,8 @@ interface Syncroton_Backend_IDevice extends Syncroton_Backend_IBackend { /** - * @param string $userId - * @param string $deviceId - * + * @param unknown_type $userId + * @param unknown_type $deviceId * @return Syncroton_Model_IDevice */ public function getUserDevice($userId, $deviceId); @@ -41,7 +40,7 @@ * * @param array $request Oof/Get request data * - * @return Syncroton_Model_Oof|null Response object or NULL if OOF is not supported + * @return Syncroton_Model_Oof Response object or NULL if OOF is not supported * @throws Syncroton_Exception_Status */ public function getOOF($request);
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Backend/ISyncState.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Backend/ISyncState.php
Changed
@@ -42,8 +42,7 @@ * * @param Syncroton_Model_Device $_deviceId * @param string $_class - * - * @return Syncroton_Model_SyncState|false + * @return array */ public function validate($_deviceId, $_syncKey, $_type); }
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Backend/SyncState.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Backend/SyncState.php
Changed
@@ -138,8 +138,7 @@ * * @param Syncroton_Model_IDevice|string $deviceId * @param Syncroton_Model_IFolder|string $folderId - * - * @return Syncroton_Model_SyncState|false + * @return Syncroton_Model_SyncState */ public function validate($deviceId, $folderId, $syncKey) {
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/FolderCreate.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/FolderCreate.php
Changed
@@ -98,31 +98,16 @@ $this->_folder->deviceId = $this->_device; $this->_folder->creationTime = $this->_syncTimeStamp; - // Check if the folder already exists to avoid a duplicate insert attempt in db - try { - $this->_folderBackend->getFolder($this->_device, $this->_folder->serverId); - - if ($this->_logger instanceof Zend_Log) - $this->_logger->info(__METHOD__ . '::' . __LINE__ . " Attempted to create a folder that already exists. parentId: {$folder->parentId} displayName: {$folder->displayName}"); - - // The folder already exists - $this->_status = Syncroton_Command_FolderSync::STATUS_FOLDER_EXISTS; - } catch (Syncroton_Exception_NotFound $e) { - // This is the normal case - if ($this->_logger instanceof Zend_Log) - $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage()); - - $this->_folderBackend->create($this->_folder); - } + $this->_folderBackend->create($this->_folder); } } catch (Syncroton_Exception_Status $e) { if ($this->_logger instanceof Zend_Log) - $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage()); + $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage()); $this->_status = $e->getCode(); } catch (Exception $e) { if ($this->_logger instanceof Zend_Log) - $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage()); + $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage()); $this->_status = Syncroton_Command_FolderSync::STATUS_UNKNOWN_ERROR; }
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/FolderDelete.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/FolderDelete.php
Changed
@@ -26,6 +26,11 @@ protected $_folder; /** + * @var Syncroton_Model_ISyncState + */ + protected $_syncState; + + /** * parse FolderDelete request */ public function handle()
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/FolderSync.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/FolderSync.php
Changed
@@ -66,9 +66,10 @@ * @var string */ protected $_syncKey; - + /** - * Parse FolderSync request + * parse FolderSync request + * */ public function handle() {
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/GetAttachment.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/GetAttachment.php
Changed
@@ -49,7 +49,7 @@ if (PHP_SAPI !== 'cli') { // cache for 3600 seconds $maxAge = 3600; - $now = new DateTime('now', new DateTimeZone('UTC')); + $now = new DateTime(null, new DateTimeZone('UTC')); header('Cache-Control: private, max-age=' . $maxAge); header("Expires: " . gmdate('D, d M Y H:i:s', $now->modify("+{$maxAge} sec")->getTimestamp()) . " GMT");
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/ItemOperations.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/ItemOperations.php
Changed
@@ -249,13 +249,12 @@ } } - $airSync = $fetch->Options->children('uri:AirSync'); - if (isset($airSync->MIMESupport)) { - $fetchArray'options''mimeSupport' = (int) $airSync->MIMESupport; + if (isset($fetch->Options->MIMESupport)){ + $fetchArray'options''mimeSupport' = (int) $fetch->Options->MIMESupport; } - if (isset($fetch->Options->Range)) { - $fetchArray'options''range' = (string) $fetch->Options->Range; + if (isset($airSyncBase->Range)) { + $fetchArray'options''range' = (string) $airSyncBase->Range; } }
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/MoveItems.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/MoveItems.php
Changed
@@ -79,12 +79,9 @@ $dataController = Syncroton_Data_Factory::factory($sourceFolder->class, $this->_device, $this->_syncTimeStamp); $newId = $dataController->moveItem($move'srcFldId', $move'srcMsgId', $move'dstFldId'); - if (!$newId) { - throw new Syncroton_Exception_Status_MoveItems(Syncroton_Exception_Status_MoveItems::INVALID_SOURCE); - } - $response->appendChild($this->_outputDom->createElementNS('uri:Move', 'Status', Syncroton_Command_MoveItems::STATUS_SUCCESS)); - $response->appendChild($this->_outputDom->createElementNS('uri:Move', 'DstMsgId', $newId)); + if ($newId) + $response->appendChild($this->_outputDom->createElementNS('uri:Move', 'DstMsgId', $newId)); } catch (Syncroton_Exception_Status $e) { $response->appendChild($this->_outputDom->createElementNS('uri:Move', 'Status', $e->getCode())); } catch (Exception $e) {
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/Ping.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/Ping.php
Changed
@@ -90,7 +90,7 @@ } } - $this->_device->lastping = new DateTime('now', new DateTimeZone('UTC')); + $this->_device->lastping = new DateTime('now', new DateTimeZone('utc')); if ($status == self::STATUS_NO_CHANGES_FOUND) { $this->_device = $this->_deviceBackend->update($this->_device); @@ -113,7 +113,7 @@ $intervalEnd = $intervalStart + $lifeTime; $secondsLeft = $intervalEnd; - $folders = $this->_device->pingfolder ? unserialize($this->_device->pingfolder) : array(); + $folders = unserialize($this->_device->pingfolder); if ($status === self::STATUS_NO_CHANGES_FOUND && (!is_array($folders) || count($folders) == 0)) { $status = self::STATUS_MISSING_PARAMETERS; @@ -185,7 +185,7 @@ continue; } - $now = new DateTime('now', new DateTimeZone('UTC')); + $now = new DateTime('now', new DateTimeZone('utc')); foreach ($folders as $folderId) { try {
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/Search.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/Search.php
Changed
@@ -33,15 +33,9 @@ /** * parse search command request * - * @throws Syncroton_Exception_UnexpectedValue */ public function handle() { - if (! $this->_requestBody instanceof DOMDocument) { - throw new Syncroton_Exception_UnexpectedValue( - 'request body is no DOMDocument. got: ' . print_r($this->_requestBody, true)); - } - $xml = simplexml_import_dom($this->_requestBody); $this->_store = new Syncroton_Model_StoreRequest($xml->Store);
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/Settings.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/Settings.php
Changed
@@ -110,10 +110,8 @@ // Out-of-Office if (!empty($this->_OofGet)) { - $OofGet = null; try { $OofGet = $this->_deviceBackend->getOOF($this->_OofGet); - $OofStatus = self::STATUS_SUCCESS; } catch (Exception $e) { if ($e instanceof Syncroton_Exception_Status) { $OofStatus = $e->getCode();
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/Sync.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/Sync.php
Changed
@@ -99,6 +99,11 @@ */ protected $_moreAvailable = false; + /** + * @var Syncroton_Model_SyncState + */ + protected $_syncState; + protected $_maxWindowSize = 100; protected $_heartbeatInterval = null; @@ -238,12 +243,7 @@ continue; } - $syncKeyReused = $this->_syncStateBackend->haveNext($this->_device, $collectionData->folder, $collectionData->syncKey); - if ($syncKeyReused) { - if ($this->_logger instanceof Zend_Log) - $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " already known synckey {$collectionData->syncKey} provided"); - } - // check for invalid synckey + // check for invalid sycnkey if(($collectionData->syncState = $this->_syncStateBackend->validate($this->_device, $collectionData->folder, $collectionData->syncKey)) === false) { if ($this->_logger instanceof Zend_Log) $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " invalid synckey {$collectionData->syncKey} provided"); @@ -301,11 +301,6 @@ if ($this->_logger instanceof Zend_Log) $this->_logger->info(__METHOD__ . '::' . __LINE__ . " found " . count($adds) . " entries to be added to server"); - $clientIdMap = ; - if ($syncKeyReused && $collectionData->syncState->clientIdMap) { - $clientIdMap = Zend_Json::decode($collectionData->syncState->clientIdMap); - } - foreach ($adds as $add) { if ($this->_logger instanceof Zend_Log) $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " add entry with clientId " . (string) $add->ClientId); @@ -314,35 +309,20 @@ if ($this->_logger instanceof Zend_Log) $this->_logger->info(__METHOD__ . '::' . __LINE__ . " adding entry as new"); - $clientId = (string)$add->ClientId; - // If the sync key was reused, but we don't have a $clientId mapping, - // this means the client sent a new item with the same sync_key. - if ($syncKeyReused && array_key_exists($clientId, $clientIdMap)) { - // We don't normally store the clientId, so if a command with Add's is resent, - // we have to look-up the corresponding serverId using a cached clientId => serverId mapping, - // otherwise we would duplicate all added items on resend. - $serverId = $clientIdMap$clientId; - $clientModifications'added'$serverId = array( - 'clientId' => (string)$add->ClientId, - 'serverId' => $serverId, - 'status' => self::STATUS_SUCCESS, - 'contentState' => null - ); - } else { - $serverId = $dataController->createEntry($collectionData->collectionId, new $dataClass($add->ApplicationData)); - $clientModifications'added'$serverId = array( - 'clientId' => (string)$add->ClientId, - 'serverId' => $serverId, - 'status' => self::STATUS_SUCCESS, - 'contentState' => $this->_contentStateBackend->create(new Syncroton_Model_Content(array( - 'device_id' => $this->_device, - 'folder_id' => $collectionData->folder, - 'contentid' => $serverId, - 'creation_time' => $this->_syncTimeStamp, - 'creation_synckey' => $collectionData->syncKey + 1 - ))) - ); - } + $serverId = $dataController->createEntry($collectionData->collectionId, new $dataClass($add->ApplicationData)); + + $clientModifications'added'$serverId = array( + 'clientId' => (string)$add->ClientId, + 'serverId' => $serverId, + 'status' => self::STATUS_SUCCESS, + 'contentState' => $this->_contentStateBackend->create(new Syncroton_Model_Content(array( + 'device_id' => $this->_device, + 'folder_id' => $collectionData->folder, + 'contentid' => $serverId, + 'creation_time' => $this->_syncTimeStamp, + 'creation_synckey' => $collectionData->syncKey + 1 + ))) + ); } catch (Exception $e) { if ($this->_logger instanceof Zend_Log) @@ -356,7 +336,7 @@ } // handle changes, but only if not first sync - if(!$syncKeyReused && $collectionData->syncKey > 1 && $collectionData->hasClientChanges()) { + if($collectionData->syncKey > 1 && $collectionData->hasClientChanges()) { $changes = $collectionData->getClientChanges(); if ($this->_logger instanceof Zend_Log) @@ -387,7 +367,7 @@ } // handle deletes, but only if not first sync - if(!$syncKeyReused && $collectionData->hasClientDeletes()) { + if($collectionData->hasClientDeletes()) { $deletes = $collectionData->getClientDeletes(); if ($this->_logger instanceof Zend_Log) $this->_logger->info(__METHOD__ . '::' . __LINE__ . " found " . count($deletes) . " entries to be deleted on server"); @@ -485,7 +465,7 @@ $wakeupCallback(); - $now = new DateTime('now', new DateTimeZone('UTC')); + $now = new DateTime(null, new DateTimeZone('utc')); foreach($this->_collections as $collectionData) { // continue immediately if folder does not exist @@ -653,20 +633,20 @@ if ($hasChanges) { // update _syncTimeStamp as $dataController->hasChanges might have spent some time - $this->_syncTimeStamp = new DateTime('now', new DateTimeZone('UTC')); + $this->_syncTimeStamp = new DateTime(null, new DateTimeZone('utc')); try { // fetch entries added since last sync $allClientEntries = $this->_contentStateBackend->getFolderState( $this->_device, - $collectionData->folder, - $collectionData->syncState->counter + $collectionData->folder ); // fetch entries changed since last sync $allChangedEntries = $dataController->getChangedEntries( $collectionData->collectionId, - $collectionData->syncState, + $collectionData->syncState->lastsync, + $this->_syncTimeStamp, $collectionData->options'filterType' ); @@ -690,8 +670,8 @@ if ($this->_logger instanceof Zend_Log) $this->_logger->info(__METHOD__ . '::' . __LINE__ . " skipped added entry: " . $serverId); unset($serverModifications'added'$id); + } } - } // entries to be deleted $serverModifications'deleted' = array_diff($allClientEntries, $allServerEntries); @@ -751,7 +731,7 @@ foreach($clientModifications'added' as $entryData) { $add = $responses->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'Add')); $add->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'ClientId', $entryData'clientId')); - // we have no serverId if the add failed + // we have no serverId is the add failed if(isset($entryData'serverId')) { $add->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'ServerId', $entryData'serverId')); } @@ -949,12 +929,8 @@ $countOfPendingChanges = (count($serverModifications'added') + count($serverModifications'changed') + count($serverModifications'deleted')); if ($countOfPendingChanges > 0) { - if ($this->_logger instanceof Zend_Log) - $this->_logger->info(__METHOD__ . '::' . __LINE__ . " there are ". $countOfPendingChanges . " more items available"); $collection->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'MoreAvailable')); } else { - if ($this->_logger instanceof Zend_Log) - $this->_logger->info(__METHOD__ . '::' . __LINE__ . " there are no more items available"); $serverModifications = null; } @@ -963,12 +939,6 @@ } $totalChanges += $collectionChanges; - - // If the client resent an old sync-key, we should still respond with the latest sync key - if (isset($collectionData->syncState->counterNext)) { - //TODO we're not resending the changes in between, but I'm not sure we have to. - $collectionData->syncState->counter = $collectionData->syncState->counterNext; - } // increase SyncKey if needed if (( @@ -995,9 +965,6 @@ if (!$emptySyncSupported || $collection->childNodes->length > 4 || $collectionData->syncState->counter != $collectionData->syncKey) { $collections->appendChild($collection); } - - //Store next - $collectionData->syncState->extraData = $dataController->getExtraData($collectionData->folder); } if (isset($collectionData->syncState) && @@ -1019,90 +986,50 @@ $collectionData->syncState->pendingdata = null; } +
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Command/Wbxml.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/Wbxml.php
Changed
@@ -154,7 +154,7 @@ $this->_logger = Syncroton_Registry::get('loggerBackend'); } - $this->_syncTimeStamp = new DateTime('now', new DateTimeZone('UTC')); + $this->_syncTimeStamp = new DateTime(null, new DateTimeZone('UTC')); // set default content type $this->_headers'Content-Type' = 'application/vnd.ms-sync.wbxml';
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Data/AData.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Data/AData.php
Changed
@@ -181,10 +181,8 @@ * (non-PHPdoc) * @see Syncroton_Data_IData::getChangedEntries() */ - public function getChangedEntries($_folderId, Syncroton_Model_ISyncState $syncState, $filterType = NULL) + public function getChangedEntries($_folderId, DateTime $_startTimeStamp, DateTime $_endTimeStamp = NULL, $filterType = NULL) { - $_startTimeStamp = $syncState->lastSync; - $_endTimeStamp = null; $folderId = $_folderId instanceof Syncroton_Model_IFolder ? $_folderId->id : $_folderId; $select = $this->_db->select() @@ -274,7 +272,7 @@ $addedEntries = array_diff($allServerEntries, $allClientEntries); $deletedEntries = array_diff($allClientEntries, $allServerEntries); - $changedEntries = $this->getChangedEntries($folder->serverId, $syncState, $folder->lastfiltertype); + $changedEntries = $this->getChangedEntries($folder->serverId, $syncState->lastsync, null, $folder->lastfiltertype); return count($addedEntries) + count($deletedEntries) + count($changedEntries); }
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Data/IData.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Data/IData.php
Changed
@@ -37,11 +37,11 @@ /** * delete entry in backend * - * @param string $_folderId - * @param string $_serverId - * @param ?Syncroton_Model_SyncCollection $_collectionData + * @param string $_folderId + * @param string $_serverId + * @param unknown_type $_collectionData */ - public function deleteEntry($_folderId, $_serverId, $_collectionData = null); + public function deleteEntry($_folderId, $_serverId, $_collectionData); /** * delete folder @@ -64,14 +64,7 @@ */ public function getAllFolders(); - public function getChangedEntries($folderId, Syncroton_Model_ISyncState $syncState, $filterType = NULL); - - /** - * Retrieve extra data that is stored with the sync key - * @return string|null - **/ - public function getExtraData(Syncroton_Model_IFolder $folder); - + public function getChangedEntries($folderId, DateTime $startTimeStamp, DateTime $endTimeStamp = NULL, $filterType = NULL); /** * retrieve folders which were modified since last sync @@ -93,7 +86,7 @@ /** * - * @param string $fileReference + * @param unknown_type $fileReference * @return Syncroton_Model_FileReference */ public function getFileReference($fileReference);
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Exception/Status/Settings.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Exception/Status/Settings.php
Changed
@@ -32,11 +32,11 @@ * @var array */ protected $_errorMessages = array( - self::PROTOCOL_ERROR => "Protocol error", - self::ACCESS_DENIED => "Access denied", - self::SERVICE_UNAVAILABLE => "Server unavailable", - self::INVALID_ARGUMENTS => "Invalid arguments", - self::CONFLICTING_ARGUMENTS => "Conflicting arguments", - self::DENIED_BY_POLICY => "Denied by policy. Disabled by administrator", + self::PROTOCOL_ERROR => "Protocol error"; + self::ACCESS_DENIED => "Access denied"; + self::SERVICE_UNAVAILABLE => "Server unavailable"; + self::INVALID_ARGUMENTS => "Invalid arguments"; + self::CONFLICTING_ARGUMENTS => "Conflicting arguments"; + self::DENIED_BY_POLICY => "Denied by policy. Disabled by administrator"; ); }
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Model/AEntry.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Model/AEntry.php
Changed
@@ -40,7 +40,6 @@ * (non-PHPdoc) * @see Countable::count() */ - #\ReturnTypeWillChange public function count() { return count($this->_elements); @@ -50,7 +49,6 @@ * (non-PHPdoc) * @see IteratorAggregate::getIterator() */ - #\ReturnTypeWillChange public function getIterator() { return new ArrayIterator($this->_elements);
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Model/AXMLEntry.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Model/AXMLEntry.php
Changed
@@ -174,7 +174,7 @@ $element->appendChild($element->ownerDocument->createCDATASection(base64_encode($value))); } else { // strip off any non printable control characters - if (!ctype_print((string)$value)) { + if (!ctype_print($value)) { $value = $this->_removeControlChars($value); }
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Model/EmailMeetingRequest.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Model/EmailMeetingRequest.php
Changed
@@ -68,6 +68,8 @@ const MESSAGE_TYPE_COPY = 5; const MESSAGE_TYPE_DELEGATED = 6; + protected $_dateTimeFormat = "Ymd\THis\Z"; + protected $_xmlBaseElement = 'MeetingRequest'; protected $_properties = array( @@ -78,7 +80,7 @@ 'dtStamp' => array('type' => 'datetime'), 'endTime' => array('type' => 'datetime'), 'globalObjId' => array('type' => 'string'), - 'instanceType' => array('type' => 'number'), + 'instanceType' => array('type' => 'datetime'), 'location' => array('type' => 'string'), 'organizer' => array('type' => 'string'), //e-mail address 'recurrenceId' => array('type' => 'datetime'),
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Model/ISyncState.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Model/ISyncState.php
Changed
@@ -19,8 +19,6 @@ * @property string counter * @property DateTime lastsync * @property string pendingdata - * @property string client_id_map - * @property string extraData */ interface Syncroton_Model_ISyncState {
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Model/StoreRequest.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Model/StoreRequest.php
Changed
@@ -178,12 +178,12 @@ switch ($this->_store'name') { case 'DocumentLibrary': case 'Document Library': //? - $this->_store'options''range' = '0-999'; + '0-999'; break; case 'Mailbox': case 'GAL': default: - $this->_store'options''range' = '0-99'; + '0-99'; break; } }
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Server.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Server.php
Changed
@@ -105,9 +105,9 @@ $className = 'Syncroton_Command_' . $requestParameters'command'; - if (!class_exists($className)) { + if(!class_exists($className)) { if ($this->_logger instanceof Zend_Log) - $this->_logger->notice(__METHOD__ . '::' . __LINE__ . " command not supported: " . $requestParameters'command'); + $this->_logger->crit(__METHOD__ . '::' . __LINE__ . " command not supported: " . $requestParameters'command'); header("HTTP/1.1 501 not implemented"); @@ -123,11 +123,10 @@ $decoder = new Syncroton_Wbxml_Decoder($this->_body); $requestBody = $decoder->decode(); if ($this->_logger instanceof Zend_Log) { - $this->_logDomDocument($requestBody, 'request', __METHOD__, __LINE__); + $requestBody->formatOutput = true; + $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " xml request:\n" . $requestBody->saveXML()); } } catch(Syncroton_Wbxml_Exception_UnexpectedEndOfFile $e) { - if ($this->_logger instanceof Zend_Log) - $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " unexpected end of file."); $requestBody = NULL; } } else { @@ -162,11 +161,11 @@ } catch (Exception $e) { if ($this->_logger instanceof Zend_Log) - $this->_logger->err(__METHOD__ . '::' . __LINE__ . " unexpected exception occured: " . get_class($e)); + $this->_logger->crit(__METHOD__ . '::' . __LINE__ . " unexpected exception occured: " . get_class($e)); if ($this->_logger instanceof Zend_Log) - $this->_logger->err(__METHOD__ . '::' . __LINE__ . " exception message: " . $e->getMessage()); + $this->_logger->crit(__METHOD__ . '::' . __LINE__ . " exception message: " . $e->getMessage()); if ($this->_logger instanceof Zend_Log) - $this->_logger->err(__METHOD__ . '::' . __LINE__ . " " . $e->getTraceAsString()); + $this->_logger->crit(__METHOD__ . '::' . __LINE__ . " " . $e->getTraceAsString()); header("HTTP/1.1 500 Internal server error"); @@ -175,7 +174,7 @@ if ($response instanceof DOMDocument) { if ($this->_logger instanceof Zend_Log) { - $this->_logDomDocument($response, 'response', __METHOD__, __LINE__); + $this->_logDomDocument(Zend_Log::DEBUG, $response, __METHOD__, __LINE__); } if (isset($command) && $command instanceof Syncroton_Command_ICommand) { @@ -191,6 +190,7 @@ } catch (Syncroton_Wbxml_Exception $swe) { if ($this->_logger instanceof Zend_Log) { $this->_logger->err(__METHOD__ . '::' . __LINE__ . " Could not encode output: " . $swe); + $this->_logDomDocument(Zend_Log::WARN, $response, __METHOD__, __LINE__); } header("HTTP/1.1 500 Internal server error"); @@ -245,17 +245,15 @@ /** * write (possible big) DOMDocument in smaller chunks to log file * + * @param unknown $priority * @param DOMDocument $dom - * @param string $action * @param string $method * @param int $line */ - protected function _logDomDocument(DOMDocument $dom, $action, $method, $line) + protected function _logDomDocument($priority, DOMDocument $dom, $method, $line) { - if (method_exists($this->_logger, 'hasDebug') && !$this->_logger->hasDebug()) { - return; - } - + $loops = 0; + $tempStream = tmpfile(); $meta_data = stream_get_meta_data($tempStream); @@ -266,10 +264,11 @@ $dom->formatOutput = false; rewind($tempStream); - - $loops = 0; + + // log data in 1MByte chunks while (!feof($tempStream)) { - $this->_logger->debug("{$method}::{$line} xml {$action} ({$loops}):\n" . fread($tempStream, 1048576)); + $this->_logger->log($method . '::' . $line . " xml response($loops):\n" . fread($tempStream, 1048576), $priority); + $loops++; } @@ -421,9 +420,11 @@ /** * get existing device of owner or create new device for owner * - * @param string $ownerId - * @param array $requestParameters - * + * @param unknown_type $ownerId + * @param unknown_type $deviceId + * @param unknown_type $deviceType + * @param unknown_type $userAgent + * @param unknown_type $protocolVersion * @return Syncroton_Model_Device */ protected function _getUserDevice($ownerId, $requestParameters) @@ -433,7 +434,6 @@ $device->useragent = $requestParameters'userAgent'; $device->acsversion = $requestParameters'protocolVersion'; - $device->devicetype = $requestParameters'deviceType'; if ($device->isDirty()) { $device = $this->_deviceBackend->update($device);
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Wbxml/Encoder.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Wbxml/Encoder.php
Changed
@@ -20,6 +20,27 @@ class Syncroton_Wbxml_Encoder extends Syncroton_Wbxml_Abstract { /** + * stack of dtd objects + * + * @var array + */ + protected $_dtdStack = array(); + + /** + * stack of stream resources + * + * @var array + */ + protected $_streamStack = array(); + + /** + * stack of levels when to pop data from the other stacks + * + * @var array + */ + protected $_popStack = array(); + + /** * count level of tags * * @var string @@ -27,6 +48,27 @@ protected $_level = 0; /** + * when to take data next time from the different stacks + * + * @var unknown_type + */ + protected $_nextStackPop = NULL; + + /** + * collect data trough different calls to _handleCharacters + * + * @var string + */ + protected $_currentTagData = NULL; + + /** + * the current tag as read by the parser + * + * @var string + */ + protected $_currentTag = NULL; + + /** * the constructor * * @param resource $_stream @@ -109,66 +151,67 @@ { $_dom->formatOutput = false; - $this->_initialize($_dom); - $this->_traverseDom($_dom); - } + $tempStream = tmpfile(); - private function getAttributes($node) - { - $attributes = array(); - if ($node->attributes) { - for ($i = 0; $i < $node->attributes->length; ++$i) { - $attributes$node->attributes->item($i)->name = $node->attributes->item($i)->value; + $meta_data = stream_get_meta_data($tempStream); + $filename = $meta_data"uri"; + $_dom->save($filename); + rewind($tempStream); + + $this->_initialize($_dom); + + $parser = xml_parser_create_ns($this->_charSet, ';'); + xml_set_object($parser, $this); + xml_set_element_handler($parser, '_handleStartTag', '_handleEndTag'); + xml_set_character_data_handler($parser, '_handleCharacters'); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); + + while (!feof($tempStream)) { + if (!xml_parse($parser, fread($tempStream, 1048576), feof($tempStream))) { + // uncomment to write xml document to file + #rewind($tempStream); + #$xmlStream = fopen(tempnam(sys_get_temp_dir(), "xmlerrors"), 'r+'); + #stream_copy_to_stream($tempStream, $xmlStream); + #fclose($xmlStream); + + throw new Syncroton_Wbxml_Exception(sprintf('XML error: %s at line %d', + xml_error_string(xml_get_error_code($parser)), + xml_get_current_line_number($parser) + )); } } - return $attributes; - } - private function writeNode($node, $withContent = false, $data = null) { - if($this->_codePage->getNameSpace() != $node->namespaceURI) { - $this->_switchCodePage($node->namespaceURI); - } - $this->_writeTag($node->localName, $this->getAttributes($node), $withContent, $data); + fclose($tempStream); + xml_parser_free($parser); } - protected function _traverseDom($_dom) + /** + * get's called by xml parser when tag starts + * + * @param resource $_parser + * @param string $_tag current tag prefixed with namespace + * @param array $_attributes list of tag attributes + */ + protected function _handleStartTag($_parser, $_tag, $_attributes) { - if ($_dom->childNodes->length == 0) { - return false; - } - // print(str_pad("", $this->_level, " ") . "traversing {$_dom->nodeName}" . "\n"); $this->_level++; - $prevNode = $_dom; - $foundElementNode = false; - foreach ($_dom->childNodes as $node) { - if ($node->nodeType == XML_ELEMENT_NODE) { - $foundElementNode = true; - if ($prevNode && $this->_level > 1) { - // print(str_pad("", $this->_level, " ") . "{$node->nodeName} creating parent {$prevNode->nodeName}" . "\n"); - $this->writeNode($prevNode, true); - $prevNode = null; - } - if (!$this->_traverseDom($node)) { - // print(str_pad("", $this->_level, " ") . "{$node->nodeName} content {$node->nodeValue}" . "\n"); - $data = $node->nodeValue; - if (strlen($data) == 0) { - $this->writeNode($node); - } else { - $this->writeNode($node, true, $data); - $this->_writeByte(Syncroton_Wbxml_Abstract::END); - // print("Closing tag after writing tag\n"); - } - } else { - $this->_writeByte(Syncroton_Wbxml_Abstract::END); - // print("Closing tag\n"); - } - } + $this->_currentTagData = null; + + // write data for previous tag happens whith <tag1><tag2> + if($this->_currentTag !== NULL) { + $this->_writeTag($this->_currentTag, $this->_attributes, true); } - $this->_level--; - return $foundElementNode; - } + list($nameSpace, $this->_currentTag) = explode(';', $_tag); + + if($this->_codePage->getNameSpace() != $nameSpace) { + $this->_switchCodePage($nameSpace); + } + $this->_attributes = $_attributes; + + } + /** * strip uri: from nameSpace * @@ -181,6 +224,73 @@ } /** + * get's called by xml parser when tag ends + * + * @param resource $_parser + * @param string $_tag current tag prefixed with namespace + */ + protected function _handleEndTag($_parser, $_tag) + { + #echo "$_tag Level: $this->_level == $this->_nextStackPop \n"; + + if($this->_nextStackPop !== NULL && $this->_nextStackPop == $this->_level) { + #echo "TAG: $_tag\n"; + $this->_writeByte(Syncroton_Wbxml_Abstract::END); + + $subStream = $this->_stream; + $subStreamLength = ftell($subStream); + + $this->_dtd = array_pop($this->_dtdStack); + $this->_stream = array_pop($this->_streamStack); + $this->_nextStackPop = array_pop($this->_popStack); + $this->_codePage = $this->_dtd->getCurrentCodePage(); + + rewind($subStream); + #while (!feof($subStream)) {$buffer = fgets($subStream, 4096);echo $buffer;}
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Wbxml/Exception/UnexpectedEndOfFile.php -> kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Wbxml/Exception/UnexpectedEndOfFile.php
Changed
@@ -19,5 +19,5 @@ class Syncroton_Wbxml_Exception_UnexpectedEndOfFile extends Syncroton_Wbxml_Exception { - protected $message = 'unexpected end of file detected'; -} + protected $message = 'unexpcted end of file detected'; +} \ No newline at end of file
View file
kolab-syncroton-2.3.22.tar.gz/lib/ext/rtf.php
Added
@@ -0,0 +1,705 @@ +<?php +/* + This class contains code from rtfclass.php that was written by Markus Fischer and placed by him under + GPLv2 License. + + =======================================NOTES FROM ORIGINAL AUTHOR==================================== + Rich Text Format - Parsing Class + ================================ + + (c) 2000 Markus Fischer + <mfischer@josefine.ben.tuwien.ac.at> + http://josefine.ben.tuwien.ac.at/~mfischer/ + + Latest versions of this class can always be found at + http://josefine.ben.tuwien.ac.at/~mfischer/developing/php/rtf/rtfclass.phps + Testing suite is available at + http://josefine.ben.tuwien.ac.at/~mfischer/developing/php/rtf/ + + License: GPLv2 + + Specification: + http://msdn.microsoft.com/library/default.asp?URL=/library/specs/rtfspec.htm + + General Notes: + ============== + Unknown or unspupported control symbols are silently gnored + + Group stacking is still not supported :( + group stack logic implemented; however not really used yet + ===================================================================================================== + + It was modified by me (Andreas Brodowski) to allow compressed RTF being uncompressed by code I ported from + Java to PHP and adapted according the needs of Z-Push. + + Currently it is being used to detect empty RTF Streams from Nokia Phones in MfE Clients + + It needs to be used by other backend writers that needs to have notes in calendar, appointment or tasks + objects to be written to their databases since devices send them usually in RTF Format... With Zarafa + you can write them directly to DB and Zarafa is doing the conversion job. Other Groupware systems usually + don't have this possibility... + + Aleksander Machniak <machniak@kolabsys.com> fixed some deprecated function usage and some small issues + +*/ + + +class rtf { + var $LZRTF_HDR_DATA = "{\\rtf1\\ansi\\mac\\deff0\\deftab720{\\fonttbl;}{\\f0\\fnil \\froman \\fswiss \\fmodern \\fscript \\fdecor MS Sans SerifSymbolArialTimes New RomanCourier{\\colortbl\\red0\\green0\\blue0\n\r\\par \\pard\\plain\\f0\\fs20\\b\\i\\u\\tab\\tx"; + var $LZRTF_HDR_LEN = 207; + var $CRC32_TABLE = array( 0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3, + 0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91, + 0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,0x6DDDE4EB,0xF4D4B551,0x83D385C7, + 0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5, + 0x3B6E20C8,0x4C69105E,0xD56041E4,0xA2677172,0x3C03E4D1,0x4B04D447,0xD20D85FD,0xA50AB56B, + 0x35B5A8FA,0x42B2986C,0xDBBBC9D6,0xACBCF940,0x32D86CE3,0x45DF5C75,0xDCD60DCF,0xABD13D59, + 0x26D930AC,0x51DE003A,0xC8D75180,0xBFD06116,0x21B4F4B5,0x56B3C423,0xCFBA9599,0xB8BDA50F, + 0x2802B89E,0x5F058808,0xC60CD9B2,0xB10BE924,0x2F6F7C87,0x58684C11,0xC1611DAB,0xB6662D3D, + 0x76DC4190,0x01DB7106,0x98D220BC,0xEFD5102A,0x71B18589,0x06B6B51F,0x9FBFE4A5,0xE8B8D433, + 0x7807C9A2,0x0F00F934,0x9609A88E,0xE10E9818,0x7F6A0DBB,0x086D3D2D,0x91646C97,0xE6635C01, + 0x6B6B51F4,0x1C6C6162,0x856530D8,0xF262004E,0x6C0695ED,0x1B01A57B,0x8208F4C1,0xF50FC457, + 0x65B0D9C6,0x12B7E950,0x8BBEB8EA,0xFCB9887C,0x62DD1DDF,0x15DA2D49,0x8CD37CF3,0xFBD44C65, + 0x4DB26158,0x3AB551CE,0xA3BC0074,0xD4BB30E2,0x4ADFA541,0x3DD895D7,0xA4D1C46D,0xD3D6F4FB, + 0x4369E96A,0x346ED9FC,0xAD678846,0xDA60B8D0,0x44042D73,0x33031DE5,0xAA0A4C5F,0xDD0D7CC9, + 0x5005713C,0x270241AA,0xBE0B1010,0xC90C2086,0x5768B525,0x206F85B3,0xB966D409,0xCE61E49F, + 0x5EDEF90E,0x29D9C998,0xB0D09822,0xC7D7A8B4,0x59B33D17,0x2EB40D81,0xB7BD5C3B,0xC0BA6CAD, + 0xEDB88320,0x9ABFB3B6,0x03B6E20C,0x74B1D29A,0xEAD54739,0x9DD277AF,0x04DB2615,0x73DC1683, + 0xE3630B12,0x94643B84,0x0D6D6A3E,0x7A6A5AA8,0xE40ECF0B,0x9309FF9D,0x0A00AE27,0x7D079EB1, + 0xF00F9344,0x8708A3D2,0x1E01F268,0x6906C2FE,0xF762575D,0x806567CB,0x196C3671,0x6E6B06E7, + 0xFED41B76,0x89D32BE0,0x10DA7A5A,0x67DD4ACC,0xF9B9DF6F,0x8EBEEFF9,0x17B7BE43,0x60B08ED5, + 0xD6D6A3E8,0xA1D1937E,0x38D8C2C4,0x4FDFF252,0xD1BB67F1,0xA6BC5767,0x3FB506DD,0x48B2364B, + 0xD80D2BDA,0xAF0A1B4C,0x36034AF6,0x41047A60,0xDF60EFC3,0xA867DF55,0x316E8EEF,0x4669BE79, + 0xCB61B38C,0xBC66831A,0x256FD2A0,0x5268E236,0xCC0C7795,0xBB0B4703,0x220216B9,0x5505262F, + 0xC5BA3BBE,0xB2BD0B28,0x2BB45A92,0x5CB36A04,0xC2D7FFA7,0xB5D0CF31,0x2CD99E8B,0x5BDEAE1D, + 0x9B64C2B0,0xEC63F226,0x756AA39C,0x026D930A,0x9C0906A9,0xEB0E363F,0x72076785,0x05005713, + 0x95BF4A82,0xE2B87A14,0x7BB12BAE,0x0CB61B38,0x92D28E9B,0xE5D5BE0D,0x7CDCEFB7,0x0BDBDF21, + 0x86D3D2D4,0xF1D4E242,0x68DDB3F8,0x1FDA836E,0x81BE16CD,0xF6B9265B,0x6FB077E1,0x18B74777, + 0x88085AE6,0xFF0F6A70,0x66063BCA,0x11010B5C,0x8F659EFF,0xF862AE69,0x616BFFD3,0x166CCF45, + 0xA00AE278,0xD70DD2EE,0x4E048354,0x3903B3C2,0xA7672661,0xD06016F7,0x4969474D,0x3E6E77DB, + 0xAED16A4A,0xD9D65ADC,0x40DF0B66,0x37D83BF0,0xA9BCAE53,0xDEBB9EC5,0x47B2CF7F,0x30B5FFE9, + 0xBDBDF21C,0xCABAC28A,0x53B39330,0x24B4A3A6,0xBAD03605,0xCDD70693,0x54DE5729,0x23D967BF, + 0xB3667A2E,0xC4614AB8,0x5D681B02,0x2A6F2B94,0xB40BBE37,0xC30C8EA1,0x5A05DF1B,0x2D02EF8D, + ); + + var $rtf; // rtf core stream + var $rtf_len; // length in characters of the stream (get performace due avoiding calling strlen everytime) + var $err = array(); // array of error message, no entities on no error + + var $wantXML; // convert to XML + var $wantHTML; // convert to HTML + var $wantASCII; // convert to HTML + + // the only variable which should be accessed from the outside + var $out; // output data stream (depends on which $wantXXXXX is set to true + var $outstyles; // htmlified styles (generated after parsing if wantHTML + var $styles = array(); // if wantHTML, stylesheet definitions are put in here + + // internal parser variables -------------------------------- + // control word variables + var $cword; // holds the current (or last) control word, depending on $cw + var $cw; // are we currently parsing a control word ? + var $cfirst; // could this be the first character ? so watch out for control symbols + + var $flags = array(); // parser flags + + var $queue; // every character which is no sepcial char, not belongs to a control word/symbol; is generally considered being 'plain' + + var $stack = array(); // group stack + + /* keywords which don't follw the specification (used by Word '97 - 2000) */ + // not yet used + var $control_exception = array( + "clFitText", + "clftsWidth(-?0-9+)?", + "clNoWrap(-?0-9+)?", + "clwWidth(-?0-9+)?", + "tdfrmtxtBottom(-?0-9+)?", + "tdfrmtxtLeft(-?0-9+)?", + "tdfrmtxtRight(-?0-9+)?", + "tdfrmtxtTop(-?0-9+)?", + "trftsWidthA(-?0-9+)?", + "trftsWidthB(-?0-9+)?", + "trftsWidth(-?0-9+)?", + "trwWithA(-?0-9+)?", + "trwWithB(-?0-9+)?", + "trwWith(-?0-9+)?", + "spectspecifygen(-?0-9+)?", + ); + + var $charset_table = array( + "0" => "ANSI", + "1" => "Default", + "2" => "Symbol", + "77" => "Mac", + "128" => "Shift Jis", + "129" => "Hangul", + "130" => "Johab", + "134" => "GB2312", + "136" => "Big5", + "161" => "Greek", + "162" => "Turkish", + "163" => "Vietnamese", + "177" => "Hebrew", + "178" => "Arabic", + "179" => "Arabic Traditional", + "180" => "Arabic user", + "181" => "Hebrew user", + "186" => "Baltic", + "204" => "Russian", + "222" => "Thai", + "238" => "Eastern European", + "255" => "PC 437", + "255" => "OEM", + ); + + /* note: the only conversion table used */ + var $fontmodifier_table = array( + "bold" => "b", + "italic" => "i", + "underlined" => "u", + "strikethru" => "strike", + ); + + + function __construct() { + $this->rtf_len = 0; + $this->rtf = ''; + + $this->out = ''; + } + + // loadrtf - load the raw rtf data to be converted by this class + // data = the raw rtf + function loadrtf($data) { + if (($this->rtf = $this->uncompress($data))) { + $this->rtf_len = strlen($this->rtf); + }; + if($this->rtf_len == 0) { + debugLog("No data in stream found"); + return false; + }; + return true; + } + + function output($typ) { + switch($typ) { + case "ascii": $this->wantASCII = true; break; + case "xml": $this->wantXML = true; break; + case "html": $this->wantHTML = true; break; + default: break; + } + } + + // uncompress - uncompress compressed rtf data + // src = the compressed raw rtf in LZRTF format + function uncompress($src) { + $header = unpack("LcSize/LuSize/Lmagic/Lcrc32",substr($src,0,16)); + $in = 16; + if ($header'cSize' != strlen($src)-4) { + debugLog("Stream too short");
View file
kolab-syncroton-2.4.2.tar.gz/lib/init.php -> kolab-syncroton-2.3.22.tar.gz/lib/init.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | |
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -28,23 +28,25 @@ */ class kolab_sync extends rcube { - /** @var string Application name */ + /** + * Application name + * + * @var string + */ public $app_name = 'ActiveSync for Kolab'; // no double quotes inside - /** @var string|null Request user name */ - public $username; + /** + * Current user + * + * @var rcube_user + */ + public $user; - /** @var string|null Request user password */ + public $username; public $password; - public $task; - - protected $per_user_log_dir; - protected $log_dir; - protected $logger; - - public const CHARSET = 'UTF-8'; - public const VERSION = "2.4.2"; + const CHARSET = 'UTF-8'; + const VERSION = "2.3.22"; /** @@ -55,7 +57,7 @@ * * @return kolab_sync The one and only instance */ - public static function get_instance($mode = 0, $env = '') + static function get_instance($mode = 0, $env = '') { if (!self::$instance || !is_a(self::$instance, 'kolab_sync')) { self::$instance = new kolab_sync(); @@ -72,16 +74,15 @@ public function startup() { // Initialize Syncroton Logger - $debug_mode = $this->config->get('activesync_debug') ? kolab_sync_logger::DEBUG : kolab_sync_logger::WARN; - $this->logger = new kolab_sync_logger($debug_mode); - $this->log_dir = $this->config->get('log_dir'); + $debug_mode = $this->config->get('activesync_debug') ? kolab_sync_logger::DEBUG : kolab_sync_logger::WARN; + $this->logger = new kolab_sync_logger($debug_mode); // Get list of plugins // WARNING: We can use only plugins that are prepared for this - // e.g. are not using output or rcmail objects and - // do not throw errors when using them - $plugins = (array)$this->config->get('activesync_plugins', 'kolab_auth'); - $plugins = array_unique(array_merge($plugins, 'libkolab', 'libcalendaring')); + // e.g. are not using output or rcmail objects or + // doesn't throw errors when using them + $plugins = (array)$this->config->get('activesync_plugins', array('kolab_auth')); + $plugins = array_unique(array_merge($plugins, array('libkolab', 'libcalendaring'))); // Initialize/load plugins $this->plugins = kolab_sync_plugin_api::get_instance(); @@ -114,7 +115,7 @@ } if (isset($basicAuthData) && !empty($basicAuthData)) { - $_SERVER'PHP_AUTH_USER', $_SERVER'PHP_AUTH_PW' = explode(":", $basicAuthData); + list($_SERVER'PHP_AUTH_USER', $_SERVER'PHP_AUTH_PW') = explode(":", $basicAuthData); } } @@ -128,37 +129,34 @@ } } - // Set log directory per-user - $this->set_log_dir($_SERVER'PHP_AUTH_USER'); - // Authenticate the user $userid = $this->authenticate($_SERVER'PHP_AUTH_USER', $_SERVER'PHP_AUTH_PW'); } if (empty($userid)) { - header('WWW-Authenticate: Basic realm="' . $this->app_name . '"'); + header('WWW-Authenticate: Basic realm="' . $this->app_name .'"'); header('HTTP/1.1 401 Unauthorized'); exit; } - $this->plugins->exec_hook('ready', 'task' => 'syncroton'); + $this->plugins->exec_hook('ready', array('task' => 'syncroton')); - // Set log directory per-user (again, in case the username changed above) + // Set log directory per-user $this->set_log_dir(); // Save user password for Roundcube Framework $this->password = $_SERVER'PHP_AUTH_PW'; // Register Syncroton backends/callbacks - Syncroton_Registry::set(Syncroton_Registry::LOGGERBACKEND, $this->logger); - Syncroton_Registry::set(Syncroton_Registry::DATABASE, $this->get_dbh()); - Syncroton_Registry::set(Syncroton_Registry::TRANSACTIONMANAGER, kolab_sync_transaction_manager::getInstance()); - Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new kolab_sync_backend_device()); - Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new kolab_sync_backend_folder()); - Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new kolab_sync_backend_state()); - Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new kolab_sync_backend_content()); - Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new kolab_sync_backend_policy()); - Syncroton_Registry::set(Syncroton_Registry::SLEEP_CALLBACK, $this, 'sleep'); + Syncroton_Registry::set(Syncroton_Registry::LOGGERBACKEND, $this->logger); + Syncroton_Registry::set(Syncroton_Registry::DATABASE, $this->get_dbh()); + Syncroton_Registry::set(Syncroton_Registry::TRANSACTIONMANAGER, kolab_sync_transaction_manager::getInstance()); + Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new kolab_sync_backend_device); + Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new kolab_sync_backend_folder); + Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new kolab_sync_backend_state); + Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new kolab_sync_backend_content); + Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new kolab_sync_backend_policy); + Syncroton_Registry::set(Syncroton_Registry::SLEEP_CALLBACK, array($this, 'sleep')); Syncroton_Registry::setContactsDataClass('kolab_sync_data_contacts'); Syncroton_Registry::setCalendarDataClass('kolab_sync_data_calendar'); @@ -168,9 +166,9 @@ Syncroton_Registry::setGALDataClass('kolab_sync_data_gal'); // Configuration - Syncroton_Registry::set(Syncroton_Registry::PING_TIMEOUT, (int) $this->config->get('activesync_ping_timeout', 60)); - Syncroton_Registry::set(Syncroton_Registry::PING_INTERVAL, (int) $this->config->get('activesync_ping_interval', 15 * 60)); - Syncroton_Registry::set(Syncroton_Registry::QUIET_TIME, (int) $this->config->get('activesync_quiet_time', 3 * 60)); + Syncroton_Registry::set(Syncroton_Registry::PING_TIMEOUT, (int) $this->config->get('activesync_ping_timeout', 60)); + Syncroton_Registry::set(Syncroton_Registry::PING_INTERVAL, (int) $this->config->get('activesync_ping_interval', 15 * 60)); + Syncroton_Registry::set(Syncroton_Registry::QUIET_TIME, (int) $this->config->get('activesync_quiet_time', 3 * 60)); Syncroton_Registry::set(Syncroton_Registry::MAX_COLLECTIONS, (int) $this->config->get('activesync_max_folders', 100)); // Run Syncroton @@ -185,7 +183,7 @@ * @param string $username User name * @param string $password User password * - * @return null|int User ID + * @param int User ID */ public function authenticate($username, $password) { @@ -195,72 +193,71 @@ $cache_key = sha1($username . '::' . $host); if (!$cache || !($auth = $cache->get($cache_key))) { - $auth = $this->plugins->exec_hook('authenticate', + $auth = $this->plugins->exec_hook('authenticate', array( 'host' => $host, 'user' => $username, 'pass' => $password, - ); + )); if (!$auth'abort' && $cache) { - $cache->set($cache_key, + $cache->set($cache_key, array( 'user' => $auth'user', 'host' => $auth'host', - ); + )); } // LDAP server failure... send 503 error - if (!empty($auth'kolab_ldap_error')) { + if ($auth'kolab_ldap_error') { self::server_error(); } // Close LDAP connection from kolab_auth plugin if (class_exists('kolab_auth', false)) { - kolab_auth::ldap_close(); + if (method_exists('kolab_auth', 'ldap_close')) { + kolab_auth::ldap_close(); + } } - } else { + } + else { $auth'pass' = $password; } - $err = null;
View file
kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_backend.php
Added
@@ -0,0 +1,1059 @@ +<?php + +/** + +--------------------------------------------------------------------------+ + | Kolab Sync (ActiveSync for Kolab) | + | | + | Copyright (C) 2011-2012, Kolab Systems AG <contact@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 published | + | by the Free Software Foundation, either version 3 of the License, or | + | (at your option) any later version. | + | | + | This program is distributed in the hope that it will be useful, | + | but WITHOUT ANY WARRANTY; without even the implied warranty of | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | + | GNU Affero General Public License for more details. | + | | + | 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/> | + +--------------------------------------------------------------------------+ + | Author: Aleksander Machniak <machniak@kolabsys.com> | + +--------------------------------------------------------------------------+ +*/ + +class kolab_sync_backend +{ + /** + * Singleton instace of kolab_sync_backend + * + * @var kolab_sync_backend + */ + static protected $instance; + + protected $storage; + protected $folder_meta; + protected $folder_uids; + protected $root_meta; + + static protected $types = array( + 1 => '', + 2 => 'mail.inbox', + 3 => 'mail.drafts', + 4 => 'mail.wastebasket', + 5 => 'mail.sentitems', + 6 => 'mail.outbox', + 7 => 'task.default', + 8 => 'event.default', + 9 => 'contact.default', + 10 => 'note.default', + 11 => 'journal.default', + 12 => 'mail', + 13 => 'event', + 14 => 'contact', + 15 => 'task', + 16 => 'journal', + 17 => 'note', + ); + + static protected $classes = array( + Syncroton_Data_Factory::CLASS_CALENDAR => 'event', + Syncroton_Data_Factory::CLASS_CONTACTS => 'contact', + Syncroton_Data_Factory::CLASS_EMAIL => 'mail', + Syncroton_Data_Factory::CLASS_NOTES => 'note', + Syncroton_Data_Factory::CLASS_TASKS => 'task', + ); + + const ROOT_MAILBOX = 'INBOX'; +// const ROOT_MAILBOX = ''; + const ASYNC_KEY = '/private/vendor/kolab/activesync'; + const UID_KEY = '/shared/vendor/cmu/cyrus-imapd/uniqueid'; + + + /** + * This implements the 'singleton' design pattern + * + * @return kolab_sync_backend The one and only instance + */ + static function get_instance() + { + if (!self::$instance) { + self::$instance = new kolab_sync_backend; + self::$instance->startup(); // init AFTER object was linked with self::$instance + } + + return self::$instance; + } + + + /** + * Class initialization + */ + public function startup() + { + $this->storage = rcube::get_instance()->get_storage(); + + // @TODO: reset cache? if we do this for every request the cache would be useless + // There's no session here + //$this->storage->clear_cache('mailboxes.', true); + + // set additional header used by libkolab + $this->storage->set_options(array( + // @TODO: there can be Roundcube plugins defining additional headers, + // we maybe would need to add them here + 'fetch_headers' => 'X-KOLAB-TYPE X-KOLAB-MIME-VERSION', + 'skip_deleted' => true, + 'threading' => false, + )); + + // Disable paging + $this->storage->set_pagesize(999999); + } + + + /** + * List known devices + * + * @return array Device list as hash array + */ + public function devices_list() + { + if ($this->root_meta === null) { + // @TODO: consider server annotation instead of INBOX + if ($meta = $this->storage->get_metadata(self::ROOT_MAILBOX, self::ASYNC_KEY)) { + $this->root_meta = $this->unserialize_metadata($metaself::ROOT_MAILBOXself::ASYNC_KEY); + } + else { + $this->root_meta = array(); + } + } + + if (!empty($this->root_meta'DEVICE') && is_array($this->root_meta'DEVICE')) { + return $this->root_meta'DEVICE'; + } + + return array(); + } + + + /** + * Get list of folders available for sync + * + * @param string $deviceid Device identifier + * @param string $type Folder type + * @param bool $flat_mode Enables flat-list mode + * + * @return array|bool List of mailbox folders, False on backend failure + */ + public function folders_list($deviceid, $type, $flat_mode = false) + { + // get all folders of specified type + $folders = kolab_storage::list_folders('', '*', $type, false, $typedata); + + // get folders activesync config + $folderdata = $this->folder_meta(); + + if (!is_array($folders) || !is_array($folderdata)) { + return false; + } + + $folders_list = array(); + + // check if folders are "subscribed" for activesync + foreach ($folderdata as $folder => $meta) { + if (empty($meta'FOLDER') || empty($meta'FOLDER'$deviceid) + || empty($meta'FOLDER'$deviceid'S') + ) { + continue; + } + + // force numeric folder name to be a string (T1283) + $folder = (string) $folder; + + if (!empty($type) && !in_array($folder, $folders)) { + continue; + } + + // Activesync folder identifier (serverId) + $folder_type = $typedata$folder ?: 'mail'; + $folder_id = self::folder_id($folder, $folder_type); + + $folders_list$folder_id = $this->folder_data($folder, $folder_type); + } + + if ($flat_mode) { + $folders_list = $this->folders_list_flat($folders_list, $type, $typedata); + } + + return $folders_list; + } + + /** + * Converts list of folders to a "flat" list + */ + private function folders_list_flat($folders, $type, $typedata) + { + $delim = $this->storage->get_hierarchy_delimiter(); + + foreach ($folders as $idx => $folder) {
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_backend_common.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_backend_common.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -61,13 +61,13 @@ * * @var array */ - protected $cache = ; + protected $cache = array(); /** * Constructor */ - public function __construct() + function __construct() { $this->db = rcube::get_instance()->get_dbh(); @@ -79,10 +79,10 @@ /** * Creates new Syncroton object in database * - * @param object $object Object + * @param Syncroton_Model_* $object Object * - * @return object Object - * @throws InvalidArgumentException|Syncroton_Exception_DeadlockDetected|Exception + * @throws InvalidArgumentException + * @return Syncroton_Model_* Object */ public function create($object) { @@ -91,27 +91,21 @@ } $data = $this->object_to_array($object); - $cols = ; + $cols = array(); - $data'id' = $object->id = sha1(mt_rand() . microtime()); + $data'id' = $object->id = sha1(mt_rand(). microtime()); foreach (array_keys($data) as $key) { $cols = $this->db->quote_identifier($key); } - $result = $this->db->query( - 'INSERT INTO `' . $this->table_name . '`' . ' (' . implode(', ', $cols) . ')' + $result = $this->db->query('INSERT INTO `' . $this->table_name . '`' . ' (' . implode(', ', $cols) . ')' . ' VALUES(' . implode(', ', array_fill(0, count($cols), '?')) . ')', array_values($data) ); - if ($err = $this->db->is_error($result)) { - $err = "Failed to save instance of {$this->interface_name}: {$err}"; - if ($this->db->error_info()0 == '40001') { - throw new Syncroton_Exception_DeadlockDetected($err); - } else { - throw new Exception($err); - } + if ($this->db->is_error($result)) { + throw new Exception('Failed to save instance of ' . $this->interface_name); } return $object; @@ -120,17 +114,16 @@ /** * Returns Syncroton data object * - * @param string $id - * + * @param string $id * @throws Syncroton_Exception_NotFound - * @return object + * @return Syncroton_Model_* */ public function get($id) { $id = $id instanceof $this->interface_name ? $id->id : $id; if ($id) { - $select = $this->db->query('SELECT * FROM `' . $this->table_name . '` WHERE `id` = ?', $id); + $select = $this->db->query('SELECT * FROM `' . $this->table_name . '` WHERE `id` = ?', array($id)); $data = $this->db->fetch_assoc($select); } @@ -144,10 +137,9 @@ /** * Deletes Syncroton data object * - * @param string|object $id Object or identifier + * @param string|Syncroton_Model_* $id Object or identifier * * @return bool True on success, False on failure - * @throws Syncroton_Exception_DeadlockDetected|Exception */ public function delete($id) { @@ -157,16 +149,7 @@ return false; } - $result = $this->db->query('DELETE FROM `' . $this->table_name . '` WHERE `id` = ?', $id); - - if ($err = $this->db->is_error($result)) { - $err = "Failed to delete instance of {$this->interface_name}: {$err}"; - if ($this->db->error_info()0 == '40001') { - throw new Syncroton_Exception_DeadlockDetected($err); - } else { - throw new Exception($err); - } - } + $result = $this->db->query('DELETE FROM `' . $this->table_name .'` WHERE `id` = ?', array($id)); return (bool) $this->db->affected_rows($result); } @@ -174,10 +157,10 @@ /** * Updates Syncroton data object * - * @param object $object + * @param Syncroton_Model_* $object * - * @return object Object - * @throws InvalidArgumentException|Syncroton_Exception_DeadlockDetected|Exception + * @throws InvalidArgumentException + * @return Syncroton_Model_* Object */ public function update($object) { @@ -186,24 +169,15 @@ } $data = $this->object_to_array($object); - $set = ; + $set = array(); foreach (array_keys($data) as $key) { $set = $this->db->quote_identifier($key) . ' = ?'; } - $result = $this->db->query('UPDATE `' . $this->table_name . '` SET ' . implode(', ', $set) + $this->db->query('UPDATE `' . $this->table_name . '` SET ' . implode(', ', $set) . ' WHERE `id` = ' . $this->db->quote($object->id), array_values($data)); - if ($err = $this->db->is_error($result)) { - $err = "Failed to update instance of {$this->interface_name}: {$err}"; - if ($this->db->error_info()0 == '40001') { - throw new Syncroton_Exception_DeadlockDetected($err); - } else { - throw new Exception($err); - } - } - return $object; } @@ -217,7 +191,6 @@ public function userAccounts($device) { // this method is overwritten by kolab_sync_backend class - return ; } /** @@ -243,7 +216,7 @@ */ protected function object_to_array($object) { - $data = ; + $data = array(); foreach ($object as $key => $value) { if ($value instanceof DateTime) {
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_backend_content.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_backend_content.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -42,7 +42,7 @@ { $id = $id instanceof Syncroton_Model_IContent ? $id->id : $id; - $result = $this->db->query("UPDATE `{$this->table_name}` SET `is_deleted` = 1 WHERE `id` = ?", $id); + $result = $this->db->query("UPDATE `{$this->table_name}` SET `is_deleted` = 1 WHERE `id` = ?", array($id)); if ($result = (bool) $this->db->affected_rows($result)) { unset($this->cache'content_folderstate'); @@ -55,7 +55,6 @@ * @param Syncroton_Model_IDevice|string $_deviceId * @param Syncroton_Model_IFolder|string $_folderId * @param string $_contentId - * * @return Syncroton_Model_IContent */ public function getContentState($_deviceId, $_folderId, $_contentId) @@ -83,15 +82,13 @@ * * @param Syncroton_Model_IDevice|string $_deviceId * @param Syncroton_Model_IFolder|string $_folderId - * @param int $syncKey - * * @return array */ - public function getFolderState($_deviceId, $_folderId, $syncKey = null) + public function getFolderState($_deviceId, $_folderId) { $deviceId = $_deviceId instanceof Syncroton_Model_IDevice ? $_deviceId->id : $_deviceId; $folderId = $_folderId instanceof Syncroton_Model_IFolder ? $_folderId->id : $_folderId; - $cachekey = $deviceId . ':' . $folderId . ':' . ($syncKey ?: '*'); + $cachekey = $deviceId . ':' . $folderId; // in Sync request we call this function twice in case when // folder state changed - use cache to skip at least one SELECT query @@ -102,12 +99,9 @@ $where = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($deviceId); $where = $this->db->quote_identifier('folder_id') . ' = ' . $this->db->quote($folderId); $where = $this->db->quote_identifier('is_deleted') . ' = 0'; - if ($syncKey) { - $where = $this->db->quote_identifier('creation_synckey') . ' < ' . $this->db->quote($syncKey + 1); - } $select = $this->db->query("SELECT `contentid` FROM `{$this->table_name}` WHERE " . implode(' AND ', $where)); - $result = ; + $result = array(); while ($state = $this->db->fetch_assoc($select)) { $result = $state'contentid'; @@ -126,8 +120,9 @@ { $deviceId = $_deviceId instanceof Syncroton_Model_IDevice ? $_deviceId->id : $_deviceId; $folderId = $_folderId instanceof Syncroton_Model_IFolder ? $_folderId->id : $_folderId; + $cachekey = $deviceId . ':' . $folderId; - unset($this->cache'content_folderstate'); + unset($this->cache'content_folderstate'$cachekey); $where = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($deviceId); $where = $this->db->quote_identifier('folder_id') . ' = ' . $this->db->quote($folderId);
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_backend_device.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_backend_device.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -32,9 +32,9 @@ protected $interface_name = 'Syncroton_Model_IDevice'; /** - * Kolab Sync storage backend + * Kolab Sync backend * - * @var kolab_sync_storage + * @var kolab_sync_backend */ protected $backend; @@ -45,7 +45,7 @@ public function __construct() { parent::__construct(); - $this->backend = kolab_sync::storage(); + $this->backend = kolab_sync_backend::get_instance(); } /** @@ -60,11 +60,11 @@ $device = parent::create($device); // Create device entry in kolab backend - $created = $this->backend->device_create( + $created = $this->backend->device_create(array( 'ID' => $device->id, 'TYPE' => $device->devicetype, 'ALIAS' => $device->friendlyname, - , $device->deviceid); + ), $device->deviceid); if (!$created) { throw new Syncroton_Exception_NotFound('Device creation failed'); @@ -135,8 +135,7 @@ $engine = kolab_sync::get_instance(); $identities = $engine->user->list_identities(); $email = $engine->get_user_email(); - $addresses = ; - $displayname = null; + $addresses = array(); // read email addresses and display name (default ident comes first) foreach ((array)$identities as $ident) { @@ -148,20 +147,20 @@ } if (empty($displayname) && empty($email) && empty($addresses)) { - return ; + return array(); } - $account = new Syncroton_Model_Account(); + $account = new Syncroton_Model_Account; if ($email) { - $addresses = array_diff($addresses, $email); + $addresses = array_diff($addresses, array($email)); } $account->userDisplayName = $displayname; $account->primaryAddress = $email; $account->addresses = array_unique($addresses); - return $account; + return array($account); } /** @@ -169,14 +168,14 @@ * * @param array $request Oof/Get request data * - * @return Syncroton_Model_Oof|null Response object or NULL if OOF is not supported + * @return Syncroton_Model_Oof Response object or NULL if OOF is not supported * @throws Syncroton_Exception_Status */ public function getOOF($request) { $vacation_engine = $this->vacation_engine(); if (!$vacation_engine) { - return null; + return; } $vacation = $vacation_engine->get_vacation(); @@ -184,7 +183,8 @@ if (!$vacation'enabled') { $status = Syncroton_Model_Oof::STATUS_DISABLED; $vacation'start' = $vacation'end' = null; - } elseif ($vacation'start' || $vacation'end') { + } + else if ($vacation'start' || $vacation'end') { // in Activesync both or none time are required if (!$vacation'start' && $vacation'end') { $vacation'start' = new DateTime('1970-01-01', new DateTimeZone('UTC')); @@ -202,37 +202,34 @@ } $status = Syncroton_Model_Oof::STATUS_TIME_BASED; - } else { + } + else { $status = Syncroton_Model_Oof::STATUS_GLOBAL; } - $message = null; - if ($vacation'message') { - $message = ; - // convert message format, Roundcube supports plain text only if ($request'bodyType' == 'HTML') { $text2html = new rcube_text2html($vacation'message'); $vacation'message' = $text2html->get_html(); } - foreach ('Internal', 'ExternalKnown', 'ExternalUnknown' as $type) { - $message = new Syncroton_Model_OofMessage( + foreach (array('Internal', 'ExternalKnown', 'ExternalUnknown') as $type) { + $message = new Syncroton_Model_OofMessage(array( "appliesTo$type" => true, 'enabled' => 1, 'bodyType' => 'Text', 'replyMessage' => rcube_charset::clean($vacation'message'), - ); + )); } } - return new Syncroton_Model_Oof( + return new Syncroton_Model_Oof(array( 'oofState' => $status, 'startTime' => $vacation'start', 'endTime' => $vacation'end', 'oofMessage' => $message, - ); + )); } /** @@ -260,7 +257,8 @@ if (empty($vacation'start') || empty($vacation'end')) { throw new Syncroton_Exception_Status_Settings(Syncroton_Exception_Status_Settings::INVALID_ARGUMENTS); } - } else { + } + else { $vacation'start' = $vacation'end' = null; } @@ -289,7 +287,7 @@ $vacation_engine->set_vacation($vacation); } // disable out-of-office - elseif (isset($request->oofState)) { + else if (isset($request->oofState)) { if ($vacation'enabled') { $vacation'enabled' = false; @@ -308,7 +306,7 @@ if (class_exists('managesieve')) { $plugin = $engine->plugins->get_plugin('managesieve'); - $vacation = $plugin->get_engine('vacation'); // @phpstan-ignore-line + $vacation = $plugin->get_engine('vacation'); if ($vacation->connect($engine->username, $engine->password)) { throw new Exception("Connection to managesieve server failed");
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_backend_folder.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_backend_folder.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -58,10 +58,10 @@ $device_id = $deviceid instanceof Syncroton_Model_IDevice ? $deviceid->id : $deviceid; $where = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($device_id); - $where = $this->db->quote_identifier('class') . ' = ' . $this->db->quote($class); + $where = $this->db->quote_identifier('class') . ' = ' . $this->db->quote($class); - $select = $this->db->query('SELECT * FROM `' . $this->table_name . '` WHERE ' . implode(' AND ', $where)); - $result = ; + $select = $this->db->query('SELECT * FROM `' . $this->table_name .'` WHERE ' . implode(' AND ', $where)); + $result = array(); while ($folder = $this->db->fetch_assoc($select)) { $result$folder'folderid' = $this->get_object($folder); @@ -83,7 +83,7 @@ $device_id = $deviceid instanceof Syncroton_Model_IDevice ? $deviceid->id : $deviceid; $where = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($device_id); - $where = $this->db->quote_identifier('folderid') . ' = ' . $this->db->quote($folderid); + $where = $this->db->quote_identifier('folderid') . ' = ' . $this->db->quote($folderid); $select = $this->db->query('SELECT * FROM `' . $this->table_name . '` WHERE ' . implode(' AND ', $where)); $folder = $this->db->fetch_assoc($select); @@ -107,15 +107,15 @@ $timestamp = new DateTime('now', new DateTimeZone('utc')); $client_crc = ''; $server_crc = ''; - $client_folders = ; - $server_folders = ; - $folder_classes = + $client_folders = array(); + $server_folders = array(); + $folder_classes = array( Syncroton_Data_Factory::CLASS_CALENDAR, Syncroton_Data_Factory::CLASS_CONTACTS, Syncroton_Data_Factory::CLASS_EMAIL, Syncroton_Data_Factory::CLASS_NOTES, - Syncroton_Data_Factory::CLASS_TASKS, - ; + Syncroton_Data_Factory::CLASS_TASKS + ); // Reset imap cache so we work with up-to-date folders list rcube::get_instance()->get_storage()->clear_cache('mailboxes', true); @@ -125,7 +125,8 @@ // retrieve all folders available in data backend $dataController = Syncroton_Data_Factory::factory($class, $device, $timestamp); $server_folders = array_merge($server_folders, $dataController->getAllFolders()); - } catch (Exception $e) { + } + catch (Exception $e) { rcube::raise_error($e, true, false); // This is server error, returning True might cause infinite sync loops return false; @@ -163,10 +164,15 @@ case 'displayName': case 'parentId': return strtolower($string); + break; + case 'serverId': return 'folderid'; + break; + default: return parent::from_camelcase($string); + break; } } @@ -179,12 +185,19 @@ switch ($string) { case 'displayname': return 'displayName'; + break; + case 'parentid': return 'parentId'; + break; + case 'folderid': return 'serverId'; + break; + default: return parent::to_camelcase($string, $ucFirst); + break; } } }
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_backend_policy.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_backend_policy.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | |
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_backend_state.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_backend_state.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -41,7 +41,6 @@ */ public function create($object, $keep_previous_state = true) { - unset($object->counterNext); $object = parent::create($object); if ($keep_previous_state !== true) { @@ -58,9 +57,9 @@ protected function _deleteOtherStates(Syncroton_Model_ISyncState $state) { // remove all other synckeys - $where = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($state->deviceId); - $where = $this->db->quote_identifier('type') . ' = ' . $this->db->quote($state->type); - $where = $this->db->quote_identifier('counter') . ' <> ' . $this->db->quote($state->counter); + $where = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($state->deviceId); + $where = $this->db->quote_identifier('type') . ' = ' . $this->db->quote($state->type); + $where = $this->db->quote_identifier('counter') . ' <> ' . $this->db->quote($state->counter); $this->db->query("DELETE FROM `{$this->table_name}` WHERE " . implode(' AND ', $where)); } @@ -110,7 +109,7 @@ $folder_id = $folderid instanceof Syncroton_Model_IFolder ? $folderid->id : $folderid; $where = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($device_id); - $where = $this->db->quote_identifier('type') . ' = ' . $this->db->quote($folder_id); + $where = $this->db->quote_identifier('type') . ' = ' . $this->db->quote($folder_id); $select = $this->db->limitquery("SELECT * FROM `{$this->table_name}` WHERE " . implode(' AND ', $where) . " ORDER BY `counter` DESC", 0, 1); @@ -136,7 +135,7 @@ $folder_id = $folderid instanceof Syncroton_Model_IFolder ? $folderid->id : $folderid; $where = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($device_id); - $where = $this->db->quote_identifier('type') . ' = ' . $this->db->quote($folder_id); + $where = $this->db->quote_identifier('type') . ' = ' . $this->db->quote($folder_id); $this->db->query("DELETE FROM `{$this->table_name}` WHERE " . implode(' AND ', $where)); } @@ -148,19 +147,19 @@ * @param Syncroton_Model_IFolder|string $folderid Folder object or identifier * @param int $sync_key State key * - * @return Syncroton_Model_SyncState|false + * @return Syncroton_Model_SyncState */ public function validate($deviceid, $folderid, $sync_key) { $device_id = $deviceid instanceof Syncroton_Model_IDevice ? $deviceid->id : $deviceid; $folder_id = $folderid instanceof Syncroton_Model_IFolder ? $folderid->id : $folderid; - $states = ; + $states = array(); // get sync data // we'll get all records, thanks to this we'll be able to // skip _deleteOtherStates() call below (one DELETE query less) $where'device_id' = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($device_id); - $where'type' = $this->db->quote_identifier('type') . ' = ' . $this->db->quote($folder_id); + $where'type' = $this->db->quote_identifier('type') . ' = ' . $this->db->quote($folder_id); $select = $this->db->query("SELECT * FROM `{$this->table_name}` WHERE " . implode(' AND ', $where)); @@ -176,33 +175,26 @@ $state = $states$sync_key; $next = max(array_keys($states)); - $where = ; - $where'device_id' = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($device_id); - $where'folder_id' = $this->db->quote_identifier('folder_id') . ' = ' . $this->db->quote($folder_id); + $where = array(); + $where'device_id' = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($device_id); + $where'folder_id' = $this->db->quote_identifier('folder_id') . ' = ' . $this->db->quote($folder_id); $where'is_deleted' = $this->db->quote_identifier('is_deleted') . ' = 1'; - // found more recent synckey => the last sync response was not received by the client + // found more recent synckey => the last sync response got not received by the client if ($next > $sync_key) { - // We store the clientIdMap with the "next" sync state, so we need to copy it back. - $state->clientIdMap = $states$next->clientIdMap; - $state->counterNext = $next; - } else { - // finally delete all entries marked for removal in syncroton_content table - $retryCounter = 0; - while (true) { - $result = $this->db->query("DELETE FROM `syncroton_content` WHERE " . implode(' AND ', $where)); - if ($this->db->is_error($result)) { - $retryCounter++; - // Retry on deadlock - if ($this->db->error_info()0 != '40001' || $retryCounter > 60) { - throw new Exception('Failed to delete entries in sync_key check'); - } - } else { - break; - } - //Give the other transactions some time before we try again - sleep(1); - } + $where'synckey' = $this->db->quote_identifier('creation_synckey') . ' = ' . $this->db->quote($state->counter); + // undelete entries marked as deleted in syncroton_content table + $this->db->query("UPDATE `syncroton_content` SET `is_deleted` = 0 WHERE " . implode(' AND ', $where)); + + // remove entries added during latest sync in syncroton_content table + unset($where'is_deleted'); + $where'synckey' = $this->db->quote_identifier('creation_synckey') . ' > ' . $this->db->quote($state->counter); + + $this->db->query("DELETE FROM `syncroton_content` WHERE " . implode(' AND ', $where)); + } + else { + // finaly delete all entries marked for removal in syncroton_content table + $this->db->query("DELETE FROM `syncroton_content` WHERE " . implode(' AND ', $where)); } // remove all other synckeys @@ -212,18 +204,4 @@ return $state; } - - public function haveNext($deviceid, $folderid, $sync_key) - { - $device_id = $deviceid instanceof Syncroton_Model_IDevice ? $deviceid->id : $deviceid; - $folder_id = $folderid instanceof Syncroton_Model_IFolder ? $folderid->id : $folderid; - - $where'device_id' = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($device_id); - $where'type' = $this->db->quote_identifier('type') . ' = ' . $this->db->quote($folder_id); - $where'counter' = $this->db->quote_identifier('counter') . ' > ' . $this->db->quote($sync_key); - - $select = $this->db->query("SELECT id FROM `{$this->table_name}` WHERE " . implode(' AND ', $where)); - return $this->db->num_rows($select) > 0; - } - }
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_body_converter.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_body_converter.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -60,14 +60,14 @@ // ActiveSync types: TYPE_PLAINTEXT, TYPE_HTML, TYPE_RTF, TYPE_MIME switch ($this->type) { - case Syncroton_Model_EmailBody::TYPE_PLAINTEXT: - return $this->convert_plain($type); - case Syncroton_Model_EmailBody::TYPE_HTML: - return $this->convert_html($type); - case Syncroton_Model_EmailBody::TYPE_RTF: - return $this->convert_rtf($type); - default: - return $this->text; + case Syncroton_Model_EmailBody::TYPE_PLAINTEXT: + return $this->convert_text_plain($type); + case Syncroton_Model_EmailBody::TYPE_HTML: + return $this->convert_text_html($type); + case Syncroton_Model_EmailBody::TYPE_RTF: + return $this->convert_rtf($type); + default: + return $this->text; } } @@ -79,16 +79,16 @@ * * @return string Body value */ - protected function convert_plain($type) + protected function convert_text_plain($type) { $data = $this->text; switch ($type) { - case Syncroton_Model_EmailBody::TYPE_HTML: - return '<pre>' . htmlspecialchars($data, ENT_COMPAT, kolab_sync::CHARSET) . '</pre>'; - case Syncroton_Model_EmailBody::TYPE_RTF: - // @TODO - return ''; + case Syncroton_Model_EmailBody::TYPE_HTML: + return '<pre>' . htmlspecialchars($data, ENT_COMPAT, kolab_sync::CHARSET) . '</pre>'; + case Syncroton_Model_EmailBody::TYPE_RTF: + // @TODO + return ''; } return $data; @@ -102,17 +102,17 @@ * * @return string Body value */ - protected function convert_html($type) + protected function convert_text_html($type) { switch ($type) { - case Syncroton_Model_EmailBody::TYPE_PLAINTEXT: - $txt = new rcube_html2text($this->text, false, true); - return $txt->get_text(); - case Syncroton_Model_EmailBody::TYPE_RTF: - // @TODO - return ''; - case Syncroton_Model_EmailBody::TYPE_MIME: - return ''; + case Syncroton_Model_EmailBody::TYPE_PLAINTEXT: + $txt = new rcube_html2text($this->text, false, true); + return $txt->get_text(); + case Syncroton_Model_EmailBody::TYPE_RTF: + // @TODO + return ''; + case Syncroton_Model_EmailBody::TYPE_MIME: + return ''; } return $this->text; @@ -128,28 +128,20 @@ */ protected function convert_rtf($type) { + $rtf = new rtf(); + $rtf->loadrtf($this->text); + switch ($type) { - case Syncroton_Model_EmailBody::TYPE_PLAINTEXT: - try { - $document = new RtfHtmlPhp\Document($this->text); - $formatter = new RtfHtmlPhp\Html\HtmlFormatter(RCUBE_CHARSET); - $txt = new rcube_html2text($formatter->format($document), false, true); - return $txt->get_text(); - } catch (Exception $e) { - $logger = Syncroton_Registry::get('loggerBackend'); - $logger->warn("Failed to convert RTF content"); - return ''; - } - case Syncroton_Model_EmailBody::TYPE_HTML: - try { - $document = new RtfHtmlPhp\Document($this->text); - $formatter = new RtfHtmlPhp\Html\HtmlFormatter(RCUBE_CHARSET); - return $formatter->format($document); - } catch (Exception $e) { - $logger = Syncroton_Registry::get('loggerBackend'); - $logger->warn("Failed to convert RTF content"); - return ''; - } + case Syncroton_Model_EmailBody::TYPE_PLAINTEXT: + $rtf->output('ascii'); + $rtf->parse(); + return $rtf->out; + case Syncroton_Model_EmailBody::TYPE_HTML: + // @TODO: Conversion to HTML is broken, + // convert to text and use <PRE> tags + $rtf->output('ascii'); + $rtf->parse(); + return '<pre>' . trim($rtf->out) . '</pre>'; } return $this->text;
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_data.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_data.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -31,18 +31,11 @@ /** * ActiveSync protocol version * - * @var float + * @var int */ protected $asversion = 0; /** - * The storage backend - * - * @var kolab_sync_storage - */ - protected $backend; - - /** * information about the current device * * @var Syncroton_Model_IDevice @@ -78,13 +71,6 @@ protected $defaultFolder; /** - * default root folder - * - * @var string - */ - protected $defaultRootFolder; - - /** * type of user created folders * * @var int @@ -92,17 +78,24 @@ protected $folderType; /** - * Internal cache for storage folders list + * Internal cache for kolab_storage folder objects * * @var array */ - protected $folders = ; + protected $folders = array(); /** - * Logger instance. + * Internal cache for IMAP folders list * - * @var kolab_sync_logger + * @var array */ + protected $imap_folders = array(); + + /** + * Logger instance. + * + * @var kolab_sync_logger + */ protected $logger; /** @@ -117,7 +110,7 @@ * * @var array */ - protected $ext_devices = + protected $ext_devices = array( 'iphone', 'ipad', 'thundertine', @@ -125,50 +118,47 @@ 'wp', 'wp8', 'playbook', - ; - - protected $lastsync_folder = null; - protected $lastsync_time = null; + ); - public const RESULT_OBJECT = 0; - public const RESULT_UID = 1; - public const RESULT_COUNT = 2; + const RESULT_OBJECT = 0; + const RESULT_UID = 1; + const RESULT_COUNT = 2; /** * Recurrence types */ - public const RECUR_TYPE_DAILY = 0; // Recurs daily. - public const RECUR_TYPE_WEEKLY = 1; // Recurs weekly - public const RECUR_TYPE_MONTHLY = 2; // Recurs monthly - public const RECUR_TYPE_MONTHLY_DAYN = 3; // Recurs monthly on the nth day - public const RECUR_TYPE_YEARLY = 5; // Recurs yearly - public const RECUR_TYPE_YEARLY_DAYN = 6; // Recurs yearly on the nth day + const RECUR_TYPE_DAILY = 0; // Recurs daily. + const RECUR_TYPE_WEEKLY = 1; // Recurs weekly + const RECUR_TYPE_MONTHLY = 2; // Recurs monthly + const RECUR_TYPE_MONTHLY_DAYN = 3; // Recurs monthly on the nth day + const RECUR_TYPE_YEARLY = 5; // Recurs yearly + const RECUR_TYPE_YEARLY_DAYN = 6; // Recurs yearly on the nth day /** * Day of week constants */ - public const RECUR_DOW_SUNDAY = 1; - public const RECUR_DOW_MONDAY = 2; - public const RECUR_DOW_TUESDAY = 4; - public const RECUR_DOW_WEDNESDAY = 8; - public const RECUR_DOW_THURSDAY = 16; - public const RECUR_DOW_FRIDAY = 32; - public const RECUR_DOW_SATURDAY = 64; - public const RECUR_DOW_LAST = 127; // The last day of the month. Used as a special value in monthly or yearly recurrences. + const RECUR_DOW_SUNDAY = 1; + const RECUR_DOW_MONDAY = 2; + const RECUR_DOW_TUESDAY = 4; + const RECUR_DOW_WEDNESDAY = 8; + const RECUR_DOW_THURSDAY = 16; + const RECUR_DOW_FRIDAY = 32; + const RECUR_DOW_SATURDAY = 64; + const RECUR_DOW_LAST = 127; // The last day of the month. Used as a special value in monthly or yearly recurrences. /** * Mapping of recurrence types * * @var array */ - protected $recurTypeMap = + protected $recurTypeMap = array( self::RECUR_TYPE_DAILY => 'DAILY', self::RECUR_TYPE_WEEKLY => 'WEEKLY', self::RECUR_TYPE_MONTHLY => 'MONTHLY', self::RECUR_TYPE_MONTHLY_DAYN => 'MONTHLY', self::RECUR_TYPE_YEARLY => 'YEARLY', self::RECUR_TYPE_YEARLY_DAYN => 'YEARLY', - ; + ); /** * Mapping of weekdays @@ -176,7 +166,7 @@ * * @var array */ - protected $recurDayMap = + protected $recurDayMap = array( 'SU' => self::RECUR_DOW_SUNDAY, 'MO' => self::RECUR_DOW_MONDAY, 'TU' => self::RECUR_DOW_TUESDAY, @@ -184,7 +174,7 @@ 'TH' => self::RECUR_DOW_THURSDAY, 'FR' => self::RECUR_DOW_FRIDAY, 'SA' => self::RECUR_DOW_SATURDAY, - ; + ); /** @@ -195,10 +185,10 @@ */ public function __construct(Syncroton_Model_IDevice $device, DateTime $syncTimeStamp) { - $this->backend = kolab_sync::storage(); + $this->backend = kolab_sync_backend::get_instance(); $this->device = $device; $this->asversion = floatval($device->acsversion); - $this->syncTimeStamp = $this->backend->syncTimeStamp = $syncTimeStamp; + $this->syncTimeStamp = $syncTimeStamp; $this->logger = Syncroton_Registry::get(Syncroton_Registry::LOGGERBACKEND); $this->defaultRootFolder = $this->defaultFolder . '::Syncroton'; @@ -207,7 +197,8 @@ try { $this->timezone = rcube::get_instance()->config->get('timezone', 'GMT'); kolab_format::$timezone = new DateTimeZone($this->timezone); - } catch (Exception $e) { + } + catch (Exception $e) { //rcube::raise_error($e, true); $this->timezone = 'GMT'; kolab_format::$timezone = new DateTimeZone('GMT'); @@ -221,14 +212,15 @@ */ public function getAllFolders() { - $list = ; + $list = array(); // device supports multiple folders ?
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_data_calendar.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_data_calendar.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -31,7 +31,7 @@ /** * Mapping from ActiveSync Calendar namespace fields */ - protected $mapping = + protected $mapping = array( 'allDayEvent' => 'allday', 'startTime' => 'start', // keep it before endTime here //'attendees' => 'attendees', @@ -54,7 +54,7 @@ 'subject' => 'title', //'timezone' => 'timezone', 'uID' => 'uid', - ; + ); /** * Kolab object type @@ -87,59 +87,51 @@ /** * attendee status */ - public const ATTENDEE_STATUS_UNKNOWN = 0; - public const ATTENDEE_STATUS_TENTATIVE = 2; - public const ATTENDEE_STATUS_ACCEPTED = 3; - public const ATTENDEE_STATUS_DECLINED = 4; - public const ATTENDEE_STATUS_NOTRESPONDED = 5; + const ATTENDEE_STATUS_UNKNOWN = 0; + const ATTENDEE_STATUS_TENTATIVE = 2; + const ATTENDEE_STATUS_ACCEPTED = 3; + const ATTENDEE_STATUS_DECLINED = 4; + const ATTENDEE_STATUS_NOTRESPONDED = 5; /** * attendee types */ - public const ATTENDEE_TYPE_REQUIRED = 1; - public const ATTENDEE_TYPE_OPTIONAL = 2; - public const ATTENDEE_TYPE_RESOURCE = 3; + const ATTENDEE_TYPE_REQUIRED = 1; + const ATTENDEE_TYPE_OPTIONAL = 2; + const ATTENDEE_TYPE_RESOURCE = 3; /** * busy status constants */ - public const BUSY_STATUS_FREE = 0; - public const BUSY_STATUS_TENTATIVE = 1; - public const BUSY_STATUS_BUSY = 2; - public const BUSY_STATUS_OUTOFOFFICE = 3; + const BUSY_STATUS_FREE = 0; + const BUSY_STATUS_TENTATIVE = 1; + const BUSY_STATUS_BUSY = 2; + const BUSY_STATUS_OUTOFOFFICE = 3; /** * Sensitivity values */ - public const SENSITIVITY_NORMAL = 0; - public const SENSITIVITY_PERSONAL = 1; - public const SENSITIVITY_PRIVATE = 2; - public const SENSITIVITY_CONFIDENTIAL = 3; + const SENSITIVITY_NORMAL = 0; + const SENSITIVITY_PERSONAL = 1; + const SENSITIVITY_PRIVATE = 2; + const SENSITIVITY_CONFIDENTIAL = 3; - /** - * Internal iTip states - */ - public const ITIP_ACCEPTED = 'ACCEPTED'; - public const ITIP_DECLINED = 'DECLINED'; - public const ITIP_TENTATIVE = 'TENTATIVE'; - public const ITIP_CANCELLED = 'CANCELLED'; - - public const KEY_DTSTAMP = 'x-custom.X-ACTIVESYNC-DTSTAMP'; - public const KEY_REPLYTIME = 'x-custom.X-ACTIVESYNC-REPLYTIME'; + const KEY_DTSTAMP = 'x-custom.X-ACTIVESYNC-DTSTAMP'; + const KEY_RESPONSE_DTSTAMP = 'x-custom.X-ACTIVESYNC-RESPONSE-DTSTAMP'; /** * Mapping of attendee status * * @var array */ - protected $attendeeStatusMap = + protected $attendeeStatusMap = array( 'UNKNOWN' => self::ATTENDEE_STATUS_UNKNOWN, 'TENTATIVE' => self::ATTENDEE_STATUS_TENTATIVE, 'ACCEPTED' => self::ATTENDEE_STATUS_ACCEPTED, 'DECLINED' => self::ATTENDEE_STATUS_DECLINED, 'DELEGATED' => self::ATTENDEE_STATUS_UNKNOWN, 'NEEDS-ACTION' => self::ATTENDEE_STATUS_NOTRESPONDED, - ; + ); /** * Mapping of attendee type @@ -147,35 +139,35 @@ * NOTE: recurrences need extra handling! * @var array */ - protected $attendeeTypeMap = + protected $attendeeTypeMap = array( 'REQ-PARTICIPANT' => self::ATTENDEE_TYPE_REQUIRED, 'OPT-PARTICIPANT' => self::ATTENDEE_TYPE_OPTIONAL, // 'NON-PARTICIPANT' => self::ATTENDEE_TYPE_RESOURCE, // 'CHAIR' => self::ATTENDEE_TYPE_RESOURCE, - ; + ); /** * Mapping of busy status * * @var array */ - protected $busyStatusMap = + protected $busyStatusMap = array( 'free' => self::BUSY_STATUS_FREE, 'tentative' => self::BUSY_STATUS_TENTATIVE, 'busy' => self::BUSY_STATUS_BUSY, 'outofoffice' => self::BUSY_STATUS_OUTOFOFFICE, - ; + ); /** * mapping of sensitivity * * @var array */ - protected $sensitivityMap = + protected $sensitivityMap = array( 'public' => self::SENSITIVITY_PERSONAL, 'private' => self::SENSITIVITY_PRIVATE, 'confidential' => self::SENSITIVITY_CONFIDENTIAL, - ; + ); /** @@ -183,72 +175,77 @@ * * @param Syncroton_Model_SyncCollection $collection Collection data * @param string $serverId Local entry identifier - * @param bool $as_array Return entry as array + * @param boolean $as_array Return entry as array * - * @return array|Syncroton_Model_Event Event object + * @return array|Syncroton_Model_Event|array Event object */ public function getEntry(Syncroton_Model_SyncCollection $collection, $serverId, $as_array = false) { $event = is_array($serverId) ? $serverId : $this->getObject($collection->collectionId, $serverId); - $config = $this->getFolderConfig($event'folderId'); - $result = ; - - $is_outlook = stripos($this->device->devicetype, 'outlook') !== false; - $is_android = stripos($this->device->devicetype, 'android') !== false; + $config = $this->getFolderConfig($event'_mailbox'); + $result = array(); + // Timezone // Kolab Format 3.0 and xCal does support timezone per-date, but ActiveSync allows // only one timezone per-event. We'll use timezone of the start date - $result'timezone' = kolab_sync_timezone_converter::encodeTimezoneFromDate($event'start'); + if ($event'start' instanceof DateTime) { + $timezone = $event'start'->getTimezone(); + + if ($timezone && ($tz_name = $timezone->getName()) != 'UTC') { + $tzc = kolab_sync_timezone_converter::getInstance(); + + if ($tz_name = $tzc->encodeTimezone($tz_name)) { + $result'timezone' = $tz_name; + } + } + } // Calendar namespace fields foreach ($this->mapping as $key => $name) { $value = $this->getKolabDataItem($event, $name); switch ($name) { - case 'changed': - case 'end': - case 'start': - // For all-day events Kolab uses different times - // At least Android doesn't display such event as all-day event - if ($value && is_a($value, 'DateTime')) { - $date = clone $value; - if (!empty($event'allday')) { - // need this for self::date_from_kolab() - $date->_dateonly = false; // @phpstan-ignore-line
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_data_contacts.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_data_contacts.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -31,7 +31,7 @@ /** * Mapping from ActiveSync Contacts namespace fields */ - protected $mapping = + protected $mapping = array( 'anniversary' => 'anniversary', 'assistantName' => 'assistant:0', //'assistantPhoneNumber' => 'assistantphonenumber', @@ -94,7 +94,7 @@ 'managerName' => 'manager:0', //'mMS' => 'mms', 'nickName' => 'nickname', - ; + ); /** * Kolab object type @@ -149,13 +149,11 @@ * * @param Syncroton_Model_SyncCollection $collection Collection data * @param string $serverId Local entry identifier - * - * @return array|Syncroton_Model_Contact Contact object */ public function getEntry(Syncroton_Model_SyncCollection $collection, $serverId) { $data = is_array($serverId) ? $serverId : $this->getObject($collection->collectionId, $serverId); - $result = ; + $result = array(); if (empty($data)) { throw new Syncroton_Exception_NotFound("Contact $serverId not found"); @@ -166,23 +164,23 @@ $value = $this->getKolabDataItem($data, $name); switch ($name) { - case 'photo': - if ($value) { - // ActiveSync limits photo size to 48KB (of base64 encoded string) - if (strlen($value) * 1.33 > 48 * 1024) { - continue 2; - } + case 'photo': + if ($value) { + // ActiveSync limits photo size to 48KB (of base64 encoded string) + if (strlen($value) * 1.33 > 48 * 1024) { + continue 2; } - break; + } + break; - case 'birthday': - case 'anniversary': - $value = self::date_from_kolab($value); - break; + case 'birthday': + case 'anniversary': + $value = self::date_from_kolab($value); + break; - case 'notes': - $value = $this->body_from_kolab($value, $collection); - break; + case 'notes': + $value = $this->body_from_kolab($value, $collection); + break; } if (empty($value) || is_array($value)) { @@ -193,14 +191,13 @@ } // email address(es): email1Address, email2Address, email3Address - for ($x = 0; $x < 3; $x++) { - if (!empty($data'email'$x)) { - $email = $data'email'$x; + for ($x=0; $x<3; $x++) { + if ($email = $data'email'$x) { if (is_array($email)) { $email = $email'address'; } if ($email) { - $result'email' . ($x + 1) . 'Address' = $email; + $result'email' . ($x+1) . 'Address' = $email; } } } @@ -211,67 +208,67 @@ /** * convert contact from xml to libkolab array * - * @param Syncroton_Model_Contact $data Contact to convert - * @param string $folderId Folder identifier - * @param array $entry Existing entry + * @param Syncroton_Model_IEntry $data Contact to convert + * @param string $folderId Folder identifier + * @param array $entry Existing entry * * @return array Kolab object array */ - public function toKolab($data, $folderId, $entry = null) + public function toKolab(Syncroton_Model_IEntry $data, $folderId, $entry = null) { - $contact = !empty($entry) ? $entry : ; + $contact = !empty($entry) ? $entry : array(); // Contacts namespace fields foreach ($this->mapping as $key => $name) { $value = $data->$key; switch ($name) { - case 'address.work.street': - if (strtolower($this->device->devicetype) == 'palm') { - // palm pre sends the whole address in the <Contacts:BusinessStreet> tag - $value = null; - } - break; + case 'address.work.street': + if (strtolower($this->device->devicetype) == 'palm') { + // palm pre sends the whole address in the <Contacts:BusinessStreet> tag + $value = null; + } + break; - case 'website.homepage.url': - // remove facebook urls - if (preg_match('/^fb:\/\//', $value)) { - $value = null; - } - break; + case 'website.homepage.url': + // remove facebook urls + if (preg_match('/^fb:\/\//', $value)) { + $value = null; + } + break; - case 'notes': - $value = $this->getBody($value, Syncroton_Model_EmailBody::TYPE_PLAINTEXT); - // If note isn't specified keep old note - if ($value === null) { - continue 2; - } - break; + case 'notes': + $value = $this->getBody($value, Syncroton_Model_EmailBody::TYPE_PLAINTEXT); + // If note isn't specified keep old note + if ($value === null) { + continue 2; + } + break; - case 'photo': - // If photo isn't specified keep old photo - if ($value === null) { - continue 2; - } - break; - - case 'birthday': - case 'anniversary': - if ($value) { - // convert date to string format, so libkolab will store - // it with no time and timezone what could be incorrectly re-calculated (#2555) - $value = $value->format('Y-m-d'); - } - break; + case 'photo': + // If photo isn't specified keep old photo + if ($value === null) { + continue 2; + } + break; + + case 'birthday': + case 'anniversary': + if ($value) { + // convert date to string format, so libkolab will store + // it with no time and timezone what could be incorrectly re-calculated (#2555) + $value = $value->format('Y-m-d'); + } + break; } $this->setKolabDataItem($contact, $name, $value); } // email address(es): email1Address, email2Address, email3Address - $emails = ; - for ($x = 0; $x < 3; $x++) {
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_data_email.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_data_email.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -28,12 +28,12 @@ */ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_IDataSearch { - public const MAX_SEARCH_RESULT = 200; + const MAX_SEARCH_RESULT = 200; /** * Mapping from ActiveSync Email namespace fields */ - protected $mapping = + protected $mapping = array( 'cc' => 'cc', //'contentClass' => 'contentclass', 'dateReceived' => 'internaldate', @@ -48,22 +48,22 @@ 'subject' => 'subject', //'threadTopic' => 'threadtopic', 'to' => 'to', - ; + ); - public static $memory_accumulated = 0; + static $memory_accumulated = 0; /** * Special folder type/name map * * @var array */ - protected $folder_types = + protected $folder_types = array( 2 => 'Inbox', 3 => 'Drafts', 4 => 'Deleted Items', 5 => 'Sent Items', 6 => 'Outbox', - ; + ); /** * Kolab object type @@ -93,8 +93,6 @@ */ protected $folderType = Syncroton_Command_FolderSync::FOLDERTYPE_MAIL_USER_CREATED; - protected $storage; - /** * the constructor @@ -110,52 +108,10 @@ // Outlook 2013 support multi-folder $this->ext_devices = 'windowsoutlook15'; - } - - /** - * Encode a globalObjId according to https://interoperability.blob.core.windows.net/files/MS-ASEMAIL/%5bMS-ASEMAIL%5d-150526.pdf 2.2.2.3 - * - * @param array $data An array with the data to encode - * - * @return string the encoded globalObjId - */ - public static function encodeGlobalObjId(array $data): string - { - $classid = "040000008200e00074c5b7101a82e008"; - if (!empty($data'data')) { - $payload = $data'data'; - } else { - $uid = $data'uid'; - $payload = "vCal-Uid\1\0\0\0{$uid}\0"; - } - - $packed = pack( - "H32nCCPx8Va*", - $classid, - $data'year' ?? 0, - $data'month' ?? 0, - $data'day' ?? 0, - $data'now' ?? 0, - strlen($payload), - $payload - ); - return base64_encode($packed); - } - - /** - * Decode a globalObjId according to https://interoperability.blob.core.windows.net/files/MS-ASEMAIL/%5bMS-ASEMAIL%5d-150526.pdf 2.2.2.3 - * - * @param string $globalObjId The encoded globalObjId - * - * @return array An array with the decoded data - */ - public static function decodeGlobalObjId(string $globalObjId): array - { - $unpackString = 'H32classid/nyear/Cmonth/Cday/Pnow/x8/Vbytecount/a*data'; - $decoded = unpack($unpackString, base64_decode($globalObjId)); - $decoded'uid' = substr($decoded'data', strlen("vCal-Uid\1\0\0\0"), -1); - return $decoded; + if ($this->asversion >= 14) { + $this->tag_categories = true; + } } /** @@ -186,31 +142,31 @@ $value = null; switch ($name) { - case 'internaldate': - $value = self::date_from_kolab(rcube_utils::strtotime($headers->internaldate)); - break; + case 'internaldate': + $value = self::date_from_kolab(rcube_utils::strtotime($headers->internaldate)); + break; - case 'cc': - case 'to': - case 'replyto': - case 'from': - $addresses = rcube_mime::decode_address_list($headers->$name, null, true, $headers->charset); + case 'cc': + case 'to': + case 'replyto': + case 'from': + $addresses = rcube_mime::decode_address_list($headers->$name, null, true, $headers->charset); - foreach ($addresses as $idx => $part) { - // @FIXME: set name + address or address only? - $addresses$idx = format_email_recipient($part'mailto', $part'name'); - } + foreach ($addresses as $idx => $part) { + // @FIXME: set name + address or address only? + $addresses$idx = format_email_recipient($part'mailto', $part'name'); + } - $value = implode(',', $addresses); - break; + $value = implode(',', $addresses); + break; - case 'subject': - $value = $headers->get('subject'); - break; + case 'subject': + $value = $headers->get('subject'); + break; - case 'charset': - $value = self::charset_to_cp($headers->charset); - break; + case 'charset': + $value = self::charset_to_cp($headers->charset); + break; } if (empty($value) || is_array($value)) { @@ -224,8 +180,8 @@ $result$key = $value; } - // $result'ConversationId' = 'FF68022058BD485996BE15F6F6D99320'; - // $result'ConversationIndex' = 'CA2CFA8A23'; +// $result'ConversationId' = 'FF68022058BD485996BE15F6F6D99320'; +// $result'ConversationIndex' = 'CA2CFA8A23'; // Read flag $result'read' = intval(!empty($headers->flags'SEEN')); @@ -233,10 +189,10 @@ // Flagged message if (!empty($headers->flags'FLAGGED')) { // Use FollowUp flag which is used in Android when message is marked with a star - $result'flag' = new Syncroton_Model_EmailFlag( + $result'flag' = new Syncroton_Model_EmailFlag(array( 'flagType' => 'FollowUp', 'status' => Syncroton_Model_EmailFlag::STATUS_ACTIVE, - ); + )); } else { $result'flag' = new Syncroton_Model_EmailFlag(); } @@ -245,8 +201,9 @@ if ($headers->priority) { if ($headers->priority < 3) { $result'importance' = 2; // High - } elseif ($headers->priority > 3) { - $result'importance' = 0; // Low + } + else if ($headers->priority > 3) { + $result'importance' = 0; // Low
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_data_gal.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_data_gal.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -28,26 +28,26 @@ */ class kolab_sync_data_gal extends kolab_sync_data implements Syncroton_Data_IDataSearch { - public const MAX_SEARCH_RESULT = 100; + const MAX_SEARCH_RESULT = 100; /** * LDAP search result * * @var array */ - protected $result = ; + protected $result = array(); /** * LDAP address books list * * @var array */ - public static $address_books = ; + public static $address_books = array(); /** * Mapping from ActiveSync Contacts namespace fields */ - protected $mapping = + protected $mapping = array( 'alias' => 'nickname', 'company' => 'organization', 'displayName' => 'name', @@ -59,7 +59,7 @@ 'picture' => 'photo', 'phone' => 'phone', 'title' => 'jobtitle', - ; + ); /** * Kolab object type @@ -103,9 +103,8 @@ // Use configured fields mapping $rcube = rcube::get_instance(); $fieldmap = (array) $rcube->config->get('activesync_gal_fieldmap'); - if (!empty($fieldmap)) { - $fieldmap = array_intersect_key($fieldmap, array_keys($this->mapping)); + $fieldmap = array_intersec_key($fieldmap, array_keys($this->mapping)); $this->mapping = array_merge($this->mapping, $fieldmap); } } @@ -113,19 +112,15 @@ /** * Not used but required by parent class */ - public function toKolab($data, $folderId, $entry = null) + public function toKolab(Syncroton_Model_IEntry $data, $folderId, $entry = null) { - return ; } /** * Not used but required by parent class - * - * @return array|Syncroton_Model_Contact Contact object */ public function getEntry(Syncroton_Model_SyncCollection $collection, $serverId) { - throw new Syncroton_Exception_NotFound("getEntry() on GAL is not implemented"); } /** @@ -138,7 +133,7 @@ */ public function getSearchEntry($data, $options) { - $result = ; + $result = array(); // Contacts namespace fields foreach ($this->mapping as $key => $name) { @@ -149,24 +144,24 @@ } switch ($name) { - case 'photo': - // @TODO: MaxPictures option - // ActiveSync limits photo size of GAL contact to 100KB - $maxsize = 102400; - if (!empty($options'picture''maxSize')) { - $maxsize = min($maxsize, $options'picture''maxSize'); - } - - if (strlen($value) > $maxsize) { - continue 2; - } - - $value = new Syncroton_Model_GALPicture( - 'data' => $value, // binary - 'status' => Syncroton_Model_GALPicture::STATUS_SUCCESS, - ); - - break; + case 'photo': + // @TODO: MaxPictures option + // ActiveSync limits photo size of GAL contact to 100KB + $maxsize = 102400; + if (!empty($options'picture''maxSize')) { + $maxsize = min($maxsize, $options'picture''maxSize'); + } + + if (strlen($value) > $maxsize) { + continue 2; + } + + $value = new Syncroton_Model_GALPicture(array( + 'data' => $value, // binary + 'status' => Syncroton_Model_GALPicture::STATUS_SUCCESS, + )); + + break; } $result$key = $value; @@ -193,7 +188,7 @@ throw new Exception('Empty/invalid search request'); } - $records = ; + $records = array(); $rcube = rcube::get_instance(); // @TODO: caching with Options->RebuildResults support @@ -225,7 +220,7 @@ // get records $result = $book->list_records(); - foreach ($result as $row) { + while ($row = $result->next()) { $row'sourceid' = $idx; // make sure 'email' item is there, convert all email:* into one @@ -260,22 +255,22 @@ $start = $total; } if ($limit > $total) { - $limit = max($start + 1, $total); + $limit = max($start+1, $total); } if ($start > 0 || $limit < $total) { - $records = array_slice($records, $start, $limit - $start); + $records = array_slice($records, $start, $limit-$start); } - $response->range = $start, $start + count($records) - 1; + $response->range = array($start, $start + count($records) - 1); } // Build result array, convert to ActiveSync format foreach ($records as $idx => $rec) { - $response->result = new Syncroton_Model_StoreResponseResult( + $response->result = new Syncroton_Model_StoreResponseResult(array( 'longId' => $rec'ID', 'properties' => $this->getSearchEntry($rec, $options), - ); + )); unset($records$idx); } @@ -287,7 +282,7 @@ * * @param string $id Address book identifier * - * @return rcube_addressbook|null Address book object + * @return rcube_contacts Address book object */ public static function get_address_book($id) { @@ -297,31 +292,26 @@ // use existing instance if (isset(self::$address_books$id) && (self::$address_books$id instanceof rcube_addressbook)) { $book = self::$address_books$id; - } elseif ($id && $ldap_config$id) { - $book = new rcube_ldap( - $ldap_config$id, - $config->get('ldap_debug'), - $config->mail_domain($_SESSION'storage_host') - ); + } + else if ($id && $ldap_config$id) { + $book = new rcube_ldap($ldap_config$id, $config->get('ldap_debug'),
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_data_notes.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_data_notes.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -31,13 +31,13 @@ /** * Mapping from ActiveSync Calendar namespace fields */ - protected $mapping = + protected $mapping = array( 'body' => 'description', 'categories' => 'categories', 'lastModifiedDate' => 'changed', //'messageClass' => 'messageClass', 'subject' => 'title', - ; + ); /** * Kolab object type @@ -67,6 +67,11 @@ */ protected $folderType = Syncroton_Command_FolderSync::FOLDERTYPE_NOTE_USER_CREATED; + /** + * Enable mapping Activesync categories into Kolab tags (relations) + */ + protected $tag_categories = true; + /** * Appends note data to xml element @@ -80,20 +85,21 @@ public function getEntry(Syncroton_Model_SyncCollection $collection, $serverId, $as_array = false) { $note = is_array($serverId) ? $serverId : $this->getObject($collection->collectionId, $serverId); - $result = ; +// $config = $this->getFolderConfig($note'_mailbox'); + $result = array(); // Calendar namespace fields foreach ($this->mapping as $key => $name) { $value = $this->getKolabDataItem($note, $name); switch ($name) { - case 'changed': - $value = self::date_from_kolab($value); - break; + case 'changed': + $value = self::date_from_kolab($value); + break; - case 'description': - $value = $this->body_from_kolab($value, $collection); - break; + case 'description': + $value = $this->body_from_kolab($value, $collection); + break; } if (empty($value) || is_array($value)) { @@ -105,39 +111,44 @@ $result'messageClass' = 'IPM.StickyNote'; + // convert kolab tags into categories + $result'categories' = $this->getKolabTags($note'uid', $result'categories'); + return $as_array ? $result : new Syncroton_Model_Note($result); } /** * convert note from xml to libkolab array * - * @param Syncroton_Model_Note $data Note to convert - * @param string $folderid Folder identifier - * @param array $entry Existing entry + * @param Syncroton_Model_IEntry $data Note to convert + * @param string $folderid Folder identifier + * @param array $entry Existing entry * * @return array */ - public function toKolab($data, $folderid, $entry = null) + public function toKolab(Syncroton_Model_IEntry $data, $folderid, $entry = null) { - $note = !empty($entry) ? $entry : ; + $note = !empty($entry) ? $entry : array(); + $foldername = isset($note'_mailbox') ? $note'_mailbox' : $this->getFolderName($folderid); +// $config = $this->getFolderConfig($foldername); // Calendar namespace fields foreach ($this->mapping as $key => $name) { $value = $data->$key; switch ($name) { - case 'description': - $supported_body_types = - Syncroton_Model_EmailBody::TYPE_HTML, - Syncroton_Model_EmailBody::TYPE_PLAINTEXT, - ; - $value = $this->getBody($value, $supported_body_types); - - // If description isn't specified keep old description - if ($value === null) { - continue 2; - } - break; + case 'description': + $supported_body_types = array( + Syncroton_Model_EmailBody::TYPE_HTML, + Syncroton_Model_EmailBody::TYPE_PLAINTEXT, + ); + $value = $this->getBody($value, $supported_body_types); + + // If description isn't specified keep old description + if ($value === null) { + continue 2; + } + break; } $this->setKolabDataItem($note, $name, $value);
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_data_tasks.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_data_tasks.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -31,7 +31,7 @@ /** * Mapping from ActiveSync Calendar namespace fields */ - protected $mapping = + protected $mapping = array( 'body' => 'description', 'categories' => 'categories', //'complete' => 'complete', // handled separately @@ -46,26 +46,26 @@ 'subject' => 'title', 'utcDueDate' => 'due', 'utcStartDate' => 'start', - ; + ); /** * Sensitivity values */ - public const SENSITIVITY_NORMAL = 0; - public const SENSITIVITY_PERSONAL = 1; - public const SENSITIVITY_PRIVATE = 2; - public const SENSITIVITY_CONFIDENTIAL = 3; + const SENSITIVITY_NORMAL = 0; + const SENSITIVITY_PERSONAL = 1; + const SENSITIVITY_PRIVATE = 2; + const SENSITIVITY_CONFIDENTIAL = 3; /** * mapping of sensitivity * * @var array */ - protected $sensitivityMap = + protected $sensitivityMap = array( 'public' => self::SENSITIVITY_PERSONAL, 'private' => self::SENSITIVITY_PRIVATE, 'confidential' => self::SENSITIVITY_CONFIDENTIAL, - ; + ); /** * Kolab object type @@ -95,6 +95,11 @@ */ protected $folderType = Syncroton_Command_FolderSync::FOLDERTYPE_TASK_USER_CREATED; + /** + * Enable mapping Activesync categories into Kolab tags (relations) + */ + protected $tag_categories = true; + /** * Appends contact data to xml element @@ -108,40 +113,39 @@ public function getEntry(Syncroton_Model_SyncCollection $collection, $serverId, $as_array = false) { $task = is_array($serverId) ? $serverId : $this->getObject($collection->collectionId, $serverId); - $result = ; +// $config = $this->getFolderConfig($task'_mailbox'); + $result = array(); // Completion status (required) - $result'complete' = intval(($task'status' ?? null) == 'COMPLETED' || ($task'complete' ?? null) == 100); + $result'complete' = intval($task'status' == 'COMPLETED' || $task'complete' == 100); // Calendar namespace fields foreach ($this->mapping as $key => $name) { $value = $this->getKolabDataItem($task, $name); switch ($name) { - case 'due': - case 'start': - if (preg_match('/^UTC/i', $key)) { - $value = self::date_from_kolab($value); - } - break; - - case 'changed': - $value = $result'complete' ? self::date_from_kolab($value) : null; - break; - - case 'description': - $value = $this->body_from_kolab($value, $collection); - break; - - case 'sensitivity': - if (!empty($value)) { - $value = intval($this->sensitivityMap$value); - } - break; - - case 'priority': - $value = $this->prio_to_importance($value); - break; + case 'due': + case 'start': + if (preg_match('/^UTC/i', $key)) { + $value = self::date_from_kolab($value); + } + break; + + case 'changed': + $value = $result'complete' ? self::date_from_kolab($value) : null; + break; + + case 'description': + $value = $this->body_from_kolab($value, $collection); + break; + + case 'sensitivity': + $value = intval($this->sensitivityMap$value); + break; + + case 'priority': + $value = $this->prio_to_importance($value); + break; } if (empty($value) || is_array($value)) { @@ -151,12 +155,17 @@ $result$key = $value; } + // convert kolab tags into categories + $result'categories' = $this->getKolabTags($task'uid', $result'categories'); + // Recurrence $this->recurrence_from_kolab($collection, $task, $result, 'Task'); return $as_array ? $result : new Syncroton_Model_Task($result); } + + /** * Apply a timezone matching the utc offset. */ @@ -175,15 +184,17 @@ /** * convert contact from xml to libkolab array * - * @param Syncroton_Model_Task $data Contact to convert - * @param string $folderid Folder identifier - * @param array $entry Existing entry + * @param Syncroton_Model_IEntry $data Contact to convert + * @param string $folderid Folder identifier + * @param array $entry Existing entry * * @return array */ - public function toKolab($data, $folderid, $entry = null) + public function toKolab(Syncroton_Model_IEntry $data, $folderid, $entry = null) { - $task = !empty($entry) ? $entry : ; + $task = !empty($entry) ? $entry : array(); + $foldername = isset($task'_mailbox') ? $task'_mailbox' : $this->getFolderName($folderid); +// $config = $this->getFolderConfig($foldername); $task'allday' = 0; @@ -193,38 +204,38 @@ switch ($name) { - case 'due': - case 'start': - // We expect to always get regular and utc variants, so we only need to take one into account. - if ($key == 'utcStartDate' || $key == 'utcDueDate') { - continue 2; + case 'due': + case 'start': + // We expect to always get regular and utc variants, so we only need to take one into account. + if ($key == 'utcStartDate' || $key == 'utcDueDate') { + continue 2; + } + if ($value) { + if ($name =='due' && $data->utcDueDate) { + $value = static::applyTimezone($value, $data->utcDueDate); } - if ($value) { - if ($name == 'due' && $data->utcDueDate) { - $value = self::applyTimezone($value, $data->utcDueDate); - } - if ($name == 'start' && $data->utcStartDate) { - $value = self::applyTimezone($value, $data->utcStartDate); - } + if ($name =='start' && $data->utcStartDate) { + $value = static::applyTimezone($value, $data->utcStartDate); } - break;
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_logger.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_logger.php
Changed
@@ -1,5 +1,4 @@ <?php - /* +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | @@ -30,7 +29,6 @@ { public $mode; - protected $log_driver; protected $logfile; protected $format; protected $log_dir; @@ -39,13 +37,12 @@ /** * Constructor */ - public function __construct($mode = null) + function __construct($mode = null) { $rcube = rcube::get_instance(); $this->mode = intval($mode); $this->logfile = $rcube->config->get('activesync_log_file'); - $this->log_driver = $rcube->config->get('log_driver'); $this->format = $rcube->config->get('log_date_format', 'd-M-Y H:i:s O'); $this->log_dir = $rcube->config->get('log_dir'); @@ -62,17 +59,6 @@ } /** - * Check whether debug logging is enabled - * - * @return bool - */ - public function hasDebug() - { - // This is what we check in self::log() below - return !empty($this->log_dir) && $this->mode >= self::NOTICE; - } - - /** * Message logger * * @param string $message Log message @@ -83,7 +69,8 @@ if (is_numeric($method)) { $mode = $method; $method = array_search($method, $this->_priorities); - } else { + } + else { $mode = $this->_priorities$method; } @@ -103,17 +90,16 @@ // if log_file is configured all logs will go to it // otherwise use separate file for info/debug and warning/error - $file="undefined"; if (!$logfile) { switch ($mode) { - case self::DEBUG: - case self::INFO: - case self::NOTICE: - $file = 'console'; - break; - default: - $file = 'errors'; - break; + case self::DEBUG: + case self::INFO: + case self::NOTICE: + $file = 'console'; + break; + default: + $file = 'errors'; + break; } $logfile = $log_dir . DIRECTORY_SEPARATOR . $file; @@ -121,7 +107,8 @@ if (version_compare(version_parse(RCUBE_VERSION), '1.4.0') >= 0) { $logfile .= $rcube->config->get('log_file_ext', '.log'); } - } elseif ($logfile0 != '/') { + } + else if ($logfile0 != '/') { $logfile = $log_dir . DIRECTORY_SEPARATOR . $logfile; } @@ -129,32 +116,10 @@ $message = var_export($message, true); } - // write message in logfmt format with extra info when configured to log to STDOUT - if ($this->log_driver == 'logfmt') { - $user_name = $this->username; - - $output = "name=$file component=syncroton"; - $params = 'cmd' => 'Cmd', 'device' => 'DeviceId', 'type' => 'DeviceType'; - - foreach ($params as $key => $val) { - if ($val = $_GET$val) { - $output .= " $key=$val"; - } - } - - if (!empty($user_name)) { - $output .= " user=$user_name"; - } - $line = json_encode($message); - $output .= " log=$line\n"; - file_put_contents("php://stdout", $output, FILE_APPEND) !== false; - return; - } - // add user/request information to the log if ($mode <= self::WARN) { - $device = ; - $params = 'cmd' => 'Cmd', 'device' => 'DeviceId', 'type' => 'DeviceType'; + $device = array(); + $params = array('cmd' => 'Cmd', 'device' => 'DeviceId', 'type' => 'DeviceType'); if (!empty($this->username)) { $device'user' = $this->username; @@ -174,13 +139,6 @@ $date = rcube_utils::date_format($this->format); $logline = sprintf("%s: %s %s\n", $date, $method, $message); - // write message with file name when configured to log to STDOUT - if ($this->log_driver == 'stdout') { - $stdout = "php://stdout"; - file_put_contents($stdout, $logline, FILE_APPEND); - return; - } - if ($fp = @fopen($logfile, 'a')) { fwrite($fp, $logline); fflush($fp);
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_message.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_message.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -25,17 +25,17 @@ class kolab_sync_message { - protected $headers = ; + protected $headers = array(); protected $body; protected $ctype; - protected $ctype_params = ; + protected $ctype_params = array(); /** * Constructor * * @param string|resource $source MIME message source */ - public function __construct($source) + function __construct($source) { $this->parse_mime($source); } @@ -52,7 +52,7 @@ public function source() { - $headers = ; + $headers = array(); // Build the message back foreach ($this->headers as $header => $header_value) { @@ -89,22 +89,22 @@ * Adds attachment to the message * * @param string $body Attachment body (not encoded) - * @param array $params Attachment parameters (Mail_mimePart format) + * @param string $params Attachment parameters (Mail_mimePart format) */ - public function add_attachment($body, $params = ) + public function add_attachment($body, $params = array()) { // convert the message into multipart/mixed if ($this->ctype != 'multipart/mixed') { $boundary = '_' . md5(rand() . microtime()); $this->body = "--$boundary\r\n" - . "Content-Type: " . $this->headers'Content-Type' . "\r\n" - . "Content-Transfer-Encoding: " . $this->headers'Content-Transfer-Encoding' . "\r\n" - . "\r\n" . trim($this->body) . "\r\n" - . "--$boundary\r\n"; + ."Content-Type: " . $this->headers'Content-Type'."\r\n" + ."Content-Transfer-Encoding: " . $this->headers'Content-Transfer-Encoding'."\r\n" + ."\r\n" . trim($this->body) . "\r\n" + ."--$boundary\r\n"; $this->ctype = 'multipart/mixed'; - $this->ctype_params = 'boundary' => $boundary; + $this->ctype_params = array('boundary' => $boundary); unset($this->headers'Content-Transfer-Encoding'); $this->save_content_type($this->ctype, $this->ctype_params); } @@ -128,8 +128,8 @@ // add the attachment to the end of the message $this->body .= "\r\n" - . implode("\r\n", $body'headers') . "\r\n\r\n" - . $body'body' . "\r\n--$boundary--\r\n"; + .implode("\r\n", $body'headers') . "\r\n\r\n" + .$body'body' . "\r\n--$boundary--\r\n"; } /** @@ -153,15 +153,15 @@ * @param array $smtp_error SMTP error array (reference) * @param array $smtp_opts SMTP options (e.g. DSN request) * - * @return bool Send status. + * @return boolean Send status. */ public function send(&$smtp_error = null, $smtp_opts = null) { - $rcube = kolab_sync::get_instance(); + $rcube = rcube::get_instance(); $headers = $this->headers; $mailto = $headers'To'; - $headers'User-Agent' = $rcube->app_name . ' ' . kolab_sync::VERSION; + $headers'User-Agent' .= $rcube->app_name . ' ' . kolab_sync::VERSION; if ($agent = $rcube->config->get('useragent')) { $headers'User-Agent' .= '/' . $agent; } @@ -170,7 +170,7 @@ $headers'From' = $this->get_identity(); } // make sure there's sender name in From: - elseif ($rcube->config->get('activesync_fix_from') + else if ($rcube->config->get('activesync_fix_from') && preg_match('/^<?((\S+|("^"+"))@\S+)>?$/', trim($headers'From'), $m) ) { $identities = kolab_sync::get_instance()->user->list_identities(); @@ -196,17 +196,14 @@ $smtp_headers = $headers; // generate list of recipients - $recipients = ; + $recipients = array(); - if (!empty($headers'To')) { + if (!empty($headers'To')) $recipients = $headers'To'; - } - if (!empty($headers'Cc')) { + if (!empty($headers'Cc')) $recipients = $headers'Cc'; - } - if (!empty($headers'Bcc')) { + if (!empty($headers'Bcc')) $recipients = $headers'Bcc'; - } if (empty($headers'To') && empty($headers'Cc')) { $headers'To' = 'undisclosed-recipients:;'; @@ -226,13 +223,13 @@ // log error if (!$sent) { - rcube::raise_error('code' => 800, 'type' => 'smtp', + rcube::raise_error(array('code' => 800, 'type' => 'smtp', 'line' => __LINE__, 'file' => __FILE__, - 'message' => "SMTP error: " . implode("\n", $smtp_response), true, false); + 'message' => "SMTP error: ".join("\n", $smtp_response)), true, false); } if ($sent) { - $rcube->plugins->exec_hook('message_sent', 'headers' => $headers, 'body' => $this->body); + $rcube->plugins->exec_hook('message_sent', array('headers' => $headers, 'body' => $this->body)); // remove MDN headers after sending unset($headers'Return-Receipt-To', $headers'Disposition-Notification-To'); @@ -241,16 +238,12 @@ // get all recipient addresses $mailto = rcube_mime::decode_address_list(implode(',', $recipients), null, false, null, true); - rcube::write_log( - 'sendmail', - sprintf( - "User %s %s; Message %s for %s; %s", - $rcube->get_user_name(), - rcube_utils::remote_addr(), - $headers'Message-ID', - implode(', ', $mailto), - !empty($smtp_response) ? implode('; ', $smtp_response) : '' - ) + rcube::write_log('sendmail', sprintf("User %s %s; Message %s for %s; %s", + $rcube->get_user_name(), + rcube_utils::remote_addr(), + $headers'Message-ID', + implode(', ', $mailto), + !empty($smtp_response) ? implode('; ', $smtp_response) : '') ); } } @@ -276,20 +269,20 @@ $message = stream_get_contents($message); } - $headers, $message = array_pad(preg_split('/\r?\n\r?\n/', $message, 2, PREG_SPLIT_NO_EMPTY), 2, ''); + list($headers, $message) = preg_split('/\r?\n\r?\n/', $message, 2, PREG_SPLIT_NO_EMPTY); $hdrs = self::parse_headers($headers); // multipart message - if (preg_match('/boundary="?(a-z0-9-\'\(\)+_\,\.\/:=\? +)"?/i', $hdrs'Content-Type' ?? '', $matches)) { + if (preg_match('/boundary="?(a-z0-9-\'\(\)+_\,\.\/:=\? +)"?/i', $hdrs'Content-Type', $matches)) { $boundary = '--' . $matches1; $message = explode($boundary, $message); - for ($x = 1, $parts = count($message) - 1; $x < $parts; $x++) { + for ($x=1, $parts = count($message) - 1; $x<$parts; $x++) { $message$x = "\r\n" . self::recode_message(ltrim($message$x)); } - return $headers . "\r\n\r\n" . implode($boundary, $message); + return $headers . "\r\n\r\n" . implode($boundary , $message); } // single part @@ -338,7 +331,10 @@ /** * MIME message parser * - * @param string|resource $message MIME message source + * @param string|resource $message MIME message source
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_plugin_api.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_plugin_api.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -35,7 +35,7 @@ * * @return rcube_plugin_api The one and only instance if this class */ - public static function get_instance() + static function get_instance() { if (!self::$instance) { self::$instance = new kolab_sync_plugin_api(); @@ -44,20 +44,22 @@ return self::$instance; } + /** * Initialize plugin engine * * This has to be done after rcmail::load_gui() or rcmail::json_init() * was called because plugins need to have access to rcmail->output * - * @param rcube $app Instance of the rcube base class - * @param string $task Current application task (used for conditional plugin loading) + * @param object rcube Instance of the rcube base class + * @param string Current application task (used for conditional plugin loading) */ public function init($app, $task = '') { $this->task = $task; } + /** * Register a handler function for template objects * @@ -70,6 +72,7 @@ // empty } + /** * Register this plugin to be responsible for a specific task * @@ -81,6 +84,7 @@ $this->tasks$task = $owner; } + /** * Include a plugin script file in the current HTML page * @@ -91,6 +95,7 @@ //empty } + /** * Include a plugin stylesheet in the current HTML page *
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_timezone_converter.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_timezone_converter.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -33,11 +33,11 @@ /** * holds the instance of the singleton * - * @var ?kolab_sync_timezone_converter + * @var kolab_sync_timezone_onverter */ - private static $_instance; + private static $_instance = NULL; - protected $_startDate = ; + protected $_startDate = array(); /** * If set then the timezone guessing results will be cached. @@ -51,19 +51,11 @@ * array of offsets known by ActiceSync clients, but unknown by php * @var array */ - protected $_knownTimezones = - '0AIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==' => - 'Pacific/Kwajalein' => 'MHT', - , - ; - - - protected $_legacyTimezones = - // This is an outdated timezone that outlook keeps sending because of an outdate timezone database on windows - 'Lv///0kAcgBhAG4AIABTAHQAYQBuAGQAYQByAGQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkABAADABcAOwA7AOcDAAAAAEkAcgBhAG4AIABEAGEAeQBsAGkAZwBoAHQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAwAEAAAAAAAAAAAAxP///w==' => - 'Asia/Tehran' => '+0330', - , - ; + protected $_knownTimezones = array( + '0AIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==' => array( + 'Pacific/Kwajalein' => 'MHT' + ) + ); /** * don't use the constructor. Use the singleton. @@ -88,7 +80,7 @@ */ public static function getInstance() { - if (self::$_instance === null) { + if (self::$_instance === NULL) { self::$_instance = new kolab_sync_timezone_converter(); } @@ -147,25 +139,30 @@ { if (is_string($_offsets) && isset($this->_knownTimezones$_offsets)) { $timezones = $this->_knownTimezones$_offsets; - } elseif (is_string($_offsets) && isset($this->_legacyTimezones$_offsets)) { - $timezones = $this->_legacyTimezones$_offsets; - } else { + } + else { if (is_string($_offsets)) { // unpack timezone info to array $_offsets = $this->_unpackTimezoneInfo($_offsets); } if (!$this->_validateOffsets($_offsets)) { - return ; + return array(); } $this->_setDefaultStartDateIfEmpty($_offsets); - $timezones = ; - foreach (DateTimeZone::listIdentifiers() as $timezoneIdentifier) { - $timezone = new DateTimeZone($timezoneIdentifier); - if (false !== ($matchingTransition = $this->_checkTimezone($timezone, $_offsets))) { - $timezones$timezoneIdentifier = $matchingTransition'abbr'; + $cacheId = $this->_getCacheId('timezones', $_offsets); + $timezones = $this->_loadFromCache($cacheId); + + if (!is_array($timezones)) { + $timezones = array(); + foreach (DateTimeZone::listIdentifiers() as $timezoneIdentifier) { + $timezone = new DateTimeZone($timezoneIdentifier); + if (false !== ($matchingTransition = $this->_checkTimezone($timezone, $_offsets))) { + $timezones$timezoneIdentifier = $matchingTransition'abbr'; + } } + $this->_saveInCache($timezones, $cacheId); } } @@ -178,7 +175,7 @@ * If {@see $_expectedTimezone} is set then the method will return this timezone if it matches. * * @param string|array $_offsets Activesync timezone definition - * @param string $_expectedTimezone Expected timezone name + * @param string $_expectedTomezone Expected timezone name * * @return string Expected timezone name */ @@ -188,7 +185,8 @@ if ($_expectedTimezone && isset($timezones$_expectedTimezone)) { return $_expectedTimezone; - } else { + } + else { return key($timezones); } } @@ -214,65 +212,48 @@ return $this->_packTimezoneInfo($offsets); } - - /** - * Returns an encoded timezone representation from $date - * - * @param DateTime $date The date with the timezone to encode - * - * @return string|null Timezone name - */ - public static function encodeTimezoneFromDate($date) - { - if ($date instanceof DateTime) { - $timezone = $date->getTimezone(); - - if (($tz_name = $timezone->getName()) != 'UTC') { - $tzc = self::getInstance(); - if ($tz_name = $tzc->encodeTimezone($tz_name, $date->format('Y-m-d'))) { - return $tz_name; - } - } - } - - return null; - } - /** * Get offsets for given timezone * * @param string $_timezone Timezone identifier * @param string|int $_startDate Start date * - * @return array|null Timezone offsets + * @return array Timezone offsets */ public function getOffsetsForTimezone($_timezone, $_startDate = null) { $this->_setStartDate($_startDate); - $offsets = $this->_getOffsetsTemplate(); + $cacheId = $this->_getCacheId('offsets', array($_timezone)); - try { - $timezone = new DateTimeZone($_timezone); - } catch (Exception $e) { - return null; - } + if (false === ($offsets = $this->_loadFromCache($cacheId))) { + $offsets = $this->_getOffsetsTemplate(); + + try { + $timezone = new DateTimeZone($_timezone); + } + catch (Exception $e) { + return null; + } - $standardTransition, $daylightTransition = $this->_getTransitionsForTimezoneAndYear($timezone, $this->_startDate'year'); + list($standardTransition, $daylightTransition) = $this->_getTransitionsForTimezoneAndYear($timezone, $this->_startDate'year'); - if ($standardTransition) { - $offsets'bias' = $standardTransition'offset' / 60 * -1; - if ($daylightTransition) { - $offsets = $this->_generateOffsetsForTransition($offsets, $standardTransition, 'standard', $timezone); - $offsets = $this->_generateOffsetsForTransition($offsets, $daylightTransition, 'daylight', $timezone); + if ($standardTransition) { + $offsets'bias' = $standardTransition'offset'/60*-1; + if ($daylightTransition) { + $offsets = $this->_generateOffsetsForTransition($offsets, $standardTransition, 'standard', $timezone); + $offsets = $this->_generateOffsetsForTransition($offsets, $daylightTransition, 'daylight', $timezone); - //@todo how do we get the standardBias (is usually 0)? - //$offsets'standardBias' = ... + //@todo how do we get the standardBias (is usually 0)? + //$offsets'standardBias' = ... - $offsets'daylightBias' = ($daylightTransition'offset' - $standardTransition'offset') / 60 * -1; - $offsets'standardHour' -= $offsets'daylightBias' / 60; - $offsets'daylightHour' += $offsets'daylightBias' / 60; + $offsets'daylightBias' = ($daylightTransition'offset' - $standardTransition'offset')/60*-1; + $offsets'standardHour' -= $offsets'daylightBias' / 60; + $offsets'daylightHour' += $offsets'daylightBias' / 60;
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_transaction_manager.php -> kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_transaction_manager.php
Changed
@@ -1,6 +1,6 @@ <?php -/* +/** +--------------------------------------------------------------------------+ | Kolab Sync (ActiveSync for Kolab) | | | @@ -43,17 +43,17 @@ /** * @var array holds all transactionables with open transactions */ - protected $_openTransactionables = ; + protected $_openTransactionables = array(); /** * @var array list of all open (not commited) transactions */ - protected $_openTransactions = ; + protected $_openTransactions = array(); /** - * @var ?self + * @var Syncroton_TransactionManager */ - private static $_instance; + private static $_instance = NULL; /** * @var Zend_Log @@ -78,12 +78,12 @@ } /** - * @return self + * @return Tinebase_TransactionManager */ public static function getInstance() { - if (self::$_instance === null) { - self::$_instance = new kolab_sync_transaction_manager(); + if (self::$_instance === NULL) { + self::$_instance = new kolab_sync_transaction_manager; } return self::$_instance; @@ -92,10 +92,9 @@ /** * starts a transaction * - * @param mixed $_transactionable - * - * @return string Transaction Id - * @throws Exception + * @param mixed $_transactionable + * @return string transactionId + * @throws Tinebase_Exception_UnexpectedValue */ public function startTransaction($_transactionable) { @@ -106,7 +105,8 @@ if (! in_array($_transactionable, $this->_openTransactionables)) { if ($_transactionable instanceof rcube_db) { $_transactionable->startTransaction(); - } else { + } + else { $this->rollBack(); throw new Syncroton_Exception_UnexpectedValue('Unsupported transactionable!'); } @@ -114,7 +114,7 @@ array_push($this->_openTransactionables, $_transactionable); } - $transactionId = sha1(mt_rand() . microtime()); + $transactionId = sha1(mt_rand(). microtime()); array_push($this->_openTransactions, $transactionId); return $transactionId; @@ -146,9 +146,10 @@ } } - $this->_openTransactionables = ; - $this->_openTransactions = ; - } else { + $this->_openTransactionables = array(); + $this->_openTransactions = array(); + } + else { if ($this->_logger instanceof Zend_Log) { $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " commiting defered, as there are still $numOpenTransactions in the queue"); } @@ -172,7 +173,7 @@ } } - $this->_openTransactionables = ; - $this->_openTransactions = ; + $this->_openTransactionables = array(); + $this->_openTransactions = array(); } }
View file
kolab-syncroton-2.3.22.tar.gz/tests/body_converter.php
Added
@@ -0,0 +1,50 @@ +<?php + +class body_converter extends PHPUnit\Framework\TestCase +{ + function setUp() + { + } + + + function data_html_to_text() + { + return array( + array('', ''), + array('<div></div>', ''), + array('<div>a</div>', 'a'), + array('<html><head><title>title</title></head></html>', ''), + ); + } + + /** + * @dataProvider data_html_to_text + */ + function test_html_to_text($html, $text) + { + $converter = new kolab_sync_body_converter($html, Syncroton_Model_EmailBody::TYPE_HTML); + $output = $converter->convert(Syncroton_Model_EmailBody::TYPE_PLAINTEXT); + + $this->assertEquals(trim($text), trim($output)); + } + + /** + * + */ + function test_rtf_to_text() + { + $rtf = '0QAAAB0CAABMWkZ1Pzsq5D8ACQMwAQMB9wKnAgBjaBEKwHNldALRcHJx4DAgVGFoA3ECgwBQ6wNUDzcyD9MyBgAGwwKDpxIBA+MReDA0EhUgAoArApEI5jsJbzAVwzEyvjgJtBdCCjIXQRb0ORIAHxeEGOEYExjgFcMyNTX/CbQaYgoyGmEaHBaKCaUa9v8c6woUG3YdTRt/Hwwabxbt/xyPF7gePxg4JY0YVyRMKR+dJfh9CoEBMAOyMTYDMUksgSc1FGAnNhqAJ1Q3My3BNAqFfS7A'; + $rtf = base64_decode($rtf); + $text = 'Test'; + $html = '<pre>Test</pre>'; + + $converter = new kolab_sync_body_converter($rtf, Syncroton_Model_EmailBody::TYPE_RTF); + + $output = $converter->convert(Syncroton_Model_EmailBody::TYPE_PLAINTEXT); + $this->assertEquals(trim($text), trim($output)); + + $output = $converter->convert(Syncroton_Model_EmailBody::TYPE_HTML); + $this->assertEquals(trim($html), trim($output)); + } + +}
View file
kolab-syncroton-2.4.2.tar.gz/tests/bootstrap.php -> kolab-syncroton-2.3.22.tar.gz/tests/bootstrap.php
Changed
@@ -1,8 +1,5 @@ <?php -error_reporting(E_ALL); -ini_set('display_errors', 1); - if (php_sapi_name() != 'cli') { die("Not in shell mode (php-cli)"); } @@ -10,6 +7,5 @@ define('TESTS_DIR', dirname(__FILE__) . '/'); require_once(TESTS_DIR . '/../lib/init.php'); -require_once(TESTS_DIR . '/SyncTestCase.php'); rcube::get_instance()->config->set('devel_mode', false);
View file
kolab-syncroton-2.3.22.tar.gz/tests/data.php
Added
@@ -0,0 +1,74 @@ +<?php + +class data extends PHPUnit\Framework\TestCase +{ + /** + * Test for kolab_sync_data::recurrence_to_kolab() + */ + function test_recurrence_to_kolab() + { + $xml = '<!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> + <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase" xmlns:Calendar="uri:Calendar"> + <ApplicationData> + <Calendar:Recurrence> + <Calendar:Type>0</Calendar:Type> + <Calendar:Interval>1</Calendar:Interval> + <Calendar:Until>20101128T225959Z</Calendar:Until> + </Calendar:Recurrence> + </ApplicationData> + </Sync>'; + + $xml = new SimpleXMLElement($xml); + $event = new Syncroton_Model_Event($xml->ApplicationData); + $data = new kolab_sync_data_test; + + $result = $data->recurrence_to_kolab($event); + + $this->assertEquals('DAILY', $result'FREQ'); + $this->assertEquals(1, $result'INTERVAL'); + $this->assertEquals('20101128T225959Z', $result'UNTIL'->format("Ymd\THis\Z")); + + $xml = '<!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> + <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase" xmlns:Calendar="uri:Calendar"> + <ApplicationData> + <Calendar:Recurrence> + <Calendar:Type>1</Calendar:Type> + <Calendar:Interval>1</Calendar:Interval> + <Calendar:DayOfWeek>8</Calendar:DayOfWeek> + </Calendar:Recurrence> + </ApplicationData> + </Sync>'; + + $xml = new SimpleXMLElement($xml); + $event = new Syncroton_Model_Event($xml->ApplicationData); + + $result = $data->recurrence_to_kolab($event, null); + + $this->assertEquals('WEEKLY', $result'FREQ'); + $this->assertEquals(1, $result'INTERVAL'); + $this->assertEquals('WE', $result'BYDAY'); + } +} + +/** + * kolab_sync_data wrapper, so we can test preotected methods too + */ +class kolab_sync_data_test extends kolab_sync_data +{ + function __construct() + { + } + + public function recurrence_to_kolab($data, $dummy1 = null, $dummy2 = null) + { + return parent::recurrence_to_kolab($data, null); + } + + function toKolab(Syncroton_Model_IEntry $data, $folderId, $entry = null, $timezone = null) + { + } + + function getEntry(Syncroton_Model_SyncCollection $collection, $serverId, $as_array = false) + { + } +}
View file
kolab-syncroton-2.3.22.tar.gz/tests/data_calendar.php
Added
@@ -0,0 +1,126 @@ +<?php + +class data_calendar extends PHPUnit\Framework\TestCase +{ + /** + * Test for kolab_sync_data_calendar::from_kolab_alarm() + */ + function test_from_kolab_alarm() + { + $obj = new kolab_sync_data_calendar_test; + + $result = $obj->from_kolab_alarm(array()); + $this->assertSame(null, $result); + + $event = array('valarms' => array(array( + 'action' => 'DISPLAY', + 'trigger' => 'PT5M', + ))); + $result = $obj->from_kolab_alarm($event); + $this->assertSame(null, $result); + + $event = array('valarms' => array(array( + 'action' => 'DISPLAY', + 'trigger' => '-PT5M', + ))); + $result = $obj->from_kolab_alarm($event); + $this->assertSame(5, $result); + + $event = array('valarms' => array(array( + 'action' => 'DISPLAY', + 'trigger' => 'PT0M', + ))); + $result = $obj->from_kolab_alarm($event); + $this->assertSame(0, $result); + + $event = array('valarms' => array(array( + 'action' => 'DISPLAY', + 'trigger' => '-PT0M', + ))); + $result = $obj->from_kolab_alarm($event); + $this->assertSame(0, $result); + + $event = array('valarms' => array(array( + 'action' => 'DISPLAY', + 'trigger' => 'PT0S', + ))); + $result = $obj->from_kolab_alarm($event); + $this->assertSame(0, $result); + + // alarms on specified DateTime (T2420) + + $event = array( + // no start datetime defined + 'valarms' => array( + array( + 'action' => 'DISPLAY', + 'trigger' => new DateTime('now + 1 hour'), + ), + ), + ); + $result = $obj->from_kolab_alarm($event); + $this->assertSame(null, $result); + + $event = array( + 'start' => new DateTime('now + 10 minutes'), + 'valarms' => array( + array( + 'action' => 'DISPLAY', + 'trigger' => new DateTime('now + 1 hour'), + ), + ), + ); + $result = $obj->from_kolab_alarm($event); + $this->assertSame(null, $result); + + $event = array( + 'start' => new DateTime('now + 60 minutes'), + 'valarms' => array( + array( + 'action' => 'DISPLAY', + 'trigger' => new DateTime('now + 50 minutes'), + ), + ), + ); + $result = $obj->from_kolab_alarm($event); + $this->assertSame(10, $result); + } + + /** + * Test for kolab_sync_data_calendar::to_kolab_alarm() + */ + function test_to_kolab_alarm() + { + $obj = new kolab_sync_data_calendar_test; + + $result = $obj->to_kolab_alarm(null, array()); + $this->assertSame(array(), $result); + + $result = $obj->to_kolab_alarm(0, array()); + $this->assertSame('-PT0M', $result0'trigger'); + + $result = $obj->to_kolab_alarm(15, array()); + $this->assertSame('-PT15M', $result0'trigger'); + $this->assertSame('DISPLAY', $result0'action'); + } +} + +/** + * kolab_sync_data_calendar wrapper, so we can test protected methods too + */ +class kolab_sync_data_calendar_test extends kolab_sync_data_calendar +{ + function __construct() + { + } + + public function from_kolab_alarm($value) + { + return parent::from_kolab_alarm($value); + } + + public function to_kolab_alarm($value, $event) + { + return parent::to_kolab_alarm($value, $event); + } +}
View file
kolab-syncroton-2.3.22.tar.gz/tests/data_tasks.php
Added
@@ -0,0 +1,78 @@ +<?php + +class data_tasks extends PHPUnit\Framework\TestCase +{ + function data_prio() + { + return array( + array(0, null), + array(1, 2), + array(2, 2), + array(3, 2), + array(4, 2), + array(5, 1), + array(6, 0), + array(7, 0), + array(8, 0), + array(9, 0), + // invalid input + array(10, null), + ); + } + + function data_importance() + { + return array( + array(0, 9), + array(1, 5), + array(2, 1), + // invalid input + array(null, null), + array(5, null), + ); + } + + /** + * Test for kolab_sync_data_tasks::prio_to_importance() + * @dataProvider data_prio() + */ + function test_prio_to_importance($input, $output) + { + $data = new kolab_sync_data_tasks_test; + $result = $data->prio_to_importance($input); + + $this->assertEquals($output, $result); + } + + /** + * Test for kolab_sync_data_tasks::importance_to_prio() + * @dataProvider data_importance() + */ + function test_importance_to_prio($input, $output) + { + $data = new kolab_sync_data_tasks_test; + $result = $data->importance_to_prio($input); + + $this->assertEquals($output, $result); + } +} + +/** + * kolab_sync_data_tasks wrapper, so we can test preotected methods too + */ +class kolab_sync_data_tasks_test extends kolab_sync_data_tasks +{ + function __construct() + { + } + + public function prio_to_importance($value) + { + return parent::prio_to_importance($value); + } + + public function importance_to_prio($value) + { + return parent::importance_to_prio($value); + } +}
View file
kolab-syncroton-2.3.22.tar.gz/tests/message.php
Added
@@ -0,0 +1,151 @@ +<?php + +class message extends PHPUnit\Framework\TestCase +{ + function setUp() + { + } + + + /** + * Test message parsing and headers setting + */ + function test_headers() + { + $source = file_get_contents(TESTS_DIR . '/src/mail.plain'); + $message = new kolab_sync_message($source); + $headers = $message->headers(); + + $this->assertArrayHasKey('MIME-Version', $headers); + $this->assertCount(8, $headers); + $this->assertEquals('kolab@domain.tld', $headers'To'); + + // test set_header() + $message->set_header('to', 'test@domain.tld'); + $headers = $message->headers(); + + $this->assertCount(8, $headers); + $this->assertEquals('test@domain.tld', $headers'To'); + } + + /** + * Test message parsing + */ + function test_source() + { + $source = file_get_contents(TESTS_DIR . '/src/mail.plain'); + $message = new kolab_sync_message($source); + $result = $message->source(); + + $this->assertEquals($source, str_replace("\r\n", "\n", $result)); + } + + /** + * Test adding attachments to the message + */ + function test_attachment() + { + $source = file_get_contents(TESTS_DIR . '/src/mail.plain'); + $mixed = file_get_contents(TESTS_DIR . '/src/mail.plain.mixed'); + $mixed2 = file_get_contents(TESTS_DIR . '/src/mail.mixed'); + + // test adding attachment to text/plain message + $message = new kolab_sync_message($source); + $message->add_attachment('aaa', array( + 'content_type' => 'text/plain', + 'encoding' => '8bit', + )); + + $result = $message->source(); + $result = str_replace("\r\n", "\n", $result); + if (preg_match('/boundary="(^"+)"/', $result, $m)) { + $mixed = str_replace('BOUNDARY', $m1, $mixed); + } + + $this->assertEquals($mixed, $result); + + // test adding attachment to multipart/mixed message + $message = new kolab_sync_message($mixed); + $message->add_attachment('aaa', array( + 'content_type' => 'text/plain', + 'encoding' => 'base64', + )); + + $result = $message->source(); + $result = str_replace("\r\n", "\n", $result); + if (preg_match('/boundary="(^"+)"/', $result, $m)) { + $mixed2 = str_replace('BOUNDARY', $m1, $mixed2); + } + + $this->assertEquals($mixed2, $result); + } + + /** + * Test appending a text to the message + */ + function test_append() + { + // test appending text to text/plain message + $source = file_get_contents(TESTS_DIR . '/src/mail.plain'); + $append = file_get_contents(TESTS_DIR . '/src/mail.plain.append'); + + $message = new kolab_sync_message($source); + $message->append('a'); + + $result = $message->source(); + $result = str_replace("\r\n", "\n", $result); + $this->assertEquals($append, $result); + } + + /** + * Test recoding the message + */ + function test_recode_message_1() + { + $source = file_get_contents(TESTS_DIR . '/src/mail.recode1'); + $result = file_get_contents(TESTS_DIR . '/src/mail.recode1.out'); + + $message = kolab_sync_message::recode_message($source); + + $this->assertEquals($result, $message); + } + + /** + * Test recoding the message + */ + function test_recode_message_2() + { + $source = file_get_contents(TESTS_DIR . '/src/mail.recode2'); + $result = file_get_contents(TESTS_DIR . '/src/mail.recode2.out'); + + $message = kolab_sync_message::recode_message($source); + + $this->assertEquals($result, $message); + } + + /** + * Test recoding the message + */ + function test_recode_message_3() + { + $source = file_get_contents(TESTS_DIR . '/src/mail.recode3'); + $result = file_get_contents(TESTS_DIR . '/src/mail.recode3.out'); + + $message = kolab_sync_message::recode_message($source); + + $this->assertEquals($result, $message); + } + + /** + * Test recoding the message + */ + function test_recode_message_4() + { + $source = file_get_contents(TESTS_DIR . '/src/mail.recode4'); + $result = file_get_contents(TESTS_DIR . '/src/mail.recode4.out'); + + $message = kolab_sync_message::recode_message($source); + + $this->assertEquals($result, $message); + } +}
View file
kolab-syncroton-2.4.2.tar.gz/tests/phpunit.xml -> kolab-syncroton-2.3.22.tar.gz/tests/phpunit.xml
Changed
@@ -2,11 +2,13 @@ bootstrap="bootstrap.php" colors="true"> <testsuites> - <testsuite name="Unit"> - <directory suffix="Test.php">Unit</directory> - </testsuite> - <testsuite name="Sync"> - <directory suffix="Test.php">Sync</directory> + <testsuite name="All Tests"> + <file>body_converter.php</file> + <file>data.php</file> + <file>data_calendar.php</file> + <file>data_tasks.php</file> + <file>message.php</file> + <file>timezone_converter.php</file> </testsuite> </testsuites> </phpunit>
View file
kolab-syncroton-2.3.22.tar.gz/tests/timezone_converter.php
Added
@@ -0,0 +1,161 @@ +<?php + +class timezone_converter extends PHPUnit\Framework\TestCase +{ + function setUp() + { + } + + + function test_list_timezones() + { +// date_default_timezone_set('America/Los_Angeles'); + + $converter = timezone_converter_test::getInstance(); + $output = $converter->getListOfTimezones('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAEAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAEAAAAAAAAAxP///w=='); + + $this->assertTrue(is_array($output)); + $this->assertSame(array(), $output); + + $converter = timezone_converter_test::getInstance(); + $output = $converter->getListOfTimezones('xP///0MAZQBuAHQAcgBhAGwAIABFAHUAcgBvAHAAZQAgAFMAdABhAG4AZABhAHIAZAAgAFQAaQBtAGUAAAAAAAAAAAAAAAoAAAAFAAMAAAAAAAAAAAAAAEMAZQBuAHQAcgBhAGwAIABFAHUAcgBvAHAAZQAgAEQAYQB5AGwAaQBnAGgAdAAgAFQAaQBtAGUAAAAAAAAAAAAAAAMAAAAFAAIAAAAAAAAAxP///w=='); + + $this->assertTrue(is_array($output)); + $this->assertTrue(isset($output'Europe/Warsaw')); + + $converter = timezone_converter_test::getInstance(); + $output = $converter->getListOfTimezones('4AEAAFAAYQBjAGkAZgBpAGMAIABTAHQAYQBuAGQAYQByAGQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAIAAAAAAAAAAAAAAFAAYQBjAGkAZgBpAGMAIABEAGEAeQBsAGkAZwBoAHQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAIAAAAAAAAAxP///w=='); + + $this->assertTrue(is_array($output)); + $this->assertTrue(isset($output'America/Los_Angeles')); + + $converter = timezone_converter_test::getInstance(); + $output = $converter->getListOfTimezones('Lv///0kAcgBhAG4AIABTAHQAYQBuAGQAYQByAGQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAgADABcAOwA7AOcDAAAAAEkAcgBhAG4AIABEAGEAeQBsAGkAZwBoAHQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAQAEAAAAAAAAAAAAxP///w=='); + + $this->assertTrue(is_array($output)); + $this->assertTrue(isset($output'Asia/Tehran')); + } + + function test_get_timezone() + { + date_default_timezone_set('America/Los_Angeles'); + + $converter = timezone_converter_test::getInstance(); + $datetime = new DateTime('2017-01-01T12:00:00Z'); + + $offsets = $converter->getOffsetsForTimezone('UTC', $datetime); + $output = $converter->getTimezone($offsets, 'UTC'); + + $this->assertSame('UTC', $output); + + $offsets = $converter->getOffsetsForTimezone('Europe/Warsaw', $datetime); + $output = $converter->getTimezone($offsets, 'Europe/Warsaw'); + + $this->assertSame('Europe/Warsaw', $output); + + $offsets = $converter->getOffsetsForTimezone('America/Los_Angeles', $datetime); + $output = $converter->getTimezone($offsets, 'America/Los_Angeles'); + + $this->assertSame('America/Los_Angeles', $output); + } + + function test_get_offsets_for_timezone() + { + date_default_timezone_set('America/Los_Angeles'); + + $converter = timezone_converter_test::getInstance(); + $datetime = new DateTime('2017-01-01T12:00:00Z'); + + $output = $converter->getOffsetsForTimezone('UTC', $datetime); + + $this->assertSame($output'bias', 0); + $this->assertSame($output'standardBias', 0); + $this->assertSame($output'daylightBias', 0); + $this->assertSame($output'standardMonth', 0); + $this->assertSame($output'daylightMonth', 0); + + $output = $converter->getOffsetsForTimezone('Europe/Warsaw', $datetime); + + $this->assertSame($output'standardBias', 0); + $this->assertSame($output'standardMonth', 10); + $this->assertSame($output'standardWeek', 5); + $this->assertSame($output'standardHour', 3); + $this->assertSame($output'daylightBias', -60); + $this->assertSame($output'daylightMonth', 3); + $this->assertSame($output'daylightWeek', 5); + $this->assertSame($output'daylightHour', 2); + + $output = $converter->getOffsetsForTimezone('America/Los_Angeles', $datetime); + + $this->assertSame($output'bias', 480); + $this->assertSame($output'standardBias', 0); + $this->assertSame($output'standardMonth', 11); + $this->assertSame($output'standardWeek', 1); + $this->assertSame($output'standardHour', 2); + $this->assertSame($output'daylightBias', -60); + $this->assertSame($output'daylightMonth', 3); + $this->assertSame($output'daylightWeek', 2); + $this->assertSame($output'daylightHour', 2); + + $output = $converter->getOffsetsForTimezone('Atlantic/Azores', $datetime); + + $this->assertSame($output'bias', 60); + $this->assertSame($output'standardBias', 0); + $this->assertSame($output'standardMonth', 10); + $this->assertSame($output'standardWeek', 5); + $this->assertSame($output'standardHour', 1); + $this->assertSame($output'daylightBias', -60); + $this->assertSame($output'daylightMonth', 3); + $this->assertSame($output'daylightWeek', 5); + $this->assertSame($output'daylightHour', 0); + + $output = $converter->getOffsetsForTimezone('Asia/Tehran', $datetime); + + $this->assertSame($output'bias', -210); + $this->assertSame($output'standardBias', 0); + $this->assertSame($output'standardMonth', 9); + $this->assertSame($output'standardWeek', 3); + $this->assertSame($output'standardDayOfWeek', 2); + $this->assertSame($output'standardHour', 24); + $this->assertSame($output'daylightBias', -60); + $this->assertSame($output'daylightMonth', 3); + $this->assertSame($output'daylightWeek', 4); + $this->assertSame($output'daylightDayOfWeek', 1); + $this->assertSame($output'daylightHour', 0); + } + + function data_timezone_conversion() + { + return array( + array('Asia/Tehran', 'Lv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAgADABcAOwA7AOcDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAQAEAAAAAAAAAAAAxP///w=='), + array('Pacific/Pago_Pago', 'lAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=='), + array('Europe/Warsaw', 'xP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAFAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAIAAAAAAAAAxP///w=='), + ); + } + + /** + * @dataProvider data_timezone_conversion + */ + function test_timezone_conversion($tz, $expected) + { + $datetime = new DateTime('2021-07-01T12:00:00Z'); + $converter = timezone_converter_test::getInstance(); + $output = $converter->encodeTimezone($tz, $datetime); + + $this->assertSame($expected, $output); + + $output = $converter->getListOfTimezones($output); + + $this->assertTrue(is_array($output)); + $this->assertTrue(isset($output$tz)); + } +} + +class timezone_converter_test extends kolab_sync_timezone_converter +{ + // disable cache + function getCache() + { + return null; + } +}
View file
kolab-syncroton-2.4.2.tar.gz/.php-cs-fixer.php
Deleted
@@ -1,47 +0,0 @@ -<?php - -declare(strict_types=1); - -use PhpCsFixer\Config; -use PhpCsFixer\Finder; - -$finder = Finder::create() - ->in(__DIR__) - ->exclude( - 'lib/ext', - 'lib/plugins', - 'vendor', - ) - ->ignoreDotFiles(false) - ->name('*.php.dist'); - -return (new Config()) - ->setRiskyAllowed(true) - ->setRules( - '@PHP74Migration' => true, - '@PHP74Migration:risky' => true, - '@PHP80Migration' => true, - '@PSR1' => true, - '@PSR12' => true, - - 'concat_space' => - 'spacing' => 'one', - , - - 'declare_strict_types' => false, - 'phpdoc_add_missing_param_annotation' => false, - 'use_arrow_functions' => false, - 'void_return' => false, - - 'yoda_style' => - 'equal' => false, - 'identical' => false, - , - - // TODO - risky - 'no_unset_on_property' => false, - 'random_api_migration' => false, - 'strict_param' => false, - ) - ->setFinder($finder) - ->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer.' . md5(__DIR__) . '.cache');
View file
kolab-syncroton-2.4.2.tar.gz/docs/SQL/mysql/2023100500.sql
Deleted
@@ -1,2 +0,0 @@ - -ALTER TABLE `syncroton_synckey` ADD `client_id_map` longblob DEFAULT NULL;
View file
kolab-syncroton-2.4.2.tar.gz/docs/SQL/mysql/2024031100.sql
Deleted
@@ -1,3 +0,0 @@ - -ALTER TABLE `syncroton_synckey` ADD `extra_data` longblob DEFAULT NULL; -DROP TABLE `syncroton_modseq`;
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Exception/DeadlockDetected.php
Deleted
@@ -1,20 +0,0 @@ -<?php -/** - * Syncroton - * - * @package Syncroton - * @subpackage Exception - * @license http://www.tine20.org/licenses/lgpl.html LGPL Version 3 - * @copyright Copyright (c) 2013-2013 Metaways Infosystems GmbH (http://www.metaways.de) - * @author Lars Kneschke <l.kneschke@metaways.de> - */ - -/** - * exception for database deadlocks - * - * @package Syncroton - * @subpackage Exception - */ -class Syncroton_Exception_DeadlockDetected extends Syncroton_Exception -{ -}
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_storage.php
Deleted
@@ -1,2023 +0,0 @@ -<?php - -/* - +--------------------------------------------------------------------------+ - | Kolab Sync (ActiveSync for Kolab) | - | | - | Copyright (C) 2011-2012, Kolab Systems AG <contact@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 published | - | by the Free Software Foundation, either version 3 of the License, or | - | (at your option) any later version. | - | | - | This program is distributed in the hope that it will be useful, | - | but WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | - | GNU Affero General Public License for more details. | - | | - | 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/> | - +--------------------------------------------------------------------------+ - | Author: Aleksander Machniak <machniak@kolabsys.com> | - +--------------------------------------------------------------------------+ -*/ - -/** - * Storage handling class with basic Kolab support (everything stored in IMAP) - */ -class kolab_sync_storage -{ - public const INIT_SUB_PERSONAL = 1; // all subscribed folders in personal namespace - public const INIT_ALL_PERSONAL = 2; // all folders in personal namespace - public const INIT_SUB_OTHER = 4; // all subscribed folders in other users namespace - public const INIT_ALL_OTHER = 8; // all folders in other users namespace - public const INIT_SUB_SHARED = 16; // all subscribed folders in shared namespace - public const INIT_ALL_SHARED = 32; // all folders in shared namespace - - public const MODEL_CALENDAR = 'event'; - public const MODEL_CONTACTS = 'contact'; - public const MODEL_EMAIL = 'mail'; - public const MODEL_NOTES = 'note'; - public const MODEL_TASKS = 'task'; - - public const ROOT_MAILBOX = 'INBOX'; - public const ASYNC_KEY = '/private/vendor/kolab/activesync'; - public const UID_KEY = '/shared/vendor/cmu/cyrus-imapd/uniqueid'; - - public const CTYPE_KEY = '/shared/vendor/kolab/folder-type'; - public const CTYPE_KEY_PRIVATE = '/private/vendor/kolab/folder-type'; - - public $syncTimeStamp; - - protected $storage; - protected $folder_meta; - protected $folder_uids; - protected $folders = ; - protected $root_meta; - protected $relations = ; - protected $relationSupport = true; - protected $tag_rts = ; - private $modseq = ; - - protected static $instance; - - protected static $types = - 1 => '', - 2 => 'mail.inbox', - 3 => 'mail.drafts', - 4 => 'mail.wastebasket', - 5 => 'mail.sentitems', - 6 => 'mail.outbox', - 7 => 'task.default', - 8 => 'event.default', - 9 => 'contact.default', - 10 => 'note.default', - 11 => 'journal.default', - 12 => 'mail', - 13 => 'event', - 14 => 'contact', - 15 => 'task', - 16 => 'journal', - 17 => 'note', - ; - - - /** - * This implements the 'singleton' design pattern - * - * @return kolab_sync_storage The one and only instance - */ - public static function get_instance() - { - if (!self::$instance) { - self::$instance = new kolab_sync_storage(); - self::$instance->startup(); // init AFTER object was linked with self::$instance - } - - return self::$instance; - } - - /** - * Class initialization - */ - public function startup() - { - $this->storage = kolab_sync::get_instance()->get_storage(); - - // set additional header used by libkolab - $this->storage->set_options( - // @TODO: there can be Roundcube plugins defining additional headers, - // we maybe would need to add them here - 'fetch_headers' => 'X-KOLAB-TYPE X-KOLAB-MIME-VERSION', - 'skip_deleted' => true, - 'threading' => false, - ); - - // Disable paging - $this->storage->set_pagesize(999999); - } - - /** - * Clear internal cache state - */ - public function reset() - { - $this->folders = ; - } - - /** - * List known devices - * - * @return array Device list as hash array - */ - public function devices_list() - { - if ($this->root_meta === null) { - // @TODO: consider server annotation instead of INBOX - if ($meta = $this->storage->get_metadata(self::ROOT_MAILBOX, self::ASYNC_KEY)) { - $this->root_meta = $this->unserialize_metadata($metaself::ROOT_MAILBOXself::ASYNC_KEY); - } else { - $this->root_meta = ; - } - } - - if (!empty($this->root_meta'DEVICE') && is_array($this->root_meta'DEVICE')) { - return $this->root_meta'DEVICE'; - } - - return ; - } - - /** - * Get list of folders available for sync - * - * @param string $deviceid Device identifier - * @param string $type Folder type - * @param bool $flat_mode Enables flat-list mode - * - * @return array|bool List of mailbox folders, False on backend failure - */ - public function folders_list($deviceid, $type, $flat_mode = false) - { - // get all folders of specified type - $folders = kolab_storage::list_folders('', '*', $type, false, $typedata); - - // get folders activesync config - $folderdata = $this->folder_meta(); - - if (!is_array($folders) || !is_array($folderdata)) { - return false; - } - - $folders_list = ; - - // check if folders are "subscribed" for activesync - foreach ($folderdata as $folder => $meta) { - if (empty($meta'FOLDER') || empty($meta'FOLDER'$deviceid) - || empty($meta'FOLDER'$deviceid'S') - ) { - continue; - } - - // force numeric folder name to be a string (T1283) - $folder = (string) $folder; - - if (!empty($type) && !in_array($folder, $folders)) { - continue; - } - - // Activesync folder identifier (serverId) - $folder_type = !empty($typedata$folder) ? $typedata$folder : 'mail'; - $folder_id = $this->folder_id($folder, $folder_type); - - $folders_list$folder_id = $this->folder_data($folder, $folder_type); - } - - if ($flat_mode) { - $folders_list = $this->folders_list_flat($folders_list, $type, $typedata); - }
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_storage_kolab4.php
Deleted
@@ -1,570 +0,0 @@ -<?php - -/* - +--------------------------------------------------------------------------+ - | Kolab Sync (ActiveSync for Kolab) | - | | - | Copyright (C) 2011-2023, Apheleia IT AG <contact@apheleia-it.ch> | - | | - | This program is free software: you can redistribute it and/or modify | - | it under the terms of the GNU Affero General Public License as published | - | by the Free Software Foundation, either version 3 of the License, or | - | (at your option) any later version. | - | | - | This program is distributed in the hope that it will be useful, | - | but WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | - | GNU Affero General Public License for more details. | - | | - | 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/> | - +--------------------------------------------------------------------------+ - | Author: Aleksander Machniak <machniak@kolabsys.com> | - +--------------------------------------------------------------------------+ -*/ - -/** - * Storage handling class with Kolab 4 support (IMAP + CalDAV + CardDAV) - */ -class kolab_sync_storage_kolab4 extends kolab_sync_storage -{ - protected $davStorage = null; - protected $relationSupport = false; - - /** - * This implements the 'singleton' design pattern - * - * @return kolab_sync_storage_kolab4 The one and only instance - */ - public static function get_instance() - { - if (!self::$instance) { - self::$instance = new kolab_sync_storage_kolab4(); - self::$instance->startup(); // init AFTER object was linked with self::$instance - } - - return self::$instance; - } - - /** - * Class initialization - */ - public function startup() - { - $sync = kolab_sync::get_instance(); - - if ($sync->username === null || $sync->password === null) { - throw new Exception("Unsupported storage handler use!"); - } - - $url = $sync->config->get('activesync_dav_server', 'http://localhost'); - - if (strpos($url, '://') === false) { - $url = 'http://' . $url; - } - - // Inject user+password to the URL, there's no other way to pass it to the DAV client - $url = str_replace('://', '://' . rawurlencode($sync->username) . ':' . rawurlencode($sync->password) . '@', $url); - - $this->davStorage = new kolab_storage_dav($url); // DAV - $this->storage = $sync->get_storage(); // IMAP - - // set additional header used by libkolab - $this->storage->set_options( - 'skip_deleted' => true, - 'threading' => false, - ); - - // Disable paging - $this->storage->set_pagesize(999999); - } - - /** - * Get list of folders available for sync - * - * @param string $deviceid Device identifier - * @param string $type Folder (class) type - * @param bool $flat_mode Enables flat-list mode - * - * @return array|bool List of mailbox folders, False on backend failure - */ - public function folders_list($deviceid, $type, $flat_mode = false) - { - $list = ; - - // get mail folders subscribed for sync - if ($type === self::MODEL_EMAIL) { - $folderdata = $this->folder_meta(); - - if (!is_array($folderdata)) { - return false; - } - - $special_folders = $this->storage->get_special_folders(true); - $type_map = - 'drafts' => 3, - 'trash' => 4, - 'sent' => 5, - ; - - // Get the folders "subscribed" for activesync - foreach ($folderdata as $folder => $meta) { - if (empty($meta'FOLDER') || empty($meta'FOLDER'$deviceid) - || empty($meta'FOLDER'$deviceid'S') - ) { - continue; - } - - // Force numeric folder name to be a string (T1283) - $folder = (string) $folder; - - // Activesync folder properties - $folder_data = $this->folder_data($folder, 'mail'); - - // Set proper type for special folders - if (($type = array_search($folder, $special_folders)) && isset($type_map$type)) { - $folder_data'type' = $type_map$type; - } - - $list$folder_data'serverId' = $folder_data; - } - } elseif (in_array($type, self::MODEL_CONTACTS, self::MODEL_CALENDAR, self::MODEL_TASKS)) { - if (!empty($this->folders)) { - foreach ($this->folders as $unique_key => $folder) { - if (strpos($unique_key, "DAV:$type:") === 0) { - $folder_data = $this->folder_data($folder, $type); - $list$folder_data'serverId' = $folder_data; - } - } - } - - // TODO: For now all DAV folders are subscribed - - if (empty($list)) { - foreach ($this->davStorage->get_folders($type) as $folder) { - $folder_data = $this->folder_data($folder, $type); - $list$folder_data'serverId' = $folder_data; - - // Store all folder objects in internal cache, otherwise - // Any access to the folder (or list) will invoke excessive DAV requests - $unique_key = $folder_data'serverId' . ":$deviceid:$type"; - $this->folders$unique_key = $folder; - } - } - } - /* - // TODO - if ($flat_mode) { - $list = $this->folders_list_flat($list, $type, $typedata); - } - */ - return $list; - } - - /** - * Creates folder and subscribes to the device - * - * @param string $name Folder name (UTF8) - * @param int $type Folder (ActiveSync) type - * @param string $deviceid Device identifier - * @param ?string $parentid Parent folder identifier - * - * @return string|false New folder identifier on success, False on failure - */ - public function folder_create($name, $type, $deviceid, $parentid = null) - { - // Mail folder - if ($type <= 6 || $type == 12) { - $parent = null; - $name = rcube_charset::convert($name, kolab_sync::CHARSET, 'UTF7-IMAP'); - - if ($parentid) { - $parent = $this->folder_id2name($parentid, $deviceid); - - if ($parent === null) { - throw new Syncroton_Exception_Status_FolderCreate(Syncroton_Exception_Status_FolderCreate::PARENT_NOT_FOUND); - } - } - - if ($parent !== null) { - $delim = $this->storage->get_hierarchy_delimiter(); - $name = $parent . $delim . $name; - } - - if ($this->storage->folder_exists($name)) { - throw new Syncroton_Exception_Status_FolderCreate(Syncroton_Exception_Status_FolderCreate::FOLDER_EXISTS); - } - - // TODO: Support setting folder types? -
View file
kolab-syncroton-2.4.2.tar.gz/phpstan.bootstrap.php
Deleted
@@ -1,12 +0,0 @@ -<?php - -// environment initialization - -require_once 'lib/init.php'; - -set_include_path(implode(PATH_SEPARATOR, - 'lib/plugins/libkolab/lib', - 'lib/plugins/libcalendaring', - 'lib/plugins/libcalendaring/lib', - ini_get('include_path'), -));
View file
kolab-syncroton-2.4.2.tar.gz/phpstan.neon
Deleted
@@ -1,24 +0,0 @@ -parameters: - bootstrapFiles: - - phpstan.bootstrap.php - - excludePaths: - - vendor - - lib/plugins - - lib/ext/Roundcube - - lib/ext/Syncroton - - ignoreErrors: - - |Access to an undefined property Syncroton_Model_.*| - - |Access to offset .* on an unknown class An.| - - paths: - - lib - - tests - - level: 4 - - scanDirectories: - - lib/ext - - treatPhpDocTypesAsCertain: false
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync
Deleted
-(directory)
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/FoldersTest.php
Deleted
@@ -1,389 +0,0 @@ -<?php - -class FoldersTest extends Tests\SyncTestCase -{ - /** - * Test FolderSync command - */ - public function testFolderSync() - { - // Note: We essentially assume the test account is in an initial state, extra folders may break tests - // Anyway, we first remove folders that might have been created during tests in this file - $this->deleteTestFolder('Test Folder', 'mail'); - $this->deleteTestFolder('Test Folder New', 'mail'); - $this->deleteTestFolder('Test Contacts Folder', 'contact'); - $this->deleteTestFolder('Test Contacts New', 'contact'); - - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <FolderSync xmlns="uri:FolderHierarchy"> - <SyncKey>0</SyncKey> - </FolderSync> - EOF; - - $response = $this->request($request, 'FolderSync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - // Note: We're expecting activesync_init_subscriptions=0 here. - if ($this->isStorageDriver('kolab4')) { - $folders = - 'Calendar', Syncroton_Command_FolderSync::FOLDERTYPE_CALENDAR, - 'Contacts', Syncroton_Command_FolderSync::FOLDERTYPE_CONTACT, - 'INBOX', Syncroton_Command_FolderSync::FOLDERTYPE_INBOX, - 'Drafts', Syncroton_Command_FolderSync::FOLDERTYPE_DRAFTS, - 'Sent', Syncroton_Command_FolderSync::FOLDERTYPE_SENTMAIL, - 'Trash', Syncroton_Command_FolderSync::FOLDERTYPE_DELETEDITEMS, - 'Tasks', Syncroton_Command_FolderSync::FOLDERTYPE_TASK, - ; - - } else { - $folders = - 'Calendar', Syncroton_Command_FolderSync::FOLDERTYPE_CALENDAR, - 'Contacts', Syncroton_Command_FolderSync::FOLDERTYPE_CONTACT, - 'INBOX', Syncroton_Command_FolderSync::FOLDERTYPE_INBOX, - 'Drafts', Syncroton_Command_FolderSync::FOLDERTYPE_DRAFTS, - 'Sent', Syncroton_Command_FolderSync::FOLDERTYPE_SENTMAIL, - 'Trash', Syncroton_Command_FolderSync::FOLDERTYPE_DELETEDITEMS, - 'Notes', Syncroton_Command_FolderSync::FOLDERTYPE_NOTE, - 'Tasks', Syncroton_Command_FolderSync::FOLDERTYPE_TASK, - ; - } - - $this->assertSame('1', $xpath->query("//ns:FolderSync/ns:Status")->item(0)->nodeValue); - $this->assertSame('1', $xpath->query("//ns:FolderSync/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame(strval(count($folders)), $xpath->query("//ns:FolderSync/ns:Changes/ns:Count")->item(0)->nodeValue); - - foreach ($folders as $idx => $folder) { - $this->assertSame($folder0, $xpath->query("//ns:FolderSync/ns:Changes/ns:Add/ns:DisplayName")->item($idx)->nodeValue); - $this->assertSame((string) $folder1, $xpath->query("//ns:FolderSync/ns:Changes/ns:Add/ns:Type")->item($idx)->nodeValue); - $this->assertSame('0', $xpath->query("//ns:FolderSync/ns:Changes/ns:Add/ns:ParentId")->item($idx)->nodeValue); - } - - // Test with multi-folder support enabled - self::$deviceType = 'iphone'; - - $response = $this->request($request, 'FolderSync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - if ($this->isStorageDriver('kolab4')) { - $folders = - 'Calendar', Syncroton_Command_FolderSync::FOLDERTYPE_CALENDAR_USER_CREATED, - // Note: Kolab 4 with Cyrus DAV uses Addressbook, but Kolab 3 with iRony would use 'Contacts' - '/^(Contacts|Addressbook)$/', Syncroton_Command_FolderSync::FOLDERTYPE_CONTACT_USER_CREATED, - 'INBOX', Syncroton_Command_FolderSync::FOLDERTYPE_INBOX, - 'Drafts', Syncroton_Command_FolderSync::FOLDERTYPE_DRAFTS, - 'Sent', Syncroton_Command_FolderSync::FOLDERTYPE_SENTMAIL, - 'Trash', Syncroton_Command_FolderSync::FOLDERTYPE_DELETEDITEMS, - // Note: For now Kolab 4 uses the same Calendar folder for calendar and tasks - '/^(Tasks|Calendar)$/', Syncroton_Command_FolderSync::FOLDERTYPE_TASK_USER_CREATED, - ; - } - - $this->assertSame('1', $xpath->query("//ns:FolderSync/ns:Status")->item(0)->nodeValue); - $this->assertSame('1', $xpath->query("//ns:FolderSync/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame(strval(count($folders)), $xpath->query("//ns:FolderSync/ns:Changes/ns:Count")->item(0)->nodeValue); - - foreach ($folders as $idx => $folder) { - $displayName = $xpath->query("//ns:FolderSync/ns:Changes/ns:Add/ns:DisplayName")->item($idx)->nodeValue; - if (str_starts_with($folder0, '/')) { - $this->assertMatchesRegularExpression($folder0, $displayName); - } else { - $this->assertSame($folder0, $displayName); - } - $this->assertSame((string) $folder1, $xpath->query("//ns:FolderSync/ns:Changes/ns:Add/ns:Type")->item($idx)->nodeValue); - $this->assertSame('0', $xpath->query("//ns:FolderSync/ns:Changes/ns:Add/ns:ParentId")->item($idx)->nodeValue); - $idx++; - } - - // After we switched to multi-folder supported mode we expect next FolderSync - // to delete the old "collective" folders - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <FolderSync xmlns="uri:FolderHierarchy"> - <SyncKey>1</SyncKey> - </FolderSync> - EOF; - - $response = $this->request($request, 'FolderSync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $deleted = $this->isStorageDriver('kolab4') ? 3 : 4; // No Notes folder in Kolab4 - $syncKey = 2; - - $this->assertSame('1', $xpath->query("//ns:FolderSync/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval($syncKey), $xpath->query("//ns:FolderSync/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame(strval($deleted), $xpath->query("//ns:FolderSync/ns:Changes/ns:Count")->item(0)->nodeValue); - $this->assertSame($deleted, $xpath->query("//ns:FolderSync/ns:Changes/ns:Delete")->length); - - return $syncKey; - } - - /** - * Test FolderCreate command - * - * @depends testFolderSync - */ - public function testFolderCreate($syncKey) - { - // Multi-folder mode - self::$deviceType = 'iphone'; - - // Create a mail folder - $folderName1 = 'Test Folder'; - $folderType = Syncroton_Command_FolderSync::FOLDERTYPE_MAIL_USER_CREATED; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <FolderCreate xmlns="uri:FolderHierarchy"> - <SyncKey>{$syncKey}</SyncKey> - <ParentId>0</ParentId> - <DisplayName>{$folderName1}</DisplayName> - <Type>{$folderType}</Type> - </FolderCreate> - EOF; - - $response = $this->request($request, 'FolderCreate'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame('1', $xpath->query("//ns:FolderCreate/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("//ns:FolderCreate/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame(1, $xpath->query("//ns:FolderCreate/ns:ServerId")->count()); - $folder1 = $xpath->query("//ns:FolderCreate/ns:ServerId")->item(0)->nodeValue; - - // Note: After FolderCreate there are no changes in the following FolderSync expected - - // Create a contacts folder - $folderName2 = 'Test Contacts Folder'; - $folderType = Syncroton_Command_FolderSync::FOLDERTYPE_CONTACT_USER_CREATED; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <FolderCreate xmlns="uri:FolderHierarchy"> - <SyncKey>{$syncKey}</SyncKey> - <ParentId>0</ParentId> - <DisplayName>{$folderName2}</DisplayName> - <Type>{$folderType}</Type> - </FolderCreate> - EOF; - - $response = $this->request($request, 'FolderCreate'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame('1', $xpath->query("//ns:FolderCreate/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("//ns:FolderCreate/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame(1, $xpath->query("//ns:FolderCreate/ns:ServerId")->count()); - $folder2 = $xpath->query("//ns:FolderCreate/ns:ServerId")->item(0)->nodeValue; - - // Note: After FolderCreate there are no changes in the following FolderSync expected
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/ItemOperationsTest.php
Deleted
@@ -1,81 +0,0 @@ -<?php - -class ItemOperationsTest extends Tests\SyncTestCase -{ - /** - * Test ItemOperations::EmptyFolderContents request - */ - public function testEmptyFolderContents() - { - $this->registerDevice(); - - // TODO: Test invalid folder ID - $collectionId = 'AAAAAAAAAAAA'; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <ItemOperations xmlns="uri:ItemOperations" xmlns:AirSync="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <EmptyFolderContents> - <AirSync:CollectionId>{$collectionId}</AirSync:CollectionId> - <Options><DeleteSubFolders/></Options> - </EmptyFolderContents> - </ItemOperations> - EOF; - - $response = $this->request($request, 'ItemOperations'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame('1', $xpath->query("//ns:ItemOperations/ns:Status")->item(0)->nodeValue); - $this->assertSame( - strval(Syncroton_Exception_Status_ItemOperations::ITEM_SERVER_ERROR), - $xpath->query("//ns:ItemOperations/ns:Response/ns:EmptyFolderContents/ns:Status")->item(0)->nodeValue - ); - $this->assertSame( - $collectionId, - $xpath->query("//ns:ItemOperations/ns:Response/ns:EmptyFolderContents/AirSync:CollectionId")->item(0)->nodeValue - ); - - // Test Trash folder - $collectionId = array_search('Trash', $this->folders); - $this->assertIsString($collectionId); - - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <ItemOperations xmlns="uri:ItemOperations" xmlns:AirSync="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <EmptyFolderContents> - <AirSync:CollectionId>{$collectionId}</AirSync:CollectionId> - <Options><DeleteSubFolders/></Options> - </EmptyFolderContents> - </ItemOperations> - EOF; - - $response = $this->request($request, 'ItemOperations'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame('1', $xpath->query("//ns:ItemOperations/ns:Status")->item(0)->nodeValue); - $this->assertSame('1', $xpath->query("//ns:ItemOperations/ns:Response/ns:EmptyFolderContents/ns:Status")->item(0)->nodeValue); - $this->assertSame($collectionId, $xpath->query("//ns:ItemOperations/ns:Response/ns:EmptyFolderContents/AirSync:CollectionId")->item(0)->nodeValue); - - // TODO: Test DAV folder - // TODO: Test a folder with subfolders - // TODO: Test non-empty folder and assert that all objects are gone - $this->markTestIncomplete(); - } - - /** - * Test ItemOperations::Fetch request - */ - public function testFetch() - { - $this->markTestIncomplete(); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/MeetingResponseTest.php
Deleted
@@ -1,131 +0,0 @@ -<?php - -namespace Tests\Sync; - -class MeetingResponseTest extends \Tests\SyncTestCase -{ - /** - * Test MeetingResponse command - */ - public function testAcceptingInvitation() - { - $this->emptyTestFolder($davFolder = 'Calendar', 'event'); - $this->emptyTestFolder('INBOX', 'mail'); - - $this->registerDevice(); - - // Do the initial INBOX sync - $folderId = '38b950ebd62cd9a66929c89615d0fc04'; // INBOX - $syncKey = 0; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame('1', $xpath->query("//ns:Sync/ns:Collections/ns:Collection/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("//ns:Sync/ns:Collections/ns:Collection/ns:SyncKey")->item(0)->nodeValue); - - // Append an invitation email, and sync it - $sync = \kolab_sync::get_instance(); - $replace = - '$from' => 'test.test@domain.tld', - '$to' => $sync->config->get('activesync_test_username'), - ; - $this->appendMail('INBOX', 'mail.itip1', $replace); - - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - <DeletesAsMoves>1</DeletesAsMoves> - <GetChanges>1</GetChanges> - <WindowSize>1</WindowSize> - <Options> - <FilterType>0</FilterType> - <Conflict>1</Conflict> - <BodyPreference xmlns="uri:AirSyncBase"> - <Type>2</Type> - <TruncationSize>51200</TruncationSize> - <AllOrNone>0</AllOrNone> - </BodyPreference> - </Options> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = $xpath->query("//ns:Sync/ns:Collections/ns:Collection")->item(0); - $this->assertSame('1', $xpath->query("ns:Status", $root)->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("ns:SyncKey", $root)->item(0)->nodeValue); - $this->assertSame(1, $xpath->query("ns:Commands/ns:Add", $root)->count()); - - $serverId = $xpath->query("ns:Commands/ns:Add/ns:ServerId", $root)->item(0)->nodeValue; - - $root = $xpath->query("ns:Commands/ns:Add/ns:ApplicationData", $root)->item(0); - $this->assertSame('You\'ve been invited to "Test"', $xpath->query("Email:Subject", $root)->item(0)->nodeValue); - $this->assertSame('Organizer <test.test@domain.tld>', $xpath->query("Email:From", $root)->item(0)->nodeValue); - $this->assertSame($replace'$to', $xpath->query("Email:To", $root)->item(0)->nodeValue); - $this->assertSame('0', $xpath->query("Email:Read", $root)->item(0)->nodeValue); - $this->assertSame('IPM.Schedule.Meeting.Request', $xpath->query("Email:MessageClass", $root)->item(0)->nodeValue); - $this->assertSame('urn:content-classes:calendarmessage', $xpath->query("Email:ContentClass", $root)->item(0)->nodeValue); - $root = $xpath->query("Email:MeetingRequest", $root)->item(0); - $this->assertSame('0', $xpath->query("Email:AllDayEvent", $root)->item(0)->nodeValue); - $this->assertSame('2023-12-07T13:00:00.000Z', $xpath->query("Email:StartTime", $root)->item(0)->nodeValue); - $this->assertSame('2023-12-07T13:30:00.000Z', $xpath->query("Email:EndTime", $root)->item(0)->nodeValue); - $this->assertSame('test.test@domain.tld', $xpath->query("Email:Organizer", $root)->item(0)->nodeValue); - $this->assertSame('1', $xpath->query("Email:ResponseRequested", $root)->item(0)->nodeValue); - $this->assertSame('1', $xpath->query("Email:DisallowNewTimeProposal", $root)->item(0)->nodeValue); - - // Accept the invitation - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <MeetingResponse xmlns="uri:MeetingResponse" xmlns:Search="uri:Search"> - <Request> - <UserResponse>1</UserResponse> - <CollectionId>{$folderId}</CollectionId> - <RequestId>{$serverId}</RequestId> - </Request> - </MeetingResponse> - EOF; - - $response = $this->request($request, 'MeetingResponse'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - $xpath->registerNamespace('MeetingResponse', 'uri:MeetingResponse'); - - $root = $xpath->query("//MeetingResponse:MeetingResponse/MeetingResponse:Result")->item(0); - $this->assertSame('1', $xpath->query("ns:Status", $root)->item(0)->nodeValue); - $this->assertSame($serverId, $xpath->query("ns:RequestId", $root)->item(0)->nodeValue); - $this->assertStringMatchesFormat("CRC%s", $xpath->query("ns:CalendarId", $root)->item(0)->nodeValue); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/MoveItemsTest.php
Deleted
@@ -1,334 +0,0 @@ -<?php - -class MoveItemsTest extends Tests\SyncTestCase -{ - /** - * Test moving an email message - */ - public function testMoveEmail() - { - $this->emptyTestFolder('INBOX', 'mail'); - $this->emptyTestFolder('Trash', 'mail'); - $uid = $this->appendMail('INBOX', 'mail.sync1'); - $this->registerDevice(); - - $inbox = array_search('INBOX', $this->folders); - $trash = array_search('Trash', $this->folders); - - // Initial sync - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync"> - <Collections> - <Collection> - <SyncKey>0</SyncKey> - <CollectionId>{$inbox}</CollectionId> - </Collection> - <Collection> - <SyncKey>0</SyncKey> - <CollectionId>{$trash}</CollectionId> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - // Sync mail from INBOX and Trash - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <SyncKey>1</SyncKey> - <CollectionId>{$inbox}</CollectionId> - <GetChanges>1</GetChanges> - </Collection> - <Collection> - <SyncKey>1</SyncKey> - <CollectionId>{$trash}</CollectionId> - <GetChanges>1</GetChanges> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame(1, $xpath->query("//ns:Sync/ns:Collections/ns:Collection")->count()); - $root = $xpath->query("//ns:Sync/ns:Collections/ns:Collection")->item(0); - $this->assertSame(1, $xpath->query("ns:Commands/ns:Add", $root)->count()); - $root = $xpath->query("ns:Commands/ns:Add", $root)->item(0); - $this->assertSame('test sync', $xpath->query("ns:ApplicationData/Email:Subject", $root)->item(0)->nodeValue); - - // Move the message to $trash - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <MoveItems xmlns="uri:Move"> - <Move> - <SrcMsgId>{$inbox}::{$uid}</SrcMsgId> - <SrcFldId>{$inbox}</SrcFldId> - <DstFldId>{$trash}</DstFldId> - </Move> - </MoveItems> - EOF; - - $response = $this->request($request, 'MoveItems'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - $xpath->registerNamespace('Move', 'uri:Move'); - - $root = $xpath->query("//Move:MoveItems/Move:Response")->item(0); - $this->assertSame('3', $xpath->query("Move:Status", $root)->item(0)->nodeValue); - $this->assertSame("{$inbox}::{$uid}", $xpath->query("Move:SrcMsgId", $root)->item(0)->nodeValue); - $serverId = $xpath->query("Move:DstMsgId", $root)->item(0)->nodeValue; - - // Sync mail from INBOX and Trash - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <SyncKey>2</SyncKey> - <CollectionId>{$inbox}</CollectionId> - <GetChanges>1</GetChanges> - </Collection> - <Collection> - <SyncKey>1</SyncKey> - <CollectionId>{$trash}</CollectionId> - <GetChanges>1</GetChanges> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = $xpath->query("//ns:Sync/ns:Collections/ns:Collection")->item(0); // INBOX - $this->assertSame($inbox, $xpath->query("ns:CollectionId", $root)->item(0)->nodeValue); - $this->assertSame(1, $xpath->query("ns:Commands/ns:Delete", $root)->count()); - $this->assertSame("$inbox::$uid", $xpath->query("ns:Commands/ns:Delete/ns:ServerId", $root)->item(0)->nodeValue); - - $root = $xpath->query("//ns:Sync/ns:Collections/ns:Collection")->item(1); // Trash - $this->assertSame($trash, $xpath->query("ns:CollectionId", $root)->item(0)->nodeValue); - $this->assertSame(1, $xpath->query("ns:Commands/ns:Add", $root)->count()); - $this->assertSame('test sync', $xpath->query("ns:Commands/ns:Add/ns:ApplicationData/Email:Subject", $root)->item(0)->nodeValue); - } - - /** - * Test moving a contact - */ - public function testMoveContact() - { - // Test with multi-folder support enabled - self::$deviceType = 'iphone'; - - $davFolder = $this->isStorageDriver('kolab') ? 'Contacts' : 'Addressbook'; - $this->emptyTestFolder($davFolder, 'contact'); - $this->deleteTestFolder($folderName = 'Test Contacts Folder', 'contact'); - $this->appendObject($davFolder, 'contact.vcard1', 'contact'); - - $this->registerDevice(); - - $srcFolderId = array_search($davFolder, $this->folders); - - // Create a contacts folder - $folderType = Syncroton_Command_FolderSync::FOLDERTYPE_CONTACT_USER_CREATED; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <FolderCreate xmlns="uri:FolderHierarchy"> - <SyncKey>1</SyncKey> - <ParentId>0</ParentId> - <DisplayName>{$folderName}</DisplayName> - <Type>{$folderType}</Type> - </FolderCreate> - EOF; - - $response = $this->request($request, 'FolderCreate'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $dstFolderId = $xpath->query("//ns:FolderCreate/ns:ServerId")->item(0)->nodeValue; - - // Sync both folders - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <Class>Contacts</Class> - <SyncKey>0</SyncKey> - <CollectionId>{$srcFolderId}</CollectionId> - </Collection> - <Collection> - <Class>Contacts</Class> - <SyncKey>0</SyncKey> - <CollectionId>{$dstFolderId}</CollectionId> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); -
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/OptionsTest.php
Deleted
@@ -1,16 +0,0 @@ -<?php - -class OptionsTest extends Tests\SyncTestCase -{ - /** - * Test Options command/request - */ - public function testOptions() - { - $response = self::$client->request('OPTIONS', ''); - $this->assertEquals(200, $response->getStatusCode()); - $this->assertStringContainsString('14', $response->getHeader('MS-Server-ActiveSync')0); - $this->assertStringContainsString('14.1', $response->getHeader('MS-ASProtocolVersions')0); - $this->assertStringContainsString('FolderSync', $response->getHeader('MS-ASProtocolCommands')0); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/ProvisionTest.php
Deleted
@@ -1,45 +0,0 @@ -<?php - -class ProvisionTest extends Tests\SyncTestCase -{ - /** - * Test Provision command - */ - public function testProvision() - { - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Provision xmlns="uri:Provision" xmlns:Settings="uri:Settings"> - <DeviceInformation xmlns="uri:Settings"> - <Set> - <Model>moto e(6) plus</Model> - <IMEI>000000000000000</IMEI> - <FriendlyName>pokerp_reteu_64</FriendlyName> - <OS>Android 9.58-8</OS> - <OSLanguage>Polish (Poland)</OSLanguage> - <MobileOperator/> - </Set> - </DeviceInformation> - <Policies> - <Policy> - <PolicyType>MS-EAS-Provisioning-WBXML</PolicyType> - </Policy> - </Policies> - </Provision> - EOF; - - $response = $this->request($request, 'Provision'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame('1', $xpath->query("//ns:Provision/ns:Status")->item(0)->nodeValue); - $this->assertSame('1', $xpath->query("//ns:Provision/Settings:DeviceInformation/Settings:Status")->item(0)->nodeValue); - $this->assertSame('2', $xpath->query("//ns:Provision/ns:Policies/ns:Policy/ns:Status")->item(0)->nodeValue); - - // TODO: Assert the properties have been set - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/SettingsTest.php
Deleted
@@ -1,80 +0,0 @@ -<?php - -class SettingsTest extends Tests\SyncTestCase -{ - /** - * Test Settings command - */ - public function testSettingsUserInformation() - { - // Test retrieving the settings - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Settings xmlns="uri:Settings"> - <UserInformation> - <Get/> - </UserInformation> - </Settings> - EOF; - - $response = $this->request($request, 'Settings'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = self::fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame('1', $xpath->query("//ns:Settings/ns:Status")->item(0)->nodeValue); - $this->assertSame('1', $xpath->query("//ns:Settings/ns:UserInformation/ns:Status")->item(0)->nodeValue); - $this->assertSame( - self::$username, - $xpath->query("//ns:Settings/ns:UserInformation/ns:Get/ns:Accounts/ns:Account/ns:EmailAddresses/ns:PrimarySmtpAddress")->item(0)->nodeValue - ); - } - - /** - * Test Settings command - */ - public function testSettingsDeviceInfomation() - { - // Test device info update - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Settings xmlns="uri:Settings"> - <DeviceInformation> - <Set> - <Model>moto plus</Model> - <IMEI>111111111</IMEI> - <FriendlyName>fn</FriendlyName> - <OS>Android 10</OS> - <OSLanguage>English</OSLanguage> - <MobileOperator/> - </Set> - </DeviceInformation> - </Settings> - EOF; - - $response = $this->request($request, 'Settings'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame('1', $xpath->query("//ns:Settings/ns:Status")->item(0)->nodeValue); - $this->assertSame('1', $xpath->query("//ns:Settings/ns:DeviceInformation/ns:Set/ns:Status")->item(0)->nodeValue); - - // TODO: Assert the properties have been set - } - - /** - * Test Settings command regarding OOF - */ - public function testSettingsOOF() - { - // TODO: Test OOF settings - $this->markTestIncomplete(); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/Sync
Deleted
-(directory)
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/Sync/CalendarTest.php
Deleted
@@ -1,75 +0,0 @@ -<?php - -namespace Tests\Sync\Sync; - -class CalendarTest extends \Tests\SyncTestCase -{ - /** - * Test Sync command - */ - public function testSync() - { - $this->emptyTestFolder($davFolder = 'Calendar', 'event'); - $this->registerDevice(); - - // Test empty folder - $folderId = 'Calendar::Syncroton'; - $syncKey = 0; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <Class>Calendar</Class> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - <DeletesAsMoves/> - <GetChanges/> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = "//ns:Sync/ns:Collections/ns:Collection"; - $this->assertSame('1', $xpath->query("{$root}/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("{$root}/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame($folderId, $xpath->query("{$root}/ns:CollectionId")->item(0)->nodeValue); - $this->assertSame(0, $xpath->query("{$root}/ns:Commands/ns:Add")->count()); - - // Append two event objects and sync them - $this->appendObject($davFolder, 'event.ics1', 'event'); - $this->appendObject($davFolder, 'event.ics2', 'event'); - - $request = str_replace("<SyncKey>0</SyncKey>", "<SyncKey>{$syncKey}</SyncKey>", $request); - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = "//ns:Sync/ns:Collections/ns:Collection"; - $this->assertSame('1', $xpath->query("{$root}/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("{$root}/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame($folderId, $xpath->query("{$root}/ns:CollectionId")->item(0)->nodeValue); - $this->assertSame(2, $xpath->query("{$root}/ns:Commands/ns:Add")->count()); - - $root .= "/ns:Commands/ns:Add"; - $this->assertStringMatchesFormat("CRC%s", $xpath->query("{$root}/ns:ServerId")->item(0)->nodeValue); - $this->assertSame('20240715T170000Z', $xpath->query("{$root}/ns:ApplicationData/Calendar:StartTime")->item(0)->nodeValue); - $this->assertSame('Meeting', $xpath->query("{$root}/ns:ApplicationData/Calendar:Subject")->item(0)->nodeValue); - $this->assertSame('20240714T170000Z', $xpath->query("{$root}/ns:ApplicationData/Calendar:StartTime")->item(1)->nodeValue); - $this->assertSame('Party', $xpath->query("{$root}/ns:ApplicationData/Calendar:Subject")->item(1)->nodeValue); - - return $syncKey; - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/Sync/ContactsTest.php
Deleted
@@ -1,250 +0,0 @@ -<?php - -namespace Tests\Sync\Sync; - -class ContactsTest extends \Tests\SyncTestCase -{ - /** - * Test Sync command - */ - public function testSync() - { - $davFolder = $this->isStorageDriver('kolab') ? 'Contacts' : 'Addressbook'; - $this->emptyTestFolder($davFolder, 'contact'); - $this->deleteTestFolder('Test Contacts Folder', 'contact'); // from other test files - $this->registerDevice(); - - // Test empty contacts folder - $folderId = 'Contacts::Syncroton'; - $syncKey = 0; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <Class>Contacts</Class> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - <DeletesAsMoves/> - <GetChanges/> - <Options> - <AirSyncBase:BodyPreference> - <AirSyncBase:Type>1</AirSyncBase:Type> - <AirSyncBase:TruncationSize>5120</AirSyncBase:TruncationSize> - </AirSyncBase:BodyPreference> - <Conflict>1</Conflict> - </Options> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = "//ns:Sync/ns:Collections/ns:Collection"; - $this->assertSame('1', $xpath->query("{$root}/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("{$root}/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame($folderId, $xpath->query("{$root}/ns:CollectionId")->item(0)->nodeValue); - $this->assertSame(0, $xpath->query("{$root}/ns:Commands/ns:Add")->count()); - - // Append two contact objects and sync them - // TODO: Test a folder with contact groups inside - $this->appendObject($davFolder, 'contact.vcard1', 'contact'); - $this->appendObject($davFolder, 'contact.vcard2', 'contact'); - - $request = str_replace("<SyncKey>0</SyncKey>", "<SyncKey>{$syncKey}</SyncKey>", $request); - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = "//ns:Sync/ns:Collections/ns:Collection"; - $this->assertSame('1', $xpath->query("{$root}/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("{$root}/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame($folderId, $xpath->query("{$root}/ns:CollectionId")->item(0)->nodeValue); - $this->assertSame(2, $xpath->query("{$root}/ns:Commands/ns:Add")->count()); - - $root .= "/ns:Commands/ns:Add"; - $this->assertStringMatchesFormat("CRC%s", $xpath->query("{$root}/ns:ServerId")->item(0)->nodeValue); - $this->assertSame('Jack', $xpath->query("{$root}/ns:ApplicationData/Contacts:FirstName")->item(0)->nodeValue); - $this->assertSame('Strong', $xpath->query("{$root}/ns:ApplicationData/Contacts:LastName")->item(0)->nodeValue); - $this->assertSame('Jane', $xpath->query("{$root}/ns:ApplicationData/Contacts:FirstName")->item(1)->nodeValue); - $this->assertSame('Doe', $xpath->query("{$root}/ns:ApplicationData/Contacts:LastName")->item(1)->nodeValue); - - return $syncKey; - } - - /** - * Test adding objects from client - * - * @depends testSync - */ - public function testAddFromClient($syncKey) - { - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase" xmlns:Contacts="uri:Contacts"> - <Collections> - <Collection> - <Class>Contacts</Class> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>Contacts::Syncroton</CollectionId> - <DeletesAsMoves/> - <GetChanges/> - <Options> - <AirSyncBase:BodyPreference> - <AirSyncBase:Type>1</AirSyncBase:Type> - <AirSyncBase:TruncationSize>5120</AirSyncBase:TruncationSize> - </AirSyncBase:BodyPreference> - <Conflict>1</Conflict> - </Options> - <Commands> - <Add> - <ClientId>42</ClientId> - <ApplicationData> - <Contacts:FirstName>Lars</Contacts:FirstName> - </ApplicationData> - </Add> - </Commands> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = $xpath->query("//ns:Sync/ns:Collections/ns:Collection")->item(0); - $this->assertSame('1', $xpath->query("ns:Status", $root)->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("ns:SyncKey", $root)->item(0)->nodeValue); - $root = $xpath->query("ns:Responses/ns:Add", $root)->item(0); - $this->assertSame('1', $xpath->query("ns:Status", $root)->item(0)->nodeValue); - $this->assertSame('42', $xpath->query("ns:ClientId", $root)->item(0)->nodeValue); - $serverId = $xpath->query("ns:ServerId", $root)->item(0)->nodeValue; - $this->assertStringMatchesFormat("CRC%s", $serverId); - - // TODO: Test the content on the server - - return $syncKey, $serverId; - } - - /** - * Test updating objects from client - * - * @depends testAddFromClient - */ - public function testChangeFromClient($params) - { - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase" xmlns:Contacts="uri:Contacts"> - <Collections> - <Collection> - <Class>Contacts</Class> - <SyncKey>{$params0}</SyncKey> - <CollectionId>Contacts::Syncroton</CollectionId> - <DeletesAsMoves/> - <GetChanges/> - <Options> - <AirSyncBase:BodyPreference> - <AirSyncBase:Type>1</AirSyncBase:Type> - <AirSyncBase:TruncationSize>5120</AirSyncBase:TruncationSize> - </AirSyncBase:BodyPreference> - <Conflict>1</Conflict> - </Options> - <Commands> - <Change> - <ServerId>{$params1}</ServerId> - <ApplicationData> - <Contacts:FirstName>First</Contacts:FirstName> - <Contacts:LastName>Last</Contacts:LastName> - </ApplicationData> - </Change> - </Commands> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = $xpath->query("//ns:Sync/ns:Collections/ns:Collection")->item(0); - $this->assertSame('1', $xpath->query("ns:Status", $root)->item(0)->nodeValue); - $this->assertSame(strval(++$params0), $xpath->query("ns:SyncKey", $root)->item(0)->nodeValue); - $this->assertSame(0, $xpath->query("ns:Responses", $root)->length); - - // TODO: Assert updated content on the server - - return $params; - }
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/Sync/EmailExtraDataMigrationTest.php
Deleted
@@ -1,115 +0,0 @@ -<?php - -namespace Tests\Sync\Sync; - -class EmailExtraDataMigrationTest extends \Tests\SyncTestCase -{ - /** - * Test Sync command - */ - public function testSync() - { - $this->emptyTestFolder('INBOX', 'mail'); - $this->registerDevice(); - - - // Test INBOX - $folderId = '38b950ebd62cd9a66929c89615d0fc04'; - $syncKey = 0; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - $this->assertEquals(200, $response->getStatusCode()); - $syncKey++; - - // List mail in INBOX - // Append two mail messages - $this->appendMail('INBOX', 'mail.sync1'); - $this->appendMail('INBOX', 'mail.sync2'); - - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - <DeletesAsMoves>1</DeletesAsMoves> - <GetChanges>1</GetChanges> - <Options> - <FilterType>0</FilterType> - <Conflict>1</Conflict> - <BodyPreference xmlns="uri:AirSyncBase"> - <Type>2</Type> - <TruncationSize>51200</TruncationSize> - <AllOrNone>0</AllOrNone> - </BodyPreference> - </Options> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = "//ns:Sync/ns:Collections/ns:Collection"; - $this->assertSame('1', $xpath->query("{$root}/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("{$root}/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame($folderId, $xpath->query("{$root}/ns:CollectionId")->item(0)->nodeValue); - $this->assertSame(2, $xpath->query("{$root}/ns:Commands/ns:Add")->count()); - - // Simulate migration by clearing extra_data - $this->runSQLQuery("UPDATE syncroton_synckey SET extra_data = null;"); - - // List the rest of the mail - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - <DeletesAsMoves>1</DeletesAsMoves> - <GetChanges>1</GetChanges> - <Options> - <FilterType>0</FilterType> - <Conflict>1</Conflict> - <BodyPreference xmlns="uri:AirSyncBase"> - <Type>2</Type> - <TruncationSize>51200</TruncationSize> - <AllOrNone>0</AllOrNone> - </BodyPreference> - </Options> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - // We expect an empty response without a change - $this->assertEquals(0, $response->getBody()->getSize()); - - return $syncKey; - } - - -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/Sync/EmailITipTest.php
Deleted
@@ -1,81 +0,0 @@ -<?php - -namespace Tests\Sync\Sync; - -class EmailITipTest extends \Tests\SyncTestCase -{ - /** - * Test Sync with invalid itip - */ - public function testSyncWithInvalidITip() - { - $this->emptyTestFolder('INBOX', 'mail'); - $this->registerDevice(); - - // Test INBOX - $folderId = '38b950ebd62cd9a66929c89615d0fc04'; - $syncKey = 0; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - $this->assertEquals(200, $response->getStatusCode()); - $syncKey++; - - // Append messages - $this->appendMail('INBOX', 'mail.itip1'); - $this->appendMail('INBOX', 'mail.itip.invalid'); - $this->appendMail('INBOX', 'mail.sync2'); - - // Test that the synchornization works with the invalid itip in the middle - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - <DeletesAsMoves>1</DeletesAsMoves> - <GetChanges>1</GetChanges> - <Options> - <FilterType>0</FilterType> - <Conflict>1</Conflict> - <BodyPreference xmlns="uri:AirSyncBase"> - <Type>2</Type> - <TruncationSize>51200</TruncationSize> - <AllOrNone>0</AllOrNone> - </BodyPreference> - </Options> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - // print($dom->saveXML()); - - $root = "//ns:Sync/ns:Collections/ns:Collection"; - $this->assertSame('1', $xpath->query("{$root}/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("{$root}/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame($folderId, $xpath->query("{$root}/ns:CollectionId")->item(0)->nodeValue); - // We expect all three messages to synchronize, even if we fail to parse the invitation in the middle - $this->assertSame(3, $xpath->query("{$root}/ns:Commands/ns:Add")->count()); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/Sync/EmailTest.php
Deleted
@@ -1,468 +0,0 @@ -<?php - -namespace Tests\Sync\Sync; - -class EmailTest extends \Tests\SyncTestCase -{ - /** - * Test Sync command - */ - public function testSync() - { - $this->emptyTestFolder('INBOX', 'mail'); - $this->registerDevice(); - - // Test invalid collection identifier - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync"> - <Collections> - <Collection> - <SyncKey>0</SyncKey> - <CollectionId>1111111111</CollectionId> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame('12', $xpath->query("//ns:Sync/ns:Status")->item(0)->nodeValue); - - // Test INBOX - $folderId = '38b950ebd62cd9a66929c89615d0fc04'; - $syncKey = 0; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $this->assertSame('1', $xpath->query("//ns:Sync/ns:Collections/ns:Collection/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("//ns:Sync/ns:Collections/ns:Collection/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame('Email', $xpath->query("//ns:Sync/ns:Collections/ns:Collection/ns:Class")->item(0)->nodeValue); - $this->assertSame($folderId, $xpath->query("//ns:Sync/ns:Collections/ns:Collection/ns:CollectionId")->item(0)->nodeValue); - - // Test listing mail in INBOX, use WindowSize=1 - // Append two mail messages - $this->appendMail('INBOX', 'mail.sync1'); - $this->appendMail('INBOX', 'mail.sync2'); - - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - <DeletesAsMoves>1</DeletesAsMoves> - <GetChanges>1</GetChanges> - <WindowSize>1</WindowSize> - <Options> - <FilterType>0</FilterType> - <Conflict>1</Conflict> - <BodyPreference xmlns="uri:AirSyncBase"> - <Type>2</Type> - <TruncationSize>51200</TruncationSize> - <AllOrNone>0</AllOrNone> - </BodyPreference> - </Options> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = "//ns:Sync/ns:Collections/ns:Collection"; - $this->assertSame('1', $xpath->query("{$root}/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("{$root}/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame($folderId, $xpath->query("{$root}/ns:CollectionId")->item(0)->nodeValue); - $this->assertSame(1, $xpath->query("{$root}/ns:Commands/ns:Add")->count()); - - // Note: We assume messages are in IMAP default order, it may change in future - $root .= "/ns:Commands/ns:Add"; - $this->assertStringMatchesFormat("{$folderId}::%d", $xpath->query("{$root}/ns:ServerId")->item(0)->nodeValue); - $this->assertSame('test sync', $xpath->query("{$root}/ns:ApplicationData/Email:Subject")->item(0)->nodeValue); - - // List the rest of the mail - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - <DeletesAsMoves>1</DeletesAsMoves> - <GetChanges>1</GetChanges> - <Options> - <FilterType>0</FilterType> - <Conflict>1</Conflict> - <BodyPreference xmlns="uri:AirSyncBase"> - <Type>2</Type> - <TruncationSize>51200</TruncationSize> - <AllOrNone>0</AllOrNone> - </BodyPreference> - </Options> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - - $dom = $this->fromWbxml($response->getBody()); - $xpath = $this->xpath($dom); - - $root = "//ns:Sync/ns:Collections/ns:Collection"; - $this->assertSame('1', $xpath->query("{$root}/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("{$root}/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame($folderId, $xpath->query("{$root}/ns:CollectionId")->item(0)->nodeValue); - $this->assertSame(1, $xpath->query("{$root}/ns:Commands/ns:Add")->count()); - - // Note: We assume messages are in IMAP default order, it may change in future - $root .= "/ns:Commands/ns:Add"; - $this->assertStringMatchesFormat("{$folderId}::%d", $xpath->query("{$root}/ns:ServerId")->item(0)->nodeValue); - $this->assertSame('sync test with attachment', $xpath->query("{$root}/ns:ApplicationData/Email:Subject")->item(0)->nodeValue); - - return $syncKey; - } - - /** - * Test empty sync response - * - * @depends testSync - */ - public function testEmptySync($syncKey) - { - $folderId = '38b950ebd62cd9a66929c89615d0fc04'; - $request = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase"> - <Collections> - <Collection> - <SyncKey>{$syncKey}</SyncKey> - <CollectionId>{$folderId}</CollectionId> - <DeletesAsMoves>1</DeletesAsMoves> - <GetChanges>1</GetChanges> - <Options> - <FilterType>0</FilterType> - <Conflict>1</Conflict> - <BodyPreference xmlns="uri:AirSyncBase"> - <Type>2</Type> - <TruncationSize>51200</TruncationSize> - <AllOrNone>0</AllOrNone> - </BodyPreference> - </Options> - </Collection> - </Collections> - </Sync> - EOF; - - $response = $this->request($request, 'Sync'); - - $this->assertEquals(200, $response->getStatusCode()); - // We expect an empty response without a change - $this->assertEquals(0, $response->getBody()->getSize()); - - return $syncKey; - }
View file
kolab-syncroton-2.4.2.tar.gz/tests/SyncTestCase.php
Deleted
@@ -1,404 +0,0 @@ -<?php - -namespace Tests; - -class SyncTestCase extends \PHPUnit\Framework\TestCase -{ - protected static ?\GuzzleHttp\Client $client; - protected static ?string $deviceId; - protected static ?string $deviceType; - protected static ?string $host; - protected static ?string $username; - protected static ?string $password; - protected static bool $authenticated = false; - - protected array $folders = ; - - /** - * {@inheritDoc} - */ - public function setUp(): void - { - if (empty(self::$username)) { - $this->markTestSkipped('Not setup'); - } - - self::$deviceType = null; - } - - /** - * {@inheritDoc} - */ - public static function setUpBeforeClass(): void - { - $sync = \kolab_sync::get_instance(); - $config = $sync->config; - $db = $sync->get_dbh(); - - self::$username = $config->get('activesync_test_username'); - self::$password = $config->get('activesync_test_password'); - self::$host = $config->get('activesync_test_host', 'http://localhost:8000'); - - if (empty(self::$username)) { - return; - } - - self::$deviceId = 'test' . time(); - - $db->query('DELETE FROM syncroton_device'); - $db->query('DELETE FROM syncroton_synckey'); - $db->query('DELETE FROM syncroton_folder'); - $db->query('DELETE FROM syncroton_data'); - $db->query('DELETE FROM syncroton_data_folder'); - $db->query('DELETE FROM syncroton_content'); - - self::$client = new \GuzzleHttp\Client( - 'http_errors' => false, - 'base_uri' => self::$host, - 'verify' => false, - 'auth' => self::$username, self::$password, - 'connect_timeout' => 10, - 'timeout' => 10, - 'headers' => - 'Content-Type' => 'application/xml; charset=utf-8', - 'Depth' => '1', - , - ); - - // TODO: execute: php -S localhost:8000 - } - - /** - * {@inheritDoc} - */ - public static function tearDownAfterClass(): void - { - if (self::$deviceId) { - $sync = \kolab_sync::get_instance(); - - if (self::$authenticated || $sync->authenticate(self::$username, self::$password)) { - $sync->password = self::$password; - - $storage = $sync->storage(); - $storage->device_delete(self::$deviceId); - } - - $db = $sync->get_dbh(); - $db->query('DELETE FROM syncroton_device'); - $db->query('DELETE FROM syncroton_synckey'); - $db->query('DELETE FROM syncroton_folder'); - } - } - - /** - * Append an email message to the IMAP folder - */ - protected function appendMail($folder, $filename, $replace = ) - { - $imap = $this->getImapStorage(); - - $source = __DIR__ . '/src/' . $filename; - - if (!file_exists($source)) { - exit("File does not exist: {$source}"); - } - - $is_file = true; - - if (!empty($replace)) { - $is_file = false; - $source = file_get_contents($source); - foreach ($replace as $token => $value) { - $source = str_replace($token, $value, $source); - } - } - - $uid = $imap->save_message($folder, $source, '', $is_file); - - if ($uid === false) { - exit("Failed to append mail into {$folder}"); - } - - return $uid; - } - - /** - * Run A SQL query - */ - protected function runSQLQuery($query) - { - $sync = \kolab_sync::get_instance(); - $db = $sync->get_dbh(); - $db->query($query); - } - - /** - * Mark an email message as read over IMAP - */ - protected function markMailAsRead($folder, $uids) - { - $imap = $this->getImapStorage(); - return $imap->set_flag($uids, 'SEEN', $folder); - } - - /** - * List emails over IMAP - */ - protected function listEmails($folder, $uids) - { - $imap = $this->getImapStorage(); - return $imap->list_flags($folder, $uids); - } - - /** - * Append an DAV object to a DAV/IMAP folder - */ - protected function appendObject($foldername, $filename, $type) - { - $path = __DIR__ . '/src/' . $filename; - - if (!file_exists($path)) { - exit("File does not exist: {$path}"); - } - - $content = file_get_contents($path); - $uid = preg_match('/UID:(?:urn:uuid:)?(a-z0-9-+)/', $content, $m) ? $m1 : null; - - if (empty($uid)) { - exit("Filed to find UID in {$path}"); - } - - if ($this->isStorageDriver('kolab')) { - $imap = $this->getImapStorage(); - if ($imap->folder_exists($foldername)) { - // TODO - exit("Not implemented for Kolab v3 storage driver"); - } - - return; - } - - $dav = $this->getDavStorage(); - - foreach ($dav->get_folders($type) as $folder) { - if ($folder->get_name() === $foldername) { - $dav_type = $folder->get_dav_type(); - $location = $folder->object_location($uid); - - if ($folder->dav->create($location, $content, $dav_type) !== false) { - return; - } - } - } - - exit("Failed to append object into {$foldername}"); - } - - /** - * Delete a folder - */
View file
kolab-syncroton-2.4.2.tar.gz/tests/Unit
Deleted
-(directory)
View file
kolab-syncroton-2.4.2.tar.gz/tests/Unit/BodyConverterTest.php
Deleted
@@ -1,41 +0,0 @@ -<?php - -class BodyConverterTest extends PHPUnit\Framework\TestCase -{ - public function data_html_to_text() - { - return - '', '', - '<div></div>', '', - '<div>a</div>', 'a', - '<html><head><title>title</title></head></html>', '', - ; - } - - /** - * @dataProvider data_html_to_text - */ - public function test_html_to_text($html, $text) - { - $converter = new kolab_sync_body_converter($html, Syncroton_Model_EmailBody::TYPE_HTML); - $output = $converter->convert(Syncroton_Model_EmailBody::TYPE_PLAINTEXT); - - $this->assertEquals(trim($text), trim($output)); - } - - /** - * Test RTF convertion to HTML and Plain text - */ - public function test_rtf_to_text() - { - $rtf = file_get_contents(__DIR__ . '/../src/sample.rtf'); - - $converter = new kolab_sync_body_converter($rtf, Syncroton_Model_EmailBody::TYPE_RTF); - - $output = $converter->convert(Syncroton_Model_EmailBody::TYPE_PLAINTEXT); - $this->assertStringContainsString('This is text', trim($output)); - - $output = $converter->convert(Syncroton_Model_EmailBody::TYPE_HTML); - $this->assertStringContainsString('<span style="font-family:Helvetica,sans-serif;color:#0000ff;">anchor</span>', trim($output)); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Unit/DataCalendarTest.php
Deleted
@@ -1,126 +0,0 @@ -<?php - -class DataCalendarTest extends PHPUnit\Framework\TestCase -{ - /** - * Test for kolab_sync_data_calendar::from_kolab_alarm() - */ - public function test_from_kolab_alarm() - { - $obj = new kolab_sync_data_calendar_test(); - - $result = $obj->from_kolab_alarm(); - $this->assertSame(null, $result); - - $event = 'valarms' => - 'action' => 'DISPLAY', - 'trigger' => 'PT5M', - ; - $result = $obj->from_kolab_alarm($event); - $this->assertSame(null, $result); - - $event = 'valarms' => - 'action' => 'DISPLAY', - 'trigger' => '-PT5M', - ; - $result = $obj->from_kolab_alarm($event); - $this->assertSame(5, $result); - - $event = 'valarms' => - 'action' => 'DISPLAY', - 'trigger' => 'PT0M', - ; - $result = $obj->from_kolab_alarm($event); - $this->assertSame(0, $result); - - $event = 'valarms' => - 'action' => 'DISPLAY', - 'trigger' => '-PT0M', - ; - $result = $obj->from_kolab_alarm($event); - $this->assertSame(0, $result); - - $event = 'valarms' => - 'action' => 'DISPLAY', - 'trigger' => 'PT0S', - ; - $result = $obj->from_kolab_alarm($event); - $this->assertSame(0, $result); - - // alarms on specified DateTime (T2420) - - $event = - // no start datetime defined - 'valarms' => - - 'action' => 'DISPLAY', - 'trigger' => new DateTime('now + 1 hour'), - , - , - ; - $result = $obj->from_kolab_alarm($event); - $this->assertSame(null, $result); - - $event = - 'start' => new DateTime('now + 10 minutes'), - 'valarms' => - - 'action' => 'DISPLAY', - 'trigger' => new DateTime('now + 1 hour'), - , - , - ; - $result = $obj->from_kolab_alarm($event); - $this->assertSame(null, $result); - - $event = - 'start' => new DateTime('now + 60 minutes'), - 'valarms' => - - 'action' => 'DISPLAY', - 'trigger' => new DateTime('now + 50 minutes'), - , - , - ; - $result = $obj->from_kolab_alarm($event); - $this->assertSame(10, $result); - } - - /** - * Test for kolab_sync_data_calendar::to_kolab_alarm() - */ - public function test_to_kolab_alarm() - { - $obj = new kolab_sync_data_calendar_test(); - - $result = $obj->to_kolab_alarm(null, ); - $this->assertSame(, $result); - - $result = $obj->to_kolab_alarm(0, ); - $this->assertSame('-PT0M', $result0'trigger'); - - $result = $obj->to_kolab_alarm(15, ); - $this->assertSame('-PT15M', $result0'trigger'); - $this->assertSame('DISPLAY', $result0'action'); - } -} - -/** - * kolab_sync_data_calendar wrapper, so we can test protected methods too - */ -class kolab_sync_data_calendar_test extends kolab_sync_data_calendar -{ - public function __construct() - { - } - - public function from_kolab_alarm($value) - { - return parent::from_kolab_alarm($value); - } - - public function to_kolab_alarm($value, $event) - { - return parent::to_kolab_alarm($value, $event); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Unit/DataEmailTest.php
Deleted
@@ -1,37 +0,0 @@ -<?php - -class DataEmailTest extends PHPUnit\Framework\TestCase -{ - /** - * Test GlobalObjId encoding/decoding - */ - public function test_globalobjid() - { - // https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-asemail/e7424ddc-dd10-431e-a0b7-5c794863370e - $input = 'BAAAAIIA4AB0xbcQGoLgCAAAAAAAAAAAAAAAAAAAAAAAAAAAMwAAAHZDYWwtVWlkAQAAAHs4MTQxMkQzQy0yQTI0LTRFOUQtQjIwRS0xMUY3QkJFOTI3OTl9AA=='; - $output = kolab_sync_data_email::decodeGlobalObjId($input); - - $this->assertSame(51, $output'bytecount'); - $this->assertSame('{81412D3C-2A24-4E9D-B20E-11F7BBE92799}', $output'uid'); - - $encoded = kolab_sync_data_email::encodeGlobalObjId($output); - $this->assertSame($encoded, $input); - - $input = 'BAAAAIIA4AB0xbcQGoLgCAfUCRDgQMnBJoXEAQAAAAAAAAAAEAAAAAvw7UtuTulOnjnjhns3jvM='; - $output = kolab_sync_data_email::decodeGlobalObjId($input); - - $this->assertSame(16, $output'bytecount'); - $this->assertSame(2004, $output'year'); - $this->assertSame(9, $output'month'); - $this->assertSame(16, $output'day'); - $this->assertSame(127373090979660000, $output'now'); - - // This is how the "now" value is interpreted - // $winSecs = (int)($output'now' / 10000000); // convert microseconds to seconds - // $unixTimestamp = ($winSecs - 11644473600); // subtract 1.1.1600 - 1.1.1970 difference in seconds - // print(date(DateTime::RFC822, $unixTimestamp)); - - $encoded = kolab_sync_data_email::encodeGlobalObjId($output); - $this->assertSame($encoded, $input); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Unit/DataTasksTest.php
Deleted
@@ -1,78 +0,0 @@ -<?php - -class DataTasksTest extends PHPUnit\Framework\TestCase -{ - public function data_prio() - { - return - 0, null, - 1, 2, - 2, 2, - 3, 2, - 4, 2, - 5, 1, - 6, 0, - 7, 0, - 8, 0, - 9, 0, - // invalid input - 10, null, - ; - } - - public function data_importance() - { - return - 0, 9, - 1, 5, - 2, 1, - // invalid input - null, null, - 5, null, - ; - } - - /** - * Test for kolab_sync_data_tasks::prio_to_importance() - * @dataProvider data_prio() - */ - public function test_prio_to_importance($input, $output) - { - $data = new kolab_sync_data_tasks_test(); - $result = $data->prio_to_importance($input); - - $this->assertEquals($output, $result); - } - - /** - * Test for kolab_sync_data_tasks::importance_to_prio() - * @dataProvider data_importance() - */ - public function test_importance_to_prio($input, $output) - { - $data = new kolab_sync_data_tasks_test(); - $result = $data->importance_to_prio($input); - - $this->assertEquals($output, $result); - } -} - -/** - * kolab_sync_data_tasks wrapper, so we can test preotected methods too - */ -class kolab_sync_data_tasks_test extends kolab_sync_data_tasks -{ - public function __construct() - { - } - - public function prio_to_importance($value) - { - return parent::prio_to_importance($value); - } - - public function importance_to_prio($value) - { - return parent::importance_to_prio($value); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Unit/DataTest.php
Deleted
@@ -1,152 +0,0 @@ -<?php - -class DataTest extends PHPUnit\Framework\TestCase -{ - /** - * Test for kolab_sync_data::recurrence_to_kolab() - */ - public function test_recurrence_to_kolab() - { - $xml = '<!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase" xmlns:Calendar="uri:Calendar"> - <ApplicationData> - <Calendar:Recurrence> - <Calendar:Type>0</Calendar:Type> - <Calendar:Interval>1</Calendar:Interval> - <Calendar:Until>20101128T225959Z</Calendar:Until> - </Calendar:Recurrence> - </ApplicationData> - </Sync>'; - - $xml = new SimpleXMLElement($xml); - $event = new Syncroton_Model_Event($xml->ApplicationData); - $data = new kolab_sync_data_test(); - - $result = $data->recurrence_to_kolab($event); - - $this->assertEquals('DAILY', $result'FREQ'); - $this->assertEquals(1, $result'INTERVAL'); - $this->assertEquals('20101128T225959Z', $result'UNTIL'->format("Ymd\THis\Z")); - - $xml = '<!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase" xmlns:Calendar="uri:Calendar"> - <ApplicationData> - <Calendar:Recurrence> - <Calendar:Type>1</Calendar:Type> - <Calendar:Interval>1</Calendar:Interval> - <Calendar:DayOfWeek>8</Calendar:DayOfWeek> - </Calendar:Recurrence> - </ApplicationData> - </Sync>'; - - $xml = new SimpleXMLElement($xml); - $event = new Syncroton_Model_Event($xml->ApplicationData); - - $result = $data->recurrence_to_kolab($event, null); - - $this->assertEquals('WEEKLY', $result'FREQ'); - $this->assertEquals(1, $result'INTERVAL'); - $this->assertEquals('WE', $result'BYDAY'); - } - - /** - * Test for kolab_sync_data::recurrence_from_kolab() - */ - public function test_recurrence_from_kolab() - { - $event = - 'uid' => '52A09F6151F020312D99779F86838CF5-93BC4FC398A3FD52', - '_type' => 'event', - 'priority' => 0, - 'attendees' => - - 'rsvp' => false, - 'email' => 'bartek.machniak@nestle.kolab.ch', - 'role' => 'ORGANIZER', - 'status' => 'ACCEPTED', - , - - 'name' => 'Machniak, Aleksander', - 'status' => 'ACCEPTED', - 'cutype' => 'INDIVIDUAL', - 'rsvp' => false, - 'email' => 'aleksander.machniak@nestle.kolab.ch', - , - , - 'created' => new DateTime('2023-10-20 09:49:26.000000'), - 'changed' => new DateTime('2023-10-20 09:49:34.000000'), - 'description' => 'description', - 'end' => new DateTime('2023-10-20 14:30:00.000000'), - 'start' => new DateTime('2023-10-20 14:00:00.000000'), - 'location' => '', - 'organizer' => - 'rsvp' => false, - 'email' => 'bartek.machniak@nestle.kolab.ch', - 'role' => 'ORGANIZER', - 'status' => 'ACCEPTED', - , - 'sequence' => 0, - 'status' => 'CONFIRMED', - 'free_busy' => 'busy', - 'allday' => false, - 'recurrence' => - 'FREQ' => 'WEEKLY', - 'INTERVAL' => '1', - , - ; - - $data = new kolab_sync_data_test(); - - $data->recurrence_from_kolab(null, $event, $result); - - $this->assertEquals($data::RECUR_TYPE_WEEKLY, $result'recurrence'->type); - $this->assertEquals($data::RECUR_DOW_FRIDAY, $result'recurrence'->dayOfWeek); - $this->assertEquals(1, $result'recurrence'->interval); - - $event'recurrence' = - 'FREQ' => 'MONTHLY', - 'BYMONTHDAY' => '2,15', - 'INTERVAL' => '5', - 'COUNT' => 3, - ; - - $data->recurrence_from_kolab(null, $event, $result); - - $this->assertEquals($data::RECUR_TYPE_MONTHLY, $result'recurrence'->type); - $this->assertEquals(2, $result'recurrence'->dayOfMonth); - $this->assertEquals(5, $result'recurrence'->interval); - $this->assertEquals(3, $result'recurrence'->occurrences); - - // TODO: More cases - } -} - -/** - * kolab_sync_data wrapper, so we can test preotected methods too - */ -class kolab_sync_data_test extends kolab_sync_data -{ - public function __construct() - { - } - - public function recurrence_to_kolab($data, $dummy1 = null, $dummy2 = null) - { - return parent::recurrence_to_kolab($data, null); - } - - public function recurrence_from_kolab($collection, $data, &$result, $type = 'Event') - { - return parent::recurrence_from_kolab($collection, $data, $result, $type); - } - - public function toKolab($data, $folderId, $entry = null, $timezone = null) - { - return ; - } - - public function getEntry(Syncroton_Model_SyncCollection $collection, $serverId, $as_array = false) - { - throw new Syncroton_Exception_NotFound("Not implemented"); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Unit/MessageTest.php
Deleted
@@ -1,146 +0,0 @@ -<?php - -class MessageTest extends PHPUnit\Framework\TestCase -{ - /** - * Test message parsing and headers setting - */ - public function test_headers() - { - $source = file_get_contents(TESTS_DIR . '/src/mail.plain'); - $message = new kolab_sync_message($source); - $headers = $message->headers(); - - $this->assertArrayHasKey('MIME-Version', $headers); - $this->assertCount(8, $headers); - $this->assertEquals('kolab@domain.tld', $headers'To'); - - // test set_header() - $message->set_header('to', 'test@domain.tld'); - $headers = $message->headers(); - - $this->assertCount(8, $headers); - $this->assertEquals('test@domain.tld', $headers'To'); - } - - /** - * Test message parsing - */ - public function test_source() - { - $source = file_get_contents(TESTS_DIR . '/src/mail.plain'); - $message = new kolab_sync_message($source); - $result = $message->source(); - - $this->assertEquals($source, str_replace("\r\n", "\n", $result)); - } - - /** - * Test adding attachments to the message - */ - public function test_attachment() - { - $source = file_get_contents(TESTS_DIR . '/src/mail.plain'); - $mixed = file_get_contents(TESTS_DIR . '/src/mail.plain.mixed'); - $mixed2 = file_get_contents(TESTS_DIR . '/src/mail.mixed'); - - // test adding attachment to text/plain message - $message = new kolab_sync_message($source); - $message->add_attachment('aaa', - 'content_type' => 'text/plain', - 'encoding' => '8bit', - ); - - $result = $message->source(); - $result = str_replace("\r\n", "\n", $result); - if (preg_match('/boundary="(^"+)"/', $result, $m)) { - $mixed = str_replace('BOUNDARY', $m1, $mixed); - } - - $this->assertEquals($mixed, $result); - - // test adding attachment to multipart/mixed message - $message = new kolab_sync_message($mixed); - $message->add_attachment('aaa', - 'content_type' => 'text/plain', - 'encoding' => 'base64', - ); - - $result = $message->source(); - $result = str_replace("\r\n", "\n", $result); - if (preg_match('/boundary="(^"+)"/', $result, $m)) { - $mixed2 = str_replace('BOUNDARY', $m1, $mixed2); - } - - $this->assertEquals($mixed2, $result); - } - - /** - * Test appending a text to the message - */ - public function test_append() - { - // test appending text to text/plain message - $source = file_get_contents(TESTS_DIR . '/src/mail.plain'); - $append = file_get_contents(TESTS_DIR . '/src/mail.plain.append'); - - $message = new kolab_sync_message($source); - $message->append('a'); - - $result = $message->source(); - $result = str_replace("\r\n", "\n", $result); - $this->assertEquals($append, $result); - } - - /** - * Test recoding the message - */ - public function test_recode_message_1() - { - $source = file_get_contents(TESTS_DIR . '/src/mail.recode1'); - $result = file_get_contents(TESTS_DIR . '/src/mail.recode1.out'); - - $message = kolab_sync_message::recode_message($source); - - $this->assertEquals($result, $message); - } - - /** - * Test recoding the message - */ - public function test_recode_message_2() - { - $source = file_get_contents(TESTS_DIR . '/src/mail.recode2'); - $result = file_get_contents(TESTS_DIR . '/src/mail.recode2.out'); - - $message = kolab_sync_message::recode_message($source); - - $this->assertEquals($result, $message); - } - - /** - * Test recoding the message - */ - public function test_recode_message_3() - { - $source = file_get_contents(TESTS_DIR . '/src/mail.recode3'); - $result = file_get_contents(TESTS_DIR . '/src/mail.recode3.out'); - - $message = kolab_sync_message::recode_message($source); - - $this->assertEquals($result, $message); - } - - /** - * Test recoding the message - */ - public function test_recode_message_4() - { - $source = file_get_contents(TESTS_DIR . '/src/mail.recode4'); - $result = file_get_contents(TESTS_DIR . '/src/mail.recode4.out'); - - $message = kolab_sync_message::recode_message($source); - - $this->assertEquals($result, $message); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Unit/TimezoneConverterTest.php
Deleted
@@ -1,174 +0,0 @@ -<?php - -class TimezoneConverterTest extends PHPUnit\Framework\TestCase -{ - public function test_list_timezones() - { - // date_default_timezone_set('America/Los_Angeles'); - - $converter = kolab_sync_timezone_converter::getInstance(); - $output = $converter->getListOfTimezones('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAEAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAEAAAAAAAAAxP///w=='); - - $this->assertTrue(is_array($output)); - - $converter = kolab_sync_timezone_converter::getInstance(); - $output = $converter->getListOfTimezones('xP///0MAZQBuAHQAcgBhAGwAIABFAHUAcgBvAHAAZQAgAFMAdABhAG4AZABhAHIAZAAgAFQAaQBtAGUAAAAAAAAAAAAAAAoAAAAFAAMAAAAAAAAAAAAAAEMAZQBuAHQAcgBhAGwAIABFAHUAcgBvAHAAZQAgAEQAYQB5AGwAaQBnAGgAdAAgAFQAaQBtAGUAAAAAAAAAAAAAAAMAAAAFAAIAAAAAAAAAxP///w=='); - - $this->assertTrue(is_array($output)); - $this->assertTrue(isset($output'Europe/Warsaw')); - - $converter = kolab_sync_timezone_converter::getInstance(); - $output = $converter->getListOfTimezones('4AEAAFAAYQBjAGkAZgBpAGMAIABTAHQAYQBuAGQAYQByAGQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAIAAAAAAAAAAAAAAFAAYQBjAGkAZgBpAGMAIABEAGEAeQBsAGkAZwBoAHQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAIAAAAAAAAAxP///w=='); - - $this->assertTrue(is_array($output)); - $this->assertTrue(isset($output'America/Los_Angeles')); - - $converter = kolab_sync_timezone_converter::getInstance(); - $output = $converter->getListOfTimezones('Lv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=='); - - $this->assertTrue(is_array($output)); - $this->assertTrue(isset($output'Asia/Tehran')); - - // As seen in outlook - $converter = kolab_sync_timezone_converter::getInstance(); - $output = $converter->getListOfTimezones('Lv///0kAcgBhAG4AIABTAHQAYQBuAGQAYQByAGQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkABAADABcAOwA7AOcDAAAAAEkAcgBhAG4AIABEAGEAeQBsAGkAZwBoAHQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAwAEAAAAAAAAAAAAxP///w=='); - - $this->assertTrue(is_array($output)); - $this->assertTrue(isset($output'Asia/Tehran')); - } - - public function data_get_timezone() - { - return - 'UTC', - 'Europe/Warsaw', - 'Europe/Zurich', - 'America/Los_Angeles', - 'Asia/Tehran', - ; - } - - /** - * @dataProvider data_get_timezone - */ - public function test_get_timezone($tzName) - { - date_default_timezone_set('America/Los_Angeles'); - - $converter = kolab_sync_timezone_converter::getInstance(); - $datetime = '2017-01-01T12:00:00Z'; - - $offsets = $converter->getOffsetsForTimezone($tzName, $datetime); - $output = $converter->getTimezone($offsets, $tzName); - $this->assertSame($tzName, $output); - } - - public function test_get_offsets_for_timezone() - { - date_default_timezone_set('America/Los_Angeles'); - - $converter = kolab_sync_timezone_converter::getInstance(); - $datetime = '2017-01-01T12:00:00Z'; - - $output = $converter->getOffsetsForTimezone('UTC', $datetime); - - $this->assertSame($output'bias', 0); - $this->assertSame($output'standardBias', 0); - $this->assertSame($output'daylightBias', 0); - $this->assertSame($output'standardMonth', 0); - $this->assertSame($output'daylightMonth', 0); - - $output = $converter->getOffsetsForTimezone('Europe/Warsaw', $datetime); - - $this->assertSame($output'standardBias', 0); - $this->assertSame($output'standardMonth', 10); - $this->assertSame($output'standardWeek', 5); - $this->assertSame($output'standardHour', 3); - $this->assertSame($output'daylightBias', -60); - $this->assertSame($output'daylightMonth', 3); - $this->assertSame($output'daylightWeek', 5); - $this->assertSame($output'daylightHour', 2); - - $output = $converter->getOffsetsForTimezone('America/Los_Angeles', $datetime); - - $this->assertSame($output'bias', 480); - $this->assertSame($output'standardBias', 0); - $this->assertSame($output'standardMonth', 11); - $this->assertSame($output'standardWeek', 1); - $this->assertSame($output'standardHour', 2); - $this->assertSame($output'daylightBias', -60); - $this->assertSame($output'daylightMonth', 3); - $this->assertSame($output'daylightWeek', 2); - $this->assertSame($output'daylightHour', 2); - - $output = $converter->getOffsetsForTimezone('Atlantic/Azores', $datetime); - - $this->assertSame($output'bias', 60); - $this->assertSame($output'standardBias', 0); - $this->assertSame($output'standardMonth', 10); - $this->assertSame($output'standardWeek', 5); - $this->assertSame($output'standardHour', 1); - $this->assertSame($output'daylightBias', -60); - $this->assertSame($output'daylightMonth', 3); - $this->assertSame($output'daylightWeek', 5); - $this->assertSame($output'daylightHour', 0); - - //Check before dst change - $output = $converter->getOffsetsForTimezone('Asia/Tehran', $datetime); - - $this->assertSame($output'bias', -210); - $this->assertSame($output'standardBias', 0); - $this->assertSame($output'standardMonth', 9); - $this->assertSame($output'standardWeek', 3); - $this->assertSame($output'standardDayOfWeek', 4); - $this->assertSame($output'standardHour', 24); - $this->assertSame($output'daylightBias', -60); - $this->assertSame($output'daylightMonth', 3); - $this->assertSame($output'daylightWeek', 4); - $this->assertSame($output'daylightDayOfWeek', 3); - $this->assertSame($output'daylightHour', 0); - - //Check after dst change - $output = $converter->getOffsetsForTimezone('Asia/Tehran', '2023-01-01T12:00:00Z'); - - $this->assertSame($output'bias', -210); - $this->assertSame($output'standardBias', 0); - $this->assertSame($output'standardMonth', 0); - $this->assertSame($output'standardWeek', 0); - $this->assertSame($output'standardDayOfWeek', 0); - $this->assertSame($output'standardHour', 0); - $this->assertSame($output'daylightBias', 0); - $this->assertSame($output'daylightMonth', 0); - $this->assertSame($output'daylightWeek', 0); - $this->assertSame($output'daylightDayOfWeek', 0); - $this->assertSame($output'daylightHour', 0); - } - - public function data_timezone_conversion() - { - return - //Pre dst change - 'Asia/Tehran', 'Lv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAgADABcAOwA7AOcDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAQAEAAAAAAAAAAAAxP///w==', '2021-07-01T12:00:00Z', - //Post dst change - 'Asia/Tehran', 'Lv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==', '2023-04-01T12:00:00Z', - 'Pacific/Pago_Pago', 'lAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==', '2021-07-01T12:00:00Z', - 'Europe/Warsaw', 'xP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAFAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAIAAAAAAAAAxP///w==', '2021-07-01T12:00:00Z', - ; - } - - /** - * @dataProvider data_timezone_conversion - */ - public function test_timezone_conversion($tz, $expected, $datetime) - { - $converter = kolab_sync_timezone_converter::getInstance(); - $output = $converter->encodeTimezone($tz, $datetime); - - $this->assertSame($expected, $output); - - $output = $converter->getListOfTimezones($output); - - $this->assertTrue(is_array($output)); - $this->assertTrue(isset($output$tz)); - } -}
View file
kolab-syncroton-2.4.2.tar.gz/tests/Unit/WbxmlTest.php
Deleted
@@ -1,909 +0,0 @@ -<?php - -class WbxmlTest extends PHPUnit\Framework\TestCase -{ - //function testDecode() - //{ - // //TODO input some wbxml document - // // - // $dom = new DOMDocument(); - // $dom->loadXML($lastSyncCollection'lastXML'); - // // - // try { - // $decoder = new Syncroton_Wbxml_Decoder($dom); - // $requestBody = $decoder->decode(); - // if ($this->_logger instanceof Zend_Log) { - // $requestBody->formatOutput = true; - // $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " xml request:\n" . $requestBody->saveXML()); - // } - // } catch(Syncroton_Wbxml_Exception_UnexpectedEndOfFile $e) { - // $requestBody = NULL; - // } - // //TODO validate output - //} - - - - public function testEncode() - { - $outputStream = fopen("php://temp", 'r+'); - - $encoder = new Syncroton_Wbxml_Encoder($outputStream, 'UTF-8', 3); - - $xml = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase" xmlns:Tasks="uri:Tasks"> - <Collections> - <Collection> - <SyncKey>2</SyncKey> - <CollectionId>tasksId</CollectionId> - <Commands> - <Add> - <ClientId>clientId2</ClientId> - <ApplicationData> - <Subject xmlns="uri:Tasks">task2</Subject> - <Complete xmlns="uri:Tasks">0</Complete> - <DueDate xmlns="uri:Tasks">2020-11-04T00:00:00.000Z</DueDate> - <UtcDueDate xmlns="uri:Tasks">2020-11-03T23:00:00.000Z</UtcDueDate> - </ApplicationData> - </Add> - <Add> - <ClientId>clientId3</ClientId> - <ApplicationData> - <Subject xmlns="uri:Tasks">task3</Subject> - <Complete xmlns="uri:Tasks">0</Complete> - <DueDate xmlns="uri:Tasks">2020-11-04T00:00:00.000Z</DueDate> - <UtcDueDate xmlns="uri:Tasks">2020-11-03T23:00:00.000Z</UtcDueDate> - </ApplicationData> - </Add> - </Commands> - </Collection> - </Collections> - <WindowSize>16</WindowSize> - </Sync> - EOF; - - - $dom = new DOMDocument(); - $dom->loadXML($xml); - - $encoder->encode($dom); - - rewind($outputStream); - $output = stream_get_contents($outputStream); - // print("----"); - // print(var_export($output, true)); - // print("----"); - $this->assertEquals( - base64_decode('AwFqAEVcT0sDMgABUgN0YXNrc0lkAAFWR0wDY2xpZW50SWQyAAFdAAlgA3Rhc2syAAFKAzAAAUwDMjAyMC0xMS0wNFQwMDowMDowMC4wMDBaAAFNAzIwMjAtMTEtMDNUMjM6MDA6MDAuMDAwWgABAQEAAEdMA2NsaWVudElkMwABXQAJYAN0YXNrMwABSgMwAAFMAzIwMjAtMTEtMDRUMDA6MDA6MDAuMDAwWgABTQMyMDIwLTExLTAzVDIzOjAwOjAwLjAwMFoAAQEBAQEBAABVAzE2AAEB'), - $output - ); - } - - public function testEncodeFolderSync() - { - $outputStream = fopen("php://temp", 'r+'); - - $encoder = new Syncroton_Wbxml_Encoder($outputStream, 'UTF-8', 3); - - $xml = <<<EOF - <?xml version="1.0" encoding="utf-8"?> - <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> - <FolderSync xmlns="uri:FolderHierarchy" xmlns:Syncroton="uri:Syncroton" xmlns:Internal="uri:Internal"> - <Status>1</Status> - <SyncKey>1</SyncKey> - <Changes> - <Count>18</Count> - <Add> - <ServerId>2685b302b79f58d2753199545e3cb8be</ServerId> - <ParentId>0</ParentId> - <DisplayName>Test2</DisplayName> - <Type>13</Type> - </Add> - <Add> - <ServerId>9770b083c68e8584f396d15a116d6608</ServerId> - <ParentId>0</ParentId> - <DisplayName>DavidCalendar</DisplayName> - <Type>13</Type> - </Add> - <Add> - <ServerId>0f66388806743c514b8063bf0dc87486</ServerId> - <ParentId>0</ParentId> - <DisplayName>SergeyCalendar</DisplayName> - <Type>13</Type> - </Add> - <Add> - <ServerId>cca1b81c734abbcd669bea90d23e08ae</ServerId> - <ParentId>0</ParentId> - <DisplayName>Calendar</DisplayName> - <Type>8</Type> - </Add> - <Add> - <ServerId>ab1ddb4ef8e8f8fcc2c9f5a7f9062452</ServerId> - <ParentId>0</ParentId> - <DisplayName>PubCal</DisplayName> - <Type>13</Type> - </Add> - <Add> - <ServerId>d98bd8721371544ed095841ead941893</ServerId> - <ParentId>0</ParentId> - <DisplayName>(david) Test2</DisplayName> - <Type>13</Type> - </Add> - <Add> - <ServerId>9e7b9656ef61d4af2fb2fdcabe600079</ServerId> - <ParentId>0</ParentId> - <DisplayName>(david) DavidCalendar</DisplayName> - <Type>13</Type> - </Add> - <Add> - <ServerId>384cf2d877c39a622fdc2a16898052e2</ServerId> - <ParentId>0</ParentId> - <DisplayName>(david) Calendar</DisplayName> - <Type>13</Type> - </Add> - <Add> - <ServerId>Contacts::Syncroton</ServerId> - <ParentId>0</ParentId> - <DisplayName>Contacts</DisplayName> - <Type>9</Type> - </Add> - <Add> - <ServerId>1bb8c55fe84d52c6968db2571f7dc124</ServerId> - <ParentId>0</ParentId> - <DisplayName>Archive</DisplayName> - <Type>12</Type> - </Add> - <Add> - <ServerId>b51abe73e9e98fe200a4afe409050502</ServerId> - <ParentId>38b950ebd62cd9a66929c89615d0fc04</ParentId> - <DisplayName>Spam</DisplayName> - <Type>12</Type> - </Add> - <Add> - <ServerId>cf529c792fc87d1f207435b3921bb02e</ServerId> - <ParentId>0</ParentId> - <DisplayName>Sent</DisplayName> - <Type>5</Type> - </Add> - <Add> - <ServerId>715ed9ea29b8a5377a69c1f758037c65</ServerId> - <ParentId>0</ParentId> - <DisplayName>Spam</DisplayName> - <Type>12</Type> - </Add> - <Add> - <ServerId>db0d959a3aeb21757f8849a830947a7a</ServerId> - <ParentId>0</ParentId> - <DisplayName>Trash</DisplayName> - <Type>4</Type> - </Add> - <Add> - <ServerId>5ac9ec2e1a9d99e2e10cabe4abf26729</ServerId> - <ParentId>0</ParentId> - <DisplayName>Drafts</DisplayName> - <Type>3</Type> - </Add> - <Add> - <ServerId>38b950ebd62cd9a66929c89615d0fc04</ServerId> - <ParentId>0</ParentId> - <DisplayName>INBOX</DisplayName> - <Type>2</Type> - </Add> - <Add> - <ServerId>fc56f4c7ffe0aefa622db9f8d9186c4a</ServerId> - <ParentId>0</ParentId> - <DisplayName>Notes</DisplayName> - <Type>10</Type> - </Add>
View file
kolab-syncroton-2.4.2.tar.gz/tests/src/contact.vcard1
Deleted
@@ -1,6 +0,0 @@ -BEGIN:VCARD -VERSION:3.0 -UID:urn:uuid:abcdef-0123-4567-89ab-abcdefabcdef -FN:Jane Doe -N:Doe;Jane;J.;; -END:VCARD
View file
kolab-syncroton-2.4.2.tar.gz/tests/src/contact.vcard2
Deleted
@@ -1,6 +0,0 @@ -BEGIN:VCARD -VERSION:3.0 -UID:urn:uuid:abcdef-0123-4567-89ab-abcdefabc123 -FN:Jack Strong -N:Strong;Jack;;; -END:VCARD
View file
kolab-syncroton-2.4.2.tar.gz/tests/src/event.ics1
Deleted
@@ -1,12 +0,0 @@ -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//test/test//NONSGML v1.0//EN -BEGIN:VEVENT -UID:abcdef -DTSTAMP:19970714T170000Z -ORGANIZER;CN=John Doe:MAILTO:john.doe@example.com -DTSTART:20240714T170000Z -DTEND:20240714T180000Z -SUMMARY:Party -END:VEVENT -END:VCALENDAR
View file
kolab-syncroton-2.4.2.tar.gz/tests/src/event.ics2
Deleted
@@ -1,12 +0,0 @@ -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//test/test//NONSGML v1.0//EN -BEGIN:VEVENT -UID:123456 -DTSTAMP:19970714T170000Z -ORGANIZER;CN=John Doe:MAILTO:john.doe@example.com -DTSTART:20240715T170000Z -DTEND:20240715T180000Z -SUMMARY:Meeting -END:VEVENT -END:VCALENDAR
View file
kolab-syncroton-2.4.2.tar.gz/tests/src/mail.itip.invalid
Deleted
@@ -1,51 +0,0 @@ -MIME-Version: 1.0 -Date: Thu, 07 Dec 2023 13:29:14 +0100 -Message-ID: <14ab307198d32cee00b38ffb54c9e577@nestle.kolab.ch> -From: "Organizer" <$from> -To: <$to> -Subject: Invalid itip invitation -Content-Type: multipart/alternative; - boundary="=_f39ac9438326f676a8d562e163aa31e0" - ---=_f39ac9438326f676a8d562e163aa31e0 -Content-Transfer-Encoding: quoted-printable -Content-Type: text/plain; charset=UTF-8; - format=flowed - -*Test* ---=_f39ac9438326f676a8d562e163aa31e0 -Content-Transfer-Encoding: 8bit -Content-Type: text/calendar; charset=UTF-8; method=REQUEST; name=event.ics - -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//Roundcube 1.5-git//Sabre VObject 4.5.3//EN -CALSCALE:GREGORIAN -METHOD:REQUEST -BEGIN:VTIMEZONE -TZID:Europe/Warsaw -BEGIN:DAYLIGHT -DTSTART:20230326T010000 -TZOFFSETFROM:+0100 -TZOFFSETTO:+0200 -TZNAME:CEST -END:DAYLIGHT -BEGIN:DAYLIGHT -DTSTART:20240331T010000 -TZOFFSETFROM:+0100 -TZOFFSETTO:+0200 -TZNAME:CEST -END:DAYLIGHT -BEGIN:STANDARD -DTSTART:20231029T010000 -TZOFFSETFROM:+0200 -TZOFFSETTO:+0100 -TZNAME:CET -END:STANDARD -END:VTIMEZONE -BEGIN:VEVENT -DTSTART;TZID=Europe/Warsaw:20231207T140000 -END:VEVENT -END:VCALENDAR - ---=_f39ac9438326f676a8d562e163aa31e0--
View file
kolab-syncroton-2.4.2.tar.gz/tests/src/mail.itip1
Deleted
@@ -1,62 +0,0 @@ -MIME-Version: 1.0 -Date: Thu, 07 Dec 2023 13:29:14 +0100 -Message-ID: <14ab307198d32cee00b38ffb54c9e577@nestle.kolab.ch> -From: "Organizer" <$from> -To: <$to> -Subject: You've been invited to "Test" -Content-Type: multipart/alternative; - boundary="=_f39ac9438326f676a8d562e163aa31e0" - ---=_f39ac9438326f676a8d562e163aa31e0 -Content-Transfer-Encoding: quoted-printable -Content-Type: text/plain; charset=UTF-8; - format=flowed - -*Test* ---=_f39ac9438326f676a8d562e163aa31e0 -Content-Transfer-Encoding: 8bit -Content-Type: text/calendar; charset=UTF-8; method=REQUEST; name=event.ics - -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//Roundcube 1.5-git//Sabre VObject 4.5.3//EN -CALSCALE:GREGORIAN -METHOD:REQUEST -BEGIN:VTIMEZONE -TZID:Europe/Warsaw -BEGIN:DAYLIGHT -DTSTART:20230326T010000 -TZOFFSETFROM:+0100 -TZOFFSETTO:+0200 -TZNAME:CEST -END:DAYLIGHT -BEGIN:DAYLIGHT -DTSTART:20240331T010000 -TZOFFSETFROM:+0100 -TZOFFSETTO:+0200 -TZNAME:CEST -END:DAYLIGHT -BEGIN:STANDARD -DTSTART:20231029T010000 -TZOFFSETFROM:+0200 -TZOFFSETTO:+0100 -TZNAME:CET -END:STANDARD -END:VTIMEZONE -BEGIN:VEVENT -UID:1154B829349633D80E143AAB5641170A-93BC4FC398A3FD52 -DTSTAMP:20231207T122914Z -CREATED:20231207T122914Z -LAST-MODIFIED:20231207T122914Z -DTSTART;TZID=Europe/Warsaw:20231207T140000 -DTEND;TZID=Europe/Warsaw:20231207T143000 -SUMMARY:Test -SEQUENCE:0 -TRANSP:OPAQUE -ATTENDEE;CN="Attendee Name";PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPA - NT;CUTYPE=INDIVIDUAL;RSVP=TRUE:mailto:$to -ORGANIZER;CN="Organizer Name":mailto:$from -END:VEVENT -END:VCALENDAR - ---=_f39ac9438326f676a8d562e163aa31e0--
View file
kolab-syncroton-2.4.2.tar.gz/tests/src/mail.sync1
Deleted
@@ -1,10 +0,0 @@ -Date: Thu, 09 Aug 2012 13:18:31 +0000 -Subject: test sync -Message-ID: <sync1@domain.tld> -From: "Sync 1" <user@domain.tld> -To: "To 1" <kolab1@domain.tld>, "To 2" <kolab2@domain.tld> -MIME-Version: 1.0 -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: base64 - -ZWVlYQ==
View file
kolab-syncroton-2.4.2.tar.gz/tests/src/mail.sync2
Deleted
@@ -1,20 +0,0 @@ -Date: Thu, 10 Aug 2012 13:18:31 +0000 -Subject: sync test with attachment -Message-ID: <sync2@domain.tld> -From: user@domain.tld -To: kolab@domain.tld -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="BOUNDARY" - ---BOUNDARY -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: base64 - -ZWVl ---BOUNDARY -Content-Transfer-Encoding: base64 -Content-Type: image/jpeg; name=logo.gif -Content-Disposition: inline; filename=logo.gif; size=2574 - -/9j/4AAQSkZJRgABAgEASABIAAD/4QqARXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUA ---BOUNDARY--
View file
kolab-syncroton-2.4.2.tar.gz/tests/src/sample.rtf
Deleted
@@ -1,18 +0,0 @@ -{\rtf1\mac\deff2 {\fonttbl{\f0\fswiss Chicago;}{\f2\froman New York;}{\f3\fswiss Geneva;}{\f4\fmodern Monaco;}{\f11\fnil Cairo;}{\f13\fnil Zapf Dingbats;}{\f14\fnil Bookman;}{\f15\fnil N Helvetica Narrow;}{\f16\fnil Palatino;}{\f18\fnil Zapf Chancery;} -{\f20\froman Times;}{\f21\fswiss Helvetica;}{\f22\fmodern Courier;}{\f23\ftech Symbol;}{\f33\fnil Avant Garde;}{\f34\fnil New Century Schlbk;}{\f1297\fnil GoudyHundred;}{\f1602\fnil BlackChancery;}{\f2515\fnil MT Extra;}{\f4950\fnil TTYFont;} -{\f11132\fnil InsigniaLQmono;}{\f11133\fnil InsigniaLQprop;}{\f32500\fnil VT320;}{\f32525\fnil VT100;}}{\colortbl\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0; -\red255\green255\blue0;\red255\green255\blue255;}{\stylesheet{\s250\li720 \f21\fs20\ul \sbasedon0\snext0 heading 6;}{\s251\li720 \b\f21\fs20 \sbasedon0\snext0 heading 5;}{\s252\li360 \f21\ul \sbasedon0\snext0 heading 4;}{\s253\li360 \b\f21 -\sbasedon0\snext0 heading 3;}{\s254\sb120 \b\f21 \sbasedon0\snext0 heading 2;}{\s255\sb240 \b\f21\ul \sbasedon0\snext0 heading 1;}{\f21 \sbasedon222\snext0 Normal;}{\s2 \b\f21\cf1 \sbasedon0\snext2 Anchor;}}{\info{\author Chuck Shotton}} -\margl720\margr720\ftnbj\fracwidth \sectd \sbknone\linemod0\linex0\cols1\endnhere \pard\plain \s255\sb240 \b\f21\ul Heading 1\par -\pard\plain \f21 This is the first normal paragraph!\par -\pard\plain \s254\sb120 \b\f21 Heading 2\par -\pard\plain \s253\li360 \b\f21 Heading 3\par -\pard\plain \s252\li360 \f21\ul Heading 4\par -\pard\plain \s251\li720 \b\f21\fs20 Heading 5\par -\pard\plain \s250\li720 \f21\fs20\ul Heading 6\par -\pard\plain \f21 This is a chunk of normal text.\par -This is a chunk of normal text with specials, &, <, and >.\par -This is a second paragraph.\par -This is text with embedded {\b bold}, {\i italic}, and {\ul underline} styles.\par -Here is the {\cf1 anchor} style. And here is the {\cf5 Image} style.\par -} \ No newline at end of file
View file
kolab-syncroton.dsc
Changed
@@ -2,7 +2,7 @@ Source: kolab-syncroton Binary: kolab-syncroton Architecture: all -Version: 1:2.4.2.16-1~kolab1 +Version: 2.3.22-0~kolab1 Maintainer: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Uploaders: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Homepage: http://www.kolab.org/ @@ -12,5 +12,5 @@ Package-List: kolab-syncroton deb utils extra Files: - 00000000000000000000000000000000 0 kolab-syncroton-2.4.0.tar.gz + 00000000000000000000000000000000 0 kolab-syncroton-2.3.22.tar.gz 00000000000000000000000000000000 0 debian.tar.gz
View file
plesk.kolab_syncroton.inc.php
Changed
@@ -118,6 +118,8 @@ $config'activesync_multifolder_blacklist_note' = null; $config'activesync_multifolder_blacklist_task' = null; +$config'activesync_protected_folders' = array('windowsoutlook' => array('INBOX', 'Sent', 'Trash')); + // Enables adding sender name in the From: header of send email // when a device uses email address only (e.g. iOS devices) -$config'activesync_fix_from' = true; +$config'activesync_fix_from' = false;
View file
release.sh
Deleted
@@ -1,15 +0,0 @@ -#!/bin/bash - -./buildtarball.sh - -# Autobump the version -CURRENT_VERSION=$(grep '^Version: ' ./*.spec | sed 's/Version: //') -NEW_VERSION=$(echo "$CURRENT_VERSION" | awk -F. '/0-9+\./{$NF++;print}' OFS=.) -echo "Bumping from $CURRENT_VERSION to $NEW_VERSION" - -sed -i "s/$CURRENT_VERSION/$NEW_VERSION/" debian.changelog -sed -i "s/^Version:.*/Version: 1:$NEW_VERSION-1~kolab1/" ./*.dsc -sed -i "s/^Version:.*/Version: $NEW_VERSION/" ./*.spec - -osc ci -m "New release $NEW_VERSION" -osc sr Kolab:16 --yes -m "New release $NEW_VERSION"
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.