More Funambol adjustments and workarounds

This commit is contained in:
Jörg Lehrke 2010-01-09 18:04:21 +00:00
parent 49823ecd7e
commit 3242e169cc
4 changed files with 247 additions and 75 deletions

View File

@ -96,8 +96,12 @@ class addressbook_vcal extends addressbook_bo
function __construct($contact_app='addressbook', $_contentType='text/x-vcard', &$_clientProperties = array()) function __construct($contact_app='addressbook', $_contentType='text/x-vcard', &$_clientProperties = array())
{ {
parent::__construct($contact_app); parent::__construct($contact_app);
if($this->log)$this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-vcard"; if ($this->log)
if($this->log)error_log(__LINE__.__METHOD__.__FILE__.array2string($_contentType)."\n",3,$this->logfile); {
$this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-vcard";
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($_contentType)."\n",3,$this->logfile);
}
switch($_contentType) switch($_contentType)
{ {
case 'text/vcard': case 'text/vcard':
@ -367,6 +371,10 @@ class addressbook_vcal extends addressbook_bo
} }
elseif ($this->productManufacturer == 'funambol') elseif ($this->productManufacturer == 'funambol')
{ {
if ($this->productName == 'mozilla sync client')
{
$valueData = str_replace( "\n", '\\n', $valueData);
}
$options['ENCODING'] = 'FUNAMBOL-QP'; $options['ENCODING'] = 'FUNAMBOL-QP';
} }
elseif (preg_match('/([\000-\012\015\016\020-\037\075])/', $value)) elseif (preg_match('/([\000-\012\015\016\020-\037\075])/', $value))
@ -411,8 +419,10 @@ class addressbook_vcal extends addressbook_bo
$result = $vCard->exportvCalendar(); $result = $vCard->exportvCalendar();
if ($this->log) if ($this->log)
{ {
error_log(__LINE__.__METHOD__.__FILE__."'$this->productManufacturer','$this->productName'"."\n",3,$this->logfile); error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
error_log(__LINE__.__METHOD__.__FILE__."\n".array2string($result)."\n",3,$this->logfile); "() '$this->productManufacturer','$this->productName'\n",3,$this->logfile);
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($result)."\n",3,$this->logfile);
} }
return $result; return $result;
} }
@ -484,7 +494,11 @@ class addressbook_vcal extends addressbook_bo
'UID' => array('uid'), 'UID' => array('uid'),
); );
if ($this->log) error_log(__LINE__.__METHOD__.__FILE__."\n".array2string($_vcard)."\n",3,$this->logfile); if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($_vcard)."\n",3,$this->logfile);
}
//Horde::logMessage("vCalAddressbook vcardtoegw:\n$_vcard", __FILE__, __LINE__, PEAR_LOG_DEBUG); //Horde::logMessage("vCalAddressbook vcardtoegw:\n$_vcard", __FILE__, __LINE__, PEAR_LOG_DEBUG);
@ -658,9 +672,11 @@ class addressbook_vcal extends addressbook_bo
$rowNames[$key] = $rowName; $rowNames[$key] = $rowName;
} }
if ($this->log)
{
if($this->log)error_log(__LINE__.__METHOD__.__FILE__."\n".array2string($rowNames)."\n",3,$this->logfile); error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($rowNames)."\n",3,$this->logfile);
}
// All rowNames of the vCard are now concatenated with their qualifiers. // All rowNames of the vCard are now concatenated with their qualifiers.
// If qualifiers are missing we apply a default strategy. // If qualifiers are missing we apply a default strategy.
@ -669,7 +685,6 @@ class addressbook_vcal extends addressbook_bo
//error_log(print_r($rowNames, true)); //error_log(print_r($rowNames, true));
$finalRowNames = array(); $finalRowNames = array();
foreach ($rowNames as $vcardKey => $rowName) foreach ($rowNames as $vcardKey => $rowName)
@ -815,7 +830,11 @@ class addressbook_vcal extends addressbook_bo
} }
if($this->log)error_log(__LINE__.__METHOD__.__FILE__."\n".array2string($finalRowNames)."\n",3,$this->logfile); if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($finalRowNames)."\n",3,$this->logfile);
}
//error_log(print_r($finalRowNames, true)); //error_log(print_r($finalRowNames, true));
@ -884,8 +903,13 @@ class addressbook_vcal extends addressbook_bo
$this->fixup_contact($contact); $this->fixup_contact($contact);
if ($this->log) error_log(__LINE__.__METHOD__.__FILE__."'$this->productManufacturer','$this->productName'"."\n",3,$this->logfile); if ($this->log)
if ($this->log) error_log(__LINE__.__METHOD__.__FILE__."\n".array2string($contact)."\n",3,$this->logfile); {
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
"() '$this->productManufacturer','$this->productName'\n",3,$this->logfile);
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($contact)."\n",3,$this->logfile);
}
return $contact; return $contact;
} }

