From 83b0801533e13258aaa7ada29e1f38a49ddf9e3b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 20 Jul 2005 12:09:32 +0000 Subject: [PATCH] commit for Lars: latest SyncML updates --- infolog/inc/class.vcalinfolog.inc.php | 7 +- phpgwapi/inc/horde/Horde/RPC/syncml.php | 2 +- phpgwapi/inc/horde/Horde/SyncML.php | 4 +- phpgwapi/inc/horde/Horde/SyncML/Command.php | 4 + .../inc/horde/Horde/SyncML/Command/Alert.php | 16 ++- .../inc/horde/Horde/SyncML/Command/Sync.php | 5 +- .../horde/Horde/SyncML/Command/Sync/Add.php | 4 +- .../Command/Sync/ContentSyncElement.php | 2 +- .../Horde/SyncML/Command/Sync/Delete.php | 2 +- .../Horde/SyncML/Command/Sync/Replace.php | 2 +- .../Horde/SyncML/Command/Sync/SyncElement.php | 15 ++- phpgwapi/inc/horde/Horde/SyncML/State.php | 3 +- phpgwapi/inc/horde/Horde/SyncML/Sync.php | 61 ++++++++- .../SyncML/Sync/OneWayFromServerSync.php | 2 +- .../SyncML/Sync/RefreshFromServerSync.php | 2 +- .../inc/horde/Horde/SyncML/Sync/SlowSync.php | 9 +- .../horde/Horde/SyncML/Sync/TwoWaySync.php | 7 +- phpgwapi/inc/horde/Horde/iCalendar.php | 120 +++++++++++++++++- .../inc/horde/XML/WBXML/ContentHandler.php | 1 + phpgwapi/inc/horde/config/registry.php | 10 ++ 20 files changed, 244 insertions(+), 34 deletions(-) diff --git a/infolog/inc/class.vcalinfolog.inc.php b/infolog/inc/class.vcalinfolog.inc.php index 1bd483b210..5a594d00b9 100644 --- a/infolog/inc/class.vcalinfolog.inc.php +++ b/infolog/inc/class.vcalinfolog.inc.php @@ -19,6 +19,8 @@ function exportVTODO($_taskID, $_version) { $taskData = $this->read($_taskID); + + $taskData = $GLOBALS['egw']->translation->convert($taskData,$GLOBALS['egw']->translation->charset(),'UTF-8'); //_debug_array($taskData); @@ -88,13 +90,14 @@ foreach($component->_attributes as $attributes) { #print $attributes['name'].' - '.$attributes['value'].'
'; + #$attributes['value'] = $GLOBALS['egw']->translation->convert($attributes['value'],'UTF-8'); switch($attributes['name']) { case 'CLASS': - $taskData['info_access'] = strtolower($attributes['value']); + $taskData['info_access'] = strtolower($attributes['value']); break; case 'DESCRIPTION': - $taskData['info_des'] = $botranslation->convert($attributes['value'],'utf-8'); + $taskData['info_des'] = $attributes['value']; break; case 'DUE': $taskData['info_enddate'] = $attributes['value']; diff --git a/phpgwapi/inc/horde/Horde/RPC/syncml.php b/phpgwapi/inc/horde/Horde/RPC/syncml.php index 4658002dac..8a27df1586 100644 --- a/phpgwapi/inc/horde/Horde/RPC/syncml.php +++ b/phpgwapi/inc/horde/Horde/RPC/syncml.php @@ -39,7 +39,7 @@ class Horde_RPC_syncml extends Horde_RPC { /** * Debug directory, if set will store copies of all packets. */ - var $_debugDir = '/var/www/groupware.groupwareappliance.com/htdocs/syncml/'; + var $_debugDir = '/var/www/html/syncdebug/'; /** * Default character set. Only supports UTF-8(ASCII?). diff --git a/phpgwapi/inc/horde/Horde/SyncML.php b/phpgwapi/inc/horde/Horde/SyncML.php index d454c43d4a..d99d3fa74b 100644 --- a/phpgwapi/inc/horde/Horde/SyncML.php +++ b/phpgwapi/inc/horde/Horde/SyncML.php @@ -536,8 +536,8 @@ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler { } Horde::logMessage('SyncML: summary:' . $s, __FILE__, __LINE__, PEAR_LOG_INFO); // session can be closed here! - session_unset(); - session_destroy(); + //session_unset(); + //session_destroy(); } break; diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command.php b/phpgwapi/inc/horde/Horde/SyncML/Command.php index 4455eeed5f..e67c41d1d6 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command.php @@ -66,6 +66,10 @@ class Horde_SyncML_Command { function characters($str) { + $tempValue = trim($str); + + if(empty($tempValue)) return; + if (isset($this->_chars)) { $this->_chars = $this->_chars . $str; } else { diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php index 3e3776a427..6ad807d099 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php @@ -200,6 +200,19 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command { } } else + { + $status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Alert'); + $status->setCmdRef($this->_cmdID); + if ($this->_sourceLocURI != null) { + $status->setSourceRef($this->_sourceLocURI); + } + if ($this->_targetLocURI != null) { + $status->setTargetRef((isset($this->_targetLocURIParameters) ? $this->_targetLocURI.'?/'.$this->_targetLocURIParameters : $this->_targetLocURI)); + } + + $currentCmdID = $status->output($currentCmdID, $output); + } +/* else { if ($state->isAuthorized()) { $output->startElement($state->getURI(), 'Alert', $attrs); @@ -238,8 +251,7 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command { $currentCmdID++; } - } - + }*/ return $currentCmdID; } diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php index 8d2cbf6030..5e785730d8 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php @@ -97,7 +97,8 @@ class Horde_SyncML_Command_Sync extends Horde_Syncml_Command { $state = $_SESSION['SyncML.state']; if($state->getSyncStatus() == CLIENT_SYNC_FINNISHED || $state->getSyncStatus() == SERVER_SYNC_DATA_PENDING) { -############## +############## + $state->setSyncStatus(SERVER_SYNC_DATA_PENDING); $targets = $state->getTargets(); Horde::logMessage('SyncML: starting sync to client '.$targets[0], __FILE__, __LINE__, PEAR_LOG_DEBUG); $attrs = array(); @@ -139,7 +140,7 @@ class Horde_SyncML_Command_Sync extends Horde_Syncml_Command { $output->endElement($state->getURI(), 'Sync'); - if($currentCmdID > MAX_DATA) break; + break; } #Horde::logMessage('SyncML: ending sync to client '.$targets[0], __FILE__, __LINE__, PEAR_LOG_DEBUG); diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Add.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Add.php index c4348f74d5..8aacf9845a 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Add.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Add.php @@ -17,9 +17,11 @@ include_once 'Horde/SyncML/Command/Sync/SyncElement.php'; */ class Horde_SyncML_Command_Sync_Add extends Horde_SyncML_Command_Sync_SyncElement { + var $_status = RESPONSE_ITEM_ADDED; + function output($currentCmdID, &$output) { - $status = &new Horde_SyncML_Command_Status(RESPONSE_ITEM_ADDED, 'Add'); + $status = &new Horde_SyncML_Command_Status($this->_status, 'Add'); $status->setCmdRef($this->_cmdID); if (isset($this->_luid)) { diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/ContentSyncElement.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/ContentSyncElement.php index c8ec8bd337..3723015038 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/ContentSyncElement.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/ContentSyncElement.php @@ -127,7 +127,7 @@ class Horde_SyncML_Command_Sync_ContentSyncElement extends Horde_SyncML_Command_ } if (isset($this->_content)) { $output->startElement($state->getURI(), 'Data', $attrs); - $chars = $this->_content; + $chars = '_content.']]>'; $output->characters($chars); $output->endElement($state->getURI(), 'Data'); } diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Delete.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Delete.php index d951037a1f..5ed168b5fc 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Delete.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Delete.php @@ -19,7 +19,7 @@ class Horde_SyncML_Command_Sync_Delete extends Horde_SyncML_Command_Sync_SyncEle function output($currentCmdID, &$output) { - $status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Delete'); + $status = &new Horde_SyncML_Command_Status($this->_status, 'Delete'); $status->setCmdRef($this->_cmdID); if (isset($this->_luid)) { diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Replace.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Replace.php index e8f9bfe7b9..7fa8ee6a79 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Replace.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/Replace.php @@ -19,7 +19,7 @@ class Horde_SyncML_Command_Sync_Replace extends Horde_SyncML_Command_Sync_SyncEl function output($currentCmdID, &$output) { - $status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Replace'); + $status = &new Horde_SyncML_Command_Status($this->_status, 'Replace'); $status->setCmdRef($this->_cmdID); if (isset($this->_luid)) { diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/SyncElement.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/SyncElement.php index 01211b236b..6d48990275 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/SyncElement.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync/SyncElement.php @@ -22,6 +22,7 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command { var $_isSource; var $_content; var $_contentType; + var $_status = RESPONSE_OK; function &factory($command, $params = null) { @@ -52,6 +53,8 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command { function endElement($uri, $element) { + $search = array('/ *\n/','/ *$/m'); + $replace = array('',''); switch ($this->_xmlStack) { case 1: // Need to add sync elements to the Sync method? @@ -61,7 +64,9 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command { if ($element == 'Source') { $this->_isSource = false; } elseif ($element == 'Data') { - $this->_content = trim($this->_chars); + $this->_content = $this->_chars; + } elseif ($element == 'MoreData') { + $this->_moreData = TRUE; } elseif ($element == 'Type') { if(!isset($this->_contentType)) $this->_contentType = trim($this->_chars); @@ -73,6 +78,8 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command { $this->_luid = trim($this->_chars); } elseif ($element == 'Type') { $this->_contentType = trim($this->_chars); + } elseif ($element == 'Size') { + $this->_contentSize = trim($this->_chars); } break; } @@ -119,5 +126,9 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command { { $this->_content = $content; } - + + function setStatus($_status) + { + $this->_status = $_status; + } } diff --git a/phpgwapi/inc/horde/Horde/SyncML/State.php b/phpgwapi/inc/horde/Horde/SyncML/State.php index 01d55fa570..f985faa069 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/State.php +++ b/phpgwapi/inc/horde/Horde/SyncML/State.php @@ -129,7 +129,8 @@ define('CLIENT_SYNC_FINNISHED', 2); define('SERVER_SYNC_DATA_PENDING', 3); define('SERVER_SYNC_FINNISHED', 4); -define('MAX_DATA', 30); +define('MAX_DATA', 19); +define('MAX_ENTRIES', 10); /** * The Horde_SyncML_State class provides a SyncML state object. diff --git a/phpgwapi/inc/horde/Horde/SyncML/Sync.php b/phpgwapi/inc/horde/Horde/SyncML/Sync.php index b583047ec9..061150a27c 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Sync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Sync.php @@ -89,9 +89,9 @@ class Horde_SyncML_Sync { * Command takes place. Entries are added, deleted or replaced * from the server database by using Horde API (Registry) calls. */ - function runSyncCommand($command) + function runSyncCommand(&$command) { - Horde::logMessage('SyncML: content type is ' . $command->getContentType(), __FILE__, __LINE__, PEAR_LOG_DEBUG); + Horde::logMessage('SyncML: content type is ' . $command->getContentType() .' moreData '. $command->_moreData, __FILE__, __LINE__, PEAR_LOG_DEBUG); global $registry; #require_once 'Horde/History.php'; @@ -99,6 +99,63 @@ class Horde_SyncML_Sync { $history = $GLOBALS['phpgw']->contenthistory; $state = &$_SESSION['SyncML.state']; + + if(isset($state->_moreData['luid'])) + { + if(($command->_luid == $state->_moreData['luid'])) + { + $lastChunks = implode('',$state->_moreData['chunks']); + $command->_content = $lastChunks.$command->_content; + $stringlen1 = strlen($lastChunks); + $stringlen2 = strlen($command->_content); + + if(!$command->_moreData && + strlen($command->_content) + != $state->_moreData['contentSize'] + ) + { + $command->_status = RESPONSE_SIZE_MISMATCH; + $state->_moreData = array(); + + return; + } + elseif(!$command->_moreData && + strlen($command->_content) + == $state->_moreData['contentSize'] + ) + { + $state->_moreData = array(); + + return; + } + + } + else + { + // alert 223 needed too + #$command->_status = ALERT_NO_END_OF_DATA; + + $state->_moreData = array(); + + return; + } + } + + // don't add/replace the data currently, they are not yet complete + if($command->_moreData == TRUE) + { + $state->_moreData['chunks'][] = $command->_content; + $state->_moreData['luid'] = $command->_luid; + + // gets only set with the first chunk of data + if(isset($command->_contentSize)) + $state->_moreData['contentSize'] = $command->_contentSize; + + $command->_status = RESPONSE_CHUNKED_ITEM_ACCEPTED_AND_BUFFERED; + + return; + } + $hordeType = $type = $this->_targetLocURI; // remove the './' from the beginning $hordeType = str_replace('./','',$hordeType); diff --git a/phpgwapi/inc/horde/Horde/SyncML/Sync/OneWayFromServerSync.php b/phpgwapi/inc/horde/Horde/SyncML/Sync/OneWayFromServerSync.php index 434f341fc9..71f98f5231 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Sync/OneWayFromServerSync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Sync/OneWayFromServerSync.php @@ -64,7 +64,7 @@ class Horde_SyncML_Sync_OneWayFromServerSync extends Horde_SyncML_Sync { $syncItems++; // return if we have to much data - if($syncItems > MAX_DATA) + if($syncItems >= MAX_ENTRIES) { $state->setMoreDataPending(); return $currentCmdID; diff --git a/phpgwapi/inc/horde/Horde/SyncML/Sync/RefreshFromServerSync.php b/phpgwapi/inc/horde/Horde/SyncML/Sync/RefreshFromServerSync.php index 06d5dc7194..a7dd1612a8 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Sync/RefreshFromServerSync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Sync/RefreshFromServerSync.php @@ -47,7 +47,7 @@ class Horde_SyncML_Sync_RefreshFromServerSync extends Horde_SyncML_Sync { $syncItems++; // return if we have to much data - if($syncItems > MAX_DATA) + if($syncItems >= MAX_ENTRIES) { $state->setMoreDataPending(); return $currentCmdID; diff --git a/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php b/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php index c187e5695d..c54fe8fce2 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php @@ -38,18 +38,19 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync { Horde::logMessage("SyncML: ".count($adds). ' added items found for '.$hordeType , __FILE__, __LINE__, PEAR_LOG_DEBUG); $serverAnchorNext = $state->getServerAnchorNext($syncType); + $counter = 0; while($guid = array_shift($adds)) { #$guid_ts = max($history->getTSforAction($guid, 'add'),$history->getTSforAction($guid, 'modify')); $sync_ts = $state->getChangeTS($syncType, $guid); - #Horde::logMessage("SyncML: timestamp add: $guid sync_ts: $sync_ts anchorNext: ". $serverAnchorNext.' / '.time(), __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: add: $guid ignored, came from client", __FILE__, __LINE__, PEAR_LOG_DEBUG); + //Horde::logMessage("SyncML: slowsync add: $guid ignored, came from client", __FILE__, __LINE__, PEAR_LOG_DEBUG); continue; } @@ -64,6 +65,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync { $c = $registry->call($hordeType . '/export', array('guid' => $guid, 'contentType' => $contentType)); + Horde::logMessage("SyncML: slowsync add to server $c", __FILE__, __LINE__, PEAR_LOG_DEBUG); if (!is_a($c, 'PEAR_Error')) { // Item in history but not in database. Strange, but // can happen. @@ -75,7 +77,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync { $state->log('Server-Add'); // return if we have to much data - if($currentCmdID > MAX_DATA) + if(++$counter >= MAX_ENTRIES) { $state->setSyncStatus(SERVER_SYNC_DATA_PENDING); return $currentCmdID; @@ -100,7 +102,6 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync { Horde::logMessage("SyncML: reading added items from database for $hordeType", __FILE__, __LINE__, PEAR_LOG_DEBUG); $state->setAddedItems($hordeType, $registry->call($hordeType. '/list', array())); $adds = &$state->getAddedItems($hordeType); - $this->_syncDataLoaded = TRUE; return count($state->getAddedItems($hordeType)); diff --git a/phpgwapi/inc/horde/Horde/SyncML/Sync/TwoWaySync.php b/phpgwapi/inc/horde/Horde/SyncML/Sync/TwoWaySync.php index 3fcdc8a8bb..e8f2becee5 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Sync/TwoWaySync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Sync/TwoWaySync.php @@ -56,6 +56,7 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync { #$history = &Horde_History::singleton(); $history = $GLOBALS['phpgw']->contenthistory; $state = &$_SESSION['SyncML.state']; + $counter = 0; $changes = &$state->getChangedItems($hordeType); $deletes = &$state->getDeletedItems($hordeType); @@ -104,7 +105,7 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync { $state->log('Server-Replace'); // return if we have to much data - if($currentCmdID > MAX_DATA) + if(++$counter >= MAX_ENTRIES) { $state->setSyncStatus(SERVER_SYNC_DATA_PENDING); return $currentCmdID; @@ -141,7 +142,7 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync { $state->removeUID($syncType, $locid); // return if we have to much data - if($currentCmdID > MAX_DATA) + if(++$counter >= MAX_ENTRIES) { $state->setSyncStatus(SERVER_SYNC_DATA_PENDING); return $currentCmdID; @@ -200,7 +201,7 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync { $state->log('Server-Add'); // return if we have to much data - if($currentCmdID > MAX_DATA) + if(++$counter >= MAX_ENTRIES) { $state->setSyncStatus(SERVER_SYNC_DATA_PENDING); return $currentCmdID; diff --git a/phpgwapi/inc/horde/Horde/iCalendar.php b/phpgwapi/inc/horde/Horde/iCalendar.php index 39640ce9ef..9e27952a79 100644 --- a/phpgwapi/inc/horde/Horde/iCalendar.php +++ b/phpgwapi/inc/horde/Horde/iCalendar.php @@ -406,7 +406,6 @@ class Horde_iCalendar { */ function parsevCalendar($text, $base = 'VCALENDAR', $charset = 'utf-8', $clear = true) { - $botranslation = CreateObject('phpgwapi.translation'); if ($clear) { $this->clear(); } @@ -494,18 +493,18 @@ class Horde_iCalendar { $value = quoted_printable_decode($value); // Quoted printable is normally encoded as utf-8. if (isset($params['CHARSET'])) { - $value = $botranslation->convert($value, $params['CHARSET']); + $value = $GLOBALS['egw']->translation->convert($value, $params['CHARSET'],'iso-8859-1'); } else { - $value = $botranslation->convert($value, 'utf-8'); + $value = $GLOBALS['egw']->translation->convert($value, 'utf-8'); } } if (isset($params['CHARSET'])) { - $value = $botranslation->convert($value, $params['CHARSET']); + $value = $GLOBALS['egw']->translation->convert($value, $params['CHARSET']); } else { // As per RFC 2279, assume UTF8 if we don't have // an explicit charset parameter. - $value = $botranslation->convert($value, $charset); + $value = $GLOBALS['egw']->translation->convert($value, 'utf-8'); } switch ($tag) { @@ -1177,7 +1176,7 @@ class Horde_iCalendar { * @access private * @return string */ - function EncodeQP ($str) { + function EncodeQP_old ($str) { $encoded = $this->FixEOL($str); #$encoded = $str; #if (substr($encoded, -(strlen($this->LE))) != $this->LE) @@ -1189,6 +1188,8 @@ class Horde_iCalendar { $encoded = preg_replace('/([\000-\012\015\016\020-\037\075\177-\377])/e', "'='.sprintf('%02X', ord('\\1'))", $encoded); // Replace every spaces and tabs when it's the last character on a line + #$encoded = preg_replace("/([\011\040])".$this->LE."/e", + # "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded); $encoded = preg_replace("/([\011\040])".$this->LE."/e", "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded); @@ -1205,7 +1206,7 @@ class Horde_iCalendar { * @access private * @return string */ - function WrapText($message, $length, $qp_mode = false) { + function WrapText_old($message, $length, $qp_mode = false) { $soft_break = ($qp_mode) ? "=\r\n" : $this->LE; #$message = $this->FixEOL($message); @@ -1291,5 +1292,110 @@ class Horde_iCalendar { return $str; } + /** + * Encode string to quoted-printable. + * @access private + * @return string + */ + function EncodeQP ($str) { + $encoded = $this->FixEOL($str); + if (substr($encoded, -(strlen($this->LE))) != $this->LE) + $encoded .= $this->LE; + + // Replace every high ascii, control and = characters + #$encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e', + # "'='.sprintf('%02X', ord('\\1'))", $encoded); + $encoded = preg_replace('/([\000-\012\015\016\020-\037\075\177-\377])/e', + "'='.sprintf('%02X', ord('\\1'))", $encoded); + // Replace every spaces and tabs when it's the last character on a line + $encoded = preg_replace("/([\011\040])".$this->LE."/e", + "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded); + + // Maximum line length of 76 characters before CRLF (74 + space + '=') + #$encoded = $this->WrapText($encoded, 74, true); + + return $encoded; + } + + /** + * Wraps message for use with mailers that do not + * automatically perform wrapping and for quoted-printable. + * Original written by philippe. + * @access private + * @return string + */ + function WrapText($message, $length, $qp_mode = false) { + $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; + $soft_break = "..="; + + $message = $this->FixEOL($message); + if (substr($message, -1) == $this->LE) + $message = substr($message, 0, -1); + + $line = explode($this->LE, $message); + $message = ""; + for ($i=0 ;$i < count($line); $i++) + { + $line_part = explode(" ", $line[$i]); + $buf = ""; + for ($e = 0; $e $length)) + { + $space_left = $length - strlen($buf) - 1; + if ($e != 0) + { + if ($space_left > 20) + { + $len = $space_left; + if (substr($word, $len - 1, 1) == "=") + $len--; + elseif (substr($word, $len - 2, 1) == "=") + $len -= 2; + $part = substr($word, 0, $len); + $word = substr($word, $len); + $buf .= " " . $part; + $message .= $buf . sprintf("=%s", $this->LE); + } + else + { + $message .= $buf . $soft_break; + } + $buf = ""; + } + while (strlen($word) > 0) + { + $len = $length; + if (substr($word, $len - 1, 1) == "=") + $len--; + elseif (substr($word, $len - 2, 1) == "=") + $len -= 2; + $part = substr($word, 0, $len); + $word = substr($word, $len); + + if (strlen($word) > 0) + $message .= $part . sprintf("=%s", $this->LE); + else + $buf = $part; + } + } + else + { + $buf_o = $buf; + $buf .= ($e == 0) ? $word : (" " . $word); + + if (strlen($buf) > $length and $buf_o != "") + { + $message .= $buf_o . $soft_break; + $buf = $word; + } + } + } + $message .= $buf . $this->LE; + } + + return $message; + } } diff --git a/phpgwapi/inc/horde/XML/WBXML/ContentHandler.php b/phpgwapi/inc/horde/XML/WBXML/ContentHandler.php index f29a5bf959..7ee64da239 100644 --- a/phpgwapi/inc/horde/XML/WBXML/ContentHandler.php +++ b/phpgwapi/inc/horde/XML/WBXML/ContentHandler.php @@ -33,6 +33,7 @@ class XML_WBXML_ContentHandler { function XML_WBXML_ContentHandler() { $this->_currentUri = &new XML_WBXML_LifoQueue(); + $this->_output = ''; } function raiseError($error) diff --git a/phpgwapi/inc/horde/config/registry.php b/phpgwapi/inc/horde/config/registry.php index 9c64e19252..52c47f903c 100644 --- a/phpgwapi/inc/horde/config/registry.php +++ b/phpgwapi/inc/horde/config/registry.php @@ -100,3 +100,13 @@ $this->applications['egwcalendarsync'] = array( 'menu_parent' => 'organizing' ); +$this->applications['egwtaskssync'] = array( + 'fileroot' => EGW_SERVER_ROOT.'/syncml/tasks', + 'webroot' => $this->applications['horde']['webroot'] . '/mnemo', + 'icon' => $this->applications['horde']['webroot'] . '/mnemo/graphics/mnemo.gif', + 'name' => _("Tasks"), + 'status' => 'active', + 'provides' => 'tasks', + 'menu_parent' => 'organizing' +); +