forked from extern/egroupware
* CalDAV: no METHOD:PUBLISH for CalDAV outside the inbox
This commit is contained in:
parent
0837c263ff
commit
175197d7c0
@ -243,7 +243,7 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
//error_log(__FILE__ . __METHOD__ . "Calendar Data : $calendar_data");
|
//error_log(__FILE__ . __METHOD__ . "Calendar Data : $calendar_data");
|
||||||
if ($calendar_data)
|
if ($calendar_data)
|
||||||
{
|
{
|
||||||
$content = $this->iCal($event,$filter['users']);
|
$content = $this->iCal($event, $filter['users'], strpos($path, '/inbox/') !== false ? 'PUBLISH' : null);
|
||||||
$props['getcontentlength'] = bytes($content);
|
$props['getcontentlength'] = bytes($content);
|
||||||
$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data',$content);
|
$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data',$content);
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
{
|
{
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
$options['data'] = $this->iCal($event,$user);
|
$options['data'] = $this->iCal($event, $user, strpos($options['path'], '/inbox/') !== false ? 'PUBLISH' : null);
|
||||||
$options['mimetype'] = 'text/calendar; charset=utf-8';
|
$options['mimetype'] = 'text/calendar; charset=utf-8';
|
||||||
header('Content-Encoding: identity');
|
header('Content-Encoding: identity');
|
||||||
header('ETag: '.$this->get_etag($event));
|
header('ETag: '.$this->get_etag($event));
|
||||||
@ -400,9 +400,10 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
*
|
*
|
||||||
* @param array $event
|
* @param array $event
|
||||||
* @param int $user=null account_id of calendar to display
|
* @param int $user=null account_id of calendar to display
|
||||||
|
* @param string $method=null eg. 'PUBLISH' for inbox, nothing anywhere else
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function iCal(array $event,$user=null)
|
private function iCal(array $event,$user=null, $method=null)
|
||||||
{
|
{
|
||||||
static $handler = null;
|
static $handler = null;
|
||||||
if (is_null($handler)) $handler = $this->_get_handler();
|
if (is_null($handler)) $handler = $this->_get_handler();
|
||||||
@ -427,7 +428,7 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
{
|
{
|
||||||
$events[0]['uid'] .= '-'.$event['id']; // force a different uid
|
$events[0]['uid'] .= '-'.$event['id']; // force a different uid
|
||||||
}
|
}
|
||||||
return $handler->exportVCal($events,'2.0','PUBLISH');
|
return $handler->exportVCal($events, '2.0', $method);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,7 +231,7 @@ class calendar_ical extends calendar_boupdate
|
|||||||
$vcal->setAttribute('PRODID','-//eGroupWare//NONSGML eGroupWare Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'.
|
$vcal->setAttribute('PRODID','-//eGroupWare//NONSGML eGroupWare Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'.
|
||||||
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
|
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
|
||||||
$vcal->setAttribute('VERSION', $version);
|
$vcal->setAttribute('VERSION', $version);
|
||||||
$vcal->setAttribute('METHOD', $method);
|
if ($method) $vcal->setAttribute('METHOD', $method);
|
||||||
$events_exported = false;
|
$events_exported = false;
|
||||||
|
|
||||||
if (!is_array($events)) $events = array($events);
|
if (!is_array($events)) $events = array($events);
|
||||||
|
@ -233,7 +233,7 @@ class infolog_groupdav extends groupdav_handler
|
|||||||
);
|
);
|
||||||
if ($calendar_data)
|
if ($calendar_data)
|
||||||
{
|
{
|
||||||
$content = $handler->exportVTODO($task,'2.0','PUBLISH');
|
$content = $handler->exportVTODO($task, '2.0', null); // no METHOD:PUBLISH for CalDAV
|
||||||
$props['getcontentlength'] = bytes($content);
|
$props['getcontentlength'] = bytes($content);
|
||||||
$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data',$content);
|
$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data',$content);
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ class infolog_groupdav extends groupdav_handler
|
|||||||
return $task;
|
return $task;
|
||||||
}
|
}
|
||||||
$handler = $this->_get_handler();
|
$handler = $this->_get_handler();
|
||||||
$options['data'] = $handler->exportVTODO($task,'2.0','PUBLISH');
|
$options['data'] = $handler->exportVTODO($task, '2.0', null); // no METHOD:PUBLISH for CalDAV
|
||||||
$options['mimetype'] = 'text/calendar; charset=utf-8';
|
$options['mimetype'] = 'text/calendar; charset=utf-8';
|
||||||
header('Content-Encoding: identity');
|
header('Content-Encoding: identity');
|
||||||
header('ETag: '.$this->get_etag($task));
|
header('ETag: '.$this->get_etag($task));
|
||||||
|
@ -168,7 +168,7 @@ class infolog_ical extends infolog_bo
|
|||||||
|
|
||||||
$vcal = new Horde_iCalendar;
|
$vcal = new Horde_iCalendar;
|
||||||
$vcal->setAttribute('VERSION',$_version);
|
$vcal->setAttribute('VERSION',$_version);
|
||||||
$vcal->setAttribute('METHOD',$_method);
|
if ($_method) $vcal->setAttribute('METHOD',$_method);
|
||||||
|
|
||||||
$tzid = $this->tzid;
|
$tzid = $this->tzid;
|
||||||
|
|
||||||
|
@ -470,7 +470,8 @@ class Horde_iCalendar {
|
|||||||
{
|
{
|
||||||
// Default values.
|
// Default values.
|
||||||
$requiredAttributes['PRODID'] = '-//The Horde Project//Horde_iCalendar Library' . (defined('HORDE_VERSION') ? ', Horde ' . constant('HORDE_VERSION') : '') . '//EN';
|
$requiredAttributes['PRODID'] = '-//The Horde Project//Horde_iCalendar Library' . (defined('HORDE_VERSION') ? ', Horde ' . constant('HORDE_VERSION') : '') . '//EN';
|
||||||
$requiredAttributes['METHOD'] = 'PUBLISH';
|
// METHOD is only required for iTip, but not for CalDAV, therefore removing it here calendar_ical sets it anyway by default
|
||||||
|
//$requiredAttributes['METHOD'] = 'PUBLISH';
|
||||||
|
|
||||||
foreach ($requiredAttributes as $name => $default_value) {
|
foreach ($requiredAttributes as $name => $default_value) {
|
||||||
if (is_a($this->getattribute($name), 'PEAR_Error')) {
|
if (is_a($this->getattribute($name), 'PEAR_Error')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user