@@ -64,39 +64,39 @@ discard block |
||
| 64 | 64 | * @var array $priority_egw2ical conversion of the priority egw => ical |
| 65 | 65 | */ |
| 66 | 66 | var $priority_egw2ical = array( |
| 67 | - 0 => 0, // undefined |
|
| 68 | - 1 => 9, // low |
|
| 69 | - 2 => 5, // normal |
|
| 70 | - 3 => 1, // high |
|
| 67 | + 0 => 0, // undefined |
|
| 68 | + 1 => 9, // low |
|
| 69 | + 2 => 5, // normal |
|
| 70 | + 3 => 1, // high |
|
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * @var array $priority_ical2egw conversion of the priority ical => egw |
| 75 | 75 | */ |
| 76 | 76 | var $priority_ical2egw = array( |
| 77 | - 0 => 0, // undefined |
|
| 78 | - 9 => 1, 8 => 1, 7 => 1, 6 => 1, // low |
|
| 79 | - 5 => 2, // normal |
|
| 80 | - 4 => 3, 3 => 3, 2 => 3, 1 => 3, // high |
|
| 77 | + 0 => 0, // undefined |
|
| 78 | + 9 => 1, 8 => 1, 7 => 1, 6 => 1, // low |
|
| 79 | + 5 => 2, // normal |
|
| 80 | + 4 => 3, 3 => 3, 2 => 3, 1 => 3, // high |
|
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * @var array $priority_egw2funambol conversion of the priority egw => funambol |
| 85 | 85 | */ |
| 86 | 86 | var $priority_egw2funambol = array( |
| 87 | - 0 => 1, // undefined (mapped to normal since undefined does not exist) |
|
| 88 | - 1 => 0, // low |
|
| 89 | - 2 => 1, // normal |
|
| 90 | - 3 => 2, // high |
|
| 87 | + 0 => 1, // undefined (mapped to normal since undefined does not exist) |
|
| 88 | + 1 => 0, // low |
|
| 89 | + 2 => 1, // normal |
|
| 90 | + 3 => 2, // high |
|
| 91 | 91 | ); |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * @var array $priority_funambol2egw conversion of the priority funambol => egw |
| 95 | 95 | */ |
| 96 | 96 | var $priority_funambol2egw = array( |
| 97 | - 0 => 1, // low |
|
| 98 | - 1 => 2, // normal |
|
| 99 | - 2 => 3, // high |
|
| 97 | + 0 => 1, // low |
|
| 98 | + 1 => 2, // normal |
|
| 99 | + 2 => 3, // high |
|
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @var boolean |
| 167 | 167 | */ |
| 168 | 168 | var $log = false; |
| 169 | - var $logfile="/tmp/log-vcal"; |
|
| 169 | + var $logfile = "/tmp/log-vcal"; |
|
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * Conflict callback |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @param int|string $current_user =0 uid of current user to only export that one as participant for method=REPLY |
| 204 | 204 | * @return string|boolean string with iCal or false on error (e.g. no permission to read the event) |
| 205 | 205 | */ |
| 206 | - function &exportVCal($events, $version='1.0', $method='PUBLISH', $recur_date=0, $principalURL='', $charset='UTF-8', $current_user=0) |
|
| 206 | + function &exportVCal($events, $version = '1.0', $method = 'PUBLISH', $recur_date = 0, $principalURL = '', $charset = 'UTF-8', $current_user = 0) |
|
| 207 | 207 | { |
| 208 | 208 | if ($this->log) |
| 209 | 209 | { |
@@ -234,13 +234,13 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | if (!is_array($this->supportedFields)) $this->setSupportedFields(); |
| 236 | 236 | |
| 237 | - if ($this->productManufacturer == '' ) |
|
| 237 | + if ($this->productManufacturer == '') |
|
| 238 | 238 | { // syncevolution is broken |
| 239 | 239 | $version = '2.0'; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $vcal = new Horde_Icalendar; |
| 243 | - $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
|
| 243 | + $vcal->setAttribute('PRODID', '-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
|
| 244 | 244 | strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang'])); |
| 245 | 245 | $vcal->setAttribute('VERSION', $version); |
| 246 | 246 | if ($method) $vcal->setAttribute('METHOD', $method); |
@@ -270,15 +270,15 @@ discard block |
||
| 270 | 270 | if ($this->log) |
| 271 | 271 | { |
| 272 | 272 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 273 | - '() User does not have the permission to read event ' . $event['id']. "\n", |
|
| 274 | - 3,$this->logfile); |
|
| 273 | + '() User does not have the permission to read event '.$event['id']."\n", |
|
| 274 | + 3, $this->logfile); |
|
| 275 | 275 | } |
| 276 | 276 | return -1; // Permission denied |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | else |
| 280 | 280 | { |
| 281 | - $retval = false; // Entry does not exist |
|
| 281 | + $retval = false; // Entry does not exist |
|
| 282 | 282 | if ($this->log) |
| 283 | 283 | { |
| 284 | 284 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | if ($this->log) |
| 293 | 293 | { |
| 294 | 294 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 295 | - '() export event UID: ' . $event['uid'] . ".\n", |
|
| 295 | + '() export event UID: '.$event['uid'].".\n", |
|
| 296 | 296 | 3, $this->logfile); |
| 297 | 297 | } |
| 298 | 298 | |
@@ -317,8 +317,8 @@ discard block |
||
| 317 | 317 | if ($this->log) |
| 318 | 318 | { |
| 319 | 319 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 320 | - '(' . $event['id']. ',' . $recurrence . ")\n" . |
|
| 321 | - array2string($event)."\n",3,$this->logfile); |
|
| 320 | + '('.$event['id'].','.$recurrence.")\n". |
|
| 321 | + array2string($event)."\n", 3, $this->logfile); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | if ($recurrence) |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | { |
| 340 | 340 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 341 | 341 | "(, $recurrence) Gratuitous pseudo exception, skipped ...\n", |
| 342 | - 3,$this->logfile); |
|
| 342 | + 3, $this->logfile); |
|
| 343 | 343 | } |
| 344 | 344 | continue; // unsupported status only exception |
| 345 | 345 | } |
@@ -349,13 +349,13 @@ discard block |
||
| 349 | 349 | $days = $this->so->get_recurrence_exceptions($master, $tzid, 0, 0, 'rrule'); |
| 350 | 350 | if ($this->log) |
| 351 | 351 | { |
| 352 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
| 353 | - array2string($days)."\n",3,$this->logfile); |
|
| 352 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
| 353 | + array2string($days)."\n", 3, $this->logfile); |
|
| 354 | 354 | } |
| 355 | 355 | $recurrence = $days[$recurrence]; // use remote representation |
| 356 | 356 | } |
| 357 | 357 | // force single event |
| 358 | - foreach (array('recur_enddate','recur_interval','recur_exception','recur_data','recur_date','id','etag') as $name) |
|
| 358 | + foreach (array('recur_enddate', 'recur_interval', 'recur_exception', 'recur_data', 'recur_date', 'id', 'etag') as $name) |
|
| 359 | 359 | { |
| 360 | 360 | unset($event[$name]); |
| 361 | 361 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | // check if tzid of event (not only recuring ones) is already added to export |
| 366 | - if ($tzid && $tzid != 'UTC' && !in_array($tzid,$vtimezones_added)) |
|
| 366 | + if ($tzid && $tzid != 'UTC' && !in_array($tzid, $vtimezones_added)) |
|
| 367 | 367 | { |
| 368 | 368 | // check if we have vtimezone component data for tzid of event, if not default to user timezone (default to server tz) |
| 369 | 369 | if (calendar_timezones::add_vtimezone($vcal, $tzid) || |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | { |
| 382 | 382 | // Append UID to DESCRIPTION |
| 383 | 383 | if (!preg_match('/\[UID:.+\]/m', $event['description'])) { |
| 384 | - $event['description'] .= "\n[UID:" . $event['uid'] . "]"; |
|
| 384 | + $event['description'] .= "\n[UID:".$event['uid']."]"; |
|
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | |
@@ -402,14 +402,14 @@ discard block |
||
| 402 | 402 | $exceptions = array(); |
| 403 | 403 | |
| 404 | 404 | // dont use "virtual" exceptions created by participant status for GroupDAV or file export |
| 405 | - if (!in_array($this->productManufacturer,array('file','groupdav'))) |
|
| 405 | + if (!in_array($this->productManufacturer, array('file', 'groupdav'))) |
|
| 406 | 406 | { |
| 407 | 407 | $filter = isset($this->supportedFields['participants']) ? 'rrule' : 'tz_rrule'; |
| 408 | 408 | $exceptions = $this->so->get_recurrence_exceptions($event, $tzid, 0, 0, $filter); |
| 409 | 409 | if ($this->log) |
| 410 | 410 | { |
| 411 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."(EXCEPTIONS)\n" . |
|
| 412 | - array2string($exceptions)."\n",3,$this->logfile); |
|
| 411 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."(EXCEPTIONS)\n". |
|
| 412 | + array2string($exceptions)."\n", 3, $this->logfile); |
|
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | elseif (is_array($event['recur_exception'])) |
@@ -426,8 +426,8 @@ discard block |
||
| 426 | 426 | if ($this->log) |
| 427 | 427 | { |
| 428 | 428 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 429 | - '(' . $event['id'] . ") [$icalFieldName] not supported\n", |
|
| 430 | - 3,$this->logfile); |
|
| 429 | + '('.$event['id'].") [$icalFieldName] not supported\n", |
|
| 430 | + 3, $this->logfile); |
|
| 431 | 431 | } |
| 432 | 432 | continue; |
| 433 | 433 | } |
@@ -444,23 +444,23 @@ discard block |
||
| 444 | 444 | |
| 445 | 445 | if (!($info = $this->resource_info($uid))) continue; |
| 446 | 446 | |
| 447 | - if (in_array($status, array('X','E'))) continue; // dont include deleted participants |
|
| 447 | + if (in_array($status, array('X', 'E'))) continue; // dont include deleted participants |
|
| 448 | 448 | |
| 449 | 449 | if ($this->log) |
| 450 | 450 | { |
| 451 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 452 | - '()attendee:' . array2string($info) ."\n",3,$this->logfile); |
|
| 451 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 452 | + '()attendee:'.array2string($info)."\n", 3, $this->logfile); |
|
| 453 | 453 | } |
| 454 | 454 | $participantCN = str_replace(array('\\', ',', ';', ':'), |
| 455 | 455 | array('\\\\', '\\,', '\\;', '\\:'), |
| 456 | 456 | trim(empty($info['cn']) ? $info['name'] : $info['cn'])); |
| 457 | 457 | if ($version == '1.0') |
| 458 | 458 | { |
| 459 | - $participantURL = trim('"' . $participantCN . '"' . (empty($info['email']) ? '' : ' <' . $info['email'] .'>')); |
|
| 459 | + $participantURL = trim('"'.$participantCN.'"'.(empty($info['email']) ? '' : ' <'.$info['email'].'>')); |
|
| 460 | 460 | } |
| 461 | 461 | else |
| 462 | 462 | { |
| 463 | - $participantURL = empty($info['email']) ? '' : 'mailto:' . $info['email']; |
|
| 463 | + $participantURL = empty($info['email']) ? '' : 'mailto:'.$info['email']; |
|
| 464 | 464 | } |
| 465 | 465 | // RSVP={TRUE|FALSE} // resonse expected, not set in eGW => status=U |
| 466 | 466 | $rsvp = $status == 'U' ? 'TRUE' : 'FALSE'; |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | ($members = $GLOBALS['egw']->accounts->members($uid, true)) && in_array($this->user, $members)) |
| 489 | 489 | { |
| 490 | 490 | $user = $this->resource_info($this->user); |
| 491 | - $attributes['ATTENDEE'][] = 'mailto:' . $user['email']; |
|
| 491 | + $attributes['ATTENDEE'][] = 'mailto:'.$user['email']; |
|
| 492 | 492 | $parameters['ATTENDEE'][] = array( |
| 493 | 493 | 'CN' => $user['name'], |
| 494 | 494 | 'ROLE' => 'REQ-PARTICIPANT', |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | if (!empty($rsvp)) $options['RSVP'] = $rsvp; |
| 531 | 531 | if (!empty($info['email']) && $participantURL != 'mailto:'.$info['email']) |
| 532 | 532 | { |
| 533 | - $options['EMAIL'] = $info['email']; // only add EMAIL attribute, if not already URL, as eg. Akonadi is reported to have problems with it |
|
| 533 | + $options['EMAIL'] = $info['email']; // only add EMAIL attribute, if not already URL, as eg. Akonadi is reported to have problems with it |
|
| 534 | 534 | } |
| 535 | 535 | if ($info['type'] != 'e') $options['X-EGROUPWARE-UID'] = (string)$uid; |
| 536 | 536 | if ($quantity > 1) $options['X-EGROUPWARE-QUANTITY'] = (string)$quantity; |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | break; |
| 541 | 541 | |
| 542 | 542 | case 'CLASS': |
| 543 | - if ($event['public']) continue; // public is default, no need to export, fails CalDAVTester if added as default |
|
| 543 | + if ($event['public']) continue; // public is default, no need to export, fails CalDAVTester if added as default |
|
| 544 | 544 | $attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'PRIVATE'; |
| 545 | 545 | // Apple iCal on OS X uses X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALANDAR (not VEVENT!) |
| 546 | 546 | if (!$event['public'] && $this->productManufacturer == 'groupdav') |
@@ -552,16 +552,16 @@ discard block |
||
| 552 | 552 | case 'ORGANIZER': |
| 553 | 553 | if (!$organizerURL) |
| 554 | 554 | { |
| 555 | - $organizerCN = '"' . trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname') |
|
| 556 | - . ' ' . $GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname')) . '"'; |
|
| 557 | - $organizerEMail = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_email'); |
|
| 555 | + $organizerCN = '"'.trim($GLOBALS['egw']->accounts->id2name($event['owner'], 'account_firstname') |
|
| 556 | + . ' '.$GLOBALS['egw']->accounts->id2name($event['owner'], 'account_lastname')).'"'; |
|
| 557 | + $organizerEMail = $GLOBALS['egw']->accounts->id2name($event['owner'], 'account_email'); |
|
| 558 | 558 | if ($version == '1.0') |
| 559 | 559 | { |
| 560 | - $organizerURL = trim($organizerCN . (empty($organizerURL) ? '' : ' <' . $organizerURL .'>')); |
|
| 560 | + $organizerURL = trim($organizerCN.(empty($organizerURL) ? '' : ' <'.$organizerURL.'>')); |
|
| 561 | 561 | } |
| 562 | 562 | else |
| 563 | 563 | { |
| 564 | - $organizerURL = empty($organizerEMail) ? '' : 'mailto:' . $organizerEMail; |
|
| 564 | + $organizerURL = empty($organizerEMail) ? '' : 'mailto:'.$organizerEMail; |
|
| 565 | 565 | } |
| 566 | 566 | $organizerUID = $event['owner']; |
| 567 | 567 | if (!isset($event['participants'][$event['owner']])) |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | case 'DTSTART': |
| 595 | 595 | if (empty($event['whole_day'])) |
| 596 | 596 | { |
| 597 | - $attributes['DTSTART'] = self::getDateTime($event['start'],$tzid,$parameters['DTSTART']); |
|
| 597 | + $attributes['DTSTART'] = self::getDateTime($event['start'], $tzid, $parameters['DTSTART']); |
|
| 598 | 598 | } |
| 599 | 599 | break; |
| 600 | 600 | |
@@ -605,27 +605,27 @@ discard block |
||
| 605 | 605 | if ($tzid == 'UTC' && $event['end'] - $event['start'] <= 86400) |
| 606 | 606 | $attributes['duration'] = $event['end'] - $event['start']; |
| 607 | 607 | else |
| 608 | - $attributes['DTEND'] = self::getDateTime($event['end'],$tzid,$parameters['DTEND']); |
|
| 608 | + $attributes['DTEND'] = self::getDateTime($event['end'], $tzid, $parameters['DTEND']); |
|
| 609 | 609 | } |
| 610 | 610 | else |
| 611 | 611 | { |
| 612 | 612 | // write start + end of whole day events as dates |
| 613 | - $event['end-nextday'] = $event['end'] + 12*3600; // we need the date of the next day, as DTEND is non-inclusive (= exclusive) in rfc2445 |
|
| 614 | - foreach (array('start' => 'DTSTART','end-nextday' => 'DTEND') as $f => $t) |
|
| 613 | + $event['end-nextday'] = $event['end'] + 12 * 3600; // we need the date of the next day, as DTEND is non-inclusive (= exclusive) in rfc2445 |
|
| 614 | + foreach (array('start' => 'DTSTART', 'end-nextday' => 'DTEND') as $f => $t) |
|
| 615 | 615 | { |
| 616 | - $time = new Api\DateTime($event[$f],Api\DateTime::$server_timezone); |
|
| 617 | - $arr = Api\DateTime::to($time,'array'); |
|
| 618 | - $vevent->setAttribute($t, array('year' => $arr['year'],'month' => $arr['month'],'mday' => $arr['day']), |
|
| 616 | + $time = new Api\DateTime($event[$f], Api\DateTime::$server_timezone); |
|
| 617 | + $arr = Api\DateTime::to($time, 'array'); |
|
| 618 | + $vevent->setAttribute($t, array('year' => $arr['year'], 'month' => $arr['month'], 'mday' => $arr['day']), |
|
| 619 | 619 | array('VALUE' => 'DATE')); |
| 620 | 620 | } |
| 621 | 621 | unset($attributes['DTSTART']); |
| 622 | 622 | // Outlook does NOT care about type of DTSTART/END, only setting X-MICROSOFT-CDO-ALLDAYEVENT is used to determine an event is a whole-day event |
| 623 | - $vevent->setAttribute('X-MICROSOFT-CDO-ALLDAYEVENT','TRUE'); |
|
| 623 | + $vevent->setAttribute('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE'); |
|
| 624 | 624 | } |
| 625 | 625 | break; |
| 626 | 626 | |
| 627 | 627 | case 'RRULE': |
| 628 | - if ($event['recur_type'] == MCAL_RECUR_NONE) break; // no recuring event |
|
| 628 | + if ($event['recur_type'] == MCAL_RECUR_NONE) break; // no recuring event |
|
| 629 | 629 | $rriter = calendar_rrule::event2rrule($event, false, $tzid); |
| 630 | 630 | $rrule = $rriter->generate_rrule($version); |
| 631 | 631 | if ($event['recur_enddate']) |
@@ -652,16 +652,16 @@ discard block |
||
| 652 | 652 | { |
| 653 | 653 | if ($event['recur_enddate'] && $tzid) |
| 654 | 654 | { |
| 655 | - $rrule['UNTIL'] = self::getDateTime($rrule['UNTIL'],$tzid); |
|
| 655 | + $rrule['UNTIL'] = self::getDateTime($rrule['UNTIL'], $tzid); |
|
| 656 | 656 | } |
| 657 | 657 | $attributes['RRULE'] = $rrule['FREQ'].' '.$rrule['UNTIL']; |
| 658 | 658 | } |
| 659 | 659 | else // $version == '2.0' |
| 660 | 660 | { |
| 661 | 661 | $attributes['RRULE'] = ''; |
| 662 | - foreach($rrule as $n => $v) |
|
| 662 | + foreach ($rrule as $n => $v) |
|
| 663 | 663 | { |
| 664 | - $attributes['RRULE'] .= ($attributes['RRULE']?';':'').$n.'='.$v; |
|
| 664 | + $attributes['RRULE'] .= ($attributes['RRULE'] ? ';' : '').$n.'='.$v; |
|
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | 667 | break; |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | { |
| 677 | 677 | // current Horde_Icalendar 2.1.4 exports EXDATE always in UTC, so we should not set a timezone here |
| 678 | 678 | // Apple calendar on OS X 10.11.4 uses a timezone, so does Horde eg. for Recurrence-ID |
| 679 | - $event['recur_exception'][$key] = self::getDateTime($timestamp,$tzid);//,$parameters['EXDATE']); |
|
| 679 | + $event['recur_exception'][$key] = self::getDateTime($timestamp, $tzid); //,$parameters['EXDATE']); |
|
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | 682 | else |
@@ -684,9 +684,9 @@ discard block |
||
| 684 | 684 | // use 'DATE' instead of 'DATE-TIME' on whole day events |
| 685 | 685 | foreach ($event['recur_exception'] as $id => $timestamp) |
| 686 | 686 | { |
| 687 | - $time = new Api\DateTime($timestamp,Api\DateTime::$server_timezone); |
|
| 687 | + $time = new Api\DateTime($timestamp, Api\DateTime::$server_timezone); |
|
| 688 | 688 | $time->setTimezone(self::$tz_cache[$event['tzid']]); |
| 689 | - $arr = Api\DateTime::to($time,'array'); |
|
| 689 | + $arr = Api\DateTime::to($time, 'array'); |
|
| 690 | 690 | $days[$id] = array( |
| 691 | 691 | 'year' => $arr['year'], |
| 692 | 692 | 'month' => $arr['month'], |
@@ -701,21 +701,21 @@ discard block |
||
| 701 | 701 | break; |
| 702 | 702 | |
| 703 | 703 | case 'PRIORITY': |
| 704 | - if (!$event['priority']) continue; // 0=undefined is default, no need to export, fails CalDAVTester if our default is added |
|
| 704 | + if (!$event['priority']) continue; // 0=undefined is default, no need to export, fails CalDAVTester if our default is added |
|
| 705 | 705 | if ($this->productManufacturer == 'funambol' && |
| 706 | 706 | (strpos($this->productName, 'outlook') !== false |
| 707 | 707 | || strpos($this->productName, 'pocket pc') !== false)) |
| 708 | 708 | { |
| 709 | - $attributes['PRIORITY'] = (int) $this->priority_egw2funambol[$event['priority']]; |
|
| 709 | + $attributes['PRIORITY'] = (int)$this->priority_egw2funambol[$event['priority']]; |
|
| 710 | 710 | } |
| 711 | 711 | else |
| 712 | 712 | { |
| 713 | - $attributes['PRIORITY'] = (int) $this->priority_egw2ical[$event['priority']]; |
|
| 713 | + $attributes['PRIORITY'] = (int)$this->priority_egw2ical[$event['priority']]; |
|
| 714 | 714 | } |
| 715 | 715 | break; |
| 716 | 716 | |
| 717 | 717 | case 'TRANSP': |
| 718 | - if (!$event['non_blocking']) continue; // OPAQUE is default, no need to export, fails CalDAVTester if added as default |
|
| 718 | + if (!$event['non_blocking']) continue; // OPAQUE is default, no need to export, fails CalDAVTester if added as default |
|
| 719 | 719 | if ($version == '1.0') |
| 720 | 720 | { |
| 721 | 721 | $attributes['TRANSP'] = ($event['non_blocking'] ? 1 : 0); |
@@ -754,13 +754,13 @@ discard block |
||
| 754 | 754 | // We handle a pseudo exception |
| 755 | 755 | if (empty($event['whole_day'])) |
| 756 | 756 | { |
| 757 | - $attributes[$icalFieldName] = self::getDateTime($recur_date,$tzid,$parameters[$icalFieldName]); |
|
| 757 | + $attributes[$icalFieldName] = self::getDateTime($recur_date, $tzid, $parameters[$icalFieldName]); |
|
| 758 | 758 | } |
| 759 | 759 | else |
| 760 | 760 | { |
| 761 | - $time = new Api\DateTime($recur_date,Api\DateTime::$server_timezone); |
|
| 761 | + $time = new Api\DateTime($recur_date, Api\DateTime::$server_timezone); |
|
| 762 | 762 | $time->setTimezone(self::$tz_cache[$event['tzid']]); |
| 763 | - $arr = Api\DateTime::to($time,'array'); |
|
| 763 | + $arr = Api\DateTime::to($time, 'array'); |
|
| 764 | 764 | $vevent->setAttribute($icalFieldName, array( |
| 765 | 765 | 'year' => $arr['year'], |
| 766 | 766 | 'month' => $arr['month'], |
@@ -772,17 +772,17 @@ discard block |
||
| 772 | 772 | elseif ($event['recurrence'] && $event['reference']) |
| 773 | 773 | { |
| 774 | 774 | // $event['reference'] is a calendar_id, not a timestamp |
| 775 | - if (!($revent = $this->read($event['reference']))) break; // referenced event does not exist |
|
| 775 | + if (!($revent = $this->read($event['reference']))) break; // referenced event does not exist |
|
| 776 | 776 | |
| 777 | 777 | if (empty($revent['whole_day'])) |
| 778 | 778 | { |
| 779 | - $attributes[$icalFieldName] = self::getDateTime($event['recurrence'],$tzid,$parameters[$icalFieldName]); |
|
| 779 | + $attributes[$icalFieldName] = self::getDateTime($event['recurrence'], $tzid, $parameters[$icalFieldName]); |
|
| 780 | 780 | } |
| 781 | 781 | else |
| 782 | 782 | { |
| 783 | - $time = new Api\DateTime($event['recurrence'],Api\DateTime::$server_timezone); |
|
| 783 | + $time = new Api\DateTime($event['recurrence'], Api\DateTime::$server_timezone); |
|
| 784 | 784 | $time->setTimezone(self::$tz_cache[$event['tzid']]); |
| 785 | - $arr = Api\DateTime::to($time,'array'); |
|
| 785 | + $arr = Api\DateTime::to($time, 'array'); |
|
| 786 | 786 | $vevent->setAttribute($icalFieldName, array( |
| 787 | 787 | 'year' => $arr['year'], |
| 788 | 788 | 'month' => $arr['month'], |
@@ -806,9 +806,9 @@ discard block |
||
| 806 | 806 | $noTruncate = $this->clientProperties[$icalFieldName]['NoTruncate']; |
| 807 | 807 | if ($this->log && $size > 0) |
| 808 | 808 | { |
| 809 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 810 | - "() $icalFieldName Size: $size, NoTruncate: " . |
|
| 811 | - ($noTruncate ? 'TRUE' : 'FALSE') . "\n",3,$this->logfile); |
|
| 809 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 810 | + "() $icalFieldName Size: $size, NoTruncate: ". |
|
| 811 | + ($noTruncate ? 'TRUE' : 'FALSE')."\n", 3, $this->logfile); |
|
| 812 | 812 | } |
| 813 | 813 | //Horde::logMessage("vCalendar $icalFieldName Size: $size, NoTruncate: " . |
| 814 | 814 | // ($noTruncate ? 'TRUE' : 'FALSE'), __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -826,8 +826,8 @@ discard block |
||
| 826 | 826 | { |
| 827 | 827 | if ($this->log) |
| 828 | 828 | { |
| 829 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 830 | - "() $icalFieldName omitted due to maximum size $size\n",3,$this->logfile); |
|
| 829 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 830 | + "() $icalFieldName omitted due to maximum size $size\n", 3, $this->logfile); |
|
| 831 | 831 | } |
| 832 | 832 | //Horde::logMessage("vCalendar $icalFieldName omitted due to maximum size $size", |
| 833 | 833 | // __FILE__, __LINE__, PEAR_LOG_WARNING); |
@@ -837,8 +837,8 @@ discard block |
||
| 837 | 837 | $value = substr($value, 0, $size - 1); |
| 838 | 838 | if ($this->log) |
| 839 | 839 | { |
| 840 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 841 | - "() $icalFieldName truncated to maximum size $size\n",3,$this->logfile); |
|
| 840 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 841 | + "() $icalFieldName truncated to maximum size $size\n", 3, $this->logfile); |
|
| 842 | 842 | } |
| 843 | 843 | //Horde::logMessage("vCalendar $icalFieldName truncated to maximum size $size", |
| 844 | 844 | // __FILE__, __LINE__, PEAR_LOG_INFO); |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | // for CalDAV add all X-Properties previously parsed |
| 854 | 854 | if ($this->productManufacturer == 'groupdav' || $this->productManufacturer == 'file') |
| 855 | 855 | { |
| 856 | - foreach($event as $name => $value) |
|
| 856 | + foreach ($event as $name => $value) |
|
| 857 | 857 | { |
| 858 | 858 | if (substr($name, 0, 2) == '##') |
| 859 | 859 | { |
@@ -925,8 +925,8 @@ discard block |
||
| 925 | 925 | $values['AALARM']['repeat count'] = ''; |
| 926 | 926 | $values['AALARM']['display text'] = $description; |
| 927 | 927 | } |
| 928 | - $attributes['DALARM'] = self::getDateTime($alarmData['time'],$tzid,$parameters['DALARM']); |
|
| 929 | - $attributes['AALARM'] = self::getDateTime($alarmData['time'],$tzid,$parameters['AALARM']); |
|
| 928 | + $attributes['DALARM'] = self::getDateTime($alarmData['time'], $tzid, $parameters['DALARM']); |
|
| 929 | + $attributes['AALARM'] = self::getDateTime($alarmData['time'], $tzid, $parameters['AALARM']); |
|
| 930 | 930 | // lets take only the first alarm |
| 931 | 931 | break; |
| 932 | 932 | } |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | $alarmData['offset'] = false; |
| 964 | 964 | } |
| 965 | 965 | |
| 966 | - $valarm = Horde_Icalendar::newComponent('VALARM',$vevent); |
|
| 966 | + $valarm = Horde_Icalendar::newComponent('VALARM', $vevent); |
|
| 967 | 967 | if ($alarmData['offset'] !== false) |
| 968 | 968 | { |
| 969 | 969 | $valarm->setAttribute('TRIGGER', -$alarmData['offset'], |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | else |
| 973 | 973 | { |
| 974 | 974 | $params = array('VALUE' => 'DATE-TIME'); |
| 975 | - $value = self::getDateTime($alarmData['time'],$tzid,$params); |
|
| 975 | + $value = self::getDateTime($alarmData['time'], $tzid, $params); |
|
| 976 | 976 | $valarm->setAttribute('TRIGGER', $value, $params); |
| 977 | 977 | } |
| 978 | 978 | if (!empty($alarmData['uid'])) |
@@ -983,7 +983,7 @@ discard block |
||
| 983 | 983 | // set evtl. existing attributes set by iCal clients not used by EGroupware |
| 984 | 984 | if (isset($alarmData['attrs'])) |
| 985 | 985 | { |
| 986 | - foreach($alarmData['attrs'] as $attr => $data) |
|
| 986 | + foreach ($alarmData['attrs'] as $attr => $data) |
|
| 987 | 987 | { |
| 988 | 988 | $valarm->setAttribute($attr, $data['value'], $data['params']); |
| 989 | 989 | } |
@@ -991,11 +991,11 @@ discard block |
||
| 991 | 991 | // set default ACTION and DESCRIPTION, if not set by a client |
| 992 | 992 | if (!isset($alarmData['attrs']) || !isset($alarmData['attrs']['ACTION'])) |
| 993 | 993 | { |
| 994 | - $valarm->setAttribute('ACTION','DISPLAY'); |
|
| 994 | + $valarm->setAttribute('ACTION', 'DISPLAY'); |
|
| 995 | 995 | } |
| 996 | 996 | if (!isset($alarmData['attrs']) || !isset($alarmData['attrs']['DESCRIPTION'])) |
| 997 | 997 | { |
| 998 | - $valarm->setAttribute('DESCRIPTION',$event['title'] ? $event['title'] : $description); |
|
| 998 | + $valarm->setAttribute('DESCRIPTION', $event['title'] ? $event['title'] : $description); |
|
| 999 | 999 | } |
| 1000 | 1000 | $vevent->addComponent($valarm); |
| 1001 | 1001 | } |
@@ -1003,15 +1003,15 @@ discard block |
||
| 1003 | 1003 | |
| 1004 | 1004 | foreach ($attributes as $key => $value) |
| 1005 | 1005 | { |
| 1006 | - foreach (is_array($value) && $parameters[$key]['VALUE']!='DATE' ? $value : array($value) as $valueID => $valueData) |
|
| 1006 | + foreach (is_array($value) && $parameters[$key]['VALUE'] != 'DATE' ? $value : array($value) as $valueID => $valueData) |
|
| 1007 | 1007 | { |
| 1008 | - $valueData = Api\Translation::convert($valueData,Api\Translation::charset(),$charset); |
|
| 1009 | - $paramData = (array) Api\Translation::convert(is_array($value) ? |
|
| 1008 | + $valueData = Api\Translation::convert($valueData, Api\Translation::charset(), $charset); |
|
| 1009 | + $paramData = (array)Api\Translation::convert(is_array($value) ? |
|
| 1010 | 1010 | $parameters[$key][$valueID] : $parameters[$key], |
| 1011 | - Api\Translation::charset(),$charset); |
|
| 1012 | - $valuesData = (array) Api\Translation::convert($values[$key], |
|
| 1013 | - Api\Translation::charset(),$charset); |
|
| 1014 | - $content = $valueData . implode(';', $valuesData); |
|
| 1011 | + Api\Translation::charset(), $charset); |
|
| 1012 | + $valuesData = (array)Api\Translation::convert($values[$key], |
|
| 1013 | + Api\Translation::charset(), $charset); |
|
| 1014 | + $content = $valueData.implode(';', $valuesData); |
|
| 1015 | 1015 | |
| 1016 | 1016 | if ($version == '1.0' && (preg_match('/[^\x20-\x7F]/', $content) || |
| 1017 | 1017 | ($paramData['CN'] && preg_match('/[^\x20-\x7F]/', $paramData['CN'])))) |
@@ -1061,10 +1061,10 @@ discard block |
||
| 1061 | 1061 | $retval = $events_exported ? $vcal->exportvCalendar() : false; |
| 1062 | 1062 | if ($this->log) |
| 1063 | 1063 | { |
| 1064 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 1065 | - "() '$this->productManufacturer','$this->productName'\n",3,$this->logfile); |
|
| 1066 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 1067 | - "()\n".array2string($retval)."\n",3,$this->logfile); |
|
| 1064 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 1065 | + "() '$this->productManufacturer','$this->productName'\n", 3, $this->logfile); |
|
| 1066 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 1067 | + "()\n".array2string($retval)."\n", 3, $this->logfile); |
|
| 1068 | 1068 | } |
| 1069 | 1069 | return $retval; |
| 1070 | 1070 | } |
@@ -1077,15 +1077,15 @@ discard block |
||
| 1077 | 1077 | * @param array &$params=null parameter array to set TZID |
| 1078 | 1078 | * @return mixed attribute value to set: integer timestamp if $tzid == 'UTC' otherwise Ymd\THis string IN $tzid |
| 1079 | 1079 | */ |
| 1080 | - static function getDateTime($time,$tzid,array &$params=null) |
|
| 1080 | + static function getDateTime($time, $tzid, array &$params = null) |
|
| 1081 | 1081 | { |
| 1082 | 1082 | if (empty($tzid) || $tzid == 'UTC') |
| 1083 | 1083 | { |
| 1084 | - return Api\DateTime::to($time,'ts'); |
|
| 1084 | + return Api\DateTime::to($time, 'ts'); |
|
| 1085 | 1085 | } |
| 1086 | - if (!is_a($time,'DateTime')) |
|
| 1086 | + if (!is_a($time, 'DateTime')) |
|
| 1087 | 1087 | { |
| 1088 | - $time = new Api\DateTime($time,Api\DateTime::$server_timezone); |
|
| 1088 | + $time = new Api\DateTime($time, Api\DateTime::$server_timezone); |
|
| 1089 | 1089 | } |
| 1090 | 1090 | if (!isset(self::$tz_cache[$tzid])) |
| 1091 | 1091 | { |
@@ -1120,11 +1120,11 @@ discard block |
||
| 1120 | 1120 | * @param string $caldav_name=null name from CalDAV client or null (to use default) |
| 1121 | 1121 | * @return int|boolean|null cal_id > 0 on success, false on failure or 0 for a failed etag|permission denied or null for "403 Forbidden" |
| 1122 | 1122 | */ |
| 1123 | - function importVCal($_vcalData, $cal_id=-1, $etag=null, $merge=false, $recur_date=0, $principalURL='', $user=null, $charset=null, $caldav_name=null,$skip_notification=false) |
|
| 1123 | + function importVCal($_vcalData, $cal_id = -1, $etag = null, $merge = false, $recur_date = 0, $principalURL = '', $user = null, $charset = null, $caldav_name = null, $skip_notification = false) |
|
| 1124 | 1124 | { |
| 1125 | 1125 | //error_log(__METHOD__."(, $cal_id, $etag, $merge, $recur_date, $principalURL, $user, $charset, $caldav_name)"); |
| 1126 | 1126 | $this->events_imported = 0; |
| 1127 | - $replace = $delete_exceptions= false; |
|
| 1127 | + $replace = $delete_exceptions = false; |
|
| 1128 | 1128 | |
| 1129 | 1129 | if (!is_array($this->supportedFields)) $this->setSupportedFields(); |
| 1130 | 1130 | |
@@ -1132,7 +1132,7 @@ discard block |
||
| 1132 | 1132 | { |
| 1133 | 1133 | return false; |
| 1134 | 1134 | } |
| 1135 | - if (!is_array($events)) $cal_id = -1; // just to be sure, as iterator does NOT allow array access (eg. $events[0]) |
|
| 1135 | + if (!is_array($events)) $cal_id = -1; // just to be sure, as iterator does NOT allow array access (eg. $events[0]) |
|
| 1136 | 1136 | |
| 1137 | 1137 | if ($cal_id > 0) |
| 1138 | 1138 | { |
@@ -1140,7 +1140,7 @@ discard block |
||
| 1140 | 1140 | { |
| 1141 | 1141 | $replace = $recur_date == 0; |
| 1142 | 1142 | $events[0]['id'] = $cal_id; |
| 1143 | - if (!is_null($etag)) $events[0]['etag'] = (int) $etag; |
|
| 1143 | + if (!is_null($etag)) $events[0]['etag'] = (int)$etag; |
|
| 1144 | 1144 | if ($recur_date) $events[0]['recurrence'] = $recur_date; |
| 1145 | 1145 | } |
| 1146 | 1146 | elseif (($foundEvent = $this->find_event(array('id' => $cal_id), 'exact')) && |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | { |
| 1193 | 1193 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1194 | 1194 | ."($cal_id, $etag, $recur_date, $principalURL, $user, $charset)\n" |
| 1195 | - . array2string($event)."\n",3,$this->logfile); |
|
| 1195 | + . array2string($event)."\n", 3, $this->logfile); |
|
| 1196 | 1196 | } |
| 1197 | 1197 | |
| 1198 | 1198 | $updated_id = false; |
@@ -1215,14 +1215,14 @@ discard block |
||
| 1215 | 1215 | { |
| 1216 | 1216 | if ($delete_exceptions) |
| 1217 | 1217 | { |
| 1218 | - $this->delete($id,0,false,$skip_notification); |
|
| 1218 | + $this->delete($id, 0, false, $skip_notification); |
|
| 1219 | 1219 | } |
| 1220 | 1220 | else |
| 1221 | 1221 | { |
| 1222 | 1222 | if (!($exception = $this->read($id))) continue; |
| 1223 | 1223 | $exception['uid'] = Api\CalDAV::generate_uid('calendar', $id); |
| 1224 | 1224 | $exception['reference'] = $exception['recurrence'] = 0; |
| 1225 | - $this->update($exception, true,true,false,true,$msg,$skip_notification); |
|
| 1225 | + $this->update($exception, true, true, false, true, $msg, $skip_notification); |
|
| 1226 | 1226 | } |
| 1227 | 1227 | } |
| 1228 | 1228 | } |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | { |
| 1240 | 1240 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1241 | 1241 | . "(UPDATE Event)\n" |
| 1242 | - . array2string($event_info['stored_event'])."\n",3,$this->logfile); |
|
| 1242 | + . array2string($event_info['stored_event'])."\n", 3, $this->logfile); |
|
| 1243 | 1243 | } |
| 1244 | 1244 | if (empty($event['uid'])) |
| 1245 | 1245 | { |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | if ($this->log) |
| 1262 | 1262 | { |
| 1263 | 1263 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1264 | - "() Restore status for $uid\n",3,$this->logfile); |
|
| 1264 | + "() Restore status for $uid\n", 3, $this->logfile); |
|
| 1265 | 1265 | } |
| 1266 | 1266 | $event['participants'][$uid] = $event_info['stored_event']['participants'][$uid]; |
| 1267 | 1267 | } |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | if ($this->log) |
| 1286 | 1286 | { |
| 1287 | 1287 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1288 | - "()[MERGE]\n",3,$this->logfile); |
|
| 1288 | + "()[MERGE]\n", 3, $this->logfile); |
|
| 1289 | 1289 | } |
| 1290 | 1290 | // overwrite with server data for merge |
| 1291 | 1291 | foreach ($event_info['stored_event'] as $key => $value) |
@@ -1315,7 +1315,7 @@ discard block |
||
| 1315 | 1315 | else |
| 1316 | 1316 | { |
| 1317 | 1317 | // no merge |
| 1318 | - if(!isset($this->supportedFields['category']) || !isset($event['category'])) |
|
| 1318 | + if (!isset($this->supportedFields['category']) || !isset($event['category'])) |
|
| 1319 | 1319 | { |
| 1320 | 1320 | $event['category'] = $event_info['stored_event']['category']; |
| 1321 | 1321 | } |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | if ($this->log) |
| 1328 | 1328 | { |
| 1329 | 1329 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1330 | - "() No participants\n",3,$this->logfile); |
|
| 1330 | + "() No participants\n", 3, $this->logfile); |
|
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | 1333 | // If this is an updated meeting, and the client doesn't support |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | if ($this->log) |
| 1347 | 1347 | { |
| 1348 | 1348 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1349 | - "() Restore resource $uid to status $status\n",3,$this->logfile); |
|
| 1349 | + "() Restore resource $uid to status $status\n", 3, $this->logfile); |
|
| 1350 | 1350 | } |
| 1351 | 1351 | // Add it back in |
| 1352 | 1352 | $event['participants'][$uid] = $status; |
@@ -1434,8 +1434,7 @@ discard block |
||
| 1434 | 1434 | } |
| 1435 | 1435 | // for resources check which new-status to give (eg. with direct booking permision 'A' instead 'U') |
| 1436 | 1436 | $event['participants'][$user] = calendar_so::combine_status( |
| 1437 | - $user < 0 || !isset($this->resources[$user[0]]['new_status']) ? 'U' : |
|
| 1438 | - ExecMethod($this->resources[$user[0]]['new_status'], substr($user, 1))); |
|
| 1437 | + $user < 0 || !isset($this->resources[$user[0]]['new_status']) ? 'U' : ExecMethod($this->resources[$user[0]]['new_status'], substr($user, 1))); |
|
| 1439 | 1438 | } |
| 1440 | 1439 | } |
| 1441 | 1440 | // check if an owner is set and the current user has add rights |
@@ -1500,9 +1499,9 @@ discard block |
||
| 1500 | 1499 | |
| 1501 | 1500 | if ($this->log) |
| 1502 | 1501 | { |
| 1503 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . '(' |
|
| 1504 | - . $event_info['type'] . ")\n" |
|
| 1505 | - . array2string($event)."\n",3,$this->logfile); |
|
| 1502 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'(' |
|
| 1503 | + . $event_info['type'].")\n" |
|
| 1504 | + . array2string($event)."\n", 3, $this->logfile); |
|
| 1506 | 1505 | } |
| 1507 | 1506 | |
| 1508 | 1507 | // Android (any maybe others) delete recurrences by setting STATUS: CANCELLED |
@@ -1510,10 +1509,10 @@ discard block |
||
| 1510 | 1509 | if (in_array($event_info['type'], array('SERIES-EXCEPTION', 'SERIES-EXCEPTION-PROPAGATE', 'SERIES-PSEUDO-EXCEPTION')) && |
| 1511 | 1510 | $event['status'] == 'CANCELLED') |
| 1512 | 1511 | { |
| 1513 | - if (!$this->delete($event['id'] ? $event['id'] : $cal_id, $event['recurrence'],false,$skip_notification)) |
|
| 1512 | + if (!$this->delete($event['id'] ? $event['id'] : $cal_id, $event['recurrence'], false, $skip_notification)) |
|
| 1514 | 1513 | { |
| 1515 | 1514 | // delete fails (because no rights), reject recurrence |
| 1516 | - $this->set_status($event['id'] ? $event['id'] : $cal_id, $this->user, 'R', $event['recurrence'],false,true,$skip_notification); |
|
| 1515 | + $this->set_status($event['id'] ? $event['id'] : $cal_id, $this->user, 'R', $event['recurrence'], false, true, $skip_notification); |
|
| 1517 | 1516 | } |
| 1518 | 1517 | continue; |
| 1519 | 1518 | } |
@@ -1525,7 +1524,7 @@ discard block |
||
| 1525 | 1524 | if ($this->log) |
| 1526 | 1525 | { |
| 1527 | 1526 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1528 | - "(): event SINGLE\n",3,$this->logfile); |
|
| 1527 | + "(): event SINGLE\n", 3, $this->logfile); |
|
| 1529 | 1528 | } |
| 1530 | 1529 | |
| 1531 | 1530 | // update the event |
@@ -1535,7 +1534,7 @@ discard block |
||
| 1535 | 1534 | $event['reference'] = 0; |
| 1536 | 1535 | $event_to_store = $event; // prevent $event from being changed by the update method |
| 1537 | 1536 | $this->server2usertime($event_to_store); |
| 1538 | - $updated_id = $this->update($event_to_store, true,true,false,true,$msg,$skip_notification); |
|
| 1537 | + $updated_id = $this->update($event_to_store, true, true, false, true, $msg, $skip_notification); |
|
| 1539 | 1538 | unset($event_to_store); |
| 1540 | 1539 | } |
| 1541 | 1540 | break; |
@@ -1544,7 +1543,7 @@ discard block |
||
| 1544 | 1543 | if ($this->log) |
| 1545 | 1544 | { |
| 1546 | 1545 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1547 | - "(): event SERIES-MASTER\n",3,$this->logfile); |
|
| 1546 | + "(): event SERIES-MASTER\n", 3, $this->logfile); |
|
| 1548 | 1547 | } |
| 1549 | 1548 | |
| 1550 | 1549 | // remove all known pseudo exceptions and update the event |
@@ -1554,8 +1553,8 @@ discard block |
||
| 1554 | 1553 | $days = $this->so->get_recurrence_exceptions($event_info['stored_event'], $this->tzid, 0, 0, $filter); |
| 1555 | 1554 | if ($this->log) |
| 1556 | 1555 | { |
| 1557 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."(EXCEPTIONS MAPPING):\n" . |
|
| 1558 | - array2string($days)."\n",3,$this->logfile); |
|
| 1556 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."(EXCEPTIONS MAPPING):\n". |
|
| 1557 | + array2string($days)."\n", 3, $this->logfile); |
|
| 1559 | 1558 | } |
| 1560 | 1559 | if (is_array($days)) |
| 1561 | 1560 | { |
@@ -1573,7 +1572,7 @@ discard block |
||
| 1573 | 1572 | |
| 1574 | 1573 | $event_to_store = $event; // prevent $event from being changed by the update method |
| 1575 | 1574 | $this->server2usertime($event_to_store); |
| 1576 | - $updated_id = $this->update($event_to_store, true,true,false,true,$msg,$skip_notification); |
|
| 1575 | + $updated_id = $this->update($event_to_store, true, true, false, true, $msg, $skip_notification); |
|
| 1577 | 1576 | unset($event_to_store); |
| 1578 | 1577 | } |
| 1579 | 1578 | break; |
@@ -1583,7 +1582,7 @@ discard block |
||
| 1583 | 1582 | if ($this->log) |
| 1584 | 1583 | { |
| 1585 | 1584 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1586 | - "(): event SERIES-EXCEPTION\n",3,$this->logfile); |
|
| 1585 | + "(): event SERIES-EXCEPTION\n", 3, $this->logfile); |
|
| 1587 | 1586 | } |
| 1588 | 1587 | |
| 1589 | 1588 | // update event |
@@ -1639,13 +1638,13 @@ discard block |
||
| 1639 | 1638 | $event['owner'] = $event_info['master_event']['owner']; |
| 1640 | 1639 | $event_to_store = $event_info['master_event']; // prevent the master_event from being changed by the update method |
| 1641 | 1640 | $this->server2usertime($event_to_store); |
| 1642 | - $this->update($event_to_store, true,true,false,true,$msg,$skip_notification); |
|
| 1641 | + $this->update($event_to_store, true, true, false, true, $msg, $skip_notification); |
|
| 1643 | 1642 | unset($event_to_store); |
| 1644 | 1643 | } |
| 1645 | 1644 | |
| 1646 | 1645 | $event_to_store = $event; // prevent $event from being changed by update method |
| 1647 | 1646 | $this->server2usertime($event_to_store); |
| 1648 | - $updated_id = $this->update($event_to_store, true,true,false,true,$msg,$skip_notification); |
|
| 1647 | + $updated_id = $this->update($event_to_store, true, true, false, true, $msg, $skip_notification); |
|
| 1649 | 1648 | unset($event_to_store); |
| 1650 | 1649 | } |
| 1651 | 1650 | break; |
@@ -1654,7 +1653,7 @@ discard block |
||
| 1654 | 1653 | if ($this->log) |
| 1655 | 1654 | { |
| 1656 | 1655 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1657 | - "(): event SERIES-PSEUDO-EXCEPTION\n",3,$this->logfile); |
|
| 1656 | + "(): event SERIES-PSEUDO-EXCEPTION\n", 3, $this->logfile); |
|
| 1658 | 1657 | } |
| 1659 | 1658 | //Horde::logMessage('importVCAL event SERIES-PSEUDO-EXCEPTION', |
| 1660 | 1659 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -1675,7 +1674,7 @@ discard block |
||
| 1675 | 1674 | // save the series master with the adjusted exceptions |
| 1676 | 1675 | $event_to_store = $event_info['master_event']; // prevent the master_event from being changed by the update method |
| 1677 | 1676 | $this->server2usertime($event_to_store); |
| 1678 | - $updated_id = $this->update($event_to_store, true, true, false, false,$msg,$skip_notification); |
|
| 1677 | + $updated_id = $this->update($event_to_store, true, true, false, false, $msg, $skip_notification); |
|
| 1679 | 1678 | unset($event_to_store); |
| 1680 | 1679 | } |
| 1681 | 1680 | |
@@ -1702,13 +1701,13 @@ discard block |
||
| 1702 | 1701 | if ($event_info['acl_edit']) |
| 1703 | 1702 | { |
| 1704 | 1703 | // update all participants if we have the right to do that |
| 1705 | - $this->update_status($event, $event_info['stored_event'],0,$skip_notification); |
|
| 1704 | + $this->update_status($event, $event_info['stored_event'], 0, $skip_notification); |
|
| 1706 | 1705 | } |
| 1707 | 1706 | elseif (isset($event['participants'][$this->user]) || isset($event_info['stored_event']['participants'][$this->user])) |
| 1708 | 1707 | { |
| 1709 | 1708 | // update the users status only |
| 1710 | 1709 | $this->set_status($event_info['stored_event']['id'], $this->user, |
| 1711 | - ($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), 0, true,true,$skip_notification); |
|
| 1710 | + ($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), 0, true, true, $skip_notification); |
|
| 1712 | 1711 | } |
| 1713 | 1712 | } |
| 1714 | 1713 | break; |
@@ -1720,13 +1719,13 @@ discard block |
||
| 1720 | 1719 | if ($event_info['acl_edit']) |
| 1721 | 1720 | { |
| 1722 | 1721 | // update all participants if we have the right to do that |
| 1723 | - $this->update_status($event, $event_info['stored_event'], $recurrence,$skip_notification); |
|
| 1722 | + $this->update_status($event, $event_info['stored_event'], $recurrence, $skip_notification); |
|
| 1724 | 1723 | } |
| 1725 | 1724 | elseif (isset($event['participants'][$this->user]) || isset($event_info['master_event']['participants'][$this->user])) |
| 1726 | 1725 | { |
| 1727 | 1726 | // update the users status only |
| 1728 | 1727 | $this->set_status($event_info['master_event']['id'], $this->user, |
| 1729 | - ($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), $recurrence, true,true,$skip_notification); |
|
| 1728 | + ($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), $recurrence, true, true, $skip_notification); |
|
| 1730 | 1729 | } |
| 1731 | 1730 | } |
| 1732 | 1731 | break; |
@@ -1743,7 +1742,7 @@ discard block |
||
| 1743 | 1742 | break; |
| 1744 | 1743 | |
| 1745 | 1744 | case 'SERIES-PSEUDO-EXCEPTION': |
| 1746 | - $return_id = is_array($event_info['master_event']) ? $event_info['master_event']['id'] . ':' . $event['recurrence'] : false; |
|
| 1745 | + $return_id = is_array($event_info['master_event']) ? $event_info['master_event']['id'].':'.$event['recurrence'] : false; |
|
| 1747 | 1746 | break; |
| 1748 | 1747 | |
| 1749 | 1748 | case 'SERIES-EXCEPTION-PROPAGATE': |
@@ -1756,7 +1755,7 @@ discard block |
||
| 1756 | 1755 | { |
| 1757 | 1756 | // we did not have sufficient rights to propagate the status only exception to a real one |
| 1758 | 1757 | // we have to keep the SERIES-PSEUDO-EXCEPTION id and keep the event untouched |
| 1759 | - $return_id = $event_info['master_event']['id'] . ':' . $event['recurrence']; |
|
| 1758 | + $return_id = $event_info['master_event']['id'].':'.$event['recurrence']; |
|
| 1760 | 1759 | } |
| 1761 | 1760 | break; |
| 1762 | 1761 | } |
@@ -1770,8 +1769,8 @@ discard block |
||
| 1770 | 1769 | if ($this->log) |
| 1771 | 1770 | { |
| 1772 | 1771 | $event_info['stored_event'] = $this->read($event_info['stored_event']['id']); |
| 1773 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()[$updated_id]\n" . |
|
| 1774 | - array2string($event_info['stored_event'])."\n",3,$this->logfile); |
|
| 1772 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()[$updated_id]\n". |
|
| 1773 | + array2string($event_info['stored_event'])."\n", 3, $this->logfile); |
|
| 1775 | 1774 | } |
| 1776 | 1775 | } |
| 1777 | 1776 | date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); |
@@ -1793,19 +1792,19 @@ discard block |
||
| 1793 | 1792 | * @return mixed on success: int $cal_id > 0, on error or conflicts false. |
| 1794 | 1793 | * Conflicts are passed to $this->conflict_callback |
| 1795 | 1794 | */ |
| 1796 | - public function update(&$event,$ignore_conflicts=false,$touch_modified=true,$ignore_acl=false,$updateTS=true,&$messages=null, $skip_notification=false) |
|
| 1795 | + public function update(&$event, $ignore_conflicts = false, $touch_modified = true, $ignore_acl = false, $updateTS = true, &$messages = null, $skip_notification = false) |
|
| 1797 | 1796 | { |
| 1798 | - if($this->conflict_callback !== null) |
|
| 1797 | + if ($this->conflict_callback !== null) |
|
| 1799 | 1798 | { |
| 1800 | 1799 | // calendar_ical overrides search(), which breaks conflict checking |
| 1801 | 1800 | // so we make sure to use the original from parent |
| 1802 | 1801 | static $bo = null; |
| 1803 | - if(!$bo) |
|
| 1802 | + if (!$bo) |
|
| 1804 | 1803 | { |
| 1805 | 1804 | $bo = new calendar_boupdate(); |
| 1806 | 1805 | } |
| 1807 | 1806 | $conflicts = $bo->conflicts($event); |
| 1808 | - if(is_array($conflicts) && count($conflicts) > 0) |
|
| 1807 | + if (is_array($conflicts) && count($conflicts) > 0) |
|
| 1809 | 1808 | { |
| 1810 | 1809 | call_user_func_array($this->conflict_callback, array(&$event, &$conflicts)); |
| 1811 | 1810 | return false; |
@@ -1826,11 +1825,11 @@ discard block |
||
| 1826 | 1825 | { |
| 1827 | 1826 | if ($this->debug) error_log(__METHOD__."(".array2string($event).', old_alarms='.array2string($old_alarms).", $user,)"); |
| 1828 | 1827 | $modified = 0; |
| 1829 | - foreach($event['alarm'] as &$alarm) |
|
| 1828 | + foreach ($event['alarm'] as &$alarm) |
|
| 1830 | 1829 | { |
| 1831 | 1830 | // check if alarm is already stored or from other users |
| 1832 | 1831 | $found = false; |
| 1833 | - foreach($old_alarms as $id => $old_alarm) |
|
| 1832 | + foreach ($old_alarms as $id => $old_alarm) |
|
| 1834 | 1833 | { |
| 1835 | 1834 | // not current users alarm --> ignore |
| 1836 | 1835 | if (!$old_alarm['all'] && $old_alarm['owner'] != $user) |
@@ -1846,7 +1845,7 @@ discard block |
||
| 1846 | 1845 | break; |
| 1847 | 1846 | } |
| 1848 | 1847 | } |
| 1849 | - if ($this->debug) error_log(__METHOD__."($event[title] (#$event[id]), ..., $user) processing ".($found?'existing':'new')." alarm ".array2string($alarm)); |
|
| 1848 | + if ($this->debug) error_log(__METHOD__."($event[title] (#$event[id]), ..., $user) processing ".($found ? 'existing' : 'new')." alarm ".array2string($alarm)); |
|
| 1850 | 1849 | if (!empty($alarm['attrs']['X-LIC-ERROR'])) |
| 1851 | 1850 | { |
| 1852 | 1851 | if ($this->debug) error_log(__METHOD__."($event[title] (#$event[id]), ..., $user) ignored X-LIC-ERROR=".array2string($alarm['X-LIC-ERROR'])); |
@@ -1874,7 +1873,7 @@ discard block |
||
| 1874 | 1873 | } |
| 1875 | 1874 | } |
| 1876 | 1875 | // remove all old alarms left from current user |
| 1877 | - foreach($old_alarms as $id => $old_alarm) |
|
| 1876 | + foreach ($old_alarms as $id => $old_alarm) |
|
| 1878 | 1877 | { |
| 1879 | 1878 | // not current users alarm --> ignore |
| 1880 | 1879 | if (!$old_alarm['all'] && $old_alarm['owner'] != $user) |
@@ -1897,7 +1896,7 @@ discard block |
||
| 1897 | 1896 | * @param string $what ='value' |
| 1898 | 1897 | * @return mixed |
| 1899 | 1898 | */ |
| 1900 | - static function _get_attribute($components,$name,$what='value') |
|
| 1899 | + static function _get_attribute($components, $name, $what = 'value') |
|
| 1901 | 1900 | { |
| 1902 | 1901 | foreach ($components as $attribute) |
| 1903 | 1902 | { |
@@ -1932,7 +1931,7 @@ discard block |
||
| 1932 | 1931 | case 'DURATION': |
| 1933 | 1932 | if (isset($vattr['params']['RELATED']) && $vattr['params']['RELATED'] == 'END') |
| 1934 | 1933 | { |
| 1935 | - $alarm['offset'] = $duration -$vattr['value']; |
|
| 1934 | + $alarm['offset'] = $duration - $vattr['value']; |
|
| 1936 | 1935 | } |
| 1937 | 1936 | elseif (isset($vattr['params']['RELATED']) && $vattr['params']['RELATED'] != 'START') |
| 1938 | 1937 | { |
@@ -1948,7 +1947,7 @@ discard block |
||
| 1948 | 1947 | $alarm['time'] = $vattr['value']; |
| 1949 | 1948 | break; |
| 1950 | 1949 | default: |
| 1951 | - error_log('VALARM/TRIGGER: unsupported value type:' . $vtype); |
|
| 1950 | + error_log('VALARM/TRIGGER: unsupported value type:'.$vtype); |
|
| 1952 | 1951 | } |
| 1953 | 1952 | break; |
| 1954 | 1953 | |
@@ -1973,9 +1972,9 @@ discard block |
||
| 1973 | 1972 | return 0; |
| 1974 | 1973 | } |
| 1975 | 1974 | |
| 1976 | - function setSupportedFields($_productManufacturer='', $_productName='') |
|
| 1975 | + function setSupportedFields($_productManufacturer = '', $_productName = '') |
|
| 1977 | 1976 | { |
| 1978 | - $state =& $_SESSION['SyncML.state']; |
|
| 1977 | + $state = & $_SESSION['SyncML.state']; |
|
| 1979 | 1978 | if (isset($state)) |
| 1980 | 1979 | { |
| 1981 | 1980 | $deviceInfo = $state->getClientDeviceInfo(); |
@@ -2272,10 +2271,10 @@ discard block |
||
| 2272 | 2271 | if ($this->log) |
| 2273 | 2272 | { |
| 2274 | 2273 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 2275 | - '(' . $this->productManufacturer . |
|
| 2276 | - ', '. $this->productName .', ' . |
|
| 2277 | - ($this->tzid ? $this->tzid : Api\DateTime::$user_timezone->getName()) . |
|
| 2278 | - ', ' . $this->calendarOwner . ")\n" , 3, $this->logfile); |
|
| 2274 | + '('.$this->productManufacturer. |
|
| 2275 | + ', '.$this->productName.', '. |
|
| 2276 | + ($this->tzid ? $this->tzid : Api\DateTime::$user_timezone->getName()). |
|
| 2277 | + ', '.$this->calendarOwner.")\n", 3, $this->logfile); |
|
| 2279 | 2278 | } |
| 2280 | 2279 | |
| 2281 | 2280 | //Horde::logMessage('setSupportedFields(' . $this->productManufacturer . ', ' |
@@ -2293,12 +2292,12 @@ discard block |
||
| 2293 | 2292 | * utf-8 for new format, iso-8859-1 for old format. |
| 2294 | 2293 | * @return Iterator|array|boolean Iterator if resource given or array of events on success, false on failure |
| 2295 | 2294 | */ |
| 2296 | - function icaltoegw($_vcalData, $principalURL='', $charset=null) |
|
| 2295 | + function icaltoegw($_vcalData, $principalURL = '', $charset = null) |
|
| 2297 | 2296 | { |
| 2298 | 2297 | if ($this->log) |
| 2299 | 2298 | { |
| 2300 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($principalURL, $charset)\n" . |
|
| 2301 | - array2string($_vcalData)."\n",3,$this->logfile); |
|
| 2299 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($principalURL, $charset)\n". |
|
| 2300 | + array2string($_vcalData)."\n", 3, $this->logfile); |
|
| 2302 | 2301 | } |
| 2303 | 2302 | |
| 2304 | 2303 | if (!is_array($this->supportedFields)) $this->setSupportedFields(); |
@@ -2333,14 +2332,14 @@ discard block |
||
| 2333 | 2332 | if ($this->log) |
| 2334 | 2333 | { |
| 2335 | 2334 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 2336 | - "(): No vCalendar Container found!\n",3,$this->logfile); |
|
| 2335 | + "(): No vCalendar Container found!\n", 3, $this->logfile); |
|
| 2337 | 2336 | } |
| 2338 | 2337 | date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); |
| 2339 | 2338 | return false; |
| 2340 | 2339 | } |
| 2341 | 2340 | foreach ($vcal->getComponents() as $component) |
| 2342 | 2341 | { |
| 2343 | - if (($event = $this->_ical2egw_callback($component,$this->tzid,$principalURL,$vcal))) |
|
| 2342 | + if (($event = $this->_ical2egw_callback($component, $this->tzid, $principalURL, $vcal))) |
|
| 2344 | 2343 | { |
| 2345 | 2344 | $events[] = $event; |
| 2346 | 2345 | } |
@@ -2385,13 +2384,13 @@ discard block |
||
| 2385 | 2384 | * @param Horde_Icalendar $container =null container to access attributes on container |
| 2386 | 2385 | * @return array|boolean event array or false if $component is no Horde_Icalendar_Vevent |
| 2387 | 2386 | */ |
| 2388 | - function _ical2egw_callback(Horde_Icalendar $component, $tzid, $principalURL='', Horde_Icalendar $container=null) |
|
| 2387 | + function _ical2egw_callback(Horde_Icalendar $component, $tzid, $principalURL = '', Horde_Icalendar $container = null) |
|
| 2389 | 2388 | { |
| 2390 | 2389 | //unset($component->_container); _debug_array($component); |
| 2391 | 2390 | |
| 2392 | 2391 | if ($this->log) |
| 2393 | 2392 | { |
| 2394 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'() '.get_class($component)." found\n",3,$this->logfile); |
|
| 2393 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'() '.get_class($component)." found\n", 3, $this->logfile); |
|
| 2395 | 2394 | } |
| 2396 | 2395 | |
| 2397 | 2396 | // eg. Mozilla holiday calendars contain only a X-WR-TIMEZONE on vCalendar component |
@@ -2451,16 +2450,16 @@ discard block |
||
| 2451 | 2450 | * @param Horde_Icalendar $container =null container to access attributes on container |
| 2452 | 2451 | * @return array|boolean event on success, false on failure |
| 2453 | 2452 | */ |
| 2454 | - function vevent2egw($component, $version, $supportedFields, $principalURL='', $check_component='Horde_Icalendar_Vevent', Horde_Icalendar $container=null) |
|
| 2453 | + function vevent2egw($component, $version, $supportedFields, $principalURL = '', $check_component = 'Horde_Icalendar_Vevent', Horde_Icalendar $container = null) |
|
| 2455 | 2454 | { |
| 2456 | - unset($principalURL); // not longer used, but required in function signature |
|
| 2455 | + unset($principalURL); // not longer used, but required in function signature |
|
| 2457 | 2456 | |
| 2458 | 2457 | if ($check_component && !is_a($component, $check_component)) |
| 2459 | 2458 | { |
| 2460 | 2459 | if ($this->log) |
| 2461 | 2460 | { |
| 2462 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'()' . |
|
| 2463 | - get_class($component)." found\n",3,$this->logfile); |
|
| 2461 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'()'. |
|
| 2462 | + get_class($component)." found\n", 3, $this->logfile); |
|
| 2464 | 2463 | } |
| 2465 | 2464 | return false; |
| 2466 | 2465 | } |
@@ -2476,11 +2475,11 @@ discard block |
||
| 2476 | 2475 | |
| 2477 | 2476 | $isDate = false; |
| 2478 | 2477 | $event = array(); |
| 2479 | - $alarms = array(); |
|
| 2480 | - $vcardData = array( |
|
| 2478 | + $alarms = array(); |
|
| 2479 | + $vcardData = array( |
|
| 2481 | 2480 | 'recur_type' => MCAL_RECUR_NONE, |
| 2482 | 2481 | 'recur_exception' => array(), |
| 2483 | - 'priority' => 0, // iCalendar default is 0=undefined, not EGroupware 5=normal |
|
| 2482 | + 'priority' => 0, // iCalendar default is 0=undefined, not EGroupware 5=normal |
|
| 2484 | 2483 | ); |
| 2485 | 2484 | // we need to parse DTSTART, DTEND or DURATION (in that order!) first |
| 2486 | 2485 | foreach (array_merge( |
@@ -2497,7 +2496,7 @@ discard block |
||
| 2497 | 2496 | $isDate = true; |
| 2498 | 2497 | } |
| 2499 | 2498 | $dtstart_ts = is_numeric($attributes['value']) ? $attributes['value'] : $this->date2ts($attributes['value']); |
| 2500 | - $vcardData['start'] = $dtstart_ts; |
|
| 2499 | + $vcardData['start'] = $dtstart_ts; |
|
| 2501 | 2500 | |
| 2502 | 2501 | // set event timezone from dtstart, if specified there |
| 2503 | 2502 | if (!empty($attributes['params']['TZID'])) |
@@ -2515,18 +2514,18 @@ discard block |
||
| 2515 | 2514 | } |
| 2516 | 2515 | else |
| 2517 | 2516 | { |
| 2518 | - error_log(__METHOD__ . '() unknown TZID=' |
|
| 2519 | - . $attributes['params']['TZID'] . ', defaulting to timezone "' |
|
| 2520 | - . date_default_timezone_get() . '".'.array2string($tz)); |
|
| 2521 | - $event['tzid'] = date_default_timezone_get(); // default to current timezone |
|
| 2517 | + error_log(__METHOD__.'() unknown TZID=' |
|
| 2518 | + . $attributes['params']['TZID'].', defaulting to timezone "' |
|
| 2519 | + . date_default_timezone_get().'".'.array2string($tz)); |
|
| 2520 | + $event['tzid'] = date_default_timezone_get(); // default to current timezone |
|
| 2522 | 2521 | } |
| 2523 | 2522 | } |
| 2524 | - catch(Exception $e) |
|
| 2523 | + catch (Exception $e) |
|
| 2525 | 2524 | { |
| 2526 | - error_log(__METHOD__ . '() unknown TZID=' |
|
| 2527 | - . $attributes['params']['TZID'] . ', defaulting to timezone "' |
|
| 2528 | - . date_default_timezone_get() . '".'.$e->getMessage()); |
|
| 2529 | - $event['tzid'] = date_default_timezone_get(); // default to current timezone |
|
| 2525 | + error_log(__METHOD__.'() unknown TZID=' |
|
| 2526 | + . $attributes['params']['TZID'].', defaulting to timezone "' |
|
| 2527 | + . date_default_timezone_get().'".'.$e->getMessage()); |
|
| 2528 | + $event['tzid'] = date_default_timezone_get(); // default to current timezone |
|
| 2530 | 2529 | } |
| 2531 | 2530 | } |
| 2532 | 2531 | // if no timezone given and one is specified in class (never the case for CalDAV) |
@@ -2550,11 +2549,11 @@ discard block |
||
| 2550 | 2549 | |
| 2551 | 2550 | case 'DTEND': |
| 2552 | 2551 | $dtend_ts = is_numeric($attributes['value']) ? $attributes['value'] : $this->date2ts($attributes['value']); |
| 2553 | - if (date('H:i:s',$dtend_ts) == '00:00:00') |
|
| 2552 | + if (date('H:i:s', $dtend_ts) == '00:00:00') |
|
| 2554 | 2553 | { |
| 2555 | 2554 | $dtend_ts -= 1; |
| 2556 | 2555 | } |
| 2557 | - $vcardData['end'] = $dtend_ts; |
|
| 2556 | + $vcardData['end'] = $dtend_ts; |
|
| 2558 | 2557 | break; |
| 2559 | 2558 | |
| 2560 | 2559 | case 'DURATION': // clients can use DTSTART+DURATION, instead of DTSTART+DTEND |
@@ -2574,7 +2573,7 @@ discard block |
||
| 2574 | 2573 | if ($this->log) |
| 2575 | 2574 | { |
| 2576 | 2575 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2577 | - . "() DTSTART missing!\n",3,$this->logfile); |
|
| 2576 | + . "() DTSTART missing!\n", 3, $this->logfile); |
|
| 2578 | 2577 | } |
| 2579 | 2578 | return false; // not a valid entry |
| 2580 | 2579 | } |
@@ -2593,7 +2592,7 @@ discard block |
||
| 2593 | 2592 | case 'X-MICROSOFT-CDO-ALLDAYEVENT': |
| 2594 | 2593 | if (isset($supportedFields['whole_day'])) |
| 2595 | 2594 | { |
| 2596 | - $event['whole_day'] = (isset($attributes['value'])?strtoupper($attributes['value'])=='TRUE':true); |
|
| 2595 | + $event['whole_day'] = (isset($attributes['value']) ? strtoupper($attributes['value']) == 'TRUE' : true); |
|
| 2597 | 2596 | } |
| 2598 | 2597 | break; |
| 2599 | 2598 | case 'AALARM': |
@@ -2623,18 +2622,18 @@ discard block |
||
| 2623 | 2622 | $vcardData['recurrence'] = $attributes['value']; |
| 2624 | 2623 | break; |
| 2625 | 2624 | case 'LOCATION': |
| 2626 | - $vcardData['location'] = str_replace("\r\n", "\n", $attributes['value']); |
|
| 2625 | + $vcardData['location'] = str_replace("\r\n", "\n", $attributes['value']); |
|
| 2627 | 2626 | break; |
| 2628 | 2627 | case 'RRULE': |
| 2629 | 2628 | $recurence = $attributes['value']; |
| 2630 | 2629 | $vcardData['recur_interval'] = 1; |
| 2631 | - $type = preg_match('/FREQ=([^;: ]+)/i',$recurence,$matches) ? $matches[1] : $recurence[0]; |
|
| 2630 | + $type = preg_match('/FREQ=([^;: ]+)/i', $recurence, $matches) ? $matches[1] : $recurence[0]; |
|
| 2632 | 2631 | // vCard 2.0 values for all types |
| 2633 | - if (preg_match('/UNTIL=([0-9TZ]+)/',$recurence,$matches)) |
|
| 2632 | + if (preg_match('/UNTIL=([0-9TZ]+)/', $recurence, $matches)) |
|
| 2634 | 2633 | { |
| 2635 | 2634 | $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($matches[1]); |
| 2636 | 2635 | // If it couldn't be parsed, treat it as not set |
| 2637 | - if(is_string($vcardData['recur_enddate'])) |
|
| 2636 | + if (is_string($vcardData['recur_enddate'])) |
|
| 2638 | 2637 | { |
| 2639 | 2638 | unset($vcardData['recur_enddate']); |
| 2640 | 2639 | } |
@@ -2644,16 +2643,16 @@ discard block |
||
| 2644 | 2643 | self::check_fix_endate($vcardData); |
| 2645 | 2644 | } |
| 2646 | 2645 | } |
| 2647 | - elseif (preg_match('/COUNT=([0-9]+)/',$recurence,$matches)) |
|
| 2646 | + elseif (preg_match('/COUNT=([0-9]+)/', $recurence, $matches)) |
|
| 2648 | 2647 | { |
| 2649 | 2648 | $vcardData['recur_count'] = (int)$matches[1]; |
| 2650 | 2649 | } |
| 2651 | - if (preg_match('/INTERVAL=([0-9]+)/',$recurence,$matches)) |
|
| 2650 | + if (preg_match('/INTERVAL=([0-9]+)/', $recurence, $matches)) |
|
| 2652 | 2651 | { |
| 2653 | - $vcardData['recur_interval'] = (int) $matches[1] ? (int) $matches[1] : 1; |
|
| 2652 | + $vcardData['recur_interval'] = (int)$matches[1] ? (int)$matches[1] : 1; |
|
| 2654 | 2653 | } |
| 2655 | 2654 | $vcardData['recur_data'] = 0; |
| 2656 | - switch($type) |
|
| 2655 | + switch ($type) |
|
| 2657 | 2656 | { |
| 2658 | 2657 | case 'D': // 1.0 |
| 2659 | 2658 | $recurenceMatches = null; |
@@ -2677,20 +2676,20 @@ discard block |
||
| 2677 | 2676 | case 'W': |
| 2678 | 2677 | case 'WEEKLY': |
| 2679 | 2678 | $days = array(); |
| 2680 | - if (preg_match('/W(\d+) *((?i: [AEFHMORSTUW]{2})+)?( +([^ ]*))$/',$recurence, $recurenceMatches)) // 1.0 |
|
| 2679 | + if (preg_match('/W(\d+) *((?i: [AEFHMORSTUW]{2})+)?( +([^ ]*))$/', $recurence, $recurenceMatches)) // 1.0 |
|
| 2681 | 2680 | { |
| 2682 | 2681 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2683 | 2682 | if (empty($recurenceMatches[2])) |
| 2684 | 2683 | { |
| 2685 | - $days[0] = strtoupper(substr(date('D', $vcardData['start']),0,2)); |
|
| 2684 | + $days[0] = strtoupper(substr(date('D', $vcardData['start']), 0, 2)); |
|
| 2686 | 2685 | } |
| 2687 | 2686 | else |
| 2688 | 2687 | { |
| 2689 | - $days = explode(' ',trim($recurenceMatches[2])); |
|
| 2688 | + $days = explode(' ', trim($recurenceMatches[2])); |
|
| 2690 | 2689 | } |
| 2691 | 2690 | |
| 2692 | 2691 | $repeatMatches = null; |
| 2693 | - if (preg_match('/#(\d+)/',$recurenceMatches[4],$repeatMatches)) |
|
| 2692 | + if (preg_match('/#(\d+)/', $recurenceMatches[4], $repeatMatches)) |
|
| 2694 | 2693 | { |
| 2695 | 2694 | if ($repeatMatches[1]) $vcardData['recur_count'] = $repeatMatches[1]; |
| 2696 | 2695 | } |
@@ -2701,21 +2700,21 @@ discard block |
||
| 2701 | 2700 | |
| 2702 | 2701 | $recur_days = $this->recur_days_1_0; |
| 2703 | 2702 | } |
| 2704 | - elseif (preg_match('/BYDAY=([^;: ]+)/',$recurence,$recurenceMatches)) // 2.0 |
|
| 2703 | + elseif (preg_match('/BYDAY=([^;: ]+)/', $recurence, $recurenceMatches)) // 2.0 |
|
| 2705 | 2704 | { |
| 2706 | - $days = explode(',',$recurenceMatches[1]); |
|
| 2705 | + $days = explode(',', $recurenceMatches[1]); |
|
| 2707 | 2706 | $recur_days = $this->recur_days; |
| 2708 | 2707 | } |
| 2709 | 2708 | else // no day given, use the day of dtstart |
| 2710 | 2709 | { |
| 2711 | - $vcardData['recur_data'] |= 1 << (int)date('w',$vcardData['start']); |
|
| 2710 | + $vcardData['recur_data'] |= 1 << (int)date('w', $vcardData['start']); |
|
| 2712 | 2711 | $vcardData['recur_type'] = MCAL_RECUR_WEEKLY; |
| 2713 | 2712 | } |
| 2714 | 2713 | if ($days) |
| 2715 | 2714 | { |
| 2716 | 2715 | foreach ($recur_days as $id => $day) |
| 2717 | 2716 | { |
| 2718 | - if (in_array(strtoupper(substr($day,0,2)),$days)) |
|
| 2717 | + if (in_array(strtoupper(substr($day, 0, 2)), $days)) |
|
| 2719 | 2718 | { |
| 2720 | 2719 | $vcardData['recur_data'] |= $id; |
| 2721 | 2720 | } |
@@ -2731,17 +2730,17 @@ discard block |
||
| 2731 | 2730 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2732 | 2731 | $vcardData['recur_count'] = $recurenceMatches[2]; |
| 2733 | 2732 | } |
| 2734 | - elseif (preg_match('/MD(\d+)(?: [^ ]+)? ([0-9TZ]+)/',$recurence, $recurenceMatches)) |
|
| 2733 | + elseif (preg_match('/MD(\d+)(?: [^ ]+)? ([0-9TZ]+)/', $recurence, $recurenceMatches)) |
|
| 2735 | 2734 | { |
| 2736 | 2735 | $vcardData['recur_type'] = MCAL_RECUR_MONTHLY_MDAY; |
| 2737 | 2736 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2738 | 2737 | $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]); |
| 2739 | 2738 | } |
| 2740 | - elseif (preg_match('/MP(\d+) (.*) (.*) (.*)/',$recurence, $recurenceMatches)) |
|
| 2739 | + elseif (preg_match('/MP(\d+) (.*) (.*) (.*)/', $recurence, $recurenceMatches)) |
|
| 2741 | 2740 | { |
| 2742 | 2741 | $vcardData['recur_type'] = MCAL_RECUR_MONTHLY_WDAY; |
| 2743 | 2742 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2744 | - if (preg_match('/#(\d+)/',$recurenceMatches[4],$recurenceMatches)) |
|
| 2743 | + if (preg_match('/#(\d+)/', $recurenceMatches[4], $recurenceMatches)) |
|
| 2745 | 2744 | { |
| 2746 | 2745 | $vcardData['recur_count'] = $recurenceMatches[1]; |
| 2747 | 2746 | } |
@@ -2758,7 +2757,7 @@ discard block |
||
| 2758 | 2757 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2759 | 2758 | $vcardData['recur_count'] = $recurenceMatches[2]; |
| 2760 | 2759 | } |
| 2761 | - elseif (preg_match('/YM(\d+)(?: [^ ]+)? ([0-9TZ]+)/',$recurence, $recurenceMatches)) |
|
| 2760 | + elseif (preg_match('/YM(\d+)(?: [^ ]+)? ([0-9TZ]+)/', $recurence, $recurenceMatches)) |
|
| 2762 | 2761 | { |
| 2763 | 2762 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2764 | 2763 | $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]); |
@@ -2772,11 +2771,11 @@ discard block |
||
| 2772 | 2771 | } |
| 2773 | 2772 | // handle FREQ=YEARLY;BYDAY= as FREQ=MONTHLY;BYDAY= with 12*INTERVAL |
| 2774 | 2773 | $vcardData['recur_interval'] = $vcardData['recur_interval'] ? |
| 2775 | - 12*$vcardData['recur_interval'] : 12; |
|
| 2774 | + 12 * $vcardData['recur_interval'] : 12; |
|
| 2776 | 2775 | // fall-through |
| 2777 | 2776 | case 'MONTHLY': |
| 2778 | 2777 | // does currently NOT parse BYDAY or BYMONTH, it has to be specified/identical to DTSTART |
| 2779 | - $vcardData['recur_type'] = strpos($recurence,'BYDAY') !== false ? |
|
| 2778 | + $vcardData['recur_type'] = strpos($recurence, 'BYDAY') !== false ? |
|
| 2780 | 2779 | MCAL_RECUR_MONTHLY_WDAY : MCAL_RECUR_MONTHLY_MDAY; |
| 2781 | 2780 | break; |
| 2782 | 2781 | } |
@@ -2832,11 +2831,11 @@ discard block |
||
| 2832 | 2831 | (strpos($this->productName, 'outlook') !== false |
| 2833 | 2832 | || strpos($this->productName, 'pocket pc') !== false)) |
| 2834 | 2833 | { |
| 2835 | - $vcardData['priority'] = (int) $this->priority_funambol2egw[$attributes['value']]; |
|
| 2834 | + $vcardData['priority'] = (int)$this->priority_funambol2egw[$attributes['value']]; |
|
| 2836 | 2835 | } |
| 2837 | 2836 | else |
| 2838 | 2837 | { |
| 2839 | - $vcardData['priority'] = (int) $this->priority_ical2egw[$attributes['value']]; |
|
| 2838 | + $vcardData['priority'] = (int)$this->priority_ical2egw[$attributes['value']]; |
|
| 2840 | 2839 | } |
| 2841 | 2840 | break; |
| 2842 | 2841 | case 'CATEGORIES': |
@@ -2850,10 +2849,10 @@ discard block |
||
| 2850 | 2849 | } |
| 2851 | 2850 | break; |
| 2852 | 2851 | case 'ORGANIZER': |
| 2853 | - $event['organizer'] = $attributes['value']; // no egw field, but needed in AS |
|
| 2854 | - if (strtolower(substr($event['organizer'],0,7)) == 'mailto:') |
|
| 2852 | + $event['organizer'] = $attributes['value']; // no egw field, but needed in AS |
|
| 2853 | + if (strtolower(substr($event['organizer'], 0, 7)) == 'mailto:') |
|
| 2855 | 2854 | { |
| 2856 | - $event['organizer'] = substr($event['organizer'],7); |
|
| 2855 | + $event['organizer'] = substr($event['organizer'], 7); |
|
| 2857 | 2856 | } |
| 2858 | 2857 | if (!empty($attributes['params']['CN'])) |
| 2859 | 2858 | { |
@@ -2890,19 +2889,19 @@ discard block |
||
| 2890 | 2889 | } |
| 2891 | 2890 | // try parsing email and cn from attendee |
| 2892 | 2891 | elseif (preg_match('/mailto:([@.a-z0-9_-]+)|mailto:"?([.a-z0-9_ -]*)"?[ ]*<([@.a-z0-9_-]*)>/i', |
| 2893 | - $attributes['value'],$matches)) |
|
| 2892 | + $attributes['value'], $matches)) |
|
| 2894 | 2893 | { |
| 2895 | 2894 | $email = $matches[1] ? $matches[1] : $matches[3]; |
| 2896 | - $cn = isset($matches[2]) ? $matches[2]: ''; |
|
| 2895 | + $cn = isset($matches[2]) ? $matches[2] : ''; |
|
| 2897 | 2896 | } |
| 2898 | 2897 | elseif (!empty($attributes['value']) && |
| 2899 | 2898 | preg_match('/"?([.a-z0-9_ -]*)"?[ ]*<([@.a-z0-9_-]*)>/i', |
| 2900 | - $attributes['value'],$matches)) |
|
| 2899 | + $attributes['value'], $matches)) |
|
| 2901 | 2900 | { |
| 2902 | 2901 | $cn = $matches[1]; |
| 2903 | 2902 | $email = $matches[2]; |
| 2904 | 2903 | } |
| 2905 | - elseif (strpos($attributes['value'],'@') !== false) |
|
| 2904 | + elseif (strpos($attributes['value'], '@') !== false) |
|
| 2906 | 2905 | { |
| 2907 | 2906 | $email = $attributes['value']; |
| 2908 | 2907 | } |
@@ -2919,7 +2918,7 @@ discard block |
||
| 2919 | 2918 | if ($this->log) |
| 2920 | 2919 | { |
| 2921 | 2920 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2922 | - . "(): Found X-EGROUPWARE-UID: '$uid'\n",3,$this->logfile); |
|
| 2921 | + . "(): Found X-EGROUPWARE-UID: '$uid'\n", 3, $this->logfile); |
|
| 2923 | 2922 | } |
| 2924 | 2923 | } |
| 2925 | 2924 | elseif ($attributes['value'] == 'Unknown') |
@@ -2937,7 +2936,7 @@ discard block |
||
| 2937 | 2936 | if ($this->log) |
| 2938 | 2937 | { |
| 2939 | 2938 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2940 | - . "() Found account: '$uid', '$cn', '$email'\n",3,$this->logfile); |
|
| 2939 | + . "() Found account: '$uid', '$cn', '$email'\n", 3, $this->logfile); |
|
| 2941 | 2940 | } |
| 2942 | 2941 | } |
| 2943 | 2942 | if (!$uid) |
@@ -2954,9 +2953,9 @@ discard block |
||
| 2954 | 2953 | $cn = str_replace(array('\\,', '\\;', '\\:', '\\\\'), |
| 2955 | 2954 | array(',', ';', ':', '\\'), |
| 2956 | 2955 | $attributes['params']['CN']); |
| 2957 | - if ($cn[0] == '"' && substr($cn,-1) == '"') |
|
| 2956 | + if ($cn[0] == '"' && substr($cn, -1) == '"') |
|
| 2958 | 2957 | { |
| 2959 | - $cn = substr($cn,1,-1); |
|
| 2958 | + $cn = substr($cn, 1, -1); |
|
| 2960 | 2959 | } |
| 2961 | 2960 | // not searching for $cn, as match can be not unique or without an email address |
| 2962 | 2961 | // --> notification will fail, better store just as email |
@@ -2965,19 +2964,19 @@ discard block |
||
| 2965 | 2964 | if ($this->log) |
| 2966 | 2965 | { |
| 2967 | 2966 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2968 | - . "() Search participant: '$cn', '$email'\n",3,$this->logfile); |
|
| 2967 | + . "() Search participant: '$cn', '$email'\n", 3, $this->logfile); |
|
| 2969 | 2968 | } |
| 2970 | 2969 | |
| 2971 | 2970 | //elseif (//$attributes['params']['CUTYPE'] == 'GROUP' |
| 2972 | - if (preg_match('/(.*) '. lang('Group') . '/', $cn, $matches)) |
|
| 2971 | + if (preg_match('/(.*) '.lang('Group').'/', $cn, $matches)) |
|
| 2973 | 2972 | { |
| 2974 | 2973 | // we found a group |
| 2975 | 2974 | if ($this->log) |
| 2976 | 2975 | { |
| 2977 | 2976 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2978 | - . "() Found group: '$matches[1]', '$cn', '$email'\n",3,$this->logfile); |
|
| 2977 | + . "() Found group: '$matches[1]', '$cn', '$email'\n", 3, $this->logfile); |
|
| 2979 | 2978 | } |
| 2980 | - if (($uid = $GLOBALS['egw']->accounts->name2id($matches[1], 'account_lid', 'g'))) |
|
| 2979 | + if (($uid = $GLOBALS['egw']->accounts->name2id($matches[1], 'account_lid', 'g'))) |
|
| 2981 | 2980 | { |
| 2982 | 2981 | //Horde::logMessage("vevent2egw: group participant $uid", |
| 2983 | 2982 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -2991,7 +2990,7 @@ discard block |
||
| 2991 | 2990 | //Horde::logMessage("vevent2egw: set status to " . $status, |
| 2992 | 2991 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
| 2993 | 2992 | $vcardData['participants'][$this->user] = |
| 2994 | - calendar_so::combine_status($status,$quantity,$role); |
|
| 2993 | + calendar_so::combine_status($status, $quantity, $role); |
|
| 2995 | 2994 | } |
| 2996 | 2995 | } |
| 2997 | 2996 | $status = 'U'; // keep the group |
@@ -3000,36 +2999,36 @@ discard block |
||
| 3000 | 2999 | } |
| 3001 | 3000 | elseif (empty($searcharray)) |
| 3002 | 3001 | { |
| 3003 | - continue; // participants without email AND CN --> ignore it |
|
| 3002 | + continue; // participants without email AND CN --> ignore it |
|
| 3004 | 3003 | } |
| 3005 | 3004 | elseif ((list($data) = $this->addressbook->search($searcharray, |
| 3006 | - array('id','egw_addressbook.account_id as account_id','n_fn'), |
|
| 3005 | + array('id', 'egw_addressbook.account_id as account_id', 'n_fn'), |
|
| 3007 | 3006 | 'egw_addressbook.account_id IS NOT NULL DESC, n_fn IS NOT NULL DESC', |
| 3008 | - '','',false,'OR'))) |
|
| 3007 | + '', '', false, 'OR'))) |
|
| 3009 | 3008 | { |
| 3010 | 3009 | // found an addressbook entry |
| 3011 | 3010 | $uid = $data['account_id'] ? (int)$data['account_id'] : 'c'.$data['id']; |
| 3012 | 3011 | if ($this->log) |
| 3013 | 3012 | { |
| 3014 | 3013 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 3015 | - . "() Found addressbook entry: '$uid', '$cn', '$email'\n",3,$this->logfile); |
|
| 3014 | + . "() Found addressbook entry: '$uid', '$cn', '$email'\n", 3, $this->logfile); |
|
| 3016 | 3015 | } |
| 3017 | 3016 | } |
| 3018 | 3017 | else |
| 3019 | 3018 | { |
| 3020 | 3019 | if (!$email) |
| 3021 | 3020 | { |
| 3022 | - $email = '[email protected]'; // set dummy email to store the CN |
|
| 3021 | + $email = '[email protected]'; // set dummy email to store the CN |
|
| 3023 | 3022 | } |
| 3024 | - $uid = 'e'. ($cn ? $cn . ' <' . $email . '>' : $email); |
|
| 3023 | + $uid = 'e'.($cn ? $cn.' <'.$email.'>' : $email); |
|
| 3025 | 3024 | if ($this->log) |
| 3026 | 3025 | { |
| 3027 | 3026 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 3028 | - . "() Not Found, create dummy: '$uid', '$cn', '$email'\n",3,$this->logfile); |
|
| 3027 | + . "() Not Found, create dummy: '$uid', '$cn', '$email'\n", 3, $this->logfile); |
|
| 3029 | 3028 | } |
| 3030 | 3029 | } |
| 3031 | 3030 | } |
| 3032 | - switch($attributes['name']) |
|
| 3031 | + switch ($attributes['name']) |
|
| 3033 | 3032 | { |
| 3034 | 3033 | case 'ATTENDEE': |
| 3035 | 3034 | if (!isset($attributes['params']['ROLE']) && |
@@ -3043,7 +3042,7 @@ discard block |
||
| 3043 | 3042 | // keep role 'CHAIR' from an external organizer, even if he is a regular participant with a different role |
| 3044 | 3043 | // as this is currently the only way to store an external organizer and send him iMip responses |
| 3045 | 3044 | $q = $r = null; |
| 3046 | - if (isset($vcardData['participants'][$uid]) && ($s=$vcardData['participants'][$uid]) && |
|
| 3045 | + if (isset($vcardData['participants'][$uid]) && ($s = $vcardData['participants'][$uid]) && |
|
| 3047 | 3046 | calendar_so::split_status($s, $q, $r) && $r == 'CHAIR') |
| 3048 | 3047 | { |
| 3049 | 3048 | $role = 'CHAIR'; |
@@ -3057,7 +3056,7 @@ discard block |
||
| 3057 | 3056 | if (!$this->calendarOwner && is_numeric($uid) && $role == 'CHAIR') |
| 3058 | 3057 | $component->getAttribute('ORGANIZER'); |
| 3059 | 3058 | } |
| 3060 | - catch(Horde_Icalendar_Exception $e) |
|
| 3059 | + catch (Horde_Icalendar_Exception $e) |
|
| 3061 | 3060 | { |
| 3062 | 3061 | // we can store the ORGANIZER as event owner |
| 3063 | 3062 | $event['owner'] = $uid; |
@@ -3113,7 +3112,7 @@ discard block |
||
| 3113 | 3112 | break; |
| 3114 | 3113 | |
| 3115 | 3114 | case 'ATTACH': |
| 3116 | - if ($attributes['params'] && !empty($attributes['params']['FMTTYPE'])) break; // handeled by managed attachment code |
|
| 3115 | + if ($attributes['params'] && !empty($attributes['params']['FMTTYPE'])) break; // handeled by managed attachment code |
|
| 3117 | 3116 | // fall throught to store external attachment url |
| 3118 | 3117 | default: // X- attribute or other by EGroupware unsupported property |
| 3119 | 3118 | //error_log(__METHOD__."() $attributes[name] = ".array2string($attributes)); |
@@ -3171,7 +3170,7 @@ discard block |
||
| 3171 | 3170 | if ($event['recur_type'] != MCAL_RECUR_NONE) |
| 3172 | 3171 | { |
| 3173 | 3172 | $event['reference'] = 0; |
| 3174 | - foreach (array('recur_interval','recur_enddate','recur_data','recur_exception','recur_count') as $r) |
|
| 3173 | + foreach (array('recur_interval', 'recur_enddate', 'recur_data', 'recur_exception', 'recur_count') as $r) |
|
| 3175 | 3174 | { |
| 3176 | 3175 | if (isset($vcardData[$r])) |
| 3177 | 3176 | { |
@@ -3194,12 +3193,12 @@ discard block |
||
| 3194 | 3193 | // reset recure_enddate to 00:00:00 on the last day |
| 3195 | 3194 | $rriter = calendar_rrule::event2rrule($event, false); |
| 3196 | 3195 | $last = $rriter->normalize_enddate(); |
| 3197 | - if(!is_object($last)) |
|
| 3196 | + if (!is_object($last)) |
|
| 3198 | 3197 | { |
| 3199 | - if($this->log) |
|
| 3198 | + if ($this->log) |
|
| 3200 | 3199 | { |
| 3201 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 3202 | - " Unable to determine recurrence end date. \n".array2string($event),3, $this->logfile); |
|
| 3200 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 3201 | + " Unable to determine recurrence end date. \n".array2string($event), 3, $this->logfile); |
|
| 3203 | 3202 | } |
| 3204 | 3203 | return false; |
| 3205 | 3204 | } |
@@ -3208,16 +3207,16 @@ discard block |
||
| 3208 | 3207 | $event['recur_enddate'] = Api\DateTime::to($last, 'server'); |
| 3209 | 3208 | } |
| 3210 | 3209 | // translate COUNT into an enddate, as we only store enddates |
| 3211 | - elseif($event['recur_count']) |
|
| 3210 | + elseif ($event['recur_count']) |
|
| 3212 | 3211 | { |
| 3213 | 3212 | $rriter = calendar_rrule::event2rrule($event, false); |
| 3214 | 3213 | $last = $rriter->count2date($event['recur_count']); |
| 3215 | - if(!is_object($last)) |
|
| 3214 | + if (!is_object($last)) |
|
| 3216 | 3215 | { |
| 3217 | - if($this->log) |
|
| 3216 | + if ($this->log) |
|
| 3218 | 3217 | { |
| 3219 | 3218 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__, |
| 3220 | - " Unable to determine recurrence end date. \n".array2string($event),3, $this->logfile); |
|
| 3219 | + " Unable to determine recurrence end date. \n".array2string($event), 3, $this->logfile); |
|
| 3221 | 3220 | } |
| 3222 | 3221 | return false; |
| 3223 | 3222 | } |
@@ -3231,7 +3230,7 @@ discard block |
||
| 3231 | 3230 | if ($this->productManufacturer == 'groupdav' && $container && |
| 3232 | 3231 | ($x_calendarserver_access = $container->getAttribute('X-CALENDARSERVER-ACCESS'))) |
| 3233 | 3232 | { |
| 3234 | - $event['public'] = (int)(strtoupper($x_calendarserver_access) == 'PUBLIC'); |
|
| 3233 | + $event['public'] = (int)(strtoupper($x_calendarserver_access) == 'PUBLIC'); |
|
| 3235 | 3234 | } |
| 3236 | 3235 | //error_log(__METHOD__."() X-CALENDARSERVER-ACCESS=".array2string($x_calendarserver_access).' --> public='.array2string($event['public'])); |
| 3237 | 3236 | } |
@@ -3252,15 +3251,15 @@ discard block |
||
| 3252 | 3251 | |
| 3253 | 3252 | if ($this->log) |
| 3254 | 3253 | { |
| 3255 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
| 3256 | - array2string($event)."\n",3,$this->logfile); |
|
| 3254 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
| 3255 | + array2string($event)."\n", 3, $this->logfile); |
|
| 3257 | 3256 | } |
| 3258 | 3257 | //Horde::logMessage("vevent2egw:\n" . print_r($event, true), |
| 3259 | 3258 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
| 3260 | 3259 | return $event; |
| 3261 | 3260 | } |
| 3262 | 3261 | |
| 3263 | - function search($_vcalData, $contentID=null, $relax=false, $charset=null) |
|
| 3262 | + function search($_vcalData, $contentID = null, $relax = false, $charset = null) |
|
| 3264 | 3263 | { |
| 3265 | 3264 | if (($events = $this->icaltoegw($_vcalData, $charset))) |
| 3266 | 3265 | { |
@@ -3281,8 +3280,8 @@ discard block |
||
| 3281 | 3280 | } |
| 3282 | 3281 | if ($this->log) |
| 3283 | 3282 | { |
| 3284 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."() found:\n" . |
|
| 3285 | - array2string($events)."\n",3,$this->logfile); |
|
| 3283 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."() found:\n". |
|
| 3284 | + array2string($events)."\n", 3, $this->logfile); |
|
| 3286 | 3285 | } |
| 3287 | 3286 | } |
| 3288 | 3287 | return array(); |
@@ -3321,23 +3320,23 @@ discard block |
||
| 3321 | 3320 | * @param array $extra =null extra attributes to add |
| 3322 | 3321 | * X-CALENDARSERVER-MASK-UID can be used to not include an event specified by this uid as busy |
| 3323 | 3322 | */ |
| 3324 | - function freebusy($user,$end=null,$utc=true, $charset='UTF-8', $start=null, $method='PUBLISH', array $extra=null) |
|
| 3323 | + function freebusy($user, $end = null, $utc = true, $charset = 'UTF-8', $start = null, $method = 'PUBLISH', array $extra = null) |
|
| 3325 | 3324 | { |
| 3326 | - if (!$start) $start = time(); // default now |
|
| 3327 | - if (!$end) $end = time() + 100*DAY_s; // default next 100 days |
|
| 3325 | + if (!$start) $start = time(); // default now |
|
| 3326 | + if (!$end) $end = time() + 100 * DAY_s; // default next 100 days |
|
| 3328 | 3327 | |
| 3329 | 3328 | $vcal = new Horde_Icalendar; |
| 3330 | - $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
|
| 3329 | + $vcal->setAttribute('PRODID', '-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
|
| 3331 | 3330 | strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang'])); |
| 3332 | - $vcal->setAttribute('VERSION','2.0'); |
|
| 3333 | - $vcal->setAttribute('METHOD',$method); |
|
| 3331 | + $vcal->setAttribute('VERSION', '2.0'); |
|
| 3332 | + $vcal->setAttribute('METHOD', $method); |
|
| 3334 | 3333 | |
| 3335 | - $vfreebusy = Horde_Icalendar::newComponent('VFREEBUSY',$vcal); |
|
| 3334 | + $vfreebusy = Horde_Icalendar::newComponent('VFREEBUSY', $vcal); |
|
| 3336 | 3335 | |
| 3337 | 3336 | $attributes = array( |
| 3338 | 3337 | 'DTSTAMP' => time(), |
| 3339 | - 'DTSTART' => $this->date2ts($start,true), // true = server-time |
|
| 3340 | - 'DTEND' => $this->date2ts($end,true), // true = server-time |
|
| 3338 | + 'DTSTART' => $this->date2ts($start, true), // true = server-time |
|
| 3339 | + 'DTEND' => $this->date2ts($end, true), // true = server-time |
|
| 3341 | 3340 | ); |
| 3342 | 3341 | if (!$utc) |
| 3343 | 3342 | { |
@@ -3348,9 +3347,9 @@ discard block |
||
| 3348 | 3347 | } |
| 3349 | 3348 | if (is_null($extra)) $extra = array( |
| 3350 | 3349 | 'URL' => $this->freebusy_url($user), |
| 3351 | - 'ORGANIZER' => 'mailto:'.$GLOBALS['egw']->accounts->id2name($user,'account_email'), |
|
| 3350 | + 'ORGANIZER' => 'mailto:'.$GLOBALS['egw']->accounts->id2name($user, 'account_email'), |
|
| 3352 | 3351 | ); |
| 3353 | - foreach($attributes+$extra as $attr => $value) |
|
| 3352 | + foreach ($attributes + $extra as $attr => $value) |
|
| 3354 | 3353 | { |
| 3355 | 3354 | $vfreebusy->setAttribute($attr, $value); |
| 3356 | 3355 | } |
@@ -3373,16 +3372,16 @@ discard block |
||
| 3373 | 3372 | |
| 3374 | 3373 | if ($utc) |
| 3375 | 3374 | { |
| 3376 | - $vfreebusy->setAttribute('FREEBUSY',array(array( |
|
| 3375 | + $vfreebusy->setAttribute('FREEBUSY', array(array( |
|
| 3377 | 3376 | 'start' => $event['start'], |
| 3378 | 3377 | 'end' => $event['end'], |
| 3379 | 3378 | )), array('FBTYPE' => $fbtype)); |
| 3380 | 3379 | } |
| 3381 | 3380 | else |
| 3382 | 3381 | { |
| 3383 | - $vfreebusy->setAttribute('FREEBUSY',array(array( |
|
| 3384 | - 'start' => date('Ymd\THis',$event['start']), |
|
| 3385 | - 'end' => date('Ymd\THis',$event['end']), |
|
| 3382 | + $vfreebusy->setAttribute('FREEBUSY', array(array( |
|
| 3383 | + 'start' => date('Ymd\THis', $event['start']), |
|
| 3384 | + 'end' => date('Ymd\THis', $event['end']), |
|
| 3386 | 3385 | )), array('FBTYPE' => $fbtype)); |
| 3387 | 3386 | } |
| 3388 | 3387 | } |
@@ -183,7 +183,10 @@ discard block |
||
| 183 | 183 | function __construct(&$_clientProperties = array()) |
| 184 | 184 | { |
| 185 | 185 | parent::__construct(); |
| 186 | - if ($this->log) $this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-vcal"; |
|
| 186 | + if ($this->log) |
|
| 187 | + { |
|
| 188 | + $this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-vcal"; |
|
| 189 | + } |
|
| 187 | 190 | $this->clientProperties = $_clientProperties; |
| 188 | 191 | $this->vCalendar = new Horde_Icalendar; |
| 189 | 192 | $this->addressbook = new Api\Contacts; |
@@ -232,10 +235,14 @@ discard block |
||
| 232 | 235 | 'ATTACH' => 'attachments', |
| 233 | 236 | ); |
| 234 | 237 | |
| 235 | - if (!is_array($this->supportedFields)) $this->setSupportedFields(); |
|
| 238 | + if (!is_array($this->supportedFields)) |
|
| 239 | + { |
|
| 240 | + $this->setSupportedFields(); |
|
| 241 | + } |
|
| 236 | 242 | |
| 237 | 243 | if ($this->productManufacturer == '' ) |
| 238 | - { // syncevolution is broken |
|
| 244 | + { |
|
| 245 | +// syncevolution is broken |
|
| 239 | 246 | $version = '2.0'; |
| 240 | 247 | } |
| 241 | 248 | |
@@ -243,10 +250,16 @@ discard block |
||
| 243 | 250 | $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
| 244 | 251 | strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang'])); |
| 245 | 252 | $vcal->setAttribute('VERSION', $version); |
| 246 | - if ($method) $vcal->setAttribute('METHOD', $method); |
|
| 253 | + if ($method) |
|
| 254 | + { |
|
| 255 | + $vcal->setAttribute('METHOD', $method); |
|
| 256 | + } |
|
| 247 | 257 | $events_exported = false; |
| 248 | 258 | |
| 249 | - if (!is_array($events)) $events = array($events); |
|
| 259 | + if (!is_array($events)) |
|
| 260 | + { |
|
| 261 | + $events = array($events); |
|
| 262 | + } |
|
| 250 | 263 | |
| 251 | 264 | $vtimezones_added = array(); |
| 252 | 265 | foreach ($events as $event) |
@@ -312,7 +325,10 @@ discard block |
||
| 312 | 325 | self::$tz_cache[$event['tzid']] = calendar_timezones::DateTimeZone($event['tzid']); |
| 313 | 326 | } |
| 314 | 327 | |
| 315 | - if ($this->so->isWholeDay($event)) $event['whole_day'] = true; |
|
| 328 | + if ($this->so->isWholeDay($event)) |
|
| 329 | + { |
|
| 330 | + $event['whole_day'] = true; |
|
| 331 | + } |
|
| 316 | 332 | |
| 317 | 333 | if ($this->log) |
| 318 | 334 | { |
@@ -323,7 +339,10 @@ discard block |
||
| 323 | 339 | |
| 324 | 340 | if ($recurrence) |
| 325 | 341 | { |
| 326 | - if (!($master = $this->read($event['id'], 0, true, 'server'))) continue; |
|
| 342 | + if (!($master = $this->read($event['id'], 0, true, 'server'))) |
|
| 343 | + { |
|
| 344 | + continue; |
|
| 345 | + } |
|
| 327 | 346 | |
| 328 | 347 | if (!isset($this->supportedFields['participants'])) |
| 329 | 348 | { |
@@ -380,7 +399,8 @@ discard block |
||
| 380 | 399 | if ($this->productManufacturer != 'file' && $this->uidExtension) |
| 381 | 400 | { |
| 382 | 401 | // Append UID to DESCRIPTION |
| 383 | - if (!preg_match('/\[UID:.+\]/m', $event['description'])) { |
|
| 402 | + if (!preg_match('/\[UID:.+\]/m', $event['description'])) |
|
| 403 | + { |
|
| 384 | 404 | $event['description'] .= "\n[UID:" . $event['uid'] . "]"; |
| 385 | 405 | } |
| 386 | 406 | } |
@@ -440,11 +460,21 @@ discard block |
||
| 440 | 460 | $quantity = $role = null; |
| 441 | 461 | calendar_so::split_status($status, $quantity, $role); |
| 442 | 462 | // do not include event owner/ORGANIZER as participant in his own calendar, if he is only participant |
| 443 | - if (count($event['participants']) == 1 && $event['owner'] == $uid) continue; |
|
| 463 | + if (count($event['participants']) == 1 && $event['owner'] == $uid) |
|
| 464 | + { |
|
| 465 | + continue; |
|
| 466 | + } |
|
| 444 | 467 | |
| 445 | - if (!($info = $this->resource_info($uid))) continue; |
|
| 468 | + if (!($info = $this->resource_info($uid))) |
|
| 469 | + { |
|
| 470 | + continue; |
|
| 471 | + } |
|
| 446 | 472 | |
| 447 | - if (in_array($status, array('X','E'))) continue; // dont include deleted participants |
|
| 473 | + if (in_array($status, array('X','E'))) |
|
| 474 | + { |
|
| 475 | + continue; |
|
| 476 | + } |
|
| 477 | + // dont include deleted participants |
|
| 448 | 478 | |
| 449 | 479 | if ($this->log) |
| 450 | 480 | { |
@@ -523,24 +553,49 @@ discard block |
||
| 523 | 553 | } |
| 524 | 554 | // ROLE={CHAIR|REQ-PARTICIPANT|OPT-PARTICIPANT|NON-PARTICIPANT|X-*} |
| 525 | 555 | $options = array(); |
| 526 | - if (!empty($participantCN)) $options['CN'] = $participantCN; |
|
| 527 | - if (!empty($role)) $options['ROLE'] = $role; |
|
| 528 | - if (!empty($status)) $options['PARTSTAT'] = $status; |
|
| 529 | - if (!empty($cutype)) $options['CUTYPE'] = $cutype; |
|
| 530 | - if (!empty($rsvp)) $options['RSVP'] = $rsvp; |
|
| 556 | + if (!empty($participantCN)) |
|
| 557 | + { |
|
| 558 | + $options['CN'] = $participantCN; |
|
| 559 | + } |
|
| 560 | + if (!empty($role)) |
|
| 561 | + { |
|
| 562 | + $options['ROLE'] = $role; |
|
| 563 | + } |
|
| 564 | + if (!empty($status)) |
|
| 565 | + { |
|
| 566 | + $options['PARTSTAT'] = $status; |
|
| 567 | + } |
|
| 568 | + if (!empty($cutype)) |
|
| 569 | + { |
|
| 570 | + $options['CUTYPE'] = $cutype; |
|
| 571 | + } |
|
| 572 | + if (!empty($rsvp)) |
|
| 573 | + { |
|
| 574 | + $options['RSVP'] = $rsvp; |
|
| 575 | + } |
|
| 531 | 576 | if (!empty($info['email']) && $participantURL != 'mailto:'.$info['email']) |
| 532 | 577 | { |
| 533 | 578 | $options['EMAIL'] = $info['email']; // only add EMAIL attribute, if not already URL, as eg. Akonadi is reported to have problems with it |
| 534 | 579 | } |
| 535 | - if ($info['type'] != 'e') $options['X-EGROUPWARE-UID'] = (string)$uid; |
|
| 536 | - if ($quantity > 1) $options['X-EGROUPWARE-QUANTITY'] = (string)$quantity; |
|
| 580 | + if ($info['type'] != 'e') |
|
| 581 | + { |
|
| 582 | + $options['X-EGROUPWARE-UID'] = (string)$uid; |
|
| 583 | + } |
|
| 584 | + if ($quantity > 1) |
|
| 585 | + { |
|
| 586 | + $options['X-EGROUPWARE-QUANTITY'] = (string)$quantity; |
|
| 587 | + } |
|
| 537 | 588 | $attributes['ATTENDEE'][] = $participantURL; |
| 538 | 589 | $parameters['ATTENDEE'][] = $options; |
| 539 | 590 | } |
| 540 | 591 | break; |
| 541 | 592 | |
| 542 | 593 | case 'CLASS': |
| 543 | - if ($event['public']) continue; // public is default, no need to export, fails CalDAVTester if added as default |
|
| 594 | + if ($event['public']) |
|
| 595 | + { |
|
| 596 | + continue; |
|
| 597 | + } |
|
| 598 | + // public is default, no need to export, fails CalDAVTester if added as default |
|
| 544 | 599 | $attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'PRIVATE'; |
| 545 | 600 | // Apple iCal on OS X uses X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALANDAR (not VEVENT!) |
| 546 | 601 | if (!$event['public'] && $this->productManufacturer == 'groupdav') |
@@ -572,9 +627,18 @@ discard block |
||
| 572 | 627 | 'CUTYPE' => 'INDIVIDUAL', |
| 573 | 628 | //'RSVP' => 'FALSE', |
| 574 | 629 | ); |
| 575 | - if (!empty($organizerCN)) $options['CN'] = $organizerCN; |
|
| 576 | - if (!empty($organizerEMail)) $options['EMAIL'] = $organizerEMail; |
|
| 577 | - if (!empty($event['owner'])) $options['X-EGROUPWARE-UID'] = $event['owner']; |
|
| 630 | + if (!empty($organizerCN)) |
|
| 631 | + { |
|
| 632 | + $options['CN'] = $organizerCN; |
|
| 633 | + } |
|
| 634 | + if (!empty($organizerEMail)) |
|
| 635 | + { |
|
| 636 | + $options['EMAIL'] = $organizerEMail; |
|
| 637 | + } |
|
| 638 | + if (!empty($event['owner'])) |
|
| 639 | + { |
|
| 640 | + $options['X-EGROUPWARE-UID'] = $event['owner']; |
|
| 641 | + } |
|
| 578 | 642 | $attributes['ATTENDEE'][] = $organizerURL; |
| 579 | 643 | $parameters['ATTENDEE'][] = $options; |
| 580 | 644 | } |
@@ -603,9 +667,12 @@ discard block |
||
| 603 | 667 | { |
| 604 | 668 | // Hack for CalDAVTester to export duration instead of endtime |
| 605 | 669 | if ($tzid == 'UTC' && $event['end'] - $event['start'] <= 86400) |
| 606 | - $attributes['duration'] = $event['end'] - $event['start']; |
|
| 607 | - else |
|
| 608 | - $attributes['DTEND'] = self::getDateTime($event['end'],$tzid,$parameters['DTEND']); |
|
| 670 | + { |
|
| 671 | + $attributes['duration'] = $event['end'] - $event['start']; |
|
| 672 | + } |
|
| 673 | + else { |
|
| 674 | + $attributes['DTEND'] = self::getDateTime($event['end'],$tzid,$parameters['DTEND']); |
|
| 675 | + } |
|
| 609 | 676 | } |
| 610 | 677 | else |
| 611 | 678 | { |
@@ -625,7 +692,11 @@ discard block |
||
| 625 | 692 | break; |
| 626 | 693 | |
| 627 | 694 | case 'RRULE': |
| 628 | - if ($event['recur_type'] == MCAL_RECUR_NONE) break; // no recuring event |
|
| 695 | + if ($event['recur_type'] == MCAL_RECUR_NONE) |
|
| 696 | + { |
|
| 697 | + break; |
|
| 698 | + } |
|
| 699 | + // no recuring event |
|
| 629 | 700 | $rriter = calendar_rrule::event2rrule($event, false, $tzid); |
| 630 | 701 | $rrule = $rriter->generate_rrule($version); |
| 631 | 702 | if ($event['recur_enddate']) |
@@ -667,7 +738,10 @@ discard block |
||
| 667 | 738 | break; |
| 668 | 739 | |
| 669 | 740 | case 'EXDATE': |
| 670 | - if ($event['recur_type'] == MCAL_RECUR_NONE) break; |
|
| 741 | + if ($event['recur_type'] == MCAL_RECUR_NONE) |
|
| 742 | + { |
|
| 743 | + break; |
|
| 744 | + } |
|
| 671 | 745 | if (!empty($event['recur_exception'])) |
| 672 | 746 | { |
| 673 | 747 | if (empty($event['whole_day'])) |
@@ -694,14 +768,21 @@ discard block |
||
| 694 | 768 | ); |
| 695 | 769 | } |
| 696 | 770 | $event['recur_exception'] = $days; |
| 697 | - if ($version != '1.0') $parameters['EXDATE']['VALUE'] = 'DATE'; |
|
| 771 | + if ($version != '1.0') |
|
| 772 | + { |
|
| 773 | + $parameters['EXDATE']['VALUE'] = 'DATE'; |
|
| 774 | + } |
|
| 698 | 775 | } |
| 699 | 776 | $vevent->setAttribute('EXDATE', $event['recur_exception'], $parameters['EXDATE']); |
| 700 | 777 | } |
| 701 | 778 | break; |
| 702 | 779 | |
| 703 | 780 | case 'PRIORITY': |
| 704 | - if (!$event['priority']) continue; // 0=undefined is default, no need to export, fails CalDAVTester if our default is added |
|
| 781 | + if (!$event['priority']) |
|
| 782 | + { |
|
| 783 | + continue; |
|
| 784 | + } |
|
| 785 | + // 0=undefined is default, no need to export, fails CalDAVTester if our default is added |
|
| 705 | 786 | if ($this->productManufacturer == 'funambol' && |
| 706 | 787 | (strpos($this->productName, 'outlook') !== false |
| 707 | 788 | || strpos($this->productName, 'pocket pc') !== false)) |
@@ -715,7 +796,11 @@ discard block |
||
| 715 | 796 | break; |
| 716 | 797 | |
| 717 | 798 | case 'TRANSP': |
| 718 | - if (!$event['non_blocking']) continue; // OPAQUE is default, no need to export, fails CalDAVTester if added as default |
|
| 799 | + if (!$event['non_blocking']) |
|
| 800 | + { |
|
| 801 | + continue; |
|
| 802 | + } |
|
| 803 | + // OPAQUE is default, no need to export, fails CalDAVTester if added as default |
|
| 719 | 804 | if ($version == '1.0') |
| 720 | 805 | { |
| 721 | 806 | $attributes['TRANSP'] = ($event['non_blocking'] ? 1 : 0); |
@@ -772,7 +857,11 @@ discard block |
||
| 772 | 857 | elseif ($event['recurrence'] && $event['reference']) |
| 773 | 858 | { |
| 774 | 859 | // $event['reference'] is a calendar_id, not a timestamp |
| 775 | - if (!($revent = $this->read($event['reference']))) break; // referenced event does not exist |
|
| 860 | + if (!($revent = $this->read($event['reference']))) |
|
| 861 | + { |
|
| 862 | + break; |
|
| 863 | + } |
|
| 864 | + // referenced event does not exist |
|
| 776 | 865 | |
| 777 | 866 | if (empty($revent['whole_day'])) |
| 778 | 867 | { |
@@ -898,7 +987,10 @@ discard block |
||
| 898 | 987 | foreach ((array)$event['alarm'] as $alarmData) |
| 899 | 988 | { |
| 900 | 989 | // skip over alarms that don't have the minimum required info |
| 901 | - if (!isset($alarmData['offset']) && !isset($alarmData['time'])) continue; |
|
| 990 | + if (!isset($alarmData['offset']) && !isset($alarmData['time'])) |
|
| 991 | + { |
|
| 992 | + continue; |
|
| 993 | + } |
|
| 902 | 994 | |
| 903 | 995 | // skip alarms not being set for all users and alarms owned by other users |
| 904 | 996 | if ($alarmData['all'] != true && $alarmData['owner'] != $this->user) |
@@ -915,7 +1007,10 @@ discard block |
||
| 915 | 1007 | |
| 916 | 1008 | if ($version == '1.0') |
| 917 | 1009 | { |
| 918 | - if ($event['title']) $description = $event['title']; |
|
| 1010 | + if ($event['title']) |
|
| 1011 | + { |
|
| 1012 | + $description = $event['title']; |
|
| 1013 | + } |
|
| 919 | 1014 | if ($description) |
| 920 | 1015 | { |
| 921 | 1016 | $values['DALARM']['snooze_time'] = ''; |
@@ -935,7 +1030,10 @@ discard block |
||
| 935 | 1030 | // VCalendar 2.0 / RFC 2445 |
| 936 | 1031 | |
| 937 | 1032 | // RFC requires DESCRIPTION for DISPLAY |
| 938 | - if (!$event['title'] && !$description) $description = 'Alarm'; |
|
| 1033 | + if (!$event['title'] && !$description) |
|
| 1034 | + { |
|
| 1035 | + $description = 'Alarm'; |
|
| 1036 | + } |
|
| 939 | 1037 | |
| 940 | 1038 | /* Disabling for now |
| 941 | 1039 | // Lightning infinitly pops up alarms for recuring events, if the only use an offset |
@@ -1126,13 +1224,20 @@ discard block |
||
| 1126 | 1224 | $this->events_imported = 0; |
| 1127 | 1225 | $replace = $delete_exceptions= false; |
| 1128 | 1226 | |
| 1129 | - if (!is_array($this->supportedFields)) $this->setSupportedFields(); |
|
| 1227 | + if (!is_array($this->supportedFields)) |
|
| 1228 | + { |
|
| 1229 | + $this->setSupportedFields(); |
|
| 1230 | + } |
|
| 1130 | 1231 | |
| 1131 | 1232 | if (!($events = $this->icaltoegw($_vcalData, $principalURL, $charset))) |
| 1132 | 1233 | { |
| 1133 | 1234 | return false; |
| 1134 | 1235 | } |
| 1135 | - if (!is_array($events)) $cal_id = -1; // just to be sure, as iterator does NOT allow array access (eg. $events[0]) |
|
| 1236 | + if (!is_array($events)) |
|
| 1237 | + { |
|
| 1238 | + $cal_id = -1; |
|
| 1239 | + } |
|
| 1240 | + // just to be sure, as iterator does NOT allow array access (eg. $events[0]) |
|
| 1136 | 1241 | |
| 1137 | 1242 | if ($cal_id > 0) |
| 1138 | 1243 | { |
@@ -1140,8 +1245,14 @@ discard block |
||
| 1140 | 1245 | { |
| 1141 | 1246 | $replace = $recur_date == 0; |
| 1142 | 1247 | $events[0]['id'] = $cal_id; |
| 1143 | - if (!is_null($etag)) $events[0]['etag'] = (int) $etag; |
|
| 1144 | - if ($recur_date) $events[0]['recurrence'] = $recur_date; |
|
| 1248 | + if (!is_null($etag)) |
|
| 1249 | + { |
|
| 1250 | + $events[0]['etag'] = (int) $etag; |
|
| 1251 | + } |
|
| 1252 | + if ($recur_date) |
|
| 1253 | + { |
|
| 1254 | + $events[0]['recurrence'] = $recur_date; |
|
| 1255 | + } |
|
| 1145 | 1256 | } |
| 1146 | 1257 | elseif (($foundEvent = $this->find_event(array('id' => $cal_id), 'exact')) && |
| 1147 | 1258 | ($eventId = array_shift($foundEvent)) && |
@@ -1149,7 +1260,10 @@ discard block |
||
| 1149 | 1260 | { |
| 1150 | 1261 | foreach ($events as $k => $event) |
| 1151 | 1262 | { |
| 1152 | - if (!isset($event['uid'])) $events[$k]['uid'] = $egwEvent['uid']; |
|
| 1263 | + if (!isset($event['uid'])) |
|
| 1264 | + { |
|
| 1265 | + $events[$k]['uid'] = $egwEvent['uid']; |
|
| 1266 | + } |
|
| 1153 | 1267 | } |
| 1154 | 1268 | } |
| 1155 | 1269 | } |
@@ -1179,10 +1293,17 @@ discard block |
||
| 1179 | 1293 | $msg = null; |
| 1180 | 1294 | foreach ($events as $event) |
| 1181 | 1295 | { |
| 1182 | - if (!is_array($event)) continue; // the iterator may return false |
|
| 1296 | + if (!is_array($event)) |
|
| 1297 | + { |
|
| 1298 | + continue; |
|
| 1299 | + } |
|
| 1300 | + // the iterator may return false |
|
| 1183 | 1301 | ++$this->events_imported; |
| 1184 | 1302 | |
| 1185 | - if ($this->so->isWholeDay($event)) $event['whole_day'] = true; |
|
| 1303 | + if ($this->so->isWholeDay($event)) |
|
| 1304 | + { |
|
| 1305 | + $event['whole_day'] = true; |
|
| 1306 | + } |
|
| 1186 | 1307 | if (is_array($event['category'])) |
| 1187 | 1308 | { |
| 1188 | 1309 | $event['category'] = $this->find_or_add_categories($event['category'], |
@@ -1219,7 +1340,10 @@ discard block |
||
| 1219 | 1340 | } |
| 1220 | 1341 | else |
| 1221 | 1342 | { |
| 1222 | - if (!($exception = $this->read($id))) continue; |
|
| 1343 | + if (!($exception = $this->read($id))) |
|
| 1344 | + { |
|
| 1345 | + continue; |
|
| 1346 | + } |
|
| 1223 | 1347 | $exception['uid'] = Api\CalDAV::generate_uid('calendar', $id); |
| 1224 | 1348 | $exception['reference'] = $exception['recurrence'] = 0; |
| 1225 | 1349 | $this->update($exception, true,true,false,true,$msg,$skip_notification); |
@@ -1308,7 +1432,10 @@ discard block |
||
| 1308 | 1432 | break; |
| 1309 | 1433 | |
| 1310 | 1434 | default: |
| 1311 | - if (!empty($value)) $event[$key] = $value; |
|
| 1435 | + if (!empty($value)) |
|
| 1436 | + { |
|
| 1437 | + $event[$key] = $value; |
|
| 1438 | + } |
|
| 1312 | 1439 | } |
| 1313 | 1440 | } |
| 1314 | 1441 | } |
@@ -1406,7 +1533,10 @@ discard block |
||
| 1406 | 1533 | else // common adjustments for new events |
| 1407 | 1534 | { |
| 1408 | 1535 | unset($event['id']); |
| 1409 | - if ($caldav_name) $event['caldav_name'] = $caldav_name; |
|
| 1536 | + if ($caldav_name) |
|
| 1537 | + { |
|
| 1538 | + $event['caldav_name'] = $caldav_name; |
|
| 1539 | + } |
|
| 1410 | 1540 | // set non blocking all day depending on the user setting |
| 1411 | 1541 | if (!empty($event['whole_day']) && $this->nonBlockingAllday) |
| 1412 | 1542 | { |
@@ -1454,7 +1584,10 @@ discard block |
||
| 1454 | 1584 | || !isset($event['participants'][$event['owner']])) |
| 1455 | 1585 | { |
| 1456 | 1586 | $status = calendar_so::combine_status($event['owner'] == $this->user ? 'A' : 'U', 1, 'CHAIR'); |
| 1457 | - if (!is_array($event['participants'])) $event['participants'] = array(); |
|
| 1587 | + if (!is_array($event['participants'])) |
|
| 1588 | + { |
|
| 1589 | + $event['participants'] = array(); |
|
| 1590 | + } |
|
| 1458 | 1591 | $event['participants'][$event['owner']] = $status; |
| 1459 | 1592 | } |
| 1460 | 1593 | else |
@@ -1607,7 +1740,10 @@ discard block |
||
| 1607 | 1740 | $occurence = $exception = false; |
| 1608 | 1741 | foreach ($event_info['master_event']['recur_exception'] as $exception) |
| 1609 | 1742 | { |
| 1610 | - if ($exception > $event['start']) break; |
|
| 1743 | + if ($exception > $event['start']) |
|
| 1744 | + { |
|
| 1745 | + break; |
|
| 1746 | + } |
|
| 1611 | 1747 | $occurence = $exception; |
| 1612 | 1748 | } |
| 1613 | 1749 | if (!$occurence) |
@@ -1697,12 +1833,15 @@ discard block |
||
| 1697 | 1833 | case 'SERIES-MASTER': |
| 1698 | 1834 | case 'SERIES-EXCEPTION': |
| 1699 | 1835 | case 'SERIES-EXCEPTION-PROPAGATE': |
| 1700 | - if (is_array($event_info['stored_event'])) // status update requires a stored event |
|
| 1836 | + if (is_array($event_info['stored_event'])) |
|
| 1837 | + { |
|
| 1838 | + // status update requires a stored event |
|
| 1701 | 1839 | { |
| 1702 | 1840 | if ($event_info['acl_edit']) |
| 1703 | 1841 | { |
| 1704 | 1842 | // update all participants if we have the right to do that |
| 1705 | 1843 | $this->update_status($event, $event_info['stored_event'],0,$skip_notification); |
| 1844 | + } |
|
| 1706 | 1845 | } |
| 1707 | 1846 | elseif (isset($event['participants'][$this->user]) || isset($event_info['stored_event']['participants'][$this->user])) |
| 1708 | 1847 | { |
@@ -1714,9 +1853,12 @@ discard block |
||
| 1714 | 1853 | break; |
| 1715 | 1854 | |
| 1716 | 1855 | case 'SERIES-PSEUDO-EXCEPTION': |
| 1717 | - if (is_array($event_info['master_event'])) // status update requires a stored master event |
|
| 1856 | + if (is_array($event_info['master_event'])) |
|
| 1857 | + { |
|
| 1858 | + // status update requires a stored master event |
|
| 1718 | 1859 | { |
| 1719 | 1860 | $recurrence = $this->date2usertime($event['recurrence']); |
| 1861 | + } |
|
| 1720 | 1862 | if ($event_info['acl_edit']) |
| 1721 | 1863 | { |
| 1722 | 1864 | // update all participants if we have the right to do that |
@@ -1824,7 +1966,10 @@ discard block |
||
| 1824 | 1966 | */ |
| 1825 | 1967 | public function sync_alarms(array &$event, array $old_alarms, $user) |
| 1826 | 1968 | { |
| 1827 | - if ($this->debug) error_log(__METHOD__."(".array2string($event).', old_alarms='.array2string($old_alarms).", $user,)"); |
|
| 1969 | + if ($this->debug) |
|
| 1970 | + { |
|
| 1971 | + error_log(__METHOD__."(".array2string($event).', old_alarms='.array2string($old_alarms).", $user,)"); |
|
| 1972 | + } |
|
| 1828 | 1973 | $modified = 0; |
| 1829 | 1974 | foreach($event['alarm'] as &$alarm) |
| 1830 | 1975 | { |
@@ -1846,29 +1991,56 @@ discard block |
||
| 1846 | 1991 | break; |
| 1847 | 1992 | } |
| 1848 | 1993 | } |
| 1849 | - if ($this->debug) error_log(__METHOD__."($event[title] (#$event[id]), ..., $user) processing ".($found?'existing':'new')." alarm ".array2string($alarm)); |
|
| 1994 | + if ($this->debug) |
|
| 1995 | + { |
|
| 1996 | + error_log(__METHOD__."($event[title] (#$event[id]), ..., $user) processing ".($found?'existing':'new')." alarm ".array2string($alarm)); |
|
| 1997 | + } |
|
| 1850 | 1998 | if (!empty($alarm['attrs']['X-LIC-ERROR'])) |
| 1851 | 1999 | { |
| 1852 | - if ($this->debug) error_log(__METHOD__."($event[title] (#$event[id]), ..., $user) ignored X-LIC-ERROR=".array2string($alarm['X-LIC-ERROR'])); |
|
| 2000 | + if ($this->debug) |
|
| 2001 | + { |
|
| 2002 | + error_log(__METHOD__."($event[title] (#$event[id]), ..., $user) ignored X-LIC-ERROR=".array2string($alarm['X-LIC-ERROR'])); |
|
| 2003 | + } |
|
| 1853 | 2004 | unset($alarm['attrs']['X-LIC-ERROR']); |
| 1854 | 2005 | } |
| 1855 | 2006 | // alarm not found --> add it |
| 1856 | 2007 | if (!$found) |
| 1857 | 2008 | { |
| 1858 | 2009 | $alarm['owner'] = $user; |
| 1859 | - if (!isset($alarm['time'])) $alarm['time'] = $event['start'] - $alarm['offset']; |
|
| 1860 | - if ($alarm['time'] < time()) calendar_so::shift_alarm($event, $alarm); |
|
| 1861 | - if ($this->debug) error_log(__METHOD__."() adding new alarm from client ".array2string($alarm)); |
|
| 1862 | - if ($event['id']) $alarm['id'] = $this->save_alarm($event['id'], $alarm); |
|
| 2010 | + if (!isset($alarm['time'])) |
|
| 2011 | + { |
|
| 2012 | + $alarm['time'] = $event['start'] - $alarm['offset']; |
|
| 2013 | + } |
|
| 2014 | + if ($alarm['time'] < time()) |
|
| 2015 | + { |
|
| 2016 | + calendar_so::shift_alarm($event, $alarm); |
|
| 2017 | + } |
|
| 2018 | + if ($this->debug) |
|
| 2019 | + { |
|
| 2020 | + error_log(__METHOD__."() adding new alarm from client ".array2string($alarm)); |
|
| 2021 | + } |
|
| 2022 | + if ($event['id']) |
|
| 2023 | + { |
|
| 2024 | + $alarm['id'] = $this->save_alarm($event['id'], $alarm); |
|
| 2025 | + } |
|
| 1863 | 2026 | ++$modified; |
| 1864 | 2027 | } |
| 1865 | 2028 | // existing alarm --> update it |
| 1866 | 2029 | else |
| 1867 | 2030 | { |
| 1868 | - if (!isset($alarm['time'])) $alarm['time'] = $event['start'] - $alarm['offset']; |
|
| 1869 | - if ($alarm['time'] < time()) calendar_so::shift_alarm($event, $alarm); |
|
| 2031 | + if (!isset($alarm['time'])) |
|
| 2032 | + { |
|
| 2033 | + $alarm['time'] = $event['start'] - $alarm['offset']; |
|
| 2034 | + } |
|
| 2035 | + if ($alarm['time'] < time()) |
|
| 2036 | + { |
|
| 2037 | + calendar_so::shift_alarm($event, $alarm); |
|
| 2038 | + } |
|
| 1870 | 2039 | $alarm = array_merge($old_alarm, $alarm); |
| 1871 | - if ($this->debug) error_log(__METHOD__."() updating existing alarm from client ".array2string($alarm)); |
|
| 2040 | + if ($this->debug) |
|
| 2041 | + { |
|
| 2042 | + error_log(__METHOD__."() updating existing alarm from client ".array2string($alarm)); |
|
| 2043 | + } |
|
| 1872 | 2044 | $alarm['id'] = $this->save_alarm($event['id'], $alarm); |
| 1873 | 2045 | ++$modified; |
| 1874 | 2046 | } |
@@ -1882,7 +2054,10 @@ discard block |
||
| 1882 | 2054 | unset($old_alarm[$id]); |
| 1883 | 2055 | continue; |
| 1884 | 2056 | } |
| 1885 | - if ($this->debug) error_log(__METHOD__."() deleting alarm '$id' deleted on client ".array2string($old_alarm)); |
|
| 2057 | + if ($this->debug) |
|
| 2058 | + { |
|
| 2059 | + error_log(__METHOD__."() deleting alarm '$id' deleted on client ".array2string($old_alarm)); |
|
| 2060 | + } |
|
| 1886 | 2061 | $this->delete_alarm($id); |
| 1887 | 2062 | ++$modified; |
| 1888 | 2063 | } |
@@ -2301,7 +2476,10 @@ discard block |
||
| 2301 | 2476 | array2string($_vcalData)."\n",3,$this->logfile); |
| 2302 | 2477 | } |
| 2303 | 2478 | |
| 2304 | - if (!is_array($this->supportedFields)) $this->setSupportedFields(); |
|
| 2479 | + if (!is_array($this->supportedFields)) |
|
| 2480 | + { |
|
| 2481 | + $this->setSupportedFields(); |
|
| 2482 | + } |
|
| 2305 | 2483 | |
| 2306 | 2484 | // we use Api\CalDAV\IcalIterator only on resources, as calling importVCal() accesses single events like an array (eg. $events[0]) |
| 2307 | 2485 | if (is_resource($_vcalData)) |
@@ -2667,19 +2845,27 @@ discard block |
||
| 2667 | 2845 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2668 | 2846 | $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime(trim($recurenceMatches[2])); |
| 2669 | 2847 | } |
| 2670 | - else break; |
|
| 2848 | + else { |
|
| 2849 | + break; |
|
| 2850 | + } |
|
| 2671 | 2851 | // fall-through |
| 2672 | 2852 | case 'DAILY': // 2.0 |
| 2673 | 2853 | $vcardData['recur_type'] = MCAL_RECUR_DAILY; |
| 2674 | - if (stripos($recurence, 'BYDAY') === false) break; |
|
| 2854 | + if (stripos($recurence, 'BYDAY') === false) |
|
| 2855 | + { |
|
| 2856 | + break; |
|
| 2857 | + } |
|
| 2675 | 2858 | // hack to handle TYPE=DAILY;BYDAY= as WEEKLY, which is true as long as there's no interval |
| 2676 | 2859 | // fall-through |
| 2677 | 2860 | case 'W': |
| 2678 | 2861 | case 'WEEKLY': |
| 2679 | 2862 | $days = array(); |
| 2680 | - if (preg_match('/W(\d+) *((?i: [AEFHMORSTUW]{2})+)?( +([^ ]*))$/',$recurence, $recurenceMatches)) // 1.0 |
|
| 2863 | + if (preg_match('/W(\d+) *((?i: [AEFHMORSTUW]{2})+)?( +([^ ]*))$/',$recurence, $recurenceMatches)) |
|
| 2864 | + { |
|
| 2865 | + // 1.0 |
|
| 2681 | 2866 | { |
| 2682 | 2867 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2868 | + } |
|
| 2683 | 2869 | if (empty($recurenceMatches[2])) |
| 2684 | 2870 | { |
| 2685 | 2871 | $days[0] = strtoupper(substr(date('D', $vcardData['start']),0,2)); |
@@ -2692,7 +2878,10 @@ discard block |
||
| 2692 | 2878 | $repeatMatches = null; |
| 2693 | 2879 | if (preg_match('/#(\d+)/',$recurenceMatches[4],$repeatMatches)) |
| 2694 | 2880 | { |
| 2695 | - if ($repeatMatches[1]) $vcardData['recur_count'] = $repeatMatches[1]; |
|
| 2881 | + if ($repeatMatches[1]) |
|
| 2882 | + { |
|
| 2883 | + $vcardData['recur_count'] = $repeatMatches[1]; |
|
| 2884 | + } |
|
| 2696 | 2885 | } |
| 2697 | 2886 | else |
| 2698 | 2887 | { |
@@ -2701,9 +2890,12 @@ discard block |
||
| 2701 | 2890 | |
| 2702 | 2891 | $recur_days = $this->recur_days_1_0; |
| 2703 | 2892 | } |
| 2704 | - elseif (preg_match('/BYDAY=([^;: ]+)/',$recurence,$recurenceMatches)) // 2.0 |
|
| 2893 | + elseif (preg_match('/BYDAY=([^;: ]+)/',$recurence,$recurenceMatches)) |
|
| 2894 | + { |
|
| 2895 | + // 2.0 |
|
| 2705 | 2896 | { |
| 2706 | 2897 | $days = explode(',',$recurenceMatches[1]); |
| 2898 | + } |
|
| 2707 | 2899 | $recur_days = $this->recur_days; |
| 2708 | 2900 | } |
| 2709 | 2901 | else // no day given, use the day of dtstart |
@@ -2762,7 +2954,10 @@ discard block |
||
| 2762 | 2954 | { |
| 2763 | 2955 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2764 | 2956 | $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]); |
| 2765 | - } else break; |
|
| 2957 | + } |
|
| 2958 | + else { |
|
| 2959 | + break; |
|
| 2960 | + } |
|
| 2766 | 2961 | // fall-through |
| 2767 | 2962 | case 'YEARLY': // 2.0 |
| 2768 | 2963 | if (strpos($recurence, 'BYDAY') === false) |
@@ -2782,7 +2977,10 @@ discard block |
||
| 2782 | 2977 | } |
| 2783 | 2978 | break; |
| 2784 | 2979 | case 'EXDATE': |
| 2785 | - if (!$attributes['value']) break; |
|
| 2980 | + if (!$attributes['value']) |
|
| 2981 | + { |
|
| 2982 | + break; |
|
| 2983 | + } |
|
| 2786 | 2984 | if ((isset($attributes['params']['VALUE']) |
| 2787 | 2985 | && $attributes['params']['VALUE'] == 'DATE') || |
| 2788 | 2986 | (!isset($attributes['params']['VALUE']) && $isDate)) |
@@ -2862,13 +3060,16 @@ discard block |
||
| 2862 | 3060 | // fall throught |
| 2863 | 3061 | case 'ATTENDEE': |
| 2864 | 3062 | if (isset($attributes['params']['PARTSTAT'])) |
| 2865 | - { |
|
| 3063 | + { |
|
| 2866 | 3064 | $attributes['params']['STATUS'] = $attributes['params']['PARTSTAT']; |
| 2867 | 3065 | } |
| 2868 | 3066 | if (isset($attributes['params']['STATUS'])) |
| 2869 | - { |
|
| 3067 | + { |
|
| 2870 | 3068 | $status = $this->status_ical2egw[strtoupper($attributes['params']['STATUS'])]; |
| 2871 | - if (empty($status)) $status = 'X'; |
|
| 3069 | + if (empty($status)) |
|
| 3070 | + { |
|
| 3071 | + $status = 'X'; |
|
| 3072 | + } |
|
| 2872 | 3073 | } |
| 2873 | 3074 | else |
| 2874 | 3075 | { |
@@ -2928,7 +3129,10 @@ discard block |
||
| 2928 | 3129 | $uid = $this->user; |
| 2929 | 3130 | } |
| 2930 | 3131 | // check principal url from CalDAV here after X-EGROUPWARE-UID and to get optional X-EGROUPWARE-QUANTITY |
| 2931 | - if (!$uid) $uid = Api\CalDAV\Principals::url2uid($attributes['value'], null, $cn); |
|
| 3132 | + if (!$uid) |
|
| 3133 | + { |
|
| 3134 | + $uid = Api\CalDAV\Principals::url2uid($attributes['value'], null, $cn); |
|
| 3135 | + } |
|
| 2932 | 3136 | |
| 2933 | 3137 | // try to find an email address |
| 2934 | 3138 | if (!$uid && $email && ($uid = $GLOBALS['egw']->accounts->name2id($email, 'account_email'))) |
@@ -2996,7 +3200,10 @@ discard block |
||
| 2996 | 3200 | } |
| 2997 | 3201 | $status = 'U'; // keep the group |
| 2998 | 3202 | } |
| 2999 | - else continue; // can't find this group |
|
| 3203 | + else { |
|
| 3204 | + continue; |
|
| 3205 | + } |
|
| 3206 | + // can't find this group |
|
| 3000 | 3207 | } |
| 3001 | 3208 | elseif (empty($searcharray)) |
| 3002 | 3209 | { |
@@ -3055,7 +3262,9 @@ discard block |
||
| 3055 | 3262 | |
| 3056 | 3263 | try { |
| 3057 | 3264 | if (!$this->calendarOwner && is_numeric($uid) && $role == 'CHAIR') |
| 3058 | - $component->getAttribute('ORGANIZER'); |
|
| 3265 | + { |
|
| 3266 | + $component->getAttribute('ORGANIZER'); |
|
| 3267 | + } |
|
| 3059 | 3268 | } |
| 3060 | 3269 | catch(Horde_Icalendar_Exception $e) |
| 3061 | 3270 | { |
@@ -3092,7 +3301,10 @@ discard block |
||
| 3092 | 3301 | } |
| 3093 | 3302 | break; |
| 3094 | 3303 | case 'CREATED': // will be written direct to the event |
| 3095 | - if ($event['modified']) break; |
|
| 3304 | + if ($event['modified']) |
|
| 3305 | + { |
|
| 3306 | + break; |
|
| 3307 | + } |
|
| 3096 | 3308 | // fall through |
| 3097 | 3309 | case 'LAST-MODIFIED': // will be written direct to the event |
| 3098 | 3310 | $event['modified'] = $attributes['value']; |
@@ -3113,7 +3325,11 @@ discard block |
||
| 3113 | 3325 | break; |
| 3114 | 3326 | |
| 3115 | 3327 | case 'ATTACH': |
| 3116 | - if ($attributes['params'] && !empty($attributes['params']['FMTTYPE'])) break; // handeled by managed attachment code |
|
| 3328 | + if ($attributes['params'] && !empty($attributes['params']['FMTTYPE'])) |
|
| 3329 | + { |
|
| 3330 | + break; |
|
| 3331 | + } |
|
| 3332 | + // handeled by managed attachment code |
|
| 3117 | 3333 | // fall throught to store external attachment url |
| 3118 | 3334 | default: // X- attribute or other by EGroupware unsupported property |
| 3119 | 3335 | //error_log(__METHOD__."() $attributes[name] = ".array2string($attributes)); |
@@ -3244,7 +3460,10 @@ discard block |
||
| 3244 | 3460 | $event['end'] = $event['start'] + 60 * $this->cal_prefs['defaultlength']; |
| 3245 | 3461 | } |
| 3246 | 3462 | |
| 3247 | - if ($this->calendarOwner) $event['owner'] = $this->calendarOwner; |
|
| 3463 | + if ($this->calendarOwner) |
|
| 3464 | + { |
|
| 3465 | + $event['owner'] = $this->calendarOwner; |
|
| 3466 | + } |
|
| 3248 | 3467 | |
| 3249 | 3468 | // parsing ATTACH attributes for managed attachments |
| 3250 | 3469 | $event['attach-delete-by-put'] = $component->getAttributeDefault('X-EGROUPWARE-ATTACH-INCLUDED', null) === 'TRUE'; |
@@ -3270,7 +3489,10 @@ discard block |
||
| 3270 | 3489 | $filter = $relax ? 'relax' : 'check'; |
| 3271 | 3490 | $event = array_shift($events); |
| 3272 | 3491 | $eventId = -1; |
| 3273 | - if ($this->so->isWholeDay($event)) $event['whole_day'] = true; |
|
| 3492 | + if ($this->so->isWholeDay($event)) |
|
| 3493 | + { |
|
| 3494 | + $event['whole_day'] = true; |
|
| 3495 | + } |
|
| 3274 | 3496 | if ($contentID) |
| 3275 | 3497 | { |
| 3276 | 3498 | $parts = preg_split('/:/', $contentID); |
@@ -3323,8 +3545,16 @@ discard block |
||
| 3323 | 3545 | */ |
| 3324 | 3546 | function freebusy($user,$end=null,$utc=true, $charset='UTF-8', $start=null, $method='PUBLISH', array $extra=null) |
| 3325 | 3547 | { |
| 3326 | - if (!$start) $start = time(); // default now |
|
| 3327 | - if (!$end) $end = time() + 100*DAY_s; // default next 100 days |
|
| 3548 | + if (!$start) |
|
| 3549 | + { |
|
| 3550 | + $start = time(); |
|
| 3551 | + } |
|
| 3552 | + // default now |
|
| 3553 | + if (!$end) |
|
| 3554 | + { |
|
| 3555 | + $end = time() + 100*DAY_s; |
|
| 3556 | + } |
|
| 3557 | + // default next 100 days |
|
| 3328 | 3558 | |
| 3329 | 3559 | $vcal = new Horde_Icalendar; |
| 3330 | 3560 | $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
@@ -3346,10 +3576,13 @@ discard block |
||
| 3346 | 3576 | $attributes[$attr] = date('Ymd\THis', $value); |
| 3347 | 3577 | } |
| 3348 | 3578 | } |
| 3349 | - if (is_null($extra)) $extra = array( |
|
| 3579 | + if (is_null($extra)) |
|
| 3580 | + { |
|
| 3581 | + $extra = array( |
|
| 3350 | 3582 | 'URL' => $this->freebusy_url($user), |
| 3351 | 3583 | 'ORGANIZER' => 'mailto:'.$GLOBALS['egw']->accounts->id2name($user,'account_email'), |
| 3352 | 3584 | ); |
| 3585 | + } |
|
| 3353 | 3586 | foreach($attributes+$extra as $attr => $value) |
| 3354 | 3587 | { |
| 3355 | 3588 | $vfreebusy->setAttribute($attr, $value); |
@@ -3365,9 +3598,18 @@ discard block |
||
| 3365 | 3598 | { |
| 3366 | 3599 | foreach ($fbdata as $event) |
| 3367 | 3600 | { |
| 3368 | - if ($event['non_blocking']) continue; |
|
| 3369 | - if ($event['uid'] === $extra['X-CALENDARSERVER-MASK-UID']) continue; |
|
| 3370 | - if ($event['participants'][$user] == 'R') continue; |
|
| 3601 | + if ($event['non_blocking']) |
|
| 3602 | + { |
|
| 3603 | + continue; |
|
| 3604 | + } |
|
| 3605 | + if ($event['uid'] === $extra['X-CALENDARSERVER-MASK-UID']) |
|
| 3606 | + { |
|
| 3607 | + continue; |
|
| 3608 | + } |
|
| 3609 | + if ($event['participants'][$user] == 'R') |
|
| 3610 | + { |
|
| 3611 | + continue; |
|
| 3612 | + } |
|
| 3371 | 3613 | |
| 3372 | 3614 | $fbtype = $event['participants'][$user] == 'T' ? 'BUSY-TENTATIVE' : 'BUSY'; |
| 3373 | 3615 | |