various small bugfixes

This commit is contained in:
Lars Kneschke 2006-04-07 08:11:17 +00:00
parent 8941ccbc23
commit ea7b5a8afa
8 changed files with 31 additions and 33 deletions

View File

@ -157,7 +157,7 @@ class Horde_SyncML_SyncMLHdr extends Horde_SyncML_ContentHandler {
// has been authorized. Make sure we have a valid session id.
if(!empty($_GET['syncml_sessionid'])) {
session_id($_GET['syncml_sessionid']);
Horde::logMessage('SyncML['. session_id() .']: reusing existing session', __FILE__, __LINE__, PEAR_LOG_INFO);
Horde::logMessage('SyncML['. session_id() .']: reusing existing session', __FILE__, __LINE__, PEAR_LOG_DEBUG);
} else {
#session_id('syncml' . preg_replace('/[^a-zA-Z0-9]/', '', $sourceURI . $sessionID));
session_id('syncml-' . md5(uniqid(rand(), true)));
@ -527,7 +527,6 @@ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler {
// we do still have some data to send OR
// we should reply to the Sync command
if($state->getSyncStatus() >= CLIENT_SYNC_ACKNOWLEDGED && $state->getSyncStatus() < SERVER_SYNC_FINNISHED) {
Horde::logMessage('SyncML sending syncdata to client '. CLIENT_SYNC_ACKNOWLEDGED .'/'. SERVER_SYNC_FINNISHED .'/'. $state->getSyncStatus(), __FILE__, __LINE__, PEAR_LOG_INFO);
$sync = &new Horde_SyncML_Command_Sync();
$this->_currentCmdID = $sync->syncToClient($this->_currentCmdID, $this->_output);
}

View File

@ -51,7 +51,6 @@ class Horde_SyncML_Command_Sync extends Horde_Syncml_Command {
$currentCmdID = $status->output($currentCmdID, $output);
if($sync = $state->getSync($this->_targetURI)) {
Horde::logMessage('SyncML: starting from client for $this->_targetURI = ' . $this->_targetURI, __FILE__, __LINE__, PEAR_LOG_DEBUG);
$currentCmdID = $sync->startSync($currentCmdID, $output);
foreach ($this->_syncElements as $element) {

View File

@ -630,16 +630,20 @@ class Horde_SyncML_State {
*/
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) {
case 'contacts':
return 'text/x-vcard';
break;
case 'sifcalendar':
case './sifcalendar':
return 'text/x-s4j-sife';
break;
case 'sifcontacts':
case './sifcontacts':
return 'text/x-s4j-sifc';

View File

@ -203,34 +203,41 @@ class EGW_SyncML_State extends Horde_SyncML_State
if(!isset($this->_locName) && !isset($this->_password))
{
Horde::logMessage('SyncML: Authentication not possible currently. No username and password available' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
Horde::logMessage('SyncML: Authentication not yet possible currently. Username and password not available' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
return FALSE;
}
if(!isset($this->_password))
{
Horde::logMessage('SyncML: Authentication not yet possible currently. Password not available' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
return FALSE;
}
if(strstr($this->_locName,'@') === False)
{
$this->_locName .= '@'.$GLOBALS['phpgw_info']['server']['default_domain'];
$this->_locName .= '@'.$GLOBALS['egw_info']['server']['default_domain'];
}
#Horde::logMessage('SyncML: Authenticate ' . $this->_locName . ' - ' . $this->_password, __FILE__, __LINE__, PEAR_LOG_DEBUG);
#Horde::logMessage('SyncML: authenticate with username: ' . $this->_locName . ' and password: ' . $this->_password, __FILE__, __LINE__, PEAR_LOG_DEBUG);
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);
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);
Horde::logMessage('SyncML: Authentication of ' . $this->_locName . ' failed' , __FILE__, __LINE__, PEAR_LOG_INFO);
}
}
else
{
// store sessionID in a variable, because ->verify maybe resets that value
$sessionID = session_id();
if(!$GLOBALS['egw']->session->verify($sessionID, 'staticsyncmlkp3'))
Horde::logMessage('SyncML_EGW: egw session('.$sessionID.') not verified ' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
if(!$GLOBALS['egw']->session->verify($sessionID, 'staticsyncmlkp3')) {
Horde::logMessage('SyncML_EGW: egw session(' .$sessionID. ') not verified ' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
}
}
return $this->_isAuthorized;

View File

@ -99,7 +99,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
* from the server database by using Horde API (Registry) calls.
*/
function runSyncCommand(&$command) {
Horde::logMessage('SyncML: content type is ' . $command->getContentType() .' moreData '. $command->_moreData, __FILE__, __LINE__, PEAR_LOG_DEBUG);
#Horde::logMessage('SyncML: content type is ' . $command->getContentType() .' moreData '. $command->_moreData, __FILE__, __LINE__, PEAR_LOG_DEBUG);
global $registry;
$history = $GLOBALS['egw']->contenthistory;
@ -153,7 +153,6 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
$hordeType = str_replace('./','',$hordeType);
$syncElementItems = $command->getSyncElementItems();
Horde::logMessage('SyncML: found '. count($syncElementItems) .' items to import', __FILE__, __LINE__, PEAR_LOG_DEBUG);
foreach($syncElementItems as $syncItem) {
if(!$contentType = $syncItem->getContentType()) {
@ -179,10 +178,8 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
# }
# } elseif (is_a($command, 'Horde_SyncML_Command_Sync_Replace')) {
#$guid = $state->getGlobalUID($type, $syncItem->getLocURI());
Horde::logMessage('SyncML: start search for '. $syncItem->getContent() .' ('. $contentType .')' , __FILE__, __LINE__, PEAR_LOG_DEBUG);
$guid = $registry->call($hordeType . '/search',
array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType));
Horde::logMessage('SyncML: found guid: '. ($guid ? $guid : 'not found') , __FILE__, __LINE__, PEAR_LOG_DEBUG);
$ok = false;
if ($guid) {
#Horde::logMessage('SyncML: locuri'. $syncItem->getLocURI() . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_ERR);

View File

@ -94,7 +94,10 @@ class XML_WBXML_Decoder extends XML_WBXML_ContentHandler {
*/
function getByte($input)
{
return ord($input{$this->_strpos++});
$value = $input{$this->_strpos++};
$value = ord($value);
return $value;
}
/**
@ -131,7 +134,6 @@ class XML_WBXML_Decoder extends XML_WBXML_ContentHandler {
function decode($wbxml)
{
$this->_error = false; // reset state
$this->_strpos = 0;
if (empty($this->_ch)) {
@ -149,7 +151,6 @@ class XML_WBXML_Decoder extends XML_WBXML_ContentHandler {
// Containing the value zero (0)
// The actual DPI is determined after the String Table is read.
$dpiStruct = $this->getDocumentPublicIdentifier($wbxml);
// Get Charset from 5.6
// charset = mb_u_int32
$this->_charset = $this->getCharset($wbxml);
@ -366,6 +367,7 @@ class XML_WBXML_Decoder extends XML_WBXML_ContentHandler {
$size = XML_WBXML::MBUInt32ToInt($input, $this->_strpos);
// print "opaque of size $size\n"; // @todo remove debug
$b = substr($input, $this->_strpos, $size);
#$b = mb_substr($input, $this->_strpos, $size, 'ISO-8859-1');
$this->_strpos += $size;
// opaque data inside a <data> element may or may not be

View File

@ -18,7 +18,7 @@ $conf['auth']['checkip'] = true;
$conf['auth']['params']['username'] = 'Administrator';
$conf['auth']['params']['requestuser'] = false;
$conf['auth']['driver'] = 'auto';
$conf['log']['priority'] = PEAR_LOG_DEBUG;
$conf['log']['priority'] = PEAR_LOG_INFO;
$conf['log']['ident'] = 'EGWSYNC';
$conf['log']['params'] = array();
$conf['log']['name'] = '/tmp/egroupware_syncml.log';

View File

@ -111,16 +111,6 @@ $this->applications['egwcalendarsync'] = array(
'menu_parent' => 'organizing'
);
$this->applications['egwsifcalendarsync'] = array(
'fileroot' => EGW_SERVER_ROOT.'/syncml/sifcalendar',
'webroot' => $this->applications['horde']['webroot'] . '/mnemo',
'icon' => $this->applications['horde']['webroot'] . '/mnemo/graphics/mnemo.gif',
'name' => _("Calendar"),
'status' => 'active',
'provides' => 'sifcalendar',
'menu_parent' => 'organizing'
);
$this->applications['egwtaskssync'] = array(
'fileroot' => EGW_SERVER_ROOT.'/syncml/tasks',
'webroot' => $this->applications['horde']['webroot'] . '/mnemo',