Completed
Push — master ( 9d054b...106a1b )
by Klaus
23:45 queued 04:19
created
filemanager/inc/class.filemanager_hooks.inc.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		);
106 106
 		if ($location == 'admin')
107 107
 		{
108
-        	display_section(self::$appname,$file);
108
+			display_section(self::$appname,$file);
109 109
 		}
110 110
 		else
111 111
 		{
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 			'yes' => lang('Yes')
129 129
 		);
130 130
 
131
-        $settings = array(
131
+		$settings = array(
132 132
 			'startfolder'	=> array(
133 133
 				'type'		=> 'input',
134 134
 				'name'		=> 'startfolder',
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,7 +85,10 @@  discard block
 block discarded – undo
85 85
 			$file['Shared files'] = Egw::link('/index.php','menuaction=filemanager.filemanager_shares.index&ajax=true');
86 86
 			display_sidebox(self::$appname,$title,$file);
87 87
 		}
88
-		if ($GLOBALS['egw_info']['user']['apps']['admin']) self::admin(self::$appname);
88
+		if ($GLOBALS['egw_info']['user']['apps']['admin'])
89
+		{
90
+			self::admin(self::$appname);
91
+		}
89 92
 	}
90 93
 
91 94
 	/**
@@ -95,7 +98,10 @@  discard block
 block discarded – undo
95 98
 	 */
96 99
 	static function admin($location = 'admin')
97 100
 	{
98
-		if (is_array($location)) $location = $location['location'];
101
+		if (is_array($location))
102
+		{
103
+			$location = $location['location'];
104
+		}
99 105
 
100 106
 		$file = Array(
101 107
 			//'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname='.self::$appname.'&ajax=true'),
Please login to merge, or discard this patch.
filemanager/inc/class.filemanager_merge.inc.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
 		}
124 124
 		// Custom fields
125 125
 		if($content && strpos($content, '#') !== 0)
126
-                {
126
+				{
127 127
 			// Expand link-to custom fields
128 128
 			 $this->cf_link_to_expand($file, $content, $info);
129 129
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		}
124 124
 		// Custom fields
125 125
 		if($content && strpos($content, '#') !== 0)
126
-                {
126
+		{
127 127
 			// Expand link-to custom fields
128 128
 			 $this->cf_link_to_expand($file, $content, $info);
129 129
 
@@ -151,12 +151,14 @@  discard block
 block discarded – undo
151 151
 			// Try this first - a normal path /apps/appname/id/file
152 152
 			list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/')+5));
153 153
 			// Symlink?
154
-			if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) {
154
+			if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps']))
155
+			{
155 156
 				// Try resolving just app + ID - /apps/App Name/Record Title/file
156 157
 				$resolved = Vfs::resolve_url_symlinks(implode('/',array_slice(explode('/',$file['dir']),0,4)));
157 158
 				list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5));
158 159
 
159
-				if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) {
160
+				if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps']))
161
+				{
160 162
 					// Get rid of any virtual folders (eg: All$) and symlinks
161 163
 					$resolved = Vfs::resolve_url_symlinks($file['path']);
162 164
 					list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5));
@@ -190,7 +192,10 @@  discard block
 block discarded – undo
190 192
 		if(is_array($link))
191 193
 		{
192 194
 			// Directories have their internal protocol in path here
193
-			if($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path'];
195
+			if($link['path'] && strpos($link['path'], '://') !== false)
196
+			{
197
+				$link['path'] = $file['path'];
198
+			}
194 199
 			$link = Api\Session::link('/index.php', $link);
195 200
 		}
196 201
 		else
@@ -211,7 +216,10 @@  discard block
 block discarded – undo
211 216
 		// Add markers
212 217
 		foreach($file as $key => &$value)
213 218
 		{
214
-			if(!$value) $value = '';
219
+			if(!$value)
220
+			{
221
+				$value = '';
222
+			}
215 223
 			$info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value;
216 224
 		}
217 225
 		if($app_placeholders)
@@ -252,9 +260,15 @@  discard block
 block discarded – undo
252 260
 		);
253 261
 		foreach($fields as $name => $label)
254 262
 		{
255
-			if (!($n&1)) echo '<tr>';
263
+			if (!($n&1))
264
+			{
265
+				echo '<tr>';
266
+			}
256 267
 			echo '<td>{{'.$name.'}}</td><td>'.lang($label).'</td>';
257
-			if ($n&1) echo "</tr>\n";
268
+			if ($n&1)
269
+			{
270
+				echo "</tr>\n";
271
+			}
258 272
 			$n++;
259 273
 		}
260 274
 
Please login to merge, or discard this patch.
calendar/setup/tables_update.inc.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1909,7 +1909,7 @@
 block discarded – undo
1909 1909
 			WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__);
1910 1910
 	}
1911 1911
 
1912
-    $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1
1912
+	$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1
1913 1913
 			WHERE recur_interval=0',__LINE__,__FILE__);
1914 1914
 
1915 1915
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007';
Please login to merge, or discard this 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/inc/class.calendar_ical.inc.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -483,15 +483,15 @@  discard block
 block discarded – undo
483 483
 									{
484 484
 										$user = $this->resource_info($this->user);
485 485
 										$attributes['ATTENDEE'][] = 'mailto:' . $user['email'];
486
-			    						$parameters['ATTENDEE'][] = array(
487
-			    							'CN'		=>	$user['name'],
488
-			    							'ROLE'		=> 'REQ-PARTICIPANT',
486
+										$parameters['ATTENDEE'][] = array(
487
+											'CN'		=>	$user['name'],
488
+											'ROLE'		=> 'REQ-PARTICIPANT',
489 489
 											'PARTSTAT'	=> 'NEEDS-ACTION',
490 490
 											'CUTYPE'	=> 'INDIVIDUAL',
491 491
 											'RSVP'		=> 'TRUE',
492 492
 											'X-EGROUPWARE-UID'	=> (string)$this->user,
493
-			    						);
494
-			    						$event['participants'][$this->user] = true;
493
+										);
494
+										$event['participants'][$this->user] = true;
495 495
 									}
496 496
 									break;
497 497
 								case 'r':
@@ -543,24 +543,24 @@  discard block
 block discarded – undo
543 543
 						}
544 544
 						break;
545 545
 
