Completed
Push — 17.1 ( dac2e8...6ec951 )
by Ralf
23:02 queued 11:05
created
calendar/inc/class.calendar_groupdav.inc.php 1 patch
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @param string $id =''
154 154
 	 * @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
155 155
 	 */
156
-	function propfind($path,&$options,&$files,$user,$id='')
156
+	function propfind($path, &$options, &$files, $user, $id = '')
157 157
 	{
158 158
 		if ($this->debug)
159 159
 		{
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 			'enum_recuring' => false,
180 180
 			'daywise' => false,
181 181
 			'date_format' => 'server',
182
-			'no_total' => true,	// we need no total number of rows (saves extra query)
183
-			'cfs' => array(),	// return custom-fields, as we use them to store X- attributes
182
+			'no_total' => true, // we need no total number of rows (saves extra query)
183
+			'cfs' => array(), // return custom-fields, as we use them to store X- attributes
184 184
 		);
185
-		foreach(array(
185
+		foreach (array(
186 186
 			'start' => $GLOBALS['egw_info']['user']['preferences']['groupdav']['calendar-past-limit'],
187 187
 			'end' => $GLOBALS['egw_info']['user']['preferences']['groupdav']['calendar-future-limit'],
188 188
 		) as $name => $value)
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 			{
192 192
 				$value = $name == 'start' ? self::PAST_LIMIT : self::FUTURE_LIMIT;
193 193
 			}
194
-			$filter[$name] = $this->bo->now + 24*3600*($name == 'start' ? -1 : 1)*abs($value);
194
+			$filter[$name] = $this->bo->now + 24 * 3600 * ($name == 'start' ? -1 : 1) * abs($value);
195 195
 		}
196 196
 		if ($this->client_shared_uid_exceptions)	// do NOT return (non-virtual) exceptions
197 197
 		{
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 			$filter['filter'] = 'owner';
204 204
 		}
205 205
 		// scheduling inbox, shows only not yet accepted or rejected events
206
-		elseif (substr($path,-7) == '/inbox/')
206
+		elseif (substr($path, -7) == '/inbox/')
207 207
 		{
208 208
 			$filter['filter'] = 'unknown';
209
-			$filter['start'] = $this->bo->now;	// only return future invitations
209
+			$filter['start'] = $this->bo->now; // only return future invitations
210 210
 		}
211 211
 		// ToDo: not sure what scheduling outbox is supposed to show, leave it empty for now
212
-		elseif (substr($path,-8) == '/outbox/')
212
+		elseif (substr($path, -8) == '/outbox/')
213 213
 		{
214 214
 			return true;
215 215
 		}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			// when trying to request not supported components, eg. VTODO on a calendar collection
227 227
 			return true;
228 228
 		}
229
-		if ($id) $path = dirname($path).'/';	// caldav_name get's added anyway in the callback
229
+		if ($id) $path = dirname($path).'/'; // caldav_name get's added anyway in the callback
230 230
 
231 231
 		if ($this->debug > 1)
232 232
 		{
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
 			$this->sync_collection_token = null;
245 245
 
246
-			$filter['order'] = 'cal_modified ASC';	// return oldest modifications first
246
+			$filter['order'] = 'cal_modified ASC'; // return oldest modifications first
247 247
 			$filter['sync-collection'] = true;
248 248
 			// no end-date / limit into the future, as unchanged entries would never be transferted later on
249 249
 			unset($filter['end']);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 		if (isset($nresults))
253 253
 		{
254
-			unset($filter['no_total']);	// we need the total!
254
+			unset($filter['no_total']); // we need the total!
255 255
 			$files['files'] = $this->propfind_callback($path, $filter, array(0, (int)$nresults));
256 256
 
257 257
 			// hack to support limit with sync-collection report: events are returned in modified ASC order (oldest first)
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 			if ($options['root']['name'] == 'sync-collection' && $this->bo->total > $nresults)
261 261
 			{
262 262
 				--$this->sync_collection_token;
263
-				$files['sync-token-params'][] = true;	// tel get_sync_collection_token that we have more entries
263
+				$files['sync-token-params'][] = true; // tel get_sync_collection_token that we have more entries
264 264
 			}
265 265
 		}
266 266
 		else
267 267
 		{
268 268
 			// return iterator, calling ourself to return result in chunks
269
-			$files['files'] = new Api\CalDAV\PropfindIterator($this,$path,$filter,$files['files']);
269
+			$files['files'] = new Api\CalDAV\PropfindIterator($this, $path, $filter, $files['files']);
270 270
 		}
271 271
 		if (isset($_GET['download']))
272 272
 		{
@@ -286,9 +286,9 @@  discard block
 block discarded – undo
286 286
 		Api\Header\Content::type('calendar.ics', 'text/calendar');
287 287
 
288 288
 		$n = 0;
289
-		foreach($files as $file)
289
+		foreach ($files as $file)
290 290
 		{
291
-			if (!$n++) continue;	// first entry is collection itself
291
+			if (!$n++) continue; // first entry is collection itself
292 292
 
293 293
 			$icalendar = $file['props']['calendar-data']['val'];
294 294
 			if (($start = strpos($icalendar, 'BEGIN:VEVENT')) !== false &&
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 						echo substr($icalendar, 0, $start);
313 313
 					}
314 314
 				}
315
-				echo substr($icalendar, $start, $end-$start);
315
+				echo substr($icalendar, $start, $end - $start);
316 316
 			}
317 317
 		}
318 318
 		if ($icalendar && $end)
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 * @param array|boolean $start =false false=return all or array(start,num)
331 331
 	 * @return array with "files" array with values for keys path and props
332 332
 	 */
333
-	function &propfind_callback($path,array $filter,$start=false)
333
+	function &propfind_callback($path, array $filter, $start = false)
334 334
 	{
335 335
 		if ($this->debug) $starttime = microtime(true);
336 336
 
337 337
 		$calendar_data = $this->caldav->prop_requested('calendar-data', Api\CalDAV::CALDAV, true);
338
-		if (!is_array($calendar_data)) $calendar_data = false;	// not in allprop or autoindex
338
+		if (!is_array($calendar_data)) $calendar_data = false; // not in allprop or autoindex
339 339
 
340 340
 		$files = array();
341 341
 
@@ -347,11 +347,11 @@  discard block
 block discarded – undo
347 347
 		$requested_multiget_ids = (array)$filter['query'][self::$path_attr];
348 348
 		$sync_collection = $filter['sync-collection'];
349 349
 
350
-		$events =& $this->bo->search($filter);
350
+		$events = & $this->bo->search($filter);
351 351
 
352 352
 		if ($events)
353 353
 		{
354
-			foreach($events as $event)
354
+			foreach ($events as $event)
355 355
 			{
356 356
 				// remove event from requested multiget ids, to be able to report not found urls
357 357
 				if ($requested_multiget_ids && ($k = array_search($event[self::$path_attr], $requested_multiget_ids)) !== false)
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 					unset($requested_multiget_ids[$k]);
360 360
 				}
361 361
 				// sync-collection report: deleted entries need to be reported without properties, same for rejected or deleted invitations
362
-				if ($sync_collection && ($event['deleted'] && !$event['cal_reference'] || in_array($event['participants'][$filter['users']][0], array('R','X'))))
362
+				if ($sync_collection && ($event['deleted'] && !$event['cal_reference'] || in_array($event['participants'][$filter['users']][0], array('R', 'X'))))
363 363
 				{
364 364
 					$files[] = array('path' => $path.urldecode($this->get_path($event)));
365 365
 					continue;
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 						!isset($calendar_data['children']['expand']) ? false :
391 391
 							($calendar_data['children']['expand']['attrs'] ? $calendar_data['children']['expand']['attrs'] : true));
392 392
 					$props['getcontentlength'] = bytes($content);
393
-					$props['calendar-data'] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'calendar-data',$content);
393
+					$props['calendar-data'] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'calendar-data', $content);
394 394
 				}
