forked from extern/egroupware
new Horde_Icalendar throws Horde_Icalendar_Exception on call to getAttribute() for not existing attributes, getAttributeDefault($name, $default) returns $default instead
This commit is contained in:
parent
62959f95f9
commit
cd48c7c22b
@ -2223,7 +2223,7 @@ class calendar_ical extends calendar_boupdate
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_a($component, 'Horde_Icalendar_Vevent') ||
|
if (!is_a($component, 'Horde_Icalendar_Vevent') ||
|
||||||
!($event = $this->vevent2egw($component, $container ? $container->getAttribute('VERSION') : '2.0',
|
!($event = $this->vevent2egw($component, $container ? $container->getAttributeDefault('VERSION', '2.0') : '2.0',
|
||||||
$this->supportedFields, $principalURL, $container)))
|
$this->supportedFields, $principalURL, $container)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -2283,8 +2283,8 @@ class calendar_ical extends calendar_boupdate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$mozillaACK = $component->getAttribute('X-MOZ-LASTACK');
|
$mozillaACK = $component->getAttributeDefault('X-MOZ-LASTACK', null);
|
||||||
if ($this->productName == 'lightning' && !is_a($mozillaACK, 'PEAR_Error'))
|
if ($this->productName == 'lightning' && !isset($mozillaACK))
|
||||||
{
|
{
|
||||||
if ($this->log)
|
if ($this->log)
|
||||||
{
|
{
|
||||||
@ -2861,9 +2861,11 @@ class calendar_ical extends calendar_boupdate
|
|||||||
$vcardData['participants'][$uid] =
|
$vcardData['participants'][$uid] =
|
||||||
calendar_so::combine_status($status, $quantity, $role);
|
calendar_so::combine_status($status, $quantity, $role);
|
||||||
|
|
||||||
if (!$this->calendarOwner && is_numeric($uid) &&
|
try {
|
||||||
$role == 'CHAIR' &&
|
if (!$this->calendarOwner && is_numeric($uid) && $role == 'CHAIR')
|
||||||
is_a($component->getAttribute('ORGANIZER'), 'PEAR_Error'))
|
$component->getAttribute('ORGANIZER');
|
||||||
|
}
|
||||||
|
catch(Horde_Icalendar_Exception $e)
|
||||||
{
|
{
|
||||||
// we can store the ORGANIZER as event owner
|
// we can store the ORGANIZER as event owner
|
||||||
$event['owner'] = $uid;
|
$event['owner'] = $uid;
|
||||||
@ -2910,9 +2912,8 @@ class calendar_ical extends calendar_boupdate
|
|||||||
}
|
}
|
||||||
// check if the entry is a birthday
|
// check if the entry is a birthday
|
||||||
// this field is only set from NOKIA clients
|
// this field is only set from NOKIA clients
|
||||||
$agendaEntryType = $component->getAttribute('X-EPOCAGENDAENTRYTYPE');
|
try {
|
||||||
if (!is_a($agendaEntryType, 'PEAR_Error'))
|
$agendaEntryType = $component->getAttribute('X-EPOCAGENDAENTRYTYPE');
|
||||||
{
|
|
||||||
if (strtolower($agendaEntryType) == 'anniversary')
|
if (strtolower($agendaEntryType) == 'anniversary')
|
||||||
{
|
{
|
||||||
$event['special'] = '1';
|
$event['special'] = '1';
|
||||||
@ -2925,6 +2926,7 @@ class calendar_ical extends calendar_boupdate
|
|||||||
$event['special'] = '2';
|
$event['special'] = '2';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Horde_Icalendar_Exception $e) {}
|
||||||
|
|
||||||
$event['priority'] = 2; // default
|
$event['priority'] = 2; // default
|
||||||
$event['alarm'] = $alarms;
|
$event['alarm'] = $alarms;
|
||||||
@ -3005,13 +3007,15 @@ class calendar_ical extends calendar_boupdate
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apple iCal on OS X uses X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALANDAR (not VEVENT!)
|
// Apple iCal on OS X uses X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALANDAR (not VEVENT!)
|
||||||
if ($this->productManufacturer == 'GroupDAV' && $container &&
|
try {
|
||||||
($x_calendarserver_access = $container->getAttribute('X-CALENDARSERVER-ACCESS')) &&
|
if ($this->productManufacturer == 'GroupDAV' && $container &&
|
||||||
!is_a($x_calendarserver_access, 'PEAR_Error'))
|
($x_calendarserver_access = $container->getAttribute('X-CALENDARSERVER-ACCESS')))
|
||||||
{
|
{
|
||||||
$event['public'] = (int)(strtoupper($x_calendarserver_access) == 'PUBLIC');
|
$event['public'] = (int)(strtoupper($x_calendarserver_access) == 'PUBLIC');
|
||||||
|
}
|
||||||
|
//error_log(__METHOD__."() X-CALENDARSERVER-ACCESS=".array2string($x_calendarserver_access).' --> public='.array2string($event['public']));
|
||||||
}
|
}
|
||||||
//error_log(__METHOD__."() X-CALENDARSERVER-ACCESS=".array2string($x_calendarserver_access).' --> public='.array2string($event['public']));
|
catch (Horde_Icalendar_Exception $e) {}
|
||||||
|
|
||||||
// if no end is given in iCal we use the default lenght from user prefs
|
// if no end is given in iCal we use the default lenght from user prefs
|
||||||
// whole day events get one day in calendar_boupdate::save()
|
// whole day events get one day in calendar_boupdate::save()
|
||||||
@ -3023,8 +3027,7 @@ class calendar_ical extends calendar_boupdate
|
|||||||
if ($this->calendarOwner) $event['owner'] = $this->calendarOwner;
|
if ($this->calendarOwner) $event['owner'] = $this->calendarOwner;
|
||||||
|
|
||||||
// parsing ATTACH attributes for managed attachments
|
// parsing ATTACH attributes for managed attachments
|
||||||
$attr = $component->getAttribute('X-EGROUPWARE-ATTACH-INCLUDED');
|
$event['attach-delete-by-put'] = $component->getAttributeDefault('X-EGROUPWARE-ATTACH-INCLUDED', null) === 'TRUE';
|
||||||
$event['attach-delete-by-put'] = !is_a($attr, PEAR_Error) && $attr === 'TRUE';
|
|
||||||
$event['attach'] = $component->getAllAttributes('ATTACH');
|
$event['attach'] = $component->getAllAttributes('ATTACH');
|
||||||
|
|
||||||
if ($this->log)
|
if ($this->log)
|
||||||
|
@ -685,15 +685,19 @@ class infolog_ical extends infolog_bo
|
|||||||
// iOS reminder app only sets COMPLETED, but never STATUS nor PERCENT-COMPLETED
|
// iOS reminder app only sets COMPLETED, but never STATUS nor PERCENT-COMPLETED
|
||||||
// if we have no STATUS, set STATUS by existence of COMPLETED and/or PERCENT-COMPLETE and X-INFOLOG-STATUS
|
// if we have no STATUS, set STATUS by existence of COMPLETED and/or PERCENT-COMPLETE and X-INFOLOG-STATUS
|
||||||
// if we have no PERCENT-COMPLETE set it from STATUS: 0=NEEDS-ACTION, 10=IN-PROCESS, 100=COMPLETED
|
// if we have no PERCENT-COMPLETE set it from STATUS: 0=NEEDS-ACTION, 10=IN-PROCESS, 100=COMPLETED
|
||||||
if (!($status = $component->getAttribute('STATUS')) || !is_scalar($status))
|
try {
|
||||||
|
$status = $component->getAttribute('STATUS');
|
||||||
|
}
|
||||||
|
catch (Horde_Icalendar_Exception $e)
|
||||||
{
|
{
|
||||||
$completed = $component->getAttribute('COMPLETED');
|
unset($e);
|
||||||
$x_infolog_status = $component->getAttribute('X-INFOLOG-STATUS');
|
$completed = $component->getAttributeDefault('COMPLETED', null);
|
||||||
|
$x_infolog_status = $component->getAttributeDefault('X-INFOLOG-STATUS', null);
|
||||||
// check if we have a X-INFOLOG-STATUS and it's completed state is different from given COMPLETED attr
|
// check if we have a X-INFOLOG-STATUS and it's completed state is different from given COMPLETED attr
|
||||||
if (is_scalar($x_infolog_status) &&
|
if (is_scalar($x_infolog_status) &&
|
||||||
($this->_status2vtodo[$x_infolog_status] === 'COMPLETED') != is_scalar($completed))
|
($this->_status2vtodo[$x_infolog_status] === 'COMPLETED') != is_scalar($completed))
|
||||||
{
|
{
|
||||||
$percent_completed = $component->getAttribute('PERCENT-COMPLETE');
|
$percent_completed = $component->getAttributeDefault('PERCENT-COMPLETE', null);
|
||||||
$status = $completed && is_scalar($completed) ? 'COMPLETED' :
|
$status = $completed && is_scalar($completed) ? 'COMPLETED' :
|
||||||
($percent_completed && is_scalar($percent_completed) && $percent_completed > 0 ? 'IN-PROCESS' : 'NEEDS-ACTION');
|
($percent_completed && is_scalar($percent_completed) && $percent_completed > 0 ? 'IN-PROCESS' : 'NEEDS-ACTION');
|
||||||
$component->setAttribute('STATUS', $status);
|
$component->setAttribute('STATUS', $status);
|
||||||
@ -756,7 +760,7 @@ class infolog_ical extends infolog_bo
|
|||||||
case 'DURATION':
|
case 'DURATION':
|
||||||
if (!isset($taskData['info_startdate']))
|
if (!isset($taskData['info_startdate']))
|
||||||
{
|
{
|
||||||
$taskData['info_startdate'] = $component->getAttribute('DTSTART');
|
$taskData['info_startdate'] = $component->getAttributeDefault('DTSTART', null);
|
||||||
}
|
}
|
||||||
$attribute['value'] += $taskData['info_startdate'];
|
$attribute['value'] += $taskData['info_startdate'];
|
||||||
$taskData['##DURATION'] = $attribute['value'];
|
$taskData['##DURATION'] = $attribute['value'];
|
||||||
@ -800,7 +804,7 @@ class infolog_ical extends infolog_bo
|
|||||||
case 'STATUS':
|
case 'STATUS':
|
||||||
// check if we (still) have X-INFOLOG-STATUS set AND it would give an unchanged status (no change by the user)
|
// check if we (still) have X-INFOLOG-STATUS set AND it would give an unchanged status (no change by the user)
|
||||||
$taskData['info_status'] = $this->vtodo2status($attribute['value'],
|
$taskData['info_status'] = $this->vtodo2status($attribute['value'],
|
||||||
($attr=$component->getAttribute('X-INFOLOG-STATUS')) && is_scalar($attr) ? $attr : null);
|
$component->getAttributeDefault('X-INFOLOG-STATUS', null));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SUMMARY':
|
case 'SUMMARY':
|
||||||
|
Loading…
Reference in New Issue
Block a user