546
-    				case 'ORGANIZER':
547
-	    				if (!$organizerURL)
548
-	    				{
549
-	    					$organizerCN = '"' . trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname')
550
-			    				. ' ' . $GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname')) . '"';
551
-			    			$organizerEMail = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_email');
552
-			    			if ($version == '1.0')
553
-			    			{
554
-		    					$organizerURL = trim($organizerCN . (empty($organizerURL) ? '' : ' <' . $organizerURL .'>'));
555
-			    			}
556
-			    			else
557
-			    			{
558
-		    					$organizerURL = empty($organizerEMail) ? '' : 'mailto:' . $organizerEMail;
559
-			    			}
560
-			    			$organizerUID = $event['owner'];
561
-		    				if (!isset($event['participants'][$event['owner']]))
562
-		    				{
563
-			    				$options = array(
546
+					case 'ORGANIZER':
547
+						if (!$organizerURL)
548
+						{
549
+							$organizerCN = '"' . trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname')
550
+								. ' ' . $GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname')) . '"';
551
+							$organizerEMail = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_email');
552
+							if ($version == '1.0')
553
+							{
554
+								$organizerURL = trim($organizerCN . (empty($organizerURL) ? '' : ' <' . $organizerURL .'>'));
555
+							}
556
+							else
557
+							{
558
+								$organizerURL = empty($organizerEMail) ? '' : 'mailto:' . $organizerEMail;
559
+							}
560
+							$organizerUID = $event['owner'];
561
+							if (!isset($event['participants'][$event['owner']]))
562
+							{
563
+								$options = array(
564 564
 									'ROLE'     => 'CHAIR',
565 565
 									'PARTSTAT' => 'DELEGATED',
566 566
 									'CUTYPE'   => 'INDIVIDUAL',
@@ -570,20 +570,20 @@  discard block
 block discarded – undo
570 570
 								if (!empty($organizerEMail)) $options['EMAIL'] = $organizerEMail;
571 571
 								if (!empty($event['owner'])) $options['X-EGROUPWARE-UID'] = $event['owner'];
572 572
 								$attributes['ATTENDEE'][] = $organizerURL;
573
-			    				$parameters['ATTENDEE'][] = $options;
574
-		    				}
575
-	    				}
576
-    					// do NOT use ORGANIZER for events without further participants or a different organizer
577
-	    				if (count($event['participants']) > 1 || !isset($event['participants'][$event['owner']]))
578
-	    				{
579
-		    				$attributes['ORGANIZER'] = $organizerURL;
580
-		    				$parameters['ORGANIZER']['CN'] = $organizerCN;
581
-		    				if (!empty($organizerUID))
582
-		    				{
583
-			    				$parameters['ORGANIZER']['X-EGROUPWARE-UID'] = $organizerUID;
584
-		    				}
585
-	    				}
586
-	    				break;
573
+								$parameters['ATTENDEE'][] = $options;
574
+							}
575
+						}
576
+						// do NOT use ORGANIZER for events without further participants or a different organizer
577
+						if (count($event['participants']) > 1 || !isset($event['participants'][$event['owner']]))
578
+						{
579
+							$attributes['ORGANIZER'] = $organizerURL;
580
+							$parameters['ORGANIZER']['CN'] = $organizerCN;
581
+							if (!empty($organizerUID))
582
+							{
583
+								$parameters['ORGANIZER']['X-EGROUPWARE-UID'] = $organizerUID;
584
+							}
585
+						}
586
+						break;
587 587
 
588 588
 					case 'DTSTART':
589 589
 						if (empty($event['whole_day']))
@@ -992,12 +992,12 @@  discard block
 block discarded – undo
992 992
 				foreach (is_array($value) && $parameters[$key]['VALUE']!='DATE' ? $value : array($value) as $valueID => $valueData)
993 993
 				{
994 994
 					$valueData = Api\Translation::convert($valueData,Api\Translation::charset(),$charset);
995
-                    $paramData = (array) Api\Translation::convert(is_array($value) ?
996
-                    		$parameters[$key][$valueID] : $parameters[$key],
997
-                            Api\Translation::charset(),$charset);
998
-                    $valuesData = (array) Api\Translation::convert($values[$key],
999
-                    		Api\Translation::charset(),$charset);
1000
-                    $content = $valueData . implode(';', $valuesData);
995
+					$paramData = (array) Api\Translation::convert(is_array($value) ?
996
+							$parameters[$key][$valueID] : $parameters[$key],
997
+							Api\Translation::charset(),$charset);
998
+					$valuesData = (array) Api\Translation::convert($values[$key],
999
+							Api\Translation::charset(),$charset);
1000
+					$content = $valueData . implode(';', $valuesData);
1001 1001
 
1002 1002
 					if ($version == '1.0' && (preg_match('/[^\x20-\x7F]/', $content) ||
1003 1003
 						($paramData['CN'] && preg_match('/[^\x20-\x7F]/', $paramData['CN']))))
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
 	 * @param string|resource $_vcalData
2234 2234
 	 * @param string $principalURL ='' Used for CalDAV imports
2235 2235
 	 * @param string $charset  The encoding charset for $text. Defaults to
2236
-     *                         utf-8 for new format, iso-8859-1 for old format.
2236
+	 *                         utf-8 for new format, iso-8859-1 for old format.
2237 2237
 	 * @return Iterator|array|boolean Iterator if resource given or array of events on success, false on failure
2238 2238
 	 */
2239 2239
 	function icaltoegw($_vcalData, $principalURL='', $charset=null)
@@ -2784,10 +2784,10 @@  discard block
 block discarded – undo
2784 2784
 					// fall throught
2785 2785
 				case 'ATTENDEE':
2786 2786
 					if (isset($attributes['params']['PARTSTAT']))
2787
-				    {
2788
-				    	$attributes['params']['STATUS'] = $attributes['params']['PARTSTAT'];
2789
-				    }
2790
-				    if (isset($attributes['params']['STATUS']))
2787
+					{
2788
+						$attributes['params']['STATUS'] = $attributes['params']['PARTSTAT'];
2789
+					}
2790
+					if (isset($attributes['params']['STATUS']))
2791 2791
 					{
2792 2792
 						$status = $this->status_ical2egw[strtoupper($attributes['params']['STATUS'])];
2793 2793
 						if (empty($status)) $status = 'X';
@@ -3178,7 +3178,7 @@  discard block
 block discarded – undo
3178 3178
 				array2string($event)."\n",3,$this->logfile);
3179 3179
 		}
3180 3180
 		//Horde::logMessage("vevent2egw:\n" . print_r($event, true),
3181
-        //    	__FILE__, __LINE__, PEAR_LOG_DEBUG);
3181
+		//    	__FILE__, __LINE__, PEAR_LOG_DEBUG);
3182 3182
 		return $event;
3183 3183
 	}
3184 3184
 
Please login to merge, or discard this 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_import_csv.inc.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
 	protected static $conditions = array('exists');
33 33
 
34 34
 	/**
35
-	* For figuring out if an entry has changed
36
-	*/
35
+	 * For figuring out if an entry has changed
36
+	 */
37 37
 	protected $tracking;
38 38
 
39 39
 	/**
Please login to merge, or discard this patch.
Braces   +75 added lines, -32 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@  discard block
 block discarded – undo
17 17
 /**
18 18
  * class import_csv for calendar
19 19
  */
20
-class calendar_import_csv extends importexport_basic_import_csv  {
20
+class calendar_import_csv extends importexport_basic_import_csv
21
+{
21 22
 
22 23
 	/**
23 24
 	 * actions wich could be done to data entries
@@ -83,8 +84,10 @@  discard block
 block discarded – undo
83 84
 		$options['owner'] = $options['owner'] ? $options['owner'] : $this->user;
84 85
 
85 86
 		// Set owner, unless it's supposed to come from CSV file
86
-		if($options['owner_from_csv']) {
87
-			if(!is_numeric($record['owner'])) {
87
+		if($options['owner_from_csv'])
88
+		{
89
+			if(!is_numeric($record['owner']))
90
+			{
88 91
 				$this->errors[$import_csv->get_current_position()] = lang(
89 92
 					'Invalid owner ID: %1.  Might be a bad field translation.  Used %2 instead.',
90 93
 					$record->owner,
@@ -106,14 +109,16 @@  discard block
 block discarded – undo
106 109
 		}
107 110
 
108 111
 		// Parse particpants
109
-		if ($record->participants && !is_array($record->participants)) {
112
+		if ($record->participants && !is_array($record->participants))
113
+		{
110 114
 			// Importing participants in human friendly format:
111 115
 			// Name (quantity)? (status) Role[, Name (quantity)? (status) Role]+
112 116
 			preg_match_all('/(([^(]+?)(?: \(([\d]+)\))? \(([^,)]+)\)(?: ([^ ,]+))?)(?:, )?/',$record->participants,$participants);
113 117
 			$p_participants = array();
114 118
 			$missing = array();
115 119
 			list($lines, $p, $names, $quantity, $status, $role) = $participants;
116
-			foreach($names as $key => $name) {
120
+			foreach($names as $key => $name)
121
+			{
117 122
 				//error_log("Name: $name Quantity: {$quantity[$key]} Status: {$status[$key]} Role: {$role[$key]}");
118 123
 
119 124
 				// Search for direct account name, then user in accounts first
@@ -121,9 +126,13 @@  discard block
 block discarded – undo
121 126
 				$id = importexport_helper_functions::account_name2id($name);
122 127
 
123 128
 				// If not found, or not an exact match to a user (account_name2id is pretty generous)
124
-				if(!$id || $names[$key] !== $this->bo->participant_name($id)) {
129
+				if(!$id || $names[$key] !== $this->bo->participant_name($id))
130
+				{
125 131
 					$contacts = ExecMethod2('addressbook.addressbook_bo.search', $search,array('contact_id','account_id'),'org_name,n_family,n_given,cat_id,contact_email','','%',false,'OR',array(0,1));
126
-					if($contacts) $id = $contacts[0]['account_id'] ? $contacts[0]['account_id'] : 'c'.$contacts[0]['contact_id'];
132
+					if($contacts)
133
+					{
134
+						$id = $contacts[0]['account_id'] ? $contacts[0]['account_id'] : 'c'.$contacts[0]['contact_id'];
135
+					}
127 136
 				}
128 137
 				if(!$id)
129 138
 				{
@@ -131,7 +140,10 @@  discard block
 block discarded – undo
131 140
 					foreach($this->bo->resources as $resource)
132 141
 					{
133 142
 						// Can't search for email
134
-						if($resource['app'] == 'email') continue;
143
+						if($resource['app'] == 'email')
144
+						{
145
+							continue;
146
+						}
135 147
 						// Special resource search, since it does special stuff in link_query
136 148
 						if($resource['app'] == 'resources')
137 149
 						{
@@ -140,7 +152,8 @@  discard block
 block discarded – undo
140 152
 								$this->resource_so = new resources_so();
141 153
 							}
142 154
 							$result = $this->resource_so->search($search,'res_id');
143
-							if(count($result) >= 1) {
155
+							if(count($result) >= 1)
156
+							{
144 157
 								$id = $resource['type'].$result[0]['res_id'];
145 158
 								break;
146 159
 							}
@@ -159,7 +172,8 @@  discard block
 block discarded – undo
159 172
 						}
160 173
 					}
161 174
 				}
162
-				if($id) {
175
+				if($id)
176
+				{
163 177
 					$p_participants[$id] = calendar_so::combine_status(
164 178
 						$this->status_map[lang($status[$key])] ? $this->status_map[lang($status[$key])] : $status[$key][0],
165 179
 						$quantity[$key] ? $quantity[$key] : 1,
@@ -188,27 +202,38 @@  discard block
 block discarded – undo
188 202
 		}
189 203
 		$record->tzid = calendar_timezones::id2tz($record->tz_id);
190 204
 
191
-		if ( $options['conditions'] ) {
192
-			foreach ( $options['conditions'] as $condition ) {
205
+		if ( $options['conditions'] )
206
+		{
207
+			foreach ( $options['conditions'] as $condition )
208
+			{
193 209
 				$records = array();
194
-				switch ( $condition['type'] ) {
210
+				switch ( $condition['type'] )
211
+				{
195 212
 					// exists
196 213
 					case 'exists' :
197 214
 						// Check for that record
198 215
 						$result = $this->exists($record, $condition, $records);
199 216
 
200
-						if ( is_array( $records ) && count( $records ) >= 1) {
217
+						if ( is_array( $records ) && count( $records ) >= 1)
218
+						{
201 219
 							// apply action to all records matching this exists condition
202 220
 							$action = $condition['true'];
203
-							foreach ( (array)$records as $event ) {
221
+							foreach ( (array)$records as $event )
222
+							{
204 223
 								$record->id = $event['id'];
205
-								if ( $this->definition->plugin_options['update_cats'] == 'add' ) {
206
-									if ( !is_array( $record->category ) ) $record->category = explode( ',', $record->category );
224
+								if ( $this->definition->plugin_options['update_cats'] == 'add' )
225
+								{
226
+									if ( !is_array( $record->category ) )
227
+									{
228
+										$record->category = explode( ',', $record->category );
229
+									}
207 230
 									$record->category = implode( ',', array_unique( array_merge( $record->category, $event['category'] ) ) );
208 231
 								}
209 232
 								$success = $this->action(  $action['action'], $record, $import_csv->get_current_position() );
210 233
 							}
211
-						} else {
234
+						}
235
+						else
236
+						{
212 237
 							$action = $condition['false'];
213 238
 							$success = ($this->action(  $action['action'], $record, $import_csv->get_current_position() ));
214 239
 						}
@@ -219,9 +244,14 @@  discard block
 block discarded – undo
219 244
 						die('condition / action not supported!!!');
220 245
 						break;
221 246
 				}
222
-				if ($action['last']) break;
247
+				if ($action['last'])
248
+				{
249
+					break;
250
+				}
223 251
 			}
224
-		} else {
252
+		}
253
+		else
254
+		{
225 255
 			// unconditional insert
226 256
 			$success = $this->action( 'insert', $record, $import_csv->get_current_position() );
227 257
 		}
@@ -240,12 +270,14 @@  discard block
 block discarded – undo
240 270
 	 */
241 271
 	protected function exists(importexport_iface_egw_record &$record, Array &$condition, &$records = array())
242 272
 	{
243
-		if($record->__get($condition['string']) && $condition['string'] == 'id') {
273
+		if($record->__get($condition['string']) && $condition['string'] == 'id')
274
+		{
244 275
 			$event = $this->bo->read($record->__get($condition['string']));
245 276
 			$records = array($event);
246 277
 		}
247 278
 
248
-		if ( is_array( $records ) && count( $records ) >= 1) {
279
+		if ( is_array( $records ) && count( $records ) >= 1)
280
+		{
249 281
 			return true;
250 282
 		}
251 283
 		return false;
@@ -261,7 +293,8 @@  discard block
 block discarded – undo
261 293
 	protected function action ( $_action, importexport_iface_egw_record &$record, $record_num = 0 )
262 294
 	{
263 295
 		$_data = $record->get_record_array();
264
-		switch ($_action) {
296
+		switch ($_action)
297
+		{
265 298
 			case 'none' :
266 299
 				return true;
267 300
 			case 'update' :
@@ -269,7 +302,8 @@  discard block
 block discarded – undo
269 302
 				$old = $this->bo->read($_data['id']);
270 303
 
271 304
 				// Don't change a user account into a record
272
-				if(!$this->definition->plugin_options['change_owner']) {
305
+				if(!$this->definition->plugin_options['change_owner'])
306
+				{
273 307
 					// Don't change owner of an existing record
274 308
 					unset($_data['owner']);
275 309
 				}
@@ -277,23 +311,27 @@  discard block
 block discarded – undo
277 311
 				// Merge to deal with fields not in import record
278 312
 				$_data = array_merge($old, $_data);
279 313
 				$changed = $this->tracking->changed_fields($_data, $old);
280
-				if(count($changed) == 0) {
314
+				if(count($changed) == 0)
315
+				{
281 316
 					return true;
282 317
 				}
283 318
 				// Fall through
284 319
 			case 'insert' :
285
-				if($_action == 'insert') {
320
+				if($_action == 'insert')
321
+				{
286 322
 					// Backend doesn't like inserting with ID specified, can overwrite existing
287 323
 					unset($_data['id']);
288 324
 				}
289 325
 				// Make sure participants are set
290
-				if(!$_data['participants']) {
326
+				if(!$_data['participants'])
327
+				{
291 328
 					$user = $_data['owner'] ? $_data['owner'] : $this->user;
292 329
 					$_data['participants'] = array(
293 330
 						$user => 'U'
294 331
 					);
295 332
 				}
296
-				if ( $this->dry_run ) {
333
+				if ( $this->dry_run )
334
+				{
297 335
 					//print_r($_data);
298 336
 					// User is interested in conflict checks, do so for dry run
299 337
 					// Otherwise, conflicts are just ignored and imported anyway
@@ -309,7 +347,9 @@  discard block
 block discarded – undo
309 347
 					}
310 348
 					$this->results[$_action]++;
311 349
 					return true;
312
-				} else {
350
+				}
351
+				else
352
+				{
313 353
 					$messages = null;
314 354
 					$result = $this->bo->update( $_data, 
315 355
 						!$this->definition->plugin_options['skip_conflicts'],
@@ -360,7 +400,8 @@  discard block
 block discarded – undo
360 400
 	 *
361 401
 	 * @return string name
362 402
 	 */
363
-	public static function get_name() {
403
+	public static function get_name()
404
+	{
364 405
 		return lang('Calendar CSV import');
365 406
 	}
366 407
 
@@ -369,7 +410,8 @@  discard block
 block discarded – undo
369 410
 	 *
370 411
 	 * @return string descriprion
371 412
 	 */
372
-	public static function get_description() {
413
+	public static function get_description()
414
+	{
373 415
 		return lang("Imports events into your Calendar from a CSV File. CSV means 'Comma Seperated Values'. However in the options Tab you can also choose other seperators.");
374 416
 	}
375 417
 
@@ -378,7 +420,8 @@  discard block
 block discarded – undo
378 420
 	 *
379 421
 	 * @return string suffix (comma seperated)
380 422
 	 */
381
-	public static function get_filesuffix() {
423
+	public static function get_filesuffix()
424
+	{
382 425
 		return 'csv';
383 426
 	}
384 427
 
Please login to merge, or discard this patch.
calendar/inc/class.calendar_zpush.inc.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@
 block discarded – undo
177 177
 	 * @param int $cutoffdate =null
178 178
 	 * @param array $not_uids =null uids NOT to return for meeting requests
179 179
 	 * @return array
180
-  	 */
180
+	 */
181 181
 	function GetMessageList($id, $cutoffdate=NULL, array $not_uids=null)
182 182
 	{
183 183
 		if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
Please login to merge, or discard this patch.
Braces   +235 added lines, -57 removed lines patch added patch discarded remove patch
@@ -20,8 +20,12 @@  discard block
 block discarded – undo
20 20
  */
21 21
 if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)
22 22
 {
23
-	interface activesync_plugin_write {}
24
-	interface activesync_plugin_meeting_requests {}
23
+	interface activesync_plugin_write
24
+	{
25
+}
26
+	interface activesync_plugin_meeting_requests
27
+	{
28
+}
25 29
 }
26 30
 
27 31
 /**
@@ -81,7 +85,10 @@  discard block
 block discarded – undo
81 85
 	 */
82 86
 	public function GetFolderList()
83 87
 	{
84
-		if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
88
+		if (!isset($this->calendar))
89
+		{
90
+			$this->calendar = new calendar_boupdate();
91
+		}
85 92
 
86 93
 		$cals_pref = $GLOBALS['egw_info']['user']['preferences']['activesync']['calendar-cals'];
87 94
 		$cals = $cals_pref ? explode(',',$cals_pref) : array('P');	// implicit default of 'P'
@@ -180,13 +187,20 @@  discard block
 block discarded – undo
180 187
   	 */
181 188
 	function GetMessageList($id, $cutoffdate=NULL, array $not_uids=null)
182 189
 	{
183
-		if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
190
+		if (!isset($this->calendar))
191
+		{
192
+			$this->calendar = new calendar_boupdate();
193
+		}
184 194
 
185 195
 		ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$id',$cutoffdate)");
186 196
 		$type = $user = null;
187 197
 		$this->backend->splitID($id,$type,$user);
188 198
 
189
-		if (!$cutoffdate) $cutoffdate = $this->bo->now - 100*24*3600;	// default three month back -30 breaks all sync recurrences
199
+		if (!$cutoffdate)
200
+		{
201
+			$cutoffdate = $this->bo->now - 100*24*3600;
202
+		}
203
+		// default three month back -30 breaks all sync recurrences
190 204
 
191 205
 		$filter = array(
192 206
 			'users' => $user,
@@ -212,7 +226,10 @@  discard block
 block discarded – undo
212 226
 		{
213 227
 			foreach ($events as $event)
214 228
 			{
215
-				if ($not_uids && in_array($event['uid'], $not_uids)) continue;
229
+				if ($not_uids && in_array($event['uid'], $not_uids))
230
+				{
231
+					continue;
232
+				}
216 233
 				$messagelist[] = $this->StatMessage($id, $event);
217 234
 
218 235
 				// add virtual exceptions for recuring events too
@@ -227,7 +244,10 @@  discard block
 block discarded – undo
227 244
 					}
228 245
 				}*/
229 246
 			}
230
-			if (count($events) < $num_rows) break;
247
+			if (count($events) < $num_rows)
248
+			{
249
+				break;
250
+			}
231 251
 		}
232 252
 		//error_log(__METHOD__."($id, $cutoffdate, ".array2string($not_uids).") type=$type, user=$user returning ".count($messagelist)." messages ".function_backtrace());
233 253
 		return $messagelist;
@@ -289,7 +309,10 @@  discard block
 block discarded – undo
289 309
 	{
290 310
 		unset($truncsize, $optionbodypreference, $mimesupport);	// not used, but required by function signature
291 311
 
292
-		if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
312
+		if (!isset($this->calendar))
313
+		{
314
+			$this->calendar = new calendar_boupdate();
315
+		}
293 316
 
294 317
 		if (!($event = $this->calendar->read(abs($id), 0, false, 'server')))
295 318
 		{
@@ -367,7 +390,10 @@  discard block
 block discarded – undo
367 390
 			'created' => 'dtstamp',
368 391
 		) as $key => $attr)
369 392
 		{
370
-			if (!empty($event[$key])) $message->$attr = $event[$key];
393
+			if (!empty($event[$key]))
394
+			{
395
+				$message->$attr = $event[$key];
396
+			}
371 397
 		}
372 398
 		if (($message->alldayevent = (int)calendar_bo::isWholeDay($event)))
373 399
 		{
@@ -379,7 +405,10 @@  discard block
 block discarded – undo
379 405
 			'location' => 'location',
380 406
 		) as $key => $attr)
381 407
 		{
382
-			if (!empty($event[$key])) $message->$attr = $event[$key];
408
+			if (!empty($event[$key]))
409
+			{
410
+				$message->$attr = $event[$key];
411
+			}
383 412
 		}
384 413
 		$message->organizer = $event['organizer'];
385 414
 
@@ -414,7 +443,10 @@  discard block
 block discarded – undo
414 443
 	 */
415 444
 	function MeetingResponse($folderid, $requestid, $response)
416 445
 	{
417
-		if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
446
+		if (!isset($this->calendar))
447
+		{
448
+			$this->calendar = new calendar_boupdate();
449
+		}
418 450
 
419 451
 		static $as2status = array(	// different from self::$status2as!
420 452
 			1 => 'A',
@@ -424,9 +456,12 @@  discard block
 block discarded – undo
424 456
 		$status_in = isset($as2status[$response]) ? $as2status[$response] : 'U';
425 457
 		$uid = $GLOBALS['egw_info']['user']['account_id'];
426 458
 
427
-		if (!is_numeric($requestid))	// iCal from fmail
459
+		if (!is_numeric($requestid))
460
+		{
461
+			// iCal from fmail
428 462
 		{
429 463
 			$ical = new calendar_ical();
464
+		}
430 465
 			if (!($events = $ical->icaltoegw($requestid, '', 'utf-8')) || count($events) != 1)
431 466
 			{
432 467
 				ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."($folderid, '$requestid') error parsing iCal!");
@@ -536,7 +571,10 @@  discard block
 block discarded – undo
536 571
 	{
537 572
 		unset($contentParameters);	// unused, but required by function signature
538 573
 
539
-		if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
574
+		if (!isset($this->calendar))
575
+		{
576
+			$this->calendar = new calendar_boupdate();
577
+		}
540 578
 
541 579
 		$old_event = array();
542 580
 		$type = $account = null;
@@ -551,10 +589,13 @@  discard block
 block discarded – undo
551 589
 			ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid',$id,...) Folder wrong or event does not existing");
552 590
 			return false;
553 591
 		}
554
-		if ($recur_date)	// virtual exception
592
+		if ($recur_date)
593
+		{
594
+			// virtual exception
555 595
 		{
556 596
 			// @todo check if virtual exception needs to be saved as real exception, or only stati need to be changed
557 597
 			ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid',$id:$recur_date,".array2string($message).") handling of virtual exception not yet implemented!");
598
+		}
558 599
 			//error_log(__METHOD__."('$folderid',$id:$recur_date,".array2string($message).") handling of virtual exception not yet implemented!");
559 600
 		}
560 601
 		if (!$this->calendar->check_perms($id ? Acl::EDIT : Acl::ADD, $old_event ? $old_event : 0,$account))
@@ -564,7 +605,11 @@  discard block
 block discarded – undo
564 605
 			//error_log(__METHOD__."('$folderid',$id,".array2string($message).") no rights to add/edit event!");
565 606
 			return false;
566 607
 		}
567
-		if (!$id) $old_event['owner'] = $account;	// we do NOT allow to change the owner of existing events
608
+		if (!$id)
609
+		{
610
+			$old_event['owner'] = $account;
611
+		}
612
+		// we do NOT allow to change the owner of existing events
568 613
 
569 614
 		$event = $this->message2event($message, $account, $old_event);
570 615
 
@@ -593,7 +638,10 @@  discard block
 block discarded – undo
593 638
 					unset($ex_event['etag']);
594 639
 					foreach(array_keys($ex_event) as $name)
595 640
 					{
596
-						if (substr($name,0,6) == 'recur_') unset($ex_event[$name]);
641
+						if (substr($name,0,6) == 'recur_')
642
+						{
643
+							unset($ex_event[$name]);
644
+						}
597 645
 					}
598 646
 					$ex_event['recur_type'] = calendar_rrule::NONE;
599 647
 
@@ -646,7 +694,10 @@  discard block
 block discarded – undo
646 694
 			'end' => 'endtime',
647 695
 		) as $key => $attr)
648 696
 		{
649
-			if (isset($message->$attr)) $event[$key] = Api\DateTime::server2user($message->$attr);
697
+			if (isset($message->$attr))
698
+			{
699
+				$event[$key] = Api\DateTime::server2user($message->$attr);
700
+			}
650 701
 		}
651 702
 		// copying strings
652 703
 		foreach(array(
@@ -655,7 +706,10 @@  discard block
 block discarded – undo
655 706
 			'location' => 'location',
656 707
 		) as $key => $attr)
657 708
 		{
658
-			if (isset($message->$attr)) $event[$key] = $message->$attr;
709
+			if (isset($message->$attr))
710
+			{
711
+				$event[$key] = $message->$attr;
712
+			}
659 713
 		}
660 714
 
661 715
 		// only change description, if one given, as iOS5 skips description in ChangeMessage after MeetingResponse
@@ -674,14 +728,22 @@  discard block
 block discarded – undo
674 728
 
675 729
 		if (($event['whole_day'] = $message->alldayevent))
676 730
 		{
677
-			if ($event['end'] == $event['start']) $event['end'] += 24*3600;	// some clients send equal start&end for 1day
731
+			if ($event['end'] == $event['start'])
732
+			{
733
+				$event['end'] += 24*3600;
734
+			}
735
+			// some clients send equal start&end for 1day
678 736
 			$event['end']--;	// otherwise our whole-day event code in save makes it one more day!
679 737
 		}
680 738
 
681 739
 		$participants = array();
682 740
 		foreach((array)$message->attendees as $attendee)
683 741
 		{
684
-			if ($attendee->type == 3) continue;	// we can not identify resources and re-add them anyway later
742
+			if ($attendee->type == 3)
743
+			{
744
+				continue;
745
+			}
746
+			// we can not identify resources and re-add them anyway later
685 747
 
686 748
 			$matches = null;
687 749
 			if (preg_match('/^noreply-(.*)[email protected]$/',$attendee->email,$matches))
@@ -696,7 +758,10 @@  discard block
 block discarded – undo
696 758
 					//'n_fn' => $attendee->name,	// not sure if we want matches without email
697 759
 				);
698 760
 				// search addressbook for participant
699
-				if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
761
+				if (!isset($this->addressbook))
762
+				{
763
+					$this->addressbook = new Api\Contacts();
764
+				}
700 765
 				if ((list($data) = $this->addressbook->search($search,
701 766
 					array('id','egw_addressbook.account_id as account_id','n_fn'),
702 767
 					'egw_addressbook.account_id IS NOT NULL DESC, n_fn IS NOT NULL DESC',
@@ -704,10 +769,13 @@  discard block
 block discarded – undo
704 769
 				{
705 770
 					$uid = $data['account_id'] ? (int)$data['account_id'] : 'c'.$data['id'];
706 771
 				}
707
-				elseif($attendee->name === $attendee->email || empty($attendee->name))	// dont store empty or email as name
772
+				elseif($attendee->name === $attendee->email || empty($attendee->name))
773
+				{
774
+					// dont store empty or email as name
708 775
 				{
709 776
 					$uid = 'e'.$attendee->email;
710 777
 				}
778
+				}
711 779
 				else	// store just the email
712 780
 				{
713 781
 					$uid = 'e'.$attendee->name.' <'.$attendee->email.'>';
@@ -736,7 +804,11 @@  discard block
 block discarded – undo
736 804
 				$role = 'REQ-PARTICIPANT';
737 805
 				//ZLog::Write(LOGLEVEL_DEBUG, "default status for $uid is status=$status, quantity=$quantitiy, role=$role");
738 806
 			}
739
-			if ($role == 'CHAIR') $chair_set = true;	// by role from existing participant
807
+			if ($role == 'CHAIR')
808
+			{
809
+				$chair_set = true;
810
+			}
811
+			// by role from existing participant
740 812
 
741 813
 			if (isset($attendee->attendeestatus) && ($s = array_search($attendee->attendeestatus,self::$status2as)))
742 814
 			{
@@ -750,10 +822,13 @@  discard block
 block discarded – undo
750 822
 			elseif (isset($attendee->attendeetype) &&
751 823
 				!($role == 'CHAIR' && !is_numeric($uid)) &&	// do not override our external ORGANIZER
752 824
 				($r = array_search($attendee->attendeetype,self::$role2as)) &&
753
-				(int)self::$role2as[$role] != $attendee->attendeetype)	// if old role gives same type, use old role, as we have a lot more roles then AS
825
+				(int)self::$role2as[$role] != $attendee->attendeetype)
826
+			{
827
+				// if old role gives same type, use old role, as we have a lot more roles then AS
754 828
 			{
755 829
 				$role = $r;
756 830
 			}
831
+			}
757 832
 			//ZLog::Write(LOGLEVEL_DEBUG, "-> status for $uid is status=$status ($s), quantity=$quantitiy, role=$role ($r)");
758 833
 			$participants[$uid] = calendar_so::combine_status($status,$quantitiy,$role);
759 834
 		}
@@ -768,12 +843,19 @@  discard block
 block discarded – undo
768 843
 		// $account is also preserved, as AS does not add him as participant!
769 844
 		foreach((array)$event['participant_types'] as $type => $parts)
770 845
 		{
771
-			if (in_array($type,array('c','e'))) continue;	// they are correctly representable in AS
846
+			if (in_array($type,array('c','e')))
847
+			{
848
+				continue;
849
+			}
850
+			// they are correctly representable in AS
772 851
 
773 852
 			foreach($parts as $id => $status)
774 853
 			{
775 854
 				// accounts are represented correctly, but the event owner which is no participant in AS
776
-				if ($type == 'u' && $id != $account) continue;
855
+				if ($type == 'u' && $id != $account)
856
+				{
857
+					continue;
858
+				}
777 859
 
778 860
 				$uid = calendar_so::combine_user($type, $id);
779 861
 				if (!isset($participants[$uid]))
@@ -798,10 +880,13 @@  discard block
 block discarded – undo
798 880
 		// check if event is recurring and import recur information (incl. timezone)
799 881
 		if ($message->recurrence)
800 882
 		{
801
-			if ($message->timezone && !$event['id'])	// dont care for timezone, if no new and recurring event
883
+			if ($message->timezone && !$event['id'])
884
+			{
885
+				// dont care for timezone, if no new and recurring event
802 886
 			{
803 887
 				$event['tzid'] = self::as2tz(self::_getTZFromSyncBlob(base64_decode($message->timezone)));
804 888
 			}
889
+			}
805 890
 			$event['recur_type'] = $message->recurrence->type == 6 ? calendar_rrule::YEARLY :
806 891
 				array_search($message->recurrence->type, self::$recur_type2as);
807 892
 			$event['recur_interval'] = $message->recurrence->interval;
@@ -838,10 +923,13 @@  discard block
 block discarded – undo
838 923
 			{
839 924
 				// calculate enddate from occurences count, as we only support enddate
840 925
 				$count = $message->recurrence->occurrences;
841
-				foreach(calendar_rrule::event2rrule($event, true) as $rtime)	// true = timestamps are user time here, because of save!
926
+				foreach(calendar_rrule::event2rrule($event, true) as $rtime)
927
+				{
928
+					// true = timestamps are user time here, because of save!
842 929
 				{
843 930
 					if (--$count <= 0) break;
844 931
 				}
932
+				}
845 933
 				$event['recur_enddate'] = $rtime->format('ts');
846 934
 			}
847 935
 		}
@@ -856,7 +944,9 @@  discard block
 block discarded – undo
856 944
 					break;
857 945
 				}
858 946
 			}
859
-			if ($alarm !== true)	// new alarm
947
+			if ($alarm !== true)
948
+			{
949
+				// new alarm
860 950
 			{
861 951
 				// delete all earlier alarms of that user
862 952
 				// user get's per AS only the earliest alarm, as AS only supports one alarm
@@ -866,6 +956,7 @@  discard block
 block discarded – undo
866 956
 					if ($alarm['owner'] == $account && $alarm['offset'] > 60*$message->reminder)
867 957
 					{
868 958
 						unset($event['alarm'][$key]);
959
+			}
869 960
 					}
870 961
 				}
871 962
 				$event['alarm'][] = $alarm = array(
@@ -946,7 +1037,10 @@  discard block
 block discarded – undo
946 1037
 	{
947 1038
 		unset($contentParameters);	// not used, but required by function signature
948 1039
 
949
-		if (!isset($this->caledar)) $this->calendar = new calendar_boupdate();
1040
+		if (!isset($this->caledar))
1041
+		{
1042
+			$this->calendar = new calendar_boupdate();
1043
+		}
950 1044
 
951 1045
 		$ret = $this->calendar->delete($id);
952 1046
 		ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', $id) delete($id) returned ".array2string($ret));
@@ -1008,7 +1102,10 @@  discard block
 block discarded – undo
1008 1102
 	 */
1009 1103
 	public function GetMessage($folderid, $id, $contentparameters, $class='SyncAppointment')
1010 1104
 	{
1011
-		if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
1105
+		if (!isset($this->calendar))
1106
+		{
1107
+			$this->calendar = new calendar_boupdate();
1108
+		}
1012 1109
 		//error_log(__METHOD__.__LINE__.array2string($contentparameters).function_backtrace());
1013 1110
 		$truncsize = Utils::GetTruncSize($contentparameters->GetTruncation());
1014 1111
 		$mimesupport = $contentparameters->GetMimeSupport();
@@ -1046,7 +1143,10 @@  discard block
 block discarded – undo
1046 1143
 		catch(Exception $e) {
1047 1144
 			unset($e);
1048 1145
 			// z-push (2.3 at least) requires a timezone for recurring events
1049
-			if ($event['recur_type']) $message->timezone = self::UTC_BLOB;
1146
+			if ($event['recur_type'])
1147
+			{
1148
+				$message->timezone = self::UTC_BLOB;
1149
+			}
1050 1150
 		}
1051 1151
 
1052 1152
 		// copying timestamps (they are already read in servertime, so non tz conversation)
@@ -1057,7 +1157,10 @@  discard block
 block discarded – undo
1057 1157
 			'modified' => 'dtstamp',
1058 1158
 		) as $key => $attr)
1059 1159
 		{
1060
-			if (!empty($event[$key])) $message->$attr = $event[$key];
1160
+			if (!empty($event[$key]))
1161
+			{
1162
+				$message->$attr = $event[$key];
1163
+			}
1061 1164
 		}
1062 1165
 		if (($message->alldayevent = (int)calendar_bo::isWholeDay($event)))
1063 1166
 		{
@@ -1070,7 +1173,10 @@  discard block
 block discarded – undo
1070 1173
 			'location' => 'location',
1071 1174
 		) as $key => $attr)
1072 1175
 		{
1073
-			if (!empty($event[$key])) $message->$attr = $event[$key];
1176
+			if (!empty($event[$key]))
1177
+			{
1178
+				$message->$attr = $event[$key];
1179
+			}
1074 1180
 		}
1075 1181
 
1076 1182
 		// appoint description
@@ -1103,7 +1209,10 @@  discard block
 block discarded – undo
1103 1209
 		foreach($event['participants'] as $uid => $status)
1104 1210
 		{
1105 1211
 			// AS does NOT want calendar owner as participant
1106
-			if ($uid == $account) continue;
1212
+			if ($uid == $account)
1213
+			{
1214
+				continue;
1215
+			}
1107 1216
 			$quantity = $role = null;
1108 1217
 			calendar_so::split_status($status, $quantity, $role);
1109 1218
 
@@ -1120,7 +1229,10 @@  discard block
 block discarded – undo
1120 1229
 				list($info) = $i = $this->calendar->resources[$uid[0]]['info'] ?
1121 1230
 					ExecMethod($this->calendar->resources[$uid[0]]['info'],substr($uid,1)) : array(false);
1122 1231
 
1123
-				if (!$info) continue;
1232
+				if (!$info)
1233
+				{
1234
+					continue;
1235
+				}
1124 1236
 
1125 1237
 				if (!$info['email'] && $info['responsible'])
1126 1238
 				{
@@ -1136,10 +1248,17 @@  discard block
 block discarded – undo
1136 1248
 					$message->organizeremail = $attendee->email;
1137 1249
 					ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."($folderid, $id, ...) external organizer detected (role=$role, uid=$uid), set as AS organizer: $message->organizername <$message->organizeremail>");
1138 1250
 				}
1139
-				if ($uid[0] == 'r') $attendee->type = 3;	// 3 = resource
1251
+				if ($uid[0] == 'r')
1252
+				{
1253
+					$attendee->type = 3;
1254
+				}
1255
+				// 3 = resource
1140 1256
 			}
1141 1257
 			// email must NOT be empty, but MAY be an arbitrary text
1142
-			if (empty($attendee->email)) $attendee->email = 'noreply-'.$uid.'[email protected]';
1258
+			if (empty($attendee->email))
1259
+			{
1260
+				$attendee->email = 'noreply-'.$uid.'[email protected]';
1261
+			}
1143 1262
 
1144 1263
 			$message->attendees[] = $attendee;
1145 1264
 		}
@@ -1174,9 +1293,12 @@  discard block
 block discarded – undo
1174 1293
 					$recurrence->monthofyear = (int)$rrule->time->format('m');	// 1..12
1175 1294
 					break;
1176 1295
 			}
1177
-			if ($rrule->enddate)	// enddate is only a date, but AS needs a time incl. correct starttime!
1296
+			if ($rrule->enddate)
1297
+			{
1298
+				// enddate is only a date, but AS needs a time incl. correct starttime!
1178 1299
 			{
1179 1300
 				$enddate = clone $rrule->time;
1301
+			}
1180 1302
 				$enddate->setDate($rrule->enddate->format('Y'), $rrule->enddate->format('m'),
1181 1303
 					$rrule->enddate->format('d'));
1182 1304
 				$recurrence->until = $enddate->format('server');
@@ -1198,12 +1320,19 @@  discard block
 block discarded – undo
1198 1320
 				{
1199 1321
 					ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." Exceptions found but no UID given for Event:".$event['id'].' Exceptions:'.array2string($event['recur_exception']));
1200 1322
 				}
1201
-				if (count($ex_events)>=1) ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." found ".count($ex_events)." exeptions for event with UID/ID:".$event['uid'].'/'.$event['id']);
1323
+				if (count($ex_events)>=1)
1324
+				{
1325
+					ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." found ".count($ex_events)." exeptions for event with UID/ID:".$event['uid'].'/'.$event['id']);
1326
+				}
1202 1327
 
1203 1328
 				$message->exceptions = array();
1204 1329
 				foreach($ex_events as $ex_event)
1205 1330
 				{
1206
-					if ($ex_event['id'] == $event['id']) continue;	// ignore series master
1331
+					if ($ex_event['id'] == $event['id'])
1332
+					{
1333
+						continue;
1334
+					}
1335
+					// ignore series master
1207 1336
 					$exception = $this->GetMessage($folderid, $ex_event, $contentparameters, 'SyncAppointmentException');
1208 1337
 					$exception->exceptionstarttime = $exception_time = $ex_event['recurrence'];
1209 1338
 					foreach(array('attendees','recurrence','uid','timezone','organizername','organizeremail') as $not_supported)
@@ -1223,7 +1352,10 @@  discard block
 block discarded – undo
1223 1352
 				{
1224 1353
 					if (!empty($exception_time))
1225 1354
 					{
1226
-						if (empty($event['uid'])) ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." BEWARE no UID given for this event:".$event['id'].' but exception is set for '.$exception_time);
1355
+						if (empty($event['uid']))
1356
+						{
1357
+							ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." BEWARE no UID given for this event:".$event['id'].' but exception is set for '.$exception_time);
1358
+						}
1227 1359
 						$exception = new SyncAppointmentException();	// exceptions seems to be full SyncAppointments, with only starttime required
1228 1360
 						$exception->deleted = 1;
1229 1361
 						$exception->exceptionstarttime = $exception_time;
@@ -1279,12 +1411,18 @@  discard block
 block discarded – undo
1279 1411
 	{
1280 1412
 		unset($folderid);	// not used ($id is unique), but required by function signature
1281 1413
 
1282
-		if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
1414
+		if (!isset($this->calendar))
1415
+		{
1416
+			$this->calendar = new calendar_boupdate();
1417
+		}
1283 1418
 
1284 1419
 		$nul = null;
1285
-		if (!($etag = $this->calendar->get_etag($id, $nul, true, true)))	// last true: $only_master=true
1420
+		if (!($etag = $this->calendar->get_etag($id, $nul, true, true)))
1421
+		{
1422
+			// last true: $only_master=true
1286 1423
 		{
1287 1424
 			$stat = false;
1425
+		}
1288 1426
 			// error_log why access is denied (should never happen for everything returned by calendar_bo::search)
1289 1427
 			$backup = $this->calendar->debug;
1290 1428
 			//$this->calendar->debug = 2;
@@ -1318,13 +1456,22 @@  discard block
 block discarded – undo
1318 1456
 		$type = $owner = null;
1319 1457
 		$this->backend->splitID($folderid, $type, $owner);
1320 1458
 
1321
-		if ($type != 'calendar') return false;
1459
+		if ($type != 'calendar')
1460
+		{
1461
+			return false;
1462
+		}
1322 1463
 
1323
-		if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
1464
+		if (!isset($this->calendar))
1465
+		{
1466
+			$this->calendar = new calendar_boupdate();
1467
+		}
1324 1468
 		//$ctag = $this->calendar->get_ctag($owner,'owner',true);	// true only consider recurrence master
1325 1469
 		$syncstate = $this->calendar->get_ctag($owner,false,true); // we only want to fetch the owners events, where he is a participant too
1326 1470
 		// workaround for syncstate = 0 when calendar is empty causes synctate to not return 0 but array resulting in foldersync loop
1327
-		if ($syncstate == 0) $syncstate = 1;
1471
+		if ($syncstate == 0)
1472
+		{
1473
+			$syncstate = 1;
1474
+		}
1328 1475
 
1329 1476
 		ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', ...) type='$type', owner=$owner --> syncstate='$syncstate'");
1330 1477
 	}
@@ -1400,10 +1547,16 @@  discard block
 block discarded – undo
1400 1547
 			'dstendhour' => 0, 'dstendminute' => 0, 'dstendsecond' => 0, 'dstendmillis' => 0,
1401 1548
 		);
1402 1549
 
1403
-		if ($tz === 'UTC') return $data;
1550
+		if ($tz === 'UTC')
1551
+		{
1552
+			return $data;
1553
+		}
1404 1554
 
1405 1555
 		$name = $component = is_a($tz,'DateTimeZone') ? $tz->getName() : $tz;
1406
-		if (strpos($component, 'VTIMEZONE') === false) $component = calendar_timezones::tz2id($name,'component');
1556
+		if (strpos($component, 'VTIMEZONE') === false)
1557
+		{
1558
+			$component = calendar_timezones::tz2id($name,'component');
1559
+		}
1407 1560
 		// parse ical timezone defintion
1408 1561
 		$ical = self::ical2array($component);
1409 1562
 		$standard = $ical['VTIMEZONE']['STANDARD'];
@@ -1446,11 +1599,17 @@  discard block
 block discarded – undo
1446 1599
 						$data[$prefix.'week'] = 5;
1447 1600
 					}
1448 1601
 					// if both start and end use 1SU use week=5 and decrement month
1449
-					if ($prefix == 'dststart') $start_byday = $matches[1];
1602
+					if ($prefix == 'dststart')
1603
+					{
1604
+						$start_byday = $matches[1];
1605
+					}
1450 1606
 					if ($prefix == 'dstend' && $matches[1] == '1SU' && $start_byday == '1SU')
1451 1607
 					{
1452 1608
 						$data[$prefix.'week'] = 5;
1453
-						if ($prefix == 'dstend') $data[$prefix.'month'] -= 1;
1609
+						if ($prefix == 'dstend')
1610
+						{
1611
+							$data[$prefix.'month'] -= 1;
1612
+						}
1454 1613
 					}
1455 1614
 					static $day2int = array('SU'=>0,'MO'=>1,'TU'=>2,'WE'=>3,'TH'=>4,'FR'=>5,'SA'=>6);
1456 1615
 					$data[$prefix.'day'] = (int)$day2int[substr($matches[1],-2)];
@@ -1526,7 +1685,10 @@  discard block
 block discarded – undo
1526 1685
 	static public function ical2array(&$ical,$section=null)
1527 1686
 	{
1528 1687
 		$arr = array();
1529
-		if (!is_array($ical)) $ical = preg_split("/[\r\n]+/m", $ical);
1688
+		if (!is_array($ical))
1689
+		{
1690
+			$ical = preg_split("/[\r\n]+/m", $ical);
1691
+		}
1530 1692
 		while (($line = array_shift($ical)))
1531 1693
 		{
1532 1694
 			list($name,$value) = explode(':',$line,2);
@@ -1536,7 +1698,10 @@  discard block
 block discarded – undo
1536 1698
 			}
1537 1699
 			elseif($name == 'END')
1538 1700
 			{
1539
-				if ($section && $section==$value) return $arr;
1701
+				if ($section && $section==$value)
1702
+				{
1703
+					return $arr;
1704
+				}
1540 1705
 				break;
1541 1706
 			}
1542 1707
 			else
@@ -1567,13 +1732,19 @@  discard block
 block discarded – undo
1567 1732
 
1568 1733
 		for($n = 0; !isset($cache[$key]); ++$n)
1569 1734
 		{
1570
-			if (!$n)	// check users timezone first
1735
+			if (!$n)
1736
+			{
1737
+				// check users timezone first
1571 1738
 			{
1572 1739
 				$tz = Api\DateTime::$user_timezone->getName();
1573 1740
 			}
1574
-			elseif (!($tz = calendar_timezones::id2tz($n)))	// no further timezones to check
1741
+			}
1742
+			elseif (!($tz = calendar_timezones::id2tz($n)))
1743
+			{
1744
+				// no further timezones to check
1575 1745
 			{
1576 1746
 				$cache[$key] = 'UTC';
1747
+			}
1577 1748
 				error_log(__METHOD__.'('.array2string($data).') NO matching timezone found --> using UTC now!');
1578 1749
 				break;
1579 1750
 			}
@@ -1637,7 +1808,11 @@  discard block
 block discarded – undo
1637 1808
 				$account_id = $entry['grantor'];
1638 1809
 				$cals[$account_id] = $entry['name'];
1639 1810
 			}
1640
-			if ($hook_data['account_id'] > 0) unset($cals[$hook_data['account_id']]);	// skip current user
1811
+			if ($hook_data['account_id'] > 0)
1812
+			{
1813
+				unset($cals[$hook_data['account_id']]);
1814
+			}
1815
+			// skip current user
1641 1816
 		}
1642 1817
 		$cals['G'] = lang('Primary group');
1643 1818
 		$cals['A'] = lang('All');
@@ -1665,13 +1840,16 @@  discard block
 block discarded – undo
1665 1840
  *
1666 1841
  * You need to comment implements activesync_plugin_write
1667 1842
  */
1668
-if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)	// some tests
1843
+if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)
1844
+{
1845
+	// some tests
1669 1846
 {
1670 1847
 	$GLOBALS['egw_info'] = array(
1671 1848
 		'flags' => array(
1672 1849
 			'currentapp' => 'login'
1673 1850
 		)
1674 1851
 	);
1852
+}
1675 1853
 	require_once('../../header.inc.php');
1676 1854
 	ini_set('display_errors',1);
1677 1855
 	error_reporting(E_ALL & ~E_NOTICE);
Please login to merge, or discard this patch.
calendar/inc/class.calendar_ui.inc.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -387,11 +387,11 @@
 block discarded – undo
387 387
 	}
388 388
 
389 389
 	/**
390
-	* gets the icons displayed for a given event
391
-	*
392
-	* @param array $event
393
-	* @return array of 'img' / 'title' pairs
394
-	*/
390
+	 * gets the icons displayed for a given event
391
+	 *
392
+	 * @param array $event
393
+	 * @return array of 'img' / 'title' pairs
394
+	 */
395 395
 	function event_icons($event)
396 396
 	{
397 397
 		$is_private = !$event['public'] && !$this->bo->check_perms(Acl::READ,$event);
Please login to merge, or discard this patch.
Braces   +49 added lines, -13 removed lines patch added patch discarded remove patch
@@ -166,7 +166,10 @@  discard block
 block discarded – undo
166 166
 		unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
167 167
 
168 168
 		// make sure the hook for export_limit is registered
169
-		if (!Api\Hooks::exists('export_limit','calendar')) Api\Hooks::read(true);
169
+		if (!Api\Hooks::exists('export_limit','calendar'))
170
+		{
171
+			Api\Hooks::read(true);
172
+		}
170 173
 	}
171 174
 
172 175
 	/**
@@ -279,11 +282,15 @@  discard block
 block discarded – undo
279 282
 				{
280 283
 					// only change the owners of the same resource-type as given in set_state[owner]
281 284
 					$set_owners = is_array($set_states['owner']) ? $set_states['owner'] : explode(',',$set_states['owner']);
282
-					if ((string)$set_owners[0] === '0')	// set exactly the specified owners (without the 0)
285
+					if ((string)$set_owners[0] === '0')
286
+					{
287
+						// set exactly the specified owners (without the 0)
283 288
 					{
284 289
 						if ($set_states['owner'] === '0,r0')	// small fix for resources
285 290
 						{
286
-							$set_states['owner'] = $default;	// --> set default, instead of none
291
+							$set_states['owner'] = $default;
292
+					}
293
+					// --> set default, instead of none
287 294
 						}
288 295
 						else
289 296
 						{
@@ -369,7 +376,10 @@  discard block
 block discarded – undo
369 376
 		}
370 377
 		$this->view_menuaction = $this->view == 'listview' ? 'calendar.calendar_uilist.listview' : 'calendar.calendar_uiviews.index';
371 378
 
372
-		if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1), states now %3',True,$set_states,$states);
379
+		if ($this->debug > 0 || $this->debug == 'manage_states')
380
+		{
381
+			$this->bo->debug_message('uical::manage_states(%1), states now %3',True,$set_states,$states);
382
+		}
373 383
 		// save the states in the session only when we are in calendar
374 384
 		if ($GLOBALS['egw_info']['flags']['currentapp']=='calendar')
375 385
 		{
@@ -505,8 +515,11 @@  discard block
 block discarded – undo
505 515
 
506 516
 		// resources menu hooks
507 517
  		foreach ($this->bo->resources as $resource)
508
-		{
509
-			if(!is_array($resource['cal_sidebox'])) continue;
518
+ 		{
519
+			if(!is_array($resource['cal_sidebox']))
520
+			{
521
+				continue;
522
+			}
510 523
 			$menu_title = $resource['cal_sidebox']['menu_title'] ? $resource['cal_sidebox']['menu_title'] : lang($resource['app']);
511 524
 			$file = ExecMethod($resource['cal_sidebox']['file'],array(
512 525
 				'menuaction' => $this->view_menuaction,
@@ -553,7 +566,10 @@  discard block
 block discarded – undo
553 566
 		$sidebox = new Etemplate('calendar.sidebox');
554 567
 
555 568
 		$cont = $this->cal_prefs['saved_states'];
556
-		if (!is_array($cont)) $cont = array();
569
+		if (!is_array($cont))
570
+		{
571
+			$cont = array();
572
+		}
557 573
 		$cont['view'] = $this->view ? $this->view : 'week';
558 574
 		$cont['date'] = $this->date ? $this->date : Api\DateTime();
559 575
 
@@ -612,7 +628,10 @@  discard block
 block discarded – undo
612 628
 	 */
613 629
 	public function update_client($event_id, Api\DateTime $recurrence_date = null)
614 630
 	{
615
-		if(!$event_id) return false;
631
+		if(!$event_id)
632
+		{
633
+			return false;
634
+		}
616 635
 
617 636
 		// Directly update stored data.
618 637
 		// Make sure we have the whole event
@@ -678,7 +697,10 @@  discard block
 block discarded – undo
678 697
 	 */
679 698
 	public function to_client(&$event)
680 699
 	{
681
-		if(!$event || !is_array($event)) return false;
700
+		if(!$event || !is_array($event))
701
+		{
702
+			return false;
703
+		}
682 704
 
683 705
 		if (!$this->bo->check_perms(Acl::EDIT,$event))
684 706
 		{
@@ -699,8 +721,16 @@  discard block
 block discarded – undo
699 721
 
700 722
 		$event['recure'] = $this->bo->recure2string($event);
701 723
 
702
-		if (empty($event['description'])) $event['description'] = ' ';	// no description screws the titles horz. alignment
703
-		if (empty($event['location'])) $event['location'] = ' ';	// no location screws the owner horz. alignment
724
+		if (empty($event['description']))
725
+		{
726
+			$event['description'] = ' ';
727
+		}
728
+		// no description screws the titles horz. alignment
729
+		if (empty($event['location']))
730
+		{
731
+			$event['location'] = ' ';
732
+		}
733
+		// no location screws the owner horz. alignment
704 734
 
705 735
 		// respect category permissions
706 736
 		if(!empty($event['category']))
@@ -777,8 +807,14 @@  discard block
 block discarded – undo
777 807
 			if(!$timespan)
778 808
 			{
779 809
 				// Try to make time span into appropriate ranges to match
780
-				if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) $template = 'month';
781
-				if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) $template = 'week';
810
+				if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false)
811
+				{
812
+					$template = 'month';
813
+				}
814
+				if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false)
815
+				{
816
+					$template = 'week';
817
+				}
782 818
 				//error_log("Detected template $template");
783 819
 				switch ($template)
784 820
 				{
Please login to merge, or discard this patch.
calendar/inc/class.calendar_uiforms.inc.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2415,14 +2415,14 @@  discard block
 block discarded – undo
2415 2415
 	}
2416 2416
 
2417 2417
 	/**
2418
-     * Export events as vCalendar version 2.0 files (iCal)
2419
-     *
2420
-     * @param int|array $content numeric cal_id or submitted content from etempalte::exec
2421
-     * @param boolean $return_error should an error-msg be returned or a regular page with it generated (default)
2422
-     * @return string error-msg if $return_error
2423
-     */
2424
-    function export($content=0,$return_error=false)
2425
-    {
2418
+	 * Export events as vCalendar version 2.0 files (iCal)
2419
+	 *
2420
+	 * @param int|array $content numeric cal_id or submitted content from etempalte::exec
2421
+	 * @param boolean $return_error should an error-msg be returned or a regular page with it generated (default)
2422
+	 * @return string error-msg if $return_error
2423
+	 */
2424
+	function export($content=0,$return_error=false)
2425
+	{
2426 2426
 		$boical = new calendar_ical();
2427 2427
 		#error_log(__METHOD__.print_r($content,true));
2428 2428
 		if (is_numeric($cal_id = $content ? $content : $_REQUEST['cal_id']))
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('iCal Export');
2477 2477
 		$etpl = new etemplate_new('calendar.export');
2478 2478
 		$etpl->exec('calendar.calendar_uiforms.export',$content);
2479
-    }
2479
+	}
2480 2480
 	
2481 2481
 	/**
2482 2482
 	 * Edit category ACL (admin only)
@@ -2548,8 +2548,8 @@  discard block
 block discarded – undo
2548 2548
 	}
2549 2549
 
2550 2550
 	/**
2551
-	* Set up the required fields to get the history tab
2552
-	*/
2551
+	 * Set up the required fields to get the history tab
2552
+	 */
2553 2553
 	public function setup_history(&$content, &$sel_options)
2554 2554
 	{
2555 2555
 		$status = 'history_status';
Please login to merge, or discard this patch.
Braces   +288 added lines, -74 removed lines patch added patch discarded remove patch
@@ -110,11 +110,14 @@  discard block
 block discarded – undo
110 110
 		if (!$owner || !is_numeric($owner) || $GLOBALS['egw']->accounts->get_type($owner) != 'u' ||
111 111
 			!$this->bo->check_perms(Acl::ADD,0,$owner))
112 112
 		{
113
-			if ($owner)	// make an owner who is no user or we have no add-rights a participant
113
+			if ($owner)
114
+			{
115
+				// make an owner who is no user or we have no add-rights a participant
114 116
 			{
115 117
 				if(!is_array($owner))
116 118
 				{
117 119
 					$owner = explode(',',$owner);
120
+			}
118 121
 				}
119 122
 				// if we come from ressources we don't need any users selected in calendar
120 123
 				if (!isset($_GET['participants']) || $_GET['participants'][0] != 'r')
@@ -150,9 +153,17 @@  discard block
 block discarded – undo
150 153
 		$participant_types['u'] = $participant_types = $participants = array();
151 154
 		foreach($extra_participants as $uid)
152 155
 		{
153
-			if (isset($participants[$uid])) continue;	// already included
156
+			if (isset($participants[$uid]))
157
+			{
158
+				continue;
159
+			}
160
+			// already included
154 161
 
155
-			if (!$this->bo->check_acl_invite($uid)) continue;	// no right to invite --> ignored
162
+			if (!$this->bo->check_acl_invite($uid))
163
+			{
164
+				continue;
165
+			}
166
+			// no right to invite --> ignored
156 167
 
157 168
 			if (is_numeric($uid))
158 169
 			{
@@ -180,10 +191,13 @@  discard block
 block discarded – undo
180 191
 				}
181 192
 			}
182 193
 		}
183
-		if (!$participants)	// if all participants got removed, include current user
194
+		if (!$participants)
195
+		{
196
+			// if all participants got removed, include current user
184 197
 		{
185 198
 			$participants[$this->user] = $participant_types['u'][$this->user] = calendar_so::combine_status('A',1,'CHAIR');
186 199
 		}
200
+		}
187 201
 		if(isset($_GET['cat_id']))
188 202
 		{
189 203
 			$cat_id = explode(',',$_GET['cat_id']);
@@ -231,10 +245,13 @@  discard block
 block discarded – undo
231 245
 	 */
232 246
 	function process_edit($content)
233 247
 	{
234
-		if (!is_array($content))	// redirect from etemplate, if POST empty
248
+		if (!is_array($content))
249
+		{
250
+			// redirect from etemplate, if POST empty
235 251
 		{
236 252
 			return $this->edit(null,null,strip_tags($_GET['msg']));
237 253
 		}
254
+		}
238 255
 		// clear notification errors
239 256
 		notifications::errors(true);
240 257
 		$messages = null;
@@ -247,7 +264,11 @@  discard block
 block discarded – undo
247 264
 		$update_type = $content['id'] ? ($content['recur_type'] == MCAL_RECUR_NONE ? 'update' : 'edit') : 'add';
248 265
 
249 266
 		list($button) = @each($content['button']);
250
-		if (!$button && $content['action']) $button = $content['action'];	// action selectbox
267
+		if (!$button && $content['action'])
268
+		{
269
+			$button = $content['action'];
270
+		}
271
+		// action selectbox
251 272
 		unset($content['button']); unset($content['action']);
252 273
 
253 274
 		$view = $content['view'];
@@ -260,7 +281,10 @@  discard block
 block discarded – undo
260 281
 		{
261 282
 			list($date) = each($content['recur_exception']['delete_exception']);
262 283
 			// eT2 converts time to
263
-			if (!is_numeric($date)) $date = Api\DateTime::to (str_replace('Z','', $date), 'ts');
284
+			if (!is_numeric($date))
285
+			{
286
+				$date = Api\DateTime::to (str_replace('Z','', $date), 'ts');
287
+			}
264 288
 			unset($content['recur_exception']['delete_exception']);
265 289
 			if (($key = array_search($date,$content['recur_exception'])) !== false)
266 290
 			{
@@ -269,7 +293,10 @@  discard block
 block discarded – undo
269 293
 				foreach ($recur_exceptions as $id)
270 294
 				{
271 295
 					if (!($exception = $this->bo->read($id)) ||
272
-							$exception['recurrence'] != $content['recur_exception'][$key]) continue;
296
+							$exception['recurrence'] != $content['recur_exception'][$key])
297
+					{
298
+						continue;
299
+					}
273 300
 					$exception['uid'] = Api\CalDAV::generate_uid('calendar', $id);
274 301
 					$exception['reference'] = $exception['recurrence'] = 0;
275 302
 					$this->bo->update($exception, true, true,false,true,$messages,$content['no_notifications']);
@@ -344,7 +371,10 @@  discard block
 block discarded – undo
344 371
 				$event['end'] = $this->bo->date2ts($event['end']);
345 372
 			}
346 373
 			// some checks for recurrences, if you give a date, make it a weekly repeating event and visa versa
347
-			if ($event['recur_type'] == MCAL_RECUR_NONE && $event['recur_data']) $event['recur_type'] = MCAL_RECUR_WEEKLY;
374
+			if ($event['recur_type'] == MCAL_RECUR_NONE && $event['recur_data'])
375
+			{
376
+				$event['recur_type'] = MCAL_RECUR_WEEKLY;
377
+			}
348 378
 			if ($event['recur_type'] == MCAL_RECUR_WEEKLY && !$event['recur_data'])
349 379
 			{
350 380
 				$event['recur_data'] = 1 << (int)date('w',$event['start']);
@@ -371,7 +401,8 @@  discard block
 block discarded – undo
371 401
 							break;
372 402
 						case 'participant':
373 403
 							foreach($data as $participant)
374
-							{								// email or rfc822 addresse (eg. "Ralf Becker <[email protected]>")
404
+							{
405
+// email or rfc822 addresse (eg. "Ralf Becker <[email protected]>")
375 406
 								$email = array();
376 407
 								if(preg_match('/^(.*<)?([a-z0-9_.-]+@[a-z0-9_.-]{5,})>?$/i',$participant,$email))
377 408
 								{
@@ -451,7 +482,11 @@  discard block
 block discarded – undo
451 482
 							break;
452 483
 
453 484
 						default:		// existing participant row
454
-							if (!is_array($data)) continue;	// widgets in participant tab, above participant list
485
+							if (!is_array($data))
486
+							{
487
+								continue;
488
+							}
489
+							// widgets in participant tab, above participant list
455 490
 							foreach(array('uid','status','quantity','role') as $name)
456 491
 							{
457 492
 								$$name = $data[$name];
@@ -580,7 +615,10 @@  discard block
 block discarded – undo
580 615
 			{
581 616
 				foreach($participants as $id => &$p_response)
582 617
 				{
583
-					if($type == 'u' && $id == $event['owner']) continue;
618
+					if($type == 'u' && $id == $event['owner'])
619
+					{
620
+						continue;
621
+					}
584 622
 					calendar_so::split_status($p_response, $quantity, $role);
585 623
 					// if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it
586 624
 					$status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U';
@@ -662,17 +700,23 @@  discard block
 block discarded – undo
662 700
 			{
663 701
 				foreach (array_keys($event['participants']) as $uid)
664 702
 				{
665
-					if ($uid[0] == 'r') //ressource detection
703
+					if ($uid[0] == 'r')
704
+					{
705
+						//ressource detection
666 706
 					{
667 707
 						$msg = lang('Error: ressources reservation in private events is not allowed!!!');
708
+					}
668 709
 						$button = '';
669 710
 						break 2; //break foreach and case
670 711
 					}
671 712
 				}
672 713
 			}
673
-			if ($content['edit_single'])	// we edited a single event from a series
714
+			if ($content['edit_single'])
715
+			{
716
+				// we edited a single event from a series
674 717
 			{
675 718
 				$event['reference'] = $event['id'];
719
+			}
676 720
 				$event['recurrence'] = $content['edit_single'];
677 721
 				unset($event['id']);
678 722
 				$conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']);
@@ -768,7 +812,10 @@  discard block
 block discarded – undo
768 812
 										case 'no':
769 813
 											break;
770 814
 										case 'startday':
771
-											if ($sameday) break;
815
+											if ($sameday)
816
+											{
817
+												break;
818
+											}
772 819
 										default:
773 820
 											$status_reset_to_unknown = true;
774 821
 											$event['participants'][$uid] = calendar_so::combine_status('U',$q,$r);
@@ -925,7 +972,10 @@  discard block
 block discarded – undo
925 972
 				if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single'])
926 973
 				{
927 974
 					$msg = lang('Series deleted');
928
-					if ($exceptions_kept) $msg .= lang(', exceptions preserved');
975
+					if ($exceptions_kept)
976
+					{
977
+						$msg .= lang(', exceptions preserved');
978
+					}
929 979
 				}
930 980
 				else
931 981
 				{
@@ -961,11 +1011,14 @@  discard block
 block discarded – undo
961 1011
 				{
962 1012
 					$msg = lang("Can't add alarms in the past !!!");
963 1013
 				}
964
-				elseif ($event['id'])	// save the alarm immediatly
1014
+				elseif ($event['id'])
1015
+				{
1016
+					// save the alarm immediatly
965 1017
 				{
966 1018
 					if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm)))
967 1019
 					{
968 1020
 						$alarm['id'] = $alarm_id;
1021
+				}
969 1022
 						$event['alarm'][$alarm_id] = $alarm;
970 1023
 
971 1024
 						$msg = lang('Alarm added');
@@ -978,7 +1031,9 @@  discard block
 block discarded – undo
978 1031
 				}
979 1032
 				else
980 1033
 				{
981
-					for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {}	// get a temporary non-conflicting, numeric id
1034
+					for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++)
1035
+					{
1036
+}	// get a temporary non-conflicting, numeric id
982 1037
 					$event['alarm'][$alarm['id']] = $alarm;
983 1038
 				}
984 1039
 			}
@@ -1001,10 +1056,13 @@  discard block
 block discarded – undo
1001 1056
 		}
1002 1057
 		if (in_array($button,array('cancel','save','delete','delete_exceptions','delete_keep_exceptions')) && $noerror)
1003 1058
 		{
1004
-			if ($content['lock_token'])	// remove an existing lock
1059
+			if ($content['lock_token'])
1060
+			{
1061
+				// remove an existing lock
1005 1062
 			{
1006 1063
 				Vfs::unlock(Vfs::app_entry_lock_path('calendar',$content['id']),$content['lock_token'],false);
1007 1064
 			}
1065
+			}
1008 1066
 			if ($content['no_popup'])
1009 1067
 			{
1010 1068
 				Egw::redirect_link('/index.php',array(
@@ -1108,8 +1166,7 @@  discard block
 block discarded – undo
1108 1166
 		if (Api\DateTime::to($old_event['start'],'Ymd') < Api\DateTime::to($as_of_date,'Ymd') ||
1109 1167
 			// Adjust for requested date in the past
1110 1168
 			Api\DateTime::to($as_of_date,'ts') < time()
1111
-		)
1112
-		{
1169
+		) {
1113 1170
 
1114 1171
 			unset($orig_event);
1115 1172
 			// copy event by unsetting the id(s)
@@ -1197,32 +1254,50 @@  discard block
 block discarded – undo
1197 1254
 		foreach($event['participants'] as $uid => $status)
1198 1255
 		{
1199 1256
 			//error_log(__METHOD__.__LINE__.' '.$uid.':'.array2string($status));
1200
-			if (empty($status)) continue;
1257
+			if (empty($status))
1258
+			{
1259
+				continue;
1260
+			}
1201 1261
 			$toadd = '';
1202
-			if ((isset($status['status']) && $status['status'] == 'R') || (isset($status['uid']) && $status['uid'] == $this->user)) continue;
1262
+			if ((isset($status['status']) && $status['status'] == 'R') || (isset($status['uid']) && $status['uid'] == $this->user))
1263
+			{
1264
+				continue;
1265
+			}
1203 1266
 
1204 1267
 			if (isset($status['uid']) && is_numeric($status['uid']) && $GLOBALS['egw']->accounts->get_type($status['uid']) == 'u')
1205 1268
 			{
1206
-				if (!($email = $GLOBALS['egw']->accounts->id2name($status['uid'],'account_email'))) continue;
1269
+				if (!($email = $GLOBALS['egw']->accounts->id2name($status['uid'],'account_email')))
1270
+				{
1271
+					continue;
1272
+				}
1207 1273
 
1208 1274
 				$lid = $firstname = $lastname = null;
1209 1275
 				$GLOBALS['egw']->accounts->get_account_name($status['uid'],$lid,$firstname,$lastname);
1210 1276
 
1211 1277
 				$toadd = $firstname.' '.$lastname.' <'.$email.'>';
1212
-				if (!in_array($toadd,$to)) $to[] = $toadd;
1278
+				if (!in_array($toadd,$to))
1279
+				{
1280
+					$to[] = $toadd;
1281
+				}
1213 1282
 				//error_log(__METHOD__.__LINE__.array2string($to));
1214 1283
 			}
1215 1284
 			elseif ($uid < 0)
1216 1285
 			{
1217 1286
 				foreach($GLOBALS['egw']->accounts->members($uid,true) as $uid)
1218 1287
 				{
1219
-					if (!($email = $GLOBALS['egw']->accounts->id2name($uid,'account_email'))) continue;
1288
+					if (!($email = $GLOBALS['egw']->accounts->id2name($uid,'account_email')))
1289
+					{
1290
+						continue;
1291
+					}
1220 1292
 
1221 1293
 					$GLOBALS['egw']->accounts->get_account_name($uid,$lid,$firstname,$lastname);
1222 1294
 
1223 1295
 					$toadd = $firstname.' '.$lastname.' <'.$email.'>';
1224 1296
 					// dont add groupmembers if they already rejected the event, or are the current user
1225
-					if (!in_array($toadd,$to) && ($event['participants'][$uid] !== 'R' && $uid != $this->user)) $to[] = $toadd;
1297
+					if (!in_array($toadd,$to) && ($event['participants'][$uid] !== 'R' && $uid != $this->user))
1298
+					{
1299
+						$to[] = $toadd;
1300
+					}
1226 1301
 					//error_log(__METHOD__.__LINE__.array2string($to));
1227 1302
 				}
1228 1303
 			}
@@ -1275,7 +1350,10 @@  discard block
 block discarded – undo
1275 1350
 			'preset[type]'    => 'text/calendar'.($asrequest?'; method=REQUEST':''),
1276 1351
 			'preset[size]'    => filesize($ics_file),
1277 1352
 		);
1278
-		if ($asrequest) $vars['preset[msg]'] = lang('You attempt to mail a meetingrequest to the recipients above. Depending on the client this mail is opened with, the recipient may or may not see the mailbody below, but only see the meeting request attached.');
1353
+		if ($asrequest)
1354
+		{
1355
+			$vars['preset[msg]'] = lang('You attempt to mail a meetingrequest to the recipients above. Depending on the client this mail is opened with, the recipient may or may not see the mailbody below, but only see the meeting request attached.');
1356
+		}
1279 1357
 		$response = Api\Json\Response::get();
1280 1358
 		$response->call('app.calendar.custom_mail', $vars);
1281 1359
 	}
@@ -1461,9 +1539,15 @@  discard block
 block discarded – undo
1461 1539
 				}
1462 1540
 			}
1463 1541
 			// set new start and end if given by $_GET
1464
-			if(isset($_GET['start'])) { $event['start'] = Api\DateTime::to($_GET['start'],'ts'); }
1465
-			if(isset($_GET['end'])) { $event['end'] = Api\DateTime::to($_GET['end'],'ts'); }
1466
-			if(isset($_GET['non_blocking'])) { $event['non_blocking'] = (bool)$_GET['non_blocking']; }
1542
+			if(isset($_GET['start']))
1543
+			{
1544
+$event['start'] = Api\DateTime::to($_GET['start'],'ts'); }
1545
+			if(isset($_GET['end']))
1546
+			{
1547
+$event['end'] = Api\DateTime::to($_GET['end'],'ts'); }
1548
+			if(isset($_GET['non_blocking']))
1549
+			{
1550
+$event['non_blocking'] = (bool)$_GET['non_blocking']; }
1467 1551
 			// check if the event is the whole day
1468 1552
 			$start = $this->bo->date2array($event['start']);
1469 1553
 			$end = $this->bo->date2array($event['end']);
@@ -1476,10 +1560,13 @@  discard block
 block discarded – undo
1476 1560
 				foreach(is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app)
1477 1561
 				{
1478 1562
 					$link_id = $link_ids[$n];
1479
-					if(!preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id))	// guard against XSS
1563
+					if(!preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id))
1564
+					{
1565
+						// guard against XSS
1480 1566
 					{
1481 1567
 						continue;
1482 1568
 					}
1569
+					}
1483 1570
 					if(!$n)
1484 1571
 					{
1485 1572
 						$event['title'] = Link::title($link_app,$link_id);
@@ -1488,7 +1575,10 @@  discard block
 block discarded – undo
1488 1575
 						{
1489 1576
 							foreach((array)$set['link_app'] as $i => $l_app)
1490 1577
 							{
1491
-								if (($l_id=$set['link_id'][$i])) Link::link('calendar',$event['link_to']['to_id'],$l_app,$l_id);
1578
+								if (($l_id=$set['link_id'][$i]))
1579
+								{
1580
+									Link::link('calendar',$event['link_to']['to_id'],$l_app,$l_id);
1581
+								}
1492 1582
 							}
1493 1583
 							unset($set['link_app']);
1494 1584
 							unset($set['link_id']);
@@ -1514,10 +1604,13 @@  discard block
 block discarded – undo
1514 1604
 			$lock_path = Vfs::app_entry_lock_path('calendar',$event['id']);
1515 1605
 			$lock_owner = 'mailto:'.$GLOBALS['egw_info']['user']['account_email'];
1516 1606
 
1517
-			if (($preserv['lock_token'] = $event['lock_token']))		// already locked --> refresh the lock
1607
+			if (($preserv['lock_token'] = $event['lock_token']))
1608
+			{
1609
+				// already locked --> refresh the lock
1518 1610
 			{
1519 1611
 				Vfs::lock($lock_path,$preserv['lock_token'],$locktime,$lock_owner,$scope='shared',$type='write',true,false);
1520 1612
 			}
1613
+			}
1521 1614
 			if (($lock = Vfs::checkLock($lock_path)) && $lock['owner'] != $lock_owner)
1522 1615
 			{
1523 1616
 				$msg .= ' '.lang('This entry is currently opened by %1!',
@@ -1550,14 +1643,20 @@  discard block
 block discarded – undo
1550 1643
 		));
1551 1644
 		Framework::message($msg, $msg_type);
1552 1645
 		$content['duration'] = $content['end'] - $content['start'];
1553
-		if (isset($this->durations[$content['duration']])) $content['end'] = '';
1646
+		if (isset($this->durations[$content['duration']]))
1647
+		{
1648
+			$content['end'] = '';
1649
+		}
1554 1650
 
1555 1651
 		$row = 3;
1556 1652
 		$readonlys = $content['participants'] = $preserv['participants'] = array();
1557 1653
 		// preserve some ui elements, if set eg. under error-conditions
1558 1654
 		foreach(array('quantity','resource','role') as $n)
1559 1655
 		{
1560
-			if (isset($event['participants'][$n])) $content['participants'][$n] = $event['participants'][$n];
1656
+			if (isset($event['participants'][$n]))
1657
+			{
1658
+				$content['participants'][$n] = $event['participants'][$n];
1659
+			}
1561 1660
 		}
1562 1661
 		foreach($event['participant_types'] as $type => $participants)
1563 1662
 		{
@@ -1599,9 +1698,13 @@  discard block
 block discarded – undo
1599 1698
 				//echo "<p>$uid ($quantity): $role --> {$content['participants'][$row]['role']}</p>\n";
1600 1699
 
1601 1700
 				if (($no_status = !$this->bo->check_status_perms($uid,$event)) || $view)
1602
-					$readonlys['participants'][$row]['status'] = $no_status;
1701
+				{
1702
+									$readonlys['participants'][$row]['status'] = $no_status;
1703
+				}
1603 1704
 				if ($preserv['hide_delete'] || !$this->bo->check_perms(Acl::EDIT,$event))
1604
-					$readonlys['participants']['delete'][$uid] = true;
1705
+				{
1706
+									$readonlys['participants']['delete'][$uid] = true;
1707
+				}
1605 1708
 				// todo: make the participants available as links with email as title
1606 1709
 				$content['participants'][$row++]['title'] = $this->get_title($uid);
1607 1710
 				// enumerate group-invitations, so people can accept/reject them
@@ -1632,7 +1735,11 @@  discard block
 block discarded – undo
1632 1735
 			$content['participants']['cal_resources'] = '';
1633 1736
 			foreach($this->bo->resources as $data)
1634 1737
 			{
1635
-				if ($data['app'] == 'email') continue;	// make no sense, as we cant search for email
1738
+				if ($data['app'] == 'email')
1739
+				{
1740
+					continue;
1741
+				}
1742
+				// make no sense, as we cant search for email
1636 1743
 				$content['participants']['cal_resources'] .= ','.$data['app'];
1637 1744
 			}
1638 1745
 		}
@@ -1660,9 +1767,18 @@  discard block
 block discarded – undo
1660 1767
 				$hours = (int) (($alarm['offset'] % DAY_s) / HOUR_s);
1661 1768
 				$minutes = (int) (($alarm['offset'] % HOUR_s) / 60);
1662 1769
 				$label = array();
1663
-				if ($days) $label[] = $days.' '.lang('days');
1664
-				if ($hours) $label[] = $hours.' '.lang('hours');
1665
-				if ($minutes) $label[] = $minutes.' '.lang('Minutes');
1770
+				if ($days)
1771
+				{
1772
+					$label[] = $days.' '.lang('days');
1773
+				}
1774
+				if ($hours)
1775
+				{
1776
+					$label[] = $hours.' '.lang('hours');
1777
+				}
1778
+				if ($minutes)
1779
+				{
1780
+					$label[] = $minutes.' '.lang('Minutes');
1781
+				}
1666 1782
 				$alarm['offset'] = implode(', ',$label) . ' ' . ($after ? lang('after') : lang('before'));
1667 1783
 				$content['alarm'][] = $alarm;
1668 1784
 
@@ -1725,25 +1841,34 @@  discard block
 block discarded – undo
1725 1841
 			'participants' => $this->accountsel->account_selection == 'none',
1726 1842
 			'history' => !$event['id'],
1727 1843
 		);
1728
-		if (!isset($GLOBALS['egw_info']['user']['apps']['mail']))	// no mail without mail-app
1844
+		if (!isset($GLOBALS['egw_info']['user']['apps']['mail']))
1845
+		{
1846
+			// no mail without mail-app
1729 1847
 		{
1730 1848
 			unset($sel_options['action']['mail']);
1849
+		}
1731 1850
 			unset($sel_options['action']['sendmeetingrequest']);
1732 1851
 		}
1733
-		if (!$event['id'])	// no ical export for new (not saved) events
1852
+		if (!$event['id'])
1853
+		{
1854
+			// no ical export for new (not saved) events
1734 1855
 		{
1735 1856
 			$readonlys['action'] = true;
1736 1857
 		}
1858
+		}
1737 1859
 		if (!($readonlys['button[exception]'] = !$this->bo->check_perms(Acl::EDIT,$event) || $event['recur_type'] == MCAL_RECUR_NONE || ($event['recur_enddate'] &&$event['start'] > $event['recur_enddate'])))
1738 1860
 		{
1739 1861
 			$content['exception_label'] = $this->bo->long_date(max($preserved['actual_date'], $event['start']));
1740 1862
 		}
1741 1863
 		$readonlys['button[delete]'] = !$event['id'] || $preserved['hide_delete'] || !$this->bo->check_perms(Acl::DELETE,$event);
1742 1864
 
1743
-		if (!$event['id'] || $this->bo->check_perms(Acl::EDIT,$event))	// new event or edit rights to the event ==> allow to add alarm for all users
1865
+		if (!$event['id'] || $this->bo->check_perms(Acl::EDIT,$event))
1866
+		{
1867
+			// new event or edit rights to the event ==> allow to add alarm for all users
1744 1868
 		{
1745 1869
 			$sel_options['owner'][0] = lang('All participants');
1746 1870
 		}
1871
+		}
1747 1872
 		if (isset($event['participant_types']['u'][$this->user]))
1748 1873
 		{
1749 1874
 			$sel_options['owner'][$this->user] = $this->bo->participant_name($this->user);
@@ -1785,7 +1910,10 @@  discard block
 block discarded – undo
1785 1910
 
1786 1911
 		$content['cancel_needs_refresh'] = (bool)$_GET['cancel_needs_refresh'];
1787 1912
 
1788
-		if (!empty($preserved['lock_token'])) $content['lock_token'] = $preserved['lock_token'];
1913
+		if (!empty($preserved['lock_token']))
1914
+		{
1915
+			$content['lock_token'] = $preserved['lock_token'];
1916
+		}
1789 1917
 
1790 1918
 		// non_interactive==true from $_GET calls immediate save action without displaying the edit form
1791 1919
 		if(isset($_GET['non_interactive']) && (bool)$_GET['non_interactive'] === true)
@@ -1987,7 +2115,10 @@  discard block
 block discarded – undo
1987 2115
 					// set status and send notification / meeting response
1988 2116
 					if ($this->bo->set_status($event['id'], $user, $status))
1989 2117
 					{
1990
-						if (!$msg) $msg = lang('Status changed');
2118
+						if (!$msg)
2119
+						{
2120
+							$msg = lang('Status changed');
2121
+						}
1991 2122
 					}
1992 2123
 					break;
1993 2124
 
@@ -2066,13 +2197,16 @@  discard block
 block discarded – undo
2066 2197
 
2067 2198
 		foreach (array_keys($allConflicts) as $pId)
2068 2199
 		{
2069
-			if(substr($pId,0,1) == 'r' && $resources_config ) // resources Allow ignore conflicts
2200
+			if(substr($pId,0,1) == 'r' && $resources_config )
2201
+			{
2202
+				// resources Allow ignore conflicts
2070 2203
 			{
2071 2204
 
2072 2205
 				switch ($resources_config['ignoreconflicts'])
2073 2206
 				{
2074 2207
 					case 'no':
2075 2208
 						$readonlys['button[ignore]'] = true;
2209
+			}
2076 2210
 						break;
2077 2211
 					case 'allusers':
2078 2212
 						$readonlys['button[ignore]'] = false;
@@ -2216,7 +2350,10 @@  discard block
 block discarded – undo
2216 2350
 		}
2217 2351
 		else
2218 2352
 		{
2219
-			if (!$content['duration']) $content['duration'] = $content['end'] - $content['start'];
2353
+			if (!$content['duration'])
2354
+			{
2355
+				$content['duration'] = $content['end'] - $content['start'];
2356
+			}
2220 2357
 			$weekds = 0;
2221 2358
 			foreach ($content['weekdays'] as &$wdays)
2222 2359
 			{
@@ -2238,7 +2375,10 @@  discard block
 block discarded – undo
2238 2375
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('freetime search');
2239 2376
 
2240 2377
 		$sel_options['duration'] = $this->durations;
2241
-		if ($content['duration'] && isset($sel_options['duration'][$content['duration']])) $content['end'] = '';
2378
+		if ($content['duration'] && isset($sel_options['duration'][$content['duration']]))
2379
+		{
2380
+			$content['end'] = '';
2381
+		}
2242 2382
 
2243 2383
 		$etpl->exec('calendar.calendar_uiforms.freetimesearch',$content,$sel_options,NULL,array(
2244 2384
 				'participants'	=> $content['participants'],
@@ -2259,7 +2399,10 @@  discard block
 block discarded – undo
2259 2399
 	 */
2260 2400
 	function freetime($participants,$start,$end,$duration=1,$cal_id=0)
2261 2401
 	{
2262
-		if ($this->debug > 2) $this->bo->debug_message(__METHOD__.'(participants=%1, start=%2, end=%3, duration=%4, cal_id=%5)',true,$participants,$start,$end,$duration,$cal_id);
2402
+		if ($this->debug > 2)
2403
+		{
2404
+			$this->bo->debug_message(__METHOD__.'(participants=%1, start=%2, end=%3, duration=%4, cal_id=%5)',true,$participants,$start,$end,$duration,$cal_id);
2405
+		}
2263 2406
 
2264 2407
 		$busy = $this->bo->search(array(
2265 2408
 			'start' => $start,
@@ -2276,15 +2419,26 @@  discard block
 block discarded – undo
2276 2419
 		$n = 0;
2277 2420
 		foreach($busy as $event)
2278 2421
 		{
2279
-			if ((int)$cal_id && $event['id'] == (int)$cal_id) continue;	// ignore our own event
2422
+			if ((int)$cal_id && $event['id'] == (int)$cal_id)
2423
+			{
2424
+				continue;
2425
+			}
2426
+			// ignore our own event
2280 2427
 
2281
- 			if ($event['non_blocking']) continue; // ignore non_blocking events
2428
+ 			if ($event['non_blocking'])
2429
+ 			{
2430
+ 				continue;
2431
+ 			}
2432
+ 			// ignore non_blocking events
2282 2433
 
2283 2434
 			// check if from all wanted participants at least one has a not rejected status in found event
2284 2435
 			$non_rejected_found = false;
2285 2436
 			foreach($participants as $uid)
2286 2437
 			{
2287
-				if ($event['participants'][$uid] == 'R') continue;
2438
+				if ($event['participants'][$uid] == 'R')
2439
+				{
2440
+					continue;
2441
+				}
2288 2442
 
2289 2443
 				if (isset($event['participants'][$uid]) ||
2290 2444
 					$uid > 0 && array_intersect(array_keys((array)$event['participants']),
@@ -2294,7 +2448,10 @@  discard block
 block discarded – undo
2294 2448
 					break;
2295 2449
 				}
2296 2450
 			}
2297
-			if (!$non_rejected_found) continue;
2451
+			if (!$non_rejected_found)
2452
+			{
2453
+				continue;
2454
+			}
2298 2455
 
2299 2456
 			if ($this->debug)
2300 2457
 			{
@@ -2325,11 +2482,17 @@  discard block
 block discarded – undo
2325 2482
 					'start'	=> $ft_start,
2326 2483
 					'end'	=> $ft_end,
2327 2484
 				);
2328
-				if ($this->debug > 1) echo "<p>freetime: ".date('D d.m.Y H:i',$ft_start)." - ".date('D d.m.Y H:i',$ft_end)."</p>\n";
2485
+				if ($this->debug > 1)
2486
+				{
2487
+					echo "<p>freetime: ".date('D d.m.Y H:i',$ft_start)." - ".date('D d.m.Y H:i',$ft_end)."</p>\n";
2488
+				}
2329 2489
 			}
2330 2490
 			$ft_start = $event['end'];
2331 2491
 		}
2332
-		if ($this->debug > 0) $this->bo->debug_message('uiforms::freetime(participants=%1, start=%2, end=%3, duration=%4, cal_id=%5) freetime=%6',true,$participants,$start,$end,$duration,$cal_id,$freetime);
2492
+		if ($this->debug > 0)
2493
+		{
2494
+			$this->bo->debug_message('uiforms::freetime(participants=%1, start=%2, end=%3, duration=%4, cal_id=%5) freetime=%6',true,$participants,$start,$end,$duration,$cal_id,$freetime);
2495
+		}
2333 2496
 
2334 2497
 		return $freetime;
2335 2498
 	}
@@ -2349,10 +2512,16 @@  discard block
 block discarded – undo
2349 2512
 	 */
2350 2513
 	function split_freetime_daywise($freetime, $duration, $weekdays, $_start_time, $_end_time, &$sel_options)
2351 2514
 	{
2352
-		if ($this->debug > 1) $this->bo->debug_message('uiforms::split_freetime_daywise(freetime=%1, duration=%2, start_time=%3, end_time=%4)',true,$freetime,$duration,$_start_time,$_end_time);
2515
+		if ($this->debug > 1)
2516
+		{
2517
+			$this->bo->debug_message('uiforms::split_freetime_daywise(freetime=%1, duration=%2, start_time=%3, end_time=%4)',true,$freetime,$duration,$_start_time,$_end_time);
2518
+		}
2353 2519
 
2354 2520
 		$freetime_daywise = array();
2355
-		if (!is_array($sel_options)) $sel_options = array();
2521
+		if (!is_array($sel_options))
2522
+		{
2523
+			$sel_options = array();
2524
+		}
2356 2525
 		$time_format = $this->common_prefs['timeformat'] == 12 ? 'h:i a' : 'H:i';
2357 2526
 
2358 2527
 		$start_time = (int) $_start_time;	// ignore leading zeros
@@ -2362,7 +2531,10 @@  discard block
 block discarded – undo
2362 2531
 		if (($end_time - $start_time)*HOUR_s < $duration)
2363 2532
 		{
2364 2533
 			$end_time = 0;
2365
-			if ($this->debug > 1) $this->bo->debug_message('uiforms::split_freetime_daywise(, duration=%2, start_time=%3,..) end_time set to 0, it never fits durationn otherwise',true,$duration,$start_time);
2534
+			if ($this->debug > 1)
2535
+			{
2536
+				$this->bo->debug_message('uiforms::split_freetime_daywise(, duration=%2, start_time=%3,..) end_time set to 0, it never fits durationn otherwise',true,$duration,$start_time);
2537
+			}
2366 2538
 		}
2367 2539
 		$n = 0;
2368 2540
 		foreach($freetime as $ft)
@@ -2383,13 +2555,19 @@  discard block
 block discarded – undo
2383 2555
 				}
2384 2556
 				$start = $t < $ft['start'] ? $ft['start'] : $t;
2385 2557
 
2386
-				if ($start-$daybegin < $start_time*HOUR_s)	// start earlier then start_time
2558
+				if ($start-$daybegin < $start_time*HOUR_s)
2559
+				{
2560
+					// start earlier then start_time
2387 2561
 				{
2388 2562
 					$start = $daybegin + $start_time*HOUR_s;
2389 2563
 				}
2564
+				}
2390 2565
 				// if end_time given use it, else the original slot's end
2391 2566
 				$end = $end_time ? $daybegin + $end_time*HOUR_s : $ft['end'];
2392
-				if ($end > $ft['end']) $end = $ft['end'];
2567
+				if ($end > $ft['end'])
2568
+				{
2569
+					$end = $ft['end'];
2570
+				}
2393 2571
 
2394 2572
 				// slot to small for duration
2395 2573
 				if ($end - $start < $duration)
@@ -2431,7 +2609,10 @@  discard block
 block discarded – undo
2431 2609
 			{
2432 2610
 				$msg = lang('Permission denied');
2433 2611
 
2434
-				if ($return_error) return $msg;
2612
+				if ($return_error)
2613
+				{
2614
+					return $msg;
2615
+				}
2435 2616
 			}
2436 2617
 			else
2437 2618
 			{
@@ -2493,27 +2674,42 @@  discard block
 block discarded – undo
2493 2674
 		{
2494 2675
 			list($button) = each($_content['button']);
2495 2676
 			unset($_content['button']);
2496
-			if ($button != 'cancel')	// store changed Acl
2677
+			if ($button != 'cancel')
2678
+			{
2679
+				// store changed Acl
2497 2680
 			{
2498 2681
 				foreach($_content as $data)
2499 2682
 				{
2500 2683
 					if (!($cat_id = $data['cat_id'])) continue;
2684
+			}
2501 2685
 					foreach(array_merge((array)$data['add'],(array)$data['status'],array_keys((array)$data['old'])) as $account_id)
2502 2686
 					{
2503 2687
 						$rights = 0;
2504
-						if (in_array($account_id,(array)$data['add'])) $rights |= calendar_boupdate::CAT_ACL_ADD;
2505
-						if (in_array($account_id,(array)$data['status'])) $rights |= calendar_boupdate::CAT_ACL_STATUS;
2506
-						if ($account_id) $this->bo->set_cat_rights($cat_id,$account_id,$rights);
2688
+						if (in_array($account_id,(array)$data['add']))
2689
+						{
2690
+							$rights |= calendar_boupdate::CAT_ACL_ADD;
2691
+						}
2692
+						if (in_array($account_id,(array)$data['status']))
2693
+						{
2694
+							$rights |= calendar_boupdate::CAT_ACL_STATUS;
2695
+						}
2696
+						if ($account_id)
2697
+						{
2698
+							$this->bo->set_cat_rights($cat_id,$account_id,$rights);
2699
+						}
2507 2700
 					}
2508 2701
 				}
2509 2702
 			}
2510
-			if ($button != 'apply')	// end dialog
2703
+			if ($button != 'apply')
2704
+			{
2705
+				// end dialog
2511 2706
 			{
2512 2707
 				Egw::redirect_link('/index.php', array(
2513 2708
 					'menuaction' => 'admin.admin_ui.index',
2514 2709
 					'ajax' => 'true'
2515 2710
 				), 'admin');
2516 2711
 			}
2712
+			}
2517 2713
 		}
2518 2714
 		$content= $preserv = array();
2519 2715
 		$n = 1;
@@ -2527,8 +2723,14 @@  discard block
 block discarded – undo
2527 2723
 			);
2528 2724
 			foreach($data as $account_id => $rights)
2529 2725
 			{
2530
-				if ($rights & calendar_boupdate::CAT_ACL_ADD) $row['add'][] = $account_id;
2531
-				if ($rights & calendar_boupdate::CAT_ACL_STATUS) $row['status'][] = $account_id;
2726
+				if ($rights & calendar_boupdate::CAT_ACL_ADD)
2727
+				{
2728
+					$row['add'][] = $account_id;
2729
+				}
2730
+				if ($rights & calendar_boupdate::CAT_ACL_STATUS)
2731
+				{
2732
+					$row['status'][] = $account_id;
2733
+				}
2532 2734
 			}
2533 2735
 			$content[$n] = $row;
2534 2736
 			$preserv[$n] = array(
@@ -2656,7 +2858,10 @@  discard block
 block discarded – undo
2656 2858
 					break;
2657 2859
 				}
2658 2860
 			}
2659
-			if($return) return;
2861
+			if($return)
2862
+			{
2863
+				return;
2864
+			}
2660 2865
 		}
2661 2866
 		$old_event=$event=$this->bo->read($eventId);
2662 2867
 		if (!$durationT)
@@ -2741,7 +2946,10 @@  discard block
 block discarded – undo
2741 2946
 			$this->bo->update($event,true, true, false, true, $message,true);
2742 2947
 
2743 2948
 			// Whole day non blocking with DAY_s would add a day
2744
-			if($duration==DAY_s) $duration=0;
2949
+			if($duration==DAY_s)
2950
+			{
2951
+				$duration=0;
2952
+			}
2745 2953
 		}
2746 2954
 		// Drag a normal event to whole day non-blocking
2747 2955
 		else if ($durationT == 'whole_day')
@@ -2765,7 +2973,10 @@  discard block
 block discarded – undo
2765 2973
 					case 'no':
2766 2974
 						break;
2767 2975
 					case 'startday':
2768
-						if ($sameday) break;
2976
+						if ($sameday)
2977
+						{
2978
+							break;
2979
+						}
2769 2980
 					default:
2770 2981
 						$status_reset_to_unknown = true;
2771 2982
 						$event['participants'][$uid] = calendar_so::combine_status('U',$q,$r);
@@ -2803,7 +3014,10 @@  discard block
 block discarded – undo
2803 3014
 		{
2804 3015
 			$response->call('egw.message',  implode('<br />', $message));
2805 3016
 		}
2806
-		if($event['id'] != $eventId ) $this->update_client($_eventId);
3017
+		if($event['id'] != $eventId )
3018
+		{
3019
+			$this->update_client($_eventId);
3020
+		}
2807 3021
 		if ($status_reset_to_unknown)
2808 3022
 		{
2809 3023
 			foreach((array)$event['participants'] as $uid => $status)
Please login to merge, or discard this patch.
calendar/inc/class.calendar_bo.inc.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1490,13 +1490,13 @@  discard block
 block discarded – undo
1490 1490
 	}
1491 1491
 
1492 1492
 	/**
1493
-	* Converts a participant into a (readable) user- or resource-name
1494
-	*
1495
-	* @param string|int $id id of user or resource
1496
-	* @param string|boolean $use_type =false type-letter or false
1497
-	* @param boolean $append_email =false append email (Name <email>)
1498
-	* @return string with name
1499
-	*/
1493
+	 * Converts a participant into a (readable) user- or resource-name
1494
+	 *
1495
+	 * @param string|int $id id of user or resource
1496
+	 * @param string|boolean $use_type =false type-letter or false
1497
+	 * @param boolean $append_email =false append email (Name <email>)
1498
+	 * @return string with name
1499
+	 */
1500 1500
 	function participant_name($id,$use_type=false, $append_email=false)
1501 1501
 	{
1502 1502
 		static $id2lid = array();
@@ -1525,13 +1525,13 @@  discard block
 block discarded – undo
1525 1525
 	}
1526 1526
 
1527 1527
 	/**
1528
-	* Converts participants array of an event into array of (readable) participant-names with status
1529
-	*
1530
-	* @param array $event event-data
1531
-	* @param boolean $long_status =false should the long/verbose status or an icon be use
1532
-	* @param boolean $show_group_invitation =false show group-invitations (status == 'G') or not (default)
1533
-	* @return array with id / names with status pairs
1534
-	*/
1528
+	 * Converts participants array of an event into array of (readable) participant-names with status
1529
+	 *
1530
+	 * @param array $event event-data
1531
+	 * @param boolean $long_status =false should the long/verbose status or an icon be use
1532
+	 * @param boolean $show_group_invitation =false show group-invitations (status == 'G') or not (default)
1533
+	 * @return array with id / names with status pairs
1534
+	 */
1535 1535
 	function participants($event,$long_status=false,$show_group_invitation=false)
1536 1536
 	{
1537 1537
 		//error_log(__METHOD__.__LINE__.array2string($event['participants']));
@@ -1601,12 +1601,12 @@  discard block
 block discarded – undo
1601 1601
 	}
1602 1602
 
1603 1603
 	/**
1604
-	* Converts category string of an event into array of (readable) category-names
1605
-	*
1606
-	* @param string $category cat-id (multiple id's commaseparated)
1607
-	* @param int $color color of the category, if multiple cats, the color of the last one with color is returned
1608
-	* @return array with id / names
1609
-	*/
1604
+	 * Converts category string of an event into array of (readable) category-names
1605
+	 *
1606
+	 * @param string $category cat-id (multiple id's commaseparated)
1607
+	 * @param int $color color of the category, if multiple cats, the color of the last one with color is returned
1608
+	 * @return array with id / names
1609
+	 */
1610 1610
 	function categories($category,&$color)
1611 1611
 	{
1612 1612
 		static $id2cat = array();
Please login to merge, or discard this patch.
Braces   +206 added lines, -51 removed lines patch added patch discarded remove patch
@@ -15,10 +15,13 @@  discard block
 block discarded – undo
15 15
 use EGroupware\Api\Link;
16 16
 use EGroupware\Api\Acl;
17 17
 
18
-if (!defined('ACL_TYPE_IDENTIFER'))	// used to mark ACL-values for the debug_message methode
18
+if (!defined('ACL_TYPE_IDENTIFER'))
19
+{
20
+	// used to mark ACL-values for the debug_message methode
19 21
 {
20 22
 	define('ACL_TYPE_IDENTIFER','***ACL***');
21 23
 }
24
+}
22 25
 
23 26
 define('HOUR_s',60*60);
24 27
 define('DAY_s',24*HOUR_s);
@@ -222,7 +225,10 @@  discard block
 block discarded – undo
222 225
 	 */
223 226
 	function __construct()
224 227
 	{
225
-		if ($this->debug > 0) $this->debug_message('calendar_bo::bocal() started',True);
228
+		if ($this->debug > 0)
229
+		{
230
+			$this->debug_message('calendar_bo::bocal() started',True);
231
+		}
226 232
 
227 233
 		$this->so = new calendar_so();
228 234
 
@@ -308,7 +314,10 @@  discard block
 block discarded – undo
308 314
 	 */
309 315
 	static function email_info($ids)
310 316
 	{
311
-		if (!$ids) return null;
317
+		if (!$ids)
318
+		{
319
+			return null;
320
+		}
312 321
 
313 322
 		$data = array();
314 323
 		foreach((array)$ids as $id)
@@ -391,10 +400,13 @@  discard block
 block discarded – undo
391 400
 				$contact = 'c'.$contact['id'];
392 401
 				if ($ignore_acl || $this->check_perms(ACL::READ|self::ACL_READ_FOR_PARTICIPANTS|($use_freebusy?self::ACL_FREEBUSY:0),0,$contact))
393 402
 				{
394
-					if ($contact && !in_array($contact,$contact_list))	// already added?
403
+					if ($contact && !in_array($contact,$contact_list))
404
+					{
405
+						// already added?
395 406
 					{
396 407
 						$contact_list[] = $contact;
397 408
 					}
409
+					}
398 410
 				}
399 411
 			}
400 412
 		}
@@ -454,31 +466,43 @@  discard block
 block discarded – undo
454 466
 			{
455 467
 				foreach($this->enum_mailing_list($user, $ignore_acl, $use_freebusy) as $contact)
456 468
 				{
457
-					if ($contact && !in_array($contact,$users))	// already added?
469
+					if ($contact && !in_array($contact,$users))
470
+					{
471
+						// already added?
458 472
 					{
459 473
 						$users[] = $contact;
460 474
 					}
475
+					}
461 476
 				}
462 477
 				continue;
463 478
 			}
464 479
 			if ($ignore_acl || $this->check_perms(ACL::READ|self::ACL_READ_FOR_PARTICIPANTS|($use_freebusy?self::ACL_FREEBUSY:0),0,$user))
465 480
 			{
466
-				if ($user && !in_array($user,$users))	// already added?
481
+				if ($user && !in_array($user,$users))
482
+				{
483
+					// already added?
467 484
 				{
468 485
 					$users[] = $user;
469 486
 				}
487
+				}
470 488
 			}
471 489
 			elseif ($GLOBALS['egw']->accounts->get_type($user) != 'g')
472 490
 			{
473 491
 				continue;	// for non-groups (eg. users), we stop here if we have no read-rights
474 492
 			}
475 493
 			// the further code is only for real users
476
-			if (!is_numeric($user)) continue;
494
+			if (!is_numeric($user))
495
+			{
496
+				continue;
497
+			}
477 498
 
478 499
 			// for groups we have to include the members
479 500
 			if ($GLOBALS['egw']->accounts->get_type($user) == 'g')
480 501
 			{
481
-				if ($no_enum_groups) continue;
502
+				if ($no_enum_groups)
503
+				{
504
+					continue;
505
+				}
482 506
 
483 507
 				$members = $GLOBALS['egw']->accounts->members($user, true);
484 508
 				if (is_array($members))
@@ -558,11 +582,14 @@  discard block
 block discarded – undo
558 582
 		}
559 583
 
560 584
 		if (!isset($params['users']) || !$params['users'] ||
561
-			count($params['users']) == 1 && isset($params['users'][0]) && !$params['users'][0])	// null or '' casted to an array
585
+			count($params['users']) == 1 && isset($params['users'][0]) && !$params['users'][0])
586
+		{
587
+			// null or '' casted to an array
562 588
 		{
563 589
 			// for a search use all account you have read grants from
564 590
 			$params['users'] = $params['query'] ? array_keys($this->grants) : $this->user;
565 591
 		}
592
+		}
566 593
 		// resolve users to add memberships for users and members for groups
567 594
 		// for search, do NOT use freebusy rights, as it would allow to probe the content of event entries
568 595
 		$users = $this->resolve_users($params['users'], $params['filter'] == 'no-enum-groups', $params['ignore_acl'], empty($params['query']));
@@ -573,7 +600,10 @@  discard block
 block discarded – undo
573 600
 			$params['private_grants'] = array();
574 601
 			foreach($this->grants as $user => $rights)
575 602
 			{
576
-				if ($rights & Acl::PRIVAT) $params['private_grants'][] = $user;
603
+				if ($rights & Acl::PRIVAT)
604
+				{
605
+					$params['private_grants'][] = $user;
606
+				}
577 607
 			}
578 608
 		}
579 609
 
@@ -588,7 +618,10 @@  discard block
 block discarded – undo
588 618
 		{
589 619
 			return false;
590 620
 		}
591
-		if (isset($params['start'])) $start = $this->date2ts($params['start']);
621
+		if (isset($params['start']))
622
+		{
623
+			$start = $this->date2ts($params['start']);
624
+		}
592 625
 
593 626
 		if (isset($params['end']))
594 627
 		{
@@ -652,10 +685,13 @@  discard block
 block discarded – undo
652 685
 				$this->debug_message('socalendar::search daywise sorting from %1 to %2 of %3',False,$start,$end,$events);
653 686
 			}
654 687
 			// create empty entries for each day in the reported time
655
-			for($ts = $start; $ts <= $end; $ts += DAY_s) // good enough for array creation, but see while loop below.
688
+			for($ts = $start; $ts <= $end; $ts += DAY_s)
689
+			{
690
+				// good enough for array creation, but see while loop below.
656 691
 			{
657 692
 				$daysEvents[$this->date2string($ts)] = array();
658 693
 			}
694
+			}
659 695
 			foreach($events as $k => $event)
660 696
 			{
661 697
 				$e_start = max($this->date2ts($event['start']),$start);
@@ -707,7 +743,10 @@  discard block
 block discarded – undo
707 743
 			$integration_data = calendar_so::get_integration_data();
708 744
 		}
709 745
 
710
-		if (!isset($integration_data[$app])) return null;
746
+		if (!isset($integration_data[$app]))
747
+		{
748
+			return null;
749
+		}
711 750
 
712 751
 		return $part ? $integration_data[$app][$part] : $integration_data[$app];
713 752
 	}
@@ -754,8 +793,14 @@  discard block
 block discarded – undo
754 793
 	 */
755 794
 	function clear_private_infos(&$event,$allowed_participants = array())
756 795
 	{
757
-		if ($event == false) return;
758
-		if (!is_array($event['participants'])) error_log(__METHOD__.'('.array2string($event).', '.array2string($allowed_participants).') NO PARTICIPANTS '.function_backtrace());
796
+		if ($event == false)
797
+		{
798
+			return;
799
+		}
800
+		if (!is_array($event['participants']))
801
+		{
802
+			error_log(__METHOD__.'('.array2string($event).', '.array2string($allowed_participants).') NO PARTICIPANTS '.function_backtrace());
803
+		}
759 804
 
760 805
 		$event = array(
761 806
 			'id'    => $event['id'],
@@ -800,19 +845,29 @@  discard block
 block discarded – undo
800 845
 		}
801 846
 		$new_horizont = $this->date2ts($_new_horizont,true);	// now we are in server-time, where this function operates
802 847
 
803
-		if ($new_horizont <= $this->config['horizont'])	// no move necessary
848
+		if ($new_horizont <= $this->config['horizont'])
849
+		{
850
+			// no move necessary
804 851
 		{
805 852
 			if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 is bigger ==> nothing to do',true,$new_horizont,(int)$this->config['horizont']);
853
+		}
806 854
 			return;
807 855
 		}
808 856
 		if (!empty($GLOBALS['egw_info']['server']['calendar_horizont']))
809 857
 		{
810 858
 			$maxdays = abs($GLOBALS['egw_info']['server']['calendar_horizont']);
811 859
 		}
812
-		if (empty($maxdays)) $maxdays = 1000; // old default
813
-		if ($new_horizont > time()+$maxdays*DAY_s)		// some user tries to "look" more then the maximum number of days in the future
860
+		if (empty($maxdays))
861
+		{
862
+			$maxdays = 1000;
863
+		}
864
+		// old default
865
+		if ($new_horizont > time()+$maxdays*DAY_s)
866
+		{
867
+			// some user tries to "look" more then the maximum number of days in the future
814 868
 		{
815 869
 			if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 new horizont more then %3 days from now --> ignoring it',true,$new_horizont,(int)$this->config['horizont'],$maxdays);
870
+		}
816 871
 			$this->warnings['horizont'] = lang('Requested date %1 outside allowed range of %2 days: recurring events obmitted!', Api\DateTime::to($new_horizont,true), $maxdays);
817 872
 			return;
818 873
 		}
@@ -840,7 +895,10 @@  discard block
 block discarded – undo
840 895
 		// update the horizont
841 896
 		Api\Config::save_value('horizont',$this->config['horizont'],'calendar');
842 897
 
843
-		if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting',true,$new_horizont,(int)$this->config['horizont']);
898
+		if ($this->debug == 'check_move_horizont')
899
+		{
900
+			$this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting',true,$new_horizont,(int)$this->config['horizont']);
901
+		}
844 902
 	}
845 903
 
846 904
 	/**
@@ -871,7 +929,10 @@  discard block
 block discarded – undo
871 929
 				$event['end'] = $event_read['end'];
872 930
 			}
873 931
 		}
874
-		if (!$start) $start = $event['start'];
932
+		if (!$start)
933
+		{
934
+			$start = $event['start'];
935
+		}
875 936
 
876 937
 		$events = array();
877 938
 		$this->insert_all_recurrences($event,$start,$this->date2usertime($this->config['horizont']),$events);
@@ -911,7 +972,10 @@  discard block
 block discarded – undo
911 972
 	 */
912 973
 	function db2data(&$events,$date_format='ts')
913 974
 	{
914
-		if (!is_array($events)) echo "<p>calendar_bo::db2data(\$events,$date_format) \$events is no array<br />\n".function_backtrace()."</p>\n";
975
+		if (!is_array($events))
976
+		{
977
+			echo "<p>calendar_bo::db2data(\$events,$date_format) \$events is no array<br />\n".function_backtrace()."</p>\n";
978
+		}
915 979
 		foreach ($events as &$event)
916 980
 		{
917 981
 			// convert timezone id of event to tzid (iCal id like 'Europe/Berlin')
@@ -995,7 +1059,10 @@  discard block
 block discarded – undo
995 1059
 	 */
996 1060
 	function date2usertime($ts,$date_format='ts')
997 1061
 	{
998
-		if (empty($ts) || $date_format == 'server') return $ts;
1062
+		if (empty($ts) || $date_format == 'server')
1063
+		{
1064
+			return $ts;
1065
+		}
999 1066
 
1000 1067
 		return Api\DateTime::server2user($ts,$date_format);
1001 1068
 	}
@@ -1013,9 +1080,15 @@  discard block
 block discarded – undo
1013 1080
 	 */
1014 1081
 	function read($ids,$date=null,$ignore_acl=False,$date_format='ts',$clear_private_infos_users=null)
1015 1082
 	{
1016
-		if (!$ids) return false;
1083
+		if (!$ids)
1084
+		{
1085
+			return false;
1086
+		}
1017 1087
 
1018
-		if ($date) $date = $this->date2ts($date);
1088
+		if ($date)
1089
+		{
1090
+			$date = $this->date2ts($date);
1091
+		}
1019 1092
 
1020 1093
 		$return = null;
1021 1094
 
@@ -1180,7 +1253,10 @@  discard block
 block discarded – undo
1180 1253
 	{
1181 1254
 		static $res_info_cache = array();
1182 1255
 
1183
-		if (!is_scalar($uid)) throw new Api\Exception\WrongParameter(__METHOD__.'('.array2string($uid).') parameter must be scalar');
1256
+		if (!is_scalar($uid))
1257
+		{
1258
+			throw new Api\Exception\WrongParameter(__METHOD__.'('.array2string($uid).') parameter must be scalar');
1259
+		}
1184 1260
 
1185 1261
 		if (!isset($res_info_cache[$uid]))
1186 1262
 		{
@@ -1235,7 +1311,10 @@  discard block
 block discarded – undo
1235 1311
 	 */
1236 1312
 	function check_perms($needed,$event=0,$other=0,$date_format='ts',$date_to_read=null,$user=null)
1237 1313
 	{
1238
-		if (!$user) $user = $this->user;
1314
+		if (!$user)
1315
+		{
1316
+			$user = $this->user;
1317
+		}
1239 1318
 		if ($user == $this->user)
1240 1319
 		{
1241 1320
 			$grants = $this->grants;
@@ -1274,7 +1353,10 @@  discard block
 block discarded – undo
1274 1353
 		$grant = $grants[$owner];
1275 1354
 
1276 1355
 		// now any ACL rights (but invite rights!) implicate FREEBUSY rights (at least READ has to include FREEBUSY)
1277
-		if ($grant & ~self::ACL_INVITE) $grant |= self::ACL_FREEBUSY;
1356
+		if ($grant & ~self::ACL_INVITE)
1357
+		{
1358
+			$grant |= self::ACL_FREEBUSY;
1359
+		}
1278 1360
 
1279 1361
 		if (is_array($event) && ($needed == Acl::READ || $needed == self::ACL_FREEBUSY))
1280 1362
 		{
@@ -1300,7 +1382,10 @@  discard block
 block discarded – undo
1300 1382
 					elseif (!is_numeric($uid))
1301 1383
 					{
1302 1384
 						// if the owner only grants self::ACL_FREEBUSY we are not interested in the recources explicit rights
1303
-						if ($grant == self::ACL_FREEBUSY) continue;
1385
+						if ($grant == self::ACL_FREEBUSY)
1386
+						{
1387
+							continue;
1388
+						}
1304 1389
 						// if we have a resource as participant
1305 1390
 						$resource = $this->resource_info($uid);
1306 1391
 						$grant |= $resource['rights'];
@@ -1451,14 +1536,20 @@  discard block
 block discarded – undo
1451 1536
 						$param = $param ? 'True' : 'False';
1452 1537
 						break;
1453 1538
 					case 'integer':
1454
-						if ($param >= mktime(0,0,0,1,1,2000)) $param = adodb_date('Y-m-d H:i:s',$param)." ($param)";
1539
+						if ($param >= mktime(0,0,0,1,1,2000))
1540
+						{
1541
+							$param = adodb_date('Y-m-d H:i:s',$param)." ($param)";
1542
+						}
1455 1543
 						break;
1456 1544
 				}
1457 1545
 			}
1458 1546
 			$msg = str_replace('%'.($i-1),$param,$msg);
1459 1547
 		}
1460 1548
 		error_log($msg);
1461
-		if ($backtrace) error_log(function_backtrace(1));
1549
+		if ($backtrace)
1550
+		{
1551
+			error_log(function_backtrace(1));
1552
+		}
1462 1553
 	}
1463 1554
 
1464 1555
 	/**
@@ -1566,14 +1657,20 @@  discard block
 block discarded – undo
1566 1657
 	function timespan($start_m,$end_m,$both=false)
1567 1658
 	{
1568 1659
 		$duration = $end_m - $start_m;
1569
-		if ($end_m == 24*60-1) ++$duration;
1660
+		if ($end_m == 24*60-1)
1661
+		{
1662
+			++$duration;
1663
+		}
1570 1664
 		$duration = floor($duration/60).lang('h').($duration%60 ? $duration%60 : '');
1571 1665
 
1572 1666
 		$timespan = $t = Api\DateTime::to('20000101T'.sprintf('%02d',$start_m/60).sprintf('%02d',$start_m%60).'00', false);
1573 1667
 
1574
-		if ($both)	// end-time too
1668
+		if ($both)
1669
+		{
1670
+			// end-time too
1575 1671
 		{
1576 1672
 			$timespan .= ' - '.Api\DateTime::to('20000101T'.sprintf('%02d',$end_m/60).sprintf('%02d',$end_m%60).'00', false);
1673
+		}
1577 1674
 			// dont double am/pm if they are the same in both times
1578 1675
 			if ($this->common_prefs['timeformat'] == 12 && substr($timespan,-2) == substr($t,-2))
1579 1676
 			{
@@ -1597,7 +1694,10 @@  discard block
 block discarded – undo
1597 1694
 		static $id2lid = array();
1598 1695
 		static $id2email = array();
1599 1696
 
1600
-		if ($use_type && $use_type != 'u') $id = $use_type.$id;
1697
+		if ($use_type && $use_type != 'u')
1698
+		{
1699
+			$id = $use_type.$id;
1700
+		}
1601 1701
 
1602 1702
 		if (!isset($id2lid[$id]))
1603 1703
 		{
@@ -1607,7 +1707,10 @@  discard block
 block discarded – undo
1607 1707
 				if (($info = $this->resource_info($id)))
1608 1708
 				{
1609 1709
 					$id2lid[$id] = $info['name'] ? $info['name'] : $info['email'];
1610
-					if ($info['name']) $id2email[$id] = $info['email'];
1710
+					if ($info['name'])
1711
+					{
1712
+						$id2email[$id] = $info['email'];
1713
+					}
1611 1714
 				}
1612 1715
 			}
1613 1716
 			else
@@ -1633,11 +1736,18 @@  discard block
 block discarded – undo
1633 1736
 		$names = array();
1634 1737
 		foreach((array)$event['participants'] as $id => $status)
1635 1738
 		{
1636
-			if (!is_string($status)) continue;
1739
+			if (!is_string($status))
1740
+			{
1741
+				continue;
1742
+			}
1637 1743
 			$quantity = $role = null;
1638 1744
 			calendar_so::split_status($status,$quantity,$role);
1639 1745
 
1640
-			if ($status == 'G' && !$show_group_invitation) continue;	// dont show group-invitation
1746
+			if ($status == 'G' && !$show_group_invitation)
1747
+			{
1748
+				continue;
1749
+			}
1750
+			// dont show group-invitation
1641 1751
 
1642 1752
 			$lang_status = lang($this->verbose_status[$status]);
1643 1753
 			if (!$long_status)
@@ -1710,7 +1820,10 @@  discard block
 block discarded – undo
1710 1820
 
1711 1821
 		foreach(explode(',',$category) as $cat_id)
1712 1822
 		{
1713
-			if (!$cat_id) continue;
1823
+			if (!$cat_id)
1824
+			{
1825
+				continue;
1826
+			}
1714 1827
 
1715 1828
 			if (!isset($id2cat[$cat_id]))
1716 1829
 			{
@@ -1776,7 +1889,10 @@  discard block
 block discarded – undo
1776 1889
 	 */
1777 1890
 	public static function list_calendars($user, array $grants=null)
1778 1891
 	{
1779
-		if (is_null($grants)) $grants = $GLOBALS['egw']->acl->get_grants('calendar', true, $user);
1892
+		if (is_null($grants))
1893
+		{
1894
+			$grants = $GLOBALS['egw']->acl->get_grants('calendar', true, $user);
1895
+		}
1780 1896
 
1781 1897
 		$users = $groups = array();
1782 1898
 		foreach(array_keys($grants) as $id)
@@ -1824,7 +1940,10 @@  discard block
 block discarded – undo
1824 1940
 	 */
1825 1941
 	function recure2string($event)
1826 1942
 	{
1827
-		if (!is_array($event)) return false;
1943
+		if (!is_array($event))
1944
+		{
1945
+			return false;
1946
+		}
1828 1947
 		return (string)calendar_rrule::event2rrule($event);
1829 1948
 	}
1830 1949
 
@@ -1843,12 +1962,18 @@  discard block
 block discarded – undo
1843 1962
 	 */
1844 1963
 	function read_holidays($year=0)
1845 1964
 	{
1846
-		if (!$year) $year = (int) date('Y',$this->now_su);
1965
+		if (!$year)
1966
+		{
1967
+			$year = (int) date('Y',$this->now_su);
1968
+		}
1847 1969
 
1848
-		if (!$this->cached_holidays)	// try reading the holidays from the session
1970
+		if (!$this->cached_holidays)
1971
+		{
1972
+			// try reading the holidays from the session
1849 1973
 		{
1850 1974
 			$this->cached_holidays = Api\Cache::getSession('calendar', 'holidays');
1851 1975
 		}
1976
+		}
1852 1977
 		if (!isset($this->cached_holidays[$year]))
1853 1978
 		{
1854 1979
 			$this->cached_holidays[$year] = calendar_holidays::read(
@@ -1891,7 +2016,11 @@  discard block
 block discarded – undo
1891 2016
 							continue;
1892 2017
 						}
1893 2018
 						list($y,$m,$d) = explode('-',$pers['bday']);
1894
-						if ($y > $year) continue; 	// not yet born
2019
+						if ($y > $year)
2020
+						{
2021
+							continue;
2022
+						}
2023
+						// not yet born
1895 2024
 						$this->cached_holidays[$year][sprintf('%04d%02d%02d',$year,$m,$d)][] = array(
1896 2025
 							'day'       => $d,
1897 2026
 							'month'     => $m,
@@ -1984,7 +2113,10 @@  discard block
 block discarded – undo
1984 2113
 				}
1985 2114
 			}
1986 2115
 			$str_fields = implode(', ',$extra_fields);
1987
-			if (is_array($extra_fields)) return $this->format_date($event['start']) . ': ' . $event['title'] . ($str_fields? ', ' . $str_fields:'');
2116
+			if (is_array($extra_fields))
2117
+			{
2118
+				return $this->format_date($event['start']) . ': ' . $event['title'] . ($str_fields? ', ' . $str_fields:'');
2119
+			}
1988 2120
 		}
1989 2121
 		return $this->format_date($event['start']) . ': ' . $event['title'];
1990 2122
 	}
@@ -2005,7 +2137,8 @@  discard block
 block discarded – undo
2005 2137
 			'offset' =>	$options['start'],
2006 2138
 			'order' => 'cal_start DESC',
2007 2139
 		);
2008
-		if($options['num_rows']) {
2140
+		if($options['num_rows'])
2141
+		{
2009 2142
 			$query['num_rows'] = $options['num_rows'];
2010 2143
 		}
2011 2144
 		foreach((array) $this->search($query) as $event)
@@ -2066,7 +2199,10 @@  discard block
 block discarded – undo
2066 2199
 			if ((!isset($default_prefs[$var]) || (string)$default_prefs[$var] === '') && (!isset($forced_prefs[$var]) || (string)$forced_prefs[$var] === ''))
2067 2200
 			{
2068 2201
 				$GLOBALS['egw']->preferences->add('calendar',$var,$default,'default');	// always store default, even if we have a forced too
2069
-				if ($type == 'forced') $GLOBALS['egw']->preferences->add('calendar',$var,$default,'forced');
2202
+				if ($type == 'forced')
2203
+				{
2204
+					$GLOBALS['egw']->preferences->add('calendar',$var,$default,'forced');
2205
+				}
2070 2206
 				$this->cal_prefs[$var] = $default;
2071 2207
 				$need_save = True;
2072 2208
 			}
@@ -2086,7 +2222,10 @@  discard block
 block discarded – undo
2086 2222
 	 */
2087 2223
 	static function freebusy_url($user='',$pw=null)
2088 2224
 	{
2089
-		if (is_numeric($user)) $user = $GLOBALS['egw']->accounts->id2name($user);
2225
+		if (is_numeric($user))
2226
+		{
2227
+			$user = $GLOBALS['egw']->accounts->id2name($user);
2228
+		}
2090 2229
 
2091 2230
 		$credentials = '';
2092 2231
 
@@ -2154,13 +2293,19 @@  discard block
 block discarded – undo
2154 2293
 	 */
2155 2294
 	public function get_ctag($user, $filter='owner', $master_only=false)
2156 2295
 	{
2157
-		if ($this->debug > 1) $startime = microtime(true);
2296
+		if ($this->debug > 1)
2297
+		{
2298
+			$startime = microtime(true);
2299
+		}
2158 2300
 
2159 2301
 		// resolve users to add memberships for users and members for groups
2160 2302
 		$users = $this->resolve_users($user);
2161 2303
 		$ctag = $users ? $this->so->get_ctag($users, $filter == 'owner', $master_only) : 0;	// no rights, return 0 as ctag (otherwise we get SQL error!)
2162 2304
 
2163
-		if ($this->debug > 1) error_log(__METHOD__. "($user, '$filter', $master_only) = $ctag = ".date('Y-m-d H:i:s',$ctag)." took ".(microtime(true)-$startime)." secs");
2305
+		if ($this->debug > 1)
2306
+		{
2307
+			error_log(__METHOD__. "($user, '$filter', $master_only) = $ctag = ".date('Y-m-d H:i:s',$ctag)." took ".(microtime(true)-$startime)." secs");
2308
+		}
2164 2309
 		return $ctag;
2165 2310
 	}
2166 2311
 
@@ -2202,15 +2347,21 @@  discard block
 block discarded – undo
2202 2347
 				$content['link_app'][] = $link['app'];
2203 2348
 				$content['link_id'][]  = $link['id'];
2204 2349
 			}
2205
-			if ($link['app'] == 'addressbook')	// prefering contact as primary contact over calendar entry set above
2350
+			if ($link['app'] == 'addressbook')
2351
+			{
2352
+				// prefering contact as primary contact over calendar entry set above
2206 2353
 			{
2207 2354
 				$content['info_contact'] = 'addressbook:'.$link['id'];
2208 2355
 			}
2356
+			}
2209 2357
 		}
2210 2358
 		// Copy same custom fields
2211 2359
 		foreach(array_keys(Api\Storage\Customfields::get('infolog')) as $name)
2212 2360
 		{
2213
-			if ($this->customfields[$name]) $content['#'.$name] = $calendar['#'.$name];
2361
+			if ($this->customfields[$name])
2362
+			{
2363
+				$content['#'.$name] = $calendar['#'.$name];
2364
+			}
2214 2365
 		}
2215 2366
 		//error_log(__METHOD__.'('.array2string($data).') calendar='.array2string($calendar).' returning '.array2string($content));
2216 2367
 		return $content;
@@ -2233,7 +2384,11 @@  discard block
 block discarded – undo
2233 2384
 			$set['ts_title'] = $this->link_title($event);
2234 2385
 			$set['start_time'] = Api\DateTime::to($event['start'],'H:i');
2235 2386
 			$set['ts_description'] = $event['description'];
2236
-			if ($this->isWholeDay($event)) $event['end']++;	// whole day events are 1sec short
2387
+			if ($this->isWholeDay($event))
2388
+			{
2389
+				$event['end']++;
2390
+			}
2391
+			// whole day events are 1sec short
2237 2392
 			$set['ts_duration']	= ($event['end'] - $event['start']) / 60;
2238 2393
 			$set['ts_quantity'] = ($event['end'] - $event['start']) / 3600;
2239 2394
 			$set['end_time'] = null;	// unset end-time
Please login to merge, or discard this patch.