Completed
Push — 16.1 ( b39e15...d98aac )
by Klaus
18:52
created
calendar/sitemgr/class.module_calendar_list.inc.php 1 patch
Braces   +16 added lines, -5 removed lines patch added patch discarded remove patch
@@ -165,7 +165,8 @@  discard block
 block discarded – undo
165 165
 			$cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']);
166 166
 		}
167 167
 		$this->arguments['category']['options'] = $cat_ids;
168
-		if (count($cat_ids) > 5) {
168
+		if (count($cat_ids) > 5)
169
+		{
169 170
 			$this->arguments['category']['multiple'] = 5;
170 171
 		}
171 172
 
@@ -310,8 +311,16 @@  discard block
 block discarded – undo
310 311
 		foreach((array) $this->bo->search($search_params) as $event)
311 312
 		{
312 313
 			$event['date'] = $this->bo->date2string($event['start']);
313
-			if (empty($event['description'])) $event['description'] = ' ';	// no description screws the titles horz. alignment
314
-			if (empty($event['location'])) $event['location'] = ' ';	// no location screws the owner horz. alignment
314
+			if (empty($event['description']))
315
+			{
316
+				$event['description'] = ' ';
317
+			}
318
+			// no description screws the titles horz. alignment
319
+			if (empty($event['location']))
320
+			{
321
+				$event['location'] = ' ';
322
+			}
323
+			// no location screws the owner horz. alignment
315 324
 			$rows[] = $event;
316 325
 		}
317 326
 		if (($arguments['showWeeks']) && ((int)$arguments['offset'] == 0))
@@ -337,7 +346,8 @@  discard block
 block discarded – undo
337 346
 				}
338 347
 				$last_week = adodb_date('W-Y',$event['start']);
339 348
 				$html .= "  <!-- Event -->\n";
340
-				if ($event_count % 2 == 0) {
349
+				if ($event_count % 2 == 0)
350
+				{
341 351
 					$html .= '  <div class="cal_list_event cal_event_even">'."\n";
342 352
 				}
343 353
 				else
@@ -353,7 +363,8 @@  discard block
 block discarded – undo
353 363
 				$html .= '<span class="cal_list_weekday">'.lang(adodb_date('D',$event['end'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>";
354 364
 				$html .= $this->bo->format_date($event['end'])."</span></div>\n";
355 365
 				$descr = trim($event['description']);
356
-				if (! empty($descr)) {
366
+				if (! empty($descr))
367
+				{
357 368
 					$html .= "    <div class=\"cal_list_descr\">\n".preg_replace('/\\n/',"<br>\n",$event['description'])."</div>\n";
358 369
 				}
359 370
 				$html .= "  </div><!-- cal_list_event -->\n";
Please login to merge, or discard this patch.
calendar/setup/tables_update.inc.php 1 patch
Braces   +12 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1429,13 +1429,18 @@  discard block
 block discarded – undo
1429 1429
 function calendar_upgrade1_0_1_008()
1430 1430
 {
1431 1431
 	$config_data = Api\Config::read('calendar');
1432
-	if (isset($config_data['fields']))	// old custom fields
1432
+	if (isset($config_data['fields']))
1433
+	{
1434
+		// old custom fields
1433 1435
 	{
1434 1436
 		$customfields = array();
1437
+	}
1435 1438
 		$order = 0;
1436 1439
 		foreach($config_data['fields'] as $name => $data)
1437 1440
 		{
1438
-			if ($name{0} == '#' && !$data['disabled'])	// real not-disabled custom field
1441
+			if ($name{0} == '#' && !$data['disabled'])
1442
+			{
1443
+				// real not-disabled custom field
1439 1444
 			{
1440 1445
 				$customfields[substr($name,1)] = array(
1441 1446
 					'type'  => 'text',
@@ -1444,6 +1449,7 @@  discard block
 block discarded – undo
1444 1449
 					'order' => ($order += 10),
1445 1450
 				);
1446 1451
 			}
1452
+			}
1447 1453
 		}
1448 1454
 		if (count($customfields))
1449 1455
 		{
@@ -2589,9 +2595,12 @@  discard block
 block discarded – undo
2589 2595
 			'cal_recur_date' => $row['cal_recur_date'],
2590 2596
 			'cal_user_type' => 'e',
2591 2597
 			$email.'='.$GLOBALS['egw_setup']->db->quote($row['email']),
2592
-		), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user)	// order A, T, U, X
2598
+		), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user)
2599
+		{
2600
+			// order A, T, U, X
2593 2601
 		{
2594 2602
 			if (strpos($user['email'], '@') !== false && !$n++) continue;
2603
+		}
2595 2604
 			$GLOBALS['egw_setup']->db->delete('egw_cal_user', array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status'))));
2596 2605
 		}
2597 2606
 	}
Please login to merge, or discard this patch.
calendar/freebusy.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,15 +44,23 @@
 block discarded – undo
44 44
 if (strpos($_SERVER['QUERY_STRING'],'=3D') !== false && substr($_GET['user'],0,2) == '3D')
45 45
 {
46 46
 	$_GET['user'] = substr($_GET['user'],2);
47
-	if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'],2);
48
-	if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'],2);
49
-}
47
+	if (isset($_GET['password']))
48
+	{
49
+		$_GET['password'] = substr($_GET['password'],2);
50
+	}
51
+	if (isset($_GET['cred']))
52
+	{
53
+		$_GET['cred'] = substr($_GET['cred'],2);
54
+	}
55
+	}
50 56
 if (!is_numeric($user = $_GET['user']))
51 57
 {
52 58
 	// check if user contains the current domain --> remove it
53 59
 	list(,$domain) = explode('@',$user);
54 60
 	if ($domain === $GLOBALS['egw_info']['user']['domain'])
55
-	list($user) = explode('@',$user);
61
+	{
62
+		list($user) = explode('@',$user);
63
+	}
56 64
 	$user = $GLOBALS['egw']->accounts->name2id($user,'account_lid','u');
57 65
 }
58 66
 if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user)))
Please login to merge, or discard this patch.
calendar/inc/class.calendar_ical.inc.php 1 patch
Braces   +317 added lines, -81 removed lines patch added patch discarded remove patch
@@ -177,7 +177,10 @@  discard block
 block discarded – undo
177 177
 	function __construct(&$_clientProperties = array())
178 178
 	{
179 179
 		parent::__construct();
180
-		if ($this->log) $this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-vcal";
180
+		if ($this->log)
181
+		{
182
+			$this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-vcal";
183
+		}
181 184
 		$this->clientProperties = $_clientProperties;
182 185
 		$this->vCalendar = new Horde_Icalendar;
183 186
 		$this->addressbook = new Api\Contacts;
@@ -226,10 +229,14 @@  discard block
 block discarded – undo
226 229
 			'ATTACH'        => 'attachments',
227 230
 		);
228 231
 
229
-		if (!is_array($this->supportedFields)) $this->setSupportedFields();
232
+		if (!is_array($this->supportedFields))
233
+		{
234
+			$this->setSupportedFields();
235
+		}
230 236
 
231 237
 		if ($this->productManufacturer == '' )
232
-		{	// syncevolution is broken
238
+		{
239
+// syncevolution is broken
233 240
 			$version = '2.0';
234 241
 		}
235 242
 
@@ -237,10 +244,16 @@  discard block
 block discarded – undo
237 244
 		$vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'.
238 245
 			strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
239 246
 		$vcal->setAttribute('VERSION', $version);
240
-		if ($method) $vcal->setAttribute('METHOD', $method);
247
+		if ($method)
248
+		{
249
+			$vcal->setAttribute('METHOD', $method);
250
+		}
241 251
 		$events_exported = false;
242 252
 
243
-		if (!is_array($events)) $events = array($events);
253
+		if (!is_array($events))
254
+		{
255
+			$events = array($events);
256
+		}
244 257
 
245 258
 		$vtimezones_added = array();
246 259
 		foreach ($events as $event)
@@ -306,7 +319,10 @@  discard block
 block discarded – undo
306 319
 				self::$tz_cache[$event['tzid']] = calendar_timezones::DateTimeZone($event['tzid']);
307 320
 			}
308 321
 
309
-			if ($this->so->isWholeDay($event)) $event['whole_day'] = true;
322
+			if ($this->so->isWholeDay($event))
323
+			{
324
+				$event['whole_day'] = true;
325
+			}
310 326
 
311 327
 			if ($this->log)
