2005-11-09 00:15:14 +01:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* eGroupWare - iCalendar Parser *
|
|
|
|
* http://www.egroupware.org *
|
|
|
|
* Written by Lars Kneschke <lkneschke@egroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
require_once EGW_SERVER_ROOT.'/calendar/inc/class.bocalupdate.inc.php';
|
|
|
|
require_once EGW_SERVER_ROOT.'/phpgwapi/inc/horde/Horde/iCalendar.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* iCal import and export via Horde iCalendar classes
|
|
|
|
*
|
|
|
|
* @package calendar
|
|
|
|
* @author Lars Kneschke <lkneschke@egroupware.org>
|
|
|
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
*/
|
|
|
|
class boical extends bocalupdate
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var array $supportedFields array containing the supported fields of the importing device
|
|
|
|
*/
|
|
|
|
var $supportedFields;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-03-09 17:49:56 +01:00
|
|
|
var $recur_days_1_0 = array(
|
|
|
|
MCAL_M_MONDAY => 'MO',
|
|
|
|
MCAL_M_TUESDAY => 'TU',
|
|
|
|
MCAL_M_WEDNESDAY => 'WE',
|
|
|
|
MCAL_M_THURSDAY => 'TH',
|
|
|
|
MCAL_M_FRIDAY => 'FR',
|
|
|
|
MCAL_M_SATURDAY => 'SA',
|
|
|
|
MCAL_M_SUNDAY => 'SU',
|
|
|
|
);
|
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
/**
|
|
|
|
* @var array $status_egw2ical conversation of the participant status egw => ical
|
|
|
|
*/
|
|
|
|
var $status_egw2ical = array(
|
|
|
|
'U' => 'NEEDS-ACTION',
|
|
|
|
'A' => 'ACCEPTED',
|
|
|
|
'R' => 'DECLINED',
|
|
|
|
'T' => 'TENTATIVE',
|
|
|
|
);
|
|
|
|
/**
|
|
|
|
* @var array conversation of the participant status ical => egw
|
|
|
|
*/
|
|
|
|
var $status_ical2egw = array(
|
|
|
|
'NEEDS-ACTION' => 'U',
|
|
|
|
'ACCEPTED' => 'A',
|
|
|
|
'DECLINED' => 'R',
|
|
|
|
'TENTATIVE' => 'T',
|
|
|
|
);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
/**
|
|
|
|
* @var array $status_ical2egw conversation of the priority egw => ical
|
|
|
|
*/
|
|
|
|
var $priority_egw2ical = array(
|
|
|
|
0 => 0, // undefined
|
|
|
|
1 => 9, // low
|
|
|
|
2 => 5, // normal
|
|
|
|
3 => 1, // high
|
|
|
|
);
|
|
|
|
/**
|
|
|
|
* @var array $status_ical2egw conversation of the priority ical => egw
|
|
|
|
*/
|
|
|
|
var $priority_ical2egw = array(
|
|
|
|
0 => 0, // undefined
|
|
|
|
9 => 1, 8 => 1, 7 => 1, 6 => 1, // low
|
|
|
|
5 => 2, // normal
|
2006-07-15 01:24:56 +02:00
|
|
|
4 => 3, 2 => 3, 3 => 3, 1 => 3, // high
|
2005-11-09 00:15:14 +01:00
|
|
|
);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
/**
|
2006-03-09 17:49:56 +01:00
|
|
|
* @var array $recur_egw2ical_2_0 converstaion of egw recur-type => ical FREQ
|
2005-11-09 00:15:14 +01:00
|
|
|
*/
|
2006-03-09 17:49:56 +01:00
|
|
|
var $recur_egw2ical_2_0 = array(
|
2005-11-09 00:15:14 +01:00
|
|
|
MCAL_RECUR_DAILY => 'DAILY',
|
|
|
|
MCAL_RECUR_WEEKLY => 'WEEKLY',
|
|
|
|
MCAL_RECUR_MONTHLY_MDAY => 'MONTHLY', // BYMONHTDAY={1..31}
|
|
|
|
MCAL_RECUR_MONTHLY_WDAY => 'MONTHLY', // BYDAY={1..5}{MO..SO}
|
|
|
|
MCAL_RECUR_YEARLY => 'YEARLY',
|
|
|
|
);
|
|
|
|
|
2006-03-09 17:49:56 +01:00
|
|
|
/**
|
|
|
|
* @var array $recur_egw2ical_1_0 converstaion of egw recur-type => ical FREQ
|
|
|
|
*/
|
|
|
|
var $recur_egw2ical_1_0 = array(
|
|
|
|
MCAL_RECUR_DAILY => 'D',
|
|
|
|
MCAL_RECUR_WEEKLY => 'W',
|
|
|
|
MCAL_RECUR_MONTHLY_MDAY => 'MD', // BYMONHTDAY={1..31}
|
|
|
|
MCAL_RECUR_MONTHLY_WDAY => 'MP', // BYDAY={1..5}{MO..SO}
|
|
|
|
MCAL_RECUR_YEARLY => 'YM',
|
|
|
|
);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-07-15 01:24:56 +02:00
|
|
|
/**
|
|
|
|
* manufacturer and name of the sync-client
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
var $productManufacturer = 'file';
|
|
|
|
var $productName = '';
|
2006-03-09 17:49:56 +01:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
/**
|
|
|
|
* Exports one calendar event to an iCalendar item
|
|
|
|
*
|
|
|
|
* @param int/array $events (array of) cal_id or array of the events
|
2008-05-06 23:05:56 +02:00
|
|
|
* @param string $version='1.0' could be '2.0' too
|
2005-11-09 00:15:14 +01:00
|
|
|
* @param string $method='PUBLISH'
|
2008-05-06 23:05:56 +02:00
|
|
|
* @param boolean $force_own_uid=true ignore the stored and maybe from the client transfered uid and generate a new one
|
|
|
|
* RalfBecker: GroupDAV/CalDAV requires to switch that non RFC conform behavior off, dont know if SyncML still needs it
|
2005-11-09 00:15:14 +01:00
|
|
|
* @return string/boolean string with vCal or false on error (eg. no permission to read the event)
|
|
|
|
*/
|
2008-05-06 23:05:56 +02:00
|
|
|
function &exportVCal($events,$version='1.0', $method='PUBLISH',$force_own_uid=true)
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
|
|
|
$egwSupportedFields = array(
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
'CLASS' => array('dbName' => 'public'),
|
|
|
|
'SUMMARY' => array('dbName' => 'title'),
|
2005-11-09 00:15:14 +01:00
|
|
|
'DESCRIPTION' => array('dbName' => 'description'),
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
'LOCATION' => array('dbName' => 'location'),
|
|
|
|
'DTSTART' => array('dbName' => 'start'),
|
|
|
|
'DTEND' => array('dbName' => 'end'),
|
|
|
|
'ORGANIZER' => array('dbName' => 'owner'),
|
|
|
|
'ATTENDEE' => array('dbName' => 'participants'),
|
|
|
|
'RRULE' => array('dbName' => 'recur_type'),
|
|
|
|
'EXDATE' => array('dbName' => 'recur_exception'),
|
|
|
|
'PRIORITY' => array('dbName' => 'priority'),
|
|
|
|
'TRANSP' => array('dbName' => 'non_blocking'),
|
2006-03-09 17:49:56 +01:00
|
|
|
'CATEGORIES' => array('dbName' => 'category'),
|
2005-11-09 00:15:14 +01:00
|
|
|
);
|
|
|
|
if(!is_array($this->supportedFields))
|
|
|
|
{
|
|
|
|
$this->setSupportedFields();
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
if($this->productManufacturer == '' )
|
|
|
|
{ // syncevolution is broken
|
|
|
|
$version = "2.0";
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$palm_enddate_workaround=False;
|
|
|
|
if($this->productManufacturer == 'Synthesis AG'
|
|
|
|
&& strpos($this->productName, "PalmOS") )
|
|
|
|
{
|
|
|
|
// This workaround adds 1 day to the recur_enddate if it exists, to fix a palm bug
|
|
|
|
$palm_enddate_workaround=True;
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
$vcal = &new Horde_iCalendar;
|
|
|
|
$vcal->setAttribute('PRODID','-//eGroupWare//NONSGML eGroupWare Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'.
|
|
|
|
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
|
2005-11-18 15:47:27 +01:00
|
|
|
$vcal->setAttribute('VERSION',$version);
|
2005-11-09 00:15:14 +01:00
|
|
|
$vcal->setAttribute('METHOD',$method);
|
|
|
|
|
|
|
|
if (!is_array($events)) $events = array($events);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
foreach($events as $event)
|
|
|
|
{
|
|
|
|
if (!is_array($event) && !($event = $this->read($event,null,false,'server'))) // server = timestamp in server-time(!)
|
|
|
|
{
|
|
|
|
return false; // no permission to read $cal_id
|
|
|
|
}
|
|
|
|
//_debug_array($event);
|
2007-01-23 18:34:50 +01:00
|
|
|
|
|
|
|
// correct daylight saving time
|
2007-10-10 17:10:34 +02:00
|
|
|
/* causes times wrong by one hour, if exporting events with DST different from the current date,
|
|
|
|
which this fix is suppost to fix. Maybe the problem has been fixed in the horde code too.
|
2007-01-23 18:34:50 +01:00
|
|
|
$currentDST = date('I', mktime());
|
|
|
|
$eventDST = date('I', $event['start']);
|
|
|
|
$DSTCorrection = ($currentDST - $eventDST) * 3600;
|
|
|
|
$event['start'] = $event['start'] + $DSTCorrection;
|
|
|
|
$event['end'] = $event['end'] + $DSTCorrection;
|
2007-10-10 17:10:34 +02:00
|
|
|
*/
|
2005-11-09 00:15:14 +01:00
|
|
|
$eventGUID = $GLOBALS['egw']->common->generate_uid('calendar',$event['id']);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
$vevent = Horde_iCalendar::newComponent('VEVENT',$vcal);
|
|
|
|
$parameters = $attributes = array();
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
foreach($egwSupportedFields as $icalFieldName => $egwFieldInfo)
|
|
|
|
{
|
|
|
|
if($this->supportedFields[$egwFieldInfo['dbName']])
|
|
|
|
{
|
|
|
|
switch($icalFieldName)
|
|
|
|
{
|
|
|
|
case 'ATTENDEE':
|
|
|
|
foreach((array)$event['participants'] as $uid => $status)
|
|
|
|
{
|
|
|
|
// ToDo, this needs to deal with resources too!!!
|
|
|
|
if (!is_numeric($uid)) continue;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
$mailto = $GLOBALS['egw']->accounts->id2name($uid,'account_email');
|
|
|
|
$cn = trim($GLOBALS['egw']->accounts->id2name($uid,'account_firstname'). ' ' .
|
|
|
|
$GLOBALS['egw']->accounts->id2name($uid,'account_lastname'));
|
2006-06-29 07:25:22 +02:00
|
|
|
$attributes['ATTENDEE'][] = $mailto ? 'MAILTO:'. $cn .'<'. $mailto .'>' : '';
|
2005-11-09 00:15:14 +01:00
|
|
|
// ROLE={CHAIR|REQ-PARTICIPANT|OPT-PARTICIPANT|NON-PARTICIPANT} NOT used by eGW atm.
|
|
|
|
$role = $uid == $event['owner'] ? 'CHAIR' : 'REQ-PARTICIPANT';
|
|
|
|
// RSVP={TRUE|FALSE} // resonse expected, not set in eGW => status=U
|
|
|
|
$rsvp = $status == 'U' ? 'TRUE' : 'FALSE';
|
|
|
|
// PARTSTAT={NEEDS-ACTION|ACCEPTED|DECLINED|TENTATIVE|DELEGATED|COMPLETED|IN-PROGRESS} everything from delegated is NOT used by eGW atm.
|
|
|
|
$status = $this->status_egw2ical[$status];
|
|
|
|
// CUTYPE={INDIVIDUAL|GROUP|RESOURCE|ROOM|UNKNOWN}
|
2007-10-02 14:01:35 +02:00
|
|
|
switch (is_numeric($uid) ? $GLOBALS['egw']->accounts->get_type($uid) : $uid{0})
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
{
|
|
|
|
case 'g':
|
|
|
|
$cutype = 'GROUP';
|
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
$cutype = 'RESOURCE';
|
|
|
|
break;
|
|
|
|
case 'u':
|
|
|
|
$cutype = 'INDIVIDUAL';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$cutype = 'UNKNOWN';
|
|
|
|
$cutype = 'INDIVIDUAL';
|
|
|
|
break;
|
|
|
|
};
|
2005-11-09 00:15:14 +01:00
|
|
|
$parameters['ATTENDEE'][] = array(
|
2008-05-06 23:05:56 +02:00
|
|
|
'CN' => $cn,
|
|
|
|
'ROLE' => $role,
|
|
|
|
'PARTSTAT' => $status,
|
2005-11-09 00:15:14 +01:00
|
|
|
'CUTYPE' => $cutype,
|
|
|
|
'RSVP' => $rsvp,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-12-25 17:41:35 +01:00
|
|
|
case 'CLASS':
|
|
|
|
$attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'PRIVATE';
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-12-25 17:41:35 +01:00
|
|
|
case 'ORGANIZER': // according to iCalendar standard, ORGANIZER not used for events in the own calendar
|
|
|
|
if (!isset($event['participants'][$event['owner']]) || count($event['participants']) > 1)
|
|
|
|
{
|
2005-11-09 00:15:14 +01:00
|
|
|
$mailtoOrganizer = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_email');
|
|
|
|
$attributes['ORGANIZER'] = $mailtoOrganizer ? 'MAILTO:'.$mailtoOrganizer : '';
|
|
|
|
$parameters['ORGANIZER']['CN'] = trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname').' '.
|
|
|
|
$GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname'));
|
2005-12-25 17:41:35 +01:00
|
|
|
}
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
case 'DTEND':
|
|
|
|
if(date('H:i:s',$event['end']) == '23:59:59') $event['end']++;
|
2007-10-10 09:03:58 +02:00
|
|
|
if(date('H:i:s',$event['end']) == '23:59:00') $event['end']+=60; // needed by old eGW whole-day events
|
2005-12-25 17:41:35 +01:00
|
|
|
$attributes[$icalFieldName] = $event['end'];
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-12-25 17:41:35 +01:00
|
|
|
case 'RRULE':
|
|
|
|
if ($event['recur_type'] == MCAL_RECUR_NONE) break; // no recuring event
|
2006-03-09 17:49:56 +01:00
|
|
|
if ($version == '1.0') {
|
|
|
|
$interval = ($event['recur_interval'] > 1) ? $event['recur_interval'] : 1;
|
|
|
|
$rrule = array('FREQ' => $this->recur_egw2ical_1_0[$event['recur_type']].$interval);
|
|
|
|
switch ($event['recur_type'])
|
|
|
|
{
|
|
|
|
case MCAL_RECUR_WEEKLY:
|
|
|
|
$days = array();
|
|
|
|
foreach($this->recur_days_1_0 as $id => $day)
|
|
|
|
{
|
|
|
|
if ($event['recur_data'] & $id) $days[] = strtoupper(substr($day,0,2));
|
|
|
|
}
|
|
|
|
$rrule['BYDAY'] = implode(' ',$days);
|
|
|
|
$rrule['FREQ'] = $rrule['FREQ'].' '.$rrule['BYDAY'];
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-03-09 17:49:56 +01:00
|
|
|
case MCAL_RECUR_MONTHLY_MDAY: // date of the month: BYMONTDAY={1..31}
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-03-09 17:49:56 +01:00
|
|
|
case MCAL_RECUR_MONTHLY_WDAY: // weekday of the month: BDAY={1..5}{MO..SO}
|
|
|
|
$rrule['BYDAY'] = (1 + (int) ((date('d',$event['start'])-1) / 7)).'+ '.
|
|
|
|
strtoupper(substr(date('l',$event['start']),0,2));
|
|
|
|
$rrule['FREQ'] = $rrule['FREQ'].' '.$rrule['BYDAY'];
|
|
|
|
break;
|
|
|
|
}
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|
|
|
|
if ($event['recur_enddate'])
|
|
|
|
{
|
|
|
|
$recur_enddate = (int)$event['recur_enddate'];
|
|
|
|
if ($palm_enddate_workaround)
|
|
|
|
{
|
|
|
|
$recur_enddate += 86400;
|
|
|
|
}
|
2008-02-28 12:11:34 +01:00
|
|
|
# append T and the Endtime, since the RRULE seems not to be understood by the client without it
|
|
|
|
$rrule['UNTIL'] = date('Ymd',$recur_enddate).'T'.date('His',($event['end']?$event['end']:$event['start'])) ;
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$rrule['UNTIL'] = '#0';
|
|
|
|
}
|
2006-03-09 17:49:56 +01:00
|
|
|
|
|
|
|
$attributes['RRULE'] = $rrule['FREQ'].' '.$rrule['UNTIL'];
|
|
|
|
} else {
|
|
|
|
$rrule = array('FREQ' => $this->recur_egw2ical_2_0[$event['recur_type']]);
|
|
|
|
switch ($event['recur_type'])
|
|
|
|
{
|
|
|
|
case MCAL_RECUR_WEEKLY:
|
|
|
|
$days = array();
|
|
|
|
foreach($this->recur_days as $id => $day)
|
|
|
|
{
|
|
|
|
if ($event['recur_data'] & $id) $days[] = strtoupper(substr($day,0,2));
|
|
|
|
}
|
|
|
|
$rrule['BYDAY'] = implode(',',$days);
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-03-09 17:49:56 +01:00
|
|
|
case MCAL_RECUR_MONTHLY_MDAY: // date of the month: BYMONTDAY={1..31}
|
|
|
|
$rrule['BYMONTHDAY'] = (int) date('d',$event['start']);
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-03-09 17:49:56 +01:00
|
|
|
case MCAL_RECUR_MONTHLY_WDAY: // weekday of the month: BDAY={1..5}{MO..SO}
|
|
|
|
$rrule['BYDAY'] = (1 + (int) ((date('d',$event['start'])-1) / 7)).
|
|
|
|
strtoupper(substr(date('l',$event['start']),0,2));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ($event['recur_interval'] > 1) $rrule['INTERVAL'] = $event['recur_interval'];
|
|
|
|
if ($event['recur_enddate']) $rrule['UNTIL'] = date('Ymd',$event['recur_enddate']); // only day is set in eGW
|
|
|
|
|
|
|
|
// no idea how to get the Horde parser to produce a standard conformant
|
|
|
|
// RRULE:FREQ=... (note the double colon after RRULE, we cant use the $parameter array)
|
|
|
|
// so we create one value manual ;-)
|
|
|
|
foreach($rrule as $name => $value)
|
|
|
|
{
|
|
|
|
$attributes['RRULE'][] = $name . '=' . $value;
|
|
|
|
}
|
|
|
|
$attributes['RRULE'] = implode(';',$attributes['RRULE']);
|
2005-12-25 17:41:35 +01:00
|
|
|
}
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-12-25 17:41:35 +01:00
|
|
|
case 'EXDATE':
|
|
|
|
if ($event['recur_exception'])
|
|
|
|
{
|
|
|
|
$days = array();
|
|
|
|
foreach($event['recur_exception'] as $day)
|
|
|
|
{
|
|
|
|
$days[] = date('Ymd',$day);
|
|
|
|
}
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$attributes['EXDATE'] = implode(',',$days);
|
2005-12-25 17:41:35 +01:00
|
|
|
$parameters['EXDATE']['VALUE'] = 'DATE';
|
|
|
|
}
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-12-25 17:41:35 +01:00
|
|
|
case 'PRIORITY':
|
2005-11-09 00:15:14 +01:00
|
|
|
$attributes['PRIORITY'] = (int) $this->priority_egw2ical[$event['priority']];
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
case 'TRANSP':
|
2006-08-24 11:46:22 +02:00
|
|
|
if ($version == '1.0') {
|
|
|
|
$attributes['TRANSP'] = $event['non_blocking'] ? 1 : 0;
|
|
|
|
} else {
|
|
|
|
$attributes['TRANSP'] = $event['non_blocking'] ? 'TRANSPARENT' : 'OPAQUE';
|
|
|
|
}
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
case 'CATEGORIES':
|
|
|
|
if ($event['category'])
|
|
|
|
{
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$attributes['CATEGORIES'] = implode(',',$this->get_categories($event['category']));
|
2005-11-09 00:15:14 +01:00
|
|
|
}
|
|
|
|
break;
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|
2005-12-25 17:41:35 +01:00
|
|
|
default:
|
|
|
|
if ($event[$egwFieldInfo['dbName']]) // dont write empty fields
|
|
|
|
{
|
|
|
|
$attributes[$icalFieldName] = $event[$egwFieldInfo['dbName']];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-08-31 05:08:23 +02:00
|
|
|
if(strtolower($this->productManufacturer) == 'nokia') {
|
|
|
|
if($event['special'] == '1') {
|
|
|
|
$attributes['X-EPOCAGENDAENTRYTYPE'] = 'ANNIVERSARY';
|
|
|
|
$attributes['DTEND'] = $attributes['DTSTART'];
|
|
|
|
} else {
|
|
|
|
$attributes['X-EPOCAGENDAENTRYTYPE'] = 'APPOINTMENT';
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
$modified = $GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'modify');
|
|
|
|
$created = $GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'add');
|
|
|
|
if (!$created && !$modified) $created = $event['modified'];
|
|
|
|
if ($created) $attributes['CREATED'] = $created;
|
|
|
|
if (!$modified) $modified = $event['modified'];
|
|
|
|
if ($modified) $attributes['LAST-MODIFIED'] = $modified;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-01-11 06:10:52 +01:00
|
|
|
foreach($event['alarm'] as $alarmID => $alarmData)
|
|
|
|
{
|
2008-03-27 09:29:54 +01:00
|
|
|
if ($version == '1.0')
|
|
|
|
{
|
|
|
|
$attributes['DALARM'] = $vcal->_exportDateTime($alarmData['time']);
|
|
|
|
$attributes['AALARM'] = $vcal->_exportDateTime($alarmData['time']);
|
|
|
|
// lets take only the first alarm
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// VCalendar 2.0 / RFC 2445
|
|
|
|
|
|
|
|
// skip over alarms that don't have the minimum required info
|
|
|
|
if (!$alarmData['offset'] && !$alarmData['time'])
|
|
|
|
{
|
|
|
|
error_log("Couldn't add VALARM (no alarm time info)");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// RFC requires DESCRIPTION for DISPLAY
|
|
|
|
if (!$event['title'] && !$event['description'])
|
|
|
|
{
|
|
|
|
error_log("Couldn't add VALARM (no description)");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$valarm = Horde_iCalendar::newComponent('VALARM',$vevent);
|
|
|
|
if ($alarmData['offset'])
|
|
|
|
{
|
|
|
|
$valarm->setAttribute('TRIGGER', -$alarmData['offset'],
|
|
|
|
array('VALUE' => 'DURATION', 'RELATED' => 'START'));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$valarm->setAttribute('TRIGGER', $alarmData['time'],
|
|
|
|
array('VALUE' => 'DATE-TIME'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$valarm->setAttribute('ACTION','DISPLAY');
|
|
|
|
$valarm->setAttribute('DESCRIPTION',$event['title'] ? $event['title'] : $event['description']);
|
|
|
|
$vevent->addComponent($valarm);
|
|
|
|
}
|
2006-01-11 06:10:52 +01:00
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
|
|
|
$attributes['UID'] = $force_own_uid ? $eventGUID : $event['uid'];
|
2006-07-15 01:24:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
foreach($attributes as $key => $value)
|
|
|
|
{
|
|
|
|
foreach(is_array($value) ? $value : array($value) as $valueID => $valueData)
|
|
|
|
{
|
|
|
|
$valueData = $GLOBALS['egw']->translation->convert($valueData,$GLOBALS['egw']->translation->charset(),'UTF-8');
|
|
|
|
$paramData = (array) $GLOBALS['egw']->translation->convert(is_array($value) ? $parameters[$key][$valueID] : $parameters[$key],
|
|
|
|
$GLOBALS['egw']->translation->charset(),'UTF-8');
|
|
|
|
//echo "$key:$valueID: value=$valueData, param=".print_r($paramDate,true)."\n";
|
|
|
|
$vevent->setAttribute($key, $valueData, $paramData);
|
|
|
|
$options = array();
|
|
|
|
if($key != 'RRULE' && preg_match('/([\000-\012\015\016\020-\037\075])/',$valueData))
|
|
|
|
{
|
|
|
|
$options['ENCODING'] = 'QUOTED-PRINTABLE';
|
|
|
|
}
|
|
|
|
if(preg_match('/([\177-\377])/',$valueData))
|
|
|
|
{
|
|
|
|
$options['CHARSET'] = 'UTF-8';
|
|
|
|
}
|
|
|
|
$vevent->setParameter($key, $options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$vcal->addComponent($vevent);
|
|
|
|
}
|
|
|
|
//_debug_array($vcal->exportvCalendar());
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
return $vcal->exportvCalendar();
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-24 09:46:53 +01:00
|
|
|
function importVCal($_vcalData, $cal_id=-1)
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
2005-11-24 09:46:53 +01:00
|
|
|
// our (patched) horde classes, do NOT unfold folded lines, which causes a lot trouble in the import
|
|
|
|
$_vcalData = preg_replace("/[\r\n]+ /",'',$_vcalData);
|
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
$vcal = &new Horde_iCalendar;
|
2006-08-24 11:46:22 +02:00
|
|
|
if(!$vcal->parsevCalendar($_vcalData)) {
|
2005-11-09 00:15:14 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-08-24 11:46:22 +02:00
|
|
|
$version = $vcal->getAttribute('VERSION');
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
if(!is_array($this->supportedFields))
|
|
|
|
{
|
|
|
|
$this->setSupportedFields();
|
|
|
|
}
|
|
|
|
//echo "supportedFields="; _debug_array($this->supportedFields);
|
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$syncevo_enddate_fix = False;
|
|
|
|
if( $this->productManufacturer == '' && $this->productName == '' )
|
|
|
|
{
|
|
|
|
// syncevolution needs an adjusted recur_enddate
|
|
|
|
$syncevo_enddate_fix = True;
|
|
|
|
}
|
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
$Ok = false; // returning false, if file contains no components
|
|
|
|
foreach($vcal->getComponents() as $component)
|
|
|
|
{
|
|
|
|
if(is_a($component, 'Horde_iCalendar_vevent'))
|
|
|
|
{
|
|
|
|
$supportedFields = $this->supportedFields;
|
2006-01-10 14:53:23 +01:00
|
|
|
#$event = array('participants' => array());
|
|
|
|
$event = array();
|
|
|
|
$alarms = array();
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$vcardData = array(
|
|
|
|
'recur_type' => MCAL_RECUR_NONE,
|
|
|
|
'recur_exception' => array(),
|
|
|
|
);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
// lets see what we can get from the vcard
|
2008-05-06 23:05:56 +02:00
|
|
|
foreach($component->_attributes as $attributes)
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
2008-05-06 23:05:56 +02:00
|
|
|
switch($attributes['name'])
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
2006-01-10 14:53:23 +01:00
|
|
|
case 'AALARM':
|
|
|
|
case 'DALARM':
|
2006-06-01 15:25:16 +02:00
|
|
|
if (preg_match('/.*Z$/',$attributes['value'],$matches)) {
|
2006-01-10 14:53:23 +01:00
|
|
|
$alarmTime = $vcal->_parseDateTime($attributes['value']);
|
|
|
|
$alarms[$alarmTime] = array(
|
|
|
|
'time' => $alarmTime
|
|
|
|
);
|
2006-08-15 16:29:45 +02:00
|
|
|
} elseif (preg_match('/(........T......);;(\d*);$/',$attributes['value'],$matches)) {
|
|
|
|
//error_log(print_r($matches,true));
|
|
|
|
$alarmTime = $vcal->_parseDateTime($matches[1]);
|
|
|
|
$alarms[$alarmTime] = array(
|
|
|
|
'time' => $alarmTime
|
|
|
|
);
|
|
|
|
} elseif (preg_match('/(........T......Z);;(\d*);$/',$attributes['value'],$matches)) {
|
|
|
|
//error_log(print_r($matches,true));
|
2006-06-01 15:25:16 +02:00
|
|
|
$alarmTime = $vcal->_parseDateTime($matches[1]);
|
|
|
|
$alarms[$alarmTime] = array(
|
|
|
|
'time' => $alarmTime
|
|
|
|
);
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
} elseif (preg_match('/(........T......)$/',$attributes['value'],$matches)) {
|
|
|
|
$alarmTime = $vcal->_parseDateTime($attributes['value']);
|
|
|
|
$alarms[$alarmTime] = array(
|
|
|
|
'time' => $alarmTime
|
|
|
|
);
|
2006-01-10 14:53:23 +01:00
|
|
|
}
|
|
|
|
break;
|
2005-11-09 00:15:14 +01:00
|
|
|
case 'CLASS':
|
|
|
|
$vcardData['public'] = (int)(strtolower($attributes['value']) == 'public');
|
|
|
|
break;
|
|
|
|
case 'DESCRIPTION':
|
|
|
|
$vcardData['description'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
case 'DTEND':
|
2006-11-03 14:17:00 +01:00
|
|
|
$dtend_ts = is_numeric($attributes['value']) ? $attributes['value'] : $this->date2ts($attributes['value']);
|
|
|
|
if(date('H:i:s',$dtend_ts) == '00:00:00') {
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$dtend_ts -= 60;
|
2006-11-03 14:17:00 +01:00
|
|
|
}
|
|
|
|
$vcardData['end'] = $dtend_ts;
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
|
|
|
case 'DTSTART':
|
|
|
|
$vcardData['start'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
case 'LOCATION':
|
|
|
|
$vcardData['location'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
case 'RRULE':
|
2005-11-24 09:46:53 +01:00
|
|
|
$recurence = $attributes['value'];
|
|
|
|
$type = preg_match('/FREQ=([^;: ]+)/i',$recurence,$matches) ? $matches[1] : $recurence{0};
|
|
|
|
// vCard 2.0 values for all types
|
|
|
|
if (preg_match('/UNTIL=([0-9T]+)/',$recurence,$matches))
|
|
|
|
{
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($matches[1]);
|
|
|
|
}
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
elseif (preg_match('/COUNT=([0-9]+)/',$recurence,$matches))
|
|
|
|
{
|
|
|
|
$vcardData['recur_count'] = (int)$matches[1];
|
|
|
|
}
|
2005-11-24 09:46:53 +01:00
|
|
|
if (preg_match('/INTERVAL=([0-9]+)/',$recurence,$matches))
|
|
|
|
{
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
// 1 is invalid,, egw uses 0 for interval
|
|
|
|
$vcardData['recur_interval'] = (int) $matches[1] != 0 ? (int) $matches[1] : 0;
|
2005-11-24 09:46:53 +01:00
|
|
|
}
|
2005-12-25 17:41:35 +01:00
|
|
|
$vcardData['recur_data'] = 0;
|
2005-11-24 09:46:53 +01:00
|
|
|
switch($type)
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
|
|
|
case 'W':
|
2005-11-24 09:46:53 +01:00
|
|
|
case 'WEEKLY':
|
|
|
|
$days = array();
|
|
|
|
if(preg_match('/W(\d+) (.*) (.*)/',$recurence, $recurenceMatches)) // 1.0
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
2005-11-24 09:46:53 +01:00
|
|
|
$days = explode(' ',trim($recurenceMatches[2]));
|
2006-03-09 17:49:56 +01:00
|
|
|
if($recurenceMatches[3] != '#0')
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[3]);
|
|
|
|
$recur_days = $this->recur_days_1_0;
|
2005-11-09 00:15:14 +01:00
|
|
|
}
|
2005-11-24 09:46:53 +01:00
|
|
|
elseif (preg_match('/BYDAY=([^;: ]+)/',$recurence,$recurenceMatches)) // 2.0
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
2006-03-09 17:49:56 +01:00
|
|
|
$days = explode(',',$recurenceMatches[1]);
|
|
|
|
$recur_days = $this->recur_days;
|
2005-11-24 09:46:53 +01:00
|
|
|
}
|
|
|
|
if ($days)
|
|
|
|
{
|
2006-03-09 17:49:56 +01:00
|
|
|
foreach($recur_days as $id => $day)
|
|
|
|
{
|
|
|
|
if (in_array(strtoupper(substr($day,0,2)),$days))
|
|
|
|
{
|
|
|
|
$vcardData['recur_data'] |= $id;
|
|
|
|
}
|
|
|
|
}
|
2005-11-24 09:46:53 +01:00
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_WEEKLY;
|
2005-11-09 00:15:14 +01:00
|
|
|
}
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|
|
|
|
if (!empty($vcardData['recur_count']))
|
|
|
|
{
|
|
|
|
$vcardData['recur_enddate'] = mktime(0,0,0,
|
|
|
|
date('m',$vcardData['start']),
|
|
|
|
date('d',$vcardData['start']) + ($vcardData['recur_interval']*($vcardData['recur_count']-1)*7),
|
|
|
|
date('Y',$vcardData['start']));
|
|
|
|
}
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-07-20 09:59:53 +02:00
|
|
|
case 'D': // 1.0
|
|
|
|
if(preg_match('/D(\d+) #(.\d)/', $recurence, $recurenceMatches)) {
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[2] > 0 && $vcardData['end']) {
|
|
|
|
$vcardData['recur_enddate'] = mktime(
|
|
|
|
date('H', $vcardData['end']),
|
|
|
|
date('i', $vcardData['end']),
|
|
|
|
date('s', $vcardData['end']),
|
|
|
|
date('m', $vcardData['end']),
|
|
|
|
date('d', $vcardData['end']) + ($recurenceMatches[2] * $vcardData['recur_interval']),
|
2006-07-22 13:25:24 +02:00
|
|
|
date('Y', $vcardData['end'])
|
2006-07-20 09:59:53 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
} elseif(preg_match('/D(\d+) (.*)/', $recurence, $recurenceMatches)) {
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[2] != '#0') {
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
2005-11-24 09:46:53 +01:00
|
|
|
// fall-through
|
|
|
|
case 'DAILY': // 2.0
|
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_DAILY;
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|
|
|
|
if (!empty($vcardData['recur_count']))
|
|
|
|
{
|
|
|
|
$vcardData['recur_enddate'] = mktime(0,0,0,
|
|
|
|
date('m',$vcardData['start']),
|
|
|
|
date('d',$vcardData['start']) + ($vcardData['recur_interval']*($vcardData['recur_count']-1)),
|
|
|
|
date('Y',$vcardData['start']));
|
|
|
|
}
|
2005-11-24 09:46:53 +01:00
|
|
|
break;
|
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
case 'M':
|
2006-07-20 09:59:53 +02:00
|
|
|
if(preg_match('/MD(\d+) #(.\d)/', $recurence, $recurenceMatches)) {
|
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_MDAY;
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[2] > 0 && $vcardData['end']) {
|
|
|
|
$vcardData['recur_enddate'] = mktime(
|
|
|
|
date('H', $vcardData['end']),
|
|
|
|
date('i', $vcardData['end']),
|
|
|
|
date('s', $vcardData['end']),
|
|
|
|
date('m', $vcardData['end']) + ($recurenceMatches[2] * $vcardData['recur_interval']),
|
|
|
|
date('d', $vcardData['end']),
|
2006-07-22 13:25:24 +02:00
|
|
|
date('Y', $vcardData['end'])
|
2006-07-20 09:59:53 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
} elseif(preg_match('/MD(\d+) (.*)/',$recurence, $recurenceMatches)) {
|
2005-11-09 00:15:14 +01:00
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_MDAY;
|
2006-03-09 17:49:56 +01:00
|
|
|
if($recurenceMatches[1] > 1)
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[2] != '#0')
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
2006-07-20 09:59:53 +02:00
|
|
|
} elseif(preg_match('/MP(\d+) (.*) (.*) (.*)/',$recurence, $recurenceMatches)) {
|
2005-11-09 00:15:14 +01:00
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_WDAY;
|
2006-03-09 17:49:56 +01:00
|
|
|
if($recurenceMatches[1] > 1)
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[4] != '#0')
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[4]);
|
2005-11-09 00:15:14 +01:00
|
|
|
}
|
|
|
|
break;
|
2005-11-24 09:46:53 +01:00
|
|
|
case 'MONTHLY':
|
2008-05-06 23:05:56 +02:00
|
|
|
$vcardData['recur_type'] = strpos($recurence,'BYDAY') !== false ?
|
2005-11-24 09:46:53 +01:00
|
|
|
MCAL_RECUR_MONTHLY_WDAY : MCAL_RECUR_MONTHLY_MDAY;
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|
|
|
|
if (!empty($vcardData['recur_count']))
|
|
|
|
{
|
|
|
|
$vcardData['recur_enddate'] = mktime(0,0,0,
|
|
|
|
date('m',$vcardData['start']) + ($vcardData['recur_interval']*($vcardData['recur_count']-1)),
|
|
|
|
date('d',$vcardData['start']),
|
|
|
|
date('Y',$vcardData['start']));
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
break;
|
2005-11-24 09:46:53 +01:00
|
|
|
|
|
|
|
case 'Y': // 1.0
|
2006-07-20 09:59:53 +02:00
|
|
|
if(preg_match('/YM(\d+) #(.\d)/', $recurence, $recurenceMatches)) {
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[2] > 0 && $vcardData['end']) {
|
|
|
|
$vcardData['recur_enddate'] = mktime(
|
|
|
|
date('H', $vcardData['end']),
|
|
|
|
date('i', $vcardData['end']),
|
|
|
|
date('s', $vcardData['end']),
|
|
|
|
date('m', $vcardData['end']),
|
|
|
|
date('d', $vcardData['end']),
|
2006-07-23 07:34:12 +02:00
|
|
|
date('Y', $vcardData['end']) + ($recurenceMatches[2] * $vcardData['recur_interval'])
|
2006-07-20 09:59:53 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
} elseif(preg_match('/YM(\d+) (.*)/',$recurence, $recurenceMatches)) {
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[2] != '#0') {
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
2005-11-24 09:46:53 +01:00
|
|
|
// fall-through
|
|
|
|
case 'YEARLY': // 2.0
|
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_YEARLY;
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
|
|
|
|
if (!empty($vcardData['recur_count']))
|
|
|
|
{
|
|
|
|
$vcardData['recur_enddate'] = mktime(0,0,0,
|
|
|
|
date('m',$vcardData['start']),
|
|
|
|
date('d',$vcardData['start']),
|
|
|
|
date('Y',$vcardData['start']) + ($vcardData['recur_interval']*($vcardData['recur_count']-1)));
|
|
|
|
}
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
|
|
|
}
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
if( $syncevo_enddate_fix && $vcardData['recur_enddate'] )
|
|
|
|
{
|
|
|
|
// Does syncevolution need to adjust recur_enddate
|
|
|
|
$vcardData['recur_enddate'] = (int)$vcardData['recur_enddate'] + 86400;
|
|
|
|
}
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
2005-12-25 17:41:35 +01:00
|
|
|
case 'EXDATE':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$vcardData['recur_exception'] = array_merge($vcardData['recur_exception'],$attributes['value']);
|
2005-12-25 17:41:35 +01:00
|
|
|
break;
|
2005-11-09 00:15:14 +01:00
|
|
|
case 'SUMMARY':
|
|
|
|
$vcardData['title'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
case 'UID':
|
|
|
|
$event['uid'] = $vcardData['uid'] = $attributes['value'];
|
|
|
|
if ($cal_id <= 0 && !empty($vcardData['uid']) && ($uid_event = $this->read($vcardData['uid'])))
|
|
|
|
{
|
|
|
|
$event['id'] = $uid_event['id'];
|
|
|
|
unset($uid_event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'TRANSP':
|
2006-10-29 13:49:05 +01:00
|
|
|
if($version == '1.0') {
|
2006-08-24 11:46:22 +02:00
|
|
|
$vcardData['non_blocking'] = $attributes['value'] == 1;
|
|
|
|
} else {
|
|
|
|
$vcardData['non_blocking'] = $attributes['value'] == 'TRANSPARENT';
|
|
|
|
}
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
2005-12-25 17:41:35 +01:00
|
|
|
case 'PRIORITY':
|
2005-11-09 00:15:14 +01:00
|
|
|
$vcardData['priority'] = (int) $this->priority_ical2egw[$attributes['value']];
|
|
|
|
break;
|
|
|
|
case 'CATEGORIES':
|
|
|
|
if ($attributes['value'])
|
|
|
|
{
|
2007-10-20 08:05:24 +02:00
|
|
|
$vcardData['category'] = $this->find_or_add_categories(explode(',',$attributes['value']));
|
2005-11-09 00:15:14 +01:00
|
|
|
}
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$vcardData['category'] = array();
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
break;
|
2005-11-09 00:15:14 +01:00
|
|
|
case 'ATTENDEE':
|
|
|
|
if (preg_match('/MAILTO:([@.a-z0-9_-]+)/i',$attributes['value'],$matches) &&
|
2005-11-24 09:46:53 +01:00
|
|
|
($uid = $GLOBALS['egw']->accounts->name2id($matches[1],'account_email')))
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
2005-11-24 09:46:53 +01:00
|
|
|
$event['participants'][$uid] = isset($attributes['params']['PARTSTAT']) ?
|
2008-05-06 23:05:56 +02:00
|
|
|
$this->status_ical2egw[strtoupper($attributes['params']['PARTSTAT'])] :
|
2005-11-24 09:46:53 +01:00
|
|
|
($uid == $event['owner'] ? 'A' : 'U');
|
2005-11-09 00:15:14 +01:00
|
|
|
}
|
2006-06-18 09:10:53 +02:00
|
|
|
|
|
|
|
if (preg_match('/<([@.a-z0-9_-]+)>/i',$attributes['value'],$matches)) {
|
|
|
|
$uid = '';
|
|
|
|
$uid = $GLOBALS['egw']->accounts->name2id($matches[1],'account_email');
|
|
|
|
if(!empty($uid)) {
|
|
|
|
$event['participants'][$uid] = isset($attributes['params']['PARTSTAT']) ?
|
2008-05-06 23:05:56 +02:00
|
|
|
$this->status_ical2egw[strtoupper($attributes['params']['PARTSTAT'])] :
|
2006-06-18 09:10:53 +02:00
|
|
|
($uid == $event['owner'] ? 'A' : 'U');
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-06-18 09:10:53 +02:00
|
|
|
if($attributes['value'] == 'Unknown') {
|
|
|
|
$event['participants'][$GLOBALS['egw_info']['user']['account_id']] = 'A';
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
|
|
|
case 'ORGANIZER': // will be written direct to the event
|
|
|
|
if (preg_match('/MAILTO:([@.a-z0-9_-]+)/i',$attributes['value'],$matches) &&
|
2005-11-24 09:46:53 +01:00
|
|
|
($uid = $GLOBALS['egw']->accounts->name2id($matches[1],'account_email')))
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
|
|
|
$event['owner'] = $uid;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'CREATED': // will be written direct to the event
|
|
|
|
if ($event['modified']) break;
|
|
|
|
// fall through
|
|
|
|
case 'LAST-MODIFIED': // will be written direct to the event
|
|
|
|
$event['modified'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-08-31 05:08:23 +02:00
|
|
|
|
2008-05-06 23:05:56 +02:00
|
|
|
// check if the entry is a birthday
|
2006-08-31 05:08:23 +02:00
|
|
|
// this field is only set from NOKIA clients
|
|
|
|
$agendaEntryType = $component->getAttribute('X-EPOCAGENDAENTRYTYPE');
|
|
|
|
if (!is_a($agendaEntryType, 'PEAR_Error')) {
|
|
|
|
if(strtolower($agendaEntryType) == 'anniversary') {
|
|
|
|
$event['special'] = '1';
|
|
|
|
// make it a whole day event for eGW
|
|
|
|
$vcardData['end'] = $vcardData['start'] + 86399;
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-03-09 17:49:56 +01:00
|
|
|
if(!empty($vcardData['recur_enddate']))
|
2006-01-16 10:40:20 +01:00
|
|
|
{
|
|
|
|
// reset recure_enddate to 00:00:00 on the last day
|
2008-05-06 23:05:56 +02:00
|
|
|
$vcardData['recur_enddate'] = mktime(0, 0, 0,
|
2006-01-16 10:40:20 +01:00
|
|
|
date('m',$vcardData['recur_enddate']),
|
|
|
|
date('d',$vcardData['recur_enddate']),
|
|
|
|
date('Y',$vcardData['recur_enddate'])
|
|
|
|
);
|
|
|
|
}
|
2005-11-24 09:46:53 +01:00
|
|
|
//echo "event=";_debug_array($vcardData);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
// now that we know what the vard provides, we merge that data with the information we have about the device
|
|
|
|
$event['priority'] = 2;
|
|
|
|
if($cal_id > 0)
|
|
|
|
{
|
|
|
|
$event['id'] = $cal_id;
|
|
|
|
}
|
2005-11-24 09:46:53 +01:00
|
|
|
while(($fieldName = array_shift($supportedFields)))
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
|
|
|
switch($fieldName)
|
|
|
|
{
|
2006-01-10 14:53:23 +01:00
|
|
|
case 'alarms':
|
|
|
|
// not handled here
|
|
|
|
break;
|
2005-11-09 00:15:14 +01:00
|
|
|
case 'recur_type':
|
|
|
|
$event['recur_type'] = $vcardData['recur_type'];
|
|
|
|
if ($event['recur_type'] != MCAL_RECUR_NONE)
|
|
|
|
{
|
|
|
|
foreach(array('recur_interval','recur_enddate','recur_data','recur_exception') as $r)
|
|
|
|
{
|
2005-11-24 09:46:53 +01:00
|
|
|
if(isset($vcardData[$r]))
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
|
|
|
$event[$r] = $vcardData[$r];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
unset($supportedFields['recur_type']);
|
|
|
|
unset($supportedFields['recur_interval']);
|
|
|
|
unset($supportedFields['recur_enddate']);
|
|
|
|
unset($supportedFields['recur_data']);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (isset($vcardData[$fieldName]))
|
|
|
|
{
|
|
|
|
$event[$fieldName] = $vcardData[$fieldName];
|
|
|
|
}
|
|
|
|
unset($supportedFields[$fieldName]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
// add ourself to new events as participant
|
|
|
|
if($cal_id == -1 && !isset($this->supportedFields['participants']))
|
|
|
|
{
|
|
|
|
$event['participants'] = array($GLOBALS['egw_info']['user']['account_id'] => 'A');
|
|
|
|
}
|
2006-06-01 15:25:16 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
// If this is an updated meeting, and the client doesn't support
|
|
|
|
// participants, add them back
|
|
|
|
if( $cal_id >0 && !isset($this->supportedFields['participants']))
|
|
|
|
{
|
|
|
|
$egw_event = $this->read($cal_id);
|
|
|
|
if ($egw_event)
|
|
|
|
{
|
|
|
|
$event['participants'] = $egw_event['participants'];
|
|
|
|
$event['participant_types'] = $egw_event['participant_types'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check for resources, and don't remove them
|
|
|
|
if( $cal_id > 0 )
|
|
|
|
{
|
|
|
|
// for each existing participant:
|
|
|
|
$egw_event = $this->read($cal_id);
|
|
|
|
if ( $egw_event )
|
2008-05-06 23:05:56 +02:00
|
|
|
{
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
foreach( $egw_event['participants'] as $uid => $status )
|
|
|
|
{
|
|
|
|
// Is it a resource?
|
|
|
|
if ( preg_match("/^r(.*)/", $uid, $matches) )
|
|
|
|
{
|
|
|
|
// Add it back in
|
|
|
|
$event['participants'][$uid] = 'A';
|
|
|
|
$event['participant_types']['r'][$matches[1]] = 'A';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-01 15:25:16 +02:00
|
|
|
#error_log('ALARMS');
|
2006-08-31 05:08:23 +02:00
|
|
|
#error_log(print_r($event, true));
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-01-10 14:53:23 +01:00
|
|
|
if (!($Ok = $this->update($event, TRUE))) {
|
|
|
|
break; // stop with the first error
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$eventID =& $Ok;
|
|
|
|
|
|
|
|
// handle the alarms
|
2008-03-27 09:29:54 +01:00
|
|
|
foreach ($component->getComponents() as $valarm)
|
|
|
|
{
|
|
|
|
if (is_a($valarm, 'Horde_iCalendar_valarm'))
|
|
|
|
{
|
|
|
|
$this->valarm2egw($alarms,$valarm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-10 14:53:23 +01:00
|
|
|
if(count($alarms) > 0 || (isset($this->supportedFields['alarms']) && count($alarms) == 0))
|
|
|
|
{
|
|
|
|
// delete the old alarms
|
|
|
|
$updatedEvent = $this->read($eventID);
|
|
|
|
foreach($updatedEvent['alarm'] as $alarmID => $alarmData)
|
|
|
|
{
|
|
|
|
$this->delete_alarm($alarmID);
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-01-10 14:53:23 +01:00
|
|
|
foreach($alarms as $alarm)
|
|
|
|
{
|
|
|
|
$alarm['offset'] = $event['start'] - $alarm['time'];
|
|
|
|
$alarm['owner'] = $GLOBALS['egw_info']['user']['account_id'];
|
|
|
|
$this->save_alarm($eventID, $alarm);
|
|
|
|
}
|
|
|
|
}
|
2005-11-09 00:15:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return $Ok;
|
|
|
|
}
|
|
|
|
|
2008-03-27 09:29:54 +01:00
|
|
|
function valarm2egw(&$alarms, &$valarm)
|
|
|
|
{
|
|
|
|
$count = 0;
|
|
|
|
foreach($valarm->_attributes as $vattr)
|
|
|
|
{
|
|
|
|
switch($vattr['name'])
|
|
|
|
{
|
|
|
|
case 'TRIGGER':
|
|
|
|
$vtype = (isset($vattr['params']['VALUE']))
|
|
|
|
? $vattr['params']['VALUE'] : 'DURATION'; //default type
|
|
|
|
switch ($vtype)
|
|
|
|
{
|
|
|
|
case 'DURATION':
|
|
|
|
if (isset($vattr['params']['RELATED'])
|
|
|
|
&& $vattr['params']['RELATED'] != 'START')
|
|
|
|
{
|
|
|
|
error_log("Unsupported VALARM offset anchor ".$vattr['params']['RELATED']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$alarms[] = array('offset' => -$vattr['value']);
|
|
|
|
$count++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'DATE-TIME':
|
|
|
|
$alarms[] = array('time' => $vattr['value']);
|
|
|
|
$count++;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// we should also do ;RELATED=START|END
|
|
|
|
error_log('VALARM/TRIGGER: unsupported value type:' . $vtype);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
// case 'ACTION':
|
|
|
|
// break;
|
|
|
|
// case 'DISPLAY':
|
|
|
|
// break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
error_log('VALARM field:' .$vattr['name'] .':' . print_r($vattrval,true) . ' HAS NO CONVERSION YET');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $count;
|
|
|
|
}
|
|
|
|
|
2005-11-24 09:46:53 +01:00
|
|
|
function setSupportedFields($_productManufacturer='file', $_productName='')
|
2005-11-09 00:15:14 +01:00
|
|
|
{
|
2006-07-15 01:24:56 +02:00
|
|
|
// save them vor later use
|
2006-08-31 05:08:23 +02:00
|
|
|
$this->productManufacturer = $_productManufacturer;
|
2006-07-15 01:24:56 +02:00
|
|
|
$this->productName = $_productName;
|
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$defaultFields['minimal'] = array(
|
|
|
|
'public' => 'public',
|
|
|
|
'description' => 'description',
|
|
|
|
'end' => 'end',
|
|
|
|
'start' => 'start',
|
|
|
|
'location' => 'location',
|
|
|
|
'recur_type' => 'recur_type',
|
|
|
|
'recur_interval' => 'recur_interval',
|
|
|
|
'recur_data' => 'recur_data',
|
|
|
|
'recur_enddate' => 'recur_enddate',
|
|
|
|
'title' => 'title',
|
2008-05-06 23:05:56 +02:00
|
|
|
'alarms' => 'alarms',
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
$defaultFields['basic'] = $defaultFields['minimal'] + array(
|
|
|
|
'recur_exception' => 'recur_exception',
|
|
|
|
'priority' => 'priority',
|
|
|
|
);
|
2005-11-09 00:15:14 +01:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$defaultFields['nexthaus'] = $defaultFields['basic'] + array(
|
|
|
|
'participants' => 'participants',
|
|
|
|
);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$defaultFields['synthesis'] = $defaultFields['basic'] + array(
|
|
|
|
'non_blocking' => 'non_blocking',
|
|
|
|
'category' => 'category',
|
2005-11-09 00:15:14 +01:00
|
|
|
);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$defaultFields['evolution'] = $defaultFields['basic'] + array(
|
|
|
|
'participants' => 'participants',
|
|
|
|
'owner' => 'owner',
|
|
|
|
'category' => 'category',
|
|
|
|
);
|
2006-08-15 16:29:45 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$defaultFields['full'] = $defaultFields['basic'] + array(
|
|
|
|
'participants' => 'participants',
|
|
|
|
'owner' => 'owner',
|
|
|
|
'category' => 'category',
|
|
|
|
'non_blocking' => 'non_blocking',
|
2006-08-15 16:29:45 +02:00
|
|
|
);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
switch(strtolower($_productManufacturer))
|
|
|
|
{
|
|
|
|
case 'nexthaus corporation':
|
2008-03-27 08:50:35 +01:00
|
|
|
case 'nexthaus corp':
|
2005-11-09 00:15:14 +01:00
|
|
|
switch(strtolower($_productName))
|
|
|
|
{
|
|
|
|
default:
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$this->supportedFields = $defaultFields['nexthaus'];
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
// multisync does not provide anymore information then the manufacturer
|
|
|
|
// we suppose multisync with evolution
|
|
|
|
case 'the multisync project':
|
|
|
|
switch(strtolower($_productName))
|
|
|
|
{
|
|
|
|
default:
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$this->supportedFields = $defaultFields['basic'];
|
2006-08-15 16:29:45 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'nokia':
|
|
|
|
switch(strtolower($_productName))
|
|
|
|
{
|
|
|
|
case 'e61':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$this->supportedFields = $defaultFields['minimal'];
|
|
|
|
break;
|
2006-08-15 16:29:45 +02:00
|
|
|
default:
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
error_log("Unknown Nokia phone '$_productName', assuming E61");
|
|
|
|
$this->supportedFields = $defaultFields['minimal'];
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-01-10 14:53:23 +01:00
|
|
|
case 'sonyericsson':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
case 'sony ericsson':
|
2006-01-10 14:53:23 +01:00
|
|
|
switch(strtolower($_productName))
|
|
|
|
{
|
|
|
|
case 'd750i':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
case 'p910i':
|
|
|
|
$this->supportedFields = $defaultFields['basic'];
|
|
|
|
break;
|
2006-01-10 14:53:23 +01:00
|
|
|
default:
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
error_log("Unknown Sony Ericsson phone '$_productName' assuming d750i");
|
|
|
|
$this->supportedFields = $defaultFields['basic'];
|
2006-01-10 14:53:23 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
case 'synthesis ag':
|
|
|
|
switch(strtolower($_productName))
|
|
|
|
{
|
2007-11-11 11:37:52 +01:00
|
|
|
case 'sysync client pocketpc std':
|
|
|
|
case 'sysync client pocketpc pro':
|
|
|
|
$this->supportedFields = $defaultFields['full'];
|
|
|
|
break;
|
2005-11-09 00:15:14 +01:00
|
|
|
default:
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$this->supportedFields = $defaultFields['synthesis'];
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2006-11-13 09:36:00 +01:00
|
|
|
|
2008-05-06 23:05:56 +02:00
|
|
|
//Syncevolution compatibility
|
2006-11-13 09:36:00 +01:00
|
|
|
case 'patrick ohly':
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$this->supportedFields = $defaultFields['evolution'];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '': // seems syncevolution 0.5 doesn't send a manufacturer
|
|
|
|
error_log("No vendor name, assuming syncevolution 0.5");
|
|
|
|
$this->supportedFields = $defaultFields['evolution'];
|
2006-11-13 09:36:00 +01:00
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2005-11-09 00:15:14 +01:00
|
|
|
case 'file': // used outside of SyncML, eg. by the calendar itself ==> all possible fields
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$this->supportedFields = $defaultFields['full'];
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
// the fallback for SyncML
|
|
|
|
default:
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
error_log("Unknown calendar SyncML client: manufacturer='$_productManufacturer' product='$_productName'");
|
|
|
|
$this->supportedFields = $defaultFields['full'];
|
2005-11-09 00:15:14 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
function icaltoegw($_vcalData)
|
|
|
|
{
|
2006-05-17 05:32:28 +02:00
|
|
|
// our (patched) horde classes, do NOT unfold folded lines, which causes a lot trouble in the import
|
|
|
|
$_vcalData = preg_replace("/[\r\n]+ /",'',$_vcalData);
|
|
|
|
|
|
|
|
$vcal = &new Horde_iCalendar;
|
|
|
|
if(!$vcal->parsevCalendar($_vcalData))
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!is_array($this->supportedFields))
|
|
|
|
{
|
|
|
|
$this->setSupportedFields();
|
|
|
|
}
|
|
|
|
//echo "supportedFields="; _debug_array($this->supportedFields);
|
|
|
|
|
|
|
|
$Ok = false; // returning false, if file contains no components
|
|
|
|
foreach($vcal->getComponents() as $component)
|
|
|
|
{
|
|
|
|
if(is_a($component, 'Horde_iCalendar_vevent'))
|
|
|
|
{
|
|
|
|
$supportedFields = $this->supportedFields;
|
|
|
|
#$event = array('participants' => array());
|
|
|
|
$event = array();
|
|
|
|
$alarms = array();
|
|
|
|
$vcardData = array('recur_type' => 0);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-05-17 05:32:28 +02:00
|
|
|
// lets see what we can get from the vcard
|
|
|
|
foreach($component->_attributes as $attributes)
|
|
|
|
{
|
|
|
|
switch($attributes['name'])
|
|
|
|
{
|
|
|
|
case 'AALARM':
|
|
|
|
case 'DALARM':
|
|
|
|
if (preg_match('/.*Z$/',$attributes['value'],$matches))
|
|
|
|
{
|
|
|
|
$alarmTime = $vcal->_parseDateTime($attributes['value']);
|
|
|
|
$alarms[$alarmTime] = array(
|
|
|
|
'time' => $alarmTime
|
|
|
|
);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'CLASS':
|
|
|
|
$vcardData['public'] = (int)(strtolower($attributes['value']) == 'public');
|
|
|
|
break;
|
|
|
|
case 'DESCRIPTION':
|
|
|
|
$vcardData['description'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
case 'DTEND':
|
|
|
|
if(date('H:i:s',$attributes['value']) == '00:00:00')
|
|
|
|
$attributes['value']--;
|
|
|
|
$vcardData['end'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
case 'DTSTART':
|
|
|
|
$vcardData['start'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
case 'LOCATION':
|
|
|
|
$vcardData['location'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
case 'RRULE':
|
|
|
|
$recurence = $attributes['value'];
|
|
|
|
$type = preg_match('/FREQ=([^;: ]+)/i',$recurence,$matches) ? $matches[1] : $recurence{0};
|
|
|
|
// vCard 2.0 values for all types
|
|
|
|
if (preg_match('/UNTIL=([0-9T]+)/',$recurence,$matches))
|
|
|
|
{
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($matches[1]);
|
|
|
|
}
|
|
|
|
if (preg_match('/INTERVAL=([0-9]+)/',$recurence,$matches))
|
|
|
|
{
|
|
|
|
$vcardData['recur_interval'] = (int) $matches[1];
|
|
|
|
}
|
|
|
|
$vcardData['recur_data'] = 0;
|
|
|
|
switch($type)
|
|
|
|
{
|
|
|
|
case 'W':
|
|
|
|
case 'WEEKLY':
|
|
|
|
$days = array();
|
|
|
|
if(preg_match('/W(\d+) (.*) (.*)/',$recurence, $recurenceMatches)) // 1.0
|
|
|
|
{
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
$days = explode(' ',trim($recurenceMatches[2]));
|
|
|
|
if($recurenceMatches[3] != '#0')
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[3]);
|
|
|
|
$recur_days = $this->recur_days_1_0;
|
|
|
|
}
|
|
|
|
elseif (preg_match('/BYDAY=([^;: ]+)/',$recurence,$recurenceMatches)) // 2.0
|
|
|
|
{
|
|
|
|
$days = explode(',',$recurenceMatches[1]);
|
|
|
|
$recur_days = $this->recur_days;
|
|
|
|
}
|
|
|
|
if ($days)
|
|
|
|
{
|
|
|
|
foreach($recur_days as $id => $day)
|
|
|
|
{
|
|
|
|
if (in_array(strtoupper(substr($day,0,2)),$days))
|
|
|
|
{
|
|
|
|
$vcardData['recur_data'] |= $id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_WEEKLY;
|
|
|
|
}
|
|
|
|
break;
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-05-17 05:32:28 +02:00
|
|
|
case 'D': // 1.0
|
|
|
|
if(!preg_match('/D(\d+) (.*)/',$recurence, $recurenceMatches)) break;
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[2] != '#0')
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
|
|
|
// fall-through
|
|
|
|
case 'DAILY': // 2.0
|
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_DAILY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'M':
|
|
|
|
if(preg_match('/MD(\d+) (.*)/',$recurence, $recurenceMatches))
|
|
|
|
{
|
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_MDAY;
|
|
|
|
if($recurenceMatches[1] > 1)
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[2] != '#0')
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
|
|
|
}
|
|
|
|
elseif(preg_match('/MP(\d+) (.*) (.*) (.*)/',$recurence, $recurenceMatches))
|
|
|
|
{
|
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_WDAY;
|
|
|
|
if($recurenceMatches[1] > 1)
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[4] != '#0')
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[4]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'MONTHLY':
|
2008-05-06 23:05:56 +02:00
|
|
|
$vcardData['recur_type'] = strpos($recurence,'BYDAY') !== false ?
|
2006-05-17 05:32:28 +02:00
|
|
|
MCAL_RECUR_MONTHLY_WDAY : MCAL_RECUR_MONTHLY_MDAY;
|
2008-05-06 23:05:56 +02:00
|
|
|
break;
|
2006-05-17 05:32:28 +02:00
|
|
|
|
|
|
|
case 'Y': // 1.0
|
|
|
|
if(!preg_match('/YM(\d+) (.*)/',$recurence, $recurenceMatches)) break;
|
|
|
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
|
|
|
if($recurenceMatches[2] != '#0')
|
|
|
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
|
|
|
// fall-through
|
|
|
|
case 'YEARLY': // 2.0
|
|
|
|
$vcardData['recur_type'] = MCAL_RECUR_YEARLY;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'EXDATE':
|
2006-08-24 11:46:22 +02:00
|
|
|
$vcardData['recur_exception'] = $attributes['value'];
|
2006-05-17 05:32:28 +02:00
|
|
|
break;
|
|
|
|
case 'SUMMARY':
|
|
|
|
$vcardData['title'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
case 'UID':
|
|
|
|
$event['uid'] = $vcardData['uid'] = $attributes['value'];
|
|
|
|
if ($cal_id <= 0 && !empty($vcardData['uid']) && ($uid_event = $this->read($vcardData['uid'])))
|
|
|
|
{
|
|
|
|
$event['id'] = $uid_event['id'];
|
|
|
|
unset($uid_event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'TRANSP':
|
|
|
|
$vcardData['non_blocking'] = $attributes['value'] == 'TRANSPARENT';
|
|
|
|
break;
|
|
|
|
case 'PRIORITY':
|
2008-03-27 08:50:35 +01:00
|
|
|
if ($this->productManufacturer == 'nexthaus corporation'
|
|
|
|
|| $this->productManufacturer == 'nexthaus corp')
|
2006-07-15 01:24:56 +02:00
|
|
|
{
|
|
|
|
$vcardData['priority'] = $attributes['value'] == 1 ? 3 : 2; // 1=high, 2=normal
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$vcardData['priority'] = (int) $this->priority_ical2egw[$attributes['value']];
|
|
|
|
}
|
2006-05-17 05:32:28 +02:00
|
|
|
break;
|
|
|
|
case 'CATEGORIES':
|
|
|
|
if ($attributes['value'])
|
|
|
|
{
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$vcardData['category'] = $this->find_or_add_categories(explode(',',$attributes['value']));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$vcardData['category'] = array();
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
break;
|
2006-05-17 05:32:28 +02:00
|
|
|
case 'ATTENDEE':
|
|
|
|
if (preg_match('/MAILTO:([@.a-z0-9_-]+)/i',$attributes['value'],$matches) &&
|
|
|
|
($uid = $GLOBALS['egw']->accounts->name2id($matches[1],'account_email')))
|
|
|
|
{
|
|
|
|
$event['participants'][$uid] = isset($attributes['params']['PARTSTAT']) ?
|
2008-05-06 23:05:56 +02:00
|
|
|
$this->status_ical2egw[strtoupper($attributes['params']['PARTSTAT'])] :
|
2006-05-17 05:32:28 +02:00
|
|
|
($uid == $event['owner'] ? 'A' : 'U');
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'ORGANIZER': // will be written direct to the event
|
|
|
|
if (preg_match('/MAILTO:([@.a-z0-9_-]+)/i',$attributes['value'],$matches) &&
|
|
|
|
($uid = $GLOBALS['egw']->accounts->name2id($matches[1],'account_email')))
|
|
|
|
{
|
|
|
|
$event['owner'] = $uid;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'CREATED': // will be written direct to the event
|
|
|
|
if ($event['modified']) break;
|
|
|
|
// fall through
|
|
|
|
case 'LAST-MODIFIED': // will be written direct to the event
|
|
|
|
$event['modified'] = $attributes['value'];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
|
|
|
// check if the entry is a birthday
|
2006-08-31 05:08:23 +02:00
|
|
|
// this field is only set from NOKIA clients
|
|
|
|
$agendaEntryType = $component->getAttribute('X-EPOCAGENDAENTRYTYPE');
|
|
|
|
if (!is_a($agendaEntryType, 'PEAR_Error')) {
|
|
|
|
if(strtolower($agendaEntryType) == 'anniversary') {
|
|
|
|
$event['special'] = '1';
|
|
|
|
$vcardData['end'] = $vcardData['start'] + 86399;
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-05-17 05:32:28 +02:00
|
|
|
if(!empty($vcardData['recur_enddate']))
|
|
|
|
{
|
|
|
|
// reset recure_enddate to 00:00:00 on the last day
|
2008-05-06 23:05:56 +02:00
|
|
|
$vcardData['recur_enddate'] = mktime(0, 0, 0,
|
2006-05-17 05:32:28 +02:00
|
|
|
date('m',$vcardData['recur_enddate']),
|
|
|
|
date('d',$vcardData['recur_enddate']),
|
|
|
|
date('Y',$vcardData['recur_enddate'])
|
|
|
|
);
|
|
|
|
}
|
|
|
|
//echo "event=";_debug_array($vcardData);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-05-17 05:32:28 +02:00
|
|
|
while(($fieldName = array_shift($supportedFields)))
|
|
|
|
{
|
|
|
|
switch($fieldName)
|
|
|
|
{
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
case 'recur_interval':
|
|
|
|
case 'recur_enddate':
|
|
|
|
case 'recur_data':
|
|
|
|
case 'recur_exception':
|
2006-05-17 05:32:28 +02:00
|
|
|
case 'alarms':
|
|
|
|
// not handled here
|
|
|
|
break;
|
|
|
|
case 'recur_type':
|
|
|
|
$event['recur_type'] = $vcardData['recur_type'];
|
|
|
|
if ($event['recur_type'] != MCAL_RECUR_NONE)
|
|
|
|
{
|
|
|
|
foreach(array('recur_interval','recur_enddate','recur_data','recur_exception') as $r)
|
|
|
|
{
|
|
|
|
if(isset($vcardData[$r]))
|
|
|
|
{
|
|
|
|
$event[$r] = $vcardData[$r];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (isset($vcardData[$fieldName]))
|
|
|
|
{
|
|
|
|
$event[$fieldName] = $vcardData[$fieldName];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-05-17 05:32:28 +02:00
|
|
|
return $event;
|
|
|
|
}
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-05-17 05:32:28 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-05-06 23:05:56 +02:00
|
|
|
function search($_vcalData)
|
2006-08-15 16:29:45 +02:00
|
|
|
{
|
2006-07-20 11:38:53 +02:00
|
|
|
if(!$event = $this->icaltoegw($_vcalData)) {
|
2006-05-17 05:32:28 +02:00
|
|
|
return false;
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-07-13 01:51:57 +02:00
|
|
|
$query = array(
|
|
|
|
'cal_start='.$this->date2ts($event['start'],true), // true = Server-time
|
|
|
|
'cal_end='.$this->date2ts($event['end'],true),
|
|
|
|
);
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-08-15 16:29:45 +02:00
|
|
|
#foreach(array('title','location','priority','public','non_blocking') as $name) {
|
|
|
|
foreach(array('title','location','public','non_blocking') as $name) {
|
2006-07-13 01:51:57 +02:00
|
|
|
if (isset($event[$name])) $query['cal_'.$name] = $event[$name];
|
2006-05-17 05:32:28 +02:00
|
|
|
}
|
|
|
|
|
2006-07-13 01:51:57 +02:00
|
|
|
if($foundEvents = parent::search(array(
|
|
|
|
'user' => $this->user,
|
|
|
|
'query' => $query,
|
|
|
|
))) {
|
2006-05-17 05:32:28 +02:00
|
|
|
if(is_array($foundEvents)) {
|
|
|
|
$event = array_shift($foundEvents);
|
|
|
|
return $event['id'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-07-15 01:24:56 +02:00
|
|
|
/**
|
|
|
|
* Create a freebusy vCal for the given user(s)
|
|
|
|
*
|
|
|
|
* @param int $user account_id
|
|
|
|
* @param mixed $end=null end-date, default now+1 month
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function freebusy($user,$end=null)
|
|
|
|
{
|
|
|
|
if (!$end) $end = $this->now_su + 100*DAY_s; // default next 100 days
|
2008-05-06 23:05:56 +02:00
|
|
|
|
2006-07-15 01:24:56 +02:00
|
|
|
$vcal = &new Horde_iCalendar;
|
|
|
|
$vcal->setAttribute('PRODID','-//eGroupWare//NONSGML eGroupWare Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'.
|
|
|
|
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
|
|
|
|
$vcal->setAttribute('VERSION','2.0');
|
|
|
|
|
|
|
|
$vfreebusy = Horde_iCalendar::newComponent('VFREEBUSY',$vcal);
|
|
|
|
$parameters = array(
|
|
|
|
'ORGANIZER' => $GLOBALS['egw']->translation->convert(
|
|
|
|
$GLOBALS['egw']->accounts->id2name($user,'account_firstname').' '.
|
|
|
|
$GLOBALS['egw']->accounts->id2name($user,'account_lastname'),
|
|
|
|
$GLOBALS['egw']->translation->charset(),'utf-8'),
|
|
|
|
);
|
|
|
|
foreach(array(
|
|
|
|
'URL' => $this->freebusy_url($user),
|
|
|
|
'DTSTART' => $this->date2ts($this->now_su,true), // true = server-time
|
|
|
|
'DTEND' => $this->date2ts($end,true), // true = server-time
|
|
|
|
'ORGANIZER' => $GLOBALS['egw']->accounts->id2name($user,'account_email'),
|
|
|
|
'DTSTAMP' => time(),
|
|
|
|
) as $attr => $value)
|
|
|
|
{
|
|
|
|
$vfreebusy->setAttribute($attr, $value, $parameters[$name]);
|
|
|
|
}
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$fbdata = parent::search(array(
|
|
|
|
'start' => $this->now_su,
|
|
|
|
'end' => $end,
|
|
|
|
'users' => $user,
|
|
|
|
'date_format' => 'server',
|
|
|
|
'show_rejected' => false,
|
|
|
|
));
|
|
|
|
if (is_array($fbdata))
|
2006-07-15 01:24:56 +02:00
|
|
|
{
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
foreach ($fbdata as $event)
|
|
|
|
{
|
|
|
|
if ($event['non_blocking']) continue;
|
2006-07-15 01:24:56 +02:00
|
|
|
|
SyncML patches from patrick.bihan-faou-AT-mindstep.com (without
logout+mbstring stuff), small modification to use the already exiting
methodes to generate full name and fileas)
The code is commited to trunk only at the moment to allow testing of it.
If everything goes well, we intend to commit it to 1.4 branch too.
Here's the original description of the patch by Patrick:
- handles the default config for current versions of funambol (i.e. the
scard/stask/snote/scal locations)
- tries to be a bit smarter on how the data content should be encoded
based on what the client specified (sif+base64/vcard, / fragmented or
not, etc.)
- workaround a bug in some versions of funambol, where funambol does not
specify the proper sif type for the type of requested data
- imported patch #117 from egw's tracker
- make sure that the logs generated by the horde code go to stderr so
they can be view in the webserver's logs
- as much as possible reduce code duplication. For example, the
categories are handled in the parent classes for both the SIF avn VCAL
formats for each type of data (addressbook,infolog,calendar).
- make sure the code can handle more than one categories in each
direction
- treat the 'sony ericsson' vendor string just like 'sonyericsson', the
newer phones apparently have a space in the vendor string... (this
touches some files in the icalsrv as well)
- handle notes: these should now work with everything (funambol or
other)
- remove more code duplication: the syncml "api" for the various data
types (calendar, contacts, infolog) is now common for both the vcard and
sif data formats (cf the files that need to be removed)
- handle the "privat" filter in infolog like the "private" filter (some
part of the code use the name without the trailing e)
- imported patch # 267 from egw's tracker
2007-09-29 12:29:48 +02:00
|
|
|
$vfreebusy->setAttribute('FREEBUSY',array(array(
|
|
|
|
'start' => $event['start'],
|
|
|
|
'end' => $event['end'],
|
|
|
|
)));
|
|
|
|
}
|
2006-07-15 01:24:56 +02:00
|
|
|
}
|
|
|
|
$vcal->addComponent($vfreebusy);
|
|
|
|
|
|
|
|
return $vcal->exportvCalendar();
|
|
|
|
}
|
2005-11-09 00:15:14 +01:00
|
|
|
}
|