@@ -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 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param int|string $current_user =0 uid of current user to only export that one as participant for method=REPLY |
| 198 | 198 | * @return string|boolean string with iCal or false on error (e.g. no permission to read the event) |
| 199 | 199 | */ |
| 200 | - function &exportVCal($events, $version='1.0', $method='PUBLISH', $recur_date=0, $principalURL='', $charset='UTF-8', $current_user=0) |
|
| 200 | + function &exportVCal($events, $version = '1.0', $method = 'PUBLISH', $recur_date = 0, $principalURL = '', $charset = 'UTF-8', $current_user = 0) |
|
| 201 | 201 | { |
| 202 | 202 | if ($this->log) |
| 203 | 203 | { |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | if (!is_array($this->supportedFields)) $this->setSupportedFields(); |
| 230 | 230 | |
| 231 | - if ($this->productManufacturer == '' ) |
|
| 231 | + if ($this->productManufacturer == '') |
|
| 232 | 232 | { // syncevolution is broken |
| 233 | 233 | $version = '2.0'; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | $vcal = new Horde_Icalendar; |
| 237 | - $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
|
| 237 | + $vcal->setAttribute('PRODID', '-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
|
| 238 | 238 | strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang'])); |
| 239 | 239 | $vcal->setAttribute('VERSION', $version); |
| 240 | 240 | if ($method) $vcal->setAttribute('METHOD', $method); |
@@ -264,15 +264,15 @@ discard block |
||
| 264 | 264 | if ($this->log) |
| 265 | 265 | { |
| 266 | 266 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 267 | - '() User does not have the permission to read event ' . $event['id']. "\n", |
|
| 268 | - 3,$this->logfile); |
|
| 267 | + '() User does not have the permission to read event '.$event['id']."\n", |
|
| 268 | + 3, $this->logfile); |
|
| 269 | 269 | } |
| 270 | 270 | return -1; // Permission denied |
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | else |
| 274 | 274 | { |
| 275 | - $retval = false; // Entry does not exist |
|
| 275 | + $retval = false; // Entry does not exist |
|
| 276 | 276 | if ($this->log) |
| 277 | 277 | { |
| 278 | 278 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | if ($this->log) |
| 287 | 287 | { |
| 288 | 288 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 289 | - '() export event UID: ' . $event['uid'] . ".\n", |
|
| 289 | + '() export event UID: '.$event['uid'].".\n", |
|
| 290 | 290 | 3, $this->logfile); |
| 291 | 291 | } |
| 292 | 292 | |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | if ($this->log) |
| 312 | 312 | { |
| 313 | 313 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 314 | - '(' . $event['id']. ',' . $recurrence . ")\n" . |
|
| 315 | - array2string($event)."\n",3,$this->logfile); |
|
| 314 | + '('.$event['id'].','.$recurrence.")\n". |
|
| 315 | + array2string($event)."\n", 3, $this->logfile); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | if ($recurrence) |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | { |
| 334 | 334 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 335 | 335 | "(, $recurrence) Gratuitous pseudo exception, skipped ...\n", |
| 336 | - 3,$this->logfile); |
|
| 336 | + 3, $this->logfile); |
|
| 337 | 337 | } |
| 338 | 338 | continue; // unsupported status only exception |
| 339 | 339 | } |
@@ -343,13 +343,13 @@ discard block |
||
| 343 | 343 | $days = $this->so->get_recurrence_exceptions($master, $tzid, 0, 0, 'rrule'); |
| 344 | 344 | if ($this->log) |
| 345 | 345 | { |
| 346 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
| 347 | - array2string($days)."\n",3,$this->logfile); |
|
| 346 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
| 347 | + array2string($days)."\n", 3, $this->logfile); |
|
| 348 | 348 | } |
| 349 | 349 | $recurrence = $days[$recurrence]; // use remote representation |
| 350 | 350 | } |
| 351 | 351 | // force single event |
| 352 | - foreach (array('recur_enddate','recur_interval','recur_exception','recur_data','recur_date','id','etag') as $name) |
|
| 352 | + foreach (array('recur_enddate', 'recur_interval', 'recur_exception', 'recur_data', 'recur_date', 'id', 'etag') as $name) |
|
| 353 | 353 | { |
| 354 | 354 | unset($event[$name]); |
| 355 | 355 | } |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | // check if tzid of event (not only recuring ones) is already added to export |
| 360 | - if ($tzid && $tzid != 'UTC' && !in_array($tzid,$vtimezones_added)) |
|
| 360 | + if ($tzid && $tzid != 'UTC' && !in_array($tzid, $vtimezones_added)) |
|
| 361 | 361 | { |
| 362 | 362 | // check if we have vtimezone component data for tzid of event, if not default to user timezone (default to server tz) |
| 363 | 363 | if (calendar_timezones::add_vtimezone($vcal, $tzid) || |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | { |
| 376 | 376 | // Append UID to DESCRIPTION |
| 377 | 377 | if (!preg_match('/\[UID:.+\]/m', $event['description'])) { |
| 378 | - $event['description'] .= "\n[UID:" . $event['uid'] . "]"; |
|
| 378 | + $event['description'] .= "\n[UID:".$event['uid']."]"; |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
@@ -396,14 +396,14 @@ discard block |
||
| 396 | 396 | $exceptions = array(); |
| 397 | 397 | |
| 398 | 398 | // dont use "virtual" exceptions created by participant status for GroupDAV or file export |
| 399 | - if (!in_array($this->productManufacturer,array('file','groupdav'))) |
|
| 399 | + if (!in_array($this->productManufacturer, array('file', 'groupdav'))) |
|
| 400 | 400 | { |
| 401 | 401 | $filter = isset($this->supportedFields['participants']) ? 'rrule' : 'tz_rrule'; |
| 402 | 402 | $exceptions = $this->so->get_recurrence_exceptions($event, $tzid, 0, 0, $filter); |
| 403 | 403 | if ($this->log) |
| 404 | 404 | { |
| 405 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."(EXCEPTIONS)\n" . |
|
| 406 | - array2string($exceptions)."\n",3,$this->logfile); |
|
| 405 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."(EXCEPTIONS)\n". |
|
| 406 | + array2string($exceptions)."\n", 3, $this->logfile); |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | elseif (is_array($event['recur_exception'])) |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | if ($this->log) |
| 421 | 421 | { |
| 422 | 422 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 423 | - '(' . $event['id'] . ") [$icalFieldName] not supported\n", |
|
| 424 | - 3,$this->logfile); |
|
| 423 | + '('.$event['id'].") [$icalFieldName] not supported\n", |
|
| 424 | + 3, $this->logfile); |
|
| 425 | 425 | } |
| 426 | 426 | continue; |
| 427 | 427 | } |
@@ -438,23 +438,23 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | if (!($info = $this->resource_info($uid))) continue; |
| 440 | 440 | |
| 441 | - if (in_array($status, array('X','E'))) continue; // dont include deleted participants |
|
| 441 | + if (in_array($status, array('X', 'E'))) continue; // dont include deleted participants |
|
| 442 | 442 | |
| 443 | 443 | if ($this->log) |
| 444 | 444 | { |
| 445 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 446 | - '()attendee:' . array2string($info) ."\n",3,$this->logfile); |
|
| 445 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 446 | + '()attendee:'.array2string($info)."\n", 3, $this->logfile); |
|
| 447 | 447 | } |
| 448 | 448 | $participantCN = str_replace(array('\\', ',', ';', ':'), |
| 449 | 449 | array('\\\\', '\\,', '\\;', '\\:'), |
| 450 | 450 | trim(empty($info['cn']) ? $info['name'] : $info['cn'])); |
| 451 | 451 | if ($version == '1.0') |
| 452 | 452 | { |
| 453 | - $participantURL = trim('"' . $participantCN . '"' . (empty($info['email']) ? '' : ' <' . $info['email'] .'>')); |
|
| 453 | + $participantURL = trim('"'.$participantCN.'"'.(empty($info['email']) ? '' : ' <'.$info['email'].'>')); |
|
| 454 | 454 | } |
| 455 | 455 | else |
| 456 | 456 | { |
| 457 | - $participantURL = empty($info['email']) ? '' : 'mailto:' . $info['email']; |
|
| 457 | + $participantURL = empty($info['email']) ? '' : 'mailto:'.$info['email']; |
|
| 458 | 458 | } |
| 459 | 459 | // RSVP={TRUE|FALSE} // resonse expected, not set in eGW => status=U |
| 460 | 460 | $rsvp = $status == 'U' ? 'TRUE' : 'FALSE'; |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | ($members = $GLOBALS['egw']->accounts->members($uid, true)) && in_array($this->user, $members)) |
| 483 | 483 | { |
| 484 | 484 | $user = $this->resource_info($this->user); |
| 485 | - $attributes['ATTENDEE'][] = 'mailto:' . $user['email']; |
|
| 485 | + $attributes['ATTENDEE'][] = 'mailto:'.$user['email']; |
|
| 486 | 486 | $parameters['ATTENDEE'][] = array( |
| 487 | 487 | 'CN' => $user['name'], |
| 488 | 488 | 'ROLE' => 'REQ-PARTICIPANT', |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | if (!empty($rsvp)) $options['RSVP'] = $rsvp; |
| 525 | 525 | if (!empty($info['email']) && $participantURL != 'mailto:'.$info['email']) |
| 526 | 526 | { |
| 527 | - $options['EMAIL'] = $info['email']; // only add EMAIL attribute, if not already URL, as eg. Akonadi is reported to have problems with it |
|
| 527 | + $options['EMAIL'] = $info['email']; // only add EMAIL attribute, if not already URL, as eg. Akonadi is reported to have problems with it |
|
| 528 | 528 | } |
| 529 | 529 | if ($info['type'] != 'e') $options['X-EGROUPWARE-UID'] = (string)$uid; |
| 530 | 530 | if ($quantity > 1) $options['X-EGROUPWARE-QUANTITY'] = (string)$quantity; |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | break; |
| 535 | 535 | |
| 536 | 536 | case 'CLASS': |
| 537 | - if ($event['public']) continue; // public is default, no need to export, fails CalDAVTester if added as default |
|
| 537 | + if ($event['public']) continue; // public is default, no need to export, fails CalDAVTester if added as default |
|
| 538 | 538 | $attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'PRIVATE'; |
| 539 | 539 | // Apple iCal on OS X uses X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALANDAR (not VEVENT!) |
| 540 | 540 | if (!$event['public'] && $this->productManufacturer == 'groupdav') |
@@ -546,16 +546,16 @@ discard block |
||
| 546 | 546 | case 'ORGANIZER': |
| 547 | 547 | if (!$organizerURL) |
| 548 | 548 | { |
| 549 | - $organizerCN = '"' . trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname') |
|
| 550 | - . ' ' . $GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname')) . '"'; |
|
| 551 | - $organizerEMail = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_email'); |
|
| 549 | + $organizerCN = '"'.trim($GLOBALS['egw']->accounts->id2name($event['owner'], 'account_firstname') |
|
| 550 | + . ' '.$GLOBALS['egw']->accounts->id2name($event['owner'], 'account_lastname')).'"'; |
|
| 551 | + $organizerEMail = $GLOBALS['egw']->accounts->id2name($event['owner'], 'account_email'); |
|
| 552 | 552 | if ($version == '1.0') |
| 553 | 553 | { |
| 554 | - $organizerURL = trim($organizerCN . (empty($organizerURL) ? '' : ' <' . $organizerURL .'>')); |
|
| 554 | + $organizerURL = trim($organizerCN.(empty($organizerURL) ? '' : ' <'.$organizerURL.'>')); |
|
| 555 | 555 | } |
| 556 | 556 | else |
| 557 | 557 | { |
| 558 | - $organizerURL = empty($organizerEMail) ? '' : 'mailto:' . $organizerEMail; |
|
| 558 | + $organizerURL = empty($organizerEMail) ? '' : 'mailto:'.$organizerEMail; |
|
| 559 | 559 | } |
| 560 | 560 | $organizerUID = $event['owner']; |
| 561 | 561 | if (!isset($event['participants'][$event['owner']])) |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | case 'DTSTART': |
| 589 | 589 | if (empty($event['whole_day'])) |
| 590 | 590 | { |
| 591 | - $attributes['DTSTART'] = self::getDateTime($event['start'],$tzid,$parameters['DTSTART']); |
|
| 591 | + $attributes['DTSTART'] = self::getDateTime($event['start'], $tzid, $parameters['DTSTART']); |
|
| 592 | 592 | } |
| 593 | 593 | break; |
| 594 | 594 | |
@@ -599,27 +599,27 @@ discard block |
||
| 599 | 599 | if ($tzid == 'UTC' && $event['end'] - $event['start'] <= 86400) |
| 600 | 600 | $attributes['duration'] = $event['end'] - $event['start']; |
| 601 | 601 | else |
| 602 | - $attributes['DTEND'] = self::getDateTime($event['end'],$tzid,$parameters['DTEND']); |
|
| 602 | + $attributes['DTEND'] = self::getDateTime($event['end'], $tzid, $parameters['DTEND']); |
|
| 603 | 603 | } |
| 604 | 604 | else |
| 605 | 605 | { |
| 606 | 606 | // write start + end of whole day events as dates |
| 607 | - $event['end-nextday'] = $event['end'] + 12*3600; // we need the date of the next day, as DTEND is non-inclusive (= exclusive) in rfc2445 |
|
| 608 | - foreach (array('start' => 'DTSTART','end-nextday' => 'DTEND') as $f => $t) |
|
| 607 | + $event['end-nextday'] = $event['end'] + 12 * 3600; // we need the date of the next day, as DTEND is non-inclusive (= exclusive) in rfc2445 |
|
| 608 | + foreach (array('start' => 'DTSTART', 'end-nextday' => 'DTEND') as $f => $t) |
|
| 609 | 609 | { |
| 610 | - $time = new Api\DateTime($event[$f],Api\DateTime::$server_timezone); |
|
| 611 | - $arr = Api\DateTime::to($time,'array'); |
|
| 612 | - $vevent->setAttribute($t, array('year' => $arr['year'],'month' => $arr['month'],'mday' => $arr['day']), |
|
| 610 | + $time = new Api\DateTime($event[$f], Api\DateTime::$server_timezone); |
|
| 611 | + $arr = Api\DateTime::to($time, 'array'); |
|
| 612 | + $vevent->setAttribute($t, array('year' => $arr['year'], 'month' => $arr['month'], 'mday' => $arr['day']), |
|
| 613 | 613 | array('VALUE' => 'DATE')); |
| 614 | 614 | } |
| 615 | 615 | unset($attributes['DTSTART']); |
| 616 | 616 | // 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 |
| 617 | - $vevent->setAttribute('X-MICROSOFT-CDO-ALLDAYEVENT','TRUE'); |
|
| 617 | + $vevent->setAttribute('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE'); |
|
| 618 | 618 | } |
| 619 | 619 | break; |
| 620 | 620 | |
| 621 | 621 | case 'RRULE': |
| 622 | - if ($event['recur_type'] == MCAL_RECUR_NONE) break; // no recuring event |
|
| 622 | + if ($event['recur_type'] == MCAL_RECUR_NONE) break; // no recuring event |
|
| 623 | 623 | $rriter = calendar_rrule::event2rrule($event, false, $tzid); |
| 624 | 624 | $rrule = $rriter->generate_rrule($version); |
| 625 | 625 | if ($event['recur_enddate']) |
@@ -638,16 +638,16 @@ discard block |
||
| 638 | 638 | { |
| 639 | 639 | if ($event['recur_enddate'] && $tzid) |
| 640 | 640 | { |
| 641 | - $rrule['UNTIL'] = self::getDateTime($rrule['UNTIL'],$tzid); |
|
| 641 | + $rrule['UNTIL'] = self::getDateTime($rrule['UNTIL'], $tzid); |
|
| 642 | 642 | } |
| 643 | 643 | $attributes['RRULE'] = $rrule['FREQ'].' '.$rrule['UNTIL']; |
| 644 | 644 | } |
| 645 | 645 | else // $version == '2.0' |
| 646 | 646 | { |
| 647 | 647 | $attributes['RRULE'] = ''; |
| 648 | - foreach($rrule as $n => $v) |
|
| 648 | + foreach ($rrule as $n => $v) |
|
| 649 | 649 | { |
| 650 | - $attributes['RRULE'] .= ($attributes['RRULE']?';':'').$n.'='.$v; |
|
| 650 | + $attributes['RRULE'] .= ($attributes['RRULE'] ? ';' : '').$n.'='.$v; |
|
| 651 | 651 | } |
| 652 | 652 | } |
| 653 | 653 | break; |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | { |
| 663 | 663 | // current Horde_Icalendar 2.1.4 exports EXDATE always in UTC, so we should not set a timezone here |
| 664 | 664 | // Apple calendar on OS X 10.11.4 uses a timezone, so does Horde eg. for Recurrence-ID |
| 665 | - $event['recur_exception'][$key] = self::getDateTime($timestamp,$tzid);//,$parameters['EXDATE']); |
|
| 665 | + $event['recur_exception'][$key] = self::getDateTime($timestamp, $tzid); //,$parameters['EXDATE']); |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | else |
@@ -670,9 +670,9 @@ discard block |
||
| 670 | 670 | // use 'DATE' instead of 'DATE-TIME' on whole day events |
| 671 | 671 | foreach ($event['recur_exception'] as $id => $timestamp) |
| 672 | 672 | { |
| 673 | - $time = new Api\DateTime($timestamp,Api\DateTime::$server_timezone); |
|
| 673 | + $time = new Api\DateTime($timestamp, Api\DateTime::$server_timezone); |
|
| 674 | 674 | $time->setTimezone(self::$tz_cache[$event['tzid']]); |
| 675 | - $arr = Api\DateTime::to($time,'array'); |
|
| 675 | + $arr = Api\DateTime::to($time, 'array'); |
|
| 676 | 676 | $days[$id] = array( |
| 677 | 677 | 'year' => $arr['year'], |
| 678 | 678 | 'month' => $arr['month'], |
@@ -687,21 +687,21 @@ discard block |
||
| 687 | 687 | break; |
| 688 | 688 | |
| 689 | 689 | case 'PRIORITY': |
| 690 | - if (!$event['priority']) continue; // 0=undefined is default, no need to export, fails CalDAVTester if our default is added |
|
| 690 | + if (!$event['priority']) continue; // 0=undefined is default, no need to export, fails CalDAVTester if our default is added |
|
| 691 | 691 | if ($this->productManufacturer == 'funambol' && |
| 692 | 692 | (strpos($this->productName, 'outlook') !== false |
| 693 | 693 | || strpos($this->productName, 'pocket pc') !== false)) |
| 694 | 694 | { |
| 695 | - $attributes['PRIORITY'] = (int) $this->priority_egw2funambol[$event['priority']]; |
|
| 695 | + $attributes['PRIORITY'] = (int)$this->priority_egw2funambol[$event['priority']]; |
|
| 696 | 696 | } |
| 697 | 697 | else |
| 698 | 698 | { |
| 699 | - $attributes['PRIORITY'] = (int) $this->priority_egw2ical[$event['priority']]; |
|
| 699 | + $attributes['PRIORITY'] = (int)$this->priority_egw2ical[$event['priority']]; |
|
| 700 | 700 | } |
| 701 | 701 | break; |
| 702 | 702 | |
| 703 | 703 | case 'TRANSP': |
| 704 | - if (!$event['non_blocking']) continue; // OPAQUE is default, no need to export, fails CalDAVTester if added as default |
|
| 704 | + if (!$event['non_blocking']) continue; // OPAQUE is default, no need to export, fails CalDAVTester if added as default |
|
| 705 | 705 | if ($version == '1.0') |
| 706 | 706 | { |
| 707 | 707 | $attributes['TRANSP'] = ($event['non_blocking'] ? 1 : 0); |
@@ -740,13 +740,13 @@ discard block |
||
| 740 | 740 | // We handle a pseudo exception |
| 741 | 741 | if (empty($event['whole_day'])) |
| 742 | 742 | { |
| 743 | - $attributes[$icalFieldName] = self::getDateTime($recur_date,$tzid,$parameters[$icalFieldName]); |
|
| 743 | + $attributes[$icalFieldName] = self::getDateTime($recur_date, $tzid, $parameters[$icalFieldName]); |
|
| 744 | 744 | } |
| 745 | 745 | else |
| 746 | 746 | { |
| 747 | - $time = new Api\DateTime($recur_date,Api\DateTime::$server_timezone); |
|
| 747 | + $time = new Api\DateTime($recur_date, Api\DateTime::$server_timezone); |
|
| 748 | 748 | $time->setTimezone(self::$tz_cache[$event['tzid']]); |
| 749 | - $arr = Api\DateTime::to($time,'array'); |
|
| 749 | + $arr = Api\DateTime::to($time, 'array'); |
|
| 750 | 750 | $vevent->setAttribute($icalFieldName, array( |
| 751 | 751 | 'year' => $arr['year'], |
| 752 | 752 | 'month' => $arr['month'], |
@@ -758,17 +758,17 @@ discard block |
||
| 758 | 758 | elseif ($event['recurrence'] && $event['reference']) |
| 759 | 759 | { |
| 760 | 760 | // $event['reference'] is a calendar_id, not a timestamp |
| 761 | - if (!($revent = $this->read($event['reference']))) break; // referenced event does not exist |
|
| 761 | + if (!($revent = $this->read($event['reference']))) break; // referenced event does not exist |
|
| 762 | 762 | |
| 763 | 763 | if (empty($revent['whole_day'])) |
| 764 | 764 | { |
| 765 | - $attributes[$icalFieldName] = self::getDateTime($event['recurrence'],$tzid,$parameters[$icalFieldName]); |
|
| 765 | + $attributes[$icalFieldName] = self::getDateTime($event['recurrence'], $tzid, $parameters[$icalFieldName]); |
|
| 766 | 766 | } |
| 767 | 767 | else |
| 768 | 768 | { |
| 769 | - $time = new Api\DateTime($event['recurrence'],Api\DateTime::$server_timezone); |
|
| 769 | + $time = new Api\DateTime($event['recurrence'], Api\DateTime::$server_timezone); |
|
| 770 | 770 | $time->setTimezone(self::$tz_cache[$event['tzid']]); |
| 771 | - $arr = Api\DateTime::to($time,'array'); |
|
| 771 | + $arr = Api\DateTime::to($time, 'array'); |
|
| 772 | 772 | $vevent->setAttribute($icalFieldName, array( |
| 773 | 773 | 'year' => $arr['year'], |
| 774 | 774 | 'month' => $arr['month'], |
@@ -792,9 +792,9 @@ discard block |
||
| 792 | 792 | $noTruncate = $this->clientProperties[$icalFieldName]['NoTruncate']; |
| 793 | 793 | if ($this->log && $size > 0) |
| 794 | 794 | { |
| 795 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 796 | - "() $icalFieldName Size: $size, NoTruncate: " . |
|
| 797 | - ($noTruncate ? 'TRUE' : 'FALSE') . "\n",3,$this->logfile); |
|
| 795 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 796 | + "() $icalFieldName Size: $size, NoTruncate: ". |
|
| 797 | + ($noTruncate ? 'TRUE' : 'FALSE')."\n", 3, $this->logfile); |
|
| 798 | 798 | } |
| 799 | 799 | //Horde::logMessage("vCalendar $icalFieldName Size: $size, NoTruncate: " . |
| 800 | 800 | // ($noTruncate ? 'TRUE' : 'FALSE'), __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -812,8 +812,8 @@ discard block |
||
| 812 | 812 | { |
| 813 | 813 | if ($this->log) |
| 814 | 814 | { |
| 815 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 816 | - "() $icalFieldName omitted due to maximum size $size\n",3,$this->logfile); |
|
| 815 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 816 | + "() $icalFieldName omitted due to maximum size $size\n", 3, $this->logfile); |
|
| 817 | 817 | } |
| 818 | 818 | //Horde::logMessage("vCalendar $icalFieldName omitted due to maximum size $size", |
| 819 | 819 | // __FILE__, __LINE__, PEAR_LOG_WARNING); |
@@ -823,8 +823,8 @@ discard block |
||
| 823 | 823 | $value = substr($value, 0, $size - 1); |
| 824 | 824 | if ($this->log) |
| 825 | 825 | { |
| 826 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 827 | - "() $icalFieldName truncated to maximum size $size\n",3,$this->logfile); |
|
| 826 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 827 | + "() $icalFieldName truncated to maximum size $size\n", 3, $this->logfile); |
|
| 828 | 828 | } |
| 829 | 829 | //Horde::logMessage("vCalendar $icalFieldName truncated to maximum size $size", |
| 830 | 830 | // __FILE__, __LINE__, PEAR_LOG_INFO); |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | // for CalDAV add all X-Properties previously parsed |
| 840 | 840 | if ($this->productManufacturer == 'groupdav' || $this->productManufacturer == 'file') |
| 841 | 841 | { |
| 842 | - foreach($event as $name => $value) |
|
| 842 | + foreach ($event as $name => $value) |
|
| 843 | 843 | { |
| 844 | 844 | if (substr($name, 0, 2) == '##') |
| 845 | 845 | { |
@@ -911,8 +911,8 @@ discard block |
||
| 911 | 911 | $values['AALARM']['repeat count'] = ''; |
| 912 | 912 | $values['AALARM']['display text'] = $description; |
| 913 | 913 | } |
| 914 | - $attributes['DALARM'] = self::getDateTime($alarmData['time'],$tzid,$parameters['DALARM']); |
|
| 915 | - $attributes['AALARM'] = self::getDateTime($alarmData['time'],$tzid,$parameters['AALARM']); |
|
| 914 | + $attributes['DALARM'] = self::getDateTime($alarmData['time'], $tzid, $parameters['DALARM']); |
|
| 915 | + $attributes['AALARM'] = self::getDateTime($alarmData['time'], $tzid, $parameters['AALARM']); |
|
| 916 | 916 | // lets take only the first alarm |
| 917 | 917 | break; |
| 918 | 918 | } |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | $alarmData['offset'] = false; |
| 950 | 950 | } |
| 951 | 951 | |
| 952 | - $valarm = Horde_Icalendar::newComponent('VALARM',$vevent); |
|
| 952 | + $valarm = Horde_Icalendar::newComponent('VALARM', $vevent); |
|
| 953 | 953 | if ($alarmData['offset'] !== false) |
| 954 | 954 | { |
| 955 | 955 | $valarm->setAttribute('TRIGGER', -$alarmData['offset'], |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | else |
| 959 | 959 | { |
| 960 | 960 | $params = array('VALUE' => 'DATE-TIME'); |
| 961 | - $value = self::getDateTime($alarmData['time'],$tzid,$params); |
|
| 961 | + $value = self::getDateTime($alarmData['time'], $tzid, $params); |
|
| 962 | 962 | $valarm->setAttribute('TRIGGER', $value, $params); |
| 963 | 963 | } |
| 964 | 964 | if (!empty($alarmData['uid'])) |
@@ -969,7 +969,7 @@ discard block |
||
| 969 | 969 | // set evtl. existing attributes set by iCal clients not used by EGroupware |
| 970 | 970 | if (isset($alarmData['attrs'])) |
| 971 | 971 | { |
| 972 | - foreach($alarmData['attrs'] as $attr => $data) |
|
| 972 | + foreach ($alarmData['attrs'] as $attr => $data) |
|
| 973 | 973 | { |
| 974 | 974 | $valarm->setAttribute($attr, $data['value'], $data['params']); |
| 975 | 975 | } |
@@ -977,11 +977,11 @@ discard block |
||
| 977 | 977 | // set default ACTION and DESCRIPTION, if not set by a client |
| 978 | 978 | if (!isset($alarmData['attrs']) || !isset($alarmData['attrs']['ACTION'])) |
| 979 | 979 | { |
| 980 | - $valarm->setAttribute('ACTION','DISPLAY'); |
|
| 980 | + $valarm->setAttribute('ACTION', 'DISPLAY'); |
|
| 981 | 981 | } |
| 982 | 982 | if (!isset($alarmData['attrs']) || !isset($alarmData['attrs']['DESCRIPTION'])) |
| 983 | 983 | { |
| 984 | - $valarm->setAttribute('DESCRIPTION',$event['title'] ? $event['title'] : $description); |
|
| 984 | + $valarm->setAttribute('DESCRIPTION', $event['title'] ? $event['title'] : $description); |
|
| 985 | 985 | } |
| 986 | 986 | $vevent->addComponent($valarm); |
| 987 | 987 | } |
@@ -989,15 +989,15 @@ discard block |
||
| 989 | 989 | |
| 990 | 990 | foreach ($attributes as $key => $value) |
| 991 | 991 | { |
| 992 | - foreach (is_array($value) && $parameters[$key]['VALUE']!='DATE' ? $value : array($value) as $valueID => $valueData) |
|
| 992 | + foreach (is_array($value) && $parameters[$key]['VALUE'] != 'DATE' ? $value : array($value) as $valueID => $valueData) |
|
| 993 | 993 | { |
| 994 | - $valueData = Api\Translation::convert($valueData,Api\Translation::charset(),$charset); |
|
| 995 | - $paramData = (array) Api\Translation::convert(is_array($value) ? |
|
| 994 | + $valueData = Api\Translation::convert($valueData, Api\Translation::charset(), $charset); |
|
| 995 | + $paramData = (array)Api\Translation::convert(is_array($value) ? |
|
| 996 | 996 | $parameters[$key][$valueID] : $parameters[$key], |
| 997 | - Api\Translation::charset(),$charset); |
|
| 998 | - $valuesData = (array) Api\Translation::convert($values[$key], |
|
| 999 | - Api\Translation::charset(),$charset); |
|
| 1000 | - $content = $valueData . implode(';', $valuesData); |
|
| 997 | + Api\Translation::charset(), $charset); |
|
| 998 | + $valuesData = (array)Api\Translation::convert($values[$key], |
|
| 999 | + Api\Translation::charset(), $charset); |
|
| 1000 | + $content = $valueData.implode(';', $valuesData); |
|
| 1001 | 1001 | |
| 1002 | 1002 | if ($version == '1.0' && (preg_match('/[^\x20-\x7F]/', $content) || |
| 1003 | 1003 | ($paramData['CN'] && preg_match('/[^\x20-\x7F]/', $paramData['CN'])))) |
@@ -1047,10 +1047,10 @@ discard block |
||
| 1047 | 1047 | $retval = $events_exported ? $vcal->exportvCalendar() : false; |
| 1048 | 1048 | if ($this->log) |
| 1049 | 1049 | { |
| 1050 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 1051 | - "() '$this->productManufacturer','$this->productName'\n",3,$this->logfile); |
|
| 1052 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 1053 | - "()\n".array2string($retval)."\n",3,$this->logfile); |
|
| 1050 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 1051 | + "() '$this->productManufacturer','$this->productName'\n", 3, $this->logfile); |
|
| 1052 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 1053 | + "()\n".array2string($retval)."\n", 3, $this->logfile); |
|
| 1054 | 1054 | } |
| 1055 | 1055 | return $retval; |
| 1056 | 1056 | } |
@@ -1063,15 +1063,15 @@ discard block |
||
| 1063 | 1063 | * @param array &$params=null parameter array to set TZID |
| 1064 | 1064 | * @return mixed attribute value to set: integer timestamp if $tzid == 'UTC' otherwise Ymd\THis string IN $tzid |
| 1065 | 1065 | */ |
| 1066 | - static function getDateTime($time,$tzid,array &$params=null) |
|
| 1066 | + static function getDateTime($time, $tzid, array &$params = null) |
|
| 1067 | 1067 | { |
| 1068 | 1068 | if (empty($tzid) || $tzid == 'UTC') |
| 1069 | 1069 | { |
| 1070 | - return Api\DateTime::to($time,'ts'); |
|
| 1070 | + return Api\DateTime::to($time, 'ts'); |
|
| 1071 | 1071 | } |
| 1072 | - if (!is_a($time,'DateTime')) |
|
| 1072 | + if (!is_a($time, 'DateTime')) |
|
| 1073 | 1073 | { |
| 1074 | - $time = new Api\DateTime($time,Api\DateTime::$server_timezone); |
|
| 1074 | + $time = new Api\DateTime($time, Api\DateTime::$server_timezone); |
|
| 1075 | 1075 | } |
| 1076 | 1076 | if (!isset(self::$tz_cache[$tzid])) |
| 1077 | 1077 | { |
@@ -1106,11 +1106,11 @@ discard block |
||
| 1106 | 1106 | * @param string $caldav_name=null name from CalDAV client or null (to use default) |
| 1107 | 1107 | * @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" |
| 1108 | 1108 | */ |
| 1109 | - function importVCal($_vcalData, $cal_id=-1, $etag=null, $merge=false, $recur_date=0, $principalURL='', $user=null, $charset=null, $caldav_name=null,$skip_notification=false) |
|
| 1109 | + function importVCal($_vcalData, $cal_id = -1, $etag = null, $merge = false, $recur_date = 0, $principalURL = '', $user = null, $charset = null, $caldav_name = null, $skip_notification = false) |
|
| 1110 | 1110 | { |
| 1111 | 1111 | //error_log(__METHOD__."(, $cal_id, $etag, $merge, $recur_date, $principalURL, $user, $charset, $caldav_name)"); |
| 1112 | 1112 | $this->events_imported = 0; |
| 1113 | - $replace = $delete_exceptions= false; |
|
| 1113 | + $replace = $delete_exceptions = false; |
|
| 1114 | 1114 | |
| 1115 | 1115 | if (!is_array($this->supportedFields)) $this->setSupportedFields(); |
| 1116 | 1116 | |
@@ -1118,7 +1118,7 @@ discard block |
||
| 1118 | 1118 | { |
| 1119 | 1119 | return false; |
| 1120 | 1120 | } |
| 1121 | - if (!is_array($events)) $cal_id = -1; // just to be sure, as iterator does NOT allow array access (eg. $events[0]) |
|
| 1121 | + if (!is_array($events)) $cal_id = -1; // just to be sure, as iterator does NOT allow array access (eg. $events[0]) |
|
| 1122 | 1122 | |
| 1123 | 1123 | if ($cal_id > 0) |
| 1124 | 1124 | { |
@@ -1126,7 +1126,7 @@ discard block |
||
| 1126 | 1126 | { |
| 1127 | 1127 | $replace = $recur_date == 0; |
| 1128 | 1128 | $events[0]['id'] = $cal_id; |
| 1129 | - if (!is_null($etag)) $events[0]['etag'] = (int) $etag; |
|
| 1129 | + if (!is_null($etag)) $events[0]['etag'] = (int)$etag; |
|
| 1130 | 1130 | if ($recur_date) $events[0]['recurrence'] = $recur_date; |
| 1131 | 1131 | } |
| 1132 | 1132 | elseif (($foundEvent = $this->find_event(array('id' => $cal_id), 'exact')) && |
@@ -1178,7 +1178,7 @@ discard block |
||
| 1178 | 1178 | { |
| 1179 | 1179 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1180 | 1180 | ."($cal_id, $etag, $recur_date, $principalURL, $user, $charset)\n" |
| 1181 | - . array2string($event)."\n",3,$this->logfile); |
|
| 1181 | + . array2string($event)."\n", 3, $this->logfile); |
|
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | 1184 | $updated_id = false; |
@@ -1201,14 +1201,14 @@ discard block |
||
| 1201 | 1201 | { |
| 1202 | 1202 | if ($delete_exceptions) |
| 1203 | 1203 | { |
| 1204 | - $this->delete($id,0,false,$skip_notification); |
|
| 1204 | + $this->delete($id, 0, false, $skip_notification); |
|
| 1205 | 1205 | } |
| 1206 | 1206 | else |
| 1207 | 1207 | { |
| 1208 | 1208 | if (!($exception = $this->read($id))) continue; |
| 1209 | 1209 | $exception['uid'] = Api\CalDAV::generate_uid('calendar', $id); |
| 1210 | 1210 | $exception['reference'] = $exception['recurrence'] = 0; |
| 1211 | - $this->update($exception, true,true,false,true,$msg,$skip_notification); |
|
| 1211 | + $this->update($exception, true, true, false, true, $msg, $skip_notification); |
|
| 1212 | 1212 | } |
| 1213 | 1213 | } |
| 1214 | 1214 | } |
@@ -1225,7 +1225,7 @@ discard block |
||
| 1225 | 1225 | { |
| 1226 | 1226 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1227 | 1227 | . "(UPDATE Event)\n" |
| 1228 | - . array2string($event_info['stored_event'])."\n",3,$this->logfile); |
|
| 1228 | + . array2string($event_info['stored_event'])."\n", 3, $this->logfile); |
|
| 1229 | 1229 | } |
| 1230 | 1230 | if (empty($event['uid'])) |
| 1231 | 1231 | { |
@@ -1247,7 +1247,7 @@ discard block |
||
| 1247 | 1247 | if ($this->log) |
| 1248 | 1248 | { |
| 1249 | 1249 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1250 | - "() Restore status for $uid\n",3,$this->logfile); |
|
| 1250 | + "() Restore status for $uid\n", 3, $this->logfile); |
|
| 1251 | 1251 | } |
| 1252 | 1252 | $event['participants'][$uid] = $event_info['stored_event']['participants'][$uid]; |
| 1253 | 1253 | } |
@@ -1271,7 +1271,7 @@ discard block |
||
| 1271 | 1271 | if ($this->log) |
| 1272 | 1272 | { |
| 1273 | 1273 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1274 | - "()[MERGE]\n",3,$this->logfile); |
|
| 1274 | + "()[MERGE]\n", 3, $this->logfile); |
|
| 1275 | 1275 | } |
| 1276 | 1276 | // overwrite with server data for merge |
| 1277 | 1277 | foreach ($event_info['stored_event'] as $key => $value) |
@@ -1301,7 +1301,7 @@ discard block |
||
| 1301 | 1301 | else |
| 1302 | 1302 | { |
| 1303 | 1303 | // no merge |
| 1304 | - if(!isset($this->supportedFields['category']) || !isset($event['category'])) |
|
| 1304 | + if (!isset($this->supportedFields['category']) || !isset($event['category'])) |
|
| 1305 | 1305 | { |
| 1306 | 1306 | $event['category'] = $event_info['stored_event']['category']; |
| 1307 | 1307 | } |
@@ -1313,7 +1313,7 @@ discard block |
||
| 1313 | 1313 | if ($this->log) |
| 1314 | 1314 | { |
| 1315 | 1315 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1316 | - "() No participants\n",3,$this->logfile); |
|
| 1316 | + "() No participants\n", 3, $this->logfile); |
|
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | 1319 | // If this is an updated meeting, and the client doesn't support |
@@ -1332,7 +1332,7 @@ discard block |
||
| 1332 | 1332 | if ($this->log) |
| 1333 | 1333 | { |
| 1334 | 1334 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1335 | - "() Restore resource $uid to status $status\n",3,$this->logfile); |
|
| 1335 | + "() Restore resource $uid to status $status\n", 3, $this->logfile); |
|
| 1336 | 1336 | } |
| 1337 | 1337 | // Add it back in |
| 1338 | 1338 | $event['participants'][$uid] = $status; |
@@ -1420,8 +1420,7 @@ discard block |
||
| 1420 | 1420 | } |
| 1421 | 1421 | // for resources check which new-status to give (eg. with direct booking permision 'A' instead 'U') |
| 1422 | 1422 | $event['participants'][$user] = calendar_so::combine_status( |
| 1423 | - $user < 0 || !isset($this->resources[$user[0]]['new_status']) ? 'U' : |
|
| 1424 | - ExecMethod($this->resources[$user[0]]['new_status'], substr($user, 1))); |
|
| 1423 | + $user < 0 || !isset($this->resources[$user[0]]['new_status']) ? 'U' : ExecMethod($this->resources[$user[0]]['new_status'], substr($user, 1))); |
|
| 1425 | 1424 | } |
| 1426 | 1425 | } |
| 1427 | 1426 | // check if an owner is set and the current user has add rights |
@@ -1486,9 +1485,9 @@ discard block |
||
| 1486 | 1485 | |
| 1487 | 1486 | if ($this->log) |
| 1488 | 1487 | { |
| 1489 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . '(' |
|
| 1490 | - . $event_info['type'] . ")\n" |
|
| 1491 | - . array2string($event)."\n",3,$this->logfile); |
|
| 1488 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'(' |
|
| 1489 | + . $event_info['type'].")\n" |
|
| 1490 | + . array2string($event)."\n", 3, $this->logfile); |
|
| 1492 | 1491 | } |
| 1493 | 1492 | |
| 1494 | 1493 | // Android (any maybe others) delete recurrences by setting STATUS: CANCELLED |
@@ -1496,10 +1495,10 @@ discard block |
||
| 1496 | 1495 | if (in_array($event_info['type'], array('SERIES-EXCEPTION', 'SERIES-EXCEPTION-PROPAGATE', 'SERIES-PSEUDO-EXCEPTION')) && |
| 1497 | 1496 | $event['status'] == 'CANCELLED') |
| 1498 | 1497 | { |
| 1499 | - if (!$this->delete($event['id'] ? $event['id'] : $cal_id, $event['recurrence'],false,$skip_notification)) |
|
| 1498 | + if (!$this->delete($event['id'] ? $event['id'] : $cal_id, $event['recurrence'], false, $skip_notification)) |
|
| 1500 | 1499 | { |
| 1501 | 1500 | // delete fails (because no rights), reject recurrence |
| 1502 | - $this->set_status($event['id'] ? $event['id'] : $cal_id, $this->user, 'R', $event['recurrence'],false,true,$skip_notification); |
|
| 1501 | + $this->set_status($event['id'] ? $event['id'] : $cal_id, $this->user, 'R', $event['recurrence'], false, true, $skip_notification); |
|
| 1503 | 1502 | } |
| 1504 | 1503 | continue; |
| 1505 | 1504 | } |
@@ -1511,7 +1510,7 @@ discard block |
||
| 1511 | 1510 | if ($this->log) |
| 1512 | 1511 | { |
| 1513 | 1512 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1514 | - "(): event SINGLE\n",3,$this->logfile); |
|
| 1513 | + "(): event SINGLE\n", 3, $this->logfile); |
|
| 1515 | 1514 | } |
| 1516 | 1515 | |
| 1517 | 1516 | // update the event |
@@ -1521,7 +1520,7 @@ discard block |
||
| 1521 | 1520 | $event['reference'] = 0; |
| 1522 | 1521 | $event_to_store = $event; // prevent $event from being changed by the update method |
| 1523 | 1522 | $this->server2usertime($event_to_store); |
| 1524 | - $updated_id = $this->update($event_to_store, true,true,false,true,$msg,$skip_notification); |
|
| 1523 | + $updated_id = $this->update($event_to_store, true, true, false, true, $msg, $skip_notification); |
|
| 1525 | 1524 | unset($event_to_store); |
| 1526 | 1525 | } |
| 1527 | 1526 | break; |
@@ -1530,7 +1529,7 @@ discard block |
||
| 1530 | 1529 | if ($this->log) |
| 1531 | 1530 | { |
| 1532 | 1531 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1533 | - "(): event SERIES-MASTER\n",3,$this->logfile); |
|
| 1532 | + "(): event SERIES-MASTER\n", 3, $this->logfile); |
|
| 1534 | 1533 | } |
| 1535 | 1534 | |
| 1536 | 1535 | // remove all known pseudo exceptions and update the event |
@@ -1540,8 +1539,8 @@ discard block |
||
| 1540 | 1539 | $days = $this->so->get_recurrence_exceptions($event_info['stored_event'], $this->tzid, 0, 0, $filter); |
| 1541 | 1540 | if ($this->log) |
| 1542 | 1541 | { |
| 1543 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."(EXCEPTIONS MAPPING):\n" . |
|
| 1544 | - array2string($days)."\n",3,$this->logfile); |
|
| 1542 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."(EXCEPTIONS MAPPING):\n". |
|
| 1543 | + array2string($days)."\n", 3, $this->logfile); |
|
| 1545 | 1544 | } |
| 1546 | 1545 | if (is_array($days)) |
| 1547 | 1546 | { |
@@ -1559,7 +1558,7 @@ discard block |
||
| 1559 | 1558 | |
| 1560 | 1559 | $event_to_store = $event; // prevent $event from being changed by the update method |
| 1561 | 1560 | $this->server2usertime($event_to_store); |
| 1562 | - $updated_id = $this->update($event_to_store, true,true,false,true,$msg,$skip_notification); |
|
| 1561 | + $updated_id = $this->update($event_to_store, true, true, false, true, $msg, $skip_notification); |
|
| 1563 | 1562 | unset($event_to_store); |
| 1564 | 1563 | } |
| 1565 | 1564 | break; |
@@ -1569,7 +1568,7 @@ discard block |
||
| 1569 | 1568 | if ($this->log) |
| 1570 | 1569 | { |
| 1571 | 1570 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1572 | - "(): event SERIES-EXCEPTION\n",3,$this->logfile); |
|
| 1571 | + "(): event SERIES-EXCEPTION\n", 3, $this->logfile); |
|
| 1573 | 1572 | } |
| 1574 | 1573 | |
| 1575 | 1574 | // update event |
@@ -1625,13 +1624,13 @@ discard block |
||
| 1625 | 1624 | $event['owner'] = $event_info['master_event']['owner']; |
| 1626 | 1625 | $event_to_store = $event_info['master_event']; // prevent the master_event from being changed by the update method |
| 1627 | 1626 | $this->server2usertime($event_to_store); |
| 1628 | - $this->update($event_to_store, true,true,false,true,$msg,$skip_notification); |
|
| 1627 | + $this->update($event_to_store, true, true, false, true, $msg, $skip_notification); |
|
| 1629 | 1628 | unset($event_to_store); |
| 1630 | 1629 | } |
| 1631 | 1630 | |
| 1632 | 1631 | $event_to_store = $event; // prevent $event from being changed by update method |
| 1633 | 1632 | $this->server2usertime($event_to_store); |
| 1634 | - $updated_id = $this->update($event_to_store, true,true,false,true,$msg,$skip_notification); |
|
| 1633 | + $updated_id = $this->update($event_to_store, true, true, false, true, $msg, $skip_notification); |
|
| 1635 | 1634 | unset($event_to_store); |
| 1636 | 1635 | } |
| 1637 | 1636 | break; |
@@ -1640,7 +1639,7 @@ discard block |
||
| 1640 | 1639 | if ($this->log) |
| 1641 | 1640 | { |
| 1642 | 1641 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 1643 | - "(): event SERIES-PSEUDO-EXCEPTION\n",3,$this->logfile); |
|
| 1642 | + "(): event SERIES-PSEUDO-EXCEPTION\n", 3, $this->logfile); |
|
| 1644 | 1643 | } |
| 1645 | 1644 | //Horde::logMessage('importVCAL event SERIES-PSEUDO-EXCEPTION', |
| 1646 | 1645 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -1661,7 +1660,7 @@ discard block |
||
| 1661 | 1660 | // save the series master with the adjusted exceptions |
| 1662 | 1661 | $event_to_store = $event_info['master_event']; // prevent the master_event from being changed by the update method |
| 1663 | 1662 | $this->server2usertime($event_to_store); |
| 1664 | - $updated_id = $this->update($event_to_store, true, true, false, false,$msg,$skip_notification); |
|
| 1663 | + $updated_id = $this->update($event_to_store, true, true, false, false, $msg, $skip_notification); |
|
| 1665 | 1664 | unset($event_to_store); |
| 1666 | 1665 | } |
| 1667 | 1666 | |
@@ -1688,13 +1687,13 @@ discard block |
||
| 1688 | 1687 | if ($event_info['acl_edit']) |
| 1689 | 1688 | { |
| 1690 | 1689 | // update all participants if we have the right to do that |
| 1691 | - $this->update_status($event, $event_info['stored_event'],0,$skip_notification); |
|
| 1690 | + $this->update_status($event, $event_info['stored_event'], 0, $skip_notification); |
|
| 1692 | 1691 | } |
| 1693 | 1692 | elseif (isset($event['participants'][$this->user]) || isset($event_info['stored_event']['participants'][$this->user])) |
| 1694 | 1693 | { |
| 1695 | 1694 | // update the users status only |
| 1696 | 1695 | $this->set_status($event_info['stored_event']['id'], $this->user, |
| 1697 | - ($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), 0, true,true,$skip_notification); |
|
| 1696 | + ($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), 0, true, true, $skip_notification); |
|
| 1698 | 1697 | } |
| 1699 | 1698 | } |
| 1700 | 1699 | break; |
@@ -1706,13 +1705,13 @@ discard block |
||
| 1706 | 1705 | if ($event_info['acl_edit']) |
| 1707 | 1706 | { |
| 1708 | 1707 | // update all participants if we have the right to do that |
| 1709 | - $this->update_status($event, $event_info['stored_event'], $recurrence,$skip_notification); |
|
| 1708 | + $this->update_status($event, $event_info['stored_event'], $recurrence, $skip_notification); |
|
| 1710 | 1709 | } |
| 1711 | 1710 | elseif (isset($event['participants'][$this->user]) || isset($event_info['master_event']['participants'][$this->user])) |
| 1712 | 1711 | { |
| 1713 | 1712 | // update the users status only |
| 1714 | 1713 | $this->set_status($event_info['master_event']['id'], $this->user, |
| 1715 | - ($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), $recurrence, true,true,$skip_notification); |
|
| 1714 | + ($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), $recurrence, true, true, $skip_notification); |
|
| 1716 | 1715 | } |
| 1717 | 1716 | } |
| 1718 | 1717 | break; |
@@ -1729,7 +1728,7 @@ discard block |
||
| 1729 | 1728 | break; |
| 1730 | 1729 | |
| 1731 | 1730 | case 'SERIES-PSEUDO-EXCEPTION': |
| 1732 | - $return_id = is_array($event_info['master_event']) ? $event_info['master_event']['id'] . ':' . $event['recurrence'] : false; |
|
| 1731 | + $return_id = is_array($event_info['master_event']) ? $event_info['master_event']['id'].':'.$event['recurrence'] : false; |
|
| 1733 | 1732 | break; |
| 1734 | 1733 | |
| 1735 | 1734 | case 'SERIES-EXCEPTION-PROPAGATE': |
@@ -1742,7 +1741,7 @@ discard block |
||
| 1742 | 1741 | { |
| 1743 | 1742 | // we did not have sufficient rights to propagate the status only exception to a real one |
| 1744 | 1743 | // we have to keep the SERIES-PSEUDO-EXCEPTION id and keep the event untouched |
| 1745 | - $return_id = $event_info['master_event']['id'] . ':' . $event['recurrence']; |
|
| 1744 | + $return_id = $event_info['master_event']['id'].':'.$event['recurrence']; |
|
| 1746 | 1745 | } |
| 1747 | 1746 | break; |
| 1748 | 1747 | } |
@@ -1756,8 +1755,8 @@ discard block |
||
| 1756 | 1755 | if ($this->log) |
| 1757 | 1756 | { |
| 1758 | 1757 | $event_info['stored_event'] = $this->read($event_info['stored_event']['id']); |
| 1759 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()[$updated_id]\n" . |
|
| 1760 | - array2string($event_info['stored_event'])."\n",3,$this->logfile); |
|
| 1758 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()[$updated_id]\n". |
|
| 1759 | + array2string($event_info['stored_event'])."\n", 3, $this->logfile); |
|
| 1761 | 1760 | } |
| 1762 | 1761 | } |
| 1763 | 1762 | date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); |
@@ -1777,10 +1776,10 @@ discard block |
||
| 1777 | 1776 | { |
| 1778 | 1777 | if ($this->debug) error_log(__METHOD__."(".array2string($event).', old_alarms='.array2string($old_alarms).", $user,)"); |
| 1779 | 1778 | $modified = 0; |
| 1780 | - foreach($event['alarm'] as &$alarm) |
|
| 1779 | + foreach ($event['alarm'] as &$alarm) |
|
| 1781 | 1780 | { |
| 1782 | 1781 | // check if alarm is already stored or from other users |
| 1783 | - foreach($old_alarms as $id => $old_alarm) |
|
| 1782 | + foreach ($old_alarms as $id => $old_alarm) |
|
| 1784 | 1783 | { |
| 1785 | 1784 | // not current users alarm --> ignore |
| 1786 | 1785 | if (!$old_alarm['all'] && $old_alarm['owner'] != $user) |
@@ -1817,7 +1816,7 @@ discard block |
||
| 1817 | 1816 | } |
| 1818 | 1817 | } |
| 1819 | 1818 | // remove all old alarms left from current user |
| 1820 | - foreach($old_alarms as $id => $old_alarm) |
|
| 1819 | + foreach ($old_alarms as $id => $old_alarm) |
|
| 1821 | 1820 | { |
| 1822 | 1821 | // not current users alarm --> ignore |
| 1823 | 1822 | if (!$old_alarm['all'] && $old_alarm['owner'] != $user) |
@@ -1840,7 +1839,7 @@ discard block |
||
| 1840 | 1839 | * @param string $what ='value' |
| 1841 | 1840 | * @return mixed |
| 1842 | 1841 | */ |
| 1843 | - static function _get_attribute($components,$name,$what='value') |
|
| 1842 | + static function _get_attribute($components, $name, $what = 'value') |
|
| 1844 | 1843 | { |
| 1845 | 1844 | foreach ($components as $attribute) |
| 1846 | 1845 | { |
@@ -1875,7 +1874,7 @@ discard block |
||
| 1875 | 1874 | case 'DURATION': |
| 1876 | 1875 | if (isset($vattr['params']['RELATED']) && $vattr['params']['RELATED'] == 'END') |
| 1877 | 1876 | { |
| 1878 | - $alarm['offset'] = $duration -$vattr['value']; |
|
| 1877 | + $alarm['offset'] = $duration - $vattr['value']; |
|
| 1879 | 1878 | } |
| 1880 | 1879 | elseif (isset($vattr['params']['RELATED']) && $vattr['params']['RELATED'] != 'START') |
| 1881 | 1880 | { |
@@ -1891,7 +1890,7 @@ discard block |
||
| 1891 | 1890 | $alarm['time'] = $vattr['value']; |
| 1892 | 1891 | break; |
| 1893 | 1892 | default: |
| 1894 | - error_log('VALARM/TRIGGER: unsupported value type:' . $vtype); |
|
| 1893 | + error_log('VALARM/TRIGGER: unsupported value type:'.$vtype); |
|
| 1895 | 1894 | } |
| 1896 | 1895 | break; |
| 1897 | 1896 | |
@@ -1916,9 +1915,9 @@ discard block |
||
| 1916 | 1915 | return 0; |
| 1917 | 1916 | } |
| 1918 | 1917 | |
| 1919 | - function setSupportedFields($_productManufacturer='', $_productName='') |
|
| 1918 | + function setSupportedFields($_productManufacturer = '', $_productName = '') |
|
| 1920 | 1919 | { |
| 1921 | - $state =& $_SESSION['SyncML.state']; |
|
| 1920 | + $state = & $_SESSION['SyncML.state']; |
|
| 1922 | 1921 | if (isset($state)) |
| 1923 | 1922 | { |
| 1924 | 1923 | $deviceInfo = $state->getClientDeviceInfo(); |
@@ -2215,10 +2214,10 @@ discard block |
||
| 2215 | 2214 | if ($this->log) |
| 2216 | 2215 | { |
| 2217 | 2216 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 2218 | - '(' . $this->productManufacturer . |
|
| 2219 | - ', '. $this->productName .', ' . |
|
| 2220 | - ($this->tzid ? $this->tzid : Api\DateTime::$user_timezone->getName()) . |
|
| 2221 | - ', ' . $this->calendarOwner . ")\n" , 3, $this->logfile); |
|
| 2217 | + '('.$this->productManufacturer. |
|
| 2218 | + ', '.$this->productName.', '. |
|
| 2219 | + ($this->tzid ? $this->tzid : Api\DateTime::$user_timezone->getName()). |
|
| 2220 | + ', '.$this->calendarOwner.")\n", 3, $this->logfile); |
|
| 2222 | 2221 | } |
| 2223 | 2222 | |
| 2224 | 2223 | //Horde::logMessage('setSupportedFields(' . $this->productManufacturer . ', ' |
@@ -2236,12 +2235,12 @@ discard block |
||
| 2236 | 2235 | * utf-8 for new format, iso-8859-1 for old format. |
| 2237 | 2236 | * @return Iterator|array|boolean Iterator if resource given or array of events on success, false on failure |
| 2238 | 2237 | */ |
| 2239 | - function icaltoegw($_vcalData, $principalURL='', $charset=null) |
|
| 2238 | + function icaltoegw($_vcalData, $principalURL = '', $charset = null) |
|
| 2240 | 2239 | { |
| 2241 | 2240 | if ($this->log) |
| 2242 | 2241 | { |
| 2243 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($principalURL, $charset)\n" . |
|
| 2244 | - array2string($_vcalData)."\n",3,$this->logfile); |
|
| 2242 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($principalURL, $charset)\n". |
|
| 2243 | + array2string($_vcalData)."\n", 3, $this->logfile); |
|
| 2245 | 2244 | } |
| 2246 | 2245 | |
| 2247 | 2246 | if (!is_array($this->supportedFields)) $this->setSupportedFields(); |
@@ -2276,14 +2275,14 @@ discard block |
||
| 2276 | 2275 | if ($this->log) |
| 2277 | 2276 | { |
| 2278 | 2277 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
| 2279 | - "(): No vCalendar Container found!\n",3,$this->logfile); |
|
| 2278 | + "(): No vCalendar Container found!\n", 3, $this->logfile); |
|
| 2280 | 2279 | } |
| 2281 | 2280 | date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); |
| 2282 | 2281 | return false; |
| 2283 | 2282 | } |
| 2284 | 2283 | foreach ($vcal->getComponents() as $component) |
| 2285 | 2284 | { |
| 2286 | - if (($event = $this->_ical2egw_callback($component,$this->tzid,$principalURL,$vcal))) |
|
| 2285 | + if (($event = $this->_ical2egw_callback($component, $this->tzid, $principalURL, $vcal))) |
|
| 2287 | 2286 | { |
| 2288 | 2287 | $events[] = $event; |
| 2289 | 2288 | } |
@@ -2328,13 +2327,13 @@ discard block |
||
| 2328 | 2327 | * @param Horde_Icalendar $container =null container to access attributes on container |
| 2329 | 2328 | * @return array|boolean event array or false if $component is no Horde_Icalendar_Vevent |
| 2330 | 2329 | */ |
| 2331 | - function _ical2egw_callback(Horde_Icalendar $component, $tzid, $principalURL='', Horde_Icalendar $container=null) |
|
| 2330 | + function _ical2egw_callback(Horde_Icalendar $component, $tzid, $principalURL = '', Horde_Icalendar $container = null) |
|
| 2332 | 2331 | { |
| 2333 | 2332 | //unset($component->_container); _debug_array($component); |
| 2334 | 2333 | |
| 2335 | 2334 | if ($this->log) |
| 2336 | 2335 | { |
| 2337 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'() '.get_class($component)." found\n",3,$this->logfile); |
|
| 2336 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'() '.get_class($component)." found\n", 3, $this->logfile); |
|
| 2338 | 2337 | } |
| 2339 | 2338 | |
| 2340 | 2339 | // eg. Mozilla holiday calendars contain only a X-WR-TIMEZONE on vCalendar component |
@@ -2389,16 +2388,16 @@ discard block |
||
| 2389 | 2388 | * @param Horde_Icalendar $container =null container to access attributes on container |
| 2390 | 2389 | * @return array|boolean event on success, false on failure |
| 2391 | 2390 | */ |
| 2392 | - function vevent2egw($component, $version, $supportedFields, $principalURL='', $check_component='Horde_Icalendar_Vevent', Horde_Icalendar $container=null) |
|
| 2391 | + function vevent2egw($component, $version, $supportedFields, $principalURL = '', $check_component = 'Horde_Icalendar_Vevent', Horde_Icalendar $container = null) |
|
| 2393 | 2392 | { |
| 2394 | - unset($principalURL); // not longer used, but required in function signature |
|
| 2393 | + unset($principalURL); // not longer used, but required in function signature |
|
| 2395 | 2394 | |
| 2396 | 2395 | if ($check_component && !is_a($component, $check_component)) |
| 2397 | 2396 | { |
| 2398 | 2397 | if ($this->log) |
| 2399 | 2398 | { |
| 2400 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'()' . |
|
| 2401 | - get_class($component)." found\n",3,$this->logfile); |
|
| 2399 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'()'. |
|
| 2400 | + get_class($component)." found\n", 3, $this->logfile); |
|
| 2402 | 2401 | } |
| 2403 | 2402 | return false; |
| 2404 | 2403 | } |
@@ -2414,11 +2413,11 @@ discard block |
||
| 2414 | 2413 | |
| 2415 | 2414 | $isDate = false; |
| 2416 | 2415 | $event = array(); |
| 2417 | - $alarms = array(); |
|
| 2418 | - $vcardData = array( |
|
| 2416 | + $alarms = array(); |
|
| 2417 | + $vcardData = array( |
|
| 2419 | 2418 | 'recur_type' => MCAL_RECUR_NONE, |
| 2420 | 2419 | 'recur_exception' => array(), |
| 2421 | - 'priority' => 0, // iCalendar default is 0=undefined, not EGroupware 5=normal |
|
| 2420 | + 'priority' => 0, // iCalendar default is 0=undefined, not EGroupware 5=normal |
|
| 2422 | 2421 | ); |
| 2423 | 2422 | // we need to parse DTSTART, DTEND or DURATION (in that order!) first |
| 2424 | 2423 | foreach (array_merge( |
@@ -2435,7 +2434,7 @@ discard block |
||
| 2435 | 2434 | $isDate = true; |
| 2436 | 2435 | } |
| 2437 | 2436 | $dtstart_ts = is_numeric($attributes['value']) ? $attributes['value'] : $this->date2ts($attributes['value']); |
| 2438 | - $vcardData['start'] = $dtstart_ts; |
|
| 2437 | + $vcardData['start'] = $dtstart_ts; |
|
| 2439 | 2438 | |
| 2440 | 2439 | if ($this->tzid) |
| 2441 | 2440 | { |
@@ -2458,18 +2457,18 @@ discard block |
||
| 2458 | 2457 | } |
| 2459 | 2458 | else |
| 2460 | 2459 | { |
| 2461 | - error_log(__METHOD__ . '() unknown TZID=' |
|
| 2462 | - . $attributes['params']['TZID'] . ', defaulting to timezone "' |
|
| 2463 | - . date_default_timezone_get() . '".'.array2string($tz)); |
|
| 2464 | - $event['tzid'] = date_default_timezone_get(); // default to current timezone |
|
| 2460 | + error_log(__METHOD__.'() unknown TZID=' |
|
| 2461 | + . $attributes['params']['TZID'].', defaulting to timezone "' |
|
| 2462 | + . date_default_timezone_get().'".'.array2string($tz)); |
|
| 2463 | + $event['tzid'] = date_default_timezone_get(); // default to current timezone |
|
| 2465 | 2464 | } |
| 2466 | 2465 | } |
| 2467 | - catch(Exception $e) |
|
| 2466 | + catch (Exception $e) |
|
| 2468 | 2467 | { |
| 2469 | - error_log(__METHOD__ . '() unknown TZID=' |
|
| 2470 | - . $attributes['params']['TZID'] . ', defaulting to timezone "' |
|
| 2471 | - . date_default_timezone_get() . '".'.$e->getMessage()); |
|
| 2472 | - $event['tzid'] = date_default_timezone_get(); // default to current timezone |
|
| 2468 | + error_log(__METHOD__.'() unknown TZID=' |
|
| 2469 | + . $attributes['params']['TZID'].', defaulting to timezone "' |
|
| 2470 | + . date_default_timezone_get().'".'.$e->getMessage()); |
|
| 2471 | + $event['tzid'] = date_default_timezone_get(); // default to current timezone |
|
| 2473 | 2472 | } |
| 2474 | 2473 | } |
| 2475 | 2474 | else |
@@ -2484,11 +2483,11 @@ discard block |
||
| 2484 | 2483 | |
| 2485 | 2484 | case 'DTEND': |
| 2486 | 2485 | $dtend_ts = is_numeric($attributes['value']) ? $attributes['value'] : $this->date2ts($attributes['value']); |
| 2487 | - if (date('H:i:s',$dtend_ts) == '00:00:00') |
|
| 2486 | + if (date('H:i:s', $dtend_ts) == '00:00:00') |
|
| 2488 | 2487 | { |
| 2489 | 2488 | $dtend_ts -= 1; |
| 2490 | 2489 | } |
| 2491 | - $vcardData['end'] = $dtend_ts; |
|
| 2490 | + $vcardData['end'] = $dtend_ts; |
|
| 2492 | 2491 | break; |
| 2493 | 2492 | |
| 2494 | 2493 | case 'DURATION': // clients can use DTSTART+DURATION, instead of DTSTART+DTEND |
@@ -2508,7 +2507,7 @@ discard block |
||
| 2508 | 2507 | if ($this->log) |
| 2509 | 2508 | { |
| 2510 | 2509 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2511 | - . "() DTSTART missing!\n",3,$this->logfile); |
|
| 2510 | + . "() DTSTART missing!\n", 3, $this->logfile); |
|
| 2512 | 2511 | } |
| 2513 | 2512 | return false; // not a valid entry |
| 2514 | 2513 | } |
@@ -2520,7 +2519,7 @@ discard block |
||
| 2520 | 2519 | case 'X-MICROSOFT-CDO-ALLDAYEVENT': |
| 2521 | 2520 | if (isset($supportedFields['whole_day'])) |
| 2522 | 2521 | { |
| 2523 | - $event['whole_day'] = (isset($attributes['value'])?strtoupper($attributes['value'])=='TRUE':true); |
|
| 2522 | + $event['whole_day'] = (isset($attributes['value']) ? strtoupper($attributes['value']) == 'TRUE' : true); |
|
| 2524 | 2523 | } |
| 2525 | 2524 | break; |
| 2526 | 2525 | case 'AALARM': |
@@ -2550,32 +2549,32 @@ discard block |
||
| 2550 | 2549 | $vcardData['recurrence'] = $attributes['value']; |
| 2551 | 2550 | break; |
| 2552 | 2551 | case 'LOCATION': |
| 2553 | - $vcardData['location'] = str_replace("\r\n", "\n", $attributes['value']); |
|
| 2552 | + $vcardData['location'] = str_replace("\r\n", "\n", $attributes['value']); |
|
| 2554 | 2553 | break; |
| 2555 | 2554 | case 'RRULE': |
| 2556 | 2555 | $recurence = $attributes['value']; |
| 2557 | 2556 | $vcardData['recur_interval'] = 1; |
| 2558 | - $type = preg_match('/FREQ=([^;: ]+)/i',$recurence,$matches) ? $matches[1] : $recurence[0]; |
|
| 2557 | + $type = preg_match('/FREQ=([^;: ]+)/i', $recurence, $matches) ? $matches[1] : $recurence[0]; |
|
| 2559 | 2558 | // vCard 2.0 values for all types |
| 2560 | - if (preg_match('/UNTIL=([0-9TZ]+)/',$recurence,$matches)) |
|
| 2559 | + if (preg_match('/UNTIL=([0-9TZ]+)/', $recurence, $matches)) |
|
| 2561 | 2560 | { |
| 2562 | 2561 | $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($matches[1]); |
| 2563 | 2562 | // If it couldn't be parsed, treat it as not set |
| 2564 | - if(is_string($vcardData['recur_enddate'])) |
|
| 2563 | + if (is_string($vcardData['recur_enddate'])) |
|
| 2565 | 2564 | { |
| 2566 | 2565 | unset($vcardData['recur_enddate']); |
| 2567 | 2566 | } |
| 2568 | 2567 | } |
| 2569 | - elseif (preg_match('/COUNT=([0-9]+)/',$recurence,$matches)) |
|
| 2568 | + elseif (preg_match('/COUNT=([0-9]+)/', $recurence, $matches)) |
|
| 2570 | 2569 | { |
| 2571 | 2570 | $vcardData['recur_count'] = (int)$matches[1]; |
| 2572 | 2571 | } |
| 2573 | - if (preg_match('/INTERVAL=([0-9]+)/',$recurence,$matches)) |
|
| 2572 | + if (preg_match('/INTERVAL=([0-9]+)/', $recurence, $matches)) |
|
| 2574 | 2573 | { |
| 2575 | - $vcardData['recur_interval'] = (int) $matches[1] ? (int) $matches[1] : 1; |
|
| 2574 | + $vcardData['recur_interval'] = (int)$matches[1] ? (int)$matches[1] : 1; |
|
| 2576 | 2575 | } |
| 2577 | 2576 | $vcardData['recur_data'] = 0; |
| 2578 | - switch($type) |
|
| 2577 | + switch ($type) |
|
| 2579 | 2578 | { |
| 2580 | 2579 | case 'D': // 1.0 |
| 2581 | 2580 | $recurenceMatches = null; |
@@ -2599,20 +2598,20 @@ discard block |
||
| 2599 | 2598 | case 'W': |
| 2600 | 2599 | case 'WEEKLY': |
| 2601 | 2600 | $days = array(); |
| 2602 | - if (preg_match('/W(\d+) *((?i: [AEFHMORSTUW]{2})+)?( +([^ ]*))$/',$recurence, $recurenceMatches)) // 1.0 |
|
| 2601 | + if (preg_match('/W(\d+) *((?i: [AEFHMORSTUW]{2})+)?( +([^ ]*))$/', $recurence, $recurenceMatches)) // 1.0 |
|
| 2603 | 2602 | { |
| 2604 | 2603 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2605 | 2604 | if (empty($recurenceMatches[2])) |
| 2606 | 2605 | { |
| 2607 | - $days[0] = strtoupper(substr(date('D', $vcardData['start']),0,2)); |
|
| 2606 | + $days[0] = strtoupper(substr(date('D', $vcardData['start']), 0, 2)); |
|
| 2608 | 2607 | } |
| 2609 | 2608 | else |
| 2610 | 2609 | { |
| 2611 | - $days = explode(' ',trim($recurenceMatches[2])); |
|
| 2610 | + $days = explode(' ', trim($recurenceMatches[2])); |
|
| 2612 | 2611 | } |
| 2613 | 2612 | |
| 2614 | 2613 | $repeatMatches = null; |
| 2615 | - if (preg_match('/#(\d+)/',$recurenceMatches[4],$repeatMatches)) |
|
| 2614 | + if (preg_match('/#(\d+)/', $recurenceMatches[4], $repeatMatches)) |
|
| 2616 | 2615 | { |
| 2617 | 2616 | if ($repeatMatches[1]) $vcardData['recur_count'] = $repeatMatches[1]; |
| 2618 | 2617 | } |
@@ -2623,21 +2622,21 @@ discard block |
||
| 2623 | 2622 | |
| 2624 | 2623 | $recur_days = $this->recur_days_1_0; |
| 2625 | 2624 | } |
| 2626 | - elseif (preg_match('/BYDAY=([^;: ]+)/',$recurence,$recurenceMatches)) // 2.0 |
|
| 2625 | + elseif (preg_match('/BYDAY=([^;: ]+)/', $recurence, $recurenceMatches)) // 2.0 |
|
| 2627 | 2626 | { |
| 2628 | - $days = explode(',',$recurenceMatches[1]); |
|
| 2627 | + $days = explode(',', $recurenceMatches[1]); |
|
| 2629 | 2628 | $recur_days = $this->recur_days; |
| 2630 | 2629 | } |
| 2631 | 2630 | else // no day given, use the day of dtstart |
| 2632 | 2631 | { |
| 2633 | - $vcardData['recur_data'] |= 1 << (int)date('w',$vcardData['start']); |
|
| 2632 | + $vcardData['recur_data'] |= 1 << (int)date('w', $vcardData['start']); |
|
| 2634 | 2633 | $vcardData['recur_type'] = MCAL_RECUR_WEEKLY; |
| 2635 | 2634 | } |
| 2636 | 2635 | if ($days) |
| 2637 | 2636 | { |
| 2638 | 2637 | foreach ($recur_days as $id => $day) |
| 2639 | 2638 | { |
| 2640 | - if (in_array(strtoupper(substr($day,0,2)),$days)) |
|
| 2639 | + if (in_array(strtoupper(substr($day, 0, 2)), $days)) |
|
| 2641 | 2640 | { |
| 2642 | 2641 | $vcardData['recur_data'] |= $id; |
| 2643 | 2642 | } |
@@ -2653,17 +2652,17 @@ discard block |
||
| 2653 | 2652 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2654 | 2653 | $vcardData['recur_count'] = $recurenceMatches[2]; |
| 2655 | 2654 | } |
| 2656 | - elseif (preg_match('/MD(\d+)(?: [^ ]+)? ([0-9TZ]+)/',$recurence, $recurenceMatches)) |
|
| 2655 | + elseif (preg_match('/MD(\d+)(?: [^ ]+)? ([0-9TZ]+)/', $recurence, $recurenceMatches)) |
|
| 2657 | 2656 | { |
| 2658 | 2657 | $vcardData['recur_type'] = MCAL_RECUR_MONTHLY_MDAY; |
| 2659 | 2658 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2660 | 2659 | $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]); |
| 2661 | 2660 | } |
| 2662 | - elseif (preg_match('/MP(\d+) (.*) (.*) (.*)/',$recurence, $recurenceMatches)) |
|
| 2661 | + elseif (preg_match('/MP(\d+) (.*) (.*) (.*)/', $recurence, $recurenceMatches)) |
|
| 2663 | 2662 | { |
| 2664 | 2663 | $vcardData['recur_type'] = MCAL_RECUR_MONTHLY_WDAY; |
| 2665 | 2664 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2666 | - if (preg_match('/#(\d+)/',$recurenceMatches[4],$recurenceMatches)) |
|
| 2665 | + if (preg_match('/#(\d+)/', $recurenceMatches[4], $recurenceMatches)) |
|
| 2667 | 2666 | { |
| 2668 | 2667 | $vcardData['recur_count'] = $recurenceMatches[1]; |
| 2669 | 2668 | } |
@@ -2680,7 +2679,7 @@ discard block |
||
| 2680 | 2679 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2681 | 2680 | $vcardData['recur_count'] = $recurenceMatches[2]; |
| 2682 | 2681 | } |
| 2683 | - elseif (preg_match('/YM(\d+)(?: [^ ]+)? ([0-9TZ]+)/',$recurence, $recurenceMatches)) |
|
| 2682 | + elseif (preg_match('/YM(\d+)(?: [^ ]+)? ([0-9TZ]+)/', $recurence, $recurenceMatches)) |
|
| 2684 | 2683 | { |
| 2685 | 2684 | $vcardData['recur_interval'] = $recurenceMatches[1]; |
| 2686 | 2685 | $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]); |
@@ -2694,11 +2693,11 @@ discard block |
||
| 2694 | 2693 | } |
| 2695 | 2694 | // handle FREQ=YEARLY;BYDAY= as FREQ=MONTHLY;BYDAY= with 12*INTERVAL |
| 2696 | 2695 | $vcardData['recur_interval'] = $vcardData['recur_interval'] ? |
| 2697 | - 12*$vcardData['recur_interval'] : 12; |
|
| 2696 | + 12 * $vcardData['recur_interval'] : 12; |
|
| 2698 | 2697 | // fall-through |
| 2699 | 2698 | case 'MONTHLY': |
| 2700 | 2699 | // does currently NOT parse BYDAY or BYMONTH, it has to be specified/identical to DTSTART |
| 2701 | - $vcardData['recur_type'] = strpos($recurence,'BYDAY') !== false ? |
|
| 2700 | + $vcardData['recur_type'] = strpos($recurence, 'BYDAY') !== false ? |
|
| 2702 | 2701 | MCAL_RECUR_MONTHLY_WDAY : MCAL_RECUR_MONTHLY_MDAY; |
| 2703 | 2702 | break; |
| 2704 | 2703 | } |
@@ -2754,11 +2753,11 @@ discard block |
||
| 2754 | 2753 | (strpos($this->productName, 'outlook') !== false |
| 2755 | 2754 | || strpos($this->productName, 'pocket pc') !== false)) |
| 2756 | 2755 | { |
| 2757 | - $vcardData['priority'] = (int) $this->priority_funambol2egw[$attributes['value']]; |
|
| 2756 | + $vcardData['priority'] = (int)$this->priority_funambol2egw[$attributes['value']]; |
|
| 2758 | 2757 | } |
| 2759 | 2758 | else |
| 2760 | 2759 | { |
| 2761 | - $vcardData['priority'] = (int) $this->priority_ical2egw[$attributes['value']]; |
|
| 2760 | + $vcardData['priority'] = (int)$this->priority_ical2egw[$attributes['value']]; |
|
| 2762 | 2761 | } |
| 2763 | 2762 | break; |
| 2764 | 2763 | case 'CATEGORIES': |
@@ -2772,10 +2771,10 @@ discard block |
||
| 2772 | 2771 | } |
| 2773 | 2772 | break; |
| 2774 | 2773 | case 'ORGANIZER': |
| 2775 | - $event['organizer'] = $attributes['value']; // no egw field, but needed in AS |
|
| 2776 | - if (strtolower(substr($event['organizer'],0,7)) == 'mailto:') |
|
| 2774 | + $event['organizer'] = $attributes['value']; // no egw field, but needed in AS |
|
| 2775 | + if (strtolower(substr($event['organizer'], 0, 7)) == 'mailto:') |
|
| 2777 | 2776 | { |
| 2778 | - $event['organizer'] = substr($event['organizer'],7); |
|
| 2777 | + $event['organizer'] = substr($event['organizer'], 7); |
|
| 2779 | 2778 | } |
| 2780 | 2779 | if (!empty($attributes['params']['CN'])) |
| 2781 | 2780 | { |
@@ -2812,19 +2811,19 @@ discard block |
||
| 2812 | 2811 | } |
| 2813 | 2812 | // try parsing email and cn from attendee |
| 2814 | 2813 | elseif (preg_match('/mailto:([@.a-z0-9_-]+)|mailto:"?([.a-z0-9_ -]*)"?[ ]*<([@.a-z0-9_-]*)>/i', |
| 2815 | - $attributes['value'],$matches)) |
|
| 2814 | + $attributes['value'], $matches)) |
|
| 2816 | 2815 | { |
| 2817 | 2816 | $email = $matches[1] ? $matches[1] : $matches[3]; |
| 2818 | - $cn = isset($matches[2]) ? $matches[2]: ''; |
|
| 2817 | + $cn = isset($matches[2]) ? $matches[2] : ''; |
|
| 2819 | 2818 | } |
| 2820 | 2819 | elseif (!empty($attributes['value']) && |
| 2821 | 2820 | preg_match('/"?([.a-z0-9_ -]*)"?[ ]*<([@.a-z0-9_-]*)>/i', |
| 2822 | - $attributes['value'],$matches)) |
|
| 2821 | + $attributes['value'], $matches)) |
|
| 2823 | 2822 | { |
| 2824 | 2823 | $cn = $matches[1]; |
| 2825 | 2824 | $email = $matches[2]; |
| 2826 | 2825 | } |
| 2827 | - elseif (strpos($attributes['value'],'@') !== false) |
|
| 2826 | + elseif (strpos($attributes['value'], '@') !== false) |
|
| 2828 | 2827 | { |
| 2829 | 2828 | $email = $attributes['value']; |
| 2830 | 2829 | } |
@@ -2841,7 +2840,7 @@ discard block |
||
| 2841 | 2840 | if ($this->log) |
| 2842 | 2841 | { |
| 2843 | 2842 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2844 | - . "(): Found X-EGROUPWARE-UID: '$uid'\n",3,$this->logfile); |
|
| 2843 | + . "(): Found X-EGROUPWARE-UID: '$uid'\n", 3, $this->logfile); |
|
| 2845 | 2844 | } |
| 2846 | 2845 | } |
| 2847 | 2846 | elseif ($attributes['value'] == 'Unknown') |
@@ -2859,7 +2858,7 @@ discard block |
||
| 2859 | 2858 | if ($this->log) |
| 2860 | 2859 | { |
| 2861 | 2860 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2862 | - . "() Found account: '$uid', '$cn', '$email'\n",3,$this->logfile); |
|
| 2861 | + . "() Found account: '$uid', '$cn', '$email'\n", 3, $this->logfile); |
|
| 2863 | 2862 | } |
| 2864 | 2863 | } |
| 2865 | 2864 | if (!$uid) |
@@ -2876,9 +2875,9 @@ discard block |
||
| 2876 | 2875 | $cn = str_replace(array('\\,', '\\;', '\\:', '\\\\'), |
| 2877 | 2876 | array(',', ';', ':', '\\'), |
| 2878 | 2877 | $attributes['params']['CN']); |
| 2879 | - if ($cn[0] == '"' && substr($cn,-1) == '"') |
|
| 2878 | + if ($cn[0] == '"' && substr($cn, -1) == '"') |
|
| 2880 | 2879 | { |
| 2881 | - $cn = substr($cn,1,-1); |
|
| 2880 | + $cn = substr($cn, 1, -1); |
|
| 2882 | 2881 | } |
| 2883 | 2882 | // not searching for $cn, as match can be not unique or without an email address |
| 2884 | 2883 | // --> notification will fail, better store just as email |
@@ -2887,19 +2886,19 @@ discard block |
||
| 2887 | 2886 | if ($this->log) |
| 2888 | 2887 | { |
| 2889 | 2888 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2890 | - . "() Search participant: '$cn', '$email'\n",3,$this->logfile); |
|
| 2889 | + . "() Search participant: '$cn', '$email'\n", 3, $this->logfile); |
|
| 2891 | 2890 | } |
| 2892 | 2891 | |
| 2893 | 2892 | //elseif (//$attributes['params']['CUTYPE'] == 'GROUP' |
| 2894 | - if (preg_match('/(.*) '. lang('Group') . '/', $cn, $matches)) |
|
| 2893 | + if (preg_match('/(.*) '.lang('Group').'/', $cn, $matches)) |
|
| 2895 | 2894 | { |
| 2896 | 2895 | // we found a group |
| 2897 | 2896 | if ($this->log) |
| 2898 | 2897 | { |
| 2899 | 2898 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2900 | - . "() Found group: '$matches[1]', '$cn', '$email'\n",3,$this->logfile); |
|
| 2899 | + . "() Found group: '$matches[1]', '$cn', '$email'\n", 3, $this->logfile); |
|
| 2901 | 2900 | } |
| 2902 | - if (($uid = $GLOBALS['egw']->accounts->name2id($matches[1], 'account_lid', 'g'))) |
|
| 2901 | + if (($uid = $GLOBALS['egw']->accounts->name2id($matches[1], 'account_lid', 'g'))) |
|
| 2903 | 2902 | { |
| 2904 | 2903 | //Horde::logMessage("vevent2egw: group participant $uid", |
| 2905 | 2904 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -2913,7 +2912,7 @@ discard block |
||
| 2913 | 2912 | //Horde::logMessage("vevent2egw: set status to " . $status, |
| 2914 | 2913 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
| 2915 | 2914 | $vcardData['participants'][$this->user] = |
| 2916 | - calendar_so::combine_status($status,$quantity,$role); |
|
| 2915 | + calendar_so::combine_status($status, $quantity, $role); |
|
| 2917 | 2916 | } |
| 2918 | 2917 | } |
| 2919 | 2918 | $status = 'U'; // keep the group |
@@ -2922,36 +2921,36 @@ discard block |
||
| 2922 | 2921 | } |
| 2923 | 2922 | elseif (empty($searcharray)) |
| 2924 | 2923 | { |
| 2925 | - continue; // participants without email AND CN --> ignore it |
|
| 2924 | + continue; // participants without email AND CN --> ignore it |
|
| 2926 | 2925 | } |
| 2927 | 2926 | elseif ((list($data) = $this->addressbook->search($searcharray, |
| 2928 | - array('id','egw_addressbook.account_id as account_id','n_fn'), |
|
| 2927 | + array('id', 'egw_addressbook.account_id as account_id', 'n_fn'), |
|
| 2929 | 2928 | 'egw_addressbook.account_id IS NOT NULL DESC, n_fn IS NOT NULL DESC', |
| 2930 | - '','',false,'OR'))) |
|
| 2929 | + '', '', false, 'OR'))) |
|
| 2931 | 2930 | { |
| 2932 | 2931 | // found an addressbook entry |
| 2933 | 2932 | $uid = $data['account_id'] ? (int)$data['account_id'] : 'c'.$data['id']; |
| 2934 | 2933 | if ($this->log) |
| 2935 | 2934 | { |
| 2936 | 2935 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2937 | - . "() Found addressbook entry: '$uid', '$cn', '$email'\n",3,$this->logfile); |
|
| 2936 | + . "() Found addressbook entry: '$uid', '$cn', '$email'\n", 3, $this->logfile); |
|
| 2938 | 2937 | } |
| 2939 | 2938 | } |
| 2940 | 2939 | else |
| 2941 | 2940 | { |
| 2942 | 2941 | if (!$email) |
| 2943 | 2942 | { |
| 2944 | - $email = '[email protected]'; // set dummy email to store the CN |
|
| 2943 | + $email = '[email protected]'; // set dummy email to store the CN |
|
| 2945 | 2944 | } |
| 2946 | - $uid = 'e'. ($cn ? $cn . ' <' . $email . '>' : $email); |
|
| 2945 | + $uid = 'e'.($cn ? $cn.' <'.$email.'>' : $email); |
|
| 2947 | 2946 | if ($this->log) |
| 2948 | 2947 | { |
| 2949 | 2948 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2950 | - . "() Not Found, create dummy: '$uid', '$cn', '$email'\n",3,$this->logfile); |
|
| 2949 | + . "() Not Found, create dummy: '$uid', '$cn', '$email'\n", 3, $this->logfile); |
|
| 2951 | 2950 | } |
| 2952 | 2951 | } |
| 2953 | 2952 | } |
| 2954 | - switch($attributes['name']) |
|
| 2953 | + switch ($attributes['name']) |
|
| 2955 | 2954 | { |
| 2956 | 2955 | case 'ATTENDEE': |
| 2957 | 2956 | if (!isset($attributes['params']['ROLE']) && |
@@ -2965,7 +2964,7 @@ discard block |
||
| 2965 | 2964 | // keep role 'CHAIR' from an external organizer, even if he is a regular participant with a different role |
| 2966 | 2965 | // as this is currently the only way to store an external organizer and send him iMip responses |
| 2967 | 2966 | $q = $r = null; |
| 2968 | - if (isset($vcardData['participants'][$uid]) && ($s=$vcardData['participants'][$uid]) && |
|
| 2967 | + if (isset($vcardData['participants'][$uid]) && ($s = $vcardData['participants'][$uid]) && |
|
| 2969 | 2968 | calendar_so::split_status($s, $q, $r) && $r == 'CHAIR') |
| 2970 | 2969 | { |
| 2971 | 2970 | $role = 'CHAIR'; |
@@ -2979,7 +2978,7 @@ discard block |
||
| 2979 | 2978 | if (!$this->calendarOwner && is_numeric($uid) && $role == 'CHAIR') |
| 2980 | 2979 | $component->getAttribute('ORGANIZER'); |
| 2981 | 2980 | } |
| 2982 | - catch(Horde_Icalendar_Exception $e) |
|
| 2981 | + catch (Horde_Icalendar_Exception $e) |
|
| 2983 | 2982 | { |
| 2984 | 2983 | // we can store the ORGANIZER as event owner |
| 2985 | 2984 | $event['owner'] = $uid; |
@@ -3035,7 +3034,7 @@ discard block |
||
| 3035 | 3034 | break; |
| 3036 | 3035 | |
| 3037 | 3036 | case 'ATTACH': |
| 3038 | - if ($attributes['params'] && !empty($attributes['params']['FMTTYPE'])) break; // handeled by managed attachment code |
|
| 3037 | + if ($attributes['params'] && !empty($attributes['params']['FMTTYPE'])) break; // handeled by managed attachment code |
|
| 3039 | 3038 | // fall throught to store external attachment url |
| 3040 | 3039 | default: // X- attribute or other by EGroupware unsupported property |
| 3041 | 3040 | //error_log(__METHOD__."() $attributes[name] = ".array2string($attributes)); |
@@ -3093,7 +3092,7 @@ discard block |
||
| 3093 | 3092 | if ($event['recur_type'] != MCAL_RECUR_NONE) |
| 3094 | 3093 | { |
| 3095 | 3094 | $event['reference'] = 0; |
| 3096 | - foreach (array('recur_interval','recur_enddate','recur_data','recur_exception','recur_count') as $r) |
|
| 3095 | + foreach (array('recur_interval', 'recur_enddate', 'recur_data', 'recur_exception', 'recur_count') as $r) |
|
| 3097 | 3096 | { |
| 3098 | 3097 | if (isset($vcardData[$r])) |
| 3099 | 3098 | { |
@@ -3116,12 +3115,12 @@ discard block |
||
| 3116 | 3115 | // reset recure_enddate to 00:00:00 on the last day |
| 3117 | 3116 | $rriter = calendar_rrule::event2rrule($event, false); |
| 3118 | 3117 | $last = $rriter->normalize_enddate(); |
| 3119 | - if(!is_object($last)) |
|
| 3118 | + if (!is_object($last)) |
|
| 3120 | 3119 | { |
| 3121 | - if($this->log) |
|
| 3120 | + if ($this->log) |
|
| 3122 | 3121 | { |
| 3123 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
| 3124 | - " Unable to determine recurrence end date. \n".array2string($event),3, $this->logfile); |
|
| 3122 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
| 3123 | + " Unable to determine recurrence end date. \n".array2string($event), 3, $this->logfile); |
|
| 3125 | 3124 | } |
| 3126 | 3125 | return false; |
| 3127 | 3126 | } |
@@ -3130,16 +3129,16 @@ discard block |
||
| 3130 | 3129 | $event['recur_enddate'] = Api\DateTime::to($last, 'server'); |
| 3131 | 3130 | } |
| 3132 | 3131 | // translate COUNT into an enddate, as we only store enddates |
| 3133 | - elseif($event['recur_count']) |
|
| 3132 | + elseif ($event['recur_count']) |
|
| 3134 | 3133 | { |
| 3135 | 3134 | $rriter = calendar_rrule::event2rrule($event, false); |
| 3136 | 3135 | $last = $rriter->count2date($event['recur_count']); |
| 3137 | - if(!is_object($last)) |
|
| 3136 | + if (!is_object($last)) |
|
| 3138 | 3137 | { |
| 3139 | - if($this->log) |
|
| 3138 | + if ($this->log) |
|
| 3140 | 3139 | { |
| 3141 | 3140 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__, |
| 3142 | - " Unable to determine recurrence end date. \n".array2string($event),3, $this->logfile); |
|
| 3141 | + " Unable to determine recurrence end date. \n".array2string($event), 3, $this->logfile); |
|
| 3143 | 3142 | } |
| 3144 | 3143 | return false; |
| 3145 | 3144 | } |
@@ -3153,7 +3152,7 @@ discard block |
||
| 3153 | 3152 | if ($this->productManufacturer == 'groupdav' && $container && |
| 3154 | 3153 | ($x_calendarserver_access = $container->getAttribute('X-CALENDARSERVER-ACCESS'))) |
| 3155 | 3154 | { |
| 3156 | - $event['public'] = (int)(strtoupper($x_calendarserver_access) == 'PUBLIC'); |
|
| 3155 | + $event['public'] = (int)(strtoupper($x_calendarserver_access) == 'PUBLIC'); |
|
| 3157 | 3156 | } |
| 3158 | 3157 | //error_log(__METHOD__."() X-CALENDARSERVER-ACCESS=".array2string($x_calendarserver_access).' --> public='.array2string($event['public'])); |
| 3159 | 3158 | } |
@@ -3174,15 +3173,15 @@ discard block |
||
| 3174 | 3173 | |
| 3175 | 3174 | if ($this->log) |
| 3176 | 3175 | { |
| 3177 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
| 3178 | - array2string($event)."\n",3,$this->logfile); |
|
| 3176 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
| 3177 | + array2string($event)."\n", 3, $this->logfile); |
|
| 3179 | 3178 | } |
| 3180 | 3179 | //Horde::logMessage("vevent2egw:\n" . print_r($event, true), |
| 3181 | 3180 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
| 3182 | 3181 | return $event; |
| 3183 | 3182 | } |
| 3184 | 3183 | |
| 3185 | - function search($_vcalData, $contentID=null, $relax=false, $charset=null) |
|
| 3184 | + function search($_vcalData, $contentID = null, $relax = false, $charset = null) |
|
| 3186 | 3185 | { |
| 3187 | 3186 | if (($events = $this->icaltoegw($_vcalData, $charset))) |
| 3188 | 3187 | { |
@@ -3203,8 +3202,8 @@ discard block |
||
| 3203 | 3202 | } |
| 3204 | 3203 | if ($this->log) |
| 3205 | 3204 | { |
| 3206 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."() found:\n" . |
|
| 3207 | - array2string($events)."\n",3,$this->logfile); |
|
| 3205 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."() found:\n". |
|
| 3206 | + array2string($events)."\n", 3, $this->logfile); |
|
| 3208 | 3207 | } |
| 3209 | 3208 | } |
| 3210 | 3209 | return array(); |
@@ -3222,23 +3221,23 @@ discard block |
||
| 3222 | 3221 | * @param array $extra =null extra attributes to add |
| 3223 | 3222 | * X-CALENDARSERVER-MASK-UID can be used to not include an event specified by this uid as busy |
| 3224 | 3223 | */ |
| 3225 | - function freebusy($user,$end=null,$utc=true, $charset='UTF-8', $start=null, $method='PUBLISH', array $extra=null) |
|
| 3224 | + function freebusy($user, $end = null, $utc = true, $charset = 'UTF-8', $start = null, $method = 'PUBLISH', array $extra = null) |
|
| 3226 | 3225 | { |
| 3227 | - if (!$start) $start = time(); // default now |
|
| 3228 | - if (!$end) $end = time() + 100*DAY_s; // default next 100 days |
|
| 3226 | + if (!$start) $start = time(); // default now |
|
| 3227 | + if (!$end) $end = time() + 100 * DAY_s; // default next 100 days |
|
| 3229 | 3228 | |
| 3230 | 3229 | $vcal = new Horde_Icalendar; |
| 3231 | - $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
|
| 3230 | + $vcal->setAttribute('PRODID', '-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
|
| 3232 | 3231 | strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang'])); |
| 3233 | - $vcal->setAttribute('VERSION','2.0'); |
|
| 3234 | - $vcal->setAttribute('METHOD',$method); |
|
| 3232 | + $vcal->setAttribute('VERSION', '2.0'); |
|
| 3233 | + $vcal->setAttribute('METHOD', $method); |
|
| 3235 | 3234 | |
| 3236 | - $vfreebusy = Horde_Icalendar::newComponent('VFREEBUSY',$vcal); |
|
| 3235 | + $vfreebusy = Horde_Icalendar::newComponent('VFREEBUSY', $vcal); |
|
| 3237 | 3236 | |
| 3238 | 3237 | $attributes = array( |
| 3239 | 3238 | 'DTSTAMP' => time(), |
| 3240 | - 'DTSTART' => $this->date2ts($start,true), // true = server-time |
|
| 3241 | - 'DTEND' => $this->date2ts($end,true), // true = server-time |
|
| 3239 | + 'DTSTART' => $this->date2ts($start, true), // true = server-time |
|
| 3240 | + 'DTEND' => $this->date2ts($end, true), // true = server-time |
|
| 3242 | 3241 | ); |
| 3243 | 3242 | if (!$utc) |
| 3244 | 3243 | { |
@@ -3249,9 +3248,9 @@ discard block |
||
| 3249 | 3248 | } |
| 3250 | 3249 | if (is_null($extra)) $extra = array( |
| 3251 | 3250 | 'URL' => $this->freebusy_url($user), |
| 3252 | - 'ORGANIZER' => 'mailto:'.$GLOBALS['egw']->accounts->id2name($user,'account_email'), |
|
| 3251 | + 'ORGANIZER' => 'mailto:'.$GLOBALS['egw']->accounts->id2name($user, 'account_email'), |
|
| 3253 | 3252 | ); |
| 3254 | - foreach($attributes+$extra as $attr => $value) |
|
| 3253 | + foreach ($attributes + $extra as $attr => $value) |
|
| 3255 | 3254 | { |
| 3256 | 3255 | $vfreebusy->setAttribute($attr, $value); |
| 3257 | 3256 | } |
@@ -3274,16 +3273,16 @@ discard block |
||
| 3274 | 3273 | |
| 3275 | 3274 | if ($utc) |
| 3276 | 3275 | { |
| 3277 | - $vfreebusy->setAttribute('FREEBUSY',array(array( |
|
| 3276 | + $vfreebusy->setAttribute('FREEBUSY', array(array( |
|
| 3278 | 3277 | 'start' => $event['start'], |
| 3279 | 3278 | 'end' => $event['end'], |
| 3280 | 3279 | )), array('FBTYPE' => $fbtype)); |
| 3281 | 3280 | } |
| 3282 | 3281 | else |
| 3283 | 3282 | { |
| 3284 | - $vfreebusy->setAttribute('FREEBUSY',array(array( |
|
| 3285 | - 'start' => date('Ymd\THis',$event['start']), |
|
| 3286 | - 'end' => date('Ymd\THis',$event['end']), |
|
| 3283 | + $vfreebusy->setAttribute('FREEBUSY', array(array( |
|
| 3284 | + 'start' => date('Ymd\THis', $event['start']), |
|
| 3285 | + 'end' => date('Ymd\THis', $event['end']), |
|
| 3287 | 3286 | )), array('FBTYPE' => $fbtype)); |
| 3288 | 3287 | } |
| 3289 | 3288 | } |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * class import_csv for calendar |
| 19 | 19 | */ |
| 20 | -class calendar_import_csv extends importexport_basic_import_csv { |
|
| 20 | +class calendar_import_csv extends importexport_basic_import_csv { |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * actions wich could be done to data entries |
| 24 | 24 | */ |
| 25 | - protected static $actions = array( 'none', 'update', 'insert' ); |
|
| 25 | + protected static $actions = array('none', 'update', 'insert'); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * conditions for actions |
@@ -44,16 +44,16 @@ discard block |
||
| 44 | 44 | /** |
| 45 | 45 | * Set up tracker |
| 46 | 46 | */ |
| 47 | - protected function init(importexport_definition &$definition) |
|
| 47 | + protected function init(importexport_definition&$definition) |
|
| 48 | 48 | { |
| 49 | 49 | // fetch the addressbook bo |
| 50 | - $this->bo= new calendar_boupdate(); |
|
| 50 | + $this->bo = new calendar_boupdate(); |
|
| 51 | 51 | |
| 52 | 52 | // Get the tracker for changes |
| 53 | 53 | $this->tracking = new calendar_tracking(); |
| 54 | 54 | |
| 55 | 55 | // Used for participants |
| 56 | - $this->status_map = array_flip(array_map('lang',$this->bo->verbose_status)); |
|
| 56 | + $this->status_map = array_flip(array_map('lang', $this->bo->verbose_status)); |
|
| 57 | 57 | $this->role_map = array_flip($this->bo->roles); |
| 58 | 58 | |
| 59 | 59 | $this->lookups = array( |
@@ -76,15 +76,15 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @return boolean success |
| 78 | 78 | */ |
| 79 | - public function import_record(\importexport_iface_egw_record &$record, &$import_csv) |
|
| 79 | + public function import_record(\importexport_iface_egw_record&$record, &$import_csv) |
|
| 80 | 80 | { |
| 81 | 81 | // set eventOwner |
| 82 | - $options =& $this->definition->plugin_options; |
|
| 82 | + $options = & $this->definition->plugin_options; |
|
| 83 | 83 | $options['owner'] = $options['owner'] ? $options['owner'] : $this->user; |
| 84 | 84 | |
| 85 | 85 | // Set owner, unless it's supposed to come from CSV file |
| 86 | - if($options['owner_from_csv']) { |
|
| 87 | - if(!is_numeric($record['owner'])) { |
|
| 86 | + if ($options['owner_from_csv']) { |
|
| 87 | + if (!is_numeric($record['owner'])) { |
|
| 88 | 88 | $this->errors[$import_csv->get_current_position()] = lang( |
| 89 | 89 | 'Invalid owner ID: %1. Might be a bad field translation. Used %2 instead.', |
| 90 | 90 | $record->owner, |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Handle errors in length or start/end date |
| 102 | - if($record->start > $record->end) |
|
| 102 | + if ($record->start > $record->end) |
|
| 103 | 103 | { |
| 104 | 104 | $record->end = $record->start + $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength'] * 60; |
| 105 | 105 | $this->warnings[$import_csv->get_current_position()] = lang('error: starttime has to be before the endtime !!!'); |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | if ($record->participants && !is_array($record->participants)) { |
| 110 | 110 | // Importing participants in human friendly format: |
| 111 | 111 | // Name (quantity)? (status) Role[, Name (quantity)? (status) Role]+ |
| 112 | - preg_match_all('/(([^(]+?)(?: \(([\d]+)\))? \(([^,)]+)\)(?: ([^ ,]+))?)(?:, )?/',$record->participants,$participants); |
|
| 112 | + preg_match_all('/(([^(]+?)(?: \(([\d]+)\))? \(([^,)]+)\)(?: ([^ ,]+))?)(?:, )?/', $record->participants, $participants); |
|
| 113 | 113 | $p_participants = array(); |
| 114 | 114 | $missing = array(); |
| 115 | 115 | list($lines, $p, $names, $quantity, $status, $role) = $participants; |
| 116 | - foreach($names as $key => $name) { |
|
| 116 | + foreach ($names as $key => $name) { |
|
| 117 | 117 | //error_log("Name: $name Quantity: {$quantity[$key]} Status: {$status[$key]} Role: {$role[$key]}"); |
| 118 | 118 | |
| 119 | 119 | // Search for direct account name, then user in accounts first |
@@ -121,26 +121,26 @@ discard block |
||
| 121 | 121 | $id = importexport_helper_functions::account_name2id($name); |
| 122 | 122 | |
| 123 | 123 | // If not found, or not an exact match to a user (account_name2id is pretty generous) |
| 124 | - if(!$id || $names[$key] !== $this->bo->participant_name($id)) { |
|
| 125 | - $contacts = ExecMethod2('addressbook.addressbook_bo.search', $search,array('contact_id','account_id'),'org_name,n_family,n_given,cat_id,contact_email','','%',false,'OR',array(0,1)); |
|
| 126 | - if($contacts) $id = $contacts[0]['account_id'] ? $contacts[0]['account_id'] : 'c'.$contacts[0]['contact_id']; |
|
| 124 | + if (!$id || $names[$key] !== $this->bo->participant_name($id)) { |
|
| 125 | + $contacts = ExecMethod2('addressbook.addressbook_bo.search', $search, array('contact_id', 'account_id'), 'org_name,n_family,n_given,cat_id,contact_email', '', '%', false, 'OR', array(0, 1)); |
|
| 126 | + if ($contacts) $id = $contacts[0]['account_id'] ? $contacts[0]['account_id'] : 'c'.$contacts[0]['contact_id']; |
|
| 127 | 127 | } |
| 128 | - if(!$id) |
|
| 128 | + if (!$id) |
|
| 129 | 129 | { |
| 130 | 130 | // Use calendar's registered resources to find participant |
| 131 | - foreach($this->bo->resources as $resource) |
|
| 131 | + foreach ($this->bo->resources as $resource) |
|
| 132 | 132 | { |
| 133 | 133 | // Can't search for email |
| 134 | - if($resource['app'] == 'email') continue; |
|
| 134 | + if ($resource['app'] == 'email') continue; |
|
| 135 | 135 | // Special resource search, since it does special stuff in link_query |
| 136 | - if($resource['app'] == 'resources') |
|
| 136 | + if ($resource['app'] == 'resources') |
|
| 137 | 137 | { |
| 138 | - if(!$this->resource_so) |
|
| 138 | + if (!$this->resource_so) |
|
| 139 | 139 | { |
| 140 | 140 | $this->resource_so = new resources_so(); |
| 141 | 141 | } |
| 142 | - $result = $this->resource_so->search($search,'res_id'); |
|
| 143 | - if(count($result) >= 1) { |
|
| 142 | + $result = $this->resource_so->search($search, 'res_id'); |
|
| 143 | + if (count($result) >= 1) { |
|
| 144 | 144 | $id = $resource['type'].$result[0]['res_id']; |
| 145 | 145 | break; |
| 146 | 146 | } |
@@ -150,15 +150,15 @@ discard block |
||
| 150 | 150 | // Search app via link query |
| 151 | 151 | $result = Link::query($resource['app'], $search, $options); |
| 152 | 152 | |
| 153 | - if($result) |
|
| 153 | + if ($result) |
|
| 154 | 154 | { |
| 155 | - $id = $resource['type'] . key($result); |
|
| 155 | + $id = $resource['type'].key($result); |
|
| 156 | 156 | break; |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | - if($id) { |
|
| 161 | + if ($id) { |
|
| 162 | 162 | $p_participants[$id] = calendar_so::combine_status( |
| 163 | 163 | $this->status_map[lang($status[$key])] ? $this->status_map[lang($status[$key])] : $status[$key][0], |
| 164 | 164 | $quantity[$key] ? $quantity[$key] : 1, |
@@ -169,47 +169,47 @@ discard block |
||
| 169 | 169 | { |
| 170 | 170 | $missing[] = $name; |
| 171 | 171 | } |
| 172 | - if(count($missing) > 0) |
|
| 172 | + if (count($missing) > 0) |
|
| 173 | 173 | { |
| 174 | - $this->warnings[$import_csv->get_current_position()] = $record->title . ' ' . lang('participants') . ': ' . |
|
| 175 | - lang('Contact not found!') . '<br />'.implode(", ",$missing); |
|
| 174 | + $this->warnings[$import_csv->get_current_position()] = $record->title.' '.lang('participants').': '. |
|
| 175 | + lang('Contact not found!').'<br />'.implode(", ", $missing); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | $record->participants = $p_participants; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if($record->recurrence) |
|
| 181 | + if ($record->recurrence) |
|
| 182 | 182 | { |
| 183 | - list($record->recur_type, $record->recur_interval) = explode('/',$record->recurrence,2); |
|
| 183 | + list($record->recur_type, $record->recur_interval) = explode('/', $record->recurrence, 2); |
|
| 184 | 184 | $record->recur_interval = trim($record->recur_interval); |
| 185 | - $record->recur_type = array_search(strtolower(trim($record->recur_type)), array_map('strtolower',$lookups['recurrence'])); |
|
| 185 | + $record->recur_type = array_search(strtolower(trim($record->recur_type)), array_map('strtolower', $lookups['recurrence'])); |
|
| 186 | 186 | unset($record->recurrence); |
| 187 | 187 | } |
| 188 | 188 | $record->tzid = calendar_timezones::id2tz($record->tz_id); |
| 189 | 189 | |
| 190 | - if ( $options['conditions'] ) { |
|
| 191 | - foreach ( $options['conditions'] as $condition ) { |
|
| 190 | + if ($options['conditions']) { |
|
| 191 | + foreach ($options['conditions'] as $condition) { |
|
| 192 | 192 | $records = array(); |
| 193 | - switch ( $condition['type'] ) { |
|
| 193 | + switch ($condition['type']) { |
|
| 194 | 194 | // exists |
| 195 | 195 | case 'exists' : |
| 196 | 196 | // Check for that record |
| 197 | 197 | $result = $this->exists($record, $condition, $records); |
| 198 | 198 | |
| 199 | - if ( is_array( $records ) && count( $records ) >= 1) { |
|
| 199 | + if (is_array($records) && count($records) >= 1) { |
|
| 200 | 200 | // apply action to all records matching this exists condition |
| 201 | 201 | $action = $condition['true']; |
| 202 | - foreach ( (array)$records as $event ) { |
|
| 202 | + foreach ((array)$records as $event) { |
|
| 203 | 203 | $record->id = $event['id']; |
| 204 | - if ( $this->definition->plugin_options['update_cats'] == 'add' ) { |
|
| 205 | - if ( !is_array( $record->category ) ) $record->category = explode( ',', $record->category ); |
|
| 206 | - $record->category = implode( ',', array_unique( array_merge( $record->category, $event['category'] ) ) ); |
|
| 204 | + if ($this->definition->plugin_options['update_cats'] == 'add') { |
|
| 205 | + if (!is_array($record->category)) $record->category = explode(',', $record->category); |
|
| 206 | + $record->category = implode(',', array_unique(array_merge($record->category, $event['category']))); |
|
| 207 | 207 | } |
| 208 | - $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
|
| 208 | + $success = $this->action($action['action'], $record, $import_csv->get_current_position()); |
|
| 209 | 209 | } |
| 210 | 210 | } else { |
| 211 | 211 | $action = $condition['false']; |
| 212 | - $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
|
| 212 | + $success = ($this->action($action['action'], $record, $import_csv->get_current_position())); |
|
| 213 | 213 | } |
| 214 | 214 | break; |
| 215 | 215 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | } else { |
| 224 | 224 | // unconditional insert |
| 225 | - $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
|
| 225 | + $success = $this->action('insert', $record, $import_csv->get_current_position()); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | return $success; |
@@ -237,14 +237,14 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @return boolean |
| 239 | 239 | */ |
| 240 | - protected function exists(importexport_iface_egw_record &$record, Array &$condition, &$records = array()) |
|
| 240 | + protected function exists(importexport_iface_egw_record&$record, Array &$condition, &$records = array()) |
|
| 241 | 241 | { |
| 242 | - if($record->__get($condition['string']) && $condition['string'] == 'id') { |
|
| 242 | + if ($record->__get($condition['string']) && $condition['string'] == 'id') { |
|
| 243 | 243 | $event = $this->bo->read($record->__get($condition['string'])); |
| 244 | 244 | $records = array($event); |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - if ( is_array( $records ) && count( $records ) >= 1) { |
|
| 247 | + if (is_array($records) && count($records) >= 1) { |
|
| 248 | 248 | return true; |
| 249 | 249 | } |
| 250 | 250 | return false; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @param array $_data record data for the action |
| 258 | 258 | * @return bool success or not |
| 259 | 259 | */ |
| 260 | - protected function action ( $_action, importexport_iface_egw_record &$record, $record_num = 0 ) |
|
| 260 | + protected function action($_action, importexport_iface_egw_record&$record, $record_num = 0) |
|
| 261 | 261 | { |
| 262 | 262 | $_data = $record->get_record_array(); |
| 263 | 263 | switch ($_action) { |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $old = $this->bo->read($_data['id']); |
| 269 | 269 | |
| 270 | 270 | // Don't change a user account into a record |
| 271 | - if(!$this->definition->plugin_options['change_owner']) { |
|
| 271 | + if (!$this->definition->plugin_options['change_owner']) { |
|
| 272 | 272 | // Don't change owner of an existing record |
| 273 | 273 | unset($_data['owner']); |
| 274 | 274 | } |
@@ -276,29 +276,29 @@ discard block |
||
| 276 | 276 | // Merge to deal with fields not in import record |
| 277 | 277 | $_data = array_merge($old, $_data); |
| 278 | 278 | $changed = $this->tracking->changed_fields($_data, $old); |
| 279 | - if(count($changed) == 0) { |
|
| 279 | + if (count($changed) == 0) { |
|
| 280 | 280 | return true; |
| 281 | 281 | } |
| 282 | 282 | // Fall through |
| 283 | 283 | case 'insert' : |
| 284 | - if($_action == 'insert') { |
|
| 284 | + if ($_action == 'insert') { |
|
| 285 | 285 | // Backend doesn't like inserting with ID specified, can overwrite existing |
| 286 | 286 | unset($_data['id']); |
| 287 | 287 | } |
| 288 | 288 | // Make sure participants are set |
| 289 | - if(!$_data['participants']) { |
|
| 289 | + if (!$_data['participants']) { |
|
| 290 | 290 | $user = $_data['owner'] ? $_data['owner'] : $this->user; |
| 291 | 291 | $_data['participants'] = array( |
| 292 | 292 | $user => 'U' |
| 293 | 293 | ); |
| 294 | 294 | } |
| 295 | - if ( $this->dry_run ) { |
|
| 295 | + if ($this->dry_run) { |
|
| 296 | 296 | //print_r($_data); |
| 297 | 297 | $this->results[$_action]++; |
| 298 | 298 | return true; |
| 299 | 299 | } else { |
| 300 | - $result = $this->bo->save( $_data, $this->is_admin); |
|
| 301 | - if(!$result) { |
|
| 300 | + $result = $this->bo->save($_data, $this->is_admin); |
|
| 301 | + if (!$result) { |
|
| 302 | 302 | $this->errors[$record_num] = lang('Unable to save'); |
| 303 | 303 | } else { |
| 304 | 304 | $this->results[$_action]++; |
@@ -345,9 +345,9 @@ discard block |
||
| 345 | 345 | * |
| 346 | 346 | * @param egw_record $row_entry |
| 347 | 347 | */ |
| 348 | - protected function row_preview(importexport_iface_egw_record &$row_entry) |
|
| 348 | + protected function row_preview(importexport_iface_egw_record&$row_entry) |
|
| 349 | 349 | { |
| 350 | - $row_entry->participants = implode('<br />', $this->bo->participants(array('participants' => $row_entry->participants),true)); |
|
| 350 | + $row_entry->participants = implode('<br />', $this->bo->participants(array('participants' => $row_entry->participants), true)); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | } |
| 354 | 354 | \ No newline at end of file |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 85 | 85 | |
| 86 | 86 | $cals_pref = $GLOBALS['egw_info']['user']['preferences']['activesync']['calendar-cals']; |
| 87 | - $cals = $cals_pref ? explode(',',$cals_pref) : array('P'); // implicit default of 'P' |
|
| 87 | + $cals = $cals_pref ? explode(',', $cals_pref) : array('P'); // implicit default of 'P' |
|
| 88 | 88 | $folderlist = array(); |
| 89 | 89 | |
| 90 | 90 | foreach ($this->calendar->list_cals() as $entry) |
| 91 | 91 | { |
| 92 | 92 | $account_id = $entry['grantor']; |
| 93 | - if (in_array('A',$cals) || in_array($account_id,$cals) || |
|
| 94 | - $account_id == $GLOBALS['egw_info']['user']['account_id'] || // always incl. own calendar! |
|
| 95 | - $account_id == $GLOBALS['egw_info']['user']['account_primary_group'] && in_array('G',$cals)) |
|
| 93 | + if (in_array('A', $cals) || in_array($account_id, $cals) || |
|
| 94 | + $account_id == $GLOBALS['egw_info']['user']['account_id'] || // always incl. own calendar! |
|
| 95 | + $account_id == $GLOBALS['egw_info']['user']['account_primary_group'] && in_array('G', $cals)) |
|
| 96 | 96 | { |
| 97 | 97 | $folderlist[] = $f = array( |
| 98 | - 'id' => $this->backend->createID('calendar',$account_id), |
|
| 99 | - 'mod' => $GLOBALS['egw']->accounts->id2name($account_id,'account_fullname'), |
|
| 98 | + 'id' => $this->backend->createID('calendar', $account_id), |
|
| 99 | + 'mod' => $GLOBALS['egw']->accounts->id2name($account_id, 'account_fullname'), |
|
| 100 | 100 | 'parent'=> '0', |
| 101 | 101 | ); |
| 102 | 102 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $folderObj = new SyncFolder(); |
| 121 | 121 | $folderObj->serverid = $id; |
| 122 | 122 | $folderObj->parentid = '0'; |
| 123 | - $folderObj->displayname = $GLOBALS['egw']->accounts->id2name($owner,'account_fullname'); |
|
| 123 | + $folderObj->displayname = $GLOBALS['egw']->accounts->id2name($owner, 'account_fullname'); |
|
| 124 | 124 | if ($owner == $GLOBALS['egw_info']['user']['account_id']) |
| 125 | 125 | { |
| 126 | 126 | $folderObj->type = SYNC_FOLDER_TYPE_APPOINTMENT; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $stat = array( |
| 156 | 156 | 'id' => $id, |
| 157 | - 'mod' => $GLOBALS['egw']->accounts->id2name($owner,'account_fullname'), |
|
| 157 | + 'mod' => $GLOBALS['egw']->accounts->id2name($owner, 'account_fullname'), |
|
| 158 | 158 | 'parent' => '0', |
| 159 | 159 | ); |
| 160 | 160 | //error_log(__METHOD__."('$id') folderObj=".array2string($stat)); |
@@ -178,19 +178,19 @@ discard block |
||
| 178 | 178 | * @param array $not_uids =null uids NOT to return for meeting requests |
| 179 | 179 | * @return array |
| 180 | 180 | */ |
| 181 | - function GetMessageList($id, $cutoffdate=NULL, array $not_uids=null) |
|
| 181 | + function GetMessageList($id, $cutoffdate = NULL, array $not_uids = null) |
|
| 182 | 182 | { |
| 183 | 183 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 184 | 184 | |
| 185 | 185 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$id',$cutoffdate)"); |
| 186 | 186 | $type = $user = null; |
| 187 | - $this->backend->splitID($id,$type,$user); |
|
| 187 | + $this->backend->splitID($id, $type, $user); |
|
| 188 | 188 | |
| 189 | - if (!$cutoffdate) $cutoffdate = $this->bo->now - 100*24*3600; // default three month back -30 breaks all sync recurrences |
|
| 189 | + if (!$cutoffdate) $cutoffdate = $this->bo->now - 100 * 24 * 3600; // default three month back -30 breaks all sync recurrences |
|
| 190 | 190 | |
| 191 | 191 | $filter = array( |
| 192 | 192 | 'users' => $user, |
| 193 | - 'start' => $cutoffdate, // default one month back -30 breaks all sync recurrences |
|
| 193 | + 'start' => $cutoffdate, // default one month back -30 breaks all sync recurrences |
|
| 194 | 194 | 'enum_recuring' => false, |
| 195 | 195 | 'daywise' => false, |
| 196 | 196 | 'date_format' => 'server', |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | 'filter' => $user == $GLOBALS['egw_info']['user']['account_id'] ? (is_array($not_uids) ? 'unknown' : 'default') : 'default', |
| 200 | 200 | // @todo return only etag relevant information (seems not to work ...) |
| 201 | 201 | //'cols' => array('egw_cal.cal_id', 'cal_start', 'recur_type', 'cal_modified', 'cal_uid', 'cal_etag'), |
| 202 | - 'query' => array('cal_recurrence' => 0), // do NOT return recurrence exceptions |
|
| 202 | + 'query' => array('cal_recurrence' => 0), // do NOT return recurrence exceptions |
|
| 203 | 203 | ); |
| 204 | 204 | |
| 205 | 205 | $messagelist = array(); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @param int $cutoffdate =null |
| 231 | 231 | * @return array |
| 232 | 232 | */ |
| 233 | - function GetMeetingRequests(array $not_uids, $cutoffdate=NULL) |
|
| 233 | + function GetMeetingRequests(array $not_uids, $cutoffdate = NULL) |
|
| 234 | 234 | { |
| 235 | 235 | unset($not_uids, $cutoffdate); |
| 236 | 236 | return array(); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | function StatMeetingRequest($id) |
| 258 | 258 | { |
| 259 | - $folderid = $this->backend->createID('calendar', $GLOBALS['egw_info']['user']['account_id']); // users personal calendar |
|
| 259 | + $folderid = $this->backend->createID('calendar', $GLOBALS['egw_info']['user']['account_id']); // users personal calendar |
|
| 260 | 260 | |
| 261 | 261 | $ret = $this->StatMessage($folderid, abs($id)); |
| 262 | 262 | $ret['id'] = $id; |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | * @param bool $mimesupport |
| 276 | 276 | * @return SyncMail |
| 277 | 277 | */ |
| 278 | - function GetMeetingRequest($id, $truncsize, $bodypreference=false, $optionbodypreference=false, $mimesupport = 0) |
|
| 278 | + function GetMeetingRequest($id, $truncsize, $bodypreference = false, $optionbodypreference = false, $mimesupport = 0) |
|
| 279 | 279 | { |
| 280 | - unset($truncsize, $optionbodypreference, $mimesupport); // not used, but required by function signature |
|
| 280 | + unset($truncsize, $optionbodypreference, $mimesupport); // not used, but required by function signature |
|
| 281 | 281 | |
| 282 | 282 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 283 | 283 | |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | $message = new SyncMail(); |
| 291 | 291 | $message->read = false; |
| 292 | 292 | $message->subject = $event['title']; |
| 293 | - $message->importance = 1; // 0=Low, 1=Normal, 2=High |
|
| 293 | + $message->importance = 1; // 0=Low, 1=Normal, 2=High |
|
| 294 | 294 | $message->datereceived = $event['created']; |
| 295 | 295 | $message->to = $message->displayto = $GLOBALS['egw_info']['user']['account_email']; |
| 296 | - $message->from = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_fullname'). |
|
| 297 | - ' <'.$GLOBALS['egw']->accounts->id2name($event['owner'],'account_email').'>'; |
|
| 296 | + $message->from = $GLOBALS['egw']->accounts->id2name($event['owner'], 'account_fullname'). |
|
| 297 | + ' <'.$GLOBALS['egw']->accounts->id2name($event['owner'], 'account_email').'>'; |
|
| 298 | 298 | $message->internetcpid = 65001; |
| 299 | - $message->contentclass="urn:content-classes:message"; |
|
| 299 | + $message->contentclass = "urn:content-classes:message"; |
|
| 300 | 300 | |
| 301 | 301 | $message->meetingrequest = self::meetingRequest($event); |
| 302 | 302 | $message->messageclass = "IPM.Schedule.Meeting.Request"; |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | else |
| 312 | 312 | { |
| 313 | 313 | $message->airsyncbasebody = new SyncAirSyncBaseBody(); |
| 314 | - $message->airsyncbasenativebodytype=1; |
|
| 314 | + $message->airsyncbasenativebodytype = 1; |
|
| 315 | 315 | $this->backend->note2messagenote($event['description'], $bodypreference, $message->airsyncbasebody); |
| 316 | 316 | } |
| 317 | 317 | } |
@@ -346,12 +346,12 @@ discard block |
||
| 346 | 346 | $as_tz = self::tz2as($event['tzid']); |
| 347 | 347 | $message->timezone = base64_encode(self::_getSyncBlobFromTZ($as_tz)); |
| 348 | 348 | } |
| 349 | - catch(Exception $e) { |
|
| 349 | + catch (Exception $e) { |
|
| 350 | 350 | unset($e); |
| 351 | 351 | // ignore exception, simply set no timezone, as it is optional |
| 352 | 352 | } |
| 353 | 353 | // copying timestamps (they are already read in servertime, so non tz conversation) |
| 354 | - foreach(array( |
|
| 354 | + foreach (array( |
|
| 355 | 355 | 'start' => 'starttime', |
| 356 | 356 | 'end' => 'endtime', |
| 357 | 357 | 'created' => 'dtstamp', |
@@ -361,10 +361,10 @@ discard block |
||
| 361 | 361 | } |
| 362 | 362 | if (($message->alldayevent = (int)calendar_bo::isWholeDay($event))) |
| 363 | 363 | { |
| 364 | - ++$message->endtime; // EGw all-day-events are 1 sec shorter! |
|
| 364 | + ++$message->endtime; // EGw all-day-events are 1 sec shorter! |
|
| 365 | 365 | } |
| 366 | 366 | // copying strings |
| 367 | - foreach(array( |
|
| 367 | + foreach (array( |
|
| 368 | 368 | 'title' => 'subject', |
| 369 | 369 | 'location' => 'location', |
| 370 | 370 | ) as $key => $attr) |
@@ -373,16 +373,16 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | $message->organizer = $event['organizer']; |
| 375 | 375 | |
| 376 | - $message->sensitivity = $event['public'] ? 0 : 2; // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 376 | + $message->sensitivity = $event['public'] ? 0 : 2; // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 377 | 377 | |
| 378 | 378 | // busystatus=(0=free|1=tentative|2=busy|3=out-of-office), EGw has non_blocking=0|1 |
| 379 | 379 | $message->busystatus = $event['non_blocking'] ? 0 : 2; |
| 380 | 380 | |
| 381 | 381 | // ToDo: recurring events: InstanceType, RecurrenceId, Recurrences; ... |
| 382 | - $message->instancetype = 0; // 0=Single, 1=Master recurring, 2=Single recuring, 3=Exception |
|
| 382 | + $message->instancetype = 0; // 0=Single, 1=Master recurring, 2=Single recuring, 3=Exception |
|
| 383 | 383 | |
| 384 | - $message->responserequested = 1; //0=No, 1=Yes |
|
| 385 | - $message->disallownewtimeproposal = 1; //1=forbidden, 0=allowed |
|
| 384 | + $message->responserequested = 1; //0=No, 1=Yes |
|
| 385 | + $message->disallownewtimeproposal = 1; //1=forbidden, 0=allowed |
|
| 386 | 386 | //$message->messagemeetingtype; // email2 |
| 387 | 387 | |
| 388 | 388 | // ToDo: alarme: Reminder |
@@ -428,14 +428,14 @@ discard block |
||
| 428 | 428 | // check if event already exist (invitation of or already imported by other user) |
| 429 | 429 | if (!($event = $this->calendar->read($parsed_event['uid'], 0, false, 'server'))) |
| 430 | 430 | { |
| 431 | - $event = $parsed_event; // create new event from external invitation |
|
| 431 | + $event = $parsed_event; // create new event from external invitation |
|
| 432 | 432 | } |
| 433 | - elseif(!isset($event['participants'][$uid])) |
|
| 433 | + elseif (!isset($event['participants'][$uid])) |
|
| 434 | 434 | { |
| 435 | 435 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.'('.array2string($requestid).", $folderid, $response) current user ($uid) is NO participant of event ".array2string($event)); |
| 436 | 436 | // maybe we should silently add him, as he might not have the rights to add him himself with calendar->update ... |
| 437 | 437 | } |
| 438 | - elseif($event['deleted']) |
|
| 438 | + elseif ($event['deleted']) |
|
| 439 | 439 | { |
| 440 | 440 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.'('.array2string($requestid).", $folderid, $response) event ($uid) deleted on server --> return false"); |
| 441 | 441 | return false; |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | else |
| 459 | 459 | { |
| 460 | 460 | $event['participants'][$uid] = $status; |
| 461 | - $ret = $this->calendar->update($event, true); // true = ignore conflicts, as there seems no conflict handling in AS |
|
| 461 | + $ret = $this->calendar->update($event, true); // true = ignore conflicts, as there seems no conflict handling in AS |
|
| 462 | 462 | } |
| 463 | 463 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.'('.array2string($requestid).", '$folderid', $response) returning ".array2string($ret)); |
| 464 | 464 | return $ret; |
@@ -470,10 +470,10 @@ discard block |
||
| 470 | 470 | * @var array |
| 471 | 471 | */ |
| 472 | 472 | static $status2as = array( |
| 473 | - 'U' => 0, // unknown |
|
| 474 | - 'T' => 2, // tentative |
|
| 475 | - 'A' => 3, // accepted |
|
| 476 | - 'R' => 4, // decline |
|
| 473 | + 'U' => 0, // unknown |
|
| 474 | + 'T' => 2, // tentative |
|
| 475 | + 'A' => 3, // accepted |
|
| 476 | + 'R' => 4, // decline |
|
| 477 | 477 | // 5 = not responded |
| 478 | 478 | ); |
| 479 | 479 | /** |
@@ -482,9 +482,9 @@ discard block |
||
| 482 | 482 | * @var array |
| 483 | 483 | */ |
| 484 | 484 | static $role2as = array( |
| 485 | - 'REQ-PARTICIPANT' => 1, // required |
|
| 486 | - 'CHAIR' => 1, // required |
|
| 487 | - 'OPT-PARTICIPANT' => 2, // optional |
|
| 485 | + 'REQ-PARTICIPANT' => 1, // required |
|
| 486 | + 'CHAIR' => 1, // required |
|
| 487 | + 'OPT-PARTICIPANT' => 2, // optional |
|
| 488 | 488 | 'NON-PARTICIPANT' => 2, |
| 489 | 489 | // 3 = ressource |
| 490 | 490 | ); |
@@ -496,8 +496,8 @@ discard block |
||
| 496 | 496 | static $recur_type2as = array( |
| 497 | 497 | calendar_rrule::DAILY => 0, |
| 498 | 498 | calendar_rrule::WEEKLY => 1, |
| 499 | - calendar_rrule::MONTHLY_MDAY => 2, // monthly |
|
| 500 | - calendar_rrule::MONTHLY_WDAY => 3, // monthly on nth day |
|
| 499 | + calendar_rrule::MONTHLY_MDAY => 2, // monthly |
|
| 500 | + calendar_rrule::MONTHLY_WDAY => 3, // monthly on nth day |
|
| 501 | 501 | calendar_rrule::YEARLY => 5, |
| 502 | 502 | // 6 = yearly on nth day (same as 5 on non-leapyears or before March on leapyears) |
| 503 | 503 | ); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | */ |
| 525 | 525 | public function ChangeMessage($folderid, $_id, $message, $contentParameters) |
| 526 | 526 | { |
| 527 | - unset($contentParameters); // unused, but required by function signature |
|
| 527 | + unset($contentParameters); // unused, but required by function signature |
|
| 528 | 528 | |
| 529 | 529 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 530 | 530 | |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | |
| 535 | 535 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', $_id, ".array2string($message).") type='$type', account=$account"); |
| 536 | 536 | |
| 537 | - list($id,$recur_date) = explode(':', $_id); |
|
| 537 | + list($id, $recur_date) = explode(':', $_id); |
|
| 538 | 538 | |
| 539 | 539 | if ($type != 'calendar' || $id && !($old_event = $this->calendar->read($id, $recur_date, false, 'server'))) |
| 540 | 540 | { |
@@ -547,21 +547,21 @@ discard block |
||
| 547 | 547 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid',$id:$recur_date,".array2string($message).") handling of virtual exception not yet implemented!"); |
| 548 | 548 | //error_log(__METHOD__."('$folderid',$id:$recur_date,".array2string($message).") handling of virtual exception not yet implemented!"); |
| 549 | 549 | } |
| 550 | - if (!$this->calendar->check_perms($id ? Acl::EDIT : Acl::ADD, $old_event ? $old_event : 0,$account)) |
|
| 550 | + if (!$this->calendar->check_perms($id ? Acl::EDIT : Acl::ADD, $old_event ? $old_event : 0, $account)) |
|
| 551 | 551 | { |
| 552 | 552 | // @todo: write in users calendar and make account only a participant |
| 553 | 553 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid',$id,...) no rights to add/edit event!"); |
| 554 | 554 | //error_log(__METHOD__."('$folderid',$id,".array2string($message).") no rights to add/edit event!"); |
| 555 | 555 | return false; |
| 556 | 556 | } |
| 557 | - if (!$id) $old_event['owner'] = $account; // we do NOT allow to change the owner of existing events |
|
| 557 | + if (!$id) $old_event['owner'] = $account; // we do NOT allow to change the owner of existing events |
|
| 558 | 558 | |
| 559 | 559 | $event = $this->message2event($message, $account, $old_event); |
| 560 | 560 | |
| 561 | 561 | // store event, ignore conflicts and skip notifications, as AS clients do their own notifications |
| 562 | 562 | $skip_notification = false; |
| 563 | 563 | if (isset($GLOBALS['egw_info']['user']['preferences']['activesync']['mail-allowSendingInvitations']) && |
| 564 | - $GLOBALS['egw_info']['user']['preferences']['activesync']['mail-allowSendingInvitations']=='send') |
|
| 564 | + $GLOBALS['egw_info']['user']['preferences']['activesync']['mail-allowSendingInvitations'] == 'send') |
|
| 565 | 565 | { |
| 566 | 566 | $skip_notification = true; // to avoid double notification from client AND Server |
| 567 | 567 | } |
@@ -574,16 +574,16 @@ discard block |
||
| 574 | 574 | // store non-delete exceptions |
| 575 | 575 | if ($message->exceptions) |
| 576 | 576 | { |
| 577 | - foreach($message->exceptions as $exception) |
|
| 577 | + foreach ($message->exceptions as $exception) |
|
| 578 | 578 | { |
| 579 | 579 | if (!$exception->deleted) |
| 580 | 580 | { |
| 581 | 581 | $ex_event = $event; |
| 582 | 582 | unset($ex_event['id']); |
| 583 | 583 | unset($ex_event['etag']); |
| 584 | - foreach(array_keys($ex_event) as $name) |
|
| 584 | + foreach (array_keys($ex_event) as $name) |
|
| 585 | 585 | { |
| 586 | - if (substr($name,0,6) == 'recur_') unset($ex_event[$name]); |
|
| 586 | + if (substr($name, 0, 6) == 'recur_') unset($ex_event[$name]); |
|
| 587 | 587 | } |
| 588 | 588 | $ex_event['recur_type'] = calendar_rrule::NONE; |
| 589 | 589 | |
@@ -591,10 +591,10 @@ discard block |
||
| 591 | 591 | 'user' => $account, |
| 592 | 592 | 'enum_recuring' => false, |
| 593 | 593 | 'daywise' => false, |
| 594 | - 'filter' => 'owner', // return all possible entries |
|
| 594 | + 'filter' => 'owner', // return all possible entries |
|
| 595 | 595 | 'query' => array( |
| 596 | 596 | 'cal_uid' => $event['uid'], |
| 597 | - 'cal_recurrence' => $exception->exceptionstarttime, // in servertime |
|
| 597 | + 'cal_recurrence' => $exception->exceptionstarttime, // in servertime |
|
| 598 | 598 | ), |
| 599 | 599 | )))) |
| 600 | 600 | { |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | $participants = $event['participants']; |
| 607 | 607 | } |
| 608 | 608 | $save_event = $this->message2event($exception, $account, $ex_event); |
| 609 | - $save_event['participants'] = $participants; // not contained in $exception |
|
| 609 | + $save_event['participants'] = $participants; // not contained in $exception |
|
| 610 | 610 | $save_event['reference'] = $event['id']; |
| 611 | 611 | $save_event['recurrence'] = Api\DateTime::server2user($exception->exceptionstarttime); |
| 612 | 612 | $ex_ok = $this->calendar->save($save_event); |
@@ -628,10 +628,10 @@ discard block |
||
| 628 | 628 | * @param array $event =array() |
| 629 | 629 | * @return array |
| 630 | 630 | */ |
| 631 | - private function message2event(SyncAppointment $message, $account, $event=array()) |
|
| 631 | + private function message2event(SyncAppointment $message, $account, $event = array()) |
|
| 632 | 632 | { |
| 633 | 633 | // timestamps (created & modified are updated automatically) |
| 634 | - foreach(array( |
|
| 634 | + foreach (array( |
|
| 635 | 635 | 'start' => 'starttime', |
| 636 | 636 | 'end' => 'endtime', |
| 637 | 637 | ) as $key => $attr) |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | if (isset($message->$attr)) $event[$key] = Api\DateTime::server2user($message->$attr); |
| 640 | 640 | } |
| 641 | 641 | // copying strings |
| 642 | - foreach(array( |
|
| 642 | + foreach (array( |
|
| 643 | 643 | 'title' => 'subject', |
| 644 | 644 | 'uid' => 'uid', |
| 645 | 645 | 'location' => 'location', |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | { |
| 655 | 655 | $event['description'] = $description; |
| 656 | 656 | } |
| 657 | - $event['public'] = (int)($message->sensitivity < 1); // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 657 | + $event['public'] = (int)($message->sensitivity < 1); // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 658 | 658 | |
| 659 | 659 | // busystatus=(0=free|1=tentative|2=busy|3=out-of-office), EGw has non_blocking=0|1 |
| 660 | 660 | if (isset($message->busystatus)) |
@@ -664,21 +664,21 @@ discard block |
||
| 664 | 664 | |
| 665 | 665 | if (($event['whole_day'] = $message->alldayevent)) |
| 666 | 666 | { |
| 667 | - if ($event['end'] == $event['start']) $event['end'] += 24*3600; // some clients send equal start&end for 1day |
|
| 668 | - $event['end']--; // otherwise our whole-day event code in save makes it one more day! |
|
| 667 | + if ($event['end'] == $event['start']) $event['end'] += 24 * 3600; // some clients send equal start&end for 1day |
|
| 668 | + $event['end']--; // otherwise our whole-day event code in save makes it one more day! |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | $participants = array(); |
| 672 | - foreach((array)$message->attendees as $attendee) |
|
| 672 | + foreach ((array)$message->attendees as $attendee) |
|
| 673 | 673 | { |
| 674 | - if ($attendee->type == 3) continue; // we can not identify resources and re-add them anyway later |
|
| 674 | + if ($attendee->type == 3) continue; // we can not identify resources and re-add them anyway later |
|
| 675 | 675 | |
| 676 | 676 | $matches = null; |
| 677 | - if (preg_match('/^noreply-(.*)[email protected]$/',$attendee->email,$matches)) |
|
| 677 | + if (preg_match('/^noreply-(.*)[email protected]$/', $attendee->email, $matches)) |
|
| 678 | 678 | { |
| 679 | 679 | $uid = $matches[1]; |
| 680 | 680 | } |
| 681 | - elseif (!($uid = $GLOBALS['egw']->accounts->name2id($attendee->email,'account_email'))) |
|
| 681 | + elseif (!($uid = $GLOBALS['egw']->accounts->name2id($attendee->email, 'account_email'))) |
|
| 682 | 682 | { |
| 683 | 683 | $search = array( |
| 684 | 684 | 'email' => $attendee->email, |
@@ -688,13 +688,13 @@ discard block |
||
| 688 | 688 | // search addressbook for participant |
| 689 | 689 | if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts(); |
| 690 | 690 | if ((list($data) = $this->addressbook->search($search, |
| 691 | - array('id','egw_addressbook.account_id as account_id','n_fn'), |
|
| 691 | + array('id', 'egw_addressbook.account_id as account_id', 'n_fn'), |
|
| 692 | 692 | 'egw_addressbook.account_id IS NOT NULL DESC, n_fn IS NOT NULL DESC', |
| 693 | - '','',false,'OR'))) |
|
| 693 | + '', '', false, 'OR'))) |
|
| 694 | 694 | { |
| 695 | 695 | $uid = $data['account_id'] ? (int)$data['account_id'] : 'c'.$data['id']; |
| 696 | 696 | } |
| 697 | - elseif($attendee->name === $attendee->email || empty($attendee->name)) // dont store empty or email as name |
|
| 697 | + elseif ($attendee->name === $attendee->email || empty($attendee->name)) // dont store empty or email as name |
|
| 698 | 698 | { |
| 699 | 699 | $uid = 'e'.$attendee->email; |
| 700 | 700 | } |
@@ -712,8 +712,8 @@ discard block |
||
| 712 | 712 | //ZLog::Write(LOGLEVEL_DEBUG, "old status for $uid is status=$status, quantity=$quantitiy, role=$role"); |
| 713 | 713 | } |
| 714 | 714 | // check if just email is an existing attendee (iOS returns email as name too!), keep it to keep status/role if not set |
| 715 | - elseif ($event['id'] && (isset($event['participants'][$u='e'.$attendee->email]) || |
|
| 716 | - (isset($event['participants'][$u='e'.$attendee->name.' <'.$attendee->email.'>'])))) |
|
| 715 | + elseif ($event['id'] && (isset($event['participants'][$u = 'e'.$attendee->email]) || |
|
| 716 | + (isset($event['participants'][$u = 'e'.$attendee->name.' <'.$attendee->email.'>'])))) |
|
| 717 | 717 | { |
| 718 | 718 | $status = $event['participants'][$u]; |
| 719 | 719 | calendar_so::split_status($status, $quantity, $role); |
@@ -726,9 +726,9 @@ discard block |
||
| 726 | 726 | $role = 'REQ-PARTICIPANT'; |
| 727 | 727 | //ZLog::Write(LOGLEVEL_DEBUG, "default status for $uid is status=$status, quantity=$quantitiy, role=$role"); |
| 728 | 728 | } |
| 729 | - if ($role == 'CHAIR') $chair_set = true; // by role from existing participant |
|
| 729 | + if ($role == 'CHAIR') $chair_set = true; // by role from existing participant |
|
| 730 | 730 | |
| 731 | - if (isset($attendee->attendeestatus) && ($s = array_search($attendee->attendeestatus,self::$status2as))) |
|
| 731 | + if (isset($attendee->attendeestatus) && ($s = array_search($attendee->attendeestatus, self::$status2as))) |
|
| 732 | 732 | { |
| 733 | 733 | $status = $s; |
| 734 | 734 | } |
@@ -738,29 +738,29 @@ discard block |
||
| 738 | 738 | $chair_set = true; |
| 739 | 739 | } |
| 740 | 740 | elseif (isset($attendee->attendeetype) && |
| 741 | - !($role == 'CHAIR' && !is_numeric($uid)) && // do not override our external ORGANIZER |
|
| 742 | - ($r = array_search($attendee->attendeetype,self::$role2as)) && |
|
| 741 | + !($role == 'CHAIR' && !is_numeric($uid)) && // do not override our external ORGANIZER |
|
| 742 | + ($r = array_search($attendee->attendeetype, self::$role2as)) && |
|
| 743 | 743 | (int)self::$role2as[$role] != $attendee->attendeetype) // if old role gives same type, use old role, as we have a lot more roles then AS |
| 744 | 744 | { |
| 745 | 745 | $role = $r; |
| 746 | 746 | } |
| 747 | 747 | //ZLog::Write(LOGLEVEL_DEBUG, "-> status for $uid is status=$status ($s), quantity=$quantitiy, role=$role ($r)"); |
| 748 | - $participants[$uid] = calendar_so::combine_status($status,$quantitiy,$role); |
|
| 748 | + $participants[$uid] = calendar_so::combine_status($status, $quantitiy, $role); |
|
| 749 | 749 | } |
| 750 | 750 | // if organizer is not already participant, add him as chair |
| 751 | - if (($uid = $GLOBALS['egw']->accounts->name2id($message->organizeremail,'account_email')) && !isset($participants[$uid])) |
|
| 751 | + if (($uid = $GLOBALS['egw']->accounts->name2id($message->organizeremail, 'account_email')) && !isset($participants[$uid])) |
|
| 752 | 752 | { |
| 753 | 753 | $participants[$uid] = calendar_so::combine_status($uid == $GLOBALS['egw_info']['user']['account_id'] ? |
| 754 | - 'A' : 'U',1,'CHAIR'); |
|
| 754 | + 'A' : 'U', 1, 'CHAIR'); |
|
| 755 | 755 | $chair_set = true; |
| 756 | 756 | } |
| 757 | 757 | // preserve all resource types not account, contact or email (eg. resources) for existing events |
| 758 | 758 | // $account is also preserved, as AS does not add him as participant! |
| 759 | - foreach((array)$event['participant_types'] as $type => $parts) |
|
| 759 | + foreach ((array)$event['participant_types'] as $type => $parts) |
|
| 760 | 760 | { |
| 761 | - if (in_array($type,array('c','e'))) continue; // they are correctly representable in AS |
|
| 761 | + if (in_array($type, array('c', 'e'))) continue; // they are correctly representable in AS |
|
| 762 | 762 | |
| 763 | - foreach($parts as $id => $status) |
|
| 763 | + foreach ($parts as $id => $status) |
|
| 764 | 764 | { |
| 765 | 765 | // accounts are represented correctly, but the event owner which is no participant in AS |
| 766 | 766 | if ($type == 'u' && $id != $account) continue; |
@@ -776,13 +776,13 @@ discard block |
||
| 776 | 776 | if (!$event['id'] || !$participants || !isset($participants[$account])) |
| 777 | 777 | { |
| 778 | 778 | $participants[$account] = calendar_so::combine_status($account == $GLOBALS['egw_info']['user']['account_id'] ? |
| 779 | - 'A' : 'U',1,!$chair_set ? 'CHAIR' : 'REQ-PARTICIPANT'); |
|
| 779 | + 'A' : 'U', 1, !$chair_set ? 'CHAIR' : 'REQ-PARTICIPANT'); |
|
| 780 | 780 | } |
| 781 | 781 | $event['participants'] = $participants; |
| 782 | 782 | |
| 783 | 783 | if (isset($message->categories)) |
| 784 | 784 | { |
| 785 | - $event['category'] = implode(',', array_filter($this->calendar->find_or_add_categories($message->categories, $event),'strlen')); |
|
| 785 | + $event['category'] = implode(',', array_filter($this->calendar->find_or_add_categories($message->categories, $event), 'strlen')); |
|
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | // check if event is recurring and import recur information (incl. timezone) |
@@ -792,8 +792,7 @@ discard block |
||
| 792 | 792 | { |
| 793 | 793 | $event['tzid'] = self::as2tz(self::_getTZFromSyncBlob(base64_decode($message->timezone))); |
| 794 | 794 | } |
| 795 | - $event['recur_type'] = $message->recurrence->type == 6 ? calendar_rrule::YEARLY : |
|
| 796 | - array_search($message->recurrence->type, self::$recur_type2as); |
|
| 795 | + $event['recur_type'] = $message->recurrence->type == 6 ? calendar_rrule::YEARLY : array_search($message->recurrence->type, self::$recur_type2as); |
|
| 797 | 796 | $event['recur_interval'] = $message->recurrence->interval; |
| 798 | 797 | |
| 799 | 798 | switch ($event['recur_type']) |
@@ -802,7 +801,7 @@ discard block |
||
| 802 | 801 | // $message->recurrence->weekofmonth is not explicitly stored in egw, just taken from start date |
| 803 | 802 | // fall throught |
| 804 | 803 | case calendar_rrule::WEEKLY: |
| 805 | - $event['recur_data'] = $message->recurrence->dayofweek; // 1=Su, 2=Mo, 4=Tu, .., 64=Sa |
|
| 804 | + $event['recur_data'] = $message->recurrence->dayofweek; // 1=Su, 2=Mo, 4=Tu, .., 64=Sa |
|
| 806 | 805 | break; |
| 807 | 806 | case calendar_rrule::MONTHLY_MDAY: |
| 808 | 807 | // $message->recurrence->dayofmonth is not explicitly stored in egw, just taken from start date |
@@ -818,7 +817,7 @@ discard block |
||
| 818 | 817 | $event['recur_exceptions'] = array(); |
| 819 | 818 | if ($message->exceptions) |
| 820 | 819 | { |
| 821 | - foreach($message->exceptions as $exception) |
|
| 820 | + foreach ($message->exceptions as $exception) |
|
| 822 | 821 | { |
| 823 | 822 | $event['recur_exception'][] = Api\DateTime::server2user($exception->exceptionstarttime); |
| 824 | 823 | } |
@@ -828,7 +827,7 @@ discard block |
||
| 828 | 827 | { |
| 829 | 828 | // calculate enddate from occurences count, as we only support enddate |
| 830 | 829 | $count = $message->recurrence->occurrences; |
| 831 | - foreach(calendar_rrule::event2rrule($event, true) as $rtime) // true = timestamps are user time here, because of save! |
|
| 830 | + foreach (calendar_rrule::event2rrule($event, true) as $rtime) // true = timestamps are user time here, because of save! |
|
| 832 | 831 | { |
| 833 | 832 | if (--$count <= 0) break; |
| 834 | 833 | } |
@@ -838,11 +837,11 @@ discard block |
||
| 838 | 837 | // only import alarms in own calendar |
| 839 | 838 | if ($message->reminder && $account == $GLOBALS['egw_info']['user']['account_id']) |
| 840 | 839 | { |
| 841 | - foreach((array)$event['alarm'] as $alarm) |
|
| 840 | + foreach ((array)$event['alarm'] as $alarm) |
|
| 842 | 841 | { |
| 843 | - if (($alarm['all'] || $alarm['owner'] == $account) && $alarm['offset'] == 60*$message->reminder) |
|
| 842 | + if (($alarm['all'] || $alarm['owner'] == $account) && $alarm['offset'] == 60 * $message->reminder) |
|
| 844 | 843 | { |
| 845 | - $alarm = true; // alarm already exists --> do nothing |
|
| 844 | + $alarm = true; // alarm already exists --> do nothing |
|
| 846 | 845 | break; |
| 847 | 846 | } |
| 848 | 847 | } |
@@ -851,16 +850,16 @@ discard block |
||
| 851 | 850 | // delete all earlier alarms of that user |
| 852 | 851 | // user get's per AS only the earliest alarm, as AS only supports one alarm |
| 853 | 852 | // --> if a later alarm is returned, user probably modifed an existing alarm |
| 854 | - foreach((array)$event['alarm'] as $key => $alarm) |
|
| 853 | + foreach ((array)$event['alarm'] as $key => $alarm) |
|
| 855 | 854 | { |
| 856 | - if ($alarm['owner'] == $account && $alarm['offset'] > 60*$message->reminder) |
|
| 855 | + if ($alarm['owner'] == $account && $alarm['offset'] > 60 * $message->reminder) |
|
| 857 | 856 | { |
| 858 | 857 | unset($event['alarm'][$key]); |
| 859 | 858 | } |
| 860 | 859 | } |
| 861 | 860 | $event['alarm'][] = $alarm = array( |
| 862 | 861 | 'owner' => $account, |
| 863 | - 'offset' => 60*$message->reminder, |
|
| 862 | + 'offset' => 60 * $message->reminder, |
|
| 864 | 863 | ); |
| 865 | 864 | } |
| 866 | 865 | } |
@@ -934,7 +933,7 @@ discard block |
||
| 934 | 933 | */ |
| 935 | 934 | public function DeleteMessage($folderid, $id, $contentParameters) |
| 936 | 935 | { |
| 937 | - unset($contentParameters); // not used, but required by function signature |
|
| 936 | + unset($contentParameters); // not used, but required by function signature |
|
| 938 | 937 | |
| 939 | 938 | if (!isset($this->caledar)) $this->calendar = new calendar_boupdate(); |
| 940 | 939 | |
@@ -962,7 +961,7 @@ discard block |
||
| 962 | 961 | */ |
| 963 | 962 | function SetReadFlag($folderid, $id, $flags, $contentParameters) |
| 964 | 963 | { |
| 965 | - unset($contentParameters); // not used, but required by function signature |
|
| 964 | + unset($contentParameters); // not used, but required by function signature |
|
| 966 | 965 | |
| 967 | 966 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', $id, ".array2string($flags)." NOT supported!"); |
| 968 | 967 | return false; |
@@ -1013,17 +1012,17 @@ discard block |
||
| 1013 | 1012 | } |
| 1014 | 1013 | else |
| 1015 | 1014 | { |
| 1016 | - list($id,$recur_date) = explode(':',$id); |
|
| 1017 | - if ($type != 'calendar' || !($event = $this->calendar->read($id,$recur_date,false,'server',$account))) |
|
| 1015 | + list($id, $recur_date) = explode(':', $id); |
|
| 1016 | + if ($type != 'calendar' || !($event = $this->calendar->read($id, $recur_date, false, 'server', $account))) |
|
| 1018 | 1017 | { |
| 1019 | 1018 | error_log(__METHOD__."('$folderid', $id, ...) read($id,null,false,'server',$account) returned false"); |
| 1020 | 1019 | return false; |
| 1021 | 1020 | } |
| 1022 | 1021 | } |
| 1023 | - ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."($folderid,$id,...) start=$event[start]=".date('Y-m-d H:i:s',$event['start']).", recurrence=$event[recurrence]=".date('Y-m-d H:i:s',$event['recurrence'])); |
|
| 1024 | - foreach((array)$event['recur_exception'] as $ex) |
|
| 1022 | + ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."($folderid,$id,...) start=$event[start]=".date('Y-m-d H:i:s', $event['start']).", recurrence=$event[recurrence]=".date('Y-m-d H:i:s', $event['recurrence'])); |
|
| 1023 | + foreach ((array)$event['recur_exception'] as $ex) |
|
| 1025 | 1024 | { |
| 1026 | - ZLog::Write(LOGLEVEL_DEBUG, "exception=$ex=".date('Y-m-d H:i:s',$ex)); |
|
| 1025 | + ZLog::Write(LOGLEVEL_DEBUG, "exception=$ex=".date('Y-m-d H:i:s', $ex)); |
|
| 1027 | 1026 | } |
| 1028 | 1027 | $message = new SyncAppointment(); |
| 1029 | 1028 | |
@@ -1032,13 +1031,13 @@ discard block |
||
| 1032 | 1031 | $as_tz = self::tz2as($event['tzid']); |
| 1033 | 1032 | $message->timezone = base64_encode(self::_getSyncBlobFromTZ($as_tz)); |
| 1034 | 1033 | } |
| 1035 | - catch(Exception $e) { |
|
| 1034 | + catch (Exception $e) { |
|
| 1036 | 1035 | unset($e); |
| 1037 | 1036 | // ignore exception, simply set no timezone, as it is optional |
| 1038 | 1037 | } |
| 1039 | 1038 | |
| 1040 | 1039 | // copying timestamps (they are already read in servertime, so non tz conversation) |
| 1041 | - foreach(array( |
|
| 1040 | + foreach (array( |
|
| 1042 | 1041 | 'start' => 'starttime', |
| 1043 | 1042 | 'end' => 'endtime', |
| 1044 | 1043 | 'created' => 'dtstamp', |
@@ -1049,10 +1048,10 @@ discard block |
||
| 1049 | 1048 | } |
| 1050 | 1049 | if (($message->alldayevent = (int)calendar_bo::isWholeDay($event))) |
| 1051 | 1050 | { |
| 1052 | - ++$message->endtime; // EGw all-day-events are 1 sec shorter! |
|
| 1051 | + ++$message->endtime; // EGw all-day-events are 1 sec shorter! |
|
| 1053 | 1052 | } |
| 1054 | 1053 | // copying strings |
| 1055 | - foreach(array( |
|
| 1054 | + foreach (array( |
|
| 1056 | 1055 | 'title' => 'subject', |
| 1057 | 1056 | 'uid' => 'uid', |
| 1058 | 1057 | 'location' => 'location', |
@@ -1074,22 +1073,22 @@ discard block |
||
| 1074 | 1073 | { |
| 1075 | 1074 | ZLog::Write(LOGLEVEL_DEBUG, "airsyncbasebody!"); |
| 1076 | 1075 | $message->asbody = new SyncBaseBody(); |
| 1077 | - $message->nativebodytype=1; |
|
| 1076 | + $message->nativebodytype = 1; |
|
| 1078 | 1077 | $this->backend->note2messagenote($event['description'], $bodypreference, $message->asbody); |
| 1079 | 1078 | } |
| 1080 | 1079 | } |
| 1081 | 1080 | $message->md5body = md5($event['description']); |
| 1082 | 1081 | |
| 1083 | - $message->organizername = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_fullname'); |
|
| 1084 | - $message->organizeremail = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_email'); |
|
| 1082 | + $message->organizername = $GLOBALS['egw']->accounts->id2name($event['owner'], 'account_fullname'); |
|
| 1083 | + $message->organizeremail = $GLOBALS['egw']->accounts->id2name($event['owner'], 'account_email'); |
|
| 1085 | 1084 | |
| 1086 | - $message->sensitivity = $event['public'] ? 0 : 2; // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 1085 | + $message->sensitivity = $event['public'] ? 0 : 2; // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 1087 | 1086 | |
| 1088 | 1087 | // busystatus=(0=free|1=tentative|2=busy|3=out-of-office), EGw has non_blocking=0|1 |
| 1089 | 1088 | $message->busystatus = $event['non_blocking'] ? 0 : 2; |
| 1090 | 1089 | |
| 1091 | 1090 | $message->attendees = array(); |
| 1092 | - foreach($event['participants'] as $uid => $status) |
|
| 1091 | + foreach ($event['participants'] as $uid => $status) |
|
| 1093 | 1092 | { |
| 1094 | 1093 | // AS does NOT want calendar owner as participant |
| 1095 | 1094 | if ($uid == $account) continue; |
@@ -1101,19 +1100,19 @@ discard block |
||
| 1101 | 1100 | $attendee->attendeetype = (int)self::$role2as[$role]; |
| 1102 | 1101 | if (is_numeric($uid)) |
| 1103 | 1102 | { |
| 1104 | - $attendee->name = $GLOBALS['egw']->accounts->id2name($uid,'account_fullname'); |
|
| 1105 | - $attendee->email = $GLOBALS['egw']->accounts->id2name($uid,'account_email'); |
|
| 1103 | + $attendee->name = $GLOBALS['egw']->accounts->id2name($uid, 'account_fullname'); |
|
| 1104 | + $attendee->email = $GLOBALS['egw']->accounts->id2name($uid, 'account_email'); |
|
| 1106 | 1105 | } |
| 1107 | 1106 | else |
| 1108 | 1107 | { |
| 1109 | 1108 | list($info) = $i = $this->calendar->resources[$uid[0]]['info'] ? |
| 1110 | - ExecMethod($this->calendar->resources[$uid[0]]['info'],substr($uid,1)) : array(false); |
|
| 1109 | + ExecMethod($this->calendar->resources[$uid[0]]['info'], substr($uid, 1)) : array(false); |
|
| 1111 | 1110 | |
| 1112 | 1111 | if (!$info) continue; |
| 1113 | 1112 | |
| 1114 | 1113 | if (!$info['email'] && $info['responsible']) |
| 1115 | 1114 | { |
| 1116 | - $info['email'] = $GLOBALS['egw']->accounts->id2name($info['responsible'],'account_email'); |
|
| 1115 | + $info['email'] = $GLOBALS['egw']->accounts->id2name($info['responsible'], 'account_email'); |
|
| 1117 | 1116 | } |
| 1118 | 1117 | $attendee->name = empty($info['cn']) ? $info['name'] : $info['cn']; |
| 1119 | 1118 | $attendee->email = $info['email']; |
@@ -1125,7 +1124,7 @@ discard block |
||
| 1125 | 1124 | $message->organizeremail = $attendee->email; |
| 1126 | 1125 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."($folderid, $id, ...) external organizer detected (role=$role, uid=$uid), set as AS organizer: $message->organizername <$message->organizeremail>"); |
| 1127 | 1126 | } |
| 1128 | - if ($uid[0] == 'r') $attendee->type = 3; // 3 = resource |
|
| 1127 | + if ($uid[0] == 'r') $attendee->type = 3; // 3 = resource |
|
| 1129 | 1128 | } |
| 1130 | 1129 | // email must NOT be empty, but MAY be an arbitrary text |
| 1131 | 1130 | if (empty($attendee->email)) $attendee->email = 'noreply-'.$uid.'[email protected]'; |
@@ -1133,7 +1132,7 @@ discard block |
||
| 1133 | 1132 | $message->attendees[] = $attendee; |
| 1134 | 1133 | } |
| 1135 | 1134 | $message->categories = array(); |
| 1136 | - foreach($event['category'] ? explode(',',$event['category']) : array() as $cat_id) |
|
| 1135 | + foreach ($event['category'] ? explode(',', $event['category']) : array() as $cat_id) |
|
| 1137 | 1136 | { |
| 1138 | 1137 | $message->categories[] = Api\Categories::id2name($cat_id); |
| 1139 | 1138 | } |
@@ -1142,25 +1141,25 @@ discard block |
||
| 1142 | 1141 | if ($event['recur_type'] != calendar_rrule::NONE && !$recur_date) |
| 1143 | 1142 | { |
| 1144 | 1143 | $message->recurrence = $recurrence = new SyncRecurrence(); |
| 1145 | - $rrule = calendar_rrule::event2rrule($event,false); // false = timestamps in $event are servertime |
|
| 1144 | + $rrule = calendar_rrule::event2rrule($event, false); // false = timestamps in $event are servertime |
|
| 1146 | 1145 | $recurrence->type = (int)self::$recur_type2as[$rrule->type]; |
| 1147 | 1146 | $recurrence->interval = $rrule->interval; |
| 1148 | 1147 | switch ($rrule->type) |
| 1149 | 1148 | { |
| 1150 | 1149 | case calendar_rrule::MONTHLY_WDAY: |
| 1151 | 1150 | $recurrence->weekofmonth = $rrule->monthly_byday_num >= 1 ? |
| 1152 | - $rrule->monthly_byday_num : 5; // 1..5=last week of month, not -1 |
|
| 1151 | + $rrule->monthly_byday_num : 5; // 1..5=last week of month, not -1 |
|
| 1153 | 1152 | // fall throught |
| 1154 | 1153 | case calendar_rrule::WEEKLY: |
| 1155 | - $recurrence->dayofweek = $rrule->weekdays; // 1=Su, 2=Mo, 4=Tu, .., 64=Sa |
|
| 1154 | + $recurrence->dayofweek = $rrule->weekdays; // 1=Su, 2=Mo, 4=Tu, .., 64=Sa |
|
| 1156 | 1155 | break; |
| 1157 | 1156 | case calendar_rrule::MONTHLY_MDAY: |
| 1158 | - $recurrence->dayofmonth = $rrule->monthly_bymonthday >= 1 ? // 1..31 |
|
| 1159 | - $rrule->monthly_bymonthday : 31; // not -1 for last day of month! |
|
| 1157 | + $recurrence->dayofmonth = $rrule->monthly_bymonthday >= 1 ? // 1..31 |
|
| 1158 | + $rrule->monthly_bymonthday : 31; // not -1 for last day of month! |
|
| 1160 | 1159 | break; |
| 1161 | 1160 | case calendar_rrule::YEARLY: |
| 1162 | - $recurrence->dayofmonth = (int)$rrule->time->format('d'); // 1..31 |
|
| 1163 | - $recurrence->monthofyear = (int)$rrule->time->format('m'); // 1..12 |
|
| 1161 | + $recurrence->dayofmonth = (int)$rrule->time->format('d'); // 1..31 |
|
| 1162 | + $recurrence->monthofyear = (int)$rrule->time->format('m'); // 1..12 |
|
| 1164 | 1163 | break; |
| 1165 | 1164 | } |
| 1166 | 1165 | if ($rrule->enddate) // enddate is only a date, but AS needs a time incl. correct starttime! |
@@ -1176,9 +1175,9 @@ discard block |
||
| 1176 | 1175 | // search real / non-virtual exceptions |
| 1177 | 1176 | if (!empty($event['uid'])) |
| 1178 | 1177 | { |
| 1179 | - $ex_events =& $this->calendar->search(array( |
|
| 1178 | + $ex_events = & $this->calendar->search(array( |
|
| 1180 | 1179 | 'query' => array('cal_uid' => $event['uid']), |
| 1181 | - 'filter' => 'owner', // return all possible entries |
|
| 1180 | + 'filter' => 'owner', // return all possible entries |
|
| 1182 | 1181 | 'daywise' => false, |
| 1183 | 1182 | 'date_format' => 'server', |
| 1184 | 1183 | )); |
@@ -1187,36 +1186,36 @@ discard block |
||
| 1187 | 1186 | { |
| 1188 | 1187 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." Exceptions found but no UID given for Event:".$event['id'].' Exceptions:'.array2string($event['recur_exception'])); |
| 1189 | 1188 | } |
| 1190 | - if (count($ex_events)>=1) ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." found ".count($ex_events)." exeptions for event with UID/ID:".$event['uid'].'/'.$event['id']); |
|
| 1189 | + if (count($ex_events) >= 1) ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." found ".count($ex_events)." exeptions for event with UID/ID:".$event['uid'].'/'.$event['id']); |
|
| 1191 | 1190 | |
| 1192 | 1191 | $message->exceptions = array(); |
| 1193 | - foreach($ex_events as $ex_event) |
|
| 1192 | + foreach ($ex_events as $ex_event) |
|
| 1194 | 1193 | { |
| 1195 | - if ($ex_event['id'] == $event['id']) continue; // ignore series master |
|
| 1194 | + if ($ex_event['id'] == $event['id']) continue; // ignore series master |
|
| 1196 | 1195 | $exception = $this->GetMessage($folderid, $ex_event, $contentparameters); |
| 1197 | 1196 | $exception->exceptionstarttime = $exception_time = $ex_event['recurrence']; |
| 1198 | - foreach(array('attendees','recurrence','uid','timezone','organizername','organizeremail') as $not_supported) |
|
| 1197 | + foreach (array('attendees', 'recurrence', 'uid', 'timezone', 'organizername', 'organizeremail') as $not_supported) |
|
| 1199 | 1198 | { |
| 1200 | - $exception->$not_supported = null; // not allowed in exceptions :-( |
|
| 1199 | + $exception->$not_supported = null; // not allowed in exceptions :-( |
|
| 1201 | 1200 | } |
| 1202 | 1201 | $exception->deleted = 0; |
| 1203 | - if (($key = array_search($exception_time,$event['recur_exception'])) !== false) |
|
| 1202 | + if (($key = array_search($exception_time, $event['recur_exception'])) !== false) |
|
| 1204 | 1203 | { |
| 1205 | 1204 | unset($event['recur_exception'][$key]); |
| 1206 | 1205 | } |
| 1207 | - ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."() added exception ".date('Y-m-d H:i:s',$exception_time).' '.array2string($exception)); |
|
| 1206 | + ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."() added exception ".date('Y-m-d H:i:s', $exception_time).' '.array2string($exception)); |
|
| 1208 | 1207 | $message->exceptions[] = $exception; |
| 1209 | 1208 | } |
| 1210 | 1209 | // add rest of exceptions as deleted |
| 1211 | - foreach($event['recur_exception'] as $exception_time) |
|
| 1210 | + foreach ($event['recur_exception'] as $exception_time) |
|
| 1212 | 1211 | { |
| 1213 | 1212 | if (!empty($exception_time)) |
| 1214 | 1213 | { |
| 1215 | 1214 | if (empty($event['uid'])) ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." BEWARE no UID given for this event:".$event['id'].' but exception is set for '.$exception_time); |
| 1216 | - $exception = new SyncAppointmentException(); // exceptions seems to be full SyncAppointments, with only starttime required |
|
| 1215 | + $exception = new SyncAppointmentException(); // exceptions seems to be full SyncAppointments, with only starttime required |
|
| 1217 | 1216 | $exception->deleted = 1; |
| 1218 | 1217 | $exception->exceptionstarttime = $exception_time; |
| 1219 | - ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."() added deleted exception ".date('Y-m-d H:i:s',$exception_time).' '.array2string($exception)); |
|
| 1218 | + ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."() added deleted exception ".date('Y-m-d H:i:s', $exception_time).' '.array2string($exception)); |
|
| 1220 | 1219 | $message->exceptions[] = $exception; |
| 1221 | 1220 | } |
| 1222 | 1221 | } |
@@ -1238,12 +1237,12 @@ discard block |
||
| 1238 | 1237 | // only return alarms if in own calendar |
| 1239 | 1238 | if ($account == $GLOBALS['egw_info']['user']['account_id'] && $event['alarm']) |
| 1240 | 1239 | { |
| 1241 | - foreach($event['alarm'] as $alarm) |
|
| 1240 | + foreach ($event['alarm'] as $alarm) |
|
| 1242 | 1241 | { |
| 1243 | 1242 | if ($alarm['all'] || $alarm['owner'] == $account) |
| 1244 | 1243 | { |
| 1245 | - $message->reminder = $alarm['offset']/60; // is in minutes, not seconds as in EGw |
|
| 1246 | - break; // AS supports only one alarm! (we use the next/earliest one) |
|
| 1244 | + $message->reminder = $alarm['offset'] / 60; // is in minutes, not seconds as in EGw |
|
| 1245 | + break; // AS supports only one alarm! (we use the next/earliest one) |
|
| 1247 | 1246 | } |
| 1248 | 1247 | } |
| 1249 | 1248 | } |
@@ -1266,7 +1265,7 @@ discard block |
||
| 1266 | 1265 | */ |
| 1267 | 1266 | public function StatMessage($folderid, $id) |
| 1268 | 1267 | { |
| 1269 | - unset($folderid); // not used ($id is unique), but required by function signature |
|
| 1268 | + unset($folderid); // not used ($id is unique), but required by function signature |
|
| 1270 | 1269 | |
| 1271 | 1270 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 1272 | 1271 | |
@@ -1277,7 +1276,7 @@ discard block |
||
| 1277 | 1276 | // error_log why access is denied (should never happen for everything returned by calendar_bo::search) |
| 1278 | 1277 | $backup = $this->calendar->debug; |
| 1279 | 1278 | //$this->calendar->debug = 2; |
| 1280 | - list($id) = explode(':',$id); |
|
| 1279 | + list($id) = explode(':', $id); |
|
| 1281 | 1280 | $this->calendar->check_perms(calendar_bo::ACL_FREEBUSY, $id, 0, 'server'); |
| 1282 | 1281 | $this->calendar->debug = $backup; |
| 1283 | 1282 | } |
@@ -1311,7 +1310,7 @@ discard block |
||
| 1311 | 1310 | |
| 1312 | 1311 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 1313 | 1312 | //$ctag = $this->calendar->get_ctag($owner,'owner',true); // true only consider recurrence master |
| 1314 | - $syncstate = $this->calendar->get_ctag($owner,false,true); // we only want to fetch the owners events, where he is a participant too |
|
| 1313 | + $syncstate = $this->calendar->get_ctag($owner, false, true); // we only want to fetch the owners events, where he is a participant too |
|
| 1315 | 1314 | // workaround for syncstate = 0 when calendar is empty causes synctate to not return 0 but array resulting in foldersync loop |
| 1316 | 1315 | if ($syncstate == 0) $syncstate = 1; |
| 1317 | 1316 | |
@@ -1384,8 +1383,8 @@ discard block |
||
| 1384 | 1383 | 'dstendhour' => 0, 'dstendminute' => 0, 'dstendsecond' => 0, 'dstendmillis' => 0, |
| 1385 | 1384 | ); |
| 1386 | 1385 | |
| 1387 | - $name = $component = is_a($tz,'DateTimeZone') ? $tz->getName() : $tz; |
|
| 1388 | - if (strpos($component, 'VTIMEZONE') === false) $component = calendar_timezones::tz2id($name,'component'); |
|
| 1386 | + $name = $component = is_a($tz, 'DateTimeZone') ? $tz->getName() : $tz; |
|
| 1387 | + if (strpos($component, 'VTIMEZONE') === false) $component = calendar_timezones::tz2id($name, 'component'); |
|
| 1389 | 1388 | // parse ical timezone defintion |
| 1390 | 1389 | $ical = self::ical2array($component); |
| 1391 | 1390 | $standard = $ical['VTIMEZONE']['STANDARD']; |
@@ -1394,11 +1393,11 @@ discard block |
||
| 1394 | 1393 | if (!isset($standard)) |
| 1395 | 1394 | { |
| 1396 | 1395 | $matches = null; |
| 1397 | - if (preg_match('/^etc\/gmt([+-])([0-9]+)$/i',$name,$matches)) |
|
| 1396 | + if (preg_match('/^etc\/gmt([+-])([0-9]+)$/i', $name, $matches)) |
|
| 1398 | 1397 | { |
| 1399 | 1398 | $standard = array( |
| 1400 | - 'TZOFFSETTO' => sprintf('%s%02d00',$matches[1],$matches[2]), |
|
| 1401 | - 'TZOFFSETFROM' => sprintf('%s%02d00',$matches[1],$matches[2]), |
|
| 1399 | + 'TZOFFSETTO' => sprintf('%s%02d00', $matches[1], $matches[2]), |
|
| 1400 | + 'TZOFFSETFROM' => sprintf('%s%02d00', $matches[1], $matches[2]), |
|
| 1402 | 1401 | ); |
| 1403 | 1402 | unset($daylight); |
| 1404 | 1403 | } |
@@ -1409,15 +1408,15 @@ discard block |
||
| 1409 | 1408 | } |
| 1410 | 1409 | // get bias and dstbias from standard component, which is present in all tz's |
| 1411 | 1410 | // (dstbias is relative to bias and almost always 60 or 0) |
| 1412 | - $data['bias'] = -(60 * substr($standard['TZOFFSETTO'],0,-2) + substr($standard['TZOFFSETTO'],-2)); |
|
| 1413 | - $data['dstbias'] = -(60 * substr($standard['TZOFFSETFROM'],0,-2) + substr($standard['TZOFFSETFROM'],-2) + $data['bias']); |
|
| 1411 | + $data['bias'] = -(60 * substr($standard['TZOFFSETTO'], 0, -2) + substr($standard['TZOFFSETTO'], -2)); |
|
| 1412 | + $data['dstbias'] = -(60 * substr($standard['TZOFFSETFROM'], 0, -2) + substr($standard['TZOFFSETFROM'], -2) + $data['bias']); |
|
| 1414 | 1413 | |
| 1415 | 1414 | // check if we have an additional DAYLIGHT component and both have a RRULE component --> tz uses daylight saving |
| 1416 | 1415 | if (isset($standard['RRULE']) && isset($daylight) && isset($daylight['RRULE'])) |
| 1417 | 1416 | { |
| 1418 | - foreach(array('dststart' => $daylight,'dstend' => $standard) as $prefix => $comp) |
|
| 1417 | + foreach (array('dststart' => $daylight, 'dstend' => $standard) as $prefix => $comp) |
|
| 1419 | 1418 | { |
| 1420 | - if (preg_match('/FREQ=YEARLY;BYDAY=(.*);BYMONTH=(\d+)/',$comp['RRULE'],$matches)) |
|
| 1419 | + if (preg_match('/FREQ=YEARLY;BYDAY=(.*);BYMONTH=(\d+)/', $comp['RRULE'], $matches)) |
|
| 1421 | 1420 | { |
| 1422 | 1421 | $data[$prefix.'month'] = (int)$matches[2]; |
| 1423 | 1422 | $data[$prefix.'week'] = (int)$matches[1]; |
@@ -1434,20 +1433,20 @@ discard block |
||
| 1434 | 1433 | $data[$prefix.'week'] = 5; |
| 1435 | 1434 | if ($prefix == 'dstend') $data[$prefix.'month'] -= 1; |
| 1436 | 1435 | } |
| 1437 | - static $day2int = array('SU'=>0,'MO'=>1,'TU'=>2,'WE'=>3,'TH'=>4,'FR'=>5,'SA'=>6); |
|
| 1438 | - $data[$prefix.'day'] = (int)$day2int[substr($matches[1],-2)]; |
|
| 1436 | + static $day2int = array('SU'=>0, 'MO'=>1, 'TU'=>2, 'WE'=>3, 'TH'=>4, 'FR'=>5, 'SA'=>6); |
|
| 1437 | + $data[$prefix.'day'] = (int)$day2int[substr($matches[1], -2)]; |
|
| 1439 | 1438 | } |
| 1440 | - if (preg_match('/^\d{8}T(\d{6})$/',$comp['DTSTART'],$matches)) |
|
| 1439 | + if (preg_match('/^\d{8}T(\d{6})$/', $comp['DTSTART'], $matches)) |
|
| 1441 | 1440 | { |
| 1442 | - $data[$prefix.'hour'] = (int)substr($matches[1],0,2)+($prefix=='dststart'?-1:1)*$data['dstbias']/60; |
|
| 1443 | - $data[$prefix.'minute'] = (int)substr($matches[1],2,2)+($prefix=='dststart'?-1:1)*$data['dstbias']%60; |
|
| 1444 | - $data[$prefix.'second'] = (int)substr($matches[1],4,2); |
|
| 1441 | + $data[$prefix.'hour'] = (int)substr($matches[1], 0, 2) + ($prefix == 'dststart' ?-1 : 1) * $data['dstbias'] / 60; |
|
| 1442 | + $data[$prefix.'minute'] = (int)substr($matches[1], 2, 2) + ($prefix == 'dststart' ?-1 : 1) * $data['dstbias'] % 60; |
|
| 1443 | + $data[$prefix.'second'] = (int)substr($matches[1], 4, 2); |
|
| 1445 | 1444 | } |
| 1446 | 1445 | } |
| 1447 | 1446 | // for southern hermisphere, were DST is in January, we have to swap start- and end-hour/-minute |
| 1448 | 1447 | if ($data['dststartmonth'] > $data['dstendmonth']) |
| 1449 | 1448 | { |
| 1450 | - $start = $data['dststarthour']; $data['dststarthour'] = $data['dstendhour']; $data['dstendhour'] = $start; |
|
| 1449 | + $start = $data['dststarthour']; $data['dststarthour'] = $data['dstendhour']; $data['dstendhour'] = $start; |
|
| 1451 | 1450 | $end = $data['dststartminute']; $data['dststartminute'] = $data['dstendminute']; $data['dstendminute'] = $end; |
| 1452 | 1451 | } |
| 1453 | 1452 | } |
@@ -1505,20 +1504,20 @@ discard block |
||
| 1505 | 1504 | * @param string|array $ical lines of ical file |
| 1506 | 1505 | * @return array with parsed ical components |
| 1507 | 1506 | */ |
| 1508 | - static public function ical2array(&$ical,$section=null) |
|
| 1507 | + static public function ical2array(&$ical, $section = null) |
|
| 1509 | 1508 | { |
| 1510 | 1509 | $arr = array(); |
| 1511 | 1510 | if (!is_array($ical)) $ical = preg_split("/[\r\n]+/m", $ical); |
| 1512 | 1511 | while (($line = array_shift($ical))) |
| 1513 | 1512 | { |
| 1514 | - list($name,$value) = explode(':',$line,2); |
|
| 1513 | + list($name, $value) = explode(':', $line, 2); |
|
| 1515 | 1514 | if ($name == 'BEGIN') |
| 1516 | 1515 | { |
| 1517 | - $arr[$value] = self::ical2array($ical,$value); |
|
| 1516 | + $arr[$value] = self::ical2array($ical, $value); |
|
| 1518 | 1517 | } |
| 1519 | - elseif($name == 'END') |
|
| 1518 | + elseif ($name == 'END') |
|
| 1520 | 1519 | { |
| 1521 | - if ($section && $section==$value) return $arr; |
|
| 1520 | + if ($section && $section == $value) return $arr; |
|
| 1522 | 1521 | break; |
| 1523 | 1522 | } |
| 1524 | 1523 | else |
@@ -1541,13 +1540,13 @@ discard block |
||
| 1541 | 1540 | */ |
| 1542 | 1541 | public static function as2tz(array $data) |
| 1543 | 1542 | { |
| 1544 | - static $cache=null; // some caching withing the request |
|
| 1543 | + static $cache = null; // some caching withing the request |
|
| 1545 | 1544 | |
| 1546 | - unset($data['name']); // not used, but can stall the match |
|
| 1545 | + unset($data['name']); // not used, but can stall the match |
|
| 1547 | 1546 | |
| 1548 | 1547 | $key = serialize($data); |
| 1549 | 1548 | |
| 1550 | - for($n = 0; !isset($cache[$key]); ++$n) |
|
| 1549 | + for ($n = 0; !isset($cache[$key]); ++$n) |
|
| 1551 | 1550 | { |
| 1552 | 1551 | if (!$n) // check users timezone first |
| 1553 | 1552 | { |
@@ -1566,7 +1565,7 @@ discard block |
||
| 1566 | 1565 | break; |
| 1567 | 1566 | } |
| 1568 | 1567 | } |
| 1569 | - catch(Exception $e) { |
|
| 1568 | + catch (Exception $e) { |
|
| 1570 | 1569 | unset($e); |
| 1571 | 1570 | // simpy ignore that, as it only means $tz can NOT be converted, because it has no VTIMEZONE component |
| 1572 | 1571 | } |
@@ -1581,8 +1580,8 @@ discard block |
||
| 1581 | 1580 | */ |
| 1582 | 1581 | static public function _getTZFromSyncBlob($data) |
| 1583 | 1582 | { |
| 1584 | - $tz = unpack( "lbias/a64name/vdstendyear/vdstendmonth/vdstendday/vdstendweek/vdstendhour/vdstendminute/vdstendsecond/vdstendmillis/" . |
|
| 1585 | - "lstdbias/a64name/vdststartyear/vdststartmonth/vdststartday/vdststartweek/vdststarthour/vdststartminute/vdststartsecond/vdststartmillis/" . |
|
| 1583 | + $tz = unpack("lbias/a64name/vdstendyear/vdstendmonth/vdstendday/vdstendweek/vdstendhour/vdstendminute/vdstendsecond/vdstendmillis/". |
|
| 1584 | + "lstdbias/a64name/vdststartyear/vdststartmonth/vdststartday/vdststartweek/vdststarthour/vdststartminute/vdststartsecond/vdststartmillis/". |
|
| 1586 | 1585 | "ldstbias", $data); |
| 1587 | 1586 | |
| 1588 | 1587 | return $tz; |
@@ -1595,7 +1594,7 @@ discard block |
||
| 1595 | 1594 | */ |
| 1596 | 1595 | static public function _getSyncBlobFromTZ($tz) |
| 1597 | 1596 | { |
| 1598 | - $packed = pack("la64vvvvvvvv" . "la64vvvvvvvv" . "l", |
|
| 1597 | + $packed = pack("la64vvvvvvvv"."la64vvvvvvvv"."l", |
|
| 1599 | 1598 | $tz["bias"], "", 0, $tz["dstendmonth"], $tz["dstendday"], $tz["dstendweek"], $tz["dstendhour"], $tz["dstendminute"], $tz["dstendsecond"], $tz["dstendmillis"], |
| 1600 | 1599 | $tz["stdbias"], "", 0, $tz["dststartmonth"], $tz["dststartday"], $tz["dststartweek"], $tz["dststarthour"], $tz["dststartminute"], $tz["dststartsecond"], $tz["dststartmillis"], |
| 1601 | 1600 | $tz["dstbias"]); |
@@ -1619,7 +1618,7 @@ discard block |
||
| 1619 | 1618 | $account_id = $entry['grantor']; |
| 1620 | 1619 | $cals[$account_id] = $entry['name']; |
| 1621 | 1620 | } |
| 1622 | - if ($hook_data['account_id'] > 0) unset($cals[$hook_data['account_id']]); // skip current user |
|
| 1621 | + if ($hook_data['account_id'] > 0) unset($cals[$hook_data['account_id']]); // skip current user |
|
| 1623 | 1622 | } |
| 1624 | 1623 | $cals['G'] = lang('Primary group'); |
| 1625 | 1624 | $cals['A'] = lang('All'); |
@@ -1655,8 +1654,8 @@ discard block |
||
| 1655 | 1654 | ) |
| 1656 | 1655 | ); |
| 1657 | 1656 | require_once('../../header.inc.php'); |
| 1658 | - ini_set('display_errors',1); |
|
| 1659 | - error_reporting(E_ALL & ~E_NOTICE); |
|
| 1657 | + ini_set('display_errors', 1); |
|
| 1658 | + error_reporting(E_ALL&~E_NOTICE); |
|
| 1660 | 1659 | |
| 1661 | 1660 | echo "<html><head><title>Conversation of ActiveSync Timezone Blobs to TZID's</title></head>\n<body>\n"; |
| 1662 | 1661 | echo "<h3>Conversation of ActiveSync Timezone Blobs to TZID's</h3>\n"; |
@@ -1670,7 +1669,7 @@ discard block |
||
| 1670 | 1669 | </script>\n"; |
| 1671 | 1670 | |
| 1672 | 1671 | // TZID => AS timezone blobs reported by various devices |
| 1673 | - foreach(array( |
|
| 1672 | + foreach (array( |
|
| 1674 | 1673 | 'Europe/Berlin' => 'xP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAFAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAMAAAAAAAAAxP///w==', |
| 1675 | 1674 | 'Europe/Helsinki' => 'iP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAFAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAQAAAAAAAAAxP///w==', |
| 1676 | 1675 | 'Asia/Tokyo' => '5P3//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///w==', |
@@ -1683,9 +1682,9 @@ discard block |
||
| 1683 | 1682 | ) as $tz => $sync_blob) |
| 1684 | 1683 | { |
| 1685 | 1684 | // get as timezone data for a given timezone |
| 1686 | - $ical = calendar_timezones::tz2id($tz,'component'); |
|
| 1685 | + $ical = calendar_timezones::tz2id($tz, 'component'); |
|
| 1687 | 1686 | //echo "<pre>".print_r($ical,true)."</pre>\n"; |
| 1688 | - $ical_arr = calendar_zpush::ical2array($ical_tz=$ical); |
|
| 1687 | + $ical_arr = calendar_zpush::ical2array($ical_tz = $ical); |
|
| 1689 | 1688 | //echo "<pre>".print_r($ical_arr,true)."</pre>\n"; |
| 1690 | 1689 | $as_tz = calendar_zpush::tz2as($tz); |
| 1691 | 1690 | //echo "$tz=<pre>".print_r($as_tz,true)."</pre>\n"; |
@@ -1699,22 +1698,22 @@ discard block |
||
| 1699 | 1698 | //echo array2string($matched); |
| 1700 | 1699 | |
| 1701 | 1700 | echo "<tr><td><b onclick='toggle_display(this.nextSibling);' style='cursor:pointer;'>$tz</b><pre style='margin:0; font-size: 90%; display:none;'>$ical</pre></td><td>$as_tz_org[bias]<br/>$as_tz[bias]</td><td>$as_tz_org[dstbias]<br/>$as_tz[dstbias]</td>\n"; |
| 1702 | - foreach(array('dststart','dstend') as $prefix) |
|
| 1701 | + foreach (array('dststart', 'dstend') as $prefix) |
|
| 1703 | 1702 | { |
| 1704 | 1703 | echo "<td>\n"; |
| 1705 | - foreach(array($as_tz_org,$as_tz) as $n => $arr) |
|
| 1704 | + foreach (array($as_tz_org, $as_tz) as $n => $arr) |
|
| 1706 | 1705 | { |
| 1707 | 1706 | $parts = array(); |
| 1708 | - foreach(array('year','month','day','week','hour','minute','second') as $postfix) |
|
| 1707 | + foreach (array('year', 'month', 'day', 'week', 'hour', 'minute', 'second') as $postfix) |
|
| 1709 | 1708 | { |
| 1710 | 1709 | $failed = $n && $as_tz_org[$prefix.$postfix] !== $as_tz[$prefix.$postfix]; |
| 1711 | - $parts[] = ($failed?'<font color="red">':'').$arr[$prefix.$postfix].($failed?'</font>':''); |
|
| 1710 | + $parts[] = ($failed ? '<font color="red">' : '').$arr[$prefix.$postfix].($failed ? '</font>' : ''); |
|
| 1712 | 1711 | } |
| 1713 | - echo implode(' ', $parts).(!$n?'<br/>':''); |
|
| 1712 | + echo implode(' ', $parts).(!$n ? '<br/>' : ''); |
|
| 1714 | 1713 | } |
| 1715 | 1714 | echo "</td>\n"; |
| 1716 | 1715 | } |
| 1717 | - echo "<td> <br/>".($matched=='UTC'?'<font color="red">':'').$matched.($matched=='UTC'?'</font>':'')."</td></tr>\n"; |
|
| 1716 | + echo "<td> <br/>".($matched == 'UTC' ? '<font color="red">' : '').$matched.($matched == 'UTC' ? '</font>' : '')."</td></tr>\n"; |
|
| 1718 | 1717 | } |
| 1719 | 1718 | echo "</tbody></table>\n"; |
| 1720 | 1719 | echo "</body></html>\n"; |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public static $types = array( |
| 26 | 26 | 'select-cat' => array('category'), |
| 27 | - 'select-account'=> array('owner','creator', 'modifier'), |
|
| 28 | - 'date-time' => array('modified', 'created','start','end','recur_date'), |
|
| 27 | + 'select-account'=> array('owner', 'creator', 'modifier'), |
|
| 28 | + 'date-time' => array('modified', 'created', 'start', 'end', 'recur_date'), |
|
| 29 | 29 | 'date' => array('recur_enddate'), |
| 30 | 30 | 'select-bool' => array('public', 'non_blocking'), |
| 31 | 31 | 'select' => array('priority'), |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param string $_identifier |
| 39 | 39 | */ |
| 40 | - public function __construct( $_identifier='' ){ |
|
| 40 | + public function __construct($_identifier = '') { |
|
| 41 | 41 | $this->identifier = $_identifier; |
| 42 | - if(!is_object($this->bo)) { |
|
| 42 | + if (!is_object($this->bo)) { |
|
| 43 | 43 | $this->bo = new calendar_bo(); |
| 44 | 44 | } |
| 45 | - if($this->identifier) { |
|
| 45 | + if ($this->identifier) { |
|
| 46 | 46 | $this->record = $this->bo->read($this->identifier); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @todo add some checks |
| 97 | 97 | * @return void |
| 98 | 98 | */ |
| 99 | - public function set_record(array $_record){ |
|
| 99 | + public function set_record(array $_record) { |
|
| 100 | 100 | $this->record = $_record; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @return string identifier |
| 126 | 126 | */ |
| 127 | - public function save ( $_dst_identifier ) { |
|
| 127 | + public function save($_dst_identifier) { |
|
| 128 | 128 | // Not yet implemeted |
| 129 | 129 | $this->identifier = $_dst_identifier; |
| 130 | 130 | } |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | * @param string $_dst_identifier |
| 136 | 136 | * @return string dst_identifier |
| 137 | 137 | */ |
| 138 | - public function copy ( $_dst_identifier ) { |
|
| 139 | - unset($_dst_identifier); // not used |
|
| 138 | + public function copy($_dst_identifier) { |
|
| 139 | + unset($_dst_identifier); // not used |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | * @param string $_dst_identifier |
| 147 | 147 | * @return string dst_identifier |
| 148 | 148 | */ |
| 149 | - public function move ( $_dst_identifier ) { |
|
| 150 | - unset($_dst_identifier); // not used |
|
| 149 | + public function move($_dst_identifier) { |
|
| 150 | + unset($_dst_identifier); // not used |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * delets current record from backend |
| 155 | 155 | * |
| 156 | 156 | */ |
| 157 | - public function delete () { |
|
| 157 | + public function delete() { |
|
| 158 | 158 | |
| 159 | 159 | } |
| 160 | 160 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @var mixed |
| 43 | 43 | */ |
| 44 | - var $debug=false; |
|
| 44 | + var $debug = false; |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * extra rows above and below the workday |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @var boolean |
| 94 | 94 | */ |
| 95 | - var $use_time_grid=true; |
|
| 95 | + var $use_time_grid = true; |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Pref value of use_time_grid preference |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @var boolean |
| 107 | 107 | */ |
| 108 | - var $scroll_to_wdstart=false; |
|
| 108 | + var $scroll_to_wdstart = false; |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * counter for the current whole day event of a single day |
| 112 | 112 | * |
| 113 | 113 | * @var int |
| 114 | 114 | */ |
| 115 | - var $wholeDayPosCounter=1; |
|
| 115 | + var $wholeDayPosCounter = 1; |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * Switch to disable private data and possibility to view and edit events |
@@ -135,25 +135,25 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @param array $set_states = null to manualy set / change one of the states, default NULL = use $_REQUEST |
| 137 | 137 | */ |
| 138 | - function __construct($set_states=null) |
|
| 138 | + function __construct($set_states = null) |
|
| 139 | 139 | { |
| 140 | - parent::__construct(false,$set_states); // call the parent's constructor |
|
| 140 | + parent::__construct(false, $set_states); // call the parent's constructor |
|
| 141 | 141 | $this->extraRowsOriginal = $this->extraRows; //save original extraRows value |
| 142 | 142 | |
| 143 | 143 | $GLOBALS['egw_info']['flags']['nonavbar'] = False; |
| 144 | 144 | |
| 145 | 145 | // Check for GET message (from merge) |
| 146 | - if($_GET['msg']) |
|
| 146 | + if ($_GET['msg']) |
|
| 147 | 147 | { |
| 148 | 148 | Framework::message($_GET['msg']); |
| 149 | 149 | unset($_GET['msg']); |
| 150 | 150 | } |
| 151 | 151 | // standard params for calling bocal::search for all views |
| 152 | - $this->owner = str_replace('%2C',',',$this->owner); |
|
| 152 | + $this->owner = str_replace('%2C', ',', $this->owner); |
|
| 153 | 153 | $this->search_params = array( |
| 154 | 154 | 'start' => $this->date, |
| 155 | - 'cat_id' => $this->cat_id ? (is_array($this->cat_id)?$this->cat_id:explode(',',$this->cat_id)) : 0, |
|
| 156 | - 'users' => explode(',',$this->owner), |
|
| 155 | + 'cat_id' => $this->cat_id ? (is_array($this->cat_id) ? $this->cat_id : explode(',', $this->cat_id)) : 0, |
|
| 156 | + 'users' => explode(',', $this->owner), |
|
| 157 | 157 | 'filter' => $this->filter, |
| 158 | 158 | 'daywise' => True, |
| 159 | 159 | 'use_so_events' => $this->test === 'true', |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function week_number($time) |
| 181 | 181 | { |
| 182 | - if (!is_a($time,'DateTime')) $time = new Api\DateTime($time); |
|
| 182 | + if (!is_a($time, 'DateTime')) $time = new Api\DateTime($time); |
|
| 183 | 183 | |
| 184 | 184 | // if week does not start Monday and $time is Sunday --> add one day |
| 185 | 185 | if ($this->cal_prefs['weekdaystarts'] != 'Monday' && !($wday = $time->format('w'))) |
@@ -197,19 +197,19 @@ discard block |
||
| 197 | 197 | /** |
| 198 | 198 | * Load all views used by calendar, client side switches between them as needed |
| 199 | 199 | */ |
| 200 | - function index($content=array()) |
|
| 200 | + function index($content = array()) |
|
| 201 | 201 | { |
| 202 | - if($content['merge']) |
|
| 202 | + if ($content['merge']) |
|
| 203 | 203 | { |
| 204 | 204 | // View from sidebox is JSON encoded |
| 205 | - $this->manage_states(array_merge($content,json_decode($content['view'],true))); |
|
| 206 | - if($content['first']) |
|
| 205 | + $this->manage_states(array_merge($content, json_decode($content['view'], true))); |
|
| 206 | + if ($content['first']) |
|
| 207 | 207 | { |
| 208 | - $this->first = Api\DateTime::to($content['first'],'ts'); |
|
| 208 | + $this->first = Api\DateTime::to($content['first'], 'ts'); |
|
| 209 | 209 | } |
| 210 | - if($content['last']) |
|
| 210 | + if ($content['last']) |
|
| 211 | 211 | { |
| 212 | - $this->last = Api\DateTime::to($content['last'],'ts'); |
|
| 212 | + $this->last = Api\DateTime::to($content['last'], 'ts'); |
|
| 213 | 213 | } |
| 214 | 214 | $_GET['merge'] = $content['merge']; |
| 215 | 215 | $this->merge(); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualCalendar'.ucfirst($this->view)); |
| 226 | 226 | |
| 227 | 227 | // Sidebox & iframe for old views |
| 228 | - if(in_array($this->view,array('year')) && $_GET['view']) |
|
| 228 | + if (in_array($this->view, array('year')) && $_GET['view']) |
|
| 229 | 229 | { |
| 230 | 230 | $GLOBALS['egw_info']['flags']['nonavbar'] = true; |
| 231 | 231 | $this->manage_states($_GET); |
@@ -237,24 +237,24 @@ discard block |
||
| 237 | 237 | $tmpl = new Etemplate('calendar.toolbar'); |
| 238 | 238 | $tmpl->setElementAttribute('toolbar', 'actions', $this->getToolbarActions($content)); |
| 239 | 239 | // Adjust toolbar for mobile |
| 240 | - if(Api\Header\UserAgent::mobile()){ |
|
| 241 | - $tmpl->setElementAttribute('toolbar','class', 'et2_head_toolbar'); |
|
| 242 | - $tmpl->setElementAttribute('toolbar','view_range', '3'); |
|
| 240 | + if (Api\Header\UserAgent::mobile()) { |
|
| 241 | + $tmpl->setElementAttribute('toolbar', 'class', 'et2_head_toolbar'); |
|
| 242 | + $tmpl->setElementAttribute('toolbar', 'view_range', '3'); |
|
| 243 | 243 | } |
| 244 | - $tmpl->exec('calendar_uiviews::index',array()); |
|
| 244 | + $tmpl->exec('calendar_uiviews::index', array()); |
|
| 245 | 245 | |
| 246 | 246 | // Load the different views once, we'll switch between them on the client side |
| 247 | 247 | $todo = new Etemplate('calendar.todo'); |
| 248 | 248 | $label = ''; |
| 249 | - $todo->exec('calendar_uiviews::index',array('todos'=>$this->get_todos($label), 'label' => $label)); |
|
| 249 | + $todo->exec('calendar_uiviews::index', array('todos'=>$this->get_todos($label), 'label' => $label)); |
|
| 250 | 250 | |
| 251 | 251 | // Actually, this takes care of most of it... |
| 252 | 252 | $this->week(); |
| 253 | 253 | |
| 254 | 254 | $planner = new Etemplate('calendar.planner'); |
| 255 | 255 | // Get the actions |
| 256 | - $planner->setElementAttribute('planner','actions',$this->get_actions()); |
|
| 257 | - $planner->exec('calendar_uiviews::index',array()); |
|
| 256 | + $planner->setElementAttribute('planner', 'actions', $this->get_actions()); |
|
| 257 | + $planner->exec('calendar_uiviews::index', array()); |
|
| 258 | 258 | |
| 259 | 259 | // List view in a separate file |
| 260 | 260 | $list_ui = new calendar_uilist(); |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | { |
| 397 | 397 | foreach (array_keys($actions) as $key) |
| 398 | 398 | { |
| 399 | - if (!in_array($key, array('day_view','week_view','next', 'today','previous'))) { |
|
| 399 | + if (!in_array($key, array('day_view', 'week_view', 'next', 'today', 'previous'))) { |
|
| 400 | 400 | $actions[$key]['toolbarDefault'] = false; |
| 401 | 401 | } |
| 402 | 402 | else { |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | * |
| 415 | 415 | * @param boolean|Etemplate $home = false if etemplate return content suitable for home-page |
| 416 | 416 | */ |
| 417 | - function &planner($content = array(), $home=false) |
|
| 417 | + function &planner($content = array(), $home = false) |
|
| 418 | 418 | { |
| 419 | 419 | if ($this->sortby == 'month') // yearly planner with month rows |
| 420 | 420 | { |
@@ -423,17 +423,17 @@ discard block |
||
| 423 | 423 | unset($this->first['raw']); |
| 424 | 424 | $this->last = $this->first; |
| 425 | 425 | $this->last['year']++; |
| 426 | - $this->last = $this->bo->date2ts($this->last)-1; |
|
| 426 | + $this->last = $this->bo->date2ts($this->last) - 1; |
|
| 427 | 427 | } |
| 428 | 428 | elseif (!$this->planner_view || $this->planner_view == 'month') // planner monthview |
| 429 | 429 | { |
| 430 | 430 | if ($this->day < 15) // show one complete month |
| 431 | 431 | { |
| 432 | - $this->_week_align_month($this->first,$this->last); |
|
| 432 | + $this->_week_align_month($this->first, $this->last); |
|
| 433 | 433 | } |
| 434 | 434 | else // show 2 half month |
| 435 | 435 | { |
| 436 | - $this->_week_align_month($this->first,$this->last,15); |
|
| 436 | + $this->_week_align_month($this->first, $this->last, 15); |
|
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN') // weeekview |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $start->setWeekstart(); |
| 443 | 443 | $this->first = $start->format('ts'); |
| 444 | 444 | $this->last = $this->bo->date2array($this->first); |
| 445 | - $this->last['day'] += ($this->planner_view == 'week' ? 7 : 7 * $this->cal_prefs['multiple_weeks'])-1; |
|
| 445 | + $this->last['day'] += ($this->planner_view == 'week' ? 7 : 7 * $this->cal_prefs['multiple_weeks']) - 1; |
|
| 446 | 446 | $this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59; |
| 447 | 447 | unset($this->last['raw']); |
| 448 | 448 | $this->last = $this->bo->date2ts($this->last); |
@@ -458,9 +458,9 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | $merge = $this->merge(); |
| 461 | - if($merge) |
|
| 461 | + if ($merge) |
|
| 462 | 462 | { |
| 463 | - Egw::redirect_link('/index.php',array( |
|
| 463 | + Egw::redirect_link('/index.php', array( |
|
| 464 | 464 | 'menuaction' => 'calendar.calendar_uiviews.index', |
| 465 | 465 | 'msg' => $merge, |
| 466 | 466 | )); |
@@ -472,21 +472,21 @@ discard block |
||
| 472 | 472 | $search_params['end'] = $this->last; |
| 473 | 473 | $search_params['enum_groups'] = $this->sortby == 'user'; |
| 474 | 474 | $content['planner'] = $this->bo->search($search_params); |
| 475 | - foreach($content['planner'] as &$event) |
|
| 475 | + foreach ($content['planner'] as &$event) |
|
| 476 | 476 | { |
| 477 | 477 | $this->to_client($event); |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3',False,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last)); |
|
| 480 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3', False, $this->date, $this->bo->date2string($this->first), $this->bo->date2string($this->last)); |
|
| 481 | 481 | |
| 482 | 482 | $tmpl = $home ? $home : new Etemplate('calendar.planner'); |
| 483 | 483 | |
| 484 | - $tmpl->setElementAttribute('planner','start_date', Api\DateTime::to($this->first, Api\DateTime::ET2)); |
|
| 485 | - $tmpl->setElementAttribute('planner','end_date', Api\DateTime::to($this->last, Api\DateTime::ET2)); |
|
| 486 | - $tmpl->setElementAttribute('planner','owner', $search_params['users']); |
|
| 487 | - $tmpl->setElementAttribute('planner','group_by', $this->sortby); |
|
| 484 | + $tmpl->setElementAttribute('planner', 'start_date', Api\DateTime::to($this->first, Api\DateTime::ET2)); |
|
| 485 | + $tmpl->setElementAttribute('planner', 'end_date', Api\DateTime::to($this->last, Api\DateTime::ET2)); |
|
| 486 | + $tmpl->setElementAttribute('planner', 'owner', $search_params['users']); |
|
| 487 | + $tmpl->setElementAttribute('planner', 'group_by', $this->sortby); |
|
| 488 | 488 | // Get the actions |
| 489 | - $tmpl->setElementAttribute('planner','actions',$this->get_actions()); |
|
| 489 | + $tmpl->setElementAttribute('planner', 'actions', $this->get_actions()); |
|
| 490 | 490 | |
| 491 | 491 | $tmpl->exec(__METHOD__, $content); |
| 492 | 492 | } |
@@ -499,30 +499,30 @@ discard block |
||
| 499 | 499 | * @param int $weeks = 0 number of weeks to show, if 0 (default) all weeks of one month are shown |
| 500 | 500 | * @param boolean|etemplate2 $home = false if not false return content suitable for home-page |
| 501 | 501 | */ |
| 502 | - function &month($weeks=0,$home=false) |
|
| 502 | + function &month($weeks = 0, $home = false) |
|
| 503 | 503 | { |
| 504 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date); |
|
| 504 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2', True, $weeks, $this->date); |
|
| 505 | 505 | |
| 506 | 506 | if (!$home) |
| 507 | 507 | { |
| 508 | - trigger_error(__METHOD__ .' only used by home app', E_USER_DEPRECATED); |
|
| 508 | + trigger_error(__METHOD__.' only used by home app', E_USER_DEPRECATED); |
|
| 509 | 509 | return; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - $this->use_time_grid = !$this->use_time_grid_pref || $this->use_time_grid_pref == 'all'; // all views |
|
| 512 | + $this->use_time_grid = !$this->use_time_grid_pref || $this->use_time_grid_pref == 'all'; // all views |
|
| 513 | 513 | $granularity = 0; |
| 514 | - if($weeks) |
|
| 514 | + if ($weeks) |
|
| 515 | 515 | { |
| 516 | 516 | $granularity = ($this->cal_prefs['interval'] ? (int)$this->cal_prefs['interval'] : 30); |
| 517 | 517 | |
| 518 | 518 | $list = $this->cal_prefs['use_time_grid']; |
| 519 | - if(!is_array($list)) |
|
| 519 | + if (!is_array($list)) |
|
| 520 | 520 | { |
| 521 | - $list = explode(',',$list); |
|
| 521 | + $list = explode(',', $list); |
|
| 522 | 522 | } |
| 523 | - if(is_array($list)) |
|
| 523 | + if (is_array($list)) |
|
| 524 | 524 | { |
| 525 | - $granularity = in_array('weekN',$list) ? 0 : $granularity; |
|
| 525 | + $granularity = in_array('weekN', $list) ? 0 : $granularity; |
|
| 526 | 526 | } |
| 527 | 527 | } |
| 528 | 528 | $content = array('view' => array()); |
@@ -532,23 +532,23 @@ discard block |
||
| 532 | 532 | $start = new Api\DateTime($this->date); |
| 533 | 533 | $start->setWeekstart(); |
| 534 | 534 | $this->first = $start->format('ts'); |
| 535 | - $this->last = strtotime("+$weeks weeks",$this->first) - 1; |
|
| 535 | + $this->last = strtotime("+$weeks weeks", $this->first) - 1; |
|
| 536 | 536 | $weekNavH = "$weeks weeks"; |
| 537 | 537 | $navHeader = lang('Week').' '.$this->week_number($this->first).' - '.$this->week_number($this->last).': '. |
| 538 | - $this->bo->long_date($this->first,$this->last); |
|
| 538 | + $this->bo->long_date($this->first, $this->last); |
|
| 539 | 539 | } |
| 540 | 540 | else |
| 541 | 541 | { |
| 542 | - $this->_week_align_month($this->first,$this->last); |
|
| 542 | + $this->_week_align_month($this->first, $this->last); |
|
| 543 | 543 | $weekNavH = "1 month"; |
| 544 | - $navHeader = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year; |
|
| 544 | + $navHeader = lang(adodb_date('F', $this->bo->date2ts($this->date))).' '.$this->year; |
|
| 545 | 545 | } |
| 546 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4',False,$weeks,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last)); |
|
| 546 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4', False, $weeks, $this->date, $this->bo->date2string($this->first), $this->bo->date2string($this->last)); |
|
| 547 | 547 | |
| 548 | 548 | // Loop through, using Api\DateTime to handle DST |
| 549 | 549 | $week = 0; |
| 550 | 550 | $week_start = new EGroupware\Api\DateTime($this->first); |
| 551 | - $week_start->setTime(0,0,0); |
|
| 551 | + $week_start->setTime(0, 0, 0); |
|
| 552 | 552 | $week_end = new Api\DateTime($week_start); |
| 553 | 553 | $week_end->add(new DateInterval('P6DT23H59M59S')); |
| 554 | 554 | $last = new EGroupware\Api\DateTime($this->last); |
@@ -562,14 +562,14 @@ discard block |
||
| 562 | 562 | array( |
| 563 | 563 | 'id' => $week_start->format('Ymd') |
| 564 | 564 | ); |
| 565 | - $home->setElementAttribute("view[$week]",'onchange',false); |
|
| 566 | - $home->setElementAttribute("view[$week]",'granularity',$granularity); |
|
| 567 | - $home->setElementAttribute("view[$week]",'show_weekend', $this->search_params['weekend']); |
|
| 565 | + $home->setElementAttribute("view[$week]", 'onchange', false); |
|
| 566 | + $home->setElementAttribute("view[$week]", 'granularity', $granularity); |
|
| 567 | + $home->setElementAttribute("view[$week]", 'show_weekend', $this->search_params['weekend']); |
|
| 568 | 568 | $week++; |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | // Get the actions |
| 572 | - $home->setElementAttribute('view','actions',$this->get_actions()); |
|
| 572 | + $home->setElementAttribute('view', 'actions', $this->get_actions()); |
|
| 573 | 573 | |
| 574 | 574 | $home->exec(__METHOD__, $content); |
| 575 | 575 | } |
@@ -581,13 +581,13 @@ discard block |
||
| 581 | 581 | * @param int &$last timestamp 23:59:59 of last day of week containg the last day of the current month |
| 582 | 582 | * @param int $day = 1 should the alignment be based on the 1. of the month or an other date, eg. the 15. |
| 583 | 583 | */ |
| 584 | - function _week_align_month(&$first,&$last,$day=1) |
|
| 584 | + function _week_align_month(&$first, &$last, $day = 1) |
|
| 585 | 585 | { |
| 586 | 586 | $start = new Api\DateTime($this->date); |
| 587 | - $start->setDate($this->year,$this->month,$this->day=$day); |
|
| 587 | + $start->setDate($this->year, $this->month, $this->day = $day); |
|
| 588 | 588 | $start->setWeekstart(); |
| 589 | 589 | $first = $start->format('ts'); |
| 590 | - $start->setDate($this->year,$this->month+1,$day); |
|
| 590 | + $start->setDate($this->year, $this->month + 1, $day); |
|
| 591 | 591 | if ($day == 1) $start->add('-1day'); |
| 592 | 592 | $start->setWeekstart(); |
| 593 | 593 | // now we need to calculate the end of the last day of that week |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | $arr['day'] += 6; |
| 597 | 597 | $arr['hour'] = 23; |
| 598 | 598 | $arr['min'] = $arr['sec'] = 59; |
| 599 | - unset($arr['raw']); // otherwise date2ts does not calc raw new, but uses it |
|
| 599 | + unset($arr['raw']); // otherwise date2ts does not calc raw new, but uses it |
|
| 600 | 600 | $last = $this->bo->date2ts($arr); |
| 601 | 601 | } |
| 602 | 602 | |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | * @param int $days = 0 number of days to show, if 0 (default) the value from the URL or the prefs is used |
| 607 | 607 | * @param boolean|etemplate2 $home = false if not false return content suitable for home-page |
| 608 | 608 | */ |
| 609 | - function week($days=0,$home=false) |
|
| 609 | + function week($days = 0, $home = false) |
|
| 610 | 610 | { |
| 611 | 611 | if (!$days) |
| 612 | 612 | { |
@@ -614,17 +614,17 @@ discard block |
||
| 614 | 614 | if ($days != 5) $days = 7; |
| 615 | 615 | if ($days != $this->cal_prefs['days_in_weekview']) // save the preference |
| 616 | 616 | { |
| 617 | - $GLOBALS['egw']->preferences->add('calendar','days_in_weekview',$days); |
|
| 617 | + $GLOBALS['egw']->preferences->add('calendar', 'days_in_weekview', $days); |
|
| 618 | 618 | $GLOBALS['egw']->preferences->save_repository(); |
| 619 | 619 | $this->cal_prefs['days_in_weekview'] = $days; |
| 620 | 620 | } |
| 621 | 621 | } |
| 622 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2',True,$days,$this->date); |
|
| 622 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2', True, $days, $this->date); |
|
| 623 | 623 | |
| 624 | 624 | if ($days <= 4) // next 4 days view |
| 625 | 625 | { |
| 626 | 626 | $wd_start = $this->first = $this->bo->date2ts($this->date); |
| 627 | - $this->last = strtotime("+$days days",$this->first) - 1; |
|
| 627 | + $this->last = strtotime("+$days days", $this->first) - 1; |
|
| 628 | 628 | $view = $days == 1 ? 'day' : 'day4'; |
| 629 | 629 | } |
| 630 | 630 | else |
@@ -634,30 +634,30 @@ discard block |
||
| 634 | 634 | $wd_start = $this->first = $start->format('ts'); |
| 635 | 635 | if ($days <= 5) // no weekend-days |
| 636 | 636 | { |
| 637 | - switch($this->cal_prefs['weekdaystarts']) |
|
| 637 | + switch ($this->cal_prefs['weekdaystarts']) |
|
| 638 | 638 | { |
| 639 | 639 | case 'Saturday': |
| 640 | - $this->first = strtotime("+2 days",$this->first); |
|
| 640 | + $this->first = strtotime("+2 days", $this->first); |
|
| 641 | 641 | break; |
| 642 | 642 | case 'Sunday': |
| 643 | - $this->first = strtotime("+1 day",$this->first); |
|
| 643 | + $this->first = strtotime("+1 day", $this->first); |
|
| 644 | 644 | break; |
| 645 | 645 | } |
| 646 | 646 | } |
| 647 | - $this->last = strtotime("+$days days",$this->first) - 1; |
|
| 647 | + $this->last = strtotime("+$days days", $this->first) - 1; |
|
| 648 | 648 | $view = 'week'; |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | $granularity = ($this->cal_prefs['interval'] ? (int)$this->cal_prefs['interval'] : 30); |
| 652 | 652 | |
| 653 | 653 | $list = $this->cal_prefs['use_time_grid']; |
| 654 | - if(!is_array($list)) |
|
| 654 | + if (!is_array($list)) |
|
| 655 | 655 | { |
| 656 | - $list = explode(',',$list); |
|
| 656 | + $list = explode(',', $list); |
|
| 657 | 657 | } |
| 658 | - if(is_array($list)) |
|
| 658 | + if (is_array($list)) |
|
| 659 | 659 | { |
| 660 | - $granularity = in_array($view,$list) ? 0 : $granularity; |
|
| 660 | + $granularity = in_array($view, $list) ? 0 : $granularity; |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | $search_params = array( |
@@ -670,15 +670,15 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | $content = array('view' => array()); |
| 672 | 672 | |
| 673 | - if(!$home) |
|
| 673 | + if (!$home) |
|
| 674 | 674 | { |
| 675 | 675 | // Fill with the minimum needed 'weeks' |
| 676 | 676 | $min = max( |
| 677 | 677 | 6, // Some months need 6 weeks for full display |
| 678 | - $this->cal_prefs['multiple_weeks'], // WeekN view |
|
| 678 | + $this->cal_prefs['multiple_weeks'], // WeekN view |
|
| 679 | 679 | $this->cal_prefs['week_consolidate'] // We collapse after this many users |
| 680 | 680 | ); |
| 681 | - for($i = 0; $i < $min; $i++) |
|
| 681 | + for ($i = 0; $i < $min; $i++) |
|
| 682 | 682 | { |
| 683 | 683 | $content['view'][] = array(); |
| 684 | 684 | } |
@@ -686,8 +686,8 @@ discard block |
||
| 686 | 686 | else |
| 687 | 687 | { |
| 688 | 688 | // Always do 7 days for a week so scrolling works properly |
| 689 | - $this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days",$this->first) - 1); |
|
| 690 | - if (count($users) == 1 || count($users) >= $this->cal_prefs['week_consolidate'] ||// for more then X users, show all in one row |
|
| 689 | + $this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days", $this->first) - 1); |
|
| 690 | + if (count($users) == 1 || count($users) >= $this->cal_prefs['week_consolidate'] || // for more then X users, show all in one row |
|
| 691 | 691 | $days == 1 // Showing just 1 day |
| 692 | 692 | ) |
| 693 | 693 | { |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | } |
| 697 | 697 | else |
| 698 | 698 | { |
| 699 | - foreach(array_keys($this->_get_planner_users(false)) as $uid) |
|
| 699 | + foreach (array_keys($this->_get_planner_users(false)) as $uid) |
|
| 700 | 700 | { |
| 701 | 701 | $search_params['users'] = $uid; |
| 702 | 702 | $content['view'][] = $this->tagWholeDayOnTop($this->bo->search($search_params)) |
@@ -704,15 +704,15 @@ discard block |
||
| 704 | 704 | } |
| 705 | 705 | } |
| 706 | 706 | } |
| 707 | - $tmpl = $home ? $home :new Etemplate('calendar.view'); |
|
| 708 | - foreach(array_keys($content['view']) as $index) |
|
| 707 | + $tmpl = $home ? $home : new Etemplate('calendar.view'); |
|
| 708 | + foreach (array_keys($content['view']) as $index) |
|
| 709 | 709 | { |
| 710 | - $tmpl->setElementAttribute("view[$index]",'granularity',$granularity); |
|
| 711 | - $tmpl->setElementAttribute("view[$index]",'show_weekend',$this->search_params['weekend']); |
|
| 710 | + $tmpl->setElementAttribute("view[$index]", 'granularity', $granularity); |
|
| 711 | + $tmpl->setElementAttribute("view[$index]", 'show_weekend', $this->search_params['weekend']); |
|
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | // Get the actions |
| 715 | - $tmpl->setElementAttribute('view','actions',$this->get_actions()); |
|
| 715 | + $tmpl->setElementAttribute('view', 'actions', $this->get_actions()); |
|
| 716 | 716 | |
| 717 | 717 | $tmpl->exec(__METHOD__, $content); |
| 718 | 718 | } |
@@ -754,57 +754,56 @@ discard block |
||
| 754 | 754 | 'owner' => $this->owner // num. id of the user, not necessary current user |
| 755 | 755 | )); |
| 756 | 756 | |
| 757 | - if(is_array($todo_label)) |
|
| 757 | + if (is_array($todo_label)) |
|
| 758 | 758 | { |
| 759 | - list($label,$showall)=$todo_label; |
|
| 759 | + list($label, $showall) = $todo_label; |
|
| 760 | 760 | } |
| 761 | 761 | else |
| 762 | 762 | { |
| 763 | - $label=$todo_label; |
|
| 764 | - $showall=true; |
|
| 763 | + $label = $todo_label; |
|
| 764 | + $showall = true; |
|
| 765 | 765 | } |
| 766 | 766 | $maxshow = (int)$GLOBALS['egw_info']['user']['preferences']['infolog']['mainscreen_maxshow']; |
| 767 | - if($maxshow <= 0) |
|
| 767 | + if ($maxshow <= 0) |
|
| 768 | 768 | { |
| 769 | - $maxshow=10; |
|
| 769 | + $maxshow = 10; |
|
| 770 | 770 | } |
| 771 | 771 | //print_debug("get_todos(): label=$label; showall=$showall; max=$maxshow"); |
| 772 | 772 | |
| 773 | 773 | $content = $todo_label = ''; |
| 774 | 774 | if (is_array($todos_from_hook) && count($todos_from_hook)) |
| 775 | 775 | { |
| 776 | - foreach($todos_from_hook as $todos) |
|
| 776 | + foreach ($todos_from_hook as $todos) |
|
| 777 | 777 | { |
| 778 | 778 | $i = 0; |
| 779 | 779 | if (is_array($todos)) |
| 780 | 780 | { |
| 781 | 781 | $todo_label = !empty($label) ? $label : lang("open ToDo's:"); |
| 782 | 782 | |
| 783 | - foreach($todos as &$todo) |
|
| 783 | + foreach ($todos as &$todo) |
|
| 784 | 784 | { |
| 785 | - if(!$showall && ($i++ > $maxshow)) |
|
| 785 | + if (!$showall && ($i++ > $maxshow)) |
|
| 786 | 786 | { |
| 787 | 787 | break; |
| 788 | 788 | } |
| 789 | 789 | $icons = ''; |
| 790 | - foreach($todo['icons'] as $name => $alt) |
|
| 790 | + foreach ($todo['icons'] as $name => $alt) |
|
| 791 | 791 | { |
| 792 | - $icons .= ($icons?' ':'').Api\Html::image('infolog',$name,lang($alt),'border="0" width="15" height="15"'); |
|
| 792 | + $icons .= ($icons ? ' ' : '').Api\Html::image('infolog', $name, lang($alt), 'border="0" width="15" height="15"'); |
|
| 793 | 793 | } |
| 794 | 794 | $todo['icons'] = $icons; |
| 795 | 795 | $class = $class == 'row_on' ? 'row_off' : 'row_on'; |
| 796 | - if($todo['edit']) { |
|
| 796 | + if ($todo['edit']) { |
|
| 797 | 797 | $todo['edit_size'] = $todo['edit']['size']; |
| 798 | 798 | unset($todo['edit']['size']); |
| 799 | - $edit_icon_href = Api\Html::a_href( $icons, $todo['edit'],'',' data-todo="app|750x590" '); |
|
| 800 | - $edit_href = Api\Html::a_href( $todo['title'], $todo['edit'],'',' data-todo="app|750x590" '); |
|
| 801 | - $todo['edit'] = Framework::link('/index.php',$todo['edit'],true); |
|
| 799 | + $edit_icon_href = Api\Html::a_href($icons, $todo['edit'], '', ' data-todo="app|750x590" '); |
|
| 800 | + $edit_href = Api\Html::a_href($todo['title'], $todo['edit'], '', ' data-todo="app|750x590" '); |
|
| 801 | + $todo['edit'] = Framework::link('/index.php', $todo['edit'], true); |
|
| 802 | 802 | } |
| 803 | - $icon_href = Api\Html::a_href($icons,$todo['view']); |
|
| 803 | + $icon_href = Api\Html::a_href($icons, $todo['view']); |
|
| 804 | 804 | $content .= " <tr class=\"$class\">\n <td valign=\"top\" width=\"15%\" nowrap>". |
| 805 | - ($this->bo->printer_friendly?$icons:($edit_icon_href ? $edit_icon_href : $icon_href)). |
|
| 806 | - "</td>\n <td>".($this->printer_friendly?$todo['title']: |
|
| 807 | - $edit_href)."</td>\n </tr>\n"; |
|
| 805 | + ($this->bo->printer_friendly ? $icons : ($edit_icon_href ? $edit_icon_href : $icon_href)). |
|
| 806 | + "</td>\n <td>".($this->printer_friendly ? $todo['title'] : $edit_href)."</td>\n </tr>\n"; |
|
| 808 | 807 | /** |
| 809 | 808 | * ToDo: add delete and closing action |
| 810 | 809 | */ |
@@ -827,9 +826,9 @@ discard block |
||
| 827 | 826 | * @param int|string $id |
| 828 | 827 | * @return string |
| 829 | 828 | */ |
| 830 | - public static function integration_get_popup($app,$id) |
|
| 829 | + public static function integration_get_popup($app, $id) |
|
| 831 | 830 | { |
| 832 | - $app_data = calendar_bo::integration_get_data($app,'edit_link'); |
|
| 831 | + $app_data = calendar_bo::integration_get_data($app, 'edit_link'); |
|
| 833 | 832 | |
| 834 | 833 | if (is_array($app_data) && isset($app_data['edit'])) |
| 835 | 834 | { |
@@ -839,7 +838,7 @@ discard block |
||
| 839 | 838 | } |
| 840 | 839 | else |
| 841 | 840 | { |
| 842 | - $edit = Link::edit($app,$id,$popup_size); |
|
| 841 | + $edit = Link::edit($app, $id, $popup_size); |
|
| 843 | 842 | } |
| 844 | 843 | if ($edit) |
| 845 | 844 | { |
@@ -868,28 +867,28 @@ discard block |
||
| 868 | 867 | * @param array $event |
| 869 | 868 | * @return array |
| 870 | 869 | */ |
| 871 | - static function integration_get_icons($app,$id,$event) |
|
| 870 | + static function integration_get_icons($app, $id, $event) |
|
| 872 | 871 | { |
| 873 | 872 | $icons = array(); |
| 874 | 873 | if ($event['icons']) |
| 875 | 874 | { |
| 876 | - foreach(explode(',',$event['icons']) as $icon) |
|
| 875 | + foreach (explode(',', $event['icons']) as $icon) |
|
| 877 | 876 | { |
| 878 | - list($icon_app,$icon) = explode(':',$icon); |
|
| 879 | - if (Api\Image::find($icon_app,$icon)) |
|
| 877 | + list($icon_app, $icon) = explode(':', $icon); |
|
| 878 | + if (Api\Image::find($icon_app, $icon)) |
|
| 880 | 879 | { |
| 881 | - $icons[] = Api\Html::image($icon_app,$icon); |
|
| 880 | + $icons[] = Api\Html::image($icon_app, $icon); |
|
| 882 | 881 | } |
| 883 | 882 | } |
| 884 | 883 | } |
| 885 | - $app_data = calendar_bo::integration_get_data($app,'icons'); |
|
| 884 | + $app_data = calendar_bo::integration_get_data($app, 'icons'); |
|
| 886 | 885 | if (is_null($app_data)) |
| 887 | 886 | { |
| 888 | - $icons[] = Api\Html::image($app,'navbar'); // use navbar icon |
|
| 887 | + $icons[] = Api\Html::image($app, 'navbar'); // use navbar icon |
|
| 889 | 888 | } |
| 890 | 889 | elseif ($app_data) |
| 891 | 890 | { |
| 892 | - $icons += (array)ExecMethod2($app_data,$id,$event); |
|
| 891 | + $icons += (array)ExecMethod2($app_data, $id, $event); |
|
| 893 | 892 | } |
| 894 | 893 | return $icons; |
| 895 | 894 | } |
@@ -912,20 +911,20 @@ discard block |
||
| 912 | 911 | unset($actions['select_all']); |
| 913 | 912 | |
| 914 | 913 | // This disables the event actions for the grid rows (calendar weeks/owners) |
| 915 | - foreach($actions as $id => &$action) |
|
| 914 | + foreach ($actions as $id => &$action) |
|
| 916 | 915 | { |
| 917 | - if($id=='add') continue; |
|
| 918 | - if(!$action['enabled']) |
|
| 916 | + if ($id == 'add') continue; |
|
| 917 | + if (!$action['enabled']) |
|
| 919 | 918 | { |
| 920 | 919 | $action['enabled'] = 'javaScript:app.calendar.is_event'; |
| 921 | 920 | } |
| 922 | 921 | } |
| 923 | 922 | $actions['add']['open'] = '{"app":"calendar","type":"add"}'; |
| 924 | - $actions['add']['onExecute'] = 'javaScript:app.calendar.action_open'; |
|
| 923 | + $actions['add']['onExecute'] = 'javaScript:app.calendar.action_open'; |
|
| 925 | 924 | $actions['copy']['open'] = '{"app": "calendar", "type": "add", "extra": "cal_id=$id&action=copy"}'; |
| 926 | 925 | $actions['copy']['onExecute'] = 'javaScript:app.calendar.action_open'; |
| 927 | 926 | |
| 928 | - foreach($actions['status']['children'] as $id => &$status) |
|
| 927 | + foreach ($actions['status']['children'] as $id => &$status) |
|
| 929 | 928 | { |
| 930 | 929 | $status = array( |
| 931 | 930 | 'id' => $id, |
@@ -936,7 +935,7 @@ discard block |
||
| 936 | 935 | |
| 937 | 936 | if ($actions['filemanager']) |
| 938 | 937 | { |
| 939 | - $actions['filemanager']['url'] = '/index.php?'. $actions['filemanager']['url']; |
|
| 938 | + $actions['filemanager']['url'] = '/index.php?'.$actions['filemanager']['url']; |
|
| 940 | 939 | $actions['filemanager']['onExecute'] = 'javaScript:app.calendar.action_open'; |
| 941 | 940 | } |
| 942 | 941 | if ($actions['infolog_app']) |
@@ -981,26 +980,26 @@ discard block |
||
| 981 | 980 | { |
| 982 | 981 | $start = $this->bo->date2array($event['start']); |
| 983 | 982 | $end = $this->bo->date2array($event['end']); |
| 984 | - if(!$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59) |
|
| 983 | + if (!$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59) |
|
| 985 | 984 | { |
| 986 | - if($event['non_blocking']) |
|
| 985 | + if ($event['non_blocking']) |
|
| 987 | 986 | { |
| 988 | - $dayEvents[$day][$num]['whole_day_on_top']=true; |
|
| 989 | - $this->whole_day_positions[$num]=($this->rowHeight*($num+2)); |
|
| 987 | + $dayEvents[$day][$num]['whole_day_on_top'] = true; |
|
| 988 | + $this->whole_day_positions[$num] = ($this->rowHeight * ($num + 2)); |
|
| 990 | 989 | $extraRowsToAdd++; |
| 991 | 990 | } |
| 992 | 991 | else |
| 993 | 992 | { |
| 994 | - $dayEvents[$day][$num]['whole_day']=true; |
|
| 993 | + $dayEvents[$day][$num]['whole_day'] = true; |
|
| 995 | 994 | } |
| 996 | 995 | } |
| 997 | 996 | $this->to_client($dayEvents[$day][$num]); |
| 998 | 997 | } |
| 999 | 998 | // check after every day if we have to increase $this->extraRows |
| 1000 | - if(($this->extraRowsOriginal+$extraRowsToAdd) > $this->extraRows) |
|
| 999 | + if (($this->extraRowsOriginal + $extraRowsToAdd) > $this->extraRows) |
|
| 1001 | 1000 | { |
| 1002 | 1001 | $this->remBotExtraRows = $extraRowsToAdd; |
| 1003 | - $this->extraRows = ($this->extraRowsOriginal+$extraRowsToAdd); |
|
| 1002 | + $this->extraRows = ($this->extraRowsOriginal + $extraRowsToAdd); |
|
| 1004 | 1003 | } |
| 1005 | 1004 | } |
| 1006 | 1005 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @var $debug mixed integer level or string function-name |
| 35 | 35 | */ |
| 36 | - var $debug=false; |
|
| 36 | + var $debug = false; |
|
| 37 | 37 | /** |
| 38 | 38 | * instance of the bocal or bocalupdate class |
| 39 | 39 | * |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | /** |
| 128 | 128 | * @var array $states_to_save all states that will be saved to the user prefs |
| 129 | 129 | */ |
| 130 | - var $states_to_save = array('owner','status_filter','filter','cat_id','view','sortby','planner_view','weekend'); |
|
| 130 | + var $states_to_save = array('owner', 'status_filter', 'filter', 'cat_id', 'view', 'sortby', 'planner_view', 'weekend'); |
|
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | 133 | * Constructor |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param boolean $use_boupdate use bocalupdate as parenent instead of bocal |
| 136 | 136 | * @param array $set_states to manualy set / change one of the states, default NULL = use $_REQUEST |
| 137 | 137 | */ |
| 138 | - function __construct($use_boupdate=false,$set_states=NULL) |
|
| 138 | + function __construct($use_boupdate = false, $set_states = NULL) |
|
| 139 | 139 | { |
| 140 | 140 | if ($use_boupdate) |
| 141 | 141 | { |
@@ -146,27 +146,27 @@ discard block |
||
| 146 | 146 | $this->bo = new calendar_bo(); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $this->categories = new Api\Categories($this->user,'calendar'); |
|
| 149 | + $this->categories = new Api\Categories($this->user, 'calendar'); |
|
| 150 | 150 | |
| 151 | - $this->common_prefs = &$GLOBALS['egw_info']['user']['preferences']['common']; |
|
| 151 | + $this->common_prefs = &$GLOBALS['egw_info']['user']['preferences']['common']; |
|
| 152 | 152 | $this->cal_prefs = &$GLOBALS['egw_info']['user']['preferences']['calendar']; |
| 153 | 153 | $this->bo->check_set_default_prefs(); |
| 154 | 154 | |
| 155 | - $this->wd_start = 60*$this->cal_prefs['workdaystarts']; |
|
| 156 | - $this->wd_end = 60*$this->cal_prefs['workdayends']; |
|
| 157 | - $this->interval_m = $this->cal_prefs['interval']; |
|
| 155 | + $this->wd_start = 60 * $this->cal_prefs['workdaystarts']; |
|
| 156 | + $this->wd_end = 60 * $this->cal_prefs['workdayends']; |
|
| 157 | + $this->interval_m = $this->cal_prefs['interval']; |
|
| 158 | 158 | |
| 159 | 159 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
| 160 | 160 | |
| 161 | 161 | $this->manage_states($set_states); |
| 162 | 162 | |
| 163 | - $GLOBALS['uical'] = &$this; // make us available for ExecMethod, else it creates a new instance |
|
| 163 | + $GLOBALS['uical'] = &$this; // make us available for ExecMethod, else it creates a new instance |
|
| 164 | 164 | |
| 165 | 165 | // calendar does not work with hidden sidebox atm. |
| 166 | 166 | unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); |
| 167 | 167 | |
| 168 | 168 | // make sure the hook for export_limit is registered |
| 169 | - if (!Api\Hooks::exists('export_limit','calendar')) Api\Hooks::read(true); |
|
| 169 | + if (!Api\Hooks::exists('export_limit', 'calendar')) Api\Hooks::read(true); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -179,21 +179,21 @@ discard block |
||
| 179 | 179 | function check_owners_access($users = null, &$no_access = array()) |
| 180 | 180 | { |
| 181 | 181 | $no_access = $no_access_group = array(); |
| 182 | - $owner_array = $users ? $users : explode(',',$this->owner); |
|
| 183 | - foreach($owner_array as $idx => $owner) |
|
| 182 | + $owner_array = $users ? $users : explode(',', $this->owner); |
|
| 183 | + foreach ($owner_array as $idx => $owner) |
|
| 184 | 184 | { |
| 185 | 185 | $owner = trim($owner); |
| 186 | 186 | if (is_numeric($owner) && $GLOBALS['egw']->accounts->get_type($owner) == 'g') |
| 187 | 187 | { |
| 188 | - foreach($GLOBALS['egw']->accounts->members($owner, true) as $member) |
|
| 188 | + foreach ($GLOBALS['egw']->accounts->members($owner, true) as $member) |
|
| 189 | 189 | { |
| 190 | - if (!$this->bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY,0,$member)) |
|
| 190 | + if (!$this->bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY, 0, $member)) |
|
| 191 | 191 | { |
| 192 | 192 | $no_access_group[$member] = $this->bo->participant_name($member); |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | - elseif (!$this->bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY,0,$owner)) |
|
| 196 | + elseif (!$this->bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY, 0, $owner)) |
|
| 197 | 197 | { |
| 198 | 198 | $no_access[$owner] = $this->bo->participant_name($owner); |
| 199 | 199 | unset($owner_array[$idx]); |
@@ -201,14 +201,14 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | if (count($no_access)) |
| 203 | 203 | { |
| 204 | - $message = lang('Access denied to the calendar of %1 !!!',implode(', ',$no_access)); |
|
| 205 | - Framework::message($message,'error'); |
|
| 206 | - $this->owner = implode(',',$owner_array); |
|
| 204 | + $message = lang('Access denied to the calendar of %1 !!!', implode(', ', $no_access)); |
|
| 205 | + Framework::message($message, 'error'); |
|
| 206 | + $this->owner = implode(',', $owner_array); |
|
| 207 | 207 | return $message; |
| 208 | 208 | } |
| 209 | 209 | if (count($no_access_group)) |
| 210 | 210 | { |
| 211 | - $this->bo->warnings['groupmembers'] = lang('Groupmember(s) %1 not included, because you have no access.',implode(', ',$no_access_group)); |
|
| 211 | + $this->bo->warnings['groupmembers'] = lang('Groupmember(s) %1 not included, because you have no access.', implode(', ', $no_access_group)); |
|
| 212 | 212 | } |
| 213 | 213 | return false; |
| 214 | 214 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * - view: the actual view, where dialogs should return to or which they refresh |
| 228 | 228 | * @param array $set_states array to manualy set / change one of the states, default NULL = use $_REQUEST |
| 229 | 229 | */ |
| 230 | - function manage_states($set_states=NULL) |
|
| 230 | + function manage_states($set_states = NULL) |
|
| 231 | 231 | { |
| 232 | 232 | // retrieve saved states from prefs |
| 233 | 233 | $states = is_array($this->bo->cal_prefs['saved_states']) ? |
@@ -247,12 +247,12 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | else |
| 249 | 249 | { |
| 250 | - parse_str(substr($json_data['request']['parameters'][0], 10), $set_states); // cut off "/index.php?" |
|
| 250 | + parse_str(substr($json_data['request']['parameters'][0], 10), $set_states); // cut off "/index.php?" |
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | else |
| 254 | 254 | { |
| 255 | - $set_states = substr($_GET['menuaction'],0,9) == 'calendar.' ? $_REQUEST : array(); |
|
| 255 | + $set_states = substr($_GET['menuaction'], 0, 9) == 'calendar.' ? $_REQUEST : array(); |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | if (!$states['date'] && $states['year'] && $states['month'] && $states['day']) |
@@ -260,16 +260,16 @@ discard block |
||
| 260 | 260 | $states['date'] = $this->bo->date2string($states); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - foreach(array( |
|
| 263 | + foreach (array( |
|
| 264 | 264 | 'date' => $this->bo->date2string($this->bo->now_su), |
| 265 | 265 | 'cat_id' => 0, |
| 266 | 266 | 'status_filter' => 'default', |
| 267 | 267 | 'owner' => $this->user, |
| 268 | 268 | 'save_owner' => 0, |
| 269 | 269 | 'sortby' => 'category', |
| 270 | - 'planner_view'=> 'month', // full month |
|
| 271 | - 'view' => ($this->bo->cal_prefs['defaultcalendar']?$this->bo->cal_prefs['defaultcalendar']:'day'), // use pref, if exists else use the dayview |
|
| 272 | - 'listview_days'=> '', // no range |
|
| 270 | + 'planner_view'=> 'month', // full month |
|
| 271 | + 'view' => ($this->bo->cal_prefs['defaultcalendar'] ? $this->bo->cal_prefs['defaultcalendar'] : 'day'), // use pref, if exists else use the dayview |
|
| 272 | + 'listview_days'=> '', // no range |
|
| 273 | 273 | 'test' => 'false', |
| 274 | 274 | ) as $state => $default) |
| 275 | 275 | { |
@@ -278,42 +278,42 @@ discard block |
||
| 278 | 278 | if ($state == 'owner') |
| 279 | 279 | { |
| 280 | 280 | // only change the owners of the same resource-type as given in set_state[owner] |
| 281 | - $set_owners = is_array($set_states['owner']) ? $set_states['owner'] : explode(',',$set_states['owner']); |
|
| 281 | + $set_owners = is_array($set_states['owner']) ? $set_states['owner'] : explode(',', $set_states['owner']); |
|
| 282 | 282 | if ((string)$set_owners[0] === '0') // set exactly the specified owners (without the 0) |
| 283 | 283 | { |
| 284 | 284 | if ($set_states['owner'] === '0,r0') // small fix for resources |
| 285 | 285 | { |
| 286 | - $set_states['owner'] = $default; // --> set default, instead of none |
|
| 286 | + $set_states['owner'] = $default; // --> set default, instead of none |
|
| 287 | 287 | } |
| 288 | 288 | else |
| 289 | 289 | { |
| 290 | - $set_states['owner'] = substr($set_states['owner'],2); |
|
| 290 | + $set_states['owner'] = substr($set_states['owner'], 2); |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | else // change only the owners of the given type |
| 294 | 294 | { |
| 295 | 295 | $res_type = is_numeric($set_owners[0]) ? false : $set_owners[0][0]; |
| 296 | 296 | $owners = $states['owner'] ? $states['owner'] : $default; |
| 297 | - if(!is_array($owners)) |
|
| 297 | + if (!is_array($owners)) |
|
| 298 | 298 | { |
| 299 | - $owners = explode(',',$owners); |
|
| 299 | + $owners = explode(',', $owners); |
|
| 300 | 300 | } |
| 301 | - foreach($owners as $key => $owner) |
|
| 301 | + foreach ($owners as $key => $owner) |
|
| 302 | 302 | { |
| 303 | 303 | if (!$res_type && is_numeric($owner) || $res_type && $owner[0] == $res_type) |
| 304 | 304 | { |
| 305 | 305 | unset($owners[$key]); |
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | - if (!$res_type || !in_array($res_type.'0',$set_owners)) |
|
| 308 | + if (!$res_type || !in_array($res_type.'0', $set_owners)) |
|
| 309 | 309 | { |
| 310 | - $owners = array_merge($owners,$set_owners); |
|
| 310 | + $owners = array_merge($owners, $set_owners); |
|
| 311 | 311 | } |
| 312 | - $set_states['owner'] = implode(',',$owners); |
|
| 312 | + $set_states['owner'] = implode(',', $owners); |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | // for the uiforms class (eg. edit), dont store the (new) owner, as it might change the view |
| 316 | - if (substr($_GET['menuaction'],0,25) == 'calendar.calendar_uiforms') |
|
| 316 | + if (substr($_GET['menuaction'], 0, 25) == 'calendar.calendar_uiforms') |
|
| 317 | 317 | { |
| 318 | 318 | $this->owner = $set_states[$state]; |
| 319 | 319 | continue; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | if ($state == 'date') |
| 328 | 328 | { |
| 329 | 329 | $date_arr = $this->bo->date2array($states['date']); |
| 330 | - foreach(array('year','month','day') as $name) |
|
| 330 | + foreach (array('year', 'month', 'day') as $name) |
|
| 331 | 331 | { |
| 332 | 332 | $this->$name = $states[$name] = $date_arr[$name]; |
| 333 | 333 | } |
@@ -335,16 +335,16 @@ discard block |
||
| 335 | 335 | $this->$state = $states[$state]; |
| 336 | 336 | } |
| 337 | 337 | // remove a given calendar from the view |
| 338 | - if (isset($_GET['close']) && ($k = array_search($_GET['close'], $owners=explode(',',$this->owner))) !== false) |
|
| 338 | + if (isset($_GET['close']) && ($k = array_search($_GET['close'], $owners = explode(',', $this->owner))) !== false) |
|
| 339 | 339 | { |
| 340 | 340 | unset($owners[$k]); |
| 341 | - $this->owner = $states['owner'] = implode(',',$owners); |
|
| 341 | + $this->owner = $states['owner'] = implode(',', $owners); |
|
| 342 | 342 | } |
| 343 | - if(is_array($this->owner)) |
|
| 343 | + if (is_array($this->owner)) |
|
| 344 | 344 | { |
| 345 | - $this->owner = implode(',',$this->owner); |
|
| 345 | + $this->owner = implode(',', $this->owner); |
|
| 346 | 346 | } |
| 347 | - if (substr($this->view,0,8) == 'planner_') |
|
| 347 | + if (substr($this->view, 0, 8) == 'planner_') |
|
| 348 | 348 | { |
| 349 | 349 | $states['sortby'] = $this->sortby = $this->view == 'planner_cat' ? 'category' : 'user'; |
| 350 | 350 | $states['view'] = $this->view = 'planner'; |
@@ -352,10 +352,10 @@ discard block |
||
| 352 | 352 | // set the actual view as return_to |
| 353 | 353 | if (isset($_GET['menuaction'])) |
| 354 | 354 | { |
| 355 | - list(,$class,$func) = explode('.',$_GET['menuaction']); |
|
| 355 | + list(,$class, $func) = explode('.', $_GET['menuaction']); |
|
| 356 | 356 | if ($func == 'index') |
| 357 | 357 | { |
| 358 | - $func = $this->view; $this->view = 'index'; // switch to the default view |
|
| 358 | + $func = $this->view; $this->view = 'index'; // switch to the default view |
|
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | else // eg. calendar/index.php |
@@ -369,18 +369,18 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | $this->view_menuaction = $this->view == 'listview' ? 'calendar.calendar_uilist.listview' : 'calendar.calendar_uiviews.index'; |
| 371 | 371 | |
| 372 | - if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1), states now %3',True,$set_states,$states); |
|
| 372 | + if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1), states now %3', True, $set_states, $states); |
|
| 373 | 373 | // save the states in the session only when we are in calendar |
| 374 | - if ($GLOBALS['egw_info']['flags']['currentapp']=='calendar') |
|
| 374 | + if ($GLOBALS['egw_info']['flags']['currentapp'] == 'calendar') |
|
| 375 | 375 | { |
| 376 | 376 | // save defined states into the user-prefs |
| 377 | - if(!empty($states) && is_array($states)) |
|
| 377 | + if (!empty($states) && is_array($states)) |
|
| 378 | 378 | { |
| 379 | - $saved_states = array_intersect_key($states,array_flip($this->states_to_save)); |
|
| 379 | + $saved_states = array_intersect_key($states, array_flip($this->states_to_save)); |
|
| 380 | 380 | if ($saved_states != $this->cal_prefs['saved_states']) |
| 381 | 381 | { |
| 382 | - $GLOBALS['egw']->preferences->add('calendar','saved_states',$saved_states); |
|
| 383 | - $GLOBALS['egw']->preferences->save_repository(false,'user',true); |
|
| 382 | + $GLOBALS['egw']->preferences->add('calendar', 'saved_states', $saved_states); |
|
| 383 | + $GLOBALS['egw']->preferences->save_repository(false, 'user', true); |
|
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | } |
@@ -394,35 +394,35 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | function event_icons($event) |
| 396 | 396 | { |
| 397 | - $is_private = !$event['public'] && !$this->bo->check_perms(Acl::READ,$event); |
|
| 397 | + $is_private = !$event['public'] && !$this->bo->check_perms(Acl::READ, $event); |
|
| 398 | 398 | |
| 399 | 399 | $icons = array(); |
| 400 | 400 | if (!$is_private) |
| 401 | 401 | { |
| 402 | - if($event['priority'] == 3) |
|
| 402 | + if ($event['priority'] == 3) |
|
| 403 | 403 | { |
| 404 | - $icons[] = Api\Html::image('calendar','high',lang('high priority')); |
|
| 404 | + $icons[] = Api\Html::image('calendar', 'high', lang('high priority')); |
|
| 405 | 405 | } |
| 406 | - if($event['recur_type'] != MCAL_RECUR_NONE) |
|
| 406 | + if ($event['recur_type'] != MCAL_RECUR_NONE) |
|
| 407 | 407 | { |
| 408 | - $icons[] = Api\Html::image('calendar','recur',lang('recurring event')); |
|
| 408 | + $icons[] = Api\Html::image('calendar', 'recur', lang('recurring event')); |
|
| 409 | 409 | } |
| 410 | 410 | // icons for single user, multiple users or group(s) and resources |
| 411 | - foreach(array_keys($event['participants']) as $uid) |
|
| 411 | + foreach (array_keys($event['participants']) as $uid) |
|
| 412 | 412 | { |
| 413 | - if(is_numeric($uid) || !isset($this->bo->resources[$uid[0]]['icon'])) |
|
| 413 | + if (is_numeric($uid) || !isset($this->bo->resources[$uid[0]]['icon'])) |
|
| 414 | 414 | { |
| 415 | 415 | if (isset($icons['single']) || $GLOBALS['egw']->accounts->get_type($uid) == 'g') |
| 416 | 416 | { |
| 417 | 417 | unset($icons['single']); |
| 418 | - $icons['multiple'] = Api\Html::image('calendar','users'); |
|
| 418 | + $icons['multiple'] = Api\Html::image('calendar', 'users'); |
|
| 419 | 419 | } |
| 420 | 420 | elseif (!isset($icons['multiple'])) |
| 421 | 421 | { |
| 422 | - $icons['single'] = Api\Html::image('calendar','single'); |
|
| 422 | + $icons['single'] = Api\Html::image('calendar', 'single'); |
|
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | - elseif(!isset($icons[$uid[0]]) && isset($this->bo->resources[$uid[0]]) && isset($this->bo->resources[$uid[0]]['icon'])) |
|
| 425 | + elseif (!isset($icons[$uid[0]]) && isset($this->bo->resources[$uid[0]]) && isset($this->bo->resources[$uid[0]]['icon'])) |
|
| 426 | 426 | { |
| 427 | 427 | $icons[$uid[0]] = Api\Html::image($this->bo->resources[$uid[0]]['app'], |
| 428 | 428 | ($this->bo->resources[$uid[0]]['icon'] ? $this->bo->resources[$uid[0]]['icon'] : 'navbar'), |
@@ -431,21 +431,21 @@ discard block |
||
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | - if($event['non_blocking']) |
|
| 434 | + if ($event['non_blocking']) |
|
| 435 | 435 | { |
| 436 | - $icons[] = Api\Html::image('calendar','nonblocking',lang('non blocking')); |
|
| 436 | + $icons[] = Api\Html::image('calendar', 'nonblocking', lang('non blocking')); |
|
| 437 | 437 | } |
| 438 | - if($event['public'] == 0) |
|
| 438 | + if ($event['public'] == 0) |
|
| 439 | 439 | { |
| 440 | - $icons[] = Api\Html::image('calendar','private',lang('private')); |
|
| 440 | + $icons[] = Api\Html::image('calendar', 'private', lang('private')); |
|
| 441 | 441 | } |
| 442 | - if(isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) |
|
| 442 | + if (isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) |
|
| 443 | 443 | { |
| 444 | - $icons[] = Api\Html::image('calendar','alarm',lang('alarm')); |
|
| 444 | + $icons[] = Api\Html::image('calendar', 'alarm', lang('alarm')); |
|
| 445 | 445 | } |
| 446 | - if($event['participants'][$this->user][0] == 'U') |
|
| 446 | + if ($event['participants'][$this->user][0] == 'U') |
|
| 447 | 447 | { |
| 448 | - $icons[] = Api\Html::image('calendar','needs-action',lang('Needs action')); |
|
| 448 | + $icons[] = Api\Html::image('calendar', 'needs-action', lang('Needs action')); |
|
| 449 | 449 | } |
| 450 | 450 | return $icons; |
| 451 | 451 | } |
@@ -460,17 +460,17 @@ discard block |
||
| 460 | 460 | * @param array $vars |
| 461 | 461 | * @return string the link incl. content |
| 462 | 462 | */ |
| 463 | - function add_link($content,$date=null,$hour=null,$minute=0,array $vars=null) |
|
| 463 | + function add_link($content, $date = null, $hour = null, $minute = 0, array $vars = null) |
|
| 464 | 464 | { |
| 465 | 465 | $vars['menuaction'] = 'calendar.calendar_uiforms.edit'; |
| 466 | - $vars['date'] = $date ? $date : $this->date; |
|
| 466 | + $vars['date'] = $date ? $date : $this->date; |
|
| 467 | 467 | |
| 468 | 468 | if (!is_null($hour)) |
| 469 | 469 | { |
| 470 | 470 | $vars['hour'] = $hour; |
| 471 | 471 | $vars['minute'] = $minute; |
| 472 | 472 | } |
| 473 | - return Api\Html::a_href($content,'',$vars,' data-date="' .$vars['date'].'|'.$vars['hour'].'|'.$vars['minute'] |
|
| 473 | + return Api\Html::a_href($content, '', $vars, ' data-date="'.$vars['date'].'|'.$vars['hour'].'|'.$vars['minute'] |
|
| 474 | 474 | . '" title="'.Api\Html::htmlspecialchars(lang('Add')).'"'); |
| 475 | 475 | } |
| 476 | 476 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | // Magic etemplate2 favorites menu (from framework) |
| 483 | 483 | display_sidebox('calendar', lang('Favorites'), Framework\Favorites::list_favorites('calendar')); |
| 484 | 484 | |
| 485 | - $file = array('menuOpened' => true); // menu open by default |
|
| 485 | + $file = array('menuOpened' => true); // menu open by default |
|
| 486 | 486 | |
| 487 | 487 | // Target for etemplate |
| 488 | 488 | $file[] = array( |
@@ -495,34 +495,34 @@ discard block |
||
| 495 | 495 | // Merge print placeholders (selectbox in etemplate) |
| 496 | 496 | if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) |
| 497 | 497 | { |
| 498 | - $file['Placeholders'] = Egw::link('/index.php','menuaction=calendar.calendar_merge.show_replacements'); |
|
| 498 | + $file['Placeholders'] = Egw::link('/index.php', 'menuaction=calendar.calendar_merge.show_replacements'); |
|
| 499 | 499 | } |
| 500 | 500 | $appname = 'calendar'; |
| 501 | 501 | $menu_title = lang('Calendar Menu'); |
| 502 | - display_sidebox($appname,$menu_title,$file); |
|
| 502 | + display_sidebox($appname, $menu_title, $file); |
|
| 503 | 503 | |
| 504 | 504 | $this->sidebox_etemplate(); |
| 505 | 505 | |
| 506 | 506 | // resources menu hooks |
| 507 | 507 | foreach ($this->bo->resources as $resource) |
| 508 | 508 | { |
| 509 | - if(!is_array($resource['cal_sidebox'])) continue; |
|
| 509 | + if (!is_array($resource['cal_sidebox'])) continue; |
|
| 510 | 510 | $menu_title = $resource['cal_sidebox']['menu_title'] ? $resource['cal_sidebox']['menu_title'] : lang($resource['app']); |
| 511 | - $file = ExecMethod($resource['cal_sidebox']['file'],array( |
|
| 511 | + $file = ExecMethod($resource['cal_sidebox']['file'], array( |
|
| 512 | 512 | 'menuaction' => $this->view_menuaction, |
| 513 | 513 | 'owner' => $this->owner, |
| 514 | 514 | )); |
| 515 | - display_sidebox($appname,$menu_title,$file); |
|
| 515 | + display_sidebox($appname, $menu_title, $file); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | if ($GLOBALS['egw_info']['user']['apps']['admin']) |
| 519 | 519 | { |
| 520 | 520 | $file = Array( |
| 521 | - 'Configuration'=>Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
|
| 522 | - 'Custom Fields'=>Egw::link('/index.php','menuaction=admin.customfields.index&appname=calendar'), |
|
| 523 | - 'Global Categories' =>Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'), |
|
| 521 | + 'Configuration'=>Egw::link('/index.php', 'menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
|
| 522 | + 'Custom Fields'=>Egw::link('/index.php', 'menuaction=admin.customfields.index&appname=calendar'), |
|
| 523 | + 'Global Categories' =>Egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar'), |
|
| 524 | 524 | ); |
| 525 | - $GLOBALS['egw']->framework->sidebox($appname,lang('Admin'),$file,'admin'); |
|
| 525 | + $GLOBALS['egw']->framework->sidebox($appname, lang('Admin'), $file, 'admin'); |
|
| 526 | 526 | } |
| 527 | 527 | } |
| 528 | 528 | |
@@ -531,15 +531,15 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | function sidebox_etemplate($content = array()) |
| 533 | 533 | { |
| 534 | - if($content['merge']) |
|
| 534 | + if ($content['merge']) |
|
| 535 | 535 | { |
| 536 | 536 | // View from sidebox is JSON encoded |
| 537 | - $this->manage_states(array_merge($content,json_decode($content['view'],true))); |
|
| 538 | - if($content['first']) |
|
| 537 | + $this->manage_states(array_merge($content, json_decode($content['view'], true))); |
|
| 538 | + if ($content['first']) |
|
| 539 | 539 | { |
| 540 | - $this->first = Api\DateTime::to($content['first'],'ts'); |
|
| 540 | + $this->first = Api\DateTime::to($content['first'], 'ts'); |
|
| 541 | 541 | } |
| 542 | - if($content['last']) |
|
| 542 | + if ($content['last']) |
|
| 543 | 543 | { |
| 544 | 544 | $this->last = new Api\DateTime($content['last']); |
| 545 | 545 | $this->last->setTime(23, 59, 59); |
@@ -557,25 +557,25 @@ discard block |
||
| 557 | 557 | $cont['view'] = $this->view ? $this->view : 'week'; |
| 558 | 558 | $cont['date'] = $this->date ? $this->date : Api\DateTime(); |
| 559 | 559 | |
| 560 | - $cont['year'] = (int)Api\DateTime::to($cont['date'],'Y'); |
|
| 560 | + $cont['year'] = (int)Api\DateTime::to($cont['date'], 'Y'); |
|
| 561 | 561 | $cont['holidays'] = $this->bo->read_holidays($cont['year']); |
| 562 | 562 | |
| 563 | 563 | $readonlys = array(); |
| 564 | 564 | $sel_options['status_filter'] = array( |
| 565 | - array('value' => 'default', 'label' => lang('Not rejected'), 'title' => lang('Show all status, but rejected')), |
|
| 566 | - array('value' => 'accepted', 'label' => lang('Accepted'), 'title' => lang('Show only accepted events')), |
|
| 567 | - array('value' => 'unknown', 'label' => lang('Invitations'), 'title' => lang('Show only invitations, not yet accepted or rejected')), |
|
| 568 | - array('value' => 'tentative', 'label' => lang('Tentative'), 'title' => lang('Show only tentative accepted events')), |
|
| 569 | - array('value' => 'delegated', 'label' => lang('Delegated'), 'title' => lang('Show only delegated events')), |
|
| 570 | - array('value' => 'rejected', 'label' => lang('Rejected'),'title' => lang('Show only rejected events')), |
|
| 571 | - array('value' => 'owner', 'label' => lang('Owner too'),'title' => lang('Show also events just owned by selected user')), |
|
| 572 | - array('value' => 'all', 'label' => lang('All incl. rejected'),'title' => lang('Show all status incl. rejected events')), |
|
| 573 | - array('value' => 'hideprivate', 'label' => lang('Hide private infos'),'title' => lang('Show all events, as if they were private')), |
|
| 574 | - array('value' => 'showonlypublic', 'label' => lang('Hide private events'),'title' => lang('Show only events flagged as public, (not checked as private)')), |
|
| 575 | - array('value' => 'no-enum-groups', 'label' => lang('only group-events'),'title' => lang('Do not include events of group members')), |
|
| 576 | - array('value' => 'not-unknown', 'label' => lang('No meeting requests'),'title' => lang('Show all status, but unknown')), |
|
| 565 | + array('value' => 'default', 'label' => lang('Not rejected'), 'title' => lang('Show all status, but rejected')), |
|
| 566 | + array('value' => 'accepted', 'label' => lang('Accepted'), 'title' => lang('Show only accepted events')), |
|
| 567 | + array('value' => 'unknown', 'label' => lang('Invitations'), 'title' => lang('Show only invitations, not yet accepted or rejected')), |
|
| 568 | + array('value' => 'tentative', 'label' => lang('Tentative'), 'title' => lang('Show only tentative accepted events')), |
|
| 569 | + array('value' => 'delegated', 'label' => lang('Delegated'), 'title' => lang('Show only delegated events')), |
|
| 570 | + array('value' => 'rejected', 'label' => lang('Rejected'), 'title' => lang('Show only rejected events')), |
|
| 571 | + array('value' => 'owner', 'label' => lang('Owner too'), 'title' => lang('Show also events just owned by selected user')), |
|
| 572 | + array('value' => 'all', 'label' => lang('All incl. rejected'), 'title' => lang('Show all status incl. rejected events')), |
|
| 573 | + array('value' => 'hideprivate', 'label' => lang('Hide private infos'), 'title' => lang('Show all events, as if they were private')), |
|
| 574 | + array('value' => 'showonlypublic', 'label' => lang('Hide private events'), 'title' => lang('Show only events flagged as public, (not checked as private)')), |
|
| 575 | + array('value' => 'no-enum-groups', 'label' => lang('only group-events'), 'title' => lang('Do not include events of group members')), |
|
| 576 | + array('value' => 'not-unknown', 'label' => lang('No meeting requests'), 'title' => lang('Show all status, but unknown')), |
|
| 577 | 577 | ); |
| 578 | - if($GLOBALS['egw_info']['server']['calendar_delete_history']) |
|
| 578 | + if ($GLOBALS['egw_info']['server']['calendar_delete_history']) |
|
| 579 | 579 | { |
| 580 | 580 | $sel_options['status_filter'][] = array('value' => 'deleted', 'label' => lang('Deleted'), 'title' => lang('Show events that have been deleted')); |
| 581 | 581 | } |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | // Merge print |
| 584 | 584 | if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) |
| 585 | 585 | { |
| 586 | - $sel_options['merge'] = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null,'calendar'); |
|
| 586 | + $sel_options['merge'] = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null, 'calendar'); |
|
| 587 | 587 | } |
| 588 | 588 | else |
| 589 | 589 | { |
@@ -609,27 +609,27 @@ discard block |
||
| 609 | 609 | */ |
| 610 | 610 | public function update_client($event_id, Api\DateTime $recurrence_date = null) |
| 611 | 611 | { |
| 612 | - if(!$event_id) return; |
|
| 612 | + if (!$event_id) return; |
|
| 613 | 613 | |
| 614 | 614 | // Directly update stored data. |
| 615 | 615 | // Make sure we have the whole event |
| 616 | 616 | $event = $this->bo->read($event_id, $recurrence_date); |
| 617 | 617 | $response = Api\Json\Response::get(); |
| 618 | 618 | |
| 619 | - if(!$event) |
|
| 619 | + if (!$event) |
|
| 620 | 620 | { |
| 621 | 621 | // Sending null will trigger a removal |
| 622 | 622 | $response->generic('data', array('uid' => 'calendar::'.$event_id, 'data' => null)); |
| 623 | 623 | return false; |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | - if(!$event['recur_type'] || $recurrence_date) |
|
| 626 | + if (!$event['recur_type'] || $recurrence_date) |
|
| 627 | 627 | { |
| 628 | 628 | $this->to_client($event); |
| 629 | 629 | $response->generic('data', array('uid' => 'calendar::'.$event['row_id'], 'data' => $event)); |
| 630 | 630 | } |
| 631 | 631 | // If it's recurring, try to send the next month or so |
| 632 | - else if($event['recur_type'] ) |
|
| 632 | + else if ($event['recur_type']) |
|
| 633 | 633 | { |
| 634 | 634 | $this_month = new Api\DateTime('next month'); |
| 635 | 635 | $rrule = calendar_rrule::event2rrule($event, true); |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | $response->generic('data', array('uid' => 'calendar::'.$converted['row_id'], 'data' => $converted)); |
| 643 | 643 | $rrule->next(); |
| 644 | 644 | } |
| 645 | - while ($rrule->valid() && $occurrence <= $this_month ); |
|
| 645 | + while ($rrule->valid() && $occurrence <= $this_month); |
|
| 646 | 646 | } |
| 647 | 647 | } |
| 648 | 648 | |
@@ -657,15 +657,15 @@ discard block |
||
| 657 | 657 | */ |
| 658 | 658 | public function to_client(&$event) |
| 659 | 659 | { |
| 660 | - if(!$event || !is_array($event)) return false; |
|
| 660 | + if (!$event || !is_array($event)) return false; |
|
| 661 | 661 | |
| 662 | - if (!$this->bo->check_perms(Acl::EDIT,$event)) |
|
| 662 | + if (!$this->bo->check_perms(Acl::EDIT, $event)) |
|
| 663 | 663 | { |
| 664 | 664 | $event['class'] .= 'rowNoEdit '; |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | // Delete disabled for other applications |
| 668 | - if (!$this->bo->check_perms(Acl::DELETE,$event) || !is_numeric($event['id'])) |
|
| 668 | + if (!$this->bo->check_perms(Acl::DELETE, $event) || !is_numeric($event['id'])) |
|
| 669 | 669 | { |
| 670 | 670 | $event['class'] .= 'rowNoDelete '; |
| 671 | 671 | } |
@@ -678,32 +678,32 @@ discard block |
||
| 678 | 678 | |
| 679 | 679 | $event['recure'] = $this->bo->recure2string($event); |
| 680 | 680 | |
| 681 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
| 682 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
| 681 | + if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
| 682 | + if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
| 683 | 683 | |
| 684 | 684 | // respect category permissions |
| 685 | - if(!empty($event['category'])) |
|
| 685 | + if (!empty($event['category'])) |
|
| 686 | 686 | { |
| 687 | 687 | $event['category'] = $this->categories->check_list(Acl::READ, $event['category']); |
| 688 | 688 | } |
| 689 | 689 | $event['non_blocking'] = (bool)$event['non_blocking']; |
| 690 | 690 | |
| 691 | 691 | $matches = null; |
| 692 | - if(!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches)) |
|
| 692 | + if (!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i', $event['id'], $matches)) |
|
| 693 | 693 | { |
| 694 | 694 | $app = $matches[1]; |
| 695 | 695 | $app_id = $matches[2]; |
| 696 | 696 | $icons = array(); |
| 697 | - if(!($is_private = calendar_bo::integration_get_private($app,$app_id,$event))) |
|
| 697 | + if (!($is_private = calendar_bo::integration_get_private($app, $app_id, $event))) |
|
| 698 | 698 | { |
| 699 | - $icons = calendar_uiviews::integration_get_icons($app,$app_id,$event); |
|
| 699 | + $icons = calendar_uiviews::integration_get_icons($app, $app_id, $event); |
|
| 700 | 700 | } |
| 701 | 701 | $event['app'] = $app; |
| 702 | 702 | $event['app_id'] = $app_id; |
| 703 | 703 | } |
| 704 | 704 | else |
| 705 | 705 | { |
| 706 | - $is_private = !$this->bo->check_perms(Acl::READ,$event); |
|
| 706 | + $is_private = !$this->bo->check_perms(Acl::READ, $event); |
|
| 707 | 707 | } |
| 708 | 708 | if ($is_private) |
| 709 | 709 | { |
@@ -711,29 +711,29 @@ discard block |
||
| 711 | 711 | $event['class'] .= 'rowNoView '; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | - if(!$event['app']) |
|
| 714 | + if (!$event['app']) |
|
| 715 | 715 | { |
| 716 | 716 | $event['app'] = 'calendar'; |
| 717 | 717 | } |
| 718 | - if(!$event['app_id']) |
|
| 718 | + if (!$event['app_id']) |
|
| 719 | 719 | { |
| 720 | 720 | $event['app_id'] = $event['id']; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | if ($event['recur_type'] != MCAL_RECUR_NONE) |
| 724 | 724 | { |
| 725 | - $event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts'); |
|
| 725 | + $event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts'); |
|
| 726 | 726 | } |
| 727 | 727 | // set id for grid |
| 728 | - $event['row_id'] = $event['id'].($event['recur_type'] ? ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts') : ''); |
|
| 728 | + $event['row_id'] = $event['id'].($event['recur_type'] ? ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts') : ''); |
|
| 729 | 729 | |
| 730 | - $event['parts'] = implode(",\n",$this->bo->participants($event,false)); |
|
| 730 | + $event['parts'] = implode(",\n", $this->bo->participants($event, false)); |
|
| 731 | 731 | $event['date'] = $this->bo->date2string($event['start']); |
| 732 | 732 | |
| 733 | 733 | // Change dates |
| 734 | - foreach(calendar_egw_record::$types['date-time'] as $field) |
|
| 734 | + foreach (calendar_egw_record::$types['date-time'] as $field) |
|
| 735 | 735 | { |
| 736 | - if(is_int($event[$field])) |
|
| 736 | + if (is_int($event[$field])) |
|
| 737 | 737 | { |
| 738 | 738 | $event[$field] = Api\DateTime::to($event[$field], Api\DateTime::ET2); |
| 739 | 739 | } |
@@ -751,13 +751,13 @@ discard block |
||
| 751 | 751 | public function merge($timespan = array()) |
| 752 | 752 | { |
| 753 | 753 | // Merge print |
| 754 | - if($_GET['merge']) |
|
| 754 | + if ($_GET['merge']) |
|
| 755 | 755 | { |
| 756 | - if(!$timespan) |
|
| 756 | + if (!$timespan) |
|
| 757 | 757 | { |
| 758 | 758 | // Try to make time span into appropriate ranges to match |
| 759 | - if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) $template = 'month'; |
|
| 760 | - if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) $template = 'week'; |
|
| 759 | + if (stripos($_GET['merge'], 'month') !== false || stripos($_GET['merge'], lang('month')) !== false) $template = 'month'; |
|
| 760 | + if (stripos($_GET['merge'], 'week') !== false || stripos($_GET['merge'], lang('week')) !== false) $template = 'week'; |
|
| 761 | 761 | //error_log("Detected template $template"); |
| 762 | 762 | switch ($template) |
| 763 | 763 | { |
@@ -765,8 +765,8 @@ discard block |
||
| 765 | 765 | // Trim to _only_ the month, do not pad to week start / end |
| 766 | 766 | $time = new Api\DateTime($this->date); |
| 767 | 767 | $timespan = array(array( |
| 768 | - 'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'),'ts'), |
|
| 769 | - 'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'),'ts') |
|
| 768 | + 'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'), 'ts'), |
|
| 769 | + 'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'), 'ts') |
|
| 770 | 770 | )); |
| 771 | 771 | break; |
| 772 | 772 | case 'week': |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | $start = new Api\DateTime($this->first); |
| 775 | 775 | $t = clone $start; |
| 776 | 776 | $t->modify('+1 week')->modify('-1 second'); |
| 777 | - if($t->format('ts') < Api\DateTime::to($this->last,'ts')) |
|
| 777 | + if ($t->format('ts') < Api\DateTime::to($this->last, 'ts')) |
|
| 778 | 778 | { |
| 779 | 779 | do |
| 780 | 780 | { |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | ); |
| 785 | 785 | $start->modify('+1 week'); |
| 786 | 786 | $t->modify('+1 week'); |
| 787 | - } while( $start->format('ts') < $this->last); |
|
| 787 | + } while ($start->format('ts') < $this->last); |
|
| 788 | 788 | break; |
| 789 | 789 | } |
| 790 | 790 | // Fall through |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | Framework::refresh_opener($error, 'calendar'); |
| 803 | 803 | } |
| 804 | 804 | unset($_GET['merge']); |
| 805 | - if($error) |
|
| 805 | + if ($error) |
|
| 806 | 806 | { |
| 807 | 807 | // This doesn't give message either, but at least it doesn't give a blank screen |
| 808 | 808 | Framework::redirect_link('/index.php', array( |
@@ -30,33 +30,33 @@ discard block |
||
| 30 | 30 | * @param string $cname |
| 31 | 31 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
| 32 | 32 | */ |
| 33 | - public function beforeSendToClient($cname, array $expand=null) |
|
| 33 | + public function beforeSendToClient($cname, array $expand = null) |
|
| 34 | 34 | { |
| 35 | 35 | |
| 36 | - Framework::includeJS('.','et2_widget_owner','calendar'); |
|
| 37 | - Framework::includeCSS('calendar','calendar'); |
|
| 36 | + Framework::includeJS('.', 'et2_widget_owner', 'calendar'); |
|
| 37 | + Framework::includeCSS('calendar', 'calendar'); |
|
| 38 | 38 | |
| 39 | 39 | $bo = new calendar_bo(); |
| 40 | 40 | |
| 41 | 41 | $form_name = self::form_name($cname, $this->id, $expand); |
| 42 | 42 | |
| 43 | - $value =& self::get_array(self::$request->content, $form_name); |
|
| 44 | - if(!is_array($value)) $value = array(); |
|
| 43 | + $value = & self::get_array(self::$request->content, $form_name); |
|
| 44 | + if (!is_array($value)) $value = array(); |
|
| 45 | 45 | if (!is_array(self::$request->sel_options[$form_name])) |
| 46 | 46 | { |
| 47 | 47 | self::$request->sel_options[$form_name] = array(); |
| 48 | 48 | } |
| 49 | - $sel_options =& self::$request->sel_options[$form_name]; |
|
| 49 | + $sel_options = & self::$request->sel_options[$form_name]; |
|
| 50 | 50 | |
| 51 | 51 | // Get user accounts, formatted nicely for grouping and matching |
| 52 | 52 | // the ajax call calendar_uiforms->ajax_owner() - users first |
| 53 | 53 | $accounts = array(); |
| 54 | 54 | $list = array('accounts', 'owngroups'); |
| 55 | - foreach($list as $type) |
|
| 55 | + foreach ($list as $type) |
|
| 56 | 56 | { |
| 57 | 57 | $account_options = array('account_type' => $type); |
| 58 | - $accounts_type = Api\Accounts::link_query('',$account_options); |
|
| 59 | - if($type == 'accounts') |
|
| 58 | + $accounts_type = Api\Accounts::link_query('', $account_options); |
|
| 59 | + if ($type == 'accounts') |
|
| 60 | 60 | { |
| 61 | 61 | $accounts_type = array_intersect_key($accounts_type, $GLOBALS['egw']->acl->get_grants('calendar')); |
| 62 | 62 | } |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | // Add external owners that a select account widget will not find |
| 78 | - foreach($value as &$owner) |
|
| 78 | + foreach ($value as &$owner) |
|
| 79 | 79 | { |
| 80 | 80 | $label = self::get_owner_label($owner); |
| 81 | - if(!is_numeric($owner)) |
|
| 81 | + if (!is_numeric($owner)) |
|
| 82 | 82 | { |
| 83 | - $resource = $bo->resources[substr($owner, 0,1)]; |
|
| 83 | + $resource = $bo->resources[substr($owner, 0, 1)]; |
|
| 84 | 84 | } |
| 85 | 85 | else if (!in_array($owner, array_keys($accounts))) |
| 86 | 86 | { |
@@ -102,19 +102,19 @@ discard block |
||
| 102 | 102 | * @param array $content |
| 103 | 103 | * @param array &$validated=array() validated content |
| 104 | 104 | */ |
| 105 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
| 105 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
| 106 | 106 | { |
| 107 | 107 | $form_name = self::form_name($cname, $this->id, $expand); |
| 108 | 108 | |
| 109 | 109 | if (!$this->is_readonly($cname, $form_name)) |
| 110 | 110 | { |
| 111 | - $value = $value_in =& self::get_array($content, $form_name); |
|
| 112 | - if(!is_array($value)) |
|
| 111 | + $value = $value_in = & self::get_array($content, $form_name); |
|
| 112 | + if (!is_array($value)) |
|
| 113 | 113 | { |
| 114 | 114 | $value = Array($value); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 117 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 118 | 118 | if (true) $valid = $value; |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | public static function ajax_owner($id = null) |
| 127 | 127 | { |
| 128 | 128 | // Handle a request for a single ID |
| 129 | - if($id) |
|
| 129 | + if ($id) |
|
| 130 | 130 | { |
| 131 | 131 | $label = self::get_owner_label($id); |
| 132 | 132 | Api\Json\Response::get()->data($label); |
@@ -137,35 +137,35 @@ discard block |
||
| 137 | 137 | $query = $_REQUEST['query']; |
| 138 | 138 | // Arbitrarily limited to 50 / resource |
| 139 | 139 | $options = array('start' => 0, 'num_rows' => 50) + |
| 140 | - array_diff_key($_REQUEST, array_flip(array('menuaction','query'))); |
|
| 140 | + array_diff_key($_REQUEST, array_flip(array('menuaction', 'query'))); |
|
| 141 | 141 | $results = array(); |
| 142 | 142 | |
| 143 | - $resources = array_merge(array('' => $bo->resources['']),$bo->resources); |
|
| 144 | - foreach($resources as $type => $data) |
|
| 143 | + $resources = array_merge(array('' => $bo->resources['']), $bo->resources); |
|
| 144 | + foreach ($resources as $type => $data) |
|
| 145 | 145 | { |
| 146 | 146 | $mapped = array(); |
| 147 | 147 | $_results = array(); |
| 148 | 148 | |
| 149 | 149 | // Handle Api\Accounts seperately |
| 150 | - if($type == '') |
|
| 150 | + if ($type == '') |
|
| 151 | 151 | { |
| 152 | 152 | $list = array('accounts', 'owngroups'); |
| 153 | - foreach($list as $a_type) |
|
| 153 | + foreach ($list as $a_type) |
|
| 154 | 154 | { |
| 155 | 155 | $account_options = $options + array('account_type' => $a_type); |
| 156 | - $_results += Api\Accounts::link_query($query,$account_options); |
|
| 156 | + $_results += Api\Accounts::link_query($query, $account_options); |
|
| 157 | 157 | } |
| 158 | 158 | $_results = array_intersect_key($_results, $GLOBALS['egw']->acl->get_grants('calendar')); |
| 159 | 159 | } |
| 160 | 160 | else if ($data['app'] && Link::get_registry($data['app'], 'query')) |
| 161 | 161 | { |
| 162 | - $_results = Link::query($data['app'], $query,$options); |
|
| 162 | + $_results = Link::query($data['app'], $query, $options); |
|
| 163 | 163 | } |
| 164 | - if(!$_results) continue; |
|
| 164 | + if (!$_results) continue; |
|
| 165 | 165 | |
| 166 | - foreach(array_unique($_results) as $id => $title) |
|
| 166 | + foreach (array_unique($_results) as $id => $title) |
|
| 167 | 167 | { |
| 168 | - if($id && $title) |
|
| 168 | + if ($id && $title) |
|
| 169 | 169 | { |
| 170 | 170 | // Magicsuggest uses id, not value. |
| 171 | 171 | $value = array( |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | 'label' => $title, |
| 175 | 175 | 'app' => lang($data['app']) |
| 176 | 176 | ); |
| 177 | - if(is_array($value['label'])) |
|
| 177 | + if (is_array($value['label'])) |
|
| 178 | 178 | { |
| 179 | 179 | $value = array_merge($value, $value['label']); |
| 180 | 180 | } |
| 181 | 181 | $mapped[] = $value; |
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | - if(count($mapped)) |
|
| 184 | + if (count($mapped)) |
|
| 185 | 185 | { |
| 186 | 186 | $results = array_merge($results, $mapped); |
| 187 | 187 | } |
@@ -202,24 +202,24 @@ discard block |
||
| 202 | 202 | public static function get_owner_label($id) |
| 203 | 203 | { |
| 204 | 204 | static $bo; |
| 205 | - if(!$bo) $bo = new calendar_bo(); |
|
| 205 | + if (!$bo) $bo = new calendar_bo(); |
|
| 206 | 206 | |
| 207 | 207 | $id = ''.$id; |
| 208 | - if(!is_numeric($id)) |
|
| 208 | + if (!is_numeric($id)) |
|
| 209 | 209 | { |
| 210 | - $resource = $bo->resources[substr($id, 0,1)]; |
|
| 211 | - $label = Link::title($resource['app'], substr($id,1)); |
|
| 210 | + $resource = $bo->resources[substr($id, 0, 1)]; |
|
| 211 | + $label = Link::title($resource['app'], substr($id, 1)); |
|
| 212 | 212 | |
| 213 | 213 | // Could not get via link, try via resources info |
| 214 | - if($label === false) |
|
| 214 | + if ($label === false) |
|
| 215 | 215 | { |
| 216 | - $info = ExecMethod($resource['info'], substr($id,1)); |
|
| 216 | + $info = ExecMethod($resource['info'], substr($id, 1)); |
|
| 217 | 217 | $label = $info[0]['name']; |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | else |
| 221 | 221 | { |
| 222 | - $label = Link::title('api-accounts',$id); |
|
| 222 | + $label = Link::title('api-accounts', $id); |
|
| 223 | 223 | } |
| 224 | 224 | return $label; |
| 225 | 225 | } |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | static private $recur_egw2ical_2_0 = array( |
| 77 | 77 | self::DAILY => 'DAILY', |
| 78 | 78 | self::WEEKLY => 'WEEKLY', |
| 79 | - self::MONTHLY_WDAY => 'MONTHLY', // BYDAY={1..7, -1}{MO..SO, last workday} |
|
| 80 | - self::MONTHLY_MDAY => 'MONTHLY', // BYMONHTDAY={1..31, -1 for last day of month} |
|
| 79 | + self::MONTHLY_WDAY => 'MONTHLY', // BYDAY={1..7, -1}{MO..SO, last workday} |
|
| 80 | + self::MONTHLY_MDAY => 'MONTHLY', // BYMONHTDAY={1..31, -1 for last day of month} |
|
| 81 | 81 | self::YEARLY => 'YEARLY', |
| 82 | 82 | ); |
| 83 | 83 | |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | static private $recur_egw2ical_1_0 = array( |
| 88 | 88 | self::DAILY => 'D', |
| 89 | 89 | self::WEEKLY => 'W', |
| 90 | - self::MONTHLY_WDAY => 'MP', // BYDAY={1..7,-1}{MO..SO, last workday} |
|
| 91 | - self::MONTHLY_MDAY => 'MD', // BYMONHTDAY={1..31,-1} |
|
| 90 | + self::MONTHLY_WDAY => 'MP', // BYDAY={1..7,-1}{MO..SO, last workday} |
|
| 91 | + self::MONTHLY_MDAY => 'MD', // BYMONHTDAY={1..31,-1} |
|
| 92 | 92 | self::YEARLY => 'YM', |
| 93 | 93 | ); |
| 94 | 94 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | const THURSDAY = 16; |
| 145 | 145 | const FRIDAY = 32; |
| 146 | 146 | const SATURDAY = 64; |
| 147 | - const WORKDAYS = 62; // Mo, ..., Fr |
|
| 147 | + const WORKDAYS = 62; // Mo, ..., Fr |
|
| 148 | 148 | const ALLDAYS = 127; |
| 149 | 149 | /** |
| 150 | 150 | * Translate weekday bitmasks to labels |
@@ -172,14 +172,14 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @var array |
| 174 | 174 | */ |
| 175 | - public $exceptions=array(); |
|
| 175 | + public $exceptions = array(); |
|
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | 178 | * Array of exceptions as DateTime/egw_time objects |
| 179 | 179 | * |
| 180 | 180 | * @var array |
| 181 | 181 | */ |
| 182 | - public $exceptions_objs=array(); |
|
| 182 | + public $exceptions_objs = array(); |
|
| 183 | 183 | |
| 184 | 184 | /** |
| 185 | 185 | * Starttime of series |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | * @param int $weekdays =0 self::SUNDAY=1|self::MONDAY=2|...|self::SATURDAY=64 |
| 223 | 223 | * @param array $exceptions =null DateTime objects with exceptions |
| 224 | 224 | */ |
| 225 | - public function __construct(DateTime $time,$type,$interval=1,DateTime $enddate=null,$weekdays=0,array $exceptions=null) |
|
| 225 | + public function __construct(DateTime $time, $type, $interval = 1, DateTime $enddate = null, $weekdays = 0, array $exceptions = null) |
|
| 226 | 226 | { |
| 227 | - switch($GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']) |
|
| 227 | + switch ($GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']) |
|
| 228 | 228 | { |
| 229 | 229 | case 'Sunday': |
| 230 | 230 | $this->lastdayofweek = self::SATURDAY; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | $this->time = $time instanceof Api\DateTime ? $time : new Api\DateTime($time); |
| 240 | 240 | |
| 241 | - if (!in_array($type,array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY))) |
|
| 241 | + if (!in_array($type, array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY))) |
|
| 242 | 242 | { |
| 243 | 243 | throw new Api\Exception\WrongParameter(__METHOD__."($time,$type,$interval,$enddate,$weekdays,...) type $type is NOT valid!"); |
| 244 | 244 | } |
@@ -248,16 +248,16 @@ discard block |
||
| 248 | 248 | if ($type == self::MONTHLY_WDAY) |
| 249 | 249 | { |
| 250 | 250 | // check for last week of month |
| 251 | - if (($day = $this->time->format('d')) >= 21 && $day > self::daysInMonth($this->time)-7) |
|
| 251 | + if (($day = $this->time->format('d')) >= 21 && $day > self::daysInMonth($this->time) - 7) |
|
| 252 | 252 | { |
| 253 | 253 | $this->monthly_byday_num = -1; |
| 254 | 254 | } |
| 255 | 255 | else |
| 256 | 256 | { |
| 257 | - $this->monthly_byday_num = 1 + floor(($this->time->format('d')-1) / 7); |
|
| 257 | + $this->monthly_byday_num = 1 + floor(($this->time->format('d') - 1) / 7); |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | - elseif($type == self::MONTHLY_MDAY) |
|
| 260 | + elseif ($type == self::MONTHLY_MDAY) |
|
| 261 | 261 | { |
| 262 | 262 | $this->monthly_bymonthday = (int)$this->time->format('d'); |
| 263 | 263 | // check for last day of month |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | if ((int)$interval < 1) |
| 276 | 276 | { |
| 277 | - $interval = 1; // calendar stores no (extra) interval as null, so using default 1 here |
|
| 277 | + $interval = 1; // calendar stores no (extra) interval as null, so using default 1 here |
|
| 278 | 278 | } |
| 279 | 279 | $this->interval = (int)$interval; |
| 280 | 280 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | if ($exceptions) |
| 306 | 306 | { |
| 307 | - foreach($exceptions as $exception) |
|
| 307 | + foreach ($exceptions as $exception) |
|
| 308 | 308 | { |
| 309 | 309 | $exception->setTimezone($this->time->getTimezone()); |
| 310 | 310 | $this->exceptions[] = $exception->format('Ymd'); |
@@ -320,22 +320,22 @@ discard block |
||
| 320 | 320 | * @param int $interval =1 |
| 321 | 321 | * @return int |
| 322 | 322 | */ |
| 323 | - public static function recurrence_interval($type, $interval=1) |
|
| 323 | + public static function recurrence_interval($type, $interval = 1) |
|
| 324 | 324 | { |
| 325 | - switch($type) |
|
| 325 | + switch ($type) |
|
| 326 | 326 | { |
| 327 | 327 | case self::DAILY: |
| 328 | - $duration = 24*3600; |
|
| 328 | + $duration = 24 * 3600; |
|
| 329 | 329 | break; |
| 330 | 330 | case self::WEEKLY: |
| 331 | - $duration = 7*24*3600; |
|
| 331 | + $duration = 7 * 24 * 3600; |
|
| 332 | 332 | break; |
| 333 | 333 | case self::MONTHLY_MDAY: |
| 334 | 334 | case self::MONTHLY_WDAY: |
| 335 | - $duration = 31*24*3600; |
|
| 335 | + $duration = 31 * 24 * 3600; |
|
| 336 | 336 | break; |
| 337 | 337 | case self::YEARLY: |
| 338 | - $duration = 366*24*3600; |
|
| 338 | + $duration = 366 * 24 * 3600; |
|
| 339 | 339 | break; |
| 340 | 340 | } |
| 341 | 341 | if ($interval > 1) $duration *= $interval; |
@@ -351,9 +351,9 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | private static function daysInMonth(DateTime $time) |
| 353 | 353 | { |
| 354 | - list($year,$month) = explode('-',$time->format('Y-m')); |
|
| 354 | + list($year, $month) = explode('-', $time->format('Y-m')); |
|
| 355 | 355 | $last_day = new Api\DateTime(); |
| 356 | - $last_day->setDate($year,$month+1,0); |
|
| 356 | + $last_day->setDate($year, $month + 1, 0); |
|
| 357 | 357 | |
| 358 | 358 | return (int)$last_day->format('d'); |
| 359 | 359 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | public function next_no_exception() |
| 385 | 385 | { |
| 386 | - switch($this->type) |
|
| 386 | + switch ($this->type) |
|
| 387 | 387 | { |
| 388 | 388 | case self::NONE: // need to add at least one day, to end "series", as enddate == current date |
| 389 | 389 | case self::DAILY: |
@@ -398,28 +398,28 @@ discard block |
||
| 398 | 398 | // --> on the last day of the week we have to additionally advance interval-1 weeks |
| 399 | 399 | if ($this->interval > 1 && self::getWeekday($this->current) == $this->lastdayofweek) |
| 400 | 400 | { |
| 401 | - $this->current->modify(($this->interval-1).' week'); |
|
| 401 | + $this->current->modify(($this->interval - 1).' week'); |
|
| 402 | 402 | } |
| 403 | 403 | $this->current->modify('1 day'); |
| 404 | 404 | //echo __METHOD__.'() '.$this->current->format('l').', '.$this->current.": $this->weekdays & ".self::getWeekday($this->current)."<br />\n"; |
| 405 | 405 | } |
| 406 | - while(!($this->weekdays & self::getWeekday($this->current))); |
|
| 406 | + while (!($this->weekdays&self::getWeekday($this->current))); |
|
| 407 | 407 | break; |
| 408 | 408 | |
| 409 | 409 | case self::MONTHLY_WDAY: // iCal: BYDAY={1, ..., 5, -1}{MO..SO} |
| 410 | 410 | // advance to start of next month |
| 411 | - list($year,$month) = explode('-',$this->current->format('Y-m')); |
|
| 412 | - $month += $this->interval+($this->monthly_byday_num < 0 ? 1 : 0); |
|
| 413 | - $this->current->setDate($year,$month,$this->monthly_byday_num < 0 ? 0 : 1); |
|
| 411 | + list($year, $month) = explode('-', $this->current->format('Y-m')); |
|
| 412 | + $month += $this->interval + ($this->monthly_byday_num < 0 ? 1 : 0); |
|
| 413 | + $this->current->setDate($year, $month, $this->monthly_byday_num < 0 ? 0 : 1); |
|
| 414 | 414 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).": setDate($year,$month,1): ".$this->current->format('l').', '.$this->current."<br />\n"; |
| 415 | 415 | // now advance to n-th week |
| 416 | 416 | if ($this->monthly_byday_num > 1) |
| 417 | 417 | { |
| 418 | - $this->current->modify(($this->monthly_byday_num-1).' week'); |
|
| 418 | + $this->current->modify(($this->monthly_byday_num - 1).' week'); |
|
| 419 | 419 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).': modify('.($this->monthly_byday_num-1).' week): '.$this->current->format('l').', '.$this->current."<br />\n"; |
| 420 | 420 | } |
| 421 | 421 | // advance to given weekday |
| 422 | - while(!($this->weekdays & self::getWeekday($this->current))) |
|
| 422 | + while (!($this->weekdays&self::getWeekday($this->current))) |
|
| 423 | 423 | { |
| 424 | 424 | $this->current->modify(($this->monthly_byday_num < 0 ? -1 : 1).' day'); |
| 425 | 425 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).': modify(1 day): '.$this->current->format('l').', '.$this->current."<br />\n"; |
@@ -427,10 +427,10 @@ discard block |
||
| 427 | 427 | break; |
| 428 | 428 | |
| 429 | 429 | case self::MONTHLY_MDAY: // iCal: monthly_bymonthday={1, ..., 31, -1} |
| 430 | - list($year,$month) = explode('-',$this->current->format('Y-m')); |
|
| 431 | - $day = $this->monthly_bymonthday+($this->monthly_bymonthday < 0 ? 1 : 0); |
|
| 432 | - $month += $this->interval+($this->monthly_bymonthday < 0 ? 1 : 0); |
|
| 433 | - $this->current->setDate($year,$month,$day); |
|
| 430 | + list($year, $month) = explode('-', $this->current->format('Y-m')); |
|
| 431 | + $day = $this->monthly_bymonthday + ($this->monthly_bymonthday < 0 ? 1 : 0); |
|
| 432 | + $month += $this->interval + ($this->monthly_bymonthday < 0 ? 1 : 0); |
|
| 433 | + $this->current->setDate($year, $month, $day); |
|
| 434 | 434 | //echo __METHOD__."() setDate($year,$month,$day): ".$this->current->format('l').', '.$this->current."<br />\n"; |
| 435 | 435 | break; |
| 436 | 436 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | { |
| 453 | 453 | $this->next_no_exception(); |
| 454 | 454 | } |
| 455 | - while($this->exceptions && in_array($this->current->format('Ymd'),$this->exceptions)); |
|
| 455 | + while ($this->exceptions && in_array($this->current->format('Ymd'), $this->exceptions)); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | /** |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | if (isset($this->current)) $backup = $this->current; |
| 485 | 485 | $this->rewind(); |
| 486 | 486 | |
| 487 | - while(--$count > 0) |
|
| 487 | + while (--$count > 0) |
|
| 488 | 488 | { |
| 489 | 489 | $this->next_no_exception(); |
| 490 | 490 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | // if enddate is now before next acurrence, but not on same day, we use previous recurrence |
| 510 | 510 | // this can happen if client gives an enddate which is NOT a recurrence date |
| 511 | 511 | // eg. for a on Monday recurring weekly event a Tuesday as enddate |
| 512 | - if ($this->enddate < $this->current && $this->current->format('Ymd') != $this->enddate->format('Ymd')) |
|
| 512 | + if ($this->enddate < $this->current && $this->current->format('Ymd') != $this->enddate->format('Ymd')) |
|
| 513 | 513 | { |
| 514 | 514 | $last = $previous; |
| 515 | 515 | } |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | $this->current = clone $this->time; |
| 529 | 529 | while ($this->valid() && |
| 530 | 530 | $this->exceptions && |
| 531 | - in_array($this->current->format('Ymd'),$this->exceptions)) |
|
| 531 | + in_array($this->current->format('Ymd'), $this->exceptions)) |
|
| 532 | 532 | { |
| 533 | 533 | $this->next_no_exception(); |
| 534 | 534 | } |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | * |
| 540 | 540 | * @return boolean |
| 541 | 541 | */ |
| 542 | - public function valid () |
|
| 542 | + public function valid() |
|
| 543 | 543 | { |
| 544 | 544 | return $this->current->format('Ymd') <= $this->enddate_ymd; |
| 545 | 545 | } |
@@ -553,9 +553,9 @@ discard block |
||
| 553 | 553 | { |
| 554 | 554 | $str = ''; |
| 555 | 555 | // Repeated Events |
| 556 | - if($this->type != self::NONE) |
|
| 556 | + if ($this->type != self::NONE) |
|
| 557 | 557 | { |
| 558 | - list($str) = explode(' (',lang(self::$types[$this->type])); // remove (by day/date) from Monthly |
|
| 558 | + list($str) = explode(' (', lang(self::$types[$this->type])); // remove (by day/date) from Monthly |
|
| 559 | 559 | |
| 560 | 560 | $str_extra = array(); |
| 561 | 561 | switch ($this->type) |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | { |
| 572 | 572 | $repeat_days[] = $this->type == self::WEEKLY ? lang('all') : lang('day'); |
| 573 | 573 | } |
| 574 | - elseif($this->weekdays == self::WORKDAYS) |
|
| 574 | + elseif ($this->weekdays == self::WORKDAYS) |
|
| 575 | 575 | { |
| 576 | 576 | $repeat_days[] = $this->type == self::WEEKLY ? lang('workdays') : lang('workday'); |
| 577 | 577 | } |
@@ -579,24 +579,24 @@ discard block |
||
| 579 | 579 | { |
| 580 | 580 | foreach (self::$days as $mask => $label) |
| 581 | 581 | { |
| 582 | - if ($this->weekdays & $mask) |
|
| 582 | + if ($this->weekdays&$mask) |
|
| 583 | 583 | { |
| 584 | 584 | $repeat_days[] = lang($label); |
| 585 | 585 | } |
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | - if($this->type == self::WEEKLY && count($repeat_days)) |
|
| 588 | + if ($this->type == self::WEEKLY && count($repeat_days)) |
|
| 589 | 589 | { |
| 590 | - $str_extra[] = lang('days repeated').': '.implode(', ',$repeat_days); |
|
| 590 | + $str_extra[] = lang('days repeated').': '.implode(', ', $repeat_days); |
|
| 591 | 591 | } |
| 592 | - elseif($this->type == self::MONTHLY_WDAY) |
|
| 592 | + elseif ($this->type == self::MONTHLY_WDAY) |
|
| 593 | 593 | { |
| 594 | - $str_extra[] = ($this->monthly_byday_num == -1 ? lang('last') : $this->monthly_byday_num.'.').' '.implode(', ',$repeat_days); |
|
| 594 | + $str_extra[] = ($this->monthly_byday_num == -1 ? lang('last') : $this->monthly_byday_num.'.').' '.implode(', ', $repeat_days); |
|
| 595 | 595 | } |
| 596 | 596 | break; |
| 597 | 597 | |
| 598 | 598 | } |
| 599 | - if($this->interval > 1) |
|
| 599 | + if ($this->interval > 1) |
|
| 600 | 600 | { |
| 601 | 601 | $str_extra[] = lang('Interval').': '.$this->interval; |
| 602 | 602 | } |
@@ -612,9 +612,9 @@ discard block |
||
| 612 | 612 | { |
| 613 | 613 | $str_extra[] = $this->time->getTimezone()->getName(); |
| 614 | 614 | } |
| 615 | - if(count($str_extra)) |
|
| 615 | + if (count($str_extra)) |
|
| 616 | 616 | { |
| 617 | - $str .= ' ('.implode(', ',$str_extra).')'; |
|
| 617 | + $str .= ' ('.implode(', ', $str_extra).')'; |
|
| 618 | 618 | } |
| 619 | 619 | } |
| 620 | 620 | return $str; |
@@ -626,24 +626,24 @@ discard block |
||
| 626 | 626 | * |
| 627 | 627 | * $return array vCalendar RRULE |
| 628 | 628 | */ |
| 629 | - public function generate_rrule($version='2.0') |
|
| 629 | + public function generate_rrule($version = '2.0') |
|
| 630 | 630 | { |
| 631 | 631 | $repeat_days = array(); |
| 632 | 632 | $rrule = array(); |
| 633 | 633 | |
| 634 | - if ($this->type == self::NONE) return false; // no recuring event |
|
| 634 | + if ($this->type == self::NONE) return false; // no recuring event |
|
| 635 | 635 | |
| 636 | 636 | if ($version == '1.0') |
| 637 | 637 | { |
| 638 | - $rrule['FREQ'] = self::$recur_egw2ical_1_0[$this->type] . $this->interval; |
|
| 638 | + $rrule['FREQ'] = self::$recur_egw2ical_1_0[$this->type].$this->interval; |
|
| 639 | 639 | switch ($this->type) |
| 640 | 640 | { |
| 641 | 641 | case self::WEEKLY: |
| 642 | 642 | foreach (self::$days as $mask => $label) |
| 643 | 643 | { |
| 644 | - if ($this->weekdays & $mask) |
|
| 644 | + if ($this->weekdays&$mask) |
|
| 645 | 645 | { |
| 646 | - $repeat_days[] = strtoupper(substr($label,0,2)); |
|
| 646 | + $repeat_days[] = strtoupper(substr($label, 0, 2)); |
|
| 647 | 647 | } |
| 648 | 648 | } |
| 649 | 649 | $rrule['BYDAY'] = implode(' ', $repeat_days); |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | case self::MONTHLY_WDAY: // weekday of the month: BDAY={1..5}+ {MO..SO} |
| 657 | 657 | $rrule['BYDAY'] = abs($this->monthly_byday_num); |
| 658 | 658 | $rrule['BYDAY'] .= ($this->monthly_byday_num < 0) ? '- ' : '+ '; |
| 659 | - $rrule['BYDAY'] .= strtoupper(substr($this->time->format('l'),0,2)); |
|
| 659 | + $rrule['BYDAY'] .= strtoupper(substr($this->time->format('l'), 0, 2)); |
|
| 660 | 660 | $rrule['FREQ'] = $rrule['FREQ'].' '.$rrule['BYDAY']; |
| 661 | 661 | break; |
| 662 | 662 | } |
@@ -674,9 +674,9 @@ discard block |
||
| 674 | 674 | case self::WEEKLY: |
| 675 | 675 | foreach (self::$days as $mask => $label) |
| 676 | 676 | { |
| 677 | - if ($this->weekdays & $mask) |
|
| 677 | + if ($this->weekdays&$mask) |
|
| 678 | 678 | { |
| 679 | - $repeat_days[] = strtoupper(substr($label,0,2)); |
|
| 679 | + $repeat_days[] = strtoupper(substr($label, 0, 2)); |
|
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | 682 | $rrule['BYDAY'] = implode(',', $repeat_days); |
@@ -687,8 +687,8 @@ discard block |
||
| 687 | 687 | break; |
| 688 | 688 | |
| 689 | 689 | case self::MONTHLY_WDAY: // weekday of the month: BDAY={1..5}{MO..SO} |
| 690 | - $rrule['BYDAY'] = $this->monthly_byday_num . |
|
| 691 | - strtoupper(substr($this->time->format('l'),0,2)); |
|
| 690 | + $rrule['BYDAY'] = $this->monthly_byday_num. |
|
| 691 | + strtoupper(substr($this->time->format('l'), 0, 2)); |
|
| 692 | 692 | break; |
| 693 | 693 | } |
| 694 | 694 | if ($this->interval > 1) |
@@ -723,12 +723,12 @@ discard block |
||
| 723 | 723 | * |
| 724 | 724 | * @return calendar_rrule false on error |
| 725 | 725 | */ |
| 726 | - public static function event2rrule(array $event,$usertime=true,$to_tz=null) |
|
| 726 | + public static function event2rrule(array $event, $usertime = true, $to_tz = null) |
|
| 727 | 727 | { |
| 728 | - if (!is_array($event) || !isset($event['tzid'])) return false; |
|
| 728 | + if (!is_array($event) || !isset($event['tzid'])) return false; |
|
| 729 | 729 | if (!$to_tz) $to_tz = $event['tzid']; |
| 730 | 730 | $timestamp_tz = $usertime ? Api\DateTime::$user_timezone : Api\DateTime::$server_timezone; |
| 731 | - $time = is_a($event['start'],'DateTime') ? $event['start'] : new Api\DateTime($event['start'],$timestamp_tz); |
|
| 731 | + $time = is_a($event['start'], 'DateTime') ? $event['start'] : new Api\DateTime($event['start'], $timestamp_tz); |
|
| 732 | 732 | |
| 733 | 733 | if (!isset(self::$tz_cache[$to_tz])) |
| 734 | 734 | { |
@@ -741,16 +741,16 @@ discard block |
||
| 741 | 741 | |
| 742 | 742 | if ($event['recur_enddate']) |
| 743 | 743 | { |
| 744 | - $enddate = is_a($event['recur_enddate'],'DateTime') ? $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'],$timestamp_tz); |
|
| 744 | + $enddate = is_a($event['recur_enddate'], 'DateTime') ? $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'], $timestamp_tz); |
|
| 745 | 745 | } |
| 746 | 746 | if (is_array($event['recur_exception'])) |
| 747 | 747 | { |
| 748 | - foreach($event['recur_exception'] as $exception) |
|
| 748 | + foreach ($event['recur_exception'] as $exception) |
|
| 749 | 749 | { |
| 750 | - $exceptions[] = is_a($exception,'DateTime') ? $exception : new Api\DateTime($exception,$timestamp_tz); |
|
| 750 | + $exceptions[] = is_a($exception, 'DateTime') ? $exception : new Api\DateTime($exception, $timestamp_tz); |
|
| 751 | 751 | } |
| 752 | 752 | } |
| 753 | - return new calendar_rrule($time,$event['recur_type'],$event['recur_interval'],$enddate,$event['recur_data'],$exceptions); |
|
| 753 | + return new calendar_rrule($time, $event['recur_type'], $event['recur_interval'], $enddate, $event['recur_data'], $exceptions); |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | /** |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | * @param DateTime/string starttime of the event (in servertime) |
| 777 | 777 | * @param string $to_tz new timezone |
| 778 | 778 | */ |
| 779 | - public static function rrule2tz(array &$event,$starttime,$to_tz) |
|
| 779 | + public static function rrule2tz(array &$event, $starttime, $to_tz) |
|
| 780 | 780 | { |
| 781 | 781 | // We assume that the difference between timezones can result |
| 782 | 782 | // in a maximum of one day |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | self::$tz_cache[$to_tz] = calendar_timezones::DateTimeZone($to_tz); |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | - $time = is_a($starttime,'DateTime') ? |
|
| 800 | + $time = is_a($starttime, 'DateTime') ? |
|
| 801 | 801 | $starttime : new Api\DateTime($starttime, Api\DateTime::$server_timezone); |
| 802 | 802 | $time->setTimezone(self::$tz_cache[$event['tzid']]); |
| 803 | 803 | $remote = clone $time; |
@@ -815,11 +815,11 @@ discard block |
||
| 815 | 815 | if ($delta == 1 || $delta == -6) |
| 816 | 816 | { |
| 817 | 817 | $mask = $mask << 1; |
| 818 | - if ($mask & 128) $mask = $mask - 127; // overflow |
|
| 818 | + if ($mask&128) $mask = $mask - 127; // overflow |
|
| 819 | 819 | } |
| 820 | 820 | else |
| 821 | 821 | { |
| 822 | - if ($mask & 1) $mask = $mask + 128; // underflow |
|
| 822 | + if ($mask&1) $mask = $mask + 128; // underflow |
|
| 823 | 823 | $mask = $mask >> 1; |
| 824 | 824 | } |
| 825 | 825 | $event['recur_data'] = $mask; |
@@ -830,15 +830,15 @@ discard block |
||
| 830 | 830 | |
| 831 | 831 | if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) // some tests |
| 832 | 832 | { |
| 833 | - ini_set('display_errors',1); |
|
| 834 | - error_reporting(E_ALL & ~E_NOTICE); |
|
| 833 | + ini_set('display_errors', 1); |
|
| 834 | + error_reporting(E_ALL&~E_NOTICE); |
|
| 835 | 835 | function lang($str) { return $str; } |
| 836 | 836 | $GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $_REQUEST['user-tz'] ? $_REQUEST['user-tz'] : 'Europe/Berlin'; |
| 837 | 837 | require_once('../../api/src/autoload.php'); |
| 838 | 838 | |
| 839 | 839 | if (!isset($_REQUEST['time'])) |
| 840 | 840 | { |
| 841 | - $now = new Api\DateTime('now',new DateTimeZone($_REQUEST['tz'] = 'UTC')); |
|
| 841 | + $now = new Api\DateTime('now', new DateTimeZone($_REQUEST['tz'] = 'UTC')); |
|
| 842 | 842 | $_REQUEST['time'] = $now->format(); |
| 843 | 843 | $_REQUEST['type'] = calendar_rrule::WEEKLY; |
| 844 | 844 | $_REQUEST['interval'] = 2; |
@@ -847,29 +847,29 @@ discard block |
||
| 847 | 847 | $_REQUEST['user-tz'] = 'Europe/Berlin'; |
| 848 | 848 | } |
| 849 | 849 | echo "<html>\n<head>\n\t<title>Test calendar_rrule class</title>\n</head>\n<body>\n<form method='GET'>\n"; |
| 850 | - echo "<p>Date+Time: ".Api\Html::input('time',$_REQUEST['time']). |
|
| 851 | - Api\Html::select('tz',$_REQUEST['tz'],Api\DateTime::getTimezones())."</p>\n"; |
|
| 852 | - echo "<p>Type: ".Api\Html::select('type',$_REQUEST['type'],calendar_rrule::$types)."\n". |
|
| 853 | - "Interval: ".Api\Html::input('interval',$_REQUEST['interval'])."</p>\n"; |
|
| 850 | + echo "<p>Date+Time: ".Api\Html::input('time', $_REQUEST['time']). |
|
| 851 | + Api\Html::select('tz', $_REQUEST['tz'], Api\DateTime::getTimezones())."</p>\n"; |
|
| 852 | + echo "<p>Type: ".Api\Html::select('type', $_REQUEST['type'], calendar_rrule::$types)."\n". |
|
| 853 | + "Interval: ".Api\Html::input('interval', $_REQUEST['interval'])."</p>\n"; |
|
| 854 | 854 | echo "<table><tr><td>\n"; |
| 855 | - echo "Weekdays:<br />".Api\Html::checkbox_multiselect('weekdays',$_REQUEST['weekdays'],calendar_rrule::$days,false,'','7',false,'height: 150px;')."\n"; |
|
| 855 | + echo "Weekdays:<br />".Api\Html::checkbox_multiselect('weekdays', $_REQUEST['weekdays'], calendar_rrule::$days, false, '', '7', false, 'height: 150px;')."\n"; |
|
| 856 | 856 | echo "</td><td>\n"; |
| 857 | - echo "<p>Exceptions:<br />".Api\Html::textarea('exceptions',$_REQUEST['exceptions'],'style="height: 150px;"')."\n"; |
|
| 857 | + echo "<p>Exceptions:<br />".Api\Html::textarea('exceptions', $_REQUEST['exceptions'], 'style="height: 150px;"')."\n"; |
|
| 858 | 858 | echo "</td></tr></table>\n"; |
| 859 | - echo "<p>Enddate: ".Api\Html::input('enddate',$_REQUEST['enddate'])."</p>\n"; |
|
| 860 | - echo "<p>Display recurances in ".Api\Html::select('user-tz',$_REQUEST['user-tz'],Api\DateTime::getTimezones())."</p>\n"; |
|
| 861 | - echo "<p>".Api\Html::submit_button('calc','Calculate')."</p>\n"; |
|
| 859 | + echo "<p>Enddate: ".Api\Html::input('enddate', $_REQUEST['enddate'])."</p>\n"; |
|
| 860 | + echo "<p>Display recurances in ".Api\Html::select('user-tz', $_REQUEST['user-tz'], Api\DateTime::getTimezones())."</p>\n"; |
|
| 861 | + echo "<p>".Api\Html::submit_button('calc', 'Calculate')."</p>\n"; |
|
| 862 | 862 | echo "</form>\n"; |
| 863 | 863 | |
| 864 | 864 | $tz = new DateTimeZone($_REQUEST['tz']); |
| 865 | - $time = new Api\DateTime($_REQUEST['time'],$tz); |
|
| 866 | - if ($_REQUEST['enddate']) $enddate = new Api\DateTime($_REQUEST['enddate'],$tz); |
|
| 867 | - $weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; } |
|
| 868 | - if ($_REQUEST['exceptions']) foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); } |
|
| 865 | + $time = new Api\DateTime($_REQUEST['time'], $tz); |
|
| 866 | + if ($_REQUEST['enddate']) $enddate = new Api\DateTime($_REQUEST['enddate'], $tz); |
|
| 867 | + $weekdays = 0; foreach ((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; } |
|
| 868 | + if ($_REQUEST['exceptions']) foreach (preg_split("/[,\r\n]+ ?/", $_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); } |
|
| 869 | 869 | |
| 870 | - $rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions); |
|
| 870 | + $rrule = new calendar_rrule($time, $_REQUEST['type'], $_REQUEST['interval'], $enddate, $weekdays, $exceptions); |
|
| 871 | 871 | echo "<h3>".$time->format('l').', '.$time.' ('.$tz->getName().') '.$rrule."</h3>\n"; |
| 872 | - foreach($rrule as $rtime) |
|
| 872 | + foreach ($rrule as $rtime) |
|
| 873 | 873 | { |
| 874 | 874 | $rtime->setTimezone(Api\DateTime::$user_timezone); |
| 875 | 875 | echo ++$n.': '.$rtime->format('l').', '.$rtime."<br />\n"; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | function __construct() |
| 26 | 26 | { |
| 27 | - if (false) parent::__construct(); // can not be called, but gives IDE warning |
|
| 27 | + if (false) parent::__construct(); // can not be called, but gives IDE warning |
|
| 28 | 28 | |
| 29 | 29 | $this->datasource('calendar'); |
| 30 | 30 | |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | if (!is_array($data_id)) |
| 50 | 50 | { |
| 51 | - if (!(int) $data_id || !($data = $cal->read((int) $data_id))) |
|
| 51 | + if (!(int)$data_id || !($data = $cal->read((int)$data_id))) |
|
| 52 | 52 | { |
| 53 | 53 | return false; |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | else |
| 57 | 57 | { |
| 58 | - $data =& $data_id; |
|
| 58 | + $data = & $data_id; |
|
| 59 | 59 | } |
| 60 | 60 | $ds = array( |
| 61 | 61 | 'pe_title' => $cal->link_title($data), |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | 'pe_details' => $data['description'] ? nl2br($data['description']) : '', |
| 66 | 66 | ); |
| 67 | 67 | // return first global category, as PM only supports one |
| 68 | - foreach($data['category'] ? explode(',', $data['category']) : array() as $cat_id) |
|
| 68 | + foreach ($data['category'] ? explode(',', $data['category']) : array() as $cat_id) |
|
| 69 | 69 | { |
| 70 | 70 | if (Api\Categories::is_global($cat_id)) |
| 71 | 71 | { |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | // calculation of the time |
| 77 | - $ds['pe_planned_time'] = (int) (($ds['pe_planned_end'] - $ds['pe_planned_start'])/60); // time is in minutes |
|
| 77 | + $ds['pe_planned_time'] = (int)(($ds['pe_planned_end'] - $ds['pe_planned_start']) / 60); // time is in minutes |
|
| 78 | 78 | |
| 79 | 79 | // if the event spans multiple days, we have to substract the nights (24h - daily working time specified in PM) |
| 80 | - if (($ds['pe_planned_time']/ 60 > 24) && date('Y-m-d',$ds['pe_planned_end']) != date('Y-m-d',$ds['pe_planned_start'])) |
|
| 80 | + if (($ds['pe_planned_time'] / 60 > 24) && date('Y-m-d', $ds['pe_planned_end']) != date('Y-m-d', $ds['pe_planned_start'])) |
|
| 81 | 81 | { |
| 82 | 82 | $start = $end = null; |
| 83 | - foreach(array('start','end') as $name) |
|
| 83 | + foreach (array('start', 'end') as $name) |
|
| 84 | 84 | { |
| 85 | 85 | $arr = $cal->date2array($ds['pe_planned_'.$name]); |
| 86 | 86 | $arr['hour'] = 12; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | if (!is_array($this->pm_config)) |
| 94 | 94 | { |
| 95 | - $c =& CreateObject('phpgwapi.config','projectmanager'); |
|
| 95 | + $c = & CreateObject('phpgwapi.config', 'projectmanager'); |
|
| 96 | 96 | $c->read_repository(); |
| 97 | 97 | $this->pm_config = $c->config_data; |
| 98 | 98 | unset($c); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | $ds['pe_planned_time'] -= $nights * 60 * (24 - $this->pm_config['hours_per_workday']); |
| 102 | 102 | } |
| 103 | - foreach($data['participants'] as $uid => $status) |
|
| 103 | + foreach ($data['participants'] as $uid => $status) |
|
| 104 | 104 | { |
| 105 | 105 | if ($status != 'R' && is_numeric($uid)) // only users for now |
| 106 | 106 | { |