395 395
 				/* Calendarserver reports new events with schedule-changes: action: create, which iCal request
396 396
 				 * adding it, unfortunately does not lead to showing the new event in the users inbox
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 		// report not found multiget urls
410 410
 		if ($requested_multiget_ids)
411 411
 		{
412
-			foreach($requested_multiget_ids as $id)
412
+			foreach ($requested_multiget_ids as $id)
413 413
 			{
414 414
 				$files[] = array('path' => $path.$id.self::$path_extension);
415 415
 			}
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	private function _created_updated_by_prop($user, $time)
446 446
 	{
447 447
 		$props = array();
448
-		foreach(array(
448
+		foreach (array(
449 449
 			'first-name' => 'account_firstname',
450 450
 			'last-name' => 'account_lastname',
451 451
 			'href' => 'account_email',
@@ -488,23 +488,23 @@  discard block
 block discarded – undo
488 488
 			$cal_end = $cal_filters['end']; unset($cal_filters['end']);
489 489
 			$num_filters = count($cal_filters);
490 490
 
491
-			foreach($options['filters'] as $filter)
491
+			foreach ($options['filters'] as $filter)
492 492
 			{
493
-				switch($filter['name'])
493
+				switch ($filter['name'])
494 494
 				{
495 495
 					case 'comp-filter':
496 496
 						if ($this->debug > 1) error_log(__METHOD__."($options[path],...) comp-filter='{$filter['attrs']['name']}'");
497 497
 
498
-						switch($filter['attrs']['name'])
498
+						switch ($filter['attrs']['name'])
499 499
 						{
500 500
 							case 'VTODO':
501
-								return false;	// return nothing for now, todo: check if we can pass it on to the infolog handler
501
+								return false; // return nothing for now, todo: check if we can pass it on to the infolog handler
502 502
 								// todos are handled by the infolog handler
503 503
 								//$infolog_handler = new groupdav_infolog();
504 504
 								//return $infolog_handler->propfind($options['path'],$options,$options['files'],$user,$method);
505 505
 							case 'VCALENDAR':
506 506
 							case 'VEVENT':
507
-								break;			// that's our default anyway
507
+								break; // that's our default anyway
508 508
 						}
509 509
 						break;
510 510
 					case 'prop-filter':
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 						if ($this->debug) error_log(__METHOD__."($options[path],...) param-filter='{$filter['attrs']['name']}' not (yet) implemented!");
528 528
 						break;
529 529
 					case 'time-range':
530
-				 		if ($this->debug > 1) error_log(__FILE__ . __METHOD__."($options[path],...) time-range={$filter['attrs']['start']}-{$filter['attrs']['end']}");
530
+				 		if ($this->debug > 1) error_log(__FILE__.__METHOD__."($options[path],...) time-range={$filter['attrs']['start']}-{$filter['attrs']['end']}");
531 531
 				 		if (!empty($filter['attrs']['start']))
532 532
 				 		{
533 533
 					 		$cal_filters['start'] = $this->vCalendar->_parseDateTime($filter['attrs']['start']);
534 534
 				 		}
535 535
 				 		if (!empty($filter['attrs']['end']))
536 536
 				 		{
537
-					 		$cal_filters['end']   = $this->vCalendar->_parseDateTime($filter['attrs']['end']);
537
+					 		$cal_filters['end'] = $this->vCalendar->_parseDateTime($filter['attrs']['end']);
538 538
 				 		}
539 539
 						break;
540 540
 					default:
@@ -555,9 +555,9 @@  discard block
 block discarded – undo
555 555
 		    <B:nresults>10</B:nresults>
556 556
 		  </B:limit>
557 557
 		*/