View File

@ -259,7 +259,11 @@ class calendar_ical extends calendar_boupdate
$event['recur_enddate'] = $this->date2ts($time); $event['recur_enddate'] = $this->date2ts($time);
} }
if ($this->log) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n".array2string($event)."\n",3,$this->logfile); if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($event)."\n",3,$this->logfile);
}
if ($this->tzid === false) if ($this->tzid === false)
{ {
@ -491,7 +495,8 @@ class calendar_ical extends calendar_boupdate
break; break;
case 'PRIORITY': case 'PRIORITY':
if($this->productManufacturer == 'funambol') if($this->productManufacturer == 'funambol' &&
strpos($this->productName, 'outlook') !== false)
{ {
$attributes['PRIORITY'] = (int) $this->priority_egw2funambol[$event['priority']]; $attributes['PRIORITY'] = (int) $this->priority_egw2funambol[$event['priority']];
} }
@ -701,54 +706,61 @@ class calendar_ical extends calendar_boupdate
$valuesData = (array) $GLOBALS['egw']->translation->convert($values[$key], $valuesData = (array) $GLOBALS['egw']->translation->convert($values[$key],
$GLOBALS['egw']->translation->charset(),'UTF-8'); $GLOBALS['egw']->translation->charset(),'UTF-8');
//echo "$key:$valueID: value=$valueData, param=".print_r($paramDate,true)."\n"; //echo "$key:$valueID: value=$valueData, param=".print_r($paramDate,true)."\n";
$vevent->setAttribute($key, $valueData, $paramData, true, $valuesData); // attendees or organizer CN can contain utf-8 content
$options = array(); $paramData['CHARSET'] = 'UTF-8';
if ($paramData['CN']) $valueData .= $paramData['CN']; // attendees or organizer CN can contain utf-8 content if (preg_match('/[^\x20-\x7F]/', $valueData) ||
($paramData['CN'] && preg_match('/[^\x20-\x7F]/', $paramData['CN'])))
if (preg_match('/[^\x20-\x7F]/', $valueData))
{ {
switch ($this->productManufacturer) switch ($this->productManufacturer)
{ {
case 'groupdav': case 'groupdav':
if ($this->productName == 'kde') if ($this->productName == 'kde')
{ {
$options['CHARSET'] = 'UTF-8'; $paramData['ENCODING'] = 'QUOTED-PRINTABLE';
$options['ENCODING'] = 'QUOTED-PRINTABLE';
} }
else else
{ {
$options['CHARSET'] = ''; $paramData['CHARSET'] = '';
if (preg_match('/([\000-\012\015\016\020-\037\075])/', $valueData)) if (preg_match('/([\000-\012\015\016\020-\037\075])/', $valueData))
{ {
$options['ENCODING'] = 'QUOTED-PRINTABLE'; $paramData['ENCODING'] = 'QUOTED-PRINTABLE';
} }
else else
{ {
$options['ENCODING'] = ''; $paramData['ENCODING'] = '';
} }
} }
break; break;
case 'funambol': case 'funambol':
$options['ENCODING'] = 'FUNAMBOL-QP'; if ($this->productName == 'mozilla sync client')
default: {
// force UTF-8 $valueData = str_replace( "\n", '\\n', $valueData);
$options['CHARSET'] = 'UTF-8'; }
$paramData['ENCODING'] = 'FUNAMBOL-QP';
} }
} }
if (preg_match('/([\000-\012])/', $valueData)) if (preg_match('/([\000-\012])/', $valueData))
{ {
if ($this->log) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."() Has invalid XML data: $valueData",3,$this->logfile); if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
"() Has invalid XML data: $valueData",3,$this->logfile);
} }
$vevent->setParameter($key, $options); }
$vevent->setAttribute($key, $valueData, $paramData, true, $valuesData);
} }
} }
$vcal->addComponent($vevent); $vcal->addComponent($vevent);
} }
$retval = $vcal->exportvCalendar(); $retval = $vcal->exportvCalendar();
if ($this->log) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n".array2string($retval)."\n",3,$this->logfile); if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
"() '$this->productManufacturer','$this->productName'\n",3,$this->logfile);
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
"()\n".array2string($retval)."\n",3,$this->logfile);
}
return $retval; return $retval;
} }
@ -793,7 +805,11 @@ class calendar_ical extends calendar_boupdate
*/ */
function importVCal($_vcalData, $cal_id=-1, $etag=null, $merge=false, $recur_date=0) function importVCal($_vcalData, $cal_id=-1, $etag=null, $merge=false, $recur_date=0)
{ {
if ($this->log) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n".array2string($_vcalData)."\n",3,$this->logfile); if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($_vcalData)."\n",3,$this->logfile);
}
if (!is_array($this->supportedFields)) $this->setSupportedFields(); if (!is_array($this->supportedFields)) $this->setSupportedFields();
@ -815,7 +831,11 @@ class calendar_ical extends calendar_boupdate
} }
foreach ($events as $event) foreach ($events as $event)
{ {
if ($this->log) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n".array2string($event)."\n",3,$this->logfile); if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($event)."\n",3,$this->logfile);
}
$updated_id = false; $updated_id = false;
$event_info = $this->get_event_info($event); $event_info = $this->get_event_info($event);
@ -1137,7 +1157,8 @@ class calendar_ical extends calendar_boupdate
if ($this->log) if ($this->log)
{ {
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n".array2string($event_info['stored_event'])."\n",3,$this->logfile); error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($event_info['stored_event'])."\n",3,$this->logfile);
} }
} }
@ -1308,6 +1329,8 @@ class calendar_ical extends calendar_boupdate
); );
$defaultFields['funambol'] = $defaultFields['basic'] + array( $defaultFields['funambol'] = $defaultFields['basic'] + array(
'participants' => 'participants',
'owner' => 'owner',
'category' => 'category', 'category' => 'category',
'non_blocking' => 'non_blocking', 'non_blocking' => 'non_blocking',
'recurrence' => 'recurrence', 'recurrence' => 'recurrence',
@ -1468,7 +1491,11 @@ class calendar_ical extends calendar_boupdate
$vcal = new Horde_iCalendar; $vcal = new Horde_iCalendar;
if (!$vcal->parsevCalendar($_vcalData)) if (!$vcal->parsevCalendar($_vcalData))
{ {
if ($this->log) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."(): No vCalendar Container found!\n",3,$this->logfile); if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
"(): No vCalendar Container found!\n",3,$this->logfile);
}
if ($this->tzid) if ($this->tzid)
{ {
date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']);
@ -1906,7 +1933,8 @@ class calendar_ical extends calendar_boupdate
} }
break; break;
case 'PRIORITY': case 'PRIORITY':
if($this->productManufacturer == 'funambol') if($this->productManufacturer == 'funambol' &&
strpos($this->productName, 'outlook') !== false)
{ {
$vcardData['priority'] = (int) $this->priority_funambol2egw[$attributes['value']]; $vcardData['priority'] = (int) $this->priority_funambol2egw[$attributes['value']];
} }
@ -2165,7 +2193,11 @@ class calendar_ical extends calendar_boupdate
} }
if ($this->calendarOwner) $event['owner'] = $this->calendarOwner; if ($this->calendarOwner) $event['owner'] = $this->calendarOwner;
if ($this->log) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n".array2string($event)."\n",3,$this->logfile); if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($event)."\n",3,$this->logfile);
}
//Horde::logMessage("vevent2egw:\n" . print_r($event, true), //Horde::logMessage("vevent2egw:\n" . print_r($event, true),
// __FILE__, __LINE__, PEAR_LOG_DEBUG); // __FILE__, __LINE__, PEAR_LOG_DEBUG);
return $event; return $event;

