forked from extern/egroupware
various syncml fixes
- when doing slowsync we don't update the entries anymore. we just add the needed mapping to the database. - improved handing of deviceinfo
This commit is contained in:
parent
072b6966d2
commit
45200da684
@ -493,12 +493,6 @@ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler {
|
|||||||
|
|
||||||
switch($element)
|
switch($element)
|
||||||
{
|
{
|
||||||
# case 'Final':
|
|
||||||
# if($state->getClientSyncStatus() == 1)
|
|
||||||
# {
|
|
||||||
# $state->setClientSyncStatus(2);
|
|
||||||
# }
|
|
||||||
# break;
|
|
||||||
case 'Sync':
|
case 'Sync':
|
||||||
$state->setSyncStatus(CLIENT_SYNC_STARTED);
|
$state->setSyncStatus(CLIENT_SYNC_STARTED);
|
||||||
Horde::logMessage('SyncML['. session_id() .']: syncStatus(client sync started) ' . $state->getSyncStatus(), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
Horde::logMessage('SyncML['. session_id() .']: syncStatus(client sync started) ' . $state->getSyncStatus(), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
@ -78,8 +78,7 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($this->_alert < ALERT_RESULT_ALERT)
|
if($this->_alert < ALERT_RESULT_ALERT) {
|
||||||
{
|
|
||||||
|
|
||||||
$type = $this->_targetLocURI;
|
$type = $this->_targetLocURI;
|
||||||
|
|
||||||
@ -121,6 +120,7 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
|||||||
if(isset($this->_targetLocURIParameters))
|
if(isset($this->_targetLocURIParameters))
|
||||||
$sync->_targetLocURIParameters = $this->_targetLocURIParameters;
|
$sync->_targetLocURIParameters = $this->_targetLocURIParameters;
|
||||||
$state->setSync($this->_targetLocURI, $sync);
|
$state->setSync($this->_targetLocURI, $sync);
|
||||||
|
$state->removeAllUID($this->_targetLocURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
$status = &new Horde_SyncML_Command_Status($code, 'Alert');
|
$status = &new Horde_SyncML_Command_Status($code, 'Alert');
|
||||||
@ -196,10 +196,46 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
|||||||
$output->endElement($state->getURI(), 'Item');
|
$output->endElement($state->getURI(), 'Item');
|
||||||
$output->endElement($state->getURI(), 'Alert');
|
$output->endElement($state->getURI(), 'Alert');
|
||||||
|
|
||||||
|
// still needed? lars
|
||||||
$state->_sendFinal = true;
|
$state->_sendFinal = true;
|
||||||
|
|
||||||
$currentCmdID++;
|
$currentCmdID++;
|
||||||
|
|
||||||
|
if($state->_devinfoRequested == false &&
|
||||||
|
$this->_sourceLocURI != null &&
|
||||||
|
is_a($state->getPreferedContentTypeClient($this->_sourceLocURI), 'PEAR_Error')) {
|
||||||
|
|
||||||
|
$output->startElement($state->getURI(), 'Get', $attrs);
|
||||||
|
|
||||||
|
$output->startElement($state->getURI(), 'CmdID', $attrs);
|
||||||
|
$output->characters($currentCmdID);
|
||||||
|
$currentCmdID++;
|
||||||
|
$output->endElement($state->getURI(), 'CmdID');
|
||||||
|
|
||||||
|
$output->startElement($state->getURI(), 'Meta', $attrs);
|
||||||
|
$output->startElement($state->getURIMeta(), 'Type', $attrs);
|
||||||
|
if(is_a($output, 'XML_WBXML_Encoder')) {
|
||||||
|
$output->characters('application/vnd.syncml-devinf+wbxml');
|
||||||
|
} else {
|
||||||
|
$output->characters('application/vnd.syncml-devinf+xml');
|
||||||
}
|
}
|
||||||
|
$output->endElement($state->getURIMeta(), 'Type');
|
||||||
|
$output->endElement($state->getURI(), 'Meta');
|
||||||
|
|
||||||
|
$output->startElement($state->getURI(), 'Item', $attrs);
|
||||||
|
$output->startElement($state->getURI(), 'Target', $attrs);
|
||||||
|
$output->startElement($state->getURI(), 'LocURI', $attrs);
|
||||||
|
$output->characters(($state->getVersion() == 0) ? './devinf10' : './devinf11');
|
||||||
|
$output->endElement($state->getURI(), 'LocURI');
|
||||||
|
$output->endElement($state->getURI(), 'Target');
|
||||||
|
$output->endElement($state->getURI(), 'Item');
|
||||||
|
|
||||||
|
$output->endElement($state->getURI(), 'Get');
|
||||||
|
|
||||||
|
$state->_devinfoRequested = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} elseif ($this->_alert == ALERT_NEXT_MESSAGE) {
|
} elseif ($this->_alert == ALERT_NEXT_MESSAGE) {
|
||||||
$status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Alert');
|
$status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Alert');
|
||||||
$status->setCmdRef($this->_cmdID);
|
$status->setCmdRef($this->_cmdID);
|
||||||
@ -215,9 +251,6 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
|||||||
|
|
||||||
$state->setAlert222Received(true);
|
$state->setAlert222Received(true);
|
||||||
|
|
||||||
#if($state->getSyncStatus() > CLIENT_SYNC_STARTED && $state->getSyncStatus() < CLIENT_SYNC_ACKNOWLEDGED) {
|
|
||||||
# $state->setSyncStatus(CLIENT_SYNC_ACKNOWLEDGED);
|
|
||||||
#}
|
|
||||||
} else {
|
} else {
|
||||||
$status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Alert');
|
$status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Alert');
|
||||||
$status->setCmdRef($this->_cmdID);
|
$status->setCmdRef($this->_cmdID);
|
||||||
@ -230,46 +263,6 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
|||||||
|
|
||||||
$currentCmdID = $status->output($currentCmdID, $output);
|
$currentCmdID = $status->output($currentCmdID, $output);
|
||||||
}
|
}
|
||||||
/* else
|
|
||||||
{
|
|
||||||
if ($state->isAuthorized()) {
|
|
||||||
$output->startElement($state->getURI(), 'Alert', $attrs);
|
|
||||||
|
|
||||||
$output->startElement($state->getURI(), 'CmdID', $attrs);
|
|
||||||
$chars = $currentCmdID;
|
|
||||||
$output->characters($chars);
|
|
||||||
$output->endElement($state->getURI(), 'CmdID');
|
|
||||||
|
|
||||||
$output->startElement($state->getURI(), 'Data', $attrs);
|
|
||||||
$chars = $this->_alert;
|
|
||||||
$output->characters($chars);
|
|
||||||
$output->endElement($state->getURI(), 'Data');
|
|
||||||
|
|
||||||
$output->startElement($state->getURI(), 'Item', $attrs);
|
|
||||||
|
|
||||||
if ($this->_sourceLocURI != null) {
|
|
||||||
$output->startElement($state->getURI(), 'Target', $attrs);
|
|
||||||
$output->startElement($state->getURI(), 'LocURI', $attrs);
|
|
||||||
$chars = $this->_sourceLocURI;
|
|
||||||
$output->characters($chars);
|
|
||||||
$output->endElement($state->getURI(), 'LocURI');
|
|
||||||
$output->endElement($state->getURI(), 'Target');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->_targetLocURI != null) {
|
|
||||||
$output->startElement($state->getURI(), 'Source', $attrs);
|
|
||||||
$output->startElement($state->getURI(), 'LocURI', $attrs);
|
|
||||||
$chars = (isset($this->_targetLocURIParameters) ? $this->_targetLocURI.'?/'.$this->_targetLocURIParameters : $this->_targetLocURI);
|
|
||||||
$output->characters($chars);
|
|
||||||
$output->endElement($state->getURI(), 'LocURI');
|
|
||||||
$output->endElement($state->getURI(), 'Source');
|
|
||||||
}
|
|
||||||
$output->endElement($state->getURI(), 'Item');
|
|
||||||
$output->endElement($state->getURI(), 'Alert');
|
|
||||||
|
|
||||||
$currentCmdID++;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return $currentCmdID;
|
return $currentCmdID;
|
||||||
}
|
}
|
||||||
@ -338,17 +331,24 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
|||||||
|
|
||||||
$sync->_targetLocURI = $this->_targetLocURI;
|
$sync->_targetLocURI = $this->_targetLocURI;
|
||||||
$sync->_sourceLocURI = $this->_sourceLocURI;
|
$sync->_sourceLocURI = $this->_sourceLocURI;
|
||||||
if(isset($this->_targetLocURIParameters))
|
if(isset($this->_targetLocURIParameters)) {
|
||||||
$sync->_targetLocURIParameters = $this->_targetLocURIParameters;
|
$sync->_targetLocURIParameters = $this->_targetLocURIParameters;
|
||||||
|
}
|
||||||
|
|
||||||
$state->setSync($this->_targetLocURI, $sync);
|
$state->setSync($this->_targetLocURI, $sync);
|
||||||
|
|
||||||
|
if($this->_alert == ALERT_SLOW_SYNC) {
|
||||||
|
$state->removeAllUID($this->_targetLocURI);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if ($element == 'Data') {
|
if ($element == 'Data') {
|
||||||
$this->_alert = intval(trim($this->_chars));
|
$this->_alert = intval(trim($this->_chars));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
@ -360,12 +360,12 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
|||||||
|
|
||||||
$this->_targetLocURI = $targetLocURIData[0];
|
$this->_targetLocURI = $targetLocURIData[0];
|
||||||
|
|
||||||
if(isset($targetLocURIData[1]))
|
if(isset($targetLocURIData[1])) {
|
||||||
{
|
|
||||||
$this->_targetLocURIParameters = $targetLocURIData[1];
|
$this->_targetLocURIParameters = $targetLocURIData[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
@ -374,6 +374,7 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
|||||||
} else if ($element == 'Last') {
|
} else if ($element == 'Last') {
|
||||||
$this->_metaAnchorLast = trim($this->_chars);
|
$this->_metaAnchorLast = trim($this->_chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ class Horde_SyncML_Command_Get extends Horde_SyncML_Command {
|
|||||||
$this->_writeDataStore('./contacts', 'text/x-vcard', '2.1', $output);
|
$this->_writeDataStore('./contacts', 'text/x-vcard', '2.1', $output);
|
||||||
$this->_writeDataStore('./tasks', 'text/x-vcalendar', '1.0', $output);
|
$this->_writeDataStore('./tasks', 'text/x-vcalendar', '1.0', $output);
|
||||||
$this->_writeDataStore('./calendar', 'text/x-vcalendar', '1.0', $output);
|
$this->_writeDataStore('./calendar', 'text/x-vcalendar', '1.0', $output);
|
||||||
|
$this->_writeDataStore('./caltasks', 'text/x-vcalendar', '1.0', $output);
|
||||||
$output->endElement($state->getURIDevInf() , 'DevInf', $attrs);
|
$output->endElement($state->getURIDevInf() , 'DevInf', $attrs);
|
||||||
|
|
||||||
$output->endElement($state->getURI(), 'Data');
|
$output->endElement($state->getURI(), 'Data');
|
||||||
|
@ -42,9 +42,7 @@ class Horde_SyncML_Command_Put extends Horde_SyncML_Command {
|
|||||||
|
|
||||||
var $_softwareVersion;
|
var $_softwareVersion;
|
||||||
|
|
||||||
function endElement($uri, $element)
|
function endElement($uri, $element) {
|
||||||
{
|
|
||||||
#Horde::logMessage('SyncML: put endelement ' . $element . ' stack ' . $this->_xmlStack, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
switch ($this->_xmlStack) {
|
switch ($this->_xmlStack) {
|
||||||
case 5:
|
case 5:
|
||||||
switch($element) {
|
switch($element) {
|
||||||
@ -56,30 +54,51 @@ class Horde_SyncML_Command_Put extends Horde_SyncML_Command {
|
|||||||
'syncCapabilities' => $this->_syncCapabilities,
|
'syncCapabilities' => $this->_syncCapabilities,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'DevID':
|
case 'DevID':
|
||||||
$this->_deviceInfo['deviceID'] = trim($this->_chars);
|
$this->_deviceInfo['deviceID'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'DevTyp':
|
case 'DevTyp':
|
||||||
$this->_deviceInfo['deviceType'] = trim($this->_chars);
|
$this->_deviceInfo['deviceType'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'FwV':
|
||||||
|
$this->_deviceInfo['firmwareVersion'] = trim($this->_chars);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'HwV':
|
||||||
|
$this->_deviceInfo['hardwareVersion'] = trim($this->_chars);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'Man':
|
case 'Man':
|
||||||
$this->_deviceInfo['manufacturer'] = trim($this->_chars);
|
$this->_deviceInfo['manufacturer'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Mod':
|
case 'Mod':
|
||||||
$this->_deviceInfo['model'] = trim($this->_chars);
|
$this->_deviceInfo['model'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'OEM':
|
case 'OEM':
|
||||||
$this->_deviceInfo['oem'] = trim($this->_chars);
|
$this->_deviceInfo['oem'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SwV':
|
case 'SwV':
|
||||||
$this->_deviceInfo['softwareVersion'] = trim($this->_chars);
|
$this->_deviceInfo['softwareVersion'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SupportLargeObjs':
|
case 'SupportLargeObjs':
|
||||||
$this->_deviceInfo['supportLargeObjs'] = true;
|
$this->_deviceInfo['supportLargeObjs'] = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SupportNumberOfChanges':
|
case 'SupportNumberOfChanges':
|
||||||
$this->_deviceInfo['supportNumberOfChanges'] = true;
|
$this->_deviceInfo['supportNumberOfChanges'] = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'UTC':
|
||||||
|
$this->_deviceInfo['UTC'] = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'VerDTD':
|
case 'VerDTD':
|
||||||
$this->_deviceInfo['DTDVersion'] = trim($this->_chars);
|
$this->_deviceInfo['DTDVersion'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
@ -90,15 +109,18 @@ class Horde_SyncML_Command_Put extends Horde_SyncML_Command {
|
|||||||
case 'MaxGUIDSize':
|
case 'MaxGUIDSize':
|
||||||
$this->_maxGUIDSize = trim($this->_chars);
|
$this->_maxGUIDSize = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Rx-Pref':
|
case 'Rx-Pref':
|
||||||
$this->_rxPreference = array(
|
$this->_rxPreference = array(
|
||||||
'contentType' => $this->_contentType,
|
'contentType' => $this->_contentType,
|
||||||
'contentVersion' => $this->_contentVersion,
|
'contentVersion' => $this->_contentVersion,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SourceRef':
|
case 'SourceRef':
|
||||||
$this->_sourceReference = trim($this->_chars);
|
$this->_sourceReference = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Tx-Pref':
|
case 'Tx-Pref':
|
||||||
$this->_txPreference = array(
|
$this->_txPreference = array(
|
||||||
'contentType' => $this->_contentType,
|
'contentType' => $this->_contentType,
|
||||||
@ -107,14 +129,17 @@ class Horde_SyncML_Command_Put extends Horde_SyncML_Command {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
switch($element) {
|
switch($element) {
|
||||||
case 'CTType':
|
case 'CTType':
|
||||||
$this->_contentType = trim($this->_chars);
|
$this->_contentType = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SyncType':
|
case 'SyncType':
|
||||||
$this->_syncCapabilities[] = trim($this->_chars);
|
$this->_syncCapabilities[] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'VerCT':
|
case 'VerCT':
|
||||||
$this->_contentVersion = trim($this->_chars);
|
$this->_contentVersion = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
@ -125,8 +150,7 @@ class Horde_SyncML_Command_Put extends Horde_SyncML_Command {
|
|||||||
parent::endElement($uri, $element);
|
parent::endElement($uri, $element);
|
||||||
}
|
}
|
||||||
|
|
||||||
function output($currentCmdID, &$output )
|
function output($currentCmdID, &$output ) {
|
||||||
{
|
|
||||||
$state = &$_SESSION['SyncML.state'];
|
$state = &$_SESSION['SyncML.state'];
|
||||||
|
|
||||||
$status = &new Horde_SyncML_Command_Status((($state->isAuthorized()) ? RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS), 'Put');
|
$status = &new Horde_SyncML_Command_Status((($state->isAuthorized()) ? RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS), 'Put');
|
||||||
@ -136,10 +160,8 @@ class Horde_SyncML_Command_Put extends Horde_SyncML_Command {
|
|||||||
|
|
||||||
$status->setSourceRef($ref);
|
$status->setSourceRef($ref);
|
||||||
|
|
||||||
if($state->isAuthorized())
|
if($state->isAuthorized()) {
|
||||||
{
|
if(count((array)$this->_deviceInfo) > 0) {
|
||||||
if(count((array)$this->_deviceInfo) > 0)
|
|
||||||
{
|
|
||||||
$state->setClientDeviceInfo($this->_deviceInfo);
|
$state->setClientDeviceInfo($this->_deviceInfo);
|
||||||
$state->writeClientDeviceInfo();
|
$state->writeClientDeviceInfo();
|
||||||
}
|
}
|
||||||
@ -148,9 +170,7 @@ class Horde_SyncML_Command_Put extends Horde_SyncML_Command {
|
|||||||
return $status->output($currentCmdID, $output);
|
return $status->output($currentCmdID, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
function startElement($uri, $element, $attrs)
|
function startElement($uri, $element, $attrs) {
|
||||||
{
|
|
||||||
#Horde::logMessage('SyncML: put startelement ' . $element, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
parent::startElement($uri, $element, $attrs);
|
parent::startElement($uri, $element, $attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
|
|||||||
var $_locSourceURI;
|
var $_locSourceURI;
|
||||||
var $_deviceInfo;
|
var $_deviceInfo;
|
||||||
|
|
||||||
function endElement($uri, $element)
|
function endElement($uri, $element) {
|
||||||
{
|
|
||||||
#Horde::logMessage('SyncML: put endelement ' . $element . ' stack ' . $this->_xmlStack, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
#Horde::logMessage('SyncML: put endelement ' . $element . ' stack ' . $this->_xmlStack, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
|
||||||
switch ($this->_xmlStack) {
|
switch ($this->_xmlStack) {
|
||||||
case 5:
|
case 5:
|
||||||
switch($element) {
|
switch($element) {
|
||||||
@ -38,49 +38,74 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
|
|||||||
'syncCapabilities' => $this->_syncCapabilities,
|
'syncCapabilities' => $this->_syncCapabilities,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'DevID':
|
case 'DevID':
|
||||||
$this->_deviceInfo['deviceID'] = trim($this->_chars);
|
$this->_deviceInfo['deviceID'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'DevTyp':
|
case 'DevTyp':
|
||||||
$this->_deviceInfo['deviceType'] = trim($this->_chars);
|
$this->_deviceInfo['deviceType'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'FwV':
|
||||||
|
$this->_deviceInfo['firmwareVersion'] = trim($this->_chars);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'HwV':
|
||||||
|
$this->_deviceInfo['hardwareVersion'] = trim($this->_chars);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'Man':
|
case 'Man':
|
||||||
$this->_deviceInfo['manufacturer'] = trim($this->_chars);
|
$this->_deviceInfo['manufacturer'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Mod':
|
case 'Mod':
|
||||||
$this->_deviceInfo['model'] = trim($this->_chars);
|
$this->_deviceInfo['model'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'OEM':
|
case 'OEM':
|
||||||
$this->_deviceInfo['oem'] = trim($this->_chars);
|
$this->_deviceInfo['oem'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SwV':
|
case 'SwV':
|
||||||
$this->_deviceInfo['softwareVersion'] = trim($this->_chars);
|
$this->_deviceInfo['softwareVersion'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SupportLargeObjs':
|
case 'SupportLargeObjs':
|
||||||
$this->_deviceInfo['supportLargeObjs'] = true;
|
$this->_deviceInfo['supportLargeObjs'] = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SupportNumberOfChanges':
|
case 'SupportNumberOfChanges':
|
||||||
$this->_deviceInfo['supportNumberOfChanges'] = true;
|
$this->_deviceInfo['supportNumberOfChanges'] = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'UTC':
|
||||||
|
$this->_deviceInfo['UTC'] = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'VerDTD':
|
case 'VerDTD':
|
||||||
$this->_deviceInfo['DTDVersion'] = trim($this->_chars);
|
$this->_deviceInfo['DTDVersion'] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
switch($element) {
|
switch($element) {
|
||||||
case 'MaxGUIDSize':
|
case 'MaxGUIDSize':
|
||||||
$this->_maxGUIDSize = trim($this->_chars);
|
$this->_maxGUIDSize = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Rx-Pref':
|
case 'Rx-Pref':
|
||||||
$this->_rxPreference = array (
|
$this->_rxPreference = array (
|
||||||
'contentType' => $this->_contentType,
|
'contentType' => $this->_contentType,
|
||||||
'contentVersion' => $this->_contentVersion,
|
'contentVersion' => $this->_contentVersion,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SourceRef':
|
case 'SourceRef':
|
||||||
$this->_sourceReference = trim($this->_chars);
|
$this->_sourceReference = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Tx-Pref':
|
case 'Tx-Pref':
|
||||||
$this->_txPreference = array(
|
$this->_txPreference = array(
|
||||||
'contentType' => $this->_contentType,
|
'contentType' => $this->_contentType,
|
||||||
@ -89,14 +114,17 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
switch($element) {
|
switch($element) {
|
||||||
case 'CTType':
|
case 'CTType':
|
||||||
$this->_contentType = trim($this->_chars);
|
$this->_contentType = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SyncType':
|
case 'SyncType':
|
||||||
$this->_syncCapabilities[] = trim($this->_chars);
|
$this->_syncCapabilities[] = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'VerCT':
|
case 'VerCT':
|
||||||
$this->_contentVersion = trim($this->_chars);
|
$this->_contentVersion = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
@ -107,11 +135,9 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
|
|||||||
parent::endElement($uri, $element);
|
parent::endElement($uri, $element);
|
||||||
}
|
}
|
||||||
|
|
||||||
function output($currentCmdID, &$output)
|
function output($currentCmdID, &$output) {
|
||||||
{
|
if(!isset($this->_locSourceURI)) {
|
||||||
if(!isset($this->_locSourceURI))
|
#Horde::logMessage('SyncML: BIG TODO!!!!!!!!!!!!!!!!!! parse reply', __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
{
|
|
||||||
Horde::logMessage('SyncML: BIG TODO!!!!!!!!!!!!!!!!!! parse reply', __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
$state = &$_SESSION['SyncML.state'];
|
$state = &$_SESSION['SyncML.state'];
|
||||||
|
|
||||||
$status = &new Horde_SyncML_Command_Status((($state->isAuthorized()) ? RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS), 'Results');
|
$status = &new Horde_SyncML_Command_Status((($state->isAuthorized()) ? RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS), 'Results');
|
||||||
@ -121,20 +147,16 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
|
|||||||
|
|
||||||
$status->setSourceRef($ref);
|
$status->setSourceRef($ref);
|
||||||
|
|
||||||
if($state->isAuthorized())
|
if($state->isAuthorized()) {
|
||||||
{
|
if(count((array)$this->_deviceInfo) > 0) {
|
||||||
if(count((array)$this->_deviceInfo) > 0)
|
|
||||||
{
|
|
||||||
$state->setClientDeviceInfo($this->_deviceInfo);
|
$state->setClientDeviceInfo($this->_deviceInfo);
|
||||||
$state->writeClientDeviceInfo();
|
$state->writeClientDeviceInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $status->output($currentCmdID, $output);
|
return $status->output($currentCmdID, $output);
|
||||||
}
|
} else {
|
||||||
else
|
#Horde::logMessage('SyncML: BIG TODO!!!!!!!!!!!!!!!!!! generate reponse', __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
{
|
|
||||||
Horde::logMessage('SyncML: BIG TODO!!!!!!!!!!!!!!!!!! generate reponse', __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
$state = $_SESSION['SyncML.state'];
|
$state = $_SESSION['SyncML.state'];
|
||||||
|
|
||||||
$attrs = array();
|
$attrs = array();
|
||||||
@ -191,8 +213,7 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
|
|||||||
*
|
*
|
||||||
* @param string $cmdRef New value of property cmdRef.
|
* @param string $cmdRef New value of property cmdRef.
|
||||||
*/
|
*/
|
||||||
function setCmdRef($cmdRef)
|
function setCmdRef($cmdRef) {
|
||||||
{
|
|
||||||
$this->_cmdRef = $cmdRef;
|
$this->_cmdRef = $cmdRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,8 +222,7 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
|
|||||||
*
|
*
|
||||||
* @param string $type New value of property type.
|
* @param string $type New value of property type.
|
||||||
*/
|
*/
|
||||||
function setType($type)
|
function setType($type) {
|
||||||
{
|
|
||||||
$this->_type = $type;
|
$this->_type = $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,8 +231,7 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
|
|||||||
*
|
*
|
||||||
* @param string $data New value of property data.
|
* @param string $data New value of property data.
|
||||||
*/
|
*/
|
||||||
function setData($data)
|
function setData($data) {
|
||||||
{
|
|
||||||
$this->_data = $data;
|
$this->_data = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,9 +240,7 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
|
|||||||
*
|
*
|
||||||
* @param string $locSourceURI New value of property locSourceURI.
|
* @param string $locSourceURI New value of property locSourceURI.
|
||||||
*/
|
*/
|
||||||
function setlocSourceURI($locSourceURI)
|
function setlocSourceURI($locSourceURI) {
|
||||||
{
|
|
||||||
$this->_locSourceURI = $locSourceURI;
|
$this->_locSourceURI = $locSourceURI;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -200,6 +200,9 @@ class Horde_SyncML_State {
|
|||||||
// stores if we received Alert 222 already
|
// stores if we received Alert 222 already
|
||||||
var $_receivedAlert222 = false;
|
var $_receivedAlert222 = false;
|
||||||
|
|
||||||
|
// stores if we already requested the deviceinfo
|
||||||
|
var $_devinfoRequested = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of Horde_SyncML_State.
|
* Creates a new instance of Horde_SyncML_State.
|
||||||
*/
|
*/
|
||||||
@ -625,20 +628,11 @@ class Horde_SyncML_State {
|
|||||||
return $guid;
|
return $guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function should use DevINF information.
|
* This function should use DevINF information.
|
||||||
*/
|
*/
|
||||||
function getPreferedContentType($type)
|
function getPreferedContentType($type) {
|
||||||
{
|
|
||||||
# if ($type == 'contacts') {
|
|
||||||
# return 'text/x-vcard';
|
|
||||||
# } elseif ($type == 'notes') {
|
|
||||||
# return 'text/x-vnote';
|
|
||||||
# } elseif ($type == 'tasks') {
|
|
||||||
# return 'text/x-vcalendar';
|
|
||||||
# } elseif ($type == 'calendar') {
|
|
||||||
# return 'text/x-vcalendar';
|
|
||||||
# }
|
|
||||||
switch($type) {
|
switch($type) {
|
||||||
case 'contacts':
|
case 'contacts':
|
||||||
case './contacts':
|
case './contacts':
|
||||||
@ -681,30 +675,17 @@ class Horde_SyncML_State {
|
|||||||
*
|
*
|
||||||
* This is passed as an option to the Horde API export functions.
|
* This is passed as an option to the Horde API export functions.
|
||||||
*/
|
*/
|
||||||
function getPreferedContentTypeClient($_sourceLocURI)
|
|
||||||
{
|
function getPreferedContentTypeClient($_sourceLocURI) {
|
||||||
$deviceInfo = $this->getClientDeviceInfo();
|
$deviceInfo = $this->getClientDeviceInfo();
|
||||||
|
|
||||||
if(isset($deviceInfo['dataStore'][$_sourceLocURI]['rxPreference']['contentType']))
|
if(isset($deviceInfo['dataStore'][$_sourceLocURI]['rxPreference']['contentType'])) {
|
||||||
{
|
|
||||||
return array('ContentType' => $deviceInfo['dataStore'][$_sourceLocURI]['rxPreference']['contentType']);
|
return array('ContentType' => $deviceInfo['dataStore'][$_sourceLocURI]['rxPreference']['contentType']);
|
||||||
}
|
}
|
||||||
|
|
||||||
Horde::logMessage('SyncML: sourceLocURI ' . $_sourceLocURI .' not found', __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
Horde::logMessage('SyncML: sourceLocURI ' . $_sourceLocURI .' not found', __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
|
||||||
return PEAR::raiseError(_('sourceLocURI not found'));
|
return PEAR::raiseError(_('sourceLocURI not found'));
|
||||||
# elseif ($type == 'contacts') {
|
|
||||||
# return 'text/x-vcard';
|
|
||||||
# } elseif ($type == 'notes') {
|
|
||||||
# return array('ContentType' => 'text/x-vnote',
|
|
||||||
# 'ENCODING' => 'QUOTED-PRINTABLE',
|
|
||||||
# 'CHARSET' => 'UTF-8');
|
|
||||||
# } elseif ($type == 'tasks') {
|
|
||||||
# return 'text/x-vcalendar';
|
|
||||||
# } elseif ($type == 'calendar') {
|
|
||||||
# return array('ContentType' => 'text/x-vcalendar',
|
|
||||||
# 'ENCODING' => 'QUOTED-PRINTABLE',
|
|
||||||
# 'CHARSET' => 'UTF-8');
|
|
||||||
# }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setClientAnchorNext($type, $a)
|
function setClientAnchorNext($type, $a)
|
||||||
|
@ -43,51 +43,63 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
*
|
*
|
||||||
* a array containing all available infos about the device
|
* a array containing all available infos about the device
|
||||||
*/
|
*/
|
||||||
function getClientDeviceInfo()
|
function getClientDeviceInfo() {
|
||||||
{
|
|
||||||
$deviceID = $this->_locName . $this->_sourceURI;
|
|
||||||
|
|
||||||
$db = clone($GLOBALS['egw']->db);
|
$db = clone($GLOBALS['egw']->db);
|
||||||
|
|
||||||
$cols = array
|
$cols = array(
|
||||||
(
|
'owner_devid',
|
||||||
|
);
|
||||||
|
|
||||||
|
$where = array (
|
||||||
|
'owner_locname' => $this->_locName,
|
||||||
|
'owner_deviceid' => $this->_sourceURI,
|
||||||
|
);
|
||||||
|
|
||||||
|
$db->select('egw_syncmldeviceowner', $cols, $where, __LINE__, __FILE__);
|
||||||
|
|
||||||
|
if($db->next_record()) {
|
||||||
|
$deviceID = $db->f('owner_devid');
|
||||||
|
|
||||||
|
$cols = array(
|
||||||
'dev_dtdversion',
|
'dev_dtdversion',
|
||||||
'dev_numberofchanges',
|
'dev_numberofchanges',
|
||||||
'dev_largeobjs',
|
'dev_largeobjs',
|
||||||
'dev_swversion',
|
'dev_swversion',
|
||||||
|
'dev_fwversion',
|
||||||
|
'dev_hwversion',
|
||||||
'dev_oem',
|
'dev_oem',
|
||||||
'dev_model',
|
'dev_model',
|
||||||
'dev_manufacturer',
|
'dev_manufacturer',
|
||||||
'dev_devicetype',
|
'dev_devicetype',
|
||||||
'dev_deviceid',
|
|
||||||
'dev_datastore',
|
'dev_datastore',
|
||||||
|
'dev_utc',
|
||||||
);
|
);
|
||||||
|
|
||||||
$where = array
|
$where = array(
|
||||||
(
|
|
||||||
'dev_id' => $deviceID,
|
'dev_id' => $deviceID,
|
||||||
);
|
);
|
||||||
|
|
||||||
$db->select('egw_syncmldevinfo', $cols, $where, __LINE__, __FILE__);
|
$db->select('egw_syncmldevinfo', $cols, $where, __LINE__, __FILE__);
|
||||||
|
|
||||||
if($db->next_record())
|
if($db->next_record()) {
|
||||||
{
|
$devInfo = array (
|
||||||
$devInfo = array
|
|
||||||
(
|
|
||||||
'DTDVersion' => $db->f('dev_dtdversion'),
|
'DTDVersion' => $db->f('dev_dtdversion'),
|
||||||
'supportNumberOfChanges' => $db->f('dev_numberofchanges'),
|
'supportNumberOfChanges' => $db->f('dev_numberofchanges'),
|
||||||
'supportLargeObjs' => $db->f('dev_largeobjs'),
|
'supportLargeObjs' => $db->f('dev_largeobjs'),
|
||||||
|
'UTC' => $db->f('dev_utc'),
|
||||||
'softwareVersion' => $db->f('dev_swversion'),
|
'softwareVersion' => $db->f('dev_swversion'),
|
||||||
|
'hardwareVersion' => $db->f('dev_hwversion'),
|
||||||
|
'firmwareVersion' => $db->f('dev_fwversion'),
|
||||||
'oem' => $db->f('dev_oem'),
|
'oem' => $db->f('dev_oem'),
|
||||||
'model' => $db->f('dev_model'),
|
'model' => $db->f('dev_model'),
|
||||||
'manufacturer' => $db->f('dev_manufacturer'),
|
'manufacturer' => $db->f('dev_manufacturer'),
|
||||||
'deviceType' => $db->f('dev_devicetype'),
|
'deviceType' => $db->f('dev_devicetype'),
|
||||||
'deviceID' => $db->f('dev_deviceid'),
|
|
||||||
'dataStore' => unserialize($db->f('dev_datastore')),
|
'dataStore' => unserialize($db->f('dev_datastore')),
|
||||||
);
|
);
|
||||||
|
|
||||||
return $devInfo;
|
return $devInfo;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -243,6 +255,29 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
return $this->_isAuthorized;
|
return $this->_isAuthorized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all locid<->guid mappings for the given type.
|
||||||
|
* Returns always true.
|
||||||
|
*/
|
||||||
|
function removeAllUID($type)
|
||||||
|
{
|
||||||
|
$mapID = $this->_locName . $this->_sourceURI . $type;
|
||||||
|
|
||||||
|
$db = clone($GLOBALS['egw']->db);
|
||||||
|
|
||||||
|
$cols = array('map_guid');
|
||||||
|
|
||||||
|
$where = array (
|
||||||
|
'map_id' => $mapID
|
||||||
|
);
|
||||||
|
|
||||||
|
Horde::logMessage("SyncML: state->removeAllUID(type=$type)", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
|
||||||
|
$db->delete('egw_contentmap', $where, __LINE__, __FILE__);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the locid<->guid mapping for the given locid. Returns
|
* Removes the locid<->guid mapping for the given locid. Returns
|
||||||
* the guid that was removed or false if no mapping entry was
|
* the guid that was removed or false if no mapping entry was
|
||||||
@ -256,23 +291,21 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
|
|
||||||
$cols = array('map_guid');
|
$cols = array('map_guid');
|
||||||
|
|
||||||
$where = array
|
$where = array (
|
||||||
(
|
|
||||||
'map_id' => $mapID,
|
'map_id' => $mapID,
|
||||||
'map_locuid' => $locid
|
'map_locuid' => $locid
|
||||||
);
|
);
|
||||||
|
|
||||||
$db->select('egw_contentmap', $cols, $where, __LINE__, __FILE__);
|
$db->select('egw_contentmap', $cols, $where, __LINE__, __FILE__);
|
||||||
|
|
||||||
if(!$db->next_record())
|
if(!$db->next_record()) {
|
||||||
{
|
Horde::logMessage("SyncML: state->removeUID(type=$type,locid=$locid) : nothing to remove", __FILE__, __LINE__, PEAR_LOG_INFO);
|
||||||
Horde::logMessage("SyncML: state->removeUID(type=$type,locid=$locid) : nothing to remove", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$guid = $db->f('map_guid');
|
$guid = $db->f('map_guid');
|
||||||
|
|
||||||
#Horde::logMessage("SyncML: state->removeUID(type=$type,locid=$locid) : removing guid:$guid", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
Horde::logMessage("SyncML: state->removeUID(type=$type,locid=$locid) : removing guid:$guid", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
|
||||||
$db->delete('egw_contentmap', $where, __LINE__, __FILE__);
|
$db->delete('egw_contentmap', $where, __LINE__, __FILE__);
|
||||||
|
|
||||||
@ -335,37 +368,70 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* write clients device info to database
|
* writes clients deviceinfo into database
|
||||||
*/
|
*/
|
||||||
function writeClientDeviceInfo()
|
function writeClientDeviceInfo() {
|
||||||
{
|
|
||||||
if (!isset($this->_clientDeviceInfo) || !is_array($this->_clientDeviceInfo)) {
|
if (!isset($this->_clientDeviceInfo) || !is_array($this->_clientDeviceInfo)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$deviceID = $this->_locName . $this->_sourceURI;
|
$db = clone($GLOBALS['egw']->db);
|
||||||
|
|
||||||
$data = array
|
$cols = array(
|
||||||
(
|
'dev_id',
|
||||||
'dev_id' => $deviceID,
|
);
|
||||||
|
|
||||||
|
$softwareVersion = !empty($this->_clientDeviceInfo['softwareVersion']) ? $this->_clientDeviceInfo['softwareVersion'] : '';
|
||||||
|
$hardwareVersion = !empty($this->_clientDeviceInfo['hardwareVersion']) ? $this->_clientDeviceInfo['hardwareVersion'] : '';
|
||||||
|
$firmwareVersion = !empty($this->_clientDeviceInfo['firmwareVersion']) ? $this->_clientDeviceInfo['firmwareVersion'] : '';
|
||||||
|
|
||||||
|
$where = array (
|
||||||
|
'dev_model' => $this->_clientDeviceInfo['model'],
|
||||||
|
'dev_manufacturer' => $this->_clientDeviceInfo['manufacturer'],
|
||||||
|
'dev_swversion' => $softwareVersion,
|
||||||
|
'dev_hwversion' => $hardwareVersion,
|
||||||
|
'dev_fwversion' => $firmwareVersion,
|
||||||
|
);
|
||||||
|
|
||||||
|
$db->select('egw_syncmldevinfo', $cols, $where, __LINE__, __FILE__);
|
||||||
|
|
||||||
|
if($db->next_record()) {
|
||||||
|
$deviceID = $db->f('dev_id');
|
||||||
|
|
||||||
|
$data = array (
|
||||||
|
'dev_datastore' => serialize($this->_clientDeviceInfo['dataStore']),
|
||||||
|
);
|
||||||
|
|
||||||
|
$db->update('egw_syncmldevinfo', $data, $where, __LINE__, __FILE__);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$data = array (
|
||||||
'dev_dtdversion' => $this->_clientDeviceInfo['DTDVersion'],
|
'dev_dtdversion' => $this->_clientDeviceInfo['DTDVersion'],
|
||||||
'dev_numberofchanges' => $this->_clientDeviceInfo['supportNumberOfChanges'],
|
'dev_numberofchanges' => $this->_clientDeviceInfo['supportNumberOfChanges'] ? true : false,
|
||||||
'dev_largeobjs' => $this->_clientDeviceInfo['supportLargeObjs'],
|
'dev_largeobjs' => $this->_clientDeviceInfo['supportLargeObjs'] ? true : false,
|
||||||
'dev_swversion' => $this->_clientDeviceInfo['softwareVersion'],
|
'dev_utc' => $this->_clientDeviceInfo['UTC'] ? true : false,
|
||||||
|
'dev_swversion' => $softwareVersion,
|
||||||
|
'dev_hwversion' => $hardwareVersion,
|
||||||
|
'dev_fwversion' => $firmwareVersion,
|
||||||
'dev_oem' => $this->_clientDeviceInfo['oem'],
|
'dev_oem' => $this->_clientDeviceInfo['oem'],
|
||||||
'dev_model' => $this->_clientDeviceInfo['model'],
|
'dev_model' => $this->_clientDeviceInfo['model'],
|
||||||
'dev_manufacturer' => $this->_clientDeviceInfo['manufacturer'],
|
'dev_manufacturer' => $this->_clientDeviceInfo['manufacturer'],
|
||||||
'dev_devicetype' => $this->_clientDeviceInfo['deviceType'],
|
'dev_devicetype' => $this->_clientDeviceInfo['deviceType'],
|
||||||
'dev_deviceid' => $this->_clientDeviceInfo['deviceID'],
|
|
||||||
'dev_datastore' => serialize($this->_clientDeviceInfo['dataStore']),
|
'dev_datastore' => serialize($this->_clientDeviceInfo['dataStore']),
|
||||||
);
|
);
|
||||||
|
|
||||||
$where = array
|
$db->insert('egw_syncmldevinfo', $data, $where, __LINE__, __FILE__);
|
||||||
(
|
|
||||||
'dev_id' => $deviceID,
|
$deviceID = $db->get_last_insert_id('egw_syncmldevinfo', 'dev_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
$where = $data = array (
|
||||||
|
'owner_locname' => $this->_locName,
|
||||||
|
'owner_deviceid' => $this->_sourceURI,
|
||||||
|
'owner_devid' => $deviceID,
|
||||||
);
|
);
|
||||||
|
|
||||||
$GLOBALS['egw']->db->insert('egw_syncmldevinfo', $data, $where, __LINE__, __FILE__);
|
$db->insert('egw_syncmldeviceowner', $data, $where, __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,23 +33,11 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
|
|
||||||
if(is_array($adds)) {
|
if(is_array($adds)) {
|
||||||
while($guid = array_shift($adds)) {
|
while($guid = array_shift($adds)) {
|
||||||
#$guid_ts = max($history->getTSforAction($guid, 'add'),$history->getTSforAction($guid, 'modify'));
|
if ($locID = $state->getLocID($syncType, $guid)) {
|
||||||
$sync_ts = $state->getChangeTS($syncType, $guid);
|
Horde::logMessage("SyncML: slowsync add to client: $guid ignored, already at client($locID)", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
#Horde::logMessage("SyncML: slowsync timestamp add: $guid sync_ts: $sync_ts anchorNext: ". $serverAnchorNext.' / '.time(), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
// $sync_ts it got synced from client to server someone
|
|
||||||
// $sync_ts >= $serverAnchorNext it got synced from client to server in this sync package already
|
|
||||||
if ($sync_ts && $sync_ts >= $serverAnchorNext) {
|
|
||||||
// Change was done by us upon request of client.
|
|
||||||
// Don't mirror that back to the client.
|
|
||||||
//Horde::logMessage("SyncML: slowsync add: $guid ignored, came from client", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#$locid = $state->getLocID($syncType, $guid);
|
|
||||||
|
|
||||||
// Create an Add request for client.
|
|
||||||
# LK $contentType = $state->getPreferedContentTypeClient($syncType);
|
|
||||||
|
|
||||||
$contentType = $state->getPreferedContentTypeClient($this->_sourceLocURI);
|
$contentType = $state->getPreferedContentTypeClient($this->_sourceLocURI);
|
||||||
if(is_a($contentType, 'PEAR_Error')) {
|
if(is_a($contentType, 'PEAR_Error')) {
|
||||||
// Client did not sent devinfo
|
// Client did not sent devinfo
|
||||||
@ -60,9 +48,6 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
$c = $registry->call($hordeType . '/export', array('guid' => $guid, 'contentType' => $contentType));
|
$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 to client $c", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
if (!is_a($c, 'PEAR_Error')) {
|
if (!is_a($c, 'PEAR_Error')) {
|
||||||
// Item in history but not in database. Strange, but
|
|
||||||
// can happen.
|
|
||||||
#LK $cmd->setContent($state->convertServer2Client($c, $contentType));
|
|
||||||
$cmd->setContent($c);
|
$cmd->setContent($c);
|
||||||
if($hordeType == 'sifcalendar' || $hordeType == 'sifcontacts' || $hordeType == 'siftasks') {
|
if($hordeType == 'sifcalendar' || $hordeType == 'sifcontacts' || $hordeType == 'siftasks') {
|
||||||
$cmd->setContentFormat('b64');
|
$cmd->setContentFormat('b64');
|
||||||
@ -74,7 +59,6 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
$state->log('Server-Add');
|
$state->log('Server-Add');
|
||||||
|
|
||||||
// return if we have to much data
|
// return if we have to much data
|
||||||
#Horde::logMessage("SyncML: ".' checking hordetype '.$hordeType , __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
if(++$counter >= MAX_ENTRIES && $hordeType != 'sifcalendar' && $hordeType != 'sifcontacts' && $hordeType != 'siftasks') {
|
if(++$counter >= MAX_ENTRIES && $hordeType != 'sifcalendar' && $hordeType != 'sifcontacts' && $hordeType != 'siftasks') {
|
||||||
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
||||||
return $currentCmdID;
|
return $currentCmdID;
|
||||||
@ -161,44 +145,17 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$guid = false;
|
$guid = false;
|
||||||
# if (is_a($command, 'Horde_SyncML_Command_Sync_Add')) {
|
|
||||||
# $guid = $registry->call($hordeType . '/import',
|
|
||||||
# array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType));
|
|
||||||
# if (!is_a($guid, 'PEAR_Error')) {
|
|
||||||
# $ts = $history->getTSforAction($guid, 'add');
|
|
||||||
# $state->setUID($type, $syncItem->getLocURI(), $guid, $ts);
|
|
||||||
# $state->log("Client-Add");
|
|
||||||
# #Horde::logMessage('SyncML: added client entry as ' . $guid, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
# } else {
|
|
||||||
# $state->log("Client-AddFailure");
|
|
||||||
# Horde::logMessage('SyncML: Error in adding client entry:' . $guid->message, __FILE__, __LINE__, PEAR_LOG_ERR);
|
|
||||||
# }
|
|
||||||
# } elseif (is_a($command, 'Horde_SyncML_Command_Sync_Replace')) {
|
|
||||||
#$guid = $state->getGlobalUID($type, $syncItem->getLocURI());
|
|
||||||
$guid = $registry->call($hordeType . '/search',
|
$guid = $registry->call($hordeType . '/search',
|
||||||
array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType));
|
array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType));
|
||||||
Horde::logMessage('SyncML: found guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
$ok = false;
|
|
||||||
if ($guid) {
|
|
||||||
#Horde::logMessage('SyncML: locuri'. $syncItem->getLocURI() . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_ERR);
|
|
||||||
// Entry exists: replace current one.
|
|
||||||
$ok = $registry->call($hordeType . '/replace',
|
|
||||||
array($guid, $state->convertClient2Server($syncItem->getContent(), $contentType), $contentType));
|
|
||||||
if (!is_a($ok, 'PEAR_Error')) {
|
|
||||||
$ts = $history->getTSforAction($guid, 'modify');
|
|
||||||
$state->setUID($type, $syncItem->getLocURI(), $guid, $ts);
|
|
||||||
#Horde::logMessage('SyncML: replaced entry due to client request guid: '. $guid .' LocURI: '. $syncItem->getLocURI() .' ts: '. $ts, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
$state->log("Client-Replace");
|
|
||||||
$ok = true;
|
|
||||||
} else {
|
|
||||||
// Entry may have been deleted; try adding it.
|
|
||||||
$ok = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$ok) {
|
if ($guid) {
|
||||||
// Entry does not exist in map or database: add a new
|
# entry exists in database already. Just update the mapping
|
||||||
// one.
|
Horde::logMessage('SyncML: adding mapping for locuri:'. $syncItem->getLocURI() . ' and guid:' . $guid , __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
$state->setUID($type, $syncItem->getLocURI(), $guid, mktime());
|
||||||
|
$state->log("Client-Replace");
|
||||||
|
} else {
|
||||||
|
# Entry does not exist in database: add a new one.
|
||||||
Horde::logMessage('SyncML: try to add contentype ' . $contentType .' to '. $hordeType, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
Horde::logMessage('SyncML: try to add contentype ' . $contentType .' to '. $hordeType, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
$guid = $registry->call($hordeType . '/import',
|
$guid = $registry->call($hordeType . '/import',
|
||||||
array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType));
|
array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType));
|
||||||
@ -212,7 +169,6 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
$state->log("Client-AddFailure");
|
$state->log("Client-AddFailure");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,6 +19,7 @@ include_once 'Horde/SyncML/Command/Sync/ContentSyncElement.php';
|
|||||||
* @package Horde_SyncML
|
* @package Horde_SyncML
|
||||||
*/
|
*/
|
||||||
class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
||||||
|
|
||||||
function endSync($currentCmdID, &$output) {
|
function endSync($currentCmdID, &$output) {
|
||||||
global $registry;
|
global $registry;
|
||||||
|
|
||||||
@ -35,12 +36,12 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
|||||||
$output,
|
$output,
|
||||||
$refts);
|
$refts);
|
||||||
|
|
||||||
if ($syncType == 'calendar' && $state->handleTasksInCalendar()) {
|
#if ($syncType == 'calendar' && $state->handleTasksInCalendar()) {
|
||||||
Horde::logMessage("SyncML: handling tasks in calendar sync", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
# Horde::logMessage("SyncML: handling tasks in calendar sync", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
#
|
||||||
$currentCmdID = $this->handleSync($currentCmdID, 'tasks', $syncType,
|
# $currentCmdID = $this->handleSync($currentCmdID, 'tasks', $syncType,
|
||||||
$output, $refts);
|
# $output, $refts);
|
||||||
}
|
#}
|
||||||
|
|
||||||
return $currentCmdID;
|
return $currentCmdID;
|
||||||
}
|
}
|
||||||
@ -219,15 +220,14 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Horde::logMessage("SyncML: handling sync ".$currentCmdID, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
#Horde::logMessage("SyncML: handling sync ".$currentCmdID, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
|
||||||
$state->clearSync($syncType);
|
$state->clearSync($syncType);
|
||||||
|
|
||||||
return $currentCmdID;
|
return $currentCmdID;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadData()
|
function loadData() {
|
||||||
{
|
|
||||||
global $registry;
|
global $registry;
|
||||||
|
|
||||||
$state = &$_SESSION['SyncML.state'];
|
$state = &$_SESSION['SyncML.state'];
|
||||||
@ -250,5 +250,4 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
|||||||
count($state->getDeletedItems($hordeType)) +
|
count($state->getDeletedItems($hordeType)) +
|
||||||
count($state->getAddedItems($hordeType));
|
count($state->getAddedItems($hordeType));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user