mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 17:14:44 +01:00
fixed handling of too long syncml id's
This commit is contained in:
parent
ef1e1721dc
commit
495abdd139
@ -484,7 +484,7 @@ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler {
|
||||
$state = & $_SESSION['SyncML.state'];
|
||||
|
||||
// <SyncML><SyncBody><[Command]>
|
||||
Horde::logMessage('SyncML['. session_id() ."]: found command $element ", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
#Horde::logMessage('SyncML['. session_id() ."]: found command $element ", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
$this->_currentCommand = Horde_SyncML_Command::factory($element);
|
||||
$this->_currentCommand->startElement($uri, $element, $attrs);
|
||||
|
||||
|
@ -117,6 +117,7 @@ class Horde_SyncML_Command_Sync_ContentSyncElement extends Horde_SyncML_Command_
|
||||
$output->startElement($state->getURI(), 'Source', $attrs);
|
||||
$output->startElement($state->getURI(), 'LocURI', $attrs);
|
||||
$chars = substr($this->_locURI,0,39);
|
||||
$state->setUIDMapping($this->_locURI, $chars);
|
||||
$output->characters($chars);
|
||||
$output->endElement($state->getURI(), 'LocURI');
|
||||
$output->endElement($state->getURI(), 'Source');
|
||||
|
@ -203,6 +203,11 @@ class Horde_SyncML_State {
|
||||
// stores if we already requested the deviceinfo
|
||||
var $_devinfoRequested = false;
|
||||
|
||||
/*
|
||||
* store the mappings of egw uids to client uids
|
||||
*/
|
||||
var $_uidMappings = array();
|
||||
|
||||
/**
|
||||
* Creates a new instance of Horde_SyncML_State.
|
||||
*/
|
||||
@ -217,6 +222,24 @@ class Horde_SyncML_State {
|
||||
|
||||
$this->isAuthorized = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
if(isset($this->_uidMappings[$_sentEgwUid])) {
|
||||
return $this->_uidMappings[$_sentEgwUid];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the DataTree used as persistence layer for SyncML. The
|
||||
|
@ -4,7 +4,12 @@ include_once dirname(__FILE__).'/State.php';
|
||||
|
||||
class EGW_SyncML_State extends Horde_SyncML_State
|
||||
{
|
||||
var $table_devinfo = 'egw_syncmldevinfo';
|
||||
var $table_devinfo = 'egw_syncmldevinfo';
|
||||
|
||||
/*
|
||||
* store the mappings of egw uids to client uids
|
||||
*/
|
||||
var $uidMappings = array();
|
||||
|
||||
/**
|
||||
* Returns the timestamp (if set) of the last change to the
|
||||
@ -323,22 +328,28 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
||||
* have different syncs with different devices. If an entry
|
||||
* already exists, it is overwritten.
|
||||
*/
|
||||
function setUID($type, $locid, $guid, $ts=0)
|
||||
function setUID($type, $locid, $_guid, $ts=0)
|
||||
{
|
||||
#Horde::logMessage("SyncML: setUID $type, $locid, $guid, $ts ", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
#Horde::logMessage("SyncML: setUID ". $this->getUIDMapping($guid), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
// fix $guid, it maybe was to long for some devices
|
||||
// format is appname-id-systemid
|
||||
$guidParts = explode('-',$guid);
|
||||
if(count($guidParts) == 3)
|
||||
{
|
||||
$guid = $GLOBALS['egw']->common->generate_uid($guidParts[0],$guidParts[1]);
|
||||
}
|
||||
#$guidParts = explode('-',$guid);
|
||||
#if(count($guidParts) == 3) {
|
||||
# $guid = $GLOBALS['egw']->common->generate_uid($guidParts[0],$guidParts[1]);
|
||||
#}
|
||||
|
||||
if($ts == 0)
|
||||
{
|
||||
$guid = $this->getUIDMapping($_guid);
|
||||
if($guid === false) {
|
||||
Horde::logMessage("SyncML: setUID $type, $locid, $guid something went wrong!!! Mapping not found.", __FILE__, __LINE__, PEAR_LOG_INFO);
|
||||
return false;
|
||||
}
|
||||
Horde::logMessage("SyncML: setUID $_guid => $guid", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
if($ts == 0) {
|
||||
$ts = time();
|
||||
}
|
||||
|
||||
#Horde::logMessage("SyncML: setUID $type, $locid, $guid, $ts ".count($guidParts), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
Horde::logMessage("SyncML: setUID $type, $locid, $guid, $ts ", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
|
||||
$db = clone($GLOBALS['egw']->db);
|
||||
|
||||
|
@ -44,7 +44,7 @@ class Horde_SyncML_Sync_RefreshFromServerSync extends Horde_SyncML_Sync_TwoWaySy
|
||||
|
||||
$cmd = &new Horde_SyncML_Command_Sync_ContentSyncElement();
|
||||
$c = $registry->call($hordeType . '/export', array('guid' => $guid, 'contentType' => $contentType));
|
||||
Horde::logMessage("SyncML: slowsync add to client $c", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
Horde::logMessage("SyncML: slowsync add $guid to client ". print_r($c, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
if (!is_a($c, 'PEAR_Error')) {
|
||||
$cmd->setContent($c);
|
||||
if($hordeType == 'sifcalendar' || $hordeType == 'sifcontacts' || $hordeType == 'siftasks') {
|
||||
|
@ -46,7 +46,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
||||
|
||||
$cmd = &new Horde_SyncML_Command_Sync_ContentSyncElement();
|
||||
$c = $registry->call($hordeType . '/export', array('guid' => $guid, 'contentType' => $contentType));
|
||||
Horde::logMessage("SyncML: slowsync add to client $c", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
#Horde::logMessage("SyncML: slowsync add guid $guid to client ". print_r($c, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
if (!is_a($c, 'PEAR_Error')) {
|
||||
$cmd->setContent($c);
|
||||
if($hordeType == 'sifcalendar' || $hordeType == 'sifcontacts' || $hordeType == 'siftasks') {
|
||||
|
Loading…
Reference in New Issue
Block a user