312 328
 			{
@@ -317,7 +333,10 @@  discard block
 block discarded – undo
317 333
 
318 334
 			if ($recurrence)
319 335
 			{
320
-				if (!($master = $this->read($event['id'], 0, true, 'server'))) continue;
336
+				if (!($master = $this->read($event['id'], 0, true, 'server')))
337
+				{
338
+					continue;
339
+				}
321 340
 
322 341
 				if (!isset($this->supportedFields['participants']))
323 342
 				{
@@ -374,7 +393,8 @@  discard block
 block discarded – undo
374 393
 			if ($this->productManufacturer != 'file' && $this->uidExtension)
375 394
 			{
376 395
 				// Append UID to DESCRIPTION
377
-				if (!preg_match('/\[UID:.+\]/m', $event['description'])) {
396
+				if (!preg_match('/\[UID:.+\]/m', $event['description']))
397
+				{
378 398
 					$event['description'] .= "\n[UID:" . $event['uid'] . "]";
379 399
 				}
380 400
 			}
@@ -434,11 +454,21 @@  discard block
 block discarded – undo
434 454
 							$quantity = $role = null;
435 455
 							calendar_so::split_status($status, $quantity, $role);
436 456
 							// do not include event owner/ORGANIZER as participant in his own calendar, if he is only participant
437
-							if (count($event['participants']) == 1 && $event['owner'] == $uid) continue;
457
+							if (count($event['participants']) == 1 && $event['owner'] == $uid)
458
+							{
459
+								continue;
460
+							}
438 461
 
439
-							if (!($info = $this->resource_info($uid))) continue;
462
+							if (!($info = $this->resource_info($uid)))
463
+							{
464
+								continue;
465
+							}
440 466
 
441
-							if (in_array($status, array('X','E'))) continue;	// dont include deleted participants
467
+							if (in_array($status, array('X','E')))
468
+							{
469
+								continue;
470
+							}
471
+							// dont include deleted participants
442 472
 
443 473
 							if ($this->log)
444 474
 							{
@@ -517,24 +547,49 @@  discard block
 block discarded – undo
517 547
 							}
518 548
 							// ROLE={CHAIR|REQ-PARTICIPANT|OPT-PARTICIPANT|NON-PARTICIPANT|X-*}
519 549
 							$options = array();
520
-							if (!empty($participantCN)) $options['CN'] = $participantCN;
521
-							if (!empty($role)) $options['ROLE'] = $role;
522
-							if (!empty($status)) $options['PARTSTAT'] = $status;
523
-							if (!empty($cutype)) $options['CUTYPE'] = $cutype;
524
-							if (!empty($rsvp)) $options['RSVP'] = $rsvp;
550
+							if (!empty($participantCN))
551
+							{
552
+								$options['CN'] = $participantCN;
553
+							}
554
+							if (!empty($role))
555
+							{
556
+								$options['ROLE'] = $role;
557
+							}
558
+							if (!empty($status))
559
+							{
560
+								$options['PARTSTAT'] = $status;
561
+							}
562
+							if (!empty($cutype))
563
+							{
564
+								$options['CUTYPE'] = $cutype;
565
+							}
566
+							if (!empty($rsvp))
567
+							{
568
+								$options['RSVP'] = $rsvp;
569
+							}
525 570
 							if (!empty($info['email']) && $participantURL != 'mailto:'.$info['email'])
526 571
 							{
527 572
 								$options['EMAIL'] = $info['email'];	// only add EMAIL attribute, if not already URL, as eg. Akonadi is reported to have problems with it
528 573
 							}
529
-							if ($info['type'] != 'e') $options['X-EGROUPWARE-UID'] = (string)$uid;
530
-							if ($quantity > 1) $options['X-EGROUPWARE-QUANTITY'] = (string)$quantity;
574
+							if ($info['type'] != 'e')
575
+							{
576
+								$options['X-EGROUPWARE-UID'] = (string)$uid;
577
+							}
578
+							if ($quantity > 1)
579
+							{
580
+								$options['X-EGROUPWARE-QUANTITY'] = (string)$quantity;
581
+							}
531 582
 							$attributes['ATTENDEE'][] = $participantURL;
532 583
 							$parameters['ATTENDEE'][] = $options;
533 584
 						}
534 585
 						break;
535 586
 
536 587
 					case 'CLASS':
537
-						if ($event['public']) continue;	// public is default, no need to export, fails CalDAVTester if added as default
588
+						if ($event['public'])
589
+						{
590
+							continue;
591
+						}
592
+						// public is default, no need to export, fails CalDAVTester if added as default
538 593
 						$attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'PRIVATE';
539 594
 						// Apple iCal on OS X uses X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALANDAR (not VEVENT!)
540 595
 						if (!$event['public'] && $this->productManufacturer == 'groupdav')
@@ -566,9 +621,18 @@  discard block
 block discarded – undo
566 621
 									'CUTYPE'   => 'INDIVIDUAL',
567 622
 									//'RSVP'     => 'FALSE',
568 623
 									);
569
-								if (!empty($organizerCN)) $options['CN'] = $organizerCN;
570
-								if (!empty($organizerEMail)) $options['EMAIL'] = $organizerEMail;
571
-								if (!empty($event['owner'])) $options['X-EGROUPWARE-UID'] = $event['owner'];
624
+								if (!empty($organizerCN))
625
+								{
626
+									$options['CN'] = $organizerCN;
627
+								}
628
+								if (!empty($organizerEMail))
629
+								{
630
+									$options['EMAIL'] = $organizerEMail;
631
+								}
632
+								if (!empty($event['owner']))
633
+								{
634
+									$options['X-EGROUPWARE-UID'] = $event['owner'];
635
+								}
572 636
 								$attributes['ATTENDEE'][] = $organizerURL;
573 637
 			    				$parameters['ATTENDEE'][] = $options;
574 638
 		    				}
@@ -597,9 +661,12 @@  discard block
 block discarded – undo
597 661
 						{
598 662
 							// Hack for CalDAVTester to export duration instead of endtime
599 663
 							if ($tzid == 'UTC' && $event['end'] - $event['start'] <= 86400)
600
-								$attributes['duration'] = $event['end'] - $event['start'];
601
-							else
602
-							$attributes['DTEND'] = self::getDateTime($event['end'],$tzid,$parameters['DTEND']);
664
+							{
665
+															$attributes['duration'] = $event['end'] - $event['start'];
666
+							}
667
+							else {
668
+														$attributes['DTEND'] = self::getDateTime($event['end'],$tzid,$parameters['DTEND']);
669
+							}
603 670
 						}
604 671
 						else
605 672
 						{
@@ -619,7 +686,11 @@  discard block
 block discarded – undo
619 686
 						break;
620 687
 
621 688
 					case 'RRULE':
622
-						if ($event['recur_type'] == MCAL_RECUR_NONE) break;		// no recuring event
689
+						if ($event['recur_type'] == MCAL_RECUR_NONE)
690
+						{
691
+							break;
692
+						}
693
+						// no recuring event
623 694
 						$rriter = calendar_rrule::event2rrule($event, false, $tzid);
624 695
 						$rrule = $rriter->generate_rrule($version);
625 696
 						if ($event['recur_enddate'])
@@ -653,7 +724,10 @@  discard block
 block discarded – undo
653 724
 						break;
654 725
 
655 726
 					case 'EXDATE':
656
-						if ($event['recur_type'] == MCAL_RECUR_NONE) break;
727
+						if ($event['recur_type'] == MCAL_RECUR_NONE)
728
+						{
729
+							break;
730
+						}
657 731
 						if (!empty($event['recur_exception']))
658 732
 						{
659 733
 							if (empty($event['whole_day']))
@@ -680,14 +754,21 @@  discard block
 block discarded – undo
680 754
 									);
681 755
 								}
682 756
 								$event['recur_exception'] = $days;
683
-								if ($version != '1.0') $parameters['EXDATE']['VALUE'] = 'DATE';
757
+								if ($version != '1.0')
758
+								{
759
+									$parameters['EXDATE']['VALUE'] = 'DATE';
760
+								}
684 761
 							}
685 762
 							$vevent->setAttribute('EXDATE', $event['recur_exception'], $parameters['EXDATE']);
686 763
 						}
687 764
 						break;
688 765
 
689 766
 					case 'PRIORITY':
690
-						if (!$event['priority']) continue;	// 0=undefined is default, no need to export, fails CalDAVTester if our default is added
767
+						if (!$event['priority'])
768
+						{
769
+							continue;
770
+						}
771
+						// 0=undefined is default, no need to export, fails CalDAVTester if our default is added
691 772
 						if ($this->productManufacturer == 'funambol' &&
692 773
 							(strpos($this->productName, 'outlook') !== false
693 774
 								|| strpos($this->productName, 'pocket pc') !== false))
@@ -701,7 +782,11 @@  discard block
 block discarded – undo
701 782
 						break;
702 783
 
703 784
 					case 'TRANSP':
704
-						if (!$event['non_blocking']) continue;	// OPAQUE is default, no need to export, fails CalDAVTester if added as default
785
+						if (!$event['non_blocking'])
786
+						{
787
+							continue;
788
+						}
789
+						// OPAQUE is default, no need to export, fails CalDAVTester if added as default
705 790
 						if ($version == '1.0')
