different SyncML fixes

This commit is contained in:
Lars Kneschke 2006-01-16 09:49:51 +00:00
parent 17219eac09
commit 735dcde161
4 changed files with 18 additions and 71 deletions

View File

@ -571,6 +571,9 @@ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler {
$this->_output->startElement($state->getURI(), 'Meta', $attrs);
$this->_output->startElement($state->getURIMeta(), 'Type', $attrs);
if(is_a($this->_output, 'XML_WBXML_Encoder'))
$this->_output->characters('application/vnd.syncml-devinf+wbxml');
else
$this->_output->characters('application/vnd.syncml-devinf+xml');
$this->_output->endElement($state->getURIMeta(), 'Type');
$this->_output->endElement($state->getURI(), 'Meta');

View File

@ -5,6 +5,7 @@ include_once 'Horde/SyncML/Command.php';
include_once 'Horde/SyncML/Command/Sync/SyncElement.php';
include_once 'Horde/SyncML/Sync/TwoWaySync.php';
include_once 'Horde/SyncML/Sync/SlowSync.php';
include_once 'Horde/SyncML/Sync/OneWayFromServerSync.php';
/**
* $Horde: framework/SyncML/SyncML/Command/Sync.php,v 1.17 2004/07/03 15:21:14 chuck Exp $

View File

@ -47,7 +47,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
{
$deviceID = $this->_locName . $this->_sourceURI;
$db = clone($GLOBALS['phpgw']->db);
$db = clone($GLOBALS['egw']->db);
$cols = array
(
@ -105,7 +105,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
Horde::logMessage('SyncML: search GlobalUID for ' . $mapID .' / '.$locid, __FILE__, __LINE__, PEAR_LOG_DEBUG);
$db = clone($GLOBALS['phpgw']->db);
$db = clone($GLOBALS['egw']->db);
$cols = array('map_guid');
@ -136,7 +136,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
{
$mapID = $this->_locName . $this->_sourceURI . $type;
$db = clone($GLOBALS['phpgw']->db);
$db = clone($GLOBALS['egw']->db);
$cols = array('map_locuid');
@ -168,7 +168,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
{
$deviceID = $this->_locName . $this->_sourceURI;
$db = clone($GLOBALS['phpgw']->db);
$db = clone($GLOBALS['egw']->db);
$cols = array('sync_serverts','sync_clientts');
@ -213,7 +213,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
Horde::logMessage('SyncML: Authenticate ' . $this->_locName . ' - ' . $this->_password, __FILE__, __LINE__, PEAR_LOG_DEBUG);
if($GLOBALS['sessionid'] = $GLOBALS['phpgw']->session->create($this->_locName,$this->_password,'text','u'))
if($GLOBALS['sessionid'] = $GLOBALS['egw']->session->create($this->_locName,$this->_password,'text','u'))
{
$this->_isAuthorized = true;
Horde::logMessage('SyncML_EGW: Authentication of ' . $this->_locName . '/' . $GLOBALS['sessionid'] . ' succeded' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
@ -228,7 +228,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
{
// store sessionID in a variable, because ->verify maybe resets that value
$sessionID = session_id();
if(!$GLOBALS['phpgw']->session->verify($sessionID, 'staticsyncmlkp3'))
if(!$GLOBALS['egw']->session->verify($sessionID, 'staticsyncmlkp3'))
Horde::logMessage('SyncML_EGW: egw session('.$sessionID.') not verified ' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
}
@ -244,7 +244,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
{
$mapID = $this->_locName . $this->_sourceURI . $type;
$db = clone($GLOBALS['phpgw']->db);
$db = clone($GLOBALS['egw']->db);
$cols = array('map_guid');
@ -287,7 +287,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
$guidParts = explode('-',$guid);
if(count($guidParts) == 3)
{
$guid = $GLOBALS['phpgw']->common->generate_uid($guidParts[0],$guidParts[1]);
$guid = $GLOBALS['egw']->common->generate_uid($guidParts[0],$guidParts[1]);
}
if($ts == 0)
@ -297,7 +297,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
Horde::logMessage("SyncML: setUID $type, $locid, $guid, $ts ".count($guidParts), __FILE__, __LINE__, PEAR_LOG_DEBUG);
$db = clone($GLOBALS['phpgw']->db);
$db = clone($GLOBALS['egw']->db);
$mapID = $this->_locName . $this->_sourceURI . $type;
@ -349,7 +349,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
'dev_id' => $deviceID,
);
$GLOBALS['phpgw']->db->insert('egw_syncmldevinfo',$data,$where);
$GLOBALS['egw']->db->insert('egw_syncmldevinfo', $data, $where, __LINE__, __FILE__);
}
/**
@ -383,7 +383,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
'sync_clientts' => $this->_clientAnchorNext[$type]
);
$GLOBALS['phpgw']->db->insert('egw_syncmlsummary', $data, $where, __LINE__, __FILE__);
$GLOBALS['egw']->db->insert('egw_syncmlsummary', $data, $where, __LINE__, __FILE__);
}
}

View File

@ -1,6 +1,6 @@
<?php
include_once 'Horde/SyncML/Sync.php';
include_once 'Horde/SyncML/Sync/TwoWaySync.php';
/**
* Will run normal $end from TwoWaySync, the client should not send
@ -18,62 +18,5 @@ include_once 'Horde/SyncML/Sync.php';
* @since Horde 3.0
* @package Horde_SyncML
*/
class Horde_SyncML_Sync_OneWayFromServerSync extends Horde_SyncML_Sync {
function endSync($currentCmdID, &$output)
{
global $registry;
$state = &$_SESSION['SyncML.state'];
// counter for synced items
$syncItems = 0;
$syncType = $this->_targetLocURI;
$hordeType = str_replace('./','',$syncType);
if(!$adds = &$state->getAddedItems($hordeType))
{
Horde::logMessage("SyncML: reading list of added items", __FILE__, __LINE__, PEAR_LOG_DEBUG);
$adds = $registry->call($hordeType, '/list', array());
$adds = &$state->getAddedItems($hordeType);
}
Horde::logMessage("SyncML: ....... ".count($adds).' items to send ..............', __FILE__, __LINE__, PEAR_LOG_DEBUG);
Horde::logMessage("SyncML: starting OneWayFromServerSync ($hordeType)", __FILE__, __LINE__, PEAR_LOG_DEBUG);
#foreach ($adds as $guid) {
while($guid = array_shift($adds))
{
$contentType = $state->getPreferedContentTypeClient($this->_sourceLocURI);
$cmd = &new Horde_SyncML_Command_Sync_ContentSyncElement();
$c = $registry->call($hordeType . '/export',
array('guid' => $guid,
'contentType' => $contentType
)
);
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->setContentType($contentType['ContentType']);
$cmd->setSourceURI($guid);
$currentCmdID = $cmd->outputCommand($currentCmdID, $output, 'Add');
$state->log('Server-Add');
$syncItems++;
// return if we have to much data
if($syncItems >= MAX_ENTRIES)
{
$state->setMoreDataPending();
return $currentCmdID;
}
}
}
Horde::logMessage("SyncML: handling OneWayFromServerSync done ".$currentCmdID, __FILE__, __LINE__, PEAR_LOG_DEBUG);
return $currentCmdID;
}
class Horde_SyncML_Sync_OneWayFromServerSync extends Horde_SyncML_Sync_TwoWaySync {
}