View File

@ -20,9 +20,9 @@ require_once EGW_SERVER_ROOT.'/phpgwapi/inc/horde/lib/core.php';
class infolog_ical extends infolog_bo class infolog_ical extends infolog_bo
{ {
/** /**
* @var array conversion of the priority egw => ical * @var array $priority_egw2ical conversion of the priority egw => ical
*/ */
var $egw_priority2vcal_priority = array( var $priority_egw2ical = array(
0 => 9, // low 0 => 9, // low
1 => 5, // normal 1 => 5, // normal
2 => 3, // high 2 => 3, // high
@ -30,15 +30,34 @@ class infolog_ical extends infolog_bo
); );
/** /**
* @var array conversion of the priority ical => egw * @var array $priority_ical2egw conversion of the priority ical => egw
*/ */
var $vcal_priority2egw_priority = array( var $priority_ical2egw = array(
9 => 0, 8 => 0, 7 => 0, // low 9 => 0, 8 => 0, 7 => 0, // low
6 => 1, 5 => 1, 4 => 1, 0 => 1, // normal 6 => 1, 5 => 1, 4 => 1, 0 => 1, // normal
3 => 2, 2 => 2, // high 3 => 2, 2 => 2, // high
1 => 3, // urgent 1 => 3, // urgent
); );
/**
* @var array $priority_egw2funambol conversion of the priority egw => funambol
*/
var $priority_egw2funambol = array(
0 => 0, // low
1 => 1, // normal
2 => 2, // high
3 => 2, // urgent
);
/**
* @var array $priority_funambol2egw conversion of the priority funambol => egw
*/
var $priority_funambol2egw = array(
0 => 0, // low
1 => 1, // normal
2 => 3, // high
);
/** /**
* manufacturer and name of the sync-client * manufacturer and name of the sync-client
* *
@ -61,6 +80,15 @@ class infolog_ical extends infolog_bo
*/ */
var $clientProperties; var $clientProperties;
/**
* Set Logging
*
* @var boolean
*/
var $log = false;
var $logfile="/tmp/log-infolog-vcal";
/** /**
* Constructor * Constructor
* *
@ -69,7 +97,7 @@ class infolog_ical extends infolog_bo
function __construct(&$_clientProperties = array()) function __construct(&$_clientProperties = array())
{ {
parent::__construct(); parent::__construct();
if ($this->log) $this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-infolog-vcal";
$this->clientProperties = $_clientProperties; $this->clientProperties = $_clientProperties;
} }
@ -201,6 +229,10 @@ class infolog_ical extends infolog_bo
} }
break; break;
case 'funambol': case 'funambol':
if ($this->productName == 'mozilla sync client')
{
$value = str_replace( "\n", '\\n', $value);
}
$options['ENCODING'] = 'FUNAMBOL-QP'; $options['ENCODING'] = 'FUNAMBOL-QP';
} }
} }
@ -228,13 +260,27 @@ class infolog_ical extends infolog_bo
// we try to preserv the original infolog status as X-INFOLOG-STATUS, so we can restore it, if the user does not modify STATUS // we try to preserv the original infolog status as X-INFOLOG-STATUS, so we can restore it, if the user does not modify STATUS
$vevent->setAttribute('X-INFOLOG-STATUS',$taskData['info_status']); $vevent->setAttribute('X-INFOLOG-STATUS',$taskData['info_status']);
$vevent->setAttribute('PERCENT-COMPLETE',$taskData['info_percent']); $vevent->setAttribute('PERCENT-COMPLETE',$taskData['info_percent']);
$vevent->setAttribute('PRIORITY',$this->egw_priority2vcal_priority[$taskData['info_priority']]); if($this->productManufacturer == 'funambol' &&
strpos($this->productName, 'outlook') !== false)
{
$priority = (int) $this->priority_egw2funambol[$taskData['info_priority']];
}
else
{
$priority = (int) $this->priority_egw2ical2[$taskData['info_priority']];
}
$vevent->setAttribute('PRIORITY', $priority);
$vcal->addComponent($vevent); $vcal->addComponent($vevent);
$retval = $vcal->exportvCalendar(); $retval = $vcal->exportvCalendar();
Horde::logMessage("exportVTODO:\n" . print_r($retval, true), __FILE__, __LINE__, PEAR_LOG_DEBUG); if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($retval)."\n",3,$this->logfile);
}
// Horde::logMessage("exportVTODO:\n" . print_r($retval, true),
// __FILE__, __LINE__, PEAR_LOG_DEBUG);
return $retval; return $retval;
} }
@ -272,7 +318,7 @@ class infolog_ical extends infolog_bo
*/ */
function importVTODO(&$_vcalData, $_taskID=-1, $merge=false) function importVTODO(&$_vcalData, $_taskID=-1, $merge=false)
{ {
if (!$taskData = $this->vtodotoegw($_vcalData,$_taskID)) return false; if (!($taskData = $this->vtodotoegw($_vcalData,$_taskID))) return false;
// we suppose that a not set status in a vtodo means that the task did not started yet // we suppose that a not set status in a vtodo means that the task did not started yet
if (empty($taskData['info_status'])) if (empty($taskData['info_status']))
@ -285,6 +331,12 @@ class infolog_ical extends infolog_bo
$taskData['info_datecompleted'] = 0; $taskData['info_datecompleted'] = 0;
} }
if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($taskData)."\n",3,$this->logfile);
}
return $this->write($taskData); return $this->write($taskData);
} }
@ -319,8 +371,23 @@ class infolog_ical extends infolog_bo
*/ */
function vtodotoegw($_vcalData, $_taskID=-1) function vtodotoegw($_vcalData, $_taskID=-1)
{ {
if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($_vcalData)."\n",3,$this->logfile);
}
$vcal = new Horde_iCalendar; $vcal = new Horde_iCalendar;
if (!($vcal->parsevCalendar($_vcalData))) return false; if (!($vcal->parsevCalendar($_vcalData)))
{
if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
"(): No vCalendar Container found!\n",3,$this->logfile);
}
return false;
}
$version = $vcal->getAttribute('VERSION'); $version = $vcal->getAttribute('VERSION');
if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'])) if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length']))
@ -332,11 +399,22 @@ class infolog_ical extends infolog_bo
$minimum_uid_length = 8; $minimum_uid_length = 8;
} }
$components = $vcal->getComponents(); foreach ($vcal->getComponents() as $component)
foreach ($components as $component)
{ {
if (is_a($component, 'Horde_iCalendar_vtodo')) if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($component)."\n",3,$this->logfile);
}
if (!is_a($component, 'Horde_iCalendar_vtodo'))
{
if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
"(): Not a vTODO container, skipping...\n",3,$this->logfile);
}
}
else
{ {
$taskData = array(); $taskData = array();
$taskData['info_type'] = 'task'; $taskData['info_type'] = 'task';
@ -399,7 +477,15 @@ class infolog_ical extends infolog_bo
case 'PRIORITY': case 'PRIORITY':
if (1 <= $attributes['value'] && $attributes['value'] <= 9) { if (1 <= $attributes['value'] && $attributes['value'] <= 9) {
$taskData['info_priority'] = $this->vcal_priority2egw_priority[$attributes['value']]; if($this->productManufacturer == 'funambol' &&
strpos($this->productName, 'outlook') !== false)
{
$taskData['info_priority'] = (int) $this->priority_funambol2egw[$attributes['value']];
}
else
{
$taskData['info_priority'] = (int) $this->priority_ical2egw[$attributes['value']];
}
} else { } else {
$taskData['info_priority'] = 1; // default = normal $taskData['info_priority'] = 1; // default = normal
} }
@ -520,6 +606,10 @@ class infolog_ical extends infolog_bo
} }
break; break;
case 'funambol': case 'funambol':
if ($this->productName == 'mozilla sync client')
{
$value = str_replace( "\n", '\\n', $value);
}
$options['ENCODING'] = 'FUNAMBOL-QP'; $options['ENCODING'] = 'FUNAMBOL-QP';
} }
} }
@ -534,8 +624,13 @@ class infolog_ical extends infolog_bo
#$vnote->setAttribute('CLASS',$taskData['info_access'] == 'public' ? 'PUBLIC' : 'PRIVATE'); #$vnote->setAttribute('CLASS',$taskData['info_access'] == 'public' ? 'PUBLIC' : 'PRIVATE');
return $vnote->exportvCalendar(); $retval = $vnote->exportvCalendar();
break; if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($retval)."\n",3,$this->logfile);
}
return $retval;
} }
return false; return false;
} }
@ -551,13 +646,24 @@ class infolog_ical extends infolog_bo
*/ */
function importVNOTE(&$_vcalData, $_type, $_noteID=-1, $merge=false) function importVNOTE(&$_vcalData, $_type, $_noteID=-1, $merge=false)
{ {
if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($_vcalData)."\n",3,$this->logfile);
}
if (!($note = $this->vnotetoegw($_vcalData, $_type, $_noteID))) return false; if (!($note = $this->vnotetoegw($_vcalData, $_type, $_noteID))) return false;
if($_noteID > 0) $note['info_id'] = $_noteID; if($_noteID > 0) $note['info_id'] = $_noteID;
if (empty($note['info_status'])) $note['info_status'] = 'done'; if (empty($note['info_status'])) $note['info_status'] = 'done';
#_debug_array($taskData);exit; if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($note)."\n",3,$this->logfile);
}
return $this->write($note); return $this->write($note);
} }