706 791
 						{
707 792
 							$attributes['TRANSP'] = ($event['non_blocking'] ? 1 : 0);
@@ -758,7 +843,11 @@  discard block
 block discarded – undo
758 843
 						elseif ($event['recurrence'] && $event['reference'])
759 844
 						{
760 845
 							// $event['reference'] is a calendar_id, not a timestamp
761
-							if (!($revent = $this->read($event['reference']))) break;	// referenced event does not exist
846
+							if (!($revent = $this->read($event['reference'])))
847
+							{
848
+								break;
849
+							}
850
+							// referenced event does not exist
762 851
 
763 852
 							if (empty($revent['whole_day']))
764 853
 							{
@@ -884,7 +973,10 @@  discard block
 block discarded – undo
884 973
 			foreach ((array)$event['alarm'] as $alarmData)
885 974
 			{
886 975
 				// skip over alarms that don't have the minimum required info
887
-				if (!isset($alarmData['offset']) && !isset($alarmData['time'])) continue;
976
+				if (!isset($alarmData['offset']) && !isset($alarmData['time']))
977
+				{
978
+					continue;
979
+				}
888 980
 
889 981
 				// skip alarms not being set for all users and alarms owned by other users
890 982
 				if ($alarmData['all'] != true && $alarmData['owner'] != $this->user)
@@ -901,7 +993,10 @@  discard block
 block discarded – undo
901 993
 
902 994
 				if ($version == '1.0')
903 995
 				{
904
-					if ($event['title']) $description = $event['title'];
996
+					if ($event['title'])
997
+					{
998
+						$description = $event['title'];
999
+					}
905 1000
 					if ($description)
906 1001
 					{
907 1002
 						$values['DALARM']['snooze_time'] = '';
@@ -921,7 +1016,10 @@  discard block
 block discarded – undo
921 1016
 					// VCalendar 2.0 / RFC 2445
922 1017
 
923 1018
 					// RFC requires DESCRIPTION for DISPLAY
924
-					if (!$event['title'] && !$description) $description = 'Alarm';
1019
+					if (!$event['title'] && !$description)
1020
+					{
1021
+						$description = 'Alarm';
1022
+					}
925 1023
 
926 1024
 					/* Disabling for now
927 1025
 					// Lightning infinitly pops up alarms for recuring events, if the only use an offset
@@ -1112,13 +1210,20 @@  discard block
 block discarded – undo
1112 1210
 		$this->events_imported = 0;
1113 1211
 		$replace = $delete_exceptions= false;
1114 1212
 
1115
-		if (!is_array($this->supportedFields)) $this->setSupportedFields();
1213
+		if (!is_array($this->supportedFields))
1214
+		{
1215
+			$this->setSupportedFields();
1216
+		}
1116 1217
 
1117 1218
 		if (!($events = $this->icaltoegw($_vcalData, $principalURL, $charset)))
1118 1219
 		{
1119 1220
 			return false;
1120 1221
 		}
1121
-		if (!is_array($events)) $cal_id = -1;	// just to be sure, as iterator does NOT allow array access (eg. $events[0])
1222
+		if (!is_array($events))
1223
+		{
1224
+			$cal_id = -1;
1225
+		}
1226
+		// just to be sure, as iterator does NOT allow array access (eg. $events[0])
1122 1227
 
1123 1228
 		if ($cal_id > 0)
1124 1229
 		{
@@ -1126,8 +1231,14 @@  discard block
 block discarded – undo
1126 1231
 			{
1127 1232
 				$replace = $recur_date == 0;
1128 1233
 				$events[0]['id'] = $cal_id;
1129
-				if (!is_null($etag)) $events[0]['etag'] = (int) $etag;
1130
-				if ($recur_date) $events[0]['recurrence'] = $recur_date;
1234
+				if (!is_null($etag))
1235
+				{
1236
+					$events[0]['etag'] = (int) $etag;
1237
+				}
1238
+				if ($recur_date)
1239
+				{
1240
+					$events[0]['recurrence'] = $recur_date;
1241
+				}
1131 1242
 			}
1132 1243
 			elseif (($foundEvent = $this->find_event(array('id' => $cal_id), 'exact')) &&
1133 1244
 					($eventId = array_shift($foundEvent)) &&
@@ -1135,7 +1246,10 @@  discard block
 block discarded – undo
1135 1246
 			{
1136 1247
 				foreach ($events as $k => $event)
1137 1248
 				{
1138
-					if (!isset($event['uid'])) $events[$k]['uid'] = $egwEvent['uid'];
1249
+					if (!isset($event['uid']))
1250
+					{
1251
+						$events[$k]['uid'] = $egwEvent['uid'];
1252
+					}
1139 1253
 				}
1140 1254
 			}
1141 1255
 		}
@@ -1165,10 +1279,17 @@  discard block
 block discarded – undo
1165 1279
 		$msg = null;
1166 1280
 		foreach ($events as $event)
1167 1281
 		{
1168
-			if (!is_array($event)) continue; // the iterator may return false
1282
+			if (!is_array($event))
1283
+			{
1284
+				continue;
1285
+			}
1286
+			// the iterator may return false
1169 1287
 			++$this->events_imported;
1170 1288
 
1171
-			if ($this->so->isWholeDay($event)) $event['whole_day'] = true;
1289
+			if ($this->so->isWholeDay($event))
1290
+			{
1291
+				$event['whole_day'] = true;
1292
+			}
1172 1293
 			if (is_array($event['category']))
1173 1294
 			{
1174 1295
 				$event['category'] = $this->find_or_add_categories($event['category'],
@@ -1205,7 +1326,10 @@  discard block
 block discarded – undo
1205 1326
 						}
1206 1327
 						else
1207 1328
 						{
1208
-							if (!($exception = $this->read($id))) continue;
1329
+							if (!($exception = $this->read($id)))
1330
+							{
1331
+								continue;
1332
+							}
1209 1333
 							$exception['uid'] = Api\CalDAV::generate_uid('calendar', $id);
1210 1334
 							$exception['reference'] = $exception['recurrence'] = 0;
1211 1335
 							$this->update($exception, true,true,false,true,$msg,$skip_notification);
@@ -1294,7 +1418,10 @@  discard block
 block discarded – undo
1294 1418
 								break;
1295 1419
 
1296 1420
 							default:
1297
-								if (!empty($value)) $event[$key] = $value;
1421
+								if (!empty($value))
1422
+								{
1423
+									$event[$key] = $value;
1424
+								}
1298 1425
 						}
1299 1426
 					}
1300 1427
 				}
@@ -1392,7 +1519,10 @@  discard block
 block discarded – undo
1392 1519
 			else // common adjustments for new events
1393 1520
 			{
1394 1521
 				unset($event['id']);
1395
-				if ($caldav_name) $event['caldav_name'] = $caldav_name;
1522
+				if ($caldav_name)
1523
+				{
1524
+					$event['caldav_name'] = $caldav_name;
1525
+				}
1396 1526
 				// set non blocking all day depending on the user setting
1397 1527
 				if (!empty($event['whole_day']) && $this->nonBlockingAllday)
1398 1528
 				{
@@ -1440,7 +1570,10 @@  discard block
 block discarded – undo
1440 1570
 					|| !isset($event['participants'][$event['owner']]))
1441 1571
 				{
1442 1572
 					$status = calendar_so::combine_status($event['owner'] == $this->user ? 'A' : 'U', 1, 'CHAIR');
1443
-					if (!is_array($event['participants'])) $event['participants'] = array();
1573
+					if (!is_array($event['participants']))
1574
+					{
1575
+						$event['participants'] = array();
1576
+					}
1444 1577
 					$event['participants'][$event['owner']] = $status;
1445 1578
 				}
1446 1579
 				else
@@ -1593,7 +1726,10 @@  discard block
 block discarded – undo
1593 1726
 								$occurence = $exception = false;
1594 1727
 								foreach ($event_info['master_event']['recur_exception'] as $exception)
1595 1728
 								{
1596
-									if ($exception > $event['start']) break;
1729
+									if ($exception > $event['start'])
1730
+									{
1731
+										break;
1732
+									}
1597 1733
 									$occurence = $exception;
1598 1734
 								}
1599 1735
 								if (!$occurence)
@@ -1683,12 +1819,15 @@  discard block
 block discarded – undo
1683 1819
 					case 'SERIES-MASTER':
1684 1820
 					case 'SERIES-EXCEPTION':
1685 1821
 					case 'SERIES-EXCEPTION-PROPAGATE':
1686
-						if (is_array($event_info['stored_event'])) // status update requires a stored event
1822
+						if (is_array($event_info['stored_event']))
1823
+						{
1824
+							// status update requires a stored event
1687 1825
 						{
1688 1826
 							if ($event_info['acl_edit'])
1689 1827
 							{
1690 1828
 								// update all participants if we have the right to do that
1691 1829
 								$this->update_status($event, $event_info['stored_event'],0,$skip_notification);
1830
+						}
1692 1831
 							}
1693 1832
 							elseif (isset($event['participants'][$this->user]) || isset($event_info['stored_event']['participants'][$this->user]))
1694 1833
 							{
@@ -1700,9 +1839,12 @@  discard block
 block discarded – undo
1700 1839
 						break;
1701 1840
 
1702 1841
 					case 'SERIES-PSEUDO-EXCEPTION':
1703
-						if (is_array($event_info['master_event'])) // status update requires a stored master event
1842
+						if (is_array($event_info['master_event']))
1843
+						{
1844
+							// status update requires a stored master event
1704 1845
 						{
1705 1846
 							$recurrence = $this->date2usertime($event['recurrence']);
1847
+						}
1706 1848
 							if ($event_info['acl_edit'])
1707 1849
 							{
1708 1850
 								// update all participants if we have the right to do that
@@ -1775,7 +1917,10 @@  discard block
 block discarded – undo
1775 1917
 	 */
1776 1918
 	public function sync_alarms(array &$event, array $old_alarms, $user)
1777 1919
 	{
1778
-		if ($this->debug) error_log(__METHOD__."(".array2string($event).', old_alarms='.array2string($old_alarms).", $user,)");
1920
+		if ($this->debug)
1921
+		{
1922
+			error_log(__METHOD__."(".array2string($event).', old_alarms='.array2string($old_alarms).", $user,)");
1923
+		}
1779 1924
 		$modified = 0;
1780 1925
 		foreach($event['alarm'] as &$alarm)
1781 1926
 		{
@@ -1799,19 +1944,40 @@  discard block
 block discarded – undo
1799 1944
 			if ($alarm['offset'] != $old_alarm['offset'] || $old_alarm['owner'] != $user && !$alarm['all'])
1800 1945
 			{
1801 1946
 				$alarm['owner'] = $user;
1802
-				if (!isset($alarm['time'])) $alarm['time'] = $event['start'] - $alarm['offset'];
1803
-				if ($alarm['time'] < time()) calendar_so::shift_alarm($event, $alarm);
1804
-				if ($this->debug) error_log(__METHOD__."() adding new alarm from client ".array2string($alarm));
1805
-				if ($event['id']) $alarm['id'] = $this->save_alarm($event['id'], $alarm);
1947
+				if (!isset($alarm['time']))
1948
+				{
1949
+					$alarm['time'] = $event['start'] - $alarm['offset'];
1950
+				}
1951
+				if ($alarm['time'] < time())
1952
+				{
1953
+					calendar_so::shift_alarm($event, $alarm);
1954
+				}
1955
+				if ($this->debug)
1956
+				{
1957
+					error_log(__METHOD__."() adding new alarm from client ".array2string($alarm));
1958
+				}
1959
+				if ($event['id'])
1960
+				{
1961
+					$alarm['id'] = $this->save_alarm($event['id'], $alarm);
1962
+				}
1806 1963
 				++$modified;
1807 1964
 			}
1808 1965
 			// existing alarm --> update it
1809 1966
 			elseif ($alarm['offset'] == $old_alarm['offset'] && ($old_alarm['owner'] == $user || $old_alarm['all']))
1810 1967
 			{
1811
-				if (!isset($alarm['time'])) $alarm['time'] = $event['start'] - $alarm['offset'];
1812
-				if ($alarm['time'] < time()) calendar_so::shift_alarm($event, $alarm);
1968
+				if (!isset($alarm['time']))
1969
+				{
1970
+					$alarm['time'] = $event['start'] - $alarm['offset'];
1971
+				}
1972
+				if ($alarm['time'] < time())
1973
+				{
1974
+					calendar_so::shift_alarm($event, $alarm);
1975
+				}
1813 1976
 				$alarm = array_merge($old_alarm, $alarm);
1814
-				if ($this->debug) error_log(__METHOD__."() updating existing alarm from client ".array2string($alarm));
1977
+				if ($this->debug)
1978
+				{
1979
+					error_log(__METHOD__."() updating existing alarm from client ".array2string($alarm));
1980
+				}
1815 1981
 				$alarm['id'] = $this->save_alarm($event['id'], $alarm);
1816 1982
 				++$modified;
1817 1983
 			}
@@ -1825,7 +1991,10 @@  discard block
 block discarded – undo
1825 1991
 				unset($old_alarm[$id]);
1826 1992
 				continue;
1827 1993
 			}
1828
-			if ($this->debug) error_log(__METHOD__."() deleting alarm '$id' deleted on client ".array2string($old_alarm));
1994
+			if ($this->debug)
1995
+			{
1996
+				error_log(__METHOD__."() deleting alarm '$id' deleted on client ".array2string($old_alarm));
1997
+			}
1829 1998
 			$this->delete_alarm($id);
1830 1999
 			++$modified;
1831 2000
 		}
@@ -2244,7 +2413,10 @@  discard block
 block discarded – undo
2244 2413
 				array2string($_vcalData)."\n",3,$this->logfile);
2245 2414
 		}
2246 2415
 
2247
-		if (!is_array($this->supportedFields)) $this->setSupportedFields();
2416
+		if (!is_array($this->supportedFields))
2417
+		{
2418
+			$this->setSupportedFields();
2419
+		}
2248 2420
 
2249 2421
 		// we use Api\CalDAV\IcalIterator only on resources, as calling importVCal() accesses single events like an array (eg. $events[0])
2250 2422
 		if (is_resource($_vcalData))
@@ -2589,19 +2761,27 @@  discard block
 block discarded – undo
2589 2761
 								$vcardData['recur_interval'] = $recurenceMatches[1];
2590 2762
 								$vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime(trim($recurenceMatches[2]));
2591 2763
 							}
2592
-							else break;
2764
+							else {
2765
+								break;
2766
+							}
2593 2767
 							// fall-through
2594 2768
 						case 'DAILY':	// 2.0
2595 2769
 							$vcardData['recur_type'] = MCAL_RECUR_DAILY;
2596
-							if (stripos($recurence, 'BYDAY') === false) break;
2770
+							if (stripos($recurence, 'BYDAY') === false)
2771
+							{
2772
+								break;
2773
+							}
2597 2774
 							// hack to handle TYPE=DAILY;BYDAY= as WEEKLY, which is true as long as there's no interval
2598 2775
 							// fall-through
2599 2776
 						case 'W':
2600 2777
 						case 'WEEKLY':
2601 2778
 							$days = array();
2602
-							if (preg_match('/W(\d+) *((?i: [AEFHMORSTUW]{2})+)?( +([^ ]*))$/',$recurence, $recurenceMatches))		// 1.0
2779
+							if (preg_match('/W(\d+) *((?i: [AEFHMORSTUW]{2})+)?( +([^ ]*))$/',$recurence, $recurenceMatches))
2780
+							{
2781
+								// 1.0
2603 2782
 							{
2604 2783
 								$vcardData['recur_interval'] = $recurenceMatches[1];
2784
+							}
2605 2785
 								if (empty($recurenceMatches[2]))
2606 2786
 								{
2607 2787
 									$days[0] = strtoupper(substr(date('D', $vcardData['start']),0,2));
@@ -2614,7 +2794,10 @@  discard block
 block discarded – undo
2614 2794
 								$repeatMatches = null;
2615 2795
 								if (preg_match('/#(\d+)/',$recurenceMatches[4],$repeatMatches))
2616 2796
 								{
2617
-									if ($repeatMatches[1]) $vcardData['recur_count'] = $repeatMatches[1];
2797
+									if ($repeatMatches[1])
2798
+									{
2799
+										$vcardData['recur_count'] = $repeatMatches[1];
2800
+									}
2618 2801
 								}
2619 2802
 								else
2620 2803
 								{
@@ -2623,9 +2806,12 @@  discard block
 block discarded – undo
2623 2806
 
2624 2807
 								$recur_days = $this->recur_days_1_0;
2625 2808
 							}
2626
-							elseif (preg_match('/BYDAY=([^;: ]+)/',$recurence,$recurenceMatches))	// 2.0
2809
+							elseif (preg_match('/BYDAY=([^;: ]+)/',$recurence,$recurenceMatches))
2810
+							{
2811
+								// 2.0
2627 2812
 							{
2628 2813
 								$days = explode(',',$recurenceMatches[1]);
2814
+							}
2629 2815
 								$recur_days = $this->recur_days;
2630 2816
 							}
2631 2817
 							else	// no day given, use the day of dtstart
@@ -2684,7 +2870,10 @@  discard block
 block discarded – undo
2684 2870
 							{
2685 2871
 								$vcardData['recur_interval'] = $recurenceMatches[1];
2686 2872
 								$vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]);
2687
-							} else break;
2873
+							}
2874
+							else {
2875
+								break;
2876
+							}
2688 2877
 							// fall-through
2689 2878
 						case 'YEARLY':	// 2.0
2690 2879
 							if (strpos($recurence, 'BYDAY') === false)
@@ -2704,7 +2893,10 @@  discard block
 block discarded – undo
2704 2893
 					}
2705 2894
 					break;
2706 2895
 				case 'EXDATE':
2707
-					if (!$attributes['value']) break;
2896
+					if (!$attributes['value'])
2897
+					{
2898
+						break;
2899
+					}
2708 2900
 					if ((isset($attributes['params']['VALUE'])
2709 2901
 							&& $attributes['params']['VALUE'] == 'DATE') ||
2710 2902
 						(!isset($attributes['params']['VALUE']) && $isDate))
@@ -2784,13 +2976,16 @@  discard block
 block discarded – undo
2784 2976
 					// fall throught
2785 2977
 				case 'ATTENDEE':
2786 2978
 					if (isset($attributes['params']['PARTSTAT']))
2787
-				    {
2979
+					{
2788 2980
 				    	$attributes['params']['STATUS'] = $attributes['params']['PARTSTAT'];
2789 2981
 				    }
2790 2982
 				    if (isset($attributes['params']['STATUS']))
2791
-					{
2983
+				    {
2792 2984
 						$status = $this->status_ical2egw[strtoupper($attributes['params']['STATUS'])];
2793
-						if (empty($status)) $status = 'X';
2985
+						if (empty($status))
2986
+						{
2987
+							$status = 'X';
2988
+						}
2794 2989
 					}
2795 2990
 					else
2796 2991
 					{
@@ -2850,7 +3045,10 @@  discard block
 block discarded – undo
2850 3045
 							$uid = $this->user;
2851 3046
 					}
2852 3047
 					// check principal url from CalDAV here after X-EGROUPWARE-UID and to get optional X-EGROUPWARE-QUANTITY
2853
-					if (!$uid) $uid = Api\CalDAV\Principals::url2uid($attributes['value'], null, $cn);
3048
+					if (!$uid)
3049
+					{
3050
+						$uid = Api\CalDAV\Principals::url2uid($attributes['value'], null, $cn);
3051
+					}
2854 3052
 
2855 3053
 					// try to find an email address
2856 3054
 					if (!$uid && $email && ($uid = $GLOBALS['egw']->accounts->name2id($email, 'account_email')))
@@ -2918,7 +3116,10 @@  discard block
 block discarded – undo
2918 3116
 								}
2919 3117
 								$status = 'U'; // keep the group
2920 3118
 							}
2921
-							else continue; // can't find this group
3119
+							else {
3120
+								continue;
3121
+							}
3122
+							// can't find this group
2922 3123
 						}