558
-		foreach((array)$options['other'] as $option)
558
+		foreach ((array)$options['other'] as $option)
559 559
 		{
560
-			switch($option['name'])
560
+			switch ($option['name'])
561 561
 			{
562 562
 				case 'nresults':
563 563
 					$nresults = (int)$option['data'];
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 				case 'limit':
567 567
 					break;
568 568
 				case 'href':
569
-					break;	// from addressbook-multiget, handled below
569
+					break; // from addressbook-multiget, handled below
570 570
 				// rfc 6578 sync-report
571 571
 				case 'sync-token':
572 572
 					if (!empty($option['data']))
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 						$parts = explode('/', $option['data']);
575 575
 						$sync_token = array_pop($parts);
576 576
 						$cal_filters['query'][] = 'cal_modified>'.(int)$sync_token;
577
-						$cal_filters['filter'] = 'everything';	// to return deleted entries too
577
+						$cal_filters['filter'] = 'everything'; // to return deleted entries too
578 578
 						// no standard time-range!
579 579
 						unset($cal_filters['start']);
580 580
 					}
@@ -603,25 +603,25 @@  discard block
 block discarded – undo
603 603
 			if ($id)
604 604
 			{
605 605
 				$cal_filters['query'][self::$path_attr] = self::$path_extension ?
606
-					basename($id,self::$path_extension) : $id;
606
+					basename($id, self::$path_extension) : $id;
607 607
 			}
608 608
 			else	// fetch all given url's
609 609
 			{
610
-				foreach($options['other'] as $option)
610
+				foreach ($options['other'] as $option)
611 611
 				{
612 612
 					if ($option['name'] == 'href')
613 613
 					{
614
-						$parts = explode('/',$option['data']);
614
+						$parts = explode('/', $option['data']);
615 615
 						if (($id = urldecode(array_pop($parts))))
616 616
 						{
617 617
 							$cal_filters['query'][self::$path_attr][] = self::$path_extension ?
618
-								basename($id,self::$path_extension) : $id;
618
+								basename($id, self::$path_extension) : $id;
619 619
 						}
620 620
 					}
621 621
 				}
622 622
 			}
623 623
 
624
-			if ($this->debug > 1) error_log(__FILE__ . __METHOD__ ."($options[path],...,$id) calendar-multiget: ids=".implode(',',$ids).', cal_filters='.array2string($cal_filters));
624
+			if ($this->debug > 1) error_log(__FILE__.__METHOD__."($options[path],...,$id) calendar-multiget: ids=".implode(',', $ids).', cal_filters='.array2string($cal_filters));
625 625
 		}
626 626
 		return true;
627 627
 	}
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
 	 * @param int $user =null account_id
635 635
 	 * @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
636 636
 	 */
637
-	function get(&$options,$id,$user=null)
637
+	function get(&$options, $id, $user = null)
638 638
 	{
639
-		if (!is_array($event = $this->_common_get_put_delete('GET',$options,$id)))
639
+		if (!is_array($event = $this->_common_get_put_delete('GET', $options, $id)))
640 640
 		{
641 641
 			return $event;
642 642
 		}
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 * @param boolean|array $expand =false true or array with values for 'start', 'end' to expand recurrences
665 665
 	 * @return string
666 666
 	 */
667
-	private function iCal(array $event,$user=null, $method=null, $expand=false)
667
+	private function iCal(array $event, $user = null, $method = null, $expand = false)
668 668
 	{
669 669
 		static $handler = null;
670 670
 		if (is_null($handler)) $handler = $this->_get_handler();
@@ -688,13 +688,13 @@  discard block
 block discarded – undo
688 688
 				if (isset($expand['start'])) $expand['start'] = $this->vCalendar->_parseDateTime($expand['start']);
689 689
 				if (isset($expand['end'])) $expand['end'] = $this->vCalendar->_parseDateTime($expand['end']);
690 690
 			}
691
-			$events =& self::get_series($event['uid'], $this->bo, $expand, $user);
691
+			$events = & self::get_series($event['uid'], $this->bo, $expand, $user);
692 692
 			// as alarm is now only on next recurrence, set alarm from original event on master
693 693
 			if ($event['alarm']) $events[0]['alarm'] = $event['alarm'];
694 694
 		}
695
-		elseif(!$this->client_shared_uid_exceptions && $event['reference'])
695
+		elseif (!$this->client_shared_uid_exceptions && $event['reference'])
696 696
 		{
697
-			$events[0]['uid'] .= '-'.$event['id'];	// force a different uid
697
+			$events[0]['uid'] .= '-'.$event['id']; // force a different uid
698 698
 		}
699 699
 		return $handler->exportVCal($events, '2.0', $method);
700 700
 	}
@@ -710,20 +710,20 @@  discard block
 block discarded – undo
710 710
 	 * @param int $user =null account_id of calendar to display, to remove master, if current user does not participate in
711 711
 	 * @return array
712 712
 	 */