View File

@ -520,14 +520,20 @@ class Horde_iCalendar {
* *
* @return boolean True on successful import, false otherwise. * @return boolean True on successful import, false otherwise.
*/ */
function parsevCalendar($text, $base = 'VCALENDAR', $charset = null, function parsevCalendar($text, $base = 'VCALENDAR', $charset = null, $clear = true)
$clear = true)
{ {
if ($clear) { if ($clear) {
$this->clear(); $this->clear();
} }
if (preg_match('/^BEGIN:' . $base . '(.*)^END:' . $base . '/ism', $text, $matches)) { if ($base == 'VTODO' &&
preg_match('/^BEGIN:VTODO(.*)^END:VEVENT/ism', $text, $matches)) {
// Workaround for Funambol VTODO bug in Mozilla Sync Plugins
Horde::logMessage('iCalendar: Funambol VTODO-bug detected, workaround activated...',
__FILE__, __LINE__, PEAR_LOG_WARNING);
$container = true;
$vCal = $matches[1];
} elseif (preg_match('/^BEGIN:' . $base . '(.*)^END:' . $base . '/ism', $text, $matches)) {
$container = true; $container = true;
$vCal = $matches[1]; $vCal = $matches[1];
} else { } else {
@ -548,7 +554,9 @@ class Horde_iCalendar {
// All subcomponents. // All subcomponents.
$matches = null; $matches = null;
if (preg_match_all('/^BEGIN:(.*)(\r\n|\r|\n)(.*)^END:\1/Uims', $vCal, $matches)) { // Workaround for Funambol VTODO bug in Mozilla Sync Plugins
if (preg_match_all('/^BEGIN:(VTODO)(\r\n|\r|\n)(.*)^END:VEVENT/Uims', $vCal, $matches) ||
preg_match_all('/^BEGIN:(.*)(\r\n|\r|\n)(.*)^END:\1/Uims', $vCal, $matches)) {
// vTimezone components are processed first. They are // vTimezone components are processed first. They are
// needed to process vEvents that may use a TZID. // needed to process vEvents that may use a TZID.
foreach ($matches[0] as $key => $data) { foreach ($matches[0] as $key => $data) {
@ -652,6 +660,8 @@ class Horde_iCalendar {
$value = $GLOBALS['egw']->translation->convert($value, $value = $GLOBALS['egw']->translation->convert($value,
empty($charset) ? ($this->isOldFormat() ? 'iso-8859-1' : 'utf-8') : $charset); empty($charset) ? ($this->isOldFormat() ? 'iso-8859-1' : 'utf-8') : $charset);
} }
// Funambol hack :-(
$value = str_replace('\\\\n', "\n", $value);
break; break;
case 'B': case 'B':
case 'BASE64': case 'BASE64':