2923 3124
 						elseif (empty($searcharray))
2924 3125
 						{
@@ -2977,7 +3178,9 @@  discard block
 block discarded – undo
2977 3178
 
2978 3179
 								try {
2979 3180
 									if (!$this->calendarOwner && is_numeric($uid) && $role == 'CHAIR')
2980
-										$component->getAttribute('ORGANIZER');
3181
+									{
3182
+																			$component->getAttribute('ORGANIZER');
3183
+									}
2981 3184
 								}
2982 3185
 								catch(Horde_Icalendar_Exception $e)
2983 3186
 								{
@@ -3014,7 +3217,10 @@  discard block
 block discarded – undo
3014 3217
 					}
3015 3218
 					break;
3016 3219
 				case 'CREATED':		// will be written direct to the event
3017
-					if ($event['modified']) break;
3220
+					if ($event['modified'])
3221
+					{
3222
+						break;
3223
+					}
3018 3224
 					// fall through
3019 3225
 				case 'LAST-MODIFIED':	// will be written direct to the event
3020 3226
 					$event['modified'] = $attributes['value'];
@@ -3035,7 +3241,11 @@  discard block
 block discarded – undo
3035 3241
 					break;
3036 3242
 
3037 3243
 				case 'ATTACH':
3038
-					if ($attributes['params'] && !empty($attributes['params']['FMTTYPE'])) break;	// handeled by managed attachment code
3244
+					if ($attributes['params'] && !empty($attributes['params']['FMTTYPE']))
3245
+					{
3246
+						break;
3247
+					}
3248
+					// handeled by managed attachment code
3039 3249
 					// fall throught to store external attachment url
3040 3250
 				default:	// X- attribute or other by EGroupware unsupported property
3041 3251
 					//error_log(__METHOD__."() $attributes[name] = ".array2string($attributes));
@@ -3166,7 +3376,10 @@  discard block
 block discarded – undo
3166 3376
 			$event['end'] = $event['start'] + 60 * $this->cal_prefs['defaultlength'];
3167 3377
 		}
3168 3378
 
3169
-		if ($this->calendarOwner) $event['owner'] = $this->calendarOwner;
3379
+		if ($this->calendarOwner)
3380
+		{
3381
+			$event['owner'] = $this->calendarOwner;
3382
+		}
3170 3383
 
3171 3384
 		// parsing ATTACH attributes for managed attachments
3172 3385
 		$event['attach-delete-by-put'] = $component->getAttributeDefault('X-EGROUPWARE-ATTACH-INCLUDED', null) === 'TRUE';
@@ -3192,7 +3405,10 @@  discard block
 block discarded – undo
3192 3405
 				$filter = $relax ? 'relax' : 'check';
3193 3406
 				$event = array_shift($events);
3194 3407
 				$eventId = -1;
3195
-				if ($this->so->isWholeDay($event)) $event['whole_day'] = true;
3408
+				if ($this->so->isWholeDay($event))
3409
+				{
3410
+					$event['whole_day'] = true;
3411
+				}
3196 3412
 				if ($contentID)
3197 3413
 				{
3198 3414
 					$parts = preg_split('/:/', $contentID);
@@ -3224,8 +3440,16 @@  discard block
 block discarded – undo
3224 3440
 	 */
3225 3441
 	function freebusy($user,$end=null,$utc=true, $charset='UTF-8', $start=null, $method='PUBLISH', array $extra=null)
3226 3442
 	{
3227
-		if (!$start) $start = time();	// default now
3228
-		if (!$end) $end = time() + 100*DAY_s;	// default next 100 days
3443
+		if (!$start)
3444
+		{
3445
+			$start = time();
3446
+		}
3447
+		// default now
3448
+		if (!$end)
3449
+		{
3450
+			$end = time() + 100*DAY_s;
3451
+		}
3452
+		// default next 100 days
3229 3453
 
3230 3454
 		$vcal = new Horde_Icalendar;
3231 3455
 		$vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'.
@@ -3247,10 +3471,13 @@  discard block
 block discarded – undo
3247 3471
 				$attributes[$attr] = date('Ymd\THis', $value);
3248 3472
 			}
3249 3473
 		}