713
-	private static function &get_series($uid,calendar_bo $bo=null, $expand=false, $user=null)
713
+	private static function &get_series($uid, calendar_bo $bo = null, $expand = false, $user = null)
714 714
 	{
715 715
 		if (is_null($bo)) $bo = new calendar_bopdate();
716 716
 
717 717
 		$params = array(
718 718
 			'query' => array('cal_uid' => $uid),
719
-			'filter' => 'owner',  // return all possible entries
719
+			'filter' => 'owner', // return all possible entries
720 720
 			'daywise' => false,
721 721
 			'date_format' => 'server',
722
-			'cfs' => array(),	// read cfs as we use them to store X- attributes
722
+			'cfs' => array(), // read cfs as we use them to store X- attributes
723 723
 		);
724 724
 		if (is_array($expand)) $params += $expand;
725 725
 
726
-		if (!($events =& $bo->search($params)))
726
+		if (!($events = & $bo->search($params)))
727 727
 		{
728 728
 			return array();
729 729
 		}
@@ -731,12 +731,12 @@  discard block
 block discarded – undo
731 731
 		// find master, which is not always first event, eg. when first event is an exception
732 732
 		$master = null;
733 733
 		$exceptions = array();
734
-		foreach($events as $k => &$recurrence)
734
+		foreach ($events as $k => &$recurrence)
735 735
 		{
736 736
 			if ($recurrence['recur_type'])
737 737
 			{
738 738
 				$master = $recurrence;
739
-				$exceptions =& $master['recur_exception'];
739
+				$exceptions = & $master['recur_exception'];
740 740
 				unset($events[$k]);
741 741
 				break;
742 742
 			}
@@ -744,13 +744,13 @@  discard block
 block discarded – undo
744 744
 		// if recurring event starts in future behind horizont, nothing will be returned by bo::search()
745 745
 		if (!isset($master)) $master = $bo->read($uid);
746 746
 
747
-		foreach($events as $k => &$recurrence)
747
+		foreach ($events as $k => &$recurrence)
748 748
 		{
749 749
 			//error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($uid)[$k]:" . array2string($recurrence));
750 750
 			if ($master && $recurrence['reference'] != $master['id'])
751 751
 			{
752 752
 				unset($events[$k]);
753
-				continue;	// same uid, but references a different event or is own master
753
+				continue; // same uid, but references a different event or is own master
754 754
 			}
755 755
 			if (!$master || $recurrence['id'] != $master['id'])	// real exception
756 756
 			{
@@ -771,11 +771,11 @@  discard block
 block discarded – undo
771 771
 				// at least Lightning "understands" EXDATE as exception from what's included
772 772
 				// in the whole resource / VCALENDAR component
773 773
 				// not removing it causes Lightning to remove the exception itself
774
-				if (($e = array_search($recurrence['recurrence'],$exceptions)) !== false)
774
+				if (($e = array_search($recurrence['recurrence'], $exceptions)) !== false)
775 775
 				{
776 776
 					unset($exceptions[$e]);
777 777
 				}
778
-				continue;	// nothing to change
778
+				continue; // nothing to change
779 779
 			}
780 780
 			// add alarms from master to recurrences, as clients otherwise have no alarms on virtual exceptions
781 781
 			if ($master && $master['alarm'])
@@ -786,14 +786,14 @@  discard block
 block discarded – undo
786 786
 			if (!$expand && $master && $master['participants'] == $recurrence['participants'])
787 787
 			{
788 788
 				//error_log('NO exception: '.array2string($recurrence));
789
-				unset($events[$k]);	// no exception --> remove it
789
+				unset($events[$k]); // no exception --> remove it
790 790
 				continue;
791 791
 			}
792 792
 			// this is a virtual exception now (no extra event/cal_id in DB)
793 793
 			//error_log('virtual exception: '.array2string($recurrence));
794 794
 			$recurrence['recurrence'] = $recurrence['start'];
795 795
 			if ($master) $recurrence['reference'] = $master['id'];
796
-			$recurrence['recur_type'] = MCAL_RECUR_NONE;	// is set, as this is a copy of the master
796
+			$recurrence['recur_type'] = MCAL_RECUR_NONE; // is set, as this is a copy of the master
797 797
 			// not for included exceptions (Lightning): $master['recur_exception'][] = $recurrence['start'];
798 798
 		}
799 799
 		// only add master if we are not expanding and current user participates in master (and not just some exceptions)
@@ -829,11 +829,11 @@  discard block
 block discarded – undo
829 829
 	 * @param string $prefix =null user prefix from path (eg. /ralf from /ralf/addressbook)
830 830
 	 * @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
831 831
 	 */
832
-	function put(&$options,$id,$user=null,$prefix=null)
832
+	function put(&$options, $id, $user = null, $prefix = null)
833 833
 	{
834
-		if ($this->debug) error_log(__METHOD__."($id, $user)".print_r($options,true));
834
+		if ($this->debug) error_log(__METHOD__."($id, $user)".print_r($options, true));
835 835
 
836
-		if (!$prefix) $user = null;	// /infolog/ does not imply setting the current user (for new entries it's done anyway)
836
+		if (!$prefix) $user = null; // /infolog/ does not imply setting the current user (for new entries it's done anyway)
837 837
 
838 838
 		// work around missing handling / racecondition in Lightning, if event already exists on server,
839 839
 		// but Lightning has not yet synced with the server: Lightning just retries the PUT, not GETing the event
@@ -850,12 +850,12 @@  discard block
 block discarded – undo
850 850
 		{
851 851
 			$_SERVER['HTTP_IF_SCHEDULE_TAG_MATCH'] = $_SERVER['HTTP_IF_SCHEDULE'];
852 852
 		}
853
-		$return_no_access = true;	// as handled by importVCal anyway and allows it to set the status for participants
854
-		$oldEvent = $this->_common_get_put_delete('PUT',$options,$id,$return_no_access,
855
-			isset($_SERVER['HTTP_IF_SCHEDULE_TAG_MATCH']));	// dont fail with 412 Precondition Failed in that case
853
+		$return_no_access = true; // as handled by importVCal anyway and allows it to set the status for participants
854
+		$oldEvent = $this->_common_get_put_delete('PUT', $options, $id, $return_no_access,
855
+			isset($_SERVER['HTTP_IF_SCHEDULE_TAG_MATCH'])); // dont fail with 412 Precondition Failed in that case
856 856
 		if (!is_null($oldEvent) && !is_array($oldEvent))
857 857
 		{
858
-			if ($this->debug) error_log(__METHOD__.': '.print_r($oldEvent,true).function_backtrace());
858
+			if ($this->debug) error_log(__METHOD__.': '.print_r($oldEvent, true).function_backtrace());
859 859
 			return $oldEvent;
860 860
 		}
861 861
 
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 				if (($events = $handler->icaltoegw($vCalendar)))
948 948
 				{
949 949
 					$modified = 0;
950
-					foreach($events as $n => $event)
950
+					foreach ($events as $n => $event)
951 951
 					{
952 952
 						// for recurrances of event series, we need to read correct recurrence (or if series master is no first event)
953 953
 						if ($event['recurrence'] || $n && !$event['recurrence'] || isset($series))
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 								$series = self::get_series($event['uid'], $this->bo);
959 959
 								//foreach($series as $s => $sEvent) error_log("series[$s]: ".array2string($sEvent));
960 960
 							}
961
-							foreach($series as $oldEvent)
961
+							foreach ($series as $oldEvent)
962 962
 							{
963 963
 								if ($oldEvent['recurrence'] == $event['recurrence']) break;
964 964
 							}
@@ -1023,9 +1023,9 @@  discard block
 block discarded – undo
1023 1023
 					isset($oldEvent['participants'][$GLOBALS['egw_info']['user']['account_id']]))
1024 1024
 				{
1025 1025
 					// just update etag in database
1026
-					$GLOBALS['egw']->db->update($this->bo->so->cal_table,'cal_etag=cal_etag+1',array(
1026
+					$GLOBALS['egw']->db->update($this->bo->so->cal_table, 'cal_etag=cal_etag+1', array(
1027 1027
 						'cal_id' => $eventId,
1028
-					),__LINE__,__FILE__,'calendar');
1028
+					), __LINE__, __FILE__, 'calendar');
1029 1029
 				}
1030 1030
 			}
1031 1031
 		}
@@ -1077,9 +1077,9 @@  discard block
 block discarded – undo
1077 1077
 	 * @param int $user =null account_id of owner, default null
1078 1078
 	 * @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
1079 1079
 	 */
1080
-	function post(&$options,$id,$user=null)
1080
+	function post(&$options, $id, $user = null)
1081 1081
 	{
1082
-		if ($this->debug) error_log(__METHOD__."($id, $user)".print_r($options,true));
1082
+		if ($this->debug) error_log(__METHOD__."($id, $user)".print_r($options, true));
1083 1083
 
1084 1084
 		$vCalendar = htmlspecialchars_decode($options['content']);
1085 1085
 		$charset = null;
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
 			}
1102 1102
 		}
