From ea7b5a8afa03f7aaabd4e72808d4cb925c9ae934 Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Fri, 7 Apr 2006 08:11:17 +0000 Subject: [PATCH] various small bugfixes --- phpgwapi/inc/horde/Horde/SyncML.php | 3 +-- .../inc/horde/Horde/SyncML/Command/Sync.php | 1 - phpgwapi/inc/horde/Horde/SyncML/State.php | 14 ++++++++----- phpgwapi/inc/horde/Horde/SyncML/State_egw.php | 21 ++++++++++++------- .../inc/horde/Horde/SyncML/Sync/SlowSync.php | 5 +---- phpgwapi/inc/horde/XML/WBXML/Decoder.php | 8 ++++--- phpgwapi/inc/horde/config/conf.php | 2 +- phpgwapi/inc/horde/config/registry.php | 10 --------- 8 files changed, 31 insertions(+), 33 deletions(-) diff --git a/phpgwapi/inc/horde/Horde/SyncML.php b/phpgwapi/inc/horde/Horde/SyncML.php index 5f61c842ff..b35d9757dc 100644 --- a/phpgwapi/inc/horde/Horde/SyncML.php +++ b/phpgwapi/inc/horde/Horde/SyncML.php @@ -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); } diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php index 7ebd3e50a4..addcd4c199 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php @@ -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) { diff --git a/phpgwapi/inc/horde/Horde/SyncML/State.php b/phpgwapi/inc/horde/Horde/SyncML/State.php index 9f5c097320..4921e16393 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/State.php +++ b/phpgwapi/inc/horde/Horde/SyncML/State.php @@ -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'; diff --git a/phpgwapi/inc/horde/Horde/SyncML/State_egw.php b/phpgwapi/inc/horde/Horde/SyncML/State_egw.php index 13b56a3886..e1916ac19f 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/State_egw.php +++ b/phpgwapi/inc/horde/Horde/SyncML/State_egw.php @@ -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; diff --git a/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php b/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php index e6b36e1c26..2a6bdd1c1e 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php @@ -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); diff --git a/phpgwapi/inc/horde/XML/WBXML/Decoder.php b/phpgwapi/inc/horde/XML/WBXML/Decoder.php index 7eb31df567..4a92f26858 100644 --- a/phpgwapi/inc/horde/XML/WBXML/Decoder.php +++ b/phpgwapi/inc/horde/XML/WBXML/Decoder.php @@ -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 element may or may not be diff --git a/phpgwapi/inc/horde/config/conf.php b/phpgwapi/inc/horde/config/conf.php index a00cc7652e..61d9c0aa59 100644 --- a/phpgwapi/inc/horde/config/conf.php +++ b/phpgwapi/inc/horde/config/conf.php @@ -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'; diff --git a/phpgwapi/inc/horde/config/registry.php b/phpgwapi/inc/horde/config/registry.php index 1341661c49..88d177b6be 100644 --- a/phpgwapi/inc/horde/config/registry.php +++ b/phpgwapi/inc/horde/config/registry.php @@ -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',