3250
-		if (is_null($extra)) $extra = array(
3474
+		if (is_null($extra))
3475
+		{
3476
+			$extra = array(
3251 3477
 			'URL' => $this->freebusy_url($user),
3252 3478
 			'ORGANIZER' => 'mailto:'.$GLOBALS['egw']->accounts->id2name($user,'account_email'),
3253 3479
 		);
3480
+		}
3254 3481
 		foreach($attributes+$extra as $attr => $value)
3255 3482
 		{
3256 3483
 			$vfreebusy->setAttribute($attr, $value);
@@ -3266,9 +3493,18 @@  discard block
 block discarded – undo
3266 3493
 		{
3267 3494
 			foreach ($fbdata as $event)
3268 3495
 			{
3269
-				if ($event['non_blocking']) continue;
3270
-				if ($event['uid'] === $extra['X-CALENDARSERVER-MASK-UID']) continue;
3271
-				if ($event['participants'][$user] == 'R') continue;
3496
+				if ($event['non_blocking'])
3497
+				{
3498
+					continue;
3499
+				}
3500
+				if ($event['uid'] === $extra['X-CALENDARSERVER-MASK-UID'])
3501
+				{
3502
+					continue;
3503
+				}
3504
+				if ($event['participants'][$user] == 'R')
3505
+				{
3506
+					continue;
3507
+				}
3272 3508
 
3273 3509
 				$fbtype = $event['participants'][$user] == 'T' ? 'BUSY-TENTATIVE' : 'BUSY';
3274 3510
 
Please login to merge, or discard this patch.
calendar/inc/class.calendar_uilist.inc.php 1 patch
Braces   +48 added lines, -13 removed lines patch added patch discarded remove patch
@@ -77,8 +77,14 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	function listview($_content=null,$msg='',$home=false)
79 79
 	{
80
-		if ($_GET['msg']) $msg .= $_GET['msg'];
81
-		if ($this->group_warning) $msg .= $this->group_warning;
80
+		if ($_GET['msg'])
81
+		{
82
+			$msg .= $_GET['msg'];
83
+		}
84
+		if ($this->group_warning)
85
+		{
86
+			$msg .= $this->group_warning;
87
+		}
82 88
 
83 89
 		$etpl = new Etemplate('calendar.list');
84 90
 
@@ -106,7 +112,8 @@  discard block
 block discarded – undo
106 112
 			{
107 113
 				// Allow merge using the date range filter
108 114
 				if(strpos($_content['nm']['action'],'document') !== false &&
109
-					!count($_content['nm']['selected']) && !$_content['nm']['select_all']) {
115
+					!count($_content['nm']['selected']) && !$_content['nm']['select_all'])
116
+				{
110 117
 					$_content['nm']['selected'][] = $this->get_merge_range($_content['nm']);
111 118
 				}
112 119
 				if (!count($_content['nm']['selected']) && !$_content['nm']['select_all'])
@@ -165,15 +172,21 @@  discard block
 block discarded – undo
165 172
 		{
166 173
 			$params = null;
167 174
 			parse_str(substr($json_data['request']['parameters'][0], 10), $params);	// cut off "/index.php?"
168
-			if (isset($params['keywords']))	// new search => set filters so every match is shown
175
+			if (isset($params['keywords']))
176
+			{
177
+				// new search => set filters so every match is shown
169 178
 			{
170 179
 				$this->adjust_for_search($params['keywords'], $content['nm']);
171 180
 			}
181
+			}
172 182
 		}
173
-		if (isset($_REQUEST['keywords']))	// new search => set filters so every match is shown
183
+		if (isset($_REQUEST['keywords']))
184
+		{
185
+			// new search => set filters so every match is shown
174 186
 		{
175 187
 			$this->adjust_for_search($_REQUEST['keywords'],$content['nm']);
176 188
 		}
189
+		}
177 190
 		$sel_options['filter'] = &$this->date_filters;
178 191
 
179 192
 		// Send categories for row styling - calendar uses no_cat, so they don't go automatically
@@ -264,9 +277,12 @@  discard block
 block discarded – undo
264 277
 		$old_params = Api\Cache::getSession('calendar', 'calendar_list');
265 278
 		if (is_array($old_params))
266 279
 		{
267
-			if ($old_params['filter'] && $old_params['filter'] != $params['filter'])	// filter changed => order accordingly
280
+			if ($old_params['filter'] && $old_params['filter'] != $params['filter'])
281
+			{
282
+				// filter changed => order accordingly
268 283
 			{
269 284
 				$params['order'] = 'cal_start';
285
+			}
270 286
 				$params['sort'] = $params['filter'] == 'before' ? 'DESC' : 'ASC';
271 287
 			}
272 288
 			if ($old_params['search'] != $params['search'])
@@ -274,7 +290,10 @@  discard block
 block discarded – undo
274 290
 				$this->adjust_for_search($params['search'],$params);
275 291
 			}
276 292
 		}
277
-		if (!$params['csv_export']) Api\Cache::setSession('calendar', 'calendar_list', $params);
293
+		if (!$params['csv_export'])
294
+		{
295
+			Api\Cache::setSession('calendar', 'calendar_list', $params);
296
+		}
278 297
 
279 298
 		// do we need to query custom fields and which
280 299
 		// Check stored preference if selectcols isn't available (ie: first call)
@@ -288,7 +307,10 @@  discard block
 block discarded – undo
288 307
 			$cfs = array();
289 308
 			foreach($select_cols as $col)
290 309
 			{
291
-				if ($col[0] == '#') $cfs[] = substr($col,1);
310
+				if ($col[0] == '#')
311
+				{
312
+					$cfs[] = substr($col,1);
313
+				}
292 314
 			}
293 315
 		}
294 316
 		$search_params = array(
@@ -521,7 +543,10 @@  discard block
 block discarded – undo
521 543
 		{
522 544
 			$rows['format'] = '64';
523 545
 		}
524
-		if ($this->cat_id) $rows['no_cat_id'] = true;
546
+		if ($this->cat_id)
547
+		{
548
+			$rows['no_cat_id'] = true;
549
+		}
525 550
 		if (!$GLOBALS['egw_info']['user']['apps']['projectmanager'])
526 551
 		{
527 552
 			$params['options-selectcols']['pm_id'] = false;
@@ -587,7 +612,10 @@  discard block
 block discarded – undo
587 612
 			$this->get_rows($query,$events,$readonlys);
588 613
 			foreach($events as $key => $event)
589 614
 			{
590
-				if (!in_array($event['id'],$checked) && !in_array($event['id'].':'.$event['recur_date'], $checked)) unset($events[$key]);
615
+				if (!in_array($event['id'],$checked) && !in_array($event['id'].':'.$event['recur_date'], $checked))
616
+				{
617
+					unset($events[$key]);
618
+				}
591 619
 			}
592 620
 			$checked = array_values($events); // Clear keys
593 621
 		}
@@ -601,7 +629,10 @@  discard block
 block discarded – undo
601 629
 				$ids = array();
602 630
 				foreach($checked as $id)
603 631
 				{
604
-					if (is_array($id)) $id = $id['id'];
632
+					if (is_array($id))
633
+					{
634
+						$id = $id['id'];
635
+					}
605 636
 					// get rid of recurrences, doublicate series and calendar-integration events
606 637
 					if (($id = (int)$id))
607 638
 					{
@@ -615,7 +646,10 @@  discard block
 block discarded – undo
615 646
 				exit();
616 647
 
617 648
 			case 'document':
618
-				if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['calendar']['default_document'];
649
+				if (!$settings)
650
+				{
651
+					$settings = $GLOBALS['egw_info']['user']['preferences']['calendar']['default_document'];
652
+				}
619 653
 				$document_merge = new calendar_merge();
620 654
 				$msg = $document_merge->download($settings, $checked, '', $GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']);
621 655
 				$failed = count($checked);
@@ -802,7 +836,8 @@  discard block
 block discarded – undo
802 836
 						$success++;
803 837
 
804 838
 						// Can't link to just one of a recurring series of events
805
-						if(!$recur_date || $app) {
839
+						if(!$recur_date || $app)
840
+						{
806 841
 							// Create link
807 842
 							$link_id = $app ? $app_id : $id;
808 843
 							Link::link($app ? $app : 'calendar', $link_id, 'timesheet', $timesheet_bo->data['ts_id']);
Please login to merge, or discard this patch.
calendar/inc/class.calendar_uiviews.inc.php 1 patch
Braces   +69 added lines, -21 removed lines patch added patch discarded remove patch
@@ -179,7 +179,10 @@  discard block
 block discarded – undo
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'))
183
+		{
184
+			$time = new Api\DateTime($time);
185
+		}
183 186
 
184 187
 		// if week does not start Monday and $time is Sunday --> add one day
185 188
 		if ($this->cal_prefs['weekdaystarts'] != 'Monday' && !($wday = $time->format('w')))
@@ -237,7 +240,8 @@  discard block
 block discarded – undo
237 240
 		$tmpl = new Etemplate('calendar.toolbar');
238 241
 		$tmpl->setElementAttribute('toolbar', 'actions', $this->getToolbarActions($content));
239 242
 		// Adjust toolbar for mobile
240
-		if(Api\Header\UserAgent::mobile()){
243
+		if(Api\Header\UserAgent::mobile())
244
+		{
241 245
 			$tmpl->setElementAttribute('toolbar','class', 'et2_head_toolbar');
242 246
 			$tmpl->setElementAttribute('toolbar','view_range', '3');
243 247
 		}
@@ -396,10 +400,12 @@  discard block
 block discarded – undo
396 400
 		{
397 401
 			foreach (array_keys($actions) as $key)
398 402
 			{
399
-				if (!in_array($key, array('day_view','week_view','next', 'today','previous'))) {
403
+				if (!in_array($key, array('day_view','week_view','next', 'today','previous')))
404
+				{
400 405
 					$actions[$key]['toolbarDefault'] = false;
401 406
 				}
402
-				else {
407
+				else
408
+				{
403 409
 					$actions[$key]['toolbarDefault'] = true;
404 410
 				}
405 411
 			}
@@ -416,29 +422,38 @@  discard block
 block discarded – undo
416 422
 	 */
417 423
 	function &planner($content = array(), $home=false)
418 424
 	{
419
-		if ($this->sortby == 'month')	// yearly planner with month rows
425
+		if ($this->sortby == 'month')
426
+		{
427
+			// yearly planner with month rows
420 428
 		{
421 429
 			$this->first = $this->bo->date2array($this->date);
430
+		}
422 431
 			$this->first['day'] = 1;
423 432
 			unset($this->first['raw']);
424 433
 			$this->last = $this->first;
425 434
 			$this->last['year']++;
426 435
 			$this->last = $this->bo->date2ts($this->last)-1;
427 436
 		}
428
-		elseif (!$this->planner_view || $this->planner_view == 'month')	// planner monthview
437
+		elseif (!$this->planner_view || $this->planner_view == 'month')
438
+		{
439
+			// planner monthview
429 440
 		{
430 441
 			if ($this->day < 15)	// show one complete month
431 442
 			{
432 443
 				$this->_week_align_month($this->first,$this->last);
444
+		}
433 445
 			}
434 446
 			else	// show 2 half month
435 447
 			{
436 448
 				$this->_week_align_month($this->first,$this->last,15);
437 449
 			}
438 450
 		}
439
-		elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN')	// weeekview
451
+		elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN')
452
+		{
453
+			// weeekview
440 454
 		{
441 455
 			$start = new Api\DateTime($this->date);
456
+		}
442 457
 			$start->setWeekstart();
443 458
 			$this->first = $start->format('ts');
444 459
 			$this->last = $this->bo->date2array($this->first);
@@ -477,7 +492,10 @@  discard block
 block discarded – undo
477 492
 			$this->to_client($event);
478 493
 		}
479 494
 
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));
495
+		if ($this->debug > 0)
496
+		{
497
+			$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));
498
+		}
481 499
 
482 500
 		$tmpl = $home ? $home : new Etemplate('calendar.planner');
483 501
 
@@ -501,7 +519,10 @@  discard block
 block discarded – undo
501 519
 	 */
502 520
 	function &month($weeks=0,$home=false)
503 521
 	{
504
-		if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date);
522
+		if ($this->debug > 0)
523
+		{
524
+			$this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date);
525
+		}
505 526
 
506 527
 		if (!$home)
507 528
 		{
@@ -543,7 +564,10 @@  discard block
 block discarded – undo
543 564
 			$weekNavH = "1 month";
544 565
 			$navHeader = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year;
545 566
 		}
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));
567
+		if ($this->debug > 0)
568
+		{
569
+			$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));
570
+		}
547 571
 
548 572
 		// Loop through, using Api\DateTime to handle DST
549 573
 		$week = 0;
@@ -588,7 +612,10 @@  discard block
 block discarded – undo
588 612
 		$start->setWeekstart();
589 613
 		$first = $start->format('ts');
590 614
 		$start->setDate($this->year,$this->month+1,$day);
591
-		if ($day == 1) $start->add('-1day');
615
+		if ($day == 1)
616
+		{
617
+			$start->add('-1day');
618
+		}
592 619
 		$start->setWeekstart();
593 620
 		// now we need to calculate the end of the last day of that week
594 621
 		// as simple $last += WEEK_s - 1; does NOT work, if daylight saving changes in that week!!!
@@ -611,19 +638,31 @@  discard block
 block discarded – undo
611 638
 		if (!$days)
612 639
 		{
613 640
 			$days = isset($_GET['days']) ? $_GET['days'] : $this->cal_prefs['days_in_weekview'];
614
-			if ($days != 5) $days = 7;
615
-			if ($days != $this->cal_prefs['days_in_weekview'])	// save the preference
641
+			if ($days != 5)
642
+			{
643
+				$days = 7;
644
+			}
645
+			if ($days != $this->cal_prefs['days_in_weekview'])
646
+			{
647
+				// save the preference
616 648
 			{
617 649
 				$GLOBALS['egw']->preferences->add('calendar','days_in_weekview',$days);
650
+			}
618 651
 				$GLOBALS['egw']->preferences->save_repository();
619 652
 				$this->cal_prefs['days_in_weekview'] = $days;
620 653
 			}
621 654
 		}
622
-		if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2',True,$days,$this->date);
655
+		if ($this->debug > 0)
656
+		{
657
+			$this->bo->debug_message('uiviews::week(days=%1) date=%2',True,$days,$this->date);
658
+		}
623 659
 
624
-		if ($days <= 4)		// next 4 days view
660
+		if ($days <= 4)
661
+		{
662
+			// next 4 days view
625 663
 		{
626 664
 			$wd_start = $this->first = $this->bo->date2ts($this->date);
665
+		}
627 666
 			$this->last = strtotime("+$days days",$this->first) - 1;
628 667
 			$view = $days == 1 ? 'day' : 'day4';
629 668
 		}
@@ -632,12 +671,15 @@  discard block
 block discarded – undo
632 671
 			$start = new Api\DateTime($this->date);
633 672
 			$start->setWeekstart();
634 673
 			$wd_start = $this->first = $start->format('ts');
635
-			if ($days <= 5)		// no weekend-days
674
+			if ($days <= 5)
675
+			{
676
+				// no weekend-days
636 677
 			{
637 678
 				switch($this->cal_prefs['weekdaystarts'])
638 679
 				{
639 680
 					case 'Saturday':
640 681
 						$this->first = strtotime("+2 days",$this->first);
682
+			}
641 683
 						break;
642 684
 					case 'Sunday':
643 685
 						$this->first = strtotime("+1 day",$this->first);
@@ -666,7 +708,10 @@  discard block
 block discarded – undo
666 708
 			) + $this->search_params;
667 709
 
668 710
 		$users = $this->search_params['users'];
669
-		if (!is_array($users)) $users = array($users);
711
+		if (!is_array($users))
712
+		{
713
+			$users = array($users);
714
+		}
670 715
 
671 716
 		$content = array('view' => array());
672 717
 
@@ -689,8 +734,7 @@  discard block
 block discarded – undo
689 734
 			$this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days",$this->first) - 1);
690 735
 			if (count($users) == 1 || count($users) >= $this->cal_prefs['week_consolidate']	||// for more then X users, show all in one row
691 736
 				$days == 1 // Showing just 1 day
692
-			)
693
-			{
737
+			) {
694 738
 				$content['view'][] = (array)$this->tagWholeDayOnTop($this->bo->search($search_params)) +
695 739
 					array('owner' => $users);
696 740
 			}
@@ -793,7 +837,8 @@  discard block
 block discarded – undo
793 837
 						}
794 838
 						$todo['icons'] = $icons;
795 839
 						$class = $class == 'row_on' ? 'row_off' : 'row_on';
796
-						if($todo['edit']) {
840
+						if($todo['edit'])
841
+						{
797 842
 							$todo['edit_size'] = $todo['edit']['size'];
798 843
 							unset($todo['edit']['size']);
799 844
 							$edit_icon_href = Api\Html::a_href( $icons, $todo['edit'],'',' data-todo="app|750x590" ');
@@ -914,7 +959,10 @@  discard block
 block discarded – undo
914 959
 		// This disables the event actions for the grid rows (calendar weeks/owners)
915 960
 		foreach($actions as $id => &$action)
916 961
 		{
917
-			if($id=='add') continue;
962
+			if($id=='add')
963
+			{
964
+				continue;
965
+			}
918 966
 			if(!$action['enabled'])
919 967
 			{
920 968
 				$action['enabled'] = 'javaScript:app.calendar.is_event';
Please login to merge, or discard this patch.
calendar/inc/class.calendar_groupdav.inc.php 1 patch
Braces   +225 added lines, -56 removed lines patch added patch discarded remove patch
@@ -120,7 +120,10 @@  discard block
 block discarded – undo
120 120
 		}
121 121
 		else
122 122
 		{
123
-			if (!is_array($event)) $event = $this->bo->read($event);
123
+			if (!is_array($event))
124
+			{
125
+				$event = $this->bo->read($event);
126
+			}
124 127
 			$name = $event[self::$path_attr];
125 128
 		}
126 129
 		$name .= self::$path_extension;
@@ -181,10 +184,13 @@  discard block
 block discarded – undo
181 184
 			}
182 185
 			$filter[$name] = $this->bo->now + 24*3600*($name == 'start' ? -1 : 1)*abs($value);
183 186
 		}
184
-		if ($this->client_shared_uid_exceptions)	// do NOT return (non-virtual) exceptions
187
+		if ($this->client_shared_uid_exceptions)
188
+		{
189
+			// do NOT return (non-virtual) exceptions
185 190
 		{
186 191
 			$filter['query'] = array('cal_reference' => 0);
187 192
 		}
193
+		}
188 194
 
189 195
 		if ($path == '/calendar/')
190 196
 		{
@@ -214,7 +220,11 @@  discard block
 block discarded – undo
214 220
 			// when trying to request not supported components, eg. VTODO on a calendar collection
215 221
 			return true;
216 222
 		}
217
-		if ($id) $path = dirname($path).'/';	// caldav_name get's added anyway in the callback
223
+		if ($id)
224
+		{
225
+			$path = dirname($path).'/';
226
+		}
227
+		// caldav_name get's added anyway in the callback
218 228
 
219 229
 		if ($this->debug > 1)
220 230
 		{
@@ -276,7 +286,11 @@  discard block
 block discarded – undo
276 286
 		$n = 0;
277 287
 		foreach($files as $file)
278 288
 		{
279
-			if (!$n++) continue;	// first entry is collection itself
289
+			if (!$n++)
290
+			{
291
+				continue;
292
+			}
293
+			// first entry is collection itself
280 294
 
281 295
 			$icalendar = $file['props']['calendar-data']['val'];
282 296
 			if (($start = strpos($icalendar, 'BEGIN:VEVENT')) !== false &&
@@ -320,10 +334,17 @@  discard block
 block discarded – undo
320 334
 	 */
321 335
 	function propfind_callback($path,array $filter,$start=false)
322 336
 	{
323
-		if ($this->debug) $starttime = microtime(true);
337
+		if ($this->debug)
338
+		{
339
+			$starttime = microtime(true);
340
+		}
324 341
 
325 342
 		$calendar_data = $this->caldav->prop_requested('calendar-data', Api\CalDAV::CALDAV, true);
326
-		if (!is_array($calendar_data)) $calendar_data = false;	// not in allprop or autoindex
343
+		if (!is_array($calendar_data))
344
+		{
345
+			$calendar_data = false;
346
+		}
347
+		// not in allprop or autoindex
327 348
 
328 349
 		$files = array();
329 350
 
@@ -481,7 +502,10 @@  discard block
 block discarded – undo
481 502
 				switch($filter['name'])
482 503
 				{
483 504
 					case 'comp-filter':
484
-						if ($this->debug > 1) error_log(__METHOD__."($options[path],...) comp-filter='{$filter['attrs']['name']}'");
505
+						if ($this->debug > 1)
506
+						{
507
+							error_log(__METHOD__."($options[path],...) comp-filter='{$filter['attrs']['name']}'");
508
+						}
485 509
 
486 510
 						switch($filter['attrs']['name'])
487 511
 						{
@@ -496,14 +520,23 @@  discard block
 block discarded – undo
496 520
 						}
497 521
 						break;
498 522
 					case 'prop-filter':
499
-						if ($this->debug > 1) error_log(__METHOD__."($options[path],...) prop-filter='{$filter['attrs']['name']}'");
523
+						if ($this->debug > 1)
524
+						{
525
+							error_log(__METHOD__."($options[path],...) prop-filter='{$filter['attrs']['name']}'");
526
+						}
500 527
 						$prop_filter = $filter['attrs']['name'];
501 528
 						break;
502 529
 					case 'text-match':
503
-						if ($this->debug > 1) error_log(__METHOD__."($options[path],...) text-match: $prop_filter='{$filter['data']}'");
530
+						if ($this->debug > 1)
531
+						{
532
+							error_log(__METHOD__."($options[path],...) text-match: $prop_filter='{$filter['data']}'");
533
+						}
504 534
 						if (!isset($this->filter_prop2cal[strtoupper($prop_filter)]))
505 535
 						{
506
-							if ($this->debug) error_log(__METHOD__."($options[path],".array2string($options).",...) unknown property '$prop_filter' --> ignored");
536
+							if ($this->debug)
537
+							{
538
+								error_log(__METHOD__."($options[path],".array2string($options).",...) unknown property '$prop_filter' --> ignored");
539
+							}
507 540
 						}
508 541
 						else
509 542
 						{
@@ -512,10 +545,16 @@  discard block
 block discarded – undo
512 545
 						unset($prop_filter);
513 546
 						break;
514 547
 					case 'param-filter':
515
-						if ($this->debug) error_log(__METHOD__."($options[path],...) param-filter='{$filter['attrs']['name']}' not (yet) implemented!");
548
+						if ($this->debug)
549
+						{
550
+							error_log(__METHOD__."($options[path],...) param-filter='{$filter['attrs']['name']}' not (yet) implemented!");
551
+						}
516 552
 						break;
517 553
 					case 'time-range':
518
-				 		if ($this->debug > 1) error_log(__FILE__ . __METHOD__."($options[path],...) time-range={$filter['attrs']['start']}-{$filter['attrs']['end']}");
554
+				 		if ($this->debug > 1)
555
+				 		{
556
+				 			error_log(__FILE__ . __METHOD__."($options[path],...) time-range={$filter['attrs']['start']}-{$filter['attrs']['end']}");
557
+				 		}
519 558
 				 		if (!empty($filter['attrs']['start']))
520 559
 				 		{
521 560
 					 		$cal_filters['start'] = $this->vCalendar->_parseDateTime($filter['attrs']['start']);
@@ -526,13 +565,19 @@  discard block
 block discarded – undo
526 565
 				 		}
527 566
 						break;
528 567
 					default:
529
-						if ($this->debug) error_log(__METHOD__."($options[path],".array2string($options).",...) unknown filter --> ignored");
568
+						if ($this->debug)
569
+						{
570
+							error_log(__METHOD__."($options[path],".array2string($options).",...) unknown filter --> ignored");
571
+						}
530 572
 						break;
531 573
 				}
532 574
 			}
533
-			if (count($cal_filters) == $num_filters)	// no filters set --> restore default start and end time
575
+			if (count($cal_filters) == $num_filters)
576
+			{
577
+				// no filters set --> restore default start and end time
534 578
 			{
535 579
 				$cal_filters['start'] = $cal_start;
580
+			}
536 581
 				$cal_filters['end']   = $cal_end;
537 582
 			}
538 583
 		}
@@ -609,7 +654,10 @@  discard block
 block discarded – undo
609 654
 				}
610 655
 			}
611 656
 
612
-			if ($this->debug > 1) error_log(__FILE__ . __METHOD__ ."($options[path],...,$id) calendar-multiget: ids=".implode(',',$ids).', cal_filters='.array2string($cal_filters));
657
+			if ($this->debug > 1)
658
+			{
659
+				error_log(__FILE__ . __METHOD__ ."($options[path],...,$id) calendar-multiget: ids=".implode(',',$ids).', cal_filters='.array2string($cal_filters));
660
+			}
613 661
 		}
614 662
 		return true;
615 663
 	}
@@ -655,9 +703,15 @@  discard block
 block discarded – undo
655 703
 	private function iCal(array $event,$user=null, $method=null, $expand=false)
656 704
 	{
657 705
 		static $handler = null;
658
-		if (is_null($handler)) $handler = $this->_get_handler();
706
+		if (is_null($handler))
707
+		{
708
+			$handler = $this->_get_handler();
709
+		}
659 710
 
660
-		if (!$user) $user = $GLOBALS['egw_info']['user']['account_id'];
711
+		if (!$user)
712
+		{
713
+			$user = $GLOBALS['egw_info']['user']['account_id'];
714
+		}
661 715
 
662 716
 		// only return alarms in own calendar, not other users calendars
663 717
 		if ($user != $GLOBALS['egw_info']['user']['account_id'])
@@ -673,8 +727,14 @@  discard block
 block discarded – undo
673 727
 		{
674 728
 			if (is_array($expand))
675 729
 			{
676
-				if (isset($expand['start'])) $expand['start'] = $this->vCalendar->_parseDateTime($expand['start']);
677
-				if (isset($expand['end'])) $expand['end'] = $this->vCalendar->_parseDateTime($expand['end']);
730
+				if (isset($expand['start']))
731
+				{
732
+					$expand['start'] = $this->vCalendar->_parseDateTime($expand['start']);
733
+				}
734
+				if (isset($expand['end']))
735
+				{
736
+					$expand['end'] = $this->vCalendar->_parseDateTime($expand['end']);
737
+				}
678 738
 			}
679 739
 			$events =& self::get_series($event['uid'], $this->bo, $expand, $user);
680 740
 		}
@@ -698,7 +758,10 @@  discard block
 block discarded – undo
698 758
 	 */
699 759
 	private static function &get_series($uid,calendar_bo $bo=null, $expand=false, $user=null)
700 760
 	{
701
-		if (is_null($bo)) $bo = new calendar_bopdate();
761
+		if (is_null($bo))
762
+		{
763
+			$bo = new calendar_bopdate();
764
+		}
702 765
 
703 766
 		$params = array(
704 767
 			'query' => array('cal_uid' => $uid),
@@ -707,7 +770,10 @@  discard block
 block discarded – undo
707 770
 			'date_format' => 'server',
708 771
 			'cfs' => array(),	// read cfs as we use them to store X- attributes
709 772
 		);
710
-		if (is_array($expand)) $params += $expand;
773
+		if (is_array($expand))
774
+		{
775
+			$params += $expand;
776
+		}
711 777
 
712 778
 		if (!($events =& $bo->search($params)))
713 779
 		{
@@ -728,12 +794,17 @@  discard block
 block discarded – undo
728 794
 			}
729 795
 		}
730 796
 		// if recurring event starts in future behind horizont, nothing will be returned by bo::search()
731
-		if (!isset($master)) $master = $bo->read($uid);
797
+		if (!isset($master))
798
+		{
799
+			$master = $bo->read($uid);
800
+		}
732 801
 
733 802
 		foreach($events as $k => &$recurrence)
734 803
 		{
735 804
 			//error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($uid)[$k]:" . array2string($recurrence));
736
-			if (!$master || $recurrence['id'] != $master['id'])	// real exception
805
+			if (!$master || $recurrence['id'] != $master['id'])
806
+			{
807
+				// real exception
737 808
 			{
738 809
 				// user is NOT participating in this exception
739 810
 				if ($user && !self::isParticipant($recurrence, $user))
@@ -742,6 +813,7 @@  discard block
 block discarded – undo
742 813
 					if (!$master || !self::isParticipant($master, $user))
743 814
 					{
744 815
 						unset($events[$k]);
816
+			}
745 817
 						continue;
746 818
 					}
747 819
 					// otherwise mark him in this exception as rejected
@@ -777,7 +849,10 @@  discard block
 block discarded – undo
777 849
 			// this is a virtual exception now (no extra event/cal_id in DB)
778 850
 			//error_log('virtual exception: '.array2string($recurrence));
779 851
 			$recurrence['recurrence'] = $recurrence['start'];
780
-			if ($master) $recurrence['reference'] = $master['id'];
852
+			if ($master)
853
+			{
854
+				$recurrence['reference'] = $master['id'];
855
+			}
781 856
 			$recurrence['recur_type'] = MCAL_RECUR_NONE;	// is set, as this is a copy of the master
782 857
 			// not for included exceptions (Lightning): $master['recur_exception'][] = $recurrence['start'];
783 858
 		}
@@ -814,9 +889,16 @@  discard block
 block discarded – undo
814 889
 	 */
815 890
 	function put(&$options,$id,$user=null,$prefix=null)
816 891
 	{
817
-		if ($this->debug) error_log(__METHOD__."($id, $user)".print_r($options,true));
892
+		if ($this->debug)
893
+		{
894
+			error_log(__METHOD__."($id, $user)".print_r($options,true));
895
+		}
818 896
 
819
-		if (!$prefix) $user = null;	// /infolog/ does not imply setting the current user (for new entries it's done anyway)
897
+		if (!$prefix)
898
+		{
899
+			$user = null;
900
+		}
901
+		// /infolog/ does not imply setting the current user (for new entries it's done anyway)
820 902
 
821 903
 		// fix for iCal4OL using WinHTTP only supporting a certain header length
822 904
 		if (isset($_SERVER['HTTP_IF_SCHEDULE']) && !isset($_SERVER['HTTP_IF_SCHEDULE_TAG_MATCH']))
@@ -828,7 +910,10 @@  discard block
 block discarded – undo
828 910
 			isset($_SERVER['HTTP_IF_SCHEDULE_TAG_MATCH']));	// dont fail with 412 Precondition Failed in that case
829 911
 		if (!is_null($oldEvent) && !is_array($oldEvent))
830 912
 		{
831
-			if ($this->debug) error_log(__METHOD__.': '.print_r($oldEvent,true).function_backtrace());
913
+			if ($this->debug)
914
+			{
915
+				error_log(__METHOD__.': '.print_r($oldEvent,true).function_backtrace());
916
+			}
832 917
 			return $oldEvent;
833 918
 		}
834 919
 
@@ -839,7 +924,10 @@  discard block
 block discarded – undo
839 924
 		{
840 925
 			// we have no add permission on this user's calendar
841 926
 			// ToDo: create event in current users calendar and invite only $user
842
-			if ($this->debug) error_log(__METHOD__."(,,$user) we have not enough rights on this calendar");
927
+			if ($this->debug)
928
+			{
929
+				error_log(__METHOD__."(,,$user) we have not enough rights on this calendar");
930
+			}
843 931
 			return '403 Forbidden';
844 932
 		}
845 933
 
@@ -887,13 +975,19 @@  discard block
 block discarded – undo
887 975
 			if ($this->use_schedule_tag && isset($_SERVER['HTTP_IF_SCHEDULE_TAG_MATCH']))
888 976
 			{
889 977
 				$schedule_tag_match = $_SERVER['HTTP_IF_SCHEDULE_TAG_MATCH'];
890
-				if ($schedule_tag_match[0] == '"') $schedule_tag_match = substr($schedule_tag_match, 1, -1);
978
+				if ($schedule_tag_match[0] == '"')
979
+				{
980
+					$schedule_tag_match = substr($schedule_tag_match, 1, -1);
981
+				}
891 982
 				$schedule_tag = null;
892 983
 				$this->get_etag($oldEvent, $schedule_tag);
893 984
 
894 985
 				if ($schedule_tag_match !== $schedule_tag)
895 986
 				{
896
-					if ($this->debug) error_log(__METHOD__."(,,$user) schedule_tag missmatch: given '$schedule_tag_match' != '$schedule_tag'");
987
+					if ($this->debug)
988
+					{
989
+						error_log(__METHOD__."(,,$user) schedule_tag missmatch: given '$schedule_tag_match' != '$schedule_tag'");
990
+					}
897 991
 					// honor Prefer: return=representation for 412 too (no need for client to explicitly reload)
898 992
 					$this->check_return_representation($options, $id, $user);
899 993
 					return '412 Precondition Failed';
@@ -908,7 +1002,10 @@  discard block
 block discarded – undo
908 1002
 					// above can be true, if current user is not in master but just a recurrence
909 1003
 					(!$oldEvent['recur_type'] || !($series = self::get_series($oldEvent['uid'], $this->bo))))
910 1004
 				{
911
-					if ($this->debug) error_log(__METHOD__."(,,$user) user $user is NOT an attendee!");
1005
+					if ($this->debug)
1006
+					{
1007
+						error_log(__METHOD__."(,,$user) user $user is NOT an attendee!");
1008
+					}
912 1009
 					return '403 Forbidden';
913 1010
 				}
914 1011
 				// update only participant status and alarms of current user
@@ -928,7 +1025,10 @@  discard block
 block discarded – undo
928 1025
 							}
929 1026
 							foreach($series as $oldEvent)
930 1027
 							{
931
-								if ($oldEvent['recurrence'] == $event['recurrence']) break;
1028
+								if ($oldEvent['recurrence'] == $event['recurrence'])
1029
+								{
1030
+									break;
1031
+								}
932 1032
 							}
933 1033
 							// if no exception found, check if it might be just a recurrence (no exception)
934 1034
 							if ($event['recurrence'] && $oldEvent['recurrence'] != $event['recurrence'])
@@ -943,7 +1043,10 @@  discard block
 block discarded – undo
943 1043
 								}
944 1044
 							}
945 1045
 						}
946
-						if ($this->debug) error_log(__METHOD__."(, $id, $user, '$prefix') eventId=$eventId ($oldEvent[id]), user=$user, old-status='{$oldEvent['participants'][$user]}', new-status='{$event['participants'][$user]}', recurrence=$event[recurrence]=".Api\DateTime::to($event['recurrence']).", event=".array2string($event));
1046
+						if ($this->debug)
1047
+						{
1048
+							error_log(__METHOD__."(, $id, $user, '$prefix') eventId=$eventId ($oldEvent[id]), user=$user, old-status='{$oldEvent['participants'][$user]}', new-status='{$event['participants'][$user]}', recurrence=$event[recurrence]=".Api\DateTime::to($event['recurrence']).", event=".array2string($event));
1049
+						}
947 1050
 						if (isset($event['participants']) && isset($event['participants'][$user]) &&
948 1051
 							$event['participants'][$user] !== $oldEvent['participants'][$user])
949 1052
 						{
@@ -951,13 +1054,19 @@  discard block
 block discarded – undo
951 1054
 								// real (not virtual) exceptions use recurrence 0 in egw_cal_user.cal_recurrence!
952 1055
 								$recurrence = $eventId == $oldEvent['id'] ? $event['recurrence'] : 0))
953 1056
 							{
954
-								if ($this->debug) error_log(__METHOD__."(,,$user) failed to set_status($oldEvent[id], $user, '{$event['participants'][$user]}', $recurrence=".Api\DateTime::to($recurrence).')');
1057
+								if ($this->debug)
1058
+								{
1059
+									error_log(__METHOD__."(,,$user) failed to set_status($oldEvent[id], $user, '{$event['participants'][$user]}', $recurrence=".Api\DateTime::to($recurrence).')');
1060
+								}
955 1061
 								return '403 Forbidden';
956 1062
 							}
957 1063
 							else
958 1064
 							{
959 1065
 								++$modified;
960
-								if ($this->debug) error_log(__METHOD__."() set_status($oldEvent[id], $user, {$event['participants'][$user]} , $recurrence=".Api\DateTime::to($recurrence).')');
1066
+								if ($this->debug)
1067
+								{
1068
+									error_log(__METHOD__."() set_status($oldEvent[id], $user, {$event['participants'][$user]} , $recurrence=".Api\DateTime::to($recurrence).')');
1069
+								}
961 1070
 							}
962 1071
 						}
963 1072
 						// import alarms, if given and changed
@@ -967,15 +1076,21 @@  discard block
 block discarded – undo
967 1076
 							$modified += $handler->sync_alarms($event, (array)$oldEvent['alarm'], $user);
968 1077
 						}
969 1078
 					}
970
-					if (!$modified)	// NO modififictions, or none we understood --> log it and return Ok: "204 No Content"
1079
+					if (!$modified)
1080
+					{
1081
+						// NO modififictions, or none we understood --> log it and return Ok: "204 No Content"
971 1082
 					{
972 1083
 						$this->caldav->log(__METHOD__."(,,$user) NO changes for current user events=".array2string($events).', old-event='.array2string($oldEvent));
973 1084
 					}
1085
+					}
974 1086
 					$this->put_response_headers($eventId, $options['path'], '204 No Content', self::$path_attr == 'caldav_name');
975 1087
 
976 1088
 					return '204 No Content';
977 1089
 				}