1103 1103
 
1104
-		if (substr($options['path'],-8) == '/outbox/')
1104
+		if (substr($options['path'], -8) == '/outbox/')
1105 1105
 		{
1106 1106
 			if (preg_match('/^METHOD:REQUEST(\r\n|\r|\n)(.*)^BEGIN:VFREEBUSY/ism', $vCalendar))
1107 1107
 			{
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 	 */
1153 1153
 	protected function outbox_freebusy_request($ical, $charset, $user, array &$options)
1154 1154
 	{
1155
-		unset($options);	// not used, but required by function signature
1155
+		unset($options); // not used, but required by function signature
1156 1156
 
1157 1157
 		$vcal = new Horde_Icalendar();
1158 1158
 		if (!$vcal->parsevCalendar($ical, 'VCALENDAR', $charset))
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 
1166 1166
 		$handler = $this->_get_handler();
1167 1167
 		$handler->setSupportedFields('groupdav');
1168
-		$handler->calendarOwner = $handler->user = 0;	// to NOT default owner/organizer to something
1168
+		$handler->calendarOwner = $handler->user = 0; // to NOT default owner/organizer to something
1169 1169
 		if (!($component = $vcal->getComponent(0)) ||
1170 1170
 			!($event = $handler->vevent2egw($component, $version, $handler->supportedFields, $this->caldav->current_user_principal, 'Horde_Icalendar_Vfreebusy')))
1171 1171
 		{
@@ -1190,13 +1190,13 @@  discard block
 block discarded – undo
1190 1190
 		$xml->startDocument('1.0', 'UTF-8');
1191 1191
 		$xml->startElementNs('C', 'schedule-response', Api\CalDAV::CALDAV);
1192 1192
 
1193
-		foreach(array_keys($event['participants']) as $uid)
1193
+		foreach (array_keys($event['participants']) as $uid)
1194 1194
 		{
1195 1195
 			$xml->startElementNs('C', 'response', null);
1196 1196
 
1197 1197
 			$xml->startElementNs('C', 'recipient', null);
1198
-			$xml->writeElementNs('D', 'href', 'DAV:', $attendee=array_shift($attendees));
1199
-			$xml->endElement();	// recipient
1198
+			$xml->writeElementNs('D', 'href', 'DAV:', $attendee = array_shift($attendees));
1199
+			$xml->endElement(); // recipient
1200 1200
 
1201 1201
 			$xml->writeElementNs('C', 'request-status', null, '2.0;Success');
1202 1202
 			$xml->writeElementNs('C', 'calendar-data', null,
@@ -1204,13 +1204,13 @@  discard block
 block discarded – undo
1204 1204
 					'UID' => $event['uid'],
1205 1205
 					'ORGANIZER' => $organizer,
1206 1206
 					'ATTENDEE' => $attendee,
1207
-				)+(empty($mask_uid) || !is_string($mask_uid) ? array() : array(
1207
+				) + (empty($mask_uid) || !is_string($mask_uid) ? array() : array(
1208 1208
 					'X-CALENDARSERVER-MASK-UID' => $mask_uid,
1209 1209
 				))));
1210 1210
 
1211
-			$xml->endElement();	// response
1211
+			$xml->endElement(); // response
1212 1212
 		}
1213
-		$xml->endElement();	// schedule-response
1213
+		$xml->endElement(); // schedule-response
1214 1214
 		$xml->endDocument();
1215 1215
 		echo $xml->outputMemory();
1216 1216
 
@@ -1225,14 +1225,14 @@  discard block
 block discarded – undo
1225 1225
 	 * @param int $user account_id
1226 1226
 	 * @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
1227 1227
 	 */
1228
-	function free_busy_report($path,$options,$user)
1228
+	function free_busy_report($path, $options, $user)
1229 1229
 	{
1230
-		unset($path);	// unused, but required by function signature
1230
+		unset($path); // unused, but required by function signature
1231 1231
 		if (!$this->bo->check_perms(calendar_bo::ACL_FREEBUSY, 0, $user))
1232 1232
 		{
1233 1233
 			return '403 Forbidden';
1234 1234
 		}
1235
-		foreach($options['other'] as $filter)
1235
+		foreach ($options['other'] as $filter)
1236 1236
 		{
1237 1237
 			if ($filter['name'] == 'time-range')
1238 1238
 			{
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 		header('Content-Type: text/calendar');
1245 1245
 		echo $handler->freebusy($user, $end, true, 'utf-8', $start, 'REPLY', array());
1246 1246
 
1247
-		exit();	// otherwise we get a 207 multistatus, not 200 Ok
1247
+		exit(); // otherwise we get a 207 multistatus, not 200 Ok
1248 1248
 	}
1249 1249
 
1250 1250
 	/**
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
 	 * @param int $user =null owner of the collection, default current user
1257 1257
 	 * @return array with privileges
1258 1258
 	 */
1259
-	public function current_user_privileges($path, $user=null)
1259
+	public function current_user_privileges($path, $user = null)
1260 1260
 	{
1261 1261
 		$privileges = parent::current_user_privileges($path, $user);
1262 1262
 		//error_log(__METHOD__."('$path', $user) parent gave ".array2string($privileges));
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 
1300 1300
 		// get array with orginal recurrences indexed by recurrence-id
1301 1301
 		$org_recurrences = $exceptions = array();
1302
-		foreach(self::get_series($events[0]['uid'],$bo) as $k => $event)
1302
+		foreach (self::get_series($events[0]['uid'], $bo) as $k => $event)
1303 1303
 		{
1304 1304
 			if (!$k) $master = $event;
1305 1305
 			if ($event['recurrence'])
@@ -1309,13 +1309,13 @@  discard block
 block discarded – undo
1309 1309
 		}
1310 1310
 
1311 1311
 		// assign cal_id's to already existing recurrences and evtl. re-add recur_exception to master
1312
-		foreach($events as $k => &$recurrence)
1312
+		foreach ($events as $k => &$recurrence)
1313 1313
 		{
1314 1314
 			if (!$recurrence['recurrence'])
1315 1315
 			{
1316 1316
 				// master
1317 1317
 				$recurrence['id'] = $master['id'];
1318
-				$master =& $events[$k];
1318
+				$master = & $events[$k];
1319 1319
 				continue;
1320 1320
 			}
1321 1321
 
@@ -1339,12 +1339,12 @@  discard block
 block discarded – undo
1339 1339
 		$master['recur_exception'] = array_merge($exceptions, $master['recur_exception']);
1340 1340
 
1341 1341
 		// delete not longer existing recurrences
1342
-		foreach($org_recurrences as $org_recurrence)
1342
+		foreach ($org_recurrences as $org_recurrence)
1343 1343
 		{
1344 1344
 			if ($org_recurrence['id'] != $master['id'])	// non-virtual recurrence
1345 1345
 			{
1346 1346
 				//error_log(__METHOD__.'() deleting #'.$org_recurrence['id']);
1347
-				$bo->delete($org_recurrence['id']);	// might fail because of permissions
1347
+				$bo->delete($org_recurrence['id']); // might fail because of permissions
1348 1348
 			}
1349 1349
 			else	// virtual recurrence
1350 1350
 			{
@@ -1366,14 +1366,14 @@  discard block
 block discarded – undo
1366 1366
 	 * @param int $user account_id of collection owner
1367 1367
 	 * @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
1368 1368
 	 */
1369
-	function delete(&$options,$id,$user)
1369
+	function delete(&$options, $id, $user)
1370 1370
 	{
1371 1371
 		if (strpos($options['path'], '/inbox/') !== false)
1372 1372
 		{
1373
-			return true;	// simply ignore DELETE in inbox for now
1373
+			return true; // simply ignore DELETE in inbox for now
1374 1374
 		}
1375
-		$return_no_access = true;	// to allow to check if current use is a participant and reject the event for him
1376
-		if (!is_array($event = $this->_common_get_put_delete('DELETE',$options,$id,$return_no_access)) || !$return_no_access ||
1375
+		$return_no_access = true; // to allow to check if current use is a participant and reject the event for him
1376
+		if (!is_array($event = $this->_common_get_put_delete('DELETE', $options, $id, $return_no_access)) || !$return_no_access ||
1377 1377
 			// Work around problems with Outlook CalDAV Synchroniser (https://caldavsynchronizer.org/)
1378 1378
 			// - sends a DELETE to reject a meeting request --> deletes event for all participants, if user has delete rights on the calendar
1379 1379
 			// --> only set status for everyone else but the organizer
@@ -1384,11 +1384,11 @@  discard block
 block discarded – undo
1384 1384
 				// check if user is a participant or one of the groups he is a member of --> reject the meeting request
1385 1385
 				$ret = '403 Forbidden';
1386 1386
 				$memberships = $GLOBALS['egw']->accounts->memberships($this->bo->user, true);
1387
-				foreach(array_keys($event['participants']) as $uid)
1387
+				foreach (array_keys($event['participants']) as $uid)
1388 1388
 				{
1389 1389
 					if ($this->bo->user == $uid || in_array($uid, $memberships))
1390 1390
 					{
1391
-						$this->bo->set_status($event,$this->bo->user, 'R');
1391
+						$this->bo->set_status($event, $this->bo->user, 'R');
1392 1392
 						$ret = true;
1393 1393
 						break;
1394 1394
 					}
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 		{
1404 1404
 			$ret = $this->bo->delete($event['id']);
1405 1405
 		}
1406
-		if ($this->debug) error_log(__METHOD__."(,$id) return_no_access=$return_no_access, event[participants]=".array2string(is_array($event)?$event['participants']:null).", user={$this->bo->user} --> return ".array2string($ret));
1406
+		if ($this->debug) error_log(__METHOD__."(,$id) return_no_access=$return_no_access, event[participants]=".array2string(is_array($event) ? $event['participants'] : null).", user={$this->bo->user} --> return ".array2string($ret));
1407 1407
 		return $ret;
1408 1408
 	}
1409 1409
 
@@ -1418,12 +1418,12 @@  discard block
 block discarded – undo
1418 1418
 	 */
1419 1419
 	function read($id)
1420 1420
 	{
1421
-		if (strpos($column=self::$path_attr,'_') === false) $column = 'cal_'.$column;
1421
+		if (strpos($column = self::$path_attr, '_') === false) $column = 'cal_'.$column;
1422 1422
 
1423 1423
 		$event = $this->bo->read(array($column => $id, 'cal_deleted IS NULL', 'cal_reference=0'), null, true, 'server');
1424
-		if ($event) $event = array_shift($event);	// read with array as 1. param, returns an array of events!
1424
+		if ($event) $event = array_shift($event); // read with array as 1. param, returns an array of events!
1425 1425
 
1426
-		if (!($retval = $this->bo->check_perms(calendar_bo::ACL_FREEBUSY,$event, 0, 'server')) &&
1426
+		if (!($retval = $this->bo->check_perms(calendar_bo::ACL_FREEBUSY, $event, 0, 'server')) &&
1427 1427
 			// above can be true, if current user is not in master but just a recurrence
1428 1428
 			(!$event['recur_type'] || !($events = self::get_series($event['uid'], $this->bo))))
1429 1429
 		{
@@ -1459,11 +1459,11 @@  discard block
 block discarded – undo
1459 1459
 	 *
1460 1460
 	 * @return string
1461 1461
 	 */
1462
-	public function getctag($path,$user)
1462
+	public function getctag($path, $user)
1463 1463
 	{
1464
-		$ctag = $this->bo->get_ctag($user,$path == '/calendar/' ? 'owner' : 'default'); // default = not rejected
1464
+		$ctag = $this->bo->get_ctag($user, $path == '/calendar/' ? 'owner' : 'default'); // default = not rejected
1465 1465
 
1466
-		if ($this->debug > 1) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. "($path)[$user] = $ctag");
1466
+		if ($this->debug > 1) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($path)[$user] = $ctag");
1467 1467
 
1468 1468
 		return $ctag;
1469 1469
 	}
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 	 * @param string $schedule_tag =null on return schedule-tag
1476 1476
 	 * @return string|boolean string with etag or false
1477 1477
 	 */
1478
-	function get_etag($entry, &$schedule_tag=null)
1478
+	function get_etag($entry, &$schedule_tag = null)
1479 1479
 	{
1480 1480
 		$etag = $this->bo->get_etag($entry, $schedule_tag, $this->client_shared_uid_exceptions);
1481 1481
 
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
 	 * @param int|string $retval
1494 1494
 	 * @param boolean $path_attr_is_name =true true: path_attr is ca(l|rd)dav_name, false: id (GroupDAV needs Location header)
1495 1495
 	 */
1496
-	function put_response_headers($entry, $path, $retval, $path_attr_is_name=true)
1496
+	function put_response_headers($entry, $path, $retval, $path_attr_is_name = true)
1497 1497
 	{
1498 1498
 		$schedule_tag = null;
1499 1499
 		$etag = $this->get_etag($entry, $schedule_tag);
@@ -1512,14 +1512,14 @@  discard block
 block discarded – undo
1512 1512
 	 * @param array|int $event event-array or id
1513 1513
 	 * @return boolean null if entry does not exist, false if no access, true if access permitted
1514 1514
 	 */
1515
-	function check_access($acl,$event)
1515
+	function check_access($acl, $event)
1516 1516
 	{
1517 1517
 		if ($acl == Acl::READ)
1518 1518
 		{
1519 1519
 			// we need at least calendar_bo::ACL_FREEBUSY to get some information
1520 1520
 			$acl = calendar_bo::ACL_FREEBUSY;
1521 1521
 		}
1522
-		return $this->bo->check_perms($acl,$event,0,'server');
1522
+		return $this->bo->check_perms($acl, $event, 0, 'server');
1523 1523
 	}
1524 1524
 
1525 1525
 	/**
@@ -1532,52 +1532,52 @@  discard block
 block discarded – undo
1532 1532
 	 * @param string $path =null path of the collection
1533 1533
 	 * @return array
1534 1534
 	 */
1535
-	public function extra_properties(array $props, $displayname, $base_uri=null, $user=null, $path=null)
1535
+	public function extra_properties(array $props, $displayname, $base_uri = null, $user = null, $path = null)
1536 1536
 	{
1537
-		unset($base_uri);	// unused, but required by function signature
1537
+		unset($base_uri); // unused, but required by function signature
1538 1538
 		if (!isset($props['calendar-description']))
1539 1539
 		{
1540 1540
 			// default calendar description: can be overwritten via PROPPATCH, in which case it's already set
1541
-			$props['calendar-description'] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'calendar-description',$displayname);
1541
+			$props['calendar-description'] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'calendar-description', $displayname);
1542 1542
 		}
1543 1543
 		$supported_components = array(
1544
-			Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'comp',array('name' => 'VEVENT')),
1544
+			Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'comp', array('name' => 'VEVENT')),
1545 1545
 		);
1546 1546
 		// outbox supports VFREEBUSY too, it is required from OS X iCal to autocomplete locations
1547
-		if (substr($path,-8) == '/outbox/')
1547
+		if (substr($path, -8) == '/outbox/')
1548 1548
 		{
1549
-			$supported_components[] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'comp',array('name' => 'VFREEBUSY'));
1549
+			$supported_components[] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'comp', array('name' => 'VFREEBUSY'));
1550 1550
 		}
1551 1551
 		$props['supported-calendar-component-set'] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV,
1552
-			'supported-calendar-component-set',$supported_components);
1552
+			'supported-calendar-component-set', $supported_components);
1553 1553
 		// supported reports
1554 1554
 		$props['supported-report-set'] = array(
1555
-			'calendar-query' => Api\CalDAV::mkprop('supported-report',array(
1556
-				Api\CalDAV::mkprop('report',array(
1557
-					Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'calendar-query',''))))),
1558
-			'calendar-multiget' => Api\CalDAV::mkprop('supported-report',array(
1559
-				Api\CalDAV::mkprop('report',array(
1560
-					Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'calendar-multiget',''))))),
1561
-			'free-busy-query' => Api\CalDAV::mkprop('supported-report',array(
1562
-				Api\CalDAV::mkprop('report',array(
1563
-					Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'free-busy-query',''))))),
1555
+			'calendar-query' => Api\CalDAV::mkprop('supported-report', array(
1556
+				Api\CalDAV::mkprop('report', array(
1557
+					Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'calendar-query', ''))))),
1558
+			'calendar-multiget' => Api\CalDAV::mkprop('supported-report', array(
1559
+				Api\CalDAV::mkprop('report', array(
1560
+					Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'calendar-multiget', ''))))),
1561
+			'free-busy-query' => Api\CalDAV::mkprop('supported-report', array(
1562
+				Api\CalDAV::mkprop('report', array(
1563
+					Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'free-busy-query', ''))))),
1564 1564
 		);
1565 1565
 		// rfc 6578 sync-collection report for everything but outbox
1566 1566
 		// only if "delete-prevention" is switched on (deleted entries get marked deleted but not actualy deleted
1567 1567
 		if (strpos($path, '/outbox/') === false && $GLOBALS['egw_info']['server']['calendar_delete_history'])
1568 1568
 		{
1569
-			$props['supported-report-set']['sync-collection'] = Api\CalDAV::mkprop('supported-report',array(
1570
-				Api\CalDAV::mkprop('report',array(
1571
-					Api\CalDAV::mkprop('sync-collection','')))));
1569
+			$props['supported-report-set']['sync-collection'] = Api\CalDAV::mkprop('supported-report', array(
1570
+				Api\CalDAV::mkprop('report', array(
1571
+					Api\CalDAV::mkprop('sync-collection', '')))));
1572 1572
 		}
1573
-		$props['supported-calendar-data'] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'supported-calendar-data',array(
1574
-			Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'calendar-data', array('content-type' => 'text/calendar', 'version'=> '2.0')),
1575
-			Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'calendar-data', array('content-type' => 'text/x-calendar', 'version'=> '1.0'))));
1573
+		$props['supported-calendar-data'] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'supported-calendar-data', array(
1574
+			Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'calendar-data', array('content-type' => 'text/calendar', 'version'=> '2.0')),
1575
+			Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'calendar-data', array('content-type' => 'text/x-calendar', 'version'=> '1.0'))));
1576 1576
 
