2005-06-19 21:00:58 +02:00
|
|
|
<?php
|
2009-07-15 21:31:25 +02:00
|
|
|
/**
|
|
|
|
* eGroupWare - SyncML based on Horde 3
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Using the PEAR Log class (which need to be installed!)
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package api
|
|
|
|
* @subpackage horde
|
|
|
|
* @author Joerg Lehrke <jlehrke@noc.de>
|
|
|
|
* @copyright (c) The Horde Project (http://www.horde.org/)
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
2005-06-19 21:00:58 +02:00
|
|
|
|
|
|
|
define('ALERT_DISPLAY', 100);
|
|
|
|
|
|
|
|
// Not implemented.
|
|
|
|
define('ALERT_TWO_WAY', 200);
|
|
|
|
define('ALERT_SLOW_SYNC', 201);
|
|
|
|
define('ALERT_ONE_WAY_FROM_CLIENT', 202);
|
|
|
|
define('ALERT_REFRESH_FROM_CLIENT', 203);
|
|
|
|
define('ALERT_ONE_WAY_FROM_SERVER', 204);
|
|
|
|
define('ALERT_REFRESH_FROM_SERVER', 205);
|
|
|
|
|
|
|
|
// Not implemented.
|
|
|
|
define('ALERT_TWO_WAY_BY_SERVER', 206);
|
|
|
|
define('ALERT_ONE_WAY_FROM_CLIENT_BY_SERVER', 207);
|
|
|
|
define('ALERT_REFRESH_FROM_CLIENT_BY_SERVER', 208);
|
|
|
|
define('ALERT_ONE_WAY_FROM_SERVER_BY_SERVER', 209);
|
|
|
|
define('ALERT_REFRESH_FROM_SERVER_BY_SERVER', 210);
|
|
|
|
|
|
|
|
define('ALERT_RESULT_ALERT', 221);
|
|
|
|
define('ALERT_NEXT_MESSAGE', 222);
|
|
|
|
define('ALERT_NO_END_OF_DATA', 223);
|
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
// Not (really) implemented.
|
|
|
|
define('ALERT_SUSPEND', 224); // New in SyncML 1.2
|
|
|
|
define('ALERT_RESUME', 225); // New in SyncML 1.2
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
define('MIME_SYNCML_XML', 'application/vnd.syncml+xml');
|
|
|
|
define('MIME_SYNCML_WBXML', 'application/vnd.syncml+wbxml');
|
|
|
|
|
|
|
|
define('MIME_SYNCML_DEVICE_INFO_XML', 'application/vnd.syncml-devinf+xml');
|
|
|
|
define('MIME_SYNCML_DEVICE_INFO_WBXML', 'application/vnd.syncml-devinf+wbxml');
|
|
|
|
|
|
|
|
define('MIME_TEXT_PLAIN', 'text/plain');
|
|
|
|
define('MIME_VCARD_V21', 'text/x-vcard');
|
|
|
|
define('MIME_VCARD_V30', 'text/vcard');
|
|
|
|
|
|
|
|
define('MIME_VCALENDAR', 'text/x-vcalendar');
|
|
|
|
define('MIME_ICALENDAR', 'text/calendar');
|
|
|
|
define('MIME_XML_ICALENDAR', 'application/vnd.syncml-xcal');
|
|
|
|
|
|
|
|
define('MIME_MESSAGE', 'text/message');
|
|
|
|
|
|
|
|
define('MIME_SYNCML_XML_EMAIL', 'application/vnd.syncml-xmsg');
|
|
|
|
define('MIME_SYNCML_XML_BOOKMARK', 'application/vnd.syncml-xbookmark');
|
|
|
|
define('MIME_SYNCML_RELATIONAL_OBJECT', 'application/vnd.syncml-xrelational');
|
|
|
|
|
|
|
|
define('RESPONSE_IN_PROGRESS', 101);
|
|
|
|
|
|
|
|
define('RESPONSE_OK', 200);
|
|
|
|
define('RESPONSE_ITEM_ADDED', 201);
|
|
|
|
define('RESPONSE_ACCEPTED_FOR_PROCESSING', 202);
|
|
|
|
define('RESPONSE_NONAUTHORIATATIVE_RESPONSE', 203);
|
|
|
|
define('RESPONSE_NO_CONTENT', 204);
|
|
|
|
define('RESPONSE_RESET_CONTENT', 205);
|
|
|
|
define('RESPONSE_PARTIAL_CONTENT', 206);
|
|
|
|
define('RESPONSE_CONFLICT_RESOLVED_WITH_MERGE', 207);
|
|
|
|
define('RESPONSE_CONFLICT_RESOLVED_WITH_CLIENT_WINNING', 208);
|
|
|
|
define('RESPONSE_CONFILCT_RESOLVED_WITH_DUPLICATE', 209);
|
|
|
|
define('RESPONSE_DELETE_WITHOUT_ARCHIVE', 210);
|
|
|
|
define('RESPONSE_ITEM_NO_DELETED', 211);
|
|
|
|
define('RESPONSE_AUTHENTICATION_ACCEPTED', 212);
|
|
|
|
define('RESPONSE_CHUNKED_ITEM_ACCEPTED_AND_BUFFERED', 213);
|
|
|
|
define('RESPONSE_OPERATION_CANCELLED', 214);
|
|
|
|
define('RESPONSE_NO_EXECUTED', 215);
|
|
|
|
define('RESPONSE_ATOMIC_ROLL_BACK_OK', 216);
|
|
|
|
|
|
|
|
define('RESPONSE_MULTIPLE_CHOICES', 300);
|
|
|
|
// Need to change names.
|
|
|
|
// define('RESPONSE_MULTIPLE_CHOICES', 301);
|
|
|
|
// define('RESPONSE_MULTIPLE_CHOICES', 302);
|
|
|
|
// define('RESPONSE_MULTIPLE_CHOICES', 303);
|
|
|
|
// define('RESPONSE_MULTIPLE_CHOICES', 304);
|
|
|
|
define('RESPONSE_USE_PROXY', 305);
|
|
|
|
|
|
|
|
define('RESPONSE_BAD_REQUEST', 400);
|
|
|
|
define('RESPONSE_INVALID_CREDENTIALS', 401);
|
|
|
|
// Need to change names.
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 402);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 403);
|
|
|
|
define('RESPONSE_NOT_FOUND', 404);
|
|
|
|
// Need to change names.
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 405);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 406);
|
|
|
|
define('RESPONSE_MISSING_CREDENTIALS', 407);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 408);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 409);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 410);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 411);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 412);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 413);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 414);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 415);
|
|
|
|
define('RESPONSE_REQUEST_SIZE_TOO_BIG', 416);
|
|
|
|
// Need to change names.
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 417);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 418);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 419);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 420);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 421);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 422);
|
|
|
|
// define('RESPONSE_INVALID_CREDENTIALS', 423);
|
|
|
|
define('RESPONSE_SIZE_MISMATCH', 424);
|
|
|
|
|
|
|
|
define('RESPONSE_COMMAND_FAILED', 500);
|
|
|
|
// Need to change names.
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 501);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 502);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 503);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 504);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 505);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 506);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 507);
|
2009-07-15 21:31:25 +02:00
|
|
|
define('RESPONSE_REFRESH_REQUIRED', 508);
|
2005-06-19 21:00:58 +02:00
|
|
|
// define('RESPONSE_COMMAND_FAILED', 509);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 510);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 511);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 512);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 513);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 514);
|
|
|
|
// define('RESPONSE_COMMAND_FAILED', 515);
|
|
|
|
define('RESPONSE_ATOMIC_ROLL_BACK_FAILED', 516);
|
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
define('NAME_SPACE_URI_SYNCML_1_0', 'syncml:syncml1.0');
|
2005-06-19 21:00:58 +02:00
|
|
|
define('NAME_SPACE_URI_SYNCML_1_1', 'syncml:syncml1.1');
|
2009-07-15 21:31:25 +02:00
|
|
|
define('NAME_SPACE_URI_SYNCML_1_2', 'syncml:syncml1.2');
|
|
|
|
define('NAME_SPACE_URI_METINF_1_0', 'syncml:metinf1.0');
|
2005-06-19 21:00:58 +02:00
|
|
|
define('NAME_SPACE_URI_METINF_1_1', 'syncml:metinf1.1');
|
2009-07-15 21:31:25 +02:00
|
|
|
define('NAME_SPACE_URI_METINF_1_2', 'syncml:metinf1.2');
|
|
|
|
define('NAME_SPACE_URI_DEVINF_1_0', 'syncml:devinf1.0');
|
2005-06-19 21:00:58 +02:00
|
|
|
define('NAME_SPACE_URI_DEVINF_1_1', 'syncml:devinf1.1');
|
2009-07-15 21:31:25 +02:00
|
|
|
define('NAME_SPACE_URI_DEVINF_1_2', 'syncml:devinf1.2');
|
2005-06-19 21:00:58 +02:00
|
|
|
|
|
|
|
define('CLIENT_SYNC_STARTED', 1);
|
|
|
|
define('CLIENT_SYNC_FINNISHED', 2);
|
2006-03-21 14:49:13 +01:00
|
|
|
define('CLIENT_SYNC_ACKNOWLEDGED', 3);
|
|
|
|
define('SERVER_SYNC_DATA_PENDING', 4);
|
|
|
|
define('SERVER_SYNC_FINNISHED', 5);
|
|
|
|
define('SERVER_SYNC_ACKNOWLEDGED', 6);
|
2005-06-19 21:00:58 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
// conflict management
|
|
|
|
define('CONFLICT_CLIENT_WINNING', 0);
|
|
|
|
define('CONFLICT_SERVER_WINNING', 1);
|
|
|
|
define('CONFLICT_MERGE_DATA', 2);
|
|
|
|
define('CONFLICT_RESOLVED_WITH_DUPLICATE', 3);
|
|
|
|
define('CONFLICT_CLIENT_CHANGES_IGNORED', 4);
|
|
|
|
define('CONFLICT_CLIENT_REFRESH_ENFORCED', 5);
|
|
|
|
|
2005-07-20 14:09:32 +02:00
|
|
|
define('MAX_DATA', 19);
|
2009-07-15 21:31:25 +02:00
|
|
|
define('MAX_ENTRIES', 10); // default
|
|
|
|
define('MAX_GUID_SIZE', 64);
|
|
|
|
define('MIN_MSG_LEFT', 200); // Overhead
|
2005-06-19 21:00:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The Horde_SyncML_State class provides a SyncML state object.
|
|
|
|
*
|
|
|
|
* $Horde: framework/SyncML/SyncML/State.php,v 1.15 2004/07/26 09:24:38 jan Exp $
|
|
|
|
*
|
|
|
|
* Copyright 2003-2004 Anthony Mills <amills@pyramid6.com>
|
|
|
|
*
|
|
|
|
* See the enclosed file COPYING for license information (LGPL). If you
|
|
|
|
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
|
|
|
|
*
|
|
|
|
* @author Anthony Mills <amills@pyramid6.com>
|
|
|
|
* @version $Revision$
|
|
|
|
* @since Horde 3.0
|
|
|
|
* @package Horde_SyncML
|
2009-07-15 21:31:25 +02:00
|
|
|
* @modified Joerg Lehrke <jlehrke@noc.de> 2009/01/20, support all syn types
|
2005-06-19 21:00:58 +02:00
|
|
|
*/
|
|
|
|
class Horde_SyncML_State {
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_sessionID;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_verProto;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_msgID;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
var $_maxMsgSize;
|
|
|
|
|
|
|
|
var $_maxGUIDSize;
|
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_targetURI;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_sourceURI;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_version;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_locName;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_password;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_isAuthorized;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
var $_AuthConfirmed;
|
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_uri;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_uriMeta;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_syncs = array();
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_clientAnchorNext = array(); // written to db after successful sync
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_serverAnchorLast = array();
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_serverAnchorNext = array(); // written to db after successful sync
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
var $_clientDeviceInfo;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
// array list of changed items, which need to be synced to the client
|
|
|
|
var $_changedItems;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
// array list of deleted items, which need to be synced to the client
|
|
|
|
var $_deletedItems;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
// array list of added items, which need to be synced to the client
|
|
|
|
var $_addedItems;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
// array list of items, which need to be refreshed at the client
|
|
|
|
var $_conflictItems;
|
|
|
|
|
|
|
|
// current session status
|
|
|
|
var $_syncStatus = 0;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
var $_log = array();
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
// stores if we received Alert 222 already
|
|
|
|
var $_receivedAlert222 = false;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-08-15 16:42:13 +02:00
|
|
|
// stores if we already requested the deviceinfo
|
|
|
|
var $_devinfoRequested = false;
|
2005-06-19 21:00:58 +02:00
|
|
|
|
2008-10-08 20:40:01 +02:00
|
|
|
/*
|
2007-06-25 10:55:20 +02:00
|
|
|
* store the mappings of egw uids to client uids
|
|
|
|
*/
|
|
|
|
var $_uidMappings = array();
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
/**
|
|
|
|
* Current sync element sent from client.
|
|
|
|
*
|
|
|
|
* Stored in state if one element is split into multiple message packets.
|
|
|
|
*
|
|
|
|
* @var SyncML_SyncElement
|
|
|
|
*/
|
|
|
|
var $curSyncItem;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Number of sync elements sent to client within current message.
|
|
|
|
*
|
|
|
|
* @var _numberOfElements
|
|
|
|
*/
|
|
|
|
var $_numberOfElements;
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
/**
|
|
|
|
* Creates a new instance of Horde_SyncML_State.
|
|
|
|
*/
|
|
|
|
function Horde_SyncML_State($sourceURI, $locName, $sessionID, $password = false)
|
|
|
|
{
|
|
|
|
$this->setSourceURI($sourceURI);
|
|
|
|
$this->setLocName($locName);
|
|
|
|
$this->setSessionID($sessionID);
|
|
|
|
if ($password) {
|
|
|
|
$this->setPassword($password);
|
|
|
|
}
|
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
$this->_isAuthorized = false;
|
|
|
|
$this->_isAuthConfirmed = false;
|
2005-06-19 21:00:58 +02:00
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2007-06-25 10:55:20 +02:00
|
|
|
/**
|
|
|
|
* store the sent global uid
|
|
|
|
*/
|
|
|
|
function setUIDMapping($_realEgwUid, $_sentEgwUid) {
|
|
|
|
$this->_uidMappings[$_sentEgwUid] = $_realEgwUid;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* retrieve the real egw uid for a given send uid
|
|
|
|
*/
|
|
|
|
function getUIDMapping($_sentEgwUid) {
|
2009-07-15 21:31:25 +02:00
|
|
|
if(strlen("$_sentEgwUid") && isset($this->_uidMappings[$_sentEgwUid])) {
|
2007-06-25 10:55:20 +02:00
|
|
|
return $this->_uidMappings[$_sentEgwUid];
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2007-06-25 10:55:20 +02:00
|
|
|
return false;
|
|
|
|
}
|
2005-06-19 21:00:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the DataTree used as persistence layer for SyncML. The
|
|
|
|
* datatree var should not be a class member of State as State is
|
|
|
|
* stored as a session var. Resource handles (=db connections)
|
|
|
|
* cannot be stored in sessions.
|
|
|
|
*
|
|
|
|
* @return object DataTree The DataTree object.
|
|
|
|
*/
|
|
|
|
function &getDataTree()
|
|
|
|
{
|
|
|
|
$driver = $GLOBALS['conf']['datatree']['driver'];
|
|
|
|
$params = Horde::getDriverConfig('datatree', $driver);
|
|
|
|
$params = array_merge($params, array( 'group' => 'syncml' ));
|
|
|
|
|
|
|
|
return DataTree::singleton($driver, $params);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getLocName()
|
|
|
|
{
|
|
|
|
if(isset($this->_locName))
|
|
|
|
return $this->_locName;
|
|
|
|
else
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getSourceURI()
|
|
|
|
{
|
|
|
|
return $this->_sourceURI;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getTargetURI()
|
|
|
|
{
|
|
|
|
return $this->_targetURI;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getVersion()
|
|
|
|
{
|
|
|
|
return $this->_version;
|
|
|
|
}
|
|
|
|
|
|
|
|
function &getAddedItems($_type)
|
|
|
|
{
|
|
|
|
if(isset($this->_addedItems[$_type]))
|
|
|
|
{
|
|
|
|
return $this->_addedItems[$_type];
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function &getChangedItems($_type)
|
|
|
|
{
|
|
|
|
if(isset($this->_changedItems[$_type]))
|
|
|
|
{
|
|
|
|
return $this->_changedItems[$_type];
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
return false;
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
function &getDeletedItems($_type)
|
|
|
|
{
|
|
|
|
if(isset($this->_deletedItems[$_type]))
|
|
|
|
{
|
|
|
|
return $this->_deletedItems[$_type];
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
return false;
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
function &getConflictItems($_type)
|
|
|
|
{
|
|
|
|
if(isset($this->_conflictItems[$_type]))
|
|
|
|
{
|
|
|
|
return $this->_conflictItems[$_type];
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
function getMoreDataPending()
|
|
|
|
{
|
|
|
|
return $this->_moreDataPending;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getMsgID()
|
|
|
|
{
|
|
|
|
return $this->_msgID;
|
|
|
|
}
|
2006-01-11 06:42:07 +01:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
function getMaxMsgSizeClient()
|
|
|
|
{
|
|
|
|
if (isset($this->_maxMsgSize)) {
|
|
|
|
return $this->_maxMsgSize;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-01-11 06:42:07 +01:00
|
|
|
function setWBXML($wbxml)
|
|
|
|
{
|
|
|
|
$this->_wbxml = $wbxml;
|
|
|
|
}
|
|
|
|
|
|
|
|
function isWBXML()
|
|
|
|
{
|
|
|
|
return !empty($this->_wbxml);
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
function &getSyncStatus()
|
|
|
|
{
|
|
|
|
return $this->_syncStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setAddedItems($_type, $_addedItems)
|
|
|
|
{
|
|
|
|
$this->_addedItems[$_type] = $_addedItems;
|
|
|
|
}
|
|
|
|
|
2009-11-11 21:16:34 +01:00
|
|
|
function mergeAddedItems($_type, $_addedItems)
|
2009-07-15 21:31:25 +02:00
|
|
|
{
|
2009-11-11 21:16:34 +01:00
|
|
|
if (is_array($this->_addedItems[$_type])) {
|
|
|
|
$this->_addedItems[$_type] = array_merge($this->_addedItems[$_type], $_addedItems);
|
|
|
|
} else {
|
|
|
|
$this->_addedItems[$_type] = $_addedItems;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function pushAddedItem($_type, $_addedItem)
|
|
|
|
{
|
|
|
|
$this->_addedItems[$_type][] = $_addedItem;
|
2009-07-15 21:31:25 +02:00
|
|
|
}
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
function setChangedItems($_type, $_changedItems)
|
|
|
|
{
|
|
|
|
$this->_changedItems[$_type] = $_changedItems;
|
|
|
|
}
|
|
|
|
|
2009-11-11 21:16:34 +01:00
|
|
|
function mergeChangedItems($_type, $_changedItems)
|
|
|
|
{
|
|
|
|
if (is_array($this->_changedItems[$_type])) {
|
|
|
|
$this->_changedItems[$_type] = array_merge($this->_changedItems[$_type], $_changedItems);
|
|
|
|
} else {
|
|
|
|
$this->_changedItems[$_type] = $_changedItems;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function pushChangedItem($_type, $_changedItem)
|
|
|
|
{
|
|
|
|
$this->_changedItems[$_type][] = $_changedItem;
|
|
|
|
}
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
function setClientDeviceInfo($clientDeviceInfo)
|
|
|
|
{
|
|
|
|
$this->_clientDeviceInfo = $clientDeviceInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setDeletedItems($_type, $_deletedItems)
|
|
|
|
{
|
|
|
|
$this->_deletedItems[$_type] = $_deletedItems;
|
|
|
|
}
|
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
function addConflictItem($_type, $_conflict)
|
2005-06-19 21:00:58 +02:00
|
|
|
{
|
2009-07-15 21:31:25 +02:00
|
|
|
$this->_conflictItems[$_type][] = $_conflict;
|
|
|
|
}
|
|
|
|
|
|
|
|
function clearConflictItems($_type)
|
|
|
|
{
|
|
|
|
$this->_conflictItems[$_type] = array();
|
2005-06-19 21:00:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setter for property msgID.
|
|
|
|
* @param msgID New value of property msgID.
|
|
|
|
*/
|
|
|
|
function setMsgID($msgID)
|
|
|
|
{
|
|
|
|
$this->_msgID = $msgID;
|
|
|
|
}
|
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
/**
|
|
|
|
* Setter for property maxMsgSize.
|
|
|
|
* @param size New value of property maxMsgSize.
|
|
|
|
*/
|
|
|
|
function setMaxMsgSize($size)
|
|
|
|
{
|
|
|
|
$this->_maxMsgSize = $size;
|
|
|
|
}
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
/**
|
|
|
|
* Setter for property locName.
|
|
|
|
* @param locName New value of property locName.
|
|
|
|
*/
|
|
|
|
function setLocName($locName)
|
|
|
|
{
|
|
|
|
$this->_locName = $locName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setter for property locName.
|
|
|
|
* @param locName New value of property locName.
|
|
|
|
*/
|
|
|
|
function setPassword($password)
|
|
|
|
{
|
|
|
|
$this->_password = $password;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setSourceURI($sourceURI)
|
|
|
|
{
|
|
|
|
$this->_sourceURI = $sourceURI;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setSyncStatus($_syncStatus)
|
|
|
|
{
|
|
|
|
#Horde::logMessage('SyncML: syncState set to ==> ' . $_syncStatus, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
|
|
$this->_syncStatus = $_syncStatus;
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
function setTargetURI($targetURI)
|
|
|
|
{
|
|
|
|
$this->_targetURI = $targetURI;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setVersion($version)
|
|
|
|
{
|
|
|
|
$this->_version = $version;
|
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
if ($version == 2) {
|
|
|
|
$this->_uri = NAME_SPACE_URI_SYNCML_1_2;
|
|
|
|
$this->_uriMeta = NAME_SPACE_URI_METINF_1_2;
|
|
|
|
$this->_uriDevInf = NAME_SPACE_URI_DEVINF_1_2;
|
|
|
|
} elseif ($version == 1) {
|
2005-06-19 21:00:58 +02:00
|
|
|
$this->_uri = NAME_SPACE_URI_SYNCML_1_1;
|
|
|
|
$this->_uriMeta = NAME_SPACE_URI_METINF_1_1;
|
2006-01-11 06:42:07 +01:00
|
|
|
$this->_uriDevInf = NAME_SPACE_URI_DEVINF_1_1;
|
2009-07-15 21:31:25 +02:00
|
|
|
} else {
|
|
|
|
$this->_uri = NAME_SPACE_URI_SYNCML_1_0;
|
|
|
|
$this->_uriMeta = NAME_SPACE_URI_METINF_1_0;
|
|
|
|
$this->_uriDevInf = NAME_SPACE_URI_DEVINF_1_0;
|
|
|
|
}
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function setSessionID($sessionID)
|
|
|
|
{
|
|
|
|
$this->_sessionID = $sessionID;
|
|
|
|
}
|
|
|
|
|
|
|
|
function isAuthorized()
|
|
|
|
{
|
|
|
|
if (!$this->_isAuthorized) {
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
if(strstr($this->_locName,'@') === False)
|
|
|
|
{
|
2008-10-08 20:40:01 +02:00
|
|
|
$this->_locName .= '@'.$GLOBALS['egw_info']['server']['default_domain'];
|
2005-06-19 21:00:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#Horde::logMessage('SyncML: Authenticate ' . $this->_locName . ' - ' . $this->_password, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
2008-10-08 20:40:01 +02:00
|
|
|
|
|
|
|
if($GLOBALS['sessionid'] = $GLOBALS['egw']->session->create($this->_locName,$this->_password,'text','u'))
|
2005-06-19 21:00:58 +02:00
|
|
|
{
|
|
|
|
$this->_isAuthorized = true;
|
|
|
|
#Horde::logMessage('SyncML_EGW: Authentication of ' . $this->_locName . '/' . $GLOBALS['sessionid'] . ' succeded' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->_isAuthorized = false;
|
|
|
|
Horde::logMessage('SyncML: Authentication of ' . $this->_locName . ' failed' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// store sessionID in a variable, because ->verify maybe resets that value
|
|
|
|
$sessionID = session_id();
|
2008-10-08 20:40:01 +02:00
|
|
|
if(!$GLOBALS['egw']->session->verify($sessionID, 'staticsyncmlkp3'))
|
2006-01-11 06:42:07 +01:00
|
|
|
Horde::logMessage('SyncML_EGW: egw session('.$sessionID. ') not verified ' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
2005-06-19 21:00:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $this->_isAuthorized;
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
function isAuthConfirmed()
|
|
|
|
{
|
|
|
|
return $this->_AuthConfirmed;
|
|
|
|
}
|
|
|
|
|
|
|
|
function AuthConfirmed()
|
|
|
|
{
|
|
|
|
$this->_AuthConfirmed = true;
|
|
|
|
}
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
function clearSync($target)
|
|
|
|
{
|
|
|
|
unset($this->_syncs[$target]);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setSync($target, $sync)
|
|
|
|
{
|
|
|
|
$this->_syncs[$target] = $sync;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getSync($target)
|
|
|
|
{
|
|
|
|
if (isset($this->_syncs[$target])) {
|
|
|
|
return $this->_syncs[$target];
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
function getTargets()
|
|
|
|
{
|
|
|
|
if(count($this->_syncs) < 1)
|
|
|
|
return FALSE;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
foreach($this->_syncs as $target => $sync)
|
|
|
|
{
|
|
|
|
$targets[] = $target;
|
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
// Make sure we keep the order
|
|
|
|
sort($targets);
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
return $targets;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getURI()
|
|
|
|
{
|
2006-01-11 06:42:07 +01:00
|
|
|
/*
|
|
|
|
* The non WBXML devices (notably P900 and Sync4j seem to get confused
|
|
|
|
* by a <SyncML xmlns="syncml:SYNCML1.1"> element. They require
|
|
|
|
* just <SyncML>. So don't use an ns for non wbxml devices.
|
|
|
|
*/
|
2006-03-21 14:49:13 +01:00
|
|
|
if ($this->isWBXML()) {
|
2006-01-11 06:42:07 +01:00
|
|
|
return $this->_uri;
|
2006-03-21 14:49:13 +01:00
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
2005-06-19 21:00:58 +02:00
|
|
|
}
|
2009-07-15 21:31:25 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
function getURIMeta()
|
|
|
|
{
|
|
|
|
return $this->_uriMeta;
|
|
|
|
}
|
|
|
|
|
2006-01-11 06:42:07 +01:00
|
|
|
function getURIDevInf()
|
|
|
|
{
|
|
|
|
return $this->_uriDevInf;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
/**
|
|
|
|
* Converts a Horde GUID (like
|
|
|
|
* kronolith:0d1b415fc124d3427722e95f0e926b75) to a client ID as
|
|
|
|
* used by the sync client (like 12) returns false if no such id
|
|
|
|
* is stored yet.
|
|
|
|
*
|
|
|
|
* Remember that the datatree is really a tree disguised as a
|
|
|
|
* table. So to look up the guid above, getId first looks for an
|
|
|
|
* entry 'kronolith' and then for an entry
|
|
|
|
* 0d1b415fc124d3427722e95f0e926b75 with kronolith as parent.
|
|
|
|
*/
|
|
|
|
function getLocID($type, $guid)
|
|
|
|
{
|
|
|
|
$dt = &$this->getDataTree();
|
|
|
|
$id = $dt->getId($this->_locName . $this->_sourceURI . $type . $guid);
|
|
|
|
if (is_a($id, 'PEAR_Error')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$gid = $dt->getObjectById($id);
|
|
|
|
if (is_a($gid, 'PEAR_Error')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $gid->get('locid');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Puts a given client $locid and Horde server $guid pair into the
|
|
|
|
* map table to allow mapping between the client's and server's
|
|
|
|
* IDs. Actually there are two maps: from the localid to the guid
|
|
|
|
* and vice versa. The localid is converted to a key as follows:
|
|
|
|
* this->_locName . $this->_sourceURI . $type . $locid so you can
|
|
|
|
* have different syncs with different devices. If an entry
|
|
|
|
* already exists, it is overwritten.
|
2009-07-15 21:31:25 +02:00
|
|
|
* Expired entries can be deleted at the next session start.
|
2005-06-19 21:00:58 +02:00
|
|
|
*/
|
2009-07-15 21:31:25 +02:00
|
|
|
function setUID($type, $locid, $guid, $ts=0, $expired=0)
|
2005-06-19 21:00:58 +02:00
|
|
|
{
|
|
|
|
$dt = &$this->getDataTree();
|
|
|
|
|
|
|
|
// Set $locid.
|
2009-06-08 18:21:14 +02:00
|
|
|
$gid = new DataTreeObject($this->_locName . $this->_sourceURI . $type . $guid);
|
2005-06-19 21:00:58 +02:00
|
|
|
$gid->set('type', $type);
|
|
|
|
$gid->set('locid', $locid);
|
|
|
|
$gid->set('ts', $ts);
|
2009-07-15 21:31:25 +02:00
|
|
|
$gid->set('expired', $expired);
|
2005-06-19 21:00:58 +02:00
|
|
|
|
|
|
|
$r = $dt->add($gid);
|
|
|
|
if (is_a($r, 'PEAR_Error')) {
|
|
|
|
// Object already exists: update instead.
|
|
|
|
$r = $dt->updateData($gid);
|
|
|
|
}
|
|
|
|
$this->dieOnError($r, __FILE__, __LINE__);
|
|
|
|
|
|
|
|
// Set $globaluid
|
2009-06-08 18:21:14 +02:00
|
|
|
$lid = new DataTreeObject($this->_locName . $this->_sourceURI . $type . $locid);
|
2005-06-19 21:00:58 +02:00
|
|
|
$lid->set('globaluid', $guid);
|
|
|
|
$r = $dt->add($lid);
|
|
|
|
if (is_a($r, 'PEAR_Error')) {
|
|
|
|
// object already exists: update instead.
|
|
|
|
$r = $dt->updateData($lid);
|
|
|
|
}
|
|
|
|
$this->dieOnError($r, __FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the Horde server guid (like
|
|
|
|
* kronolith:0d1b415fc124d3427722e95f0e926b75) for a given client
|
|
|
|
* locid. Returns false if no such id is stored yet.
|
|
|
|
*
|
|
|
|
* Opposite of getLocId which returns the locid for a given guid.
|
|
|
|
*/
|
|
|
|
function getGlobalUID($type, $locid)
|
|
|
|
{
|
|
|
|
$this->dieOnError($type, __FILE__, __LINE__);
|
|
|
|
$this->dieOnError($locid, __FILE__, __LINE__);
|
|
|
|
$this->dieOnError($locid, __FILE__, __LINE__);
|
|
|
|
$this->dieOnError($this->_locName, __FILE__, __LINE__);
|
|
|
|
$this->dieOnError($this->_sourceURI, __FILE__, __LINE__);
|
|
|
|
|
|
|
|
$dt = &$this->getDataTree();
|
|
|
|
|
|
|
|
$id = $dt->getId($this->_locName . $this->_sourceURI . $type . $locid);
|
|
|
|
if (is_a($id, 'PEAR_Error')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$lid = $dt->getObjectById($id);
|
|
|
|
if (is_a($lid, 'PEAR_Error')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $lid->get('globaluid');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the timestamp (if set) of the last change to the
|
|
|
|
* obj:guid, that was caused by the client. This is stored to
|
|
|
|
* avoid mirroring these changes back to the client.
|
|
|
|
*/
|
|
|
|
function getChangeTS($type, $guid)
|
|
|
|
{
|
|
|
|
$dt = &$this->getDataTree();
|
|
|
|
|
|
|
|
$id = $dt->getId($this->_locName . $this->_sourceURI . $type . $guid);
|
|
|
|
if (is_a($id, 'PEAR_Error')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$gid = $dt->getObjectById($id);
|
|
|
|
if (is_a($gid, 'PEAR_Error')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $gid->get('ts');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the locid<->guid mapping for the given locid. Returns
|
|
|
|
* the guid that was removed or false if no mapping entry was
|
|
|
|
* found.
|
|
|
|
*/
|
|
|
|
function removeUID($type, $locid)
|
|
|
|
{
|
|
|
|
$dt = &$this->getDataTree();
|
|
|
|
|
|
|
|
$id = $dt->getId($this->_locName . $this->_sourceURI . $type . $locid);
|
|
|
|
if (is_a($id, 'PEAR_Error')) {
|
|
|
|
Horde::logMessage("SyncML: state->removeUID(type=$type,locid=$locid) : nothing to remove", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$lid = $dt->getObjectById($id);
|
|
|
|
$guid = $lid->get('globaluid');
|
|
|
|
Horde::logMessage("SyncML: state->removeUID(type=$type,locid=$locid) : removing guid:$guid and lid:$lid", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
|
|
$dt->remove($guid);
|
|
|
|
$dt->remove($lid);
|
|
|
|
|
|
|
|
return $guid;
|
|
|
|
}
|
|
|
|
|
2006-08-15 16:42:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This function should use DevINF information.
|
|
|
|
*/
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
function adjustContentType($type, $target = null)
|
|
|
|
{
|
2009-07-15 21:31:25 +02:00
|
|
|
if (is_array($type)) {
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$ctype = $type['ContentType'];
|
|
|
|
$res = $type;
|
2009-07-15 21:31:25 +02:00
|
|
|
} else {
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$ctype = $type;
|
|
|
|
$res = array();
|
|
|
|
$res['ContentType'] = $ctype;
|
|
|
|
}
|
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
$deviceInfo = $this->getClientDeviceInfo();
|
|
|
|
$manufacturer = isset($deviceInfo['manufacturer']) ? strtolower($deviceInfo['manufacturer']) : 'unknown';
|
|
|
|
switch ($manufacturer) {
|
|
|
|
case 'funambol':
|
|
|
|
switch (strtolower($deviceInfo['model'])) {
|
|
|
|
case 'thunderbird':
|
|
|
|
case 'mozilla plugin':
|
|
|
|
$res['mayFragment'] = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (isset($deviceInfo['softwareVersion'])
|
|
|
|
&& $deviceInfo['softwareVersion'] < 4.0) {
|
|
|
|
$res['mayFragment'] = 0;
|
|
|
|
} else {
|
|
|
|
$res['mayFragment'] = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$res['mayFragment'] = 1;
|
|
|
|
break;
|
|
|
|
}
|
2007-12-19 08:45:36 +01:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
// the funambol specific types need to be encoded in base64
|
|
|
|
switch (strtolower($ctype)) {
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
case 'text/x-s4j-sifc':
|
|
|
|
case 'text/x-s4j-sife':
|
|
|
|
case 'text/x-s4j-sift':
|
|
|
|
case 'text/x-s4j-sifn':
|
|
|
|
$res['ContentFormat'] = 'b64';
|
|
|
|
break;
|
2007-11-19 12:16:24 +01:00
|
|
|
}
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getPreferedContentType($type)
|
|
|
|
{
|
|
|
|
$_type = str_replace('./','',$type);
|
2009-07-15 21:31:25 +02:00
|
|
|
switch (strtolower($_type)) {
|
2006-08-15 16:42:13 +02:00
|
|
|
case 'contacts':
|
2009-07-15 21:31:25 +02:00
|
|
|
return 'text/vcard';
|
2006-08-15 16:42:13 +02:00
|
|
|
break;
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|
|
|
|
case 'notes':
|
|
|
|
return 'text/x-vnote';
|
|
|
|
break;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
case 'calendar':
|
2009-07-15 21:31:25 +02:00
|
|
|
case 'events':
|
2007-11-19 12:16:24 +01:00
|
|
|
case 'tasks':
|
|
|
|
case 'caltasks':
|
2009-07-15 21:31:25 +02:00
|
|
|
return 'text/calendar';
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
break;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-08-15 16:42:13 +02:00
|
|
|
case 'sifcalendar':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
case 'scal':
|
2006-08-15 16:42:13 +02:00
|
|
|
return 'text/x-s4j-sife';
|
|
|
|
break;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-08-15 16:42:13 +02:00
|
|
|
case 'sifcontacts':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
case 'scard':
|
2006-08-15 16:42:13 +02:00
|
|
|
return 'text/x-s4j-sifc';
|
|
|
|
break;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-08-15 16:42:13 +02:00
|
|
|
case 'siftasks':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
case 'stask':
|
2006-08-15 16:42:13 +02:00
|
|
|
return 'text/x-s4j-sift';
|
|
|
|
break;
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|
|
|
|
case 'sifnotes':
|
|
|
|
case 'snote':
|
|
|
|
return 'text/x-s4j-sifn';
|
|
|
|
break;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2007-11-19 12:16:24 +01:00
|
|
|
default:
|
|
|
|
Horde::logMessage("SyncML: unrecognized content type '$_type'", __FILE__, __LINE__, PEAR_LOG_ERR);
|
|
|
|
break;
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getHordeType($type)
|
|
|
|
{
|
|
|
|
$_type = str_replace('./','',$type);
|
2007-11-19 12:16:24 +01:00
|
|
|
switch(strtolower($_type))
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
{
|
|
|
|
case 'contacts':
|
|
|
|
return 'contacts';
|
|
|
|
break;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-08-15 16:42:13 +02:00
|
|
|
case 'notes':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
return 'notes';
|
2006-08-15 16:42:13 +02:00
|
|
|
break;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2006-08-15 16:42:13 +02:00
|
|
|
case 'tasks':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
return 'tasks';
|
2006-08-15 16:42:13 +02:00
|
|
|
break;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
case 'events':
|
2006-08-15 16:42:13 +02:00
|
|
|
case 'calendar':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
return 'calendar';
|
|
|
|
break;
|
|
|
|
|
2008-11-03 08:44:02 +01:00
|
|
|
case 'caltasks':
|
|
|
|
return 'caltasks';
|
|
|
|
break;
|
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
# funambol related types
|
|
|
|
|
|
|
|
case 'sifcalendar':
|
|
|
|
case 'scal':
|
|
|
|
return 'sifcalendar';
|
|
|
|
break;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
case 'sifcontacts':
|
|
|
|
case 'scard':
|
|
|
|
return 'sifcontacts';
|
|
|
|
break;
|
2008-10-08 20:40:01 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
case 'siftasks':
|
|
|
|
case 'stask':
|
|
|
|
return 'siftasks';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'sifnotes':
|
|
|
|
case 'snote':
|
|
|
|
return 'sifnotes';
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2007-11-19 12:16:24 +01:00
|
|
|
Horde::logMessage("SyncML: unknown hordeType for type=$type ($_type)", __FILE__, __LINE__, PEAR_LOG_INFO);
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
return $_type;
|
2006-08-15 16:42:13 +02:00
|
|
|
break;
|
|
|
|
}
|
2006-03-21 14:49:13 +01:00
|
|
|
}
|
2005-06-19 21:00:58 +02:00
|
|
|
|
2006-08-15 16:42:13 +02:00
|
|
|
/**
|
|
|
|
* Returns the preferred contenttype of the client for the given
|
|
|
|
* sync data type (database).
|
|
|
|
*
|
|
|
|
* This is passed as an option to the Horde API export functions.
|
|
|
|
*/
|
2008-10-08 20:40:01 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
function getPreferedContentTypeClient($_sourceLocURI, $_targetLocURI = null) {
|
2006-08-15 16:42:13 +02:00
|
|
|
$deviceInfo = $this->getClientDeviceInfo();
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
if(isset($deviceInfo['dataStore'][$_sourceLocURI]['maxGUIDSize']['contentType'])) {
|
|
|
|
$this->_maxGUIDSize = $deviceInfo['dataStore'][$this->_sourceURI]['maxGUIDSize']['contentType'];
|
|
|
|
}
|
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
if(isset($deviceInfo['dataStore'][$_sourceLocURI]['rxPreference']['contentType']))
|
|
|
|
{
|
2009-07-15 21:31:25 +02:00
|
|
|
$ctype = $deviceInfo['dataStore'][$_sourceLocURI]['rxPreference']['contentType'];
|
|
|
|
$cvers = $deviceInfo['dataStore'][$_sourceLocURI]['rxPreference']['contentVersion'];
|
|
|
|
$cfrmt = $deviceInfo['dataStore'][$_sourceLocURI]['rxPreference']['contentFormat'];
|
|
|
|
$cprops = $deviceInfo['dataStore'][$_sourceLocURI]['properties'][$ctype][$cvers];
|
|
|
|
if (isset($deviceInfo['dataStore'][$_sourceLocURI]['maxGUIDSize'])) {
|
|
|
|
// get UID properties from maxGUIDSize
|
|
|
|
$cprops['UID']['Size'] = $deviceInfo['dataStore'][$_sourceLocURI]['maxGUIDSize'];
|
|
|
|
$cprops['UID']['NoTruncate'] = true;
|
|
|
|
}
|
|
|
|
$clientPrefs = array(
|
|
|
|
'ContentType' => $ctype,
|
|
|
|
'ContentFormat' => $cfrmt,
|
|
|
|
'mayFragment' => 1,
|
|
|
|
'Properties' => $cprops,
|
|
|
|
);
|
|
|
|
#Horde::logMessage('SyncML: sourceLocURI ' . $_sourceLocURI . " clientPrefs:\n"
|
|
|
|
# . print_r($clientPrefs, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
|
|
return $this->adjustContentType($clientPrefs, $_targetLocURI);
|
2006-08-15 16:42:13 +02:00
|
|
|
}
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
Horde::logMessage('SyncML: sourceLocURI ' . $_sourceLocURI . " not found:\n" . print_r($deviceInfo, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
2008-10-08 20:40:01 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
if ($_targetLocURI != null)
|
|
|
|
{
|
|
|
|
return $this->adjustContentType($this->getPreferedContentType($_targetLocURI), $_targetLocURI);
|
|
|
|
}
|
|
|
|
|
2006-08-15 16:42:13 +02:00
|
|
|
return PEAR::raiseError(_('sourceLocURI not found'));
|
|
|
|
}
|
2005-06-19 21:00:58 +02:00
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
/**
|
|
|
|
* Returns the MaxGUIDSize of the client
|
|
|
|
*/
|
|
|
|
|
|
|
|
function getMaxGUIDSizeClient() {
|
|
|
|
$maxGUIDSize = MAX_GUID_SIZE;
|
|
|
|
|
|
|
|
if (isset($this->_maxGUIDSize)) {
|
|
|
|
$maxGUIDSize = $this->_maxGUIDSize;
|
|
|
|
}
|
|
|
|
return $maxGUIDSize;
|
|
|
|
}
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
function setClientAnchorNext($type, $a)
|
|
|
|
{
|
|
|
|
$this->_clientAnchorNext[$type] = $a;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setServerAnchorLast($type, $a)
|
|
|
|
{
|
|
|
|
$this->_serverAnchorLast[$type] = $a;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setServerAnchorNext($type, $a)
|
|
|
|
{
|
|
|
|
$this->_serverAnchorNext[$type] = $a;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getClientAnchorNext($type)
|
|
|
|
{
|
|
|
|
return $this->_clientAnchorNext[$type];
|
|
|
|
}
|
|
|
|
|
|
|
|
function getServerAnchorNext($type)
|
|
|
|
{
|
|
|
|
return $this->_serverAnchorNext[$type];
|
|
|
|
}
|
|
|
|
|
|
|
|
function getServerAnchorLast($type)
|
|
|
|
{
|
|
|
|
return $this->_serverAnchorLast[$type];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves information about the previous sync if any. Returns
|
|
|
|
* false if no info found or a DateTreeObject with at least the
|
|
|
|
* following attributes:
|
|
|
|
*
|
|
|
|
* ClientAnchor: the clients Next Anchor of the previous sync.
|
|
|
|
* ServerAnchor: the Server Next Anchor of the previous sync.
|
|
|
|
*/
|
|
|
|
function &getSyncSummary($type)
|
|
|
|
{
|
|
|
|
$dt = &$this->getDataTree();
|
|
|
|
|
|
|
|
$id = $dt->getId($this->_locName . $this->_sourceURI . $type . 'syncSummary');
|
|
|
|
if (is_a($id, 'PEAR_Error')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $dt->getObjectById($id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves information about the clients device info if any. Returns
|
|
|
|
* false if no info found or a DateTreeObject with at least the
|
|
|
|
* following attributes:
|
|
|
|
*
|
|
|
|
* a array containing all available infos about the device
|
|
|
|
*/
|
|
|
|
function getClientDeviceInfo()
|
|
|
|
{
|
2009-07-15 21:31:25 +02:00
|
|
|
if (isset($this->_clientDeviceInfo) && is_array($this->_clientDeviceInfo)) {
|
|
|
|
// use cached information
|
|
|
|
return $this->_clientDeviceInfo;
|
|
|
|
}
|
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
$dt = &$this->getDataTree();
|
|
|
|
|
|
|
|
$id = $dt->getId($this->_locName . $this->_sourceURI . 'deviceInfo');
|
|
|
|
if (is_a($id, 'PEAR_Error')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
$info = $dt->getObjectById($id);
|
2008-10-08 20:40:01 +02:00
|
|
|
|
2005-06-19 21:00:58 +02:00
|
|
|
return $info->get('ClientDeviceInfo');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* write clients device info to database
|
|
|
|
*/
|
|
|
|
function writeClientDeviceInfo()
|
|
|
|
{
|
|
|
|
if (!isset($this->_clientDeviceInfo) || !is_array($this->_clientDeviceInfo)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$dt = &$this->getDataTree();
|
|
|
|
|
|
|
|
$s = $this->_locName . $this->_sourceURI . 'deviceInfo';
|
|
|
|
|
|
|
|
// Set $locid.
|
2009-06-08 18:21:14 +02:00
|
|
|
$info = new DataTreeObject($s);
|
2005-06-19 21:00:58 +02:00
|
|
|
$info->set('ClientDeviceInfo', $this->_clientDeviceInfo);
|
|
|
|
$r = $dt->add($info);
|
|
|
|
if (is_a($r, 'PEAR_Error')) {
|
|
|
|
// Object already exists: update instead.
|
|
|
|
$dt->updateData($info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* After a successful sync, the client and server's Next Anchors
|
|
|
|
* are written to the database so they can be used to negotiate
|
|
|
|
* upcoming syncs.
|
|
|
|
*/
|
|
|
|
function writeSyncSummary()
|
|
|
|
{
|
|
|
|
if (!isset($this->_serverAnchorNext) || !is_array($this->_serverAnchorNext)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$dt = &$this->getDataTree();
|
|
|
|
|
|
|
|
foreach (array_keys($this->_serverAnchorNext) as $type) {
|
|
|
|
$s = $this->_locName . $this->_sourceURI . $type . 'syncSummary';
|
|
|
|
|
|
|
|
// Set $locid.
|
2009-06-08 18:21:14 +02:00
|
|
|
$info = new DataTreeObject($s);
|
2005-06-19 21:00:58 +02:00
|
|
|
$info->set('ClientAnchor', $this->_clientAnchorNext);
|
|
|
|
$info->set('ServerAnchor', $this->_serverAnchorNext);
|
|
|
|
$r = $dt->add($info);
|
|
|
|
if (is_a($r, 'PEAR_Error')) {
|
|
|
|
// Object already exists: update instead.
|
|
|
|
$dt->updateData($info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The log simply counts the entries for each topic.
|
|
|
|
*/
|
|
|
|
function log($topic)
|
|
|
|
{
|
|
|
|
if (isset($this->_log[$topic])) {
|
|
|
|
$this->_log[$topic] += 1;
|
|
|
|
} else {
|
|
|
|
$this->_log[$topic] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Log is an array where the key is the event name and the
|
|
|
|
* value says how often this event occured.
|
|
|
|
*/
|
|
|
|
function getLog()
|
|
|
|
{
|
|
|
|
return $this->_log;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert the content.
|
|
|
|
*
|
|
|
|
* Currently strips uid (primary key) information as client and
|
|
|
|
* server might use different ones.
|
|
|
|
*
|
|
|
|
* Charset conversions might be added here too.
|
|
|
|
*/
|
|
|
|
function convertClient2Server($content, $contentType)
|
|
|
|
{
|
|
|
|
switch ($contentType) {
|
|
|
|
case 'text/calendar':
|
|
|
|
case 'text/x-icalendar':
|
|
|
|
case 'text/x-vcalendar':
|
|
|
|
case 'text/x-vevent':
|
|
|
|
case 'text/x-vtodo':
|
Big SyncML patch from Philip Herbert <pherbert(at)knauber.de>:
- change the processing of slowsync, to use the content_map instead of
trying to build a new one. This caused duplication issues on the
client if multiple similar records where stored, because only the first
one found in the server-db was matched, These duplicate entries at client
side had no entry at serverside, so deleting the wrong one
on the client (the content with a valid map entry) could cause
unwanted data loss at server side, because it is impossible for the
user to see what is a duplicate, and what is not.
see also:
http://www.nabble.com/again---syncml-duplication-issue-to20333619s3741.html
- reenabled UID from syncml clients, because it was partly used this caused
issues during SlowSync if the content was changed.
- infolog, calendar if a uid is found in the provided data, allway try to
find the corresponding content first using only the UID, instead of
using the content-id taken from content_map.
also fixed:
- a few fixes in ./notes
- creating an entry on the client that can not be imported,
(Example, Nokia E Series Appointment without a Title)
will no longer create an invalid content-map entry
However, at client side this is still counted in the Protocol as
Server-Add
2008-11-16 11:42:29 +01:00
|
|
|
// $content = preg_replace('/^UID:.*\n/m', '', $content, 1);
|
2005-06-19 21:00:58 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $content;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert the content.
|
|
|
|
*
|
|
|
|
* Currently strips uid (primary key) information as client and
|
|
|
|
* server might use different ones.
|
|
|
|
*
|
|
|
|
* Charset conversions might be added here too.
|
|
|
|
*/
|
|
|
|
function convertServer2Client($content, $contentType)
|
|
|
|
{
|
|
|
|
switch ($contentType) {
|
|
|
|
case 'text/calendar':
|
|
|
|
case 'text/x-icalendar':
|
|
|
|
case 'text/x-vcalendar':
|
|
|
|
case 'text/x-vevent':
|
|
|
|
case 'text/x-vtodo':
|
Big SyncML patch from Philip Herbert <pherbert(at)knauber.de>:
- change the processing of slowsync, to use the content_map instead of
trying to build a new one. This caused duplication issues on the
client if multiple similar records where stored, because only the first
one found in the server-db was matched, These duplicate entries at client
side had no entry at serverside, so deleting the wrong one
on the client (the content with a valid map entry) could cause
unwanted data loss at server side, because it is impossible for the
user to see what is a duplicate, and what is not.
see also:
http://www.nabble.com/again---syncml-duplication-issue-to20333619s3741.html
- reenabled UID from syncml clients, because it was partly used this caused
issues during SlowSync if the content was changed.
- infolog, calendar if a uid is found in the provided data, allway try to
find the corresponding content first using only the UID, instead of
using the content-id taken from content_map.
also fixed:
- a few fixes in ./notes
- creating an entry on the client that can not be imported,
(Example, Nokia E Series Appointment without a Title)
will no longer create an invalid content-map entry
However, at client side this is still counted in the Protocol as
Server-Add
2008-11-16 11:42:29 +01:00
|
|
|
// $content = preg_replace('/^UID:.*\n/m', '', $content, 1);
|
2005-06-19 21:00:58 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: utf8 really should be fine. But the P900 seems to
|
|
|
|
// expect ISO 8559 even when <?xml version="1.0"
|
|
|
|
// encoding="utf-8"> is specified.
|
|
|
|
//
|
|
|
|
// So at least make this dependant on the device information.
|
|
|
|
return utf8_decode($content);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When True, Task Item changes (NAG) are sent to the server
|
|
|
|
* during "calendar" Syncs. That's the way the P800/900 handles
|
|
|
|
* things. Should be retrieved from devinf?
|
|
|
|
*/
|
|
|
|
function handleTasksInCalendar()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is a small helper function that can be included to check
|
|
|
|
* whether a given $obj is a PEAR_Error or not. If so, it logs
|
|
|
|
* to debug, var_dumps the $obj and exits.
|
|
|
|
*/
|
|
|
|
function dieOnError($obj, $file = __FILE__, $line = __LINE__)
|
|
|
|
{
|
|
|
|
if (!is_a($obj, 'PEAR_Error')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Horde::logMessage('SyncML: PEAR Error: ' . $obj->getMessage(), $file, $line, PEAR_LOG_ERR);
|
|
|
|
print "PEAR ERROR\n\n";
|
|
|
|
var_dump($obj);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2006-03-21 14:49:13 +01:00
|
|
|
function getAlert222Received() {
|
|
|
|
return $this->_receivedAlert222;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setAlert222Received($_status) {
|
|
|
|
$this->_receivedAlert222 = (bool)$_status;
|
|
|
|
}
|
|
|
|
|
2009-07-15 21:31:25 +02:00
|
|
|
function incNumberOfElements() {
|
|
|
|
$this->_numberOfElements++;
|
|
|
|
}
|
|
|
|
|
|
|
|
function clearNumberOfElements() {
|
|
|
|
$this->_numberOfElements = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getNumberOfElements() {
|
|
|
|
if (isset($this->_numberOfElements)) {
|
|
|
|
return $this->_numberOfElements;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function maxNumberOfElements() {
|
|
|
|
unset($this->_numberOfElements);
|
|
|
|
}
|
2005-06-19 21:00:58 +02:00
|
|
|
}
|