978
-				if ($this->debug && !isset($events)) error_log(__METHOD__."(,,$user) only schedule-tag given for event without participants (only calendar owner) --> handle as regular PUT");
1090
+				if ($this->debug && !isset($events))
1091
+				{
1092
+					error_log(__METHOD__."(,,$user) only schedule-tag given for event without participants (only calendar owner) --> handle as regular PUT");
1093
+				}
979 1094
 			}
980 1095
 			if ($return_no_access)
981 1096
 			{
@@ -1007,17 +1122,23 @@  discard block
 block discarded – undo
1007 1122
 		if (!($cal_id = $handler->importVCal($vCalendar, $eventId,
1008 1123
 			self::etag2value($this->http_if_match), false, 0, $this->caldav->current_user_principal, $user, $charset, $id)))
1009 1124
 		{
1010
-			if ($this->debug) error_log(__METHOD__."(,$id) eventId=$eventId: importVCal('$options[content]') returned ".array2string($cal_id));
1125
+			if ($this->debug)
1126
+			{
1127
+				error_log(__METHOD__."(,$id) eventId=$eventId: importVCal('$options[content]') returned ".array2string($cal_id));
1128
+			}
1011 1129
 			if ($eventId && $cal_id === false)
1012 1130
 			{
1013 1131
 				// ignore import failures
1014 1132
 				$cal_id = $eventId;
1015 1133
 				$retval = true;
1016 1134
 			}
1017
-			elseif ($cal_id === 0)	// etag failure
1135
+			elseif ($cal_id === 0)
1136
+			{
1137
+				// etag failure
1018 1138
 			{
1019 1139
 				// honor Prefer: return=representation for 412 too (no need for client to explicitly reload)
1020 1140
 				$this->check_return_representation($options, $id, $user);
1141
+			}
1021 1142
 				return '412 Precondition Failed';
1022 1143
 			}
1023 1144
 			else
@@ -1042,7 +1163,10 @@  discard block
 block discarded – undo
1042 1163
 	 */
1043 1164
 	function post(&$options,$id,$user=null)
1044 1165
 	{
1045
-		if ($this->debug) error_log(__METHOD__."($id, $user)".print_r($options,true));
1166
+		if ($this->debug)
1167
+		{
1168
+			error_log(__METHOD__."($id, $user)".print_r($options,true));
1169
+		}
1046 1170
 
1047 1171
 		$vCalendar = htmlspecialchars_decode($options['content']);
1048 1172
 		$charset = null;
@@ -1097,7 +1221,10 @@  discard block
 block discarded – undo
1097 1221
 				if (!($cal_id = $handler->importVCal($vCalendar, $eventId, null,
1098 1222
 					false, 0, $this->caldav->current_user_principal, $user, $charset)))
1099 1223
 				{
1100
-					if ($this->debug) error_log(__METHOD__."() importVCal($eventId) returned false");
1224
+					if ($this->debug)
1225
+					{
1226
+						error_log(__METHOD__."() importVCal($eventId) returned false");
1227
+					}
1101 1228
 				}
1102 1229
 				header('ETag: "'.$this->get_etag($eventId).'"');
1103 1230
 			}
@@ -1265,7 +1392,10 @@  discard block
 block discarded – undo
1265 1392
 		$org_recurrences = $exceptions = array();
1266 1393
 		foreach(self::get_series($events[0]['uid'],$bo) as $k => $event)
1267 1394
 		{
1268
-			if (!$k) $master = $event;
1395
+			if (!$k)
1396
+			{
1397
+				$master = $event;
1398
+			}
1269 1399
 			if ($event['recurrence'])
1270 1400
 			{
1271 1401
 				$org_recurrences[$event['recurrence']] = $event;
@@ -1285,10 +1415,13 @@  discard block
 block discarded – undo
1285 1415
 
1286 1416
 			// from now on we deal with exceptions
1287 1417
 			$org_recurrence = $org_recurrences[$recurrence['recurrence']];
1288
-			if (isset($org_recurrence))	// already existing recurrence
1418
+			if (isset($org_recurrence))
1419
+			{
1420
+				// already existing recurrence
1289 1421
 			{
1290 1422
 				//error_log(__METHOD__.'() setting id #'.$org_recurrence['id']).' for '.$recurrence['recurrence'].' = '.date('Y-m-d H:i:s',$recurrence['recurrence']);
1291 1423
 				$recurrence['id'] = $org_recurrence['id'];
1424
+			}
1292 1425
 
1293 1426
 				// re-add (non-virtual) exceptions to master's recur_exception
1294 1427
 				if ($recurrence['id'] != $master['id'])
@@ -1305,10 +1438,14 @@  discard block
 block discarded – undo
1305 1438
 		// delete not longer existing recurrences
1306 1439
 		foreach($org_recurrences as $org_recurrence)
1307 1440
 		{
1308
-			if ($org_recurrence['id'] != $master['id'])	// non-virtual recurrence
1441
+			if ($org_recurrence['id'] != $master['id'])
1442
+			{
1443
+				// non-virtual recurrence
1309 1444
 			{
1310 1445
 				//error_log(__METHOD__.'() deleting #'.$org_recurrence['id']);
1311
-				$bo->delete($org_recurrence['id']);	// might fail because of permissions
1446
+				$bo->delete($org_recurrence['id']);
1447
+			}
1448
+			// might fail because of permissions
1312 1449
 			}
1313 1450
 			else	// virtual recurrence
1314 1451
 			{
@@ -1339,7 +1476,7 @@  discard block
 block discarded – undo
1339 1476
 		if (!is_array($event = $this->_common_get_put_delete('DELETE',$options,$id,$return_no_access)) || !$return_no_access)
1340 1477
 		{
1341 1478
  			if (!$return_no_access)
1342
-			{
1479
+ 			{
1343 1480
 				// check if user is a participant or one of the groups he is a member of --> reject the meeting request
1344 1481
 				$ret = '403 Forbidden';
1345 1482
 				$memberships = $GLOBALS['egw']->accounts->memberships($this->bo->user, true);
@@ -1362,7 +1499,10 @@  discard block
 block discarded – undo
1362 1499
 		{
1363 1500
 			$ret = $this->bo->delete($event['id']);
1364 1501
 		}
1365
-		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));
1502
+		if ($this->debug)
1503
+		{
1504
+			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));
1505
+		}
1366 1506
 		return $ret;
1367 1507
 	}
1368 1508
 
@@ -1377,16 +1517,26 @@  discard block
 block discarded – undo
1377 1517
 	 */
1378 1518
 	function read($id)
1379 1519
 	{
1380
-		if (strpos($column=self::$path_attr,'_') === false) $column = 'cal_'.$column;
1520
+		if (strpos($column=self::$path_attr,'_') === false)
1521
+		{
1522
+			$column = 'cal_'.$column;
1523
+		}
1381 1524
 
1382 1525
 		$event = $this->bo->read(array($column => $id, 'cal_deleted IS NULL', 'cal_reference=0'), null, true, 'server');
1383
-		if ($event) $event = array_shift($event);	// read with array as 1. param, returns an array of events!
1526
+		if ($event)
1527
+		{
1528
+			$event = array_shift($event);
1529
+		}
1530
+		// read with array as 1. param, returns an array of events!
1384 1531
 
1385 1532
 		if (!($retval = $this->bo->check_perms(calendar_bo::ACL_FREEBUSY,$event, 0, 'server')) &&
1386 1533
 			// above can be true, if current user is not in master but just a recurrence
1387 1534
 			(!$event['recur_type'] || !($events = self::get_series($event['uid'], $this->bo))))
1388 1535
 		{
1389
-			if ($this->debug > 0) error_log(__METHOD__."($id) no READ or FREEBUSY rights returning ".array2string($retval));
1536
+			if ($this->debug > 0)
1537
+			{
1538
+				error_log(__METHOD__."($id) no READ or FREEBUSY rights returning ".array2string($retval));
1539
+			}
1390 1540
 			return $retval;
1391 1541
 		}
1392 1542
 		if (!$this->bo->check_perms(Acl::READ, $event, 0, 'server'))
@@ -1394,9 +1544,15 @@  discard block
 block discarded – undo
1394 1544
 			$this->bo->clear_private_infos($event, array($this->bo->user, $event['owner']));
1395 1545
 		}
1396 1546
 		// handle deleted events, as not existing
1397
-		if ($event['deleted']) $event = null;
1547
+		if ($event['deleted'])
1548
+		{
1549
+			$event = null;
1550
+		}
1398 1551
 
1399
-		if ($this->debug > 1) error_log(__METHOD__."($id) returning ".array2string($event));
1552
+		if ($this->debug > 1)
1553
+		{
1554
+			error_log(__METHOD__."($id) returning ".array2string($event));
1555
+		}
1400 1556
 
1401 1557
 		return $event;
1402 1558
 	}
@@ -1408,7 +1564,10 @@  discard block
 block discarded – undo
1408 1564
 	 */
1409 1565
 	public function update_tags($entry)
1410 1566
 	{
1411
-		if (!is_array($entry)) $entry = $this->read($entry);
1567
+		if (!is_array($entry))
1568
+		{
1569
+			$entry = $this->read($entry);
1570
+		}
1412 1571
 
1413 1572
 		$this->bo->update($entry, true);
1414 1573
 	}
@@ -1422,7 +1581,10 @@  discard block
 block discarded – undo
1422 1581
 	{
1423 1582
 		$ctag = $this->bo->get_ctag($user,$path == '/calendar/' ? 'owner' : 'default'); // default = not rejected
1424 1583
 
1425
-		if ($this->debug > 1) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. "($path)[$user] = $ctag");
1584
+		if ($this->debug > 1)
1585
+		{
1586
+			error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. "($path)[$user] = $ctag");
1587
+		}
1426 1588
 
1427 1589
 		return $ctag;
1428 1590
 	}
@@ -1553,7 +1715,10 @@  discard block
 block discarded – undo
1553 1715
 		$handler = new calendar_ical();
1554 1716
 		$handler->setSupportedFields('GroupDAV',$this->agent);
1555 1717
 		$handler->supportedFields['attachments'] = true;	// enabling attachments
1556
-		if ($this->debug > 1) error_log("ical Handler called: " . $this->agent);
1718
+		if ($this->debug > 1)
1719
+		{
1720
+			error_log("ical Handler called: " . $this->agent);
1721
+		}
1557 1722
 		return $handler;
1558 1723
 	}
1559 1724
 
@@ -1624,7 +1789,11 @@  discard block
 block discarded – undo
1624 1789
 			{
1625 1790
 				$calendars[$entry['grantor']] = $entry['name'];
1626 1791
 			}
1627
-			if ($user > 0) unset($calendars[$user]);	// skip current user
1792
+			if ($user > 0)
1793
+			{
1794
+				unset($calendars[$user]);
1795
+			}
1796
+			// skip current user
1628 1797
 		}