1577 1577
 		// get timezone of calendar
1578 1578
 		if ($this->caldav->prop_requested('calendar-timezone'))
1579 1579
 		{
1580
-			$props['calendar-timezone'] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV,'calendar-timezone',
1580
+			$props['calendar-timezone'] = Api\CalDAV::mkprop(Api\CalDAV::CALDAV, 'calendar-timezone',
1581 1581
 				calendar_timezones::user_timezone($user));
1582 1582
 		}
1583 1583
 		return $props;
@@ -1591,9 +1591,9 @@  discard block
 block discarded – undo
1591 1591
 	private function _get_handler()
1592 1592
 	{
1593 1593
 		$handler = new calendar_ical();
1594
-		$handler->setSupportedFields('GroupDAV',$this->agent);
1595
-		$handler->supportedFields['attachments'] = true;	// enabling attachments
1596
-		if ($this->debug > 1) error_log("ical Handler called: " . $this->agent);
1594
+		$handler->setSupportedFields('GroupDAV', $this->agent);
1595
+		$handler->supportedFields['attachments'] = true; // enabling attachments
1596
+		if ($this->debug > 1) error_log("ical Handler called: ".$this->agent);
1597 1597
 		return $handler;
1598 1598
 	}
1599 1599
 
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 		$pref = $GLOBALS['egw_info']['user']['preferences']['groupdav']['calendar-home-set'];
1609 1609
 		$calendar_home_set = $pref ? explode(',', $pref) : array();
