Little code cleanup

This commit is contained in:
Thomas Bruederli 2013-04-17 09:19:26 +02:00
parent c077ed555f
commit 5c84fd55aa
2 changed files with 10 additions and 6 deletions

View file

@ -580,10 +580,8 @@ class kolab_calendar
*/
private function _from_rcube_event($event, $old = array())
{
$object = &$event;
// in kolab_storage attachments are indexed by content-id
$object['_attachments'] = array();
$event['_attachments'] = array();
if (is_array($event['attachments'])) {
foreach ($event['attachments'] as $idx => $attachment) {
$key = null;
@ -600,15 +598,15 @@ class kolab_calendar
// flagged for deletion => set to false
if ($attachment['_deleted']) {
$object['_attachments'][$key] = false;
$event['_attachments'][$key] = false;
}
// replace existing entry
else if ($key) {
$object['_attachments'][$key] = $attachment;
$event['_attachments'][$key] = $attachment;
}
// append as new attachment
else {
$object['_attachments'][] = $attachment;
$event['_attachments'][] = $attachment;
}
}
@ -625,6 +623,9 @@ class kolab_calendar
$event['_owner'] = $identity['email'];
// remove some internal properties which should not be saved
unset($event['_savemode'], $event['_fromcalendar'], $event['_identity']);
// copy meta data (starting with _) from old object
foreach ((array)$old as $key => $val) {
if (!isset($event[$key]) && $key[0] == '_')

View file

@ -610,6 +610,9 @@ class kolab_driver extends calendar_driver
$event['recurrence'] = array();
$event['thisandfuture'] = $savemode == 'future';
// remove some internal properties which should not be saved
unset($event['_savemode'], $event['_fromcalendar'], $event['_identity']);
// save properties to a recurrence exception instance
if ($old['recurrence_id']) {
$i = $old['_instance'] - 1;