1629 1798
 
1630 1799
 		$settings = array();
Please login to merge, or discard this patch.
calendar/inc/class.calendar_rrule.inc.php 1 patch
Braces   +58 added lines, -14 removed lines patch added patch discarded remove patch
@@ -338,7 +338,10 @@  discard block
 block discarded – undo
338 338
 				$duration = 366*24*3600;
339 339
 				break;
340 340
 		}
341
-		if ($interval > 1) $duration *= $interval;
341
+		if ($interval > 1)
342
+		{
343
+			$duration *= $interval;
344
+		}
342 345
 
343 346
 		return $duration;
344 347
 	}
@@ -481,7 +484,10 @@  discard block
 block discarded – undo
481 484
 		{
482 485
 			return clone $this->time;
483 486
 		}
484
-		if (isset($this->current)) $backup = $this->current;
487
+		if (isset($this->current))
488
+		{
489
+			$backup = $this->current;
490
+		}
485 491
 		$this->rewind();
486 492
 
487 493
 		while(--$count > 0)
@@ -489,7 +495,10 @@  discard block
 block discarded – undo
489 495
 			$this->next_no_exception();
490 496
 		}
491 497
 		$ret = clone $this->current;
492
-		if ($backup) $this->current = $backup;
498
+		if ($backup)
499
+		{
500
+			$this->current = $backup;
501
+		}
493 502
 		return $ret;