1610 1610
 		// replace symbolic id's with real nummeric id's
1611
-		foreach(array(
1611
+		foreach (array(
1612 1612
 			'G' => $GLOBALS['egw_info']['user']['account_primary_group'],
1613 1613
 		) as $sym => $id)
1614 1614
 		{
@@ -1617,11 +1617,11 @@  discard block
 block discarded – undo
1617 1617
 				$calendar_home_set[$key] = $id;
1618 1618
 			}
1619 1619
 		}
1620
-		foreach(ExecMethod('calendar.calendar_bo.list_cals') as $entry)
1620
+		foreach (ExecMethod('calendar.calendar_bo.list_cals') as $entry)
1621 1621
 		{
1622 1622
 			$id = $entry['grantor'];
1623
-			if ($id && $GLOBALS['egw_info']['user']['account_id'] != $id &&	// no current user
1624
-				(in_array('A',$calendar_home_set) || in_array((string)$id,$calendar_home_set)) &&
1623
+			if ($id && $GLOBALS['egw_info']['user']['account_id'] != $id && // no current user
1624
+				(in_array('A', $calendar_home_set) || in_array((string)$id, $calendar_home_set)) &&
1625 1625
 				is_numeric($id) && ($owner = $this->accounts->id2name($id)))
1626 1626
 			{
1627 1627
 				$shared[$id] = 'calendar-'.$owner;
@@ -1630,11 +1630,11 @@  discard block
 block discarded – undo
1630 1630
 		// shared locations and resources
1631 1631
 		if ($GLOBALS['egw_info']['user']['apps']['resources'])
1632 1632
 		{
1633
-			foreach(array('locations','resources') as $res)
1633
+			foreach (array('locations', 'resources') as $res)
1634 1634
 			{
1635 1635
 				if (($pref = $GLOBALS['egw_info']['user']['preferences']['groupdav']['calendar-home-set-'.$res]))
1636 1636
 				{
1637
-					foreach(explode(',', $pref) as $res_id)
1637
+					foreach (explode(',', $pref) as $res_id)
1638 1638
 					{
1639 1639
 						$is_location = $res == 'locations';
1640 1640
 						$shared['r'.$res_id] = str_replace('s/', '-', Api\CalDAV\Principals::resource2name($res_id, $is_location));
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
 			{
1665 1665
 				$calendars[$entry['grantor']] = $entry['name'];
1666 1666
 			}
1667
-			if ($user > 0) unset($calendars[$user]);	// skip current user
1667
+			if ($user > 0) unset($calendars[$user]); // skip current user
1668 1668
 		}
1669 1669
 
1670 1670
 		$settings = array();
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
 			'type'   => 'multiselect',
1673 1673
 			'label'  => 'Calendars to sync in addition to personal calendar',
1674 1674
 			'name'   => 'calendar-home-set',
1675
-			'help'   => lang('Only supported by a few fully conformant clients (eg. from Apple). If you have to enter a URL, it will most likly not be suppored!').'<br/>'.lang('They will be sub-folders in users home (%1 attribute).','CalDAV "calendar-home-set"'),
1675
+			'help'   => lang('Only supported by a few fully conformant clients (eg. from Apple). If you have to enter a URL, it will most likly not be suppored!').'<br/>'.lang('They will be sub-folders in users home (%1 attribute).', 'CalDAV "calendar-home-set"'),
1676 1676
 			'values' => $calendars,
1677 1677
 			'xmlrpc' => True,
1678 1678
 			'admin'  => False,
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
 		if ($GLOBALS['egw_info']['user']['apps']['resources'] && ($all_resources = Api\CalDAV\Principals::get_resources()))
1699 1699
 		{
1700 1700
 			$resources = $locations = array();
1701
-			foreach($all_resources as $resource)
1701
+			foreach ($all_resources as $resource)
1702 1702
 			{
1703 1703
 				if (Api\CalDAV\Principals::resource_is_location($resource))
1704 1704
 				{
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
 					$resources[$resource['res_id']] = $resource['name'];
1710 1710
 				}
1711 1711
 			}
1712
-			foreach(array(
1712
+			foreach (array(
1713 1713
 				'locations' => $locations,
1714 1714
 				'resources' => $resources,
1715 1715
 			) as $name => $options)
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
 						'label'  => lang('%1 to sync', lang($name == 'locations' ? 'Location calendars' : 'Resource calendars')),
1723 1723
 						'no_lang'=> true,
1724 1724
 						'name'   => 'calendar-home-set-'.$name,
1725
-						'help'   => lang('Only supported by a few fully conformant clients (eg. from Apple). If you have to enter a URL, it will most likly not be suppored!').'<br/>'.lang('They will be sub-folders in users home (%1 attribute).','CalDAV "calendar-home-set"'),
1725
+						'help'   => lang('Only supported by a few fully conformant clients (eg. from Apple). If you have to enter a URL, it will most likly not be suppored!').'<br/>'.lang('They will be sub-folders in users home (%1 attribute).', 'CalDAV "calendar-home-set"'),
1726 1726
 						'values' => $options,
1727 1727
 						'xmlrpc' => True,
1728 1728
 						'admin'  => False,
Please login to merge, or discard this patch.