494 503
 	}
495 504
 
@@ -631,7 +640,11 @@  discard block
 block discarded – undo
631 640
 		$repeat_days = array();
632 641
 		$rrule = array();
633 642
 
634
-		if ($this->type == self::NONE) return false;	// no recuring event
643
+		if ($this->type == self::NONE)
644
+		{
645
+			return false;
646
+		}
647
+		// no recuring event
635 648
 
636 649
 		if ($version == '1.0')
637 650
 		{
@@ -725,8 +738,14 @@  discard block
 block discarded – undo
725 738
 	 */
726 739
 	public static function event2rrule(array $event,$usertime=true,$to_tz=null)
727 740
 	{
728
-		if (!is_array($event)  || !isset($event['tzid'])) return false;
729
-		if (!$to_tz) $to_tz = $event['tzid'];
741
+		if (!is_array($event)  || !isset($event['tzid']))
742
+		{
743
+			return false;
744
+		}
745
+		if (!$to_tz)
746
+		{
747
+			$to_tz = $event['tzid'];
748
+		}
730 749
 		$timestamp_tz = $usertime ? Api\DateTime::$user_timezone : Api\DateTime::$server_timezone;
731 750
 		$time = is_a($event['start'],'DateTime') ? $event['start'] : new Api\DateTime($event['start'],$timestamp_tz);
732 751
 
@@ -786,7 +805,10 @@  discard block
 block discarded – undo
786 805
 			$event['recur_type'] == self::NONE ||
787 806
 			empty($event['recur_data']) || $event['recur_data'] == ALLDAYS ||
788 807
 			empty($event['tzid']) || empty($to_tz) ||
789
-			$event['tzid'] == $to_tz) return;
808
+			$event['tzid'] == $to_tz)
809
+		{
810
+			return;
811
+		}
790 812
 
791 813
 		if (!isset(self::$tz_cache[$event['tzid']]))
792 814
 		{
@@ -815,11 +837,19 @@  discard block
 block discarded – undo
815 837
 					if ($delta == 1 || $delta == -6)
816 838
 					{
817 839
 						$mask = $mask << 1;
818
-						if ($mask & 128) $mask = $mask - 127; // overflow
840
+						if ($mask & 128)
841
+						{
842
+							$mask = $mask - 127;
843
+						}
844
+						// overflow
819 845
 					}
820 846
 					else
821 847
 					{
822
-						if ($mask & 1) $mask = $mask + 128; // underflow
848
+						if ($mask & 1)
849
+						{
850
+							$mask = $mask + 128;
851
+						}
852
+						// underflow
823 853
 						$mask = $mask >> 1;
824 854
 					}
825 855
 					$event['recur_data'] = $mask;
@@ -828,11 +858,16 @@  discard block
 block discarded – undo
828 858
 	}
829 859
 }
830 860
 
831
-if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)	// some tests
861
+if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)
862
+{
863
+	// some tests
832 864
 {
833 865
 	ini_set('display_errors',1);
866
+}
834 867
 	error_reporting(E_ALL & ~E_NOTICE);
835
-	function lang($str) { return $str; }
868
+	function lang($str)
869
+	{
870
+return $str; }
836 871
 	$GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $_REQUEST['user-tz'] ? $_REQUEST['user-tz'] : 'Europe/Berlin';
837 872
 	require_once('../../api/src/autoload.php');
838 873
 
@@ -863,9 +898,18 @@  discard block
 block discarded – undo
863 898
 
864 899
 	$tz = new DateTimeZone($_REQUEST['tz']);
865 900
 	$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); }
901
+	if ($_REQUEST['enddate'])
902
+	{
903
+		$enddate = new Api\DateTime($_REQUEST['enddate'],$tz);
904
+	}
905
+	$weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask)
906
+	{
907
+$weekdays |= $mask; }
908
+	if ($_REQUEST['exceptions'])
909
+	{
910
+		foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception);
911
+	}
912
+	}
869 913
 
870 914
 	$rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions);
871 915
 	echo "<h3>".$time->format('l').', '.$time.' ('.$tz->getName().') '.$rrule."</h3>\n";
Please login to merge, or discard this patch.
calendar/inc/class.calendar_datasource.inc.php 1 patch
Braces   +13 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,11 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	function __construct()
26 26
 	{
27
-		if (false) parent::__construct();	// can not be called, but gives IDE warning
27
+		if (false)
28
+		{
29
+			parent::__construct();
30
+		}
31
+		// can not be called, but gives IDE warning
28 32
 
29 33
 		$this->datasource('calendar');
30 34
 
@@ -96,16 +100,22 @@  discard block
 block discarded – undo
96 100
 				$c->read_repository();
97 101
 				$this->pm_config = $c->config_data;
98 102
 				unset($c);
99
-				if (!$this->pm_config['hours_per_workday']) $this->pm_config['hours_per_workday'] = 8;
103
+				if (!$this->pm_config['hours_per_workday'])
104
+				{
105
+					$this->pm_config['hours_per_workday'] = 8;
106
+				}
100 107
 			}
101 108
 			$ds['pe_planned_time'] -= $nights * 60 * (24 - $this->pm_config['hours_per_workday']);
102 109
 		}
103 110
 		foreach($data['participants'] as $uid => $status)
104 111
 		{
105
-			if ($status != 'R' && is_numeric($uid))	// only users for now
112
+			if ($status != 'R' && is_numeric($uid))
113
+			{
114
+				// only users for now
106 115
 			{
107 116
 				$ds['pe_resources'][] = $uid;
108 117
 			}
118
+			}
109 119
 		}
110 120
 		// if we have multiple participants we have to multiply the time by the number of participants to get the total time
111 121
 		$ds['pe_planned_time'] *= count($ds['pe_resources']);
Please login to merge, or discard this patch.