Completed
Push — 14.2 ( e07840...cec2da )
by Ralf
83:18 queued 52:04
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   +20 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,7 +33,10 @@  discard block
 block discarded – undo
33 33
 		$homepath = '/home/'.$GLOBALS['egw_info']['user']['account_lid'];
34 34
 		//echo "<p>admin_prefs_sidebox_hooks::all_hooks(".print_r($args,True).") appname='$appname', location='$location'</p>\n";
35 35
 		$config = config::read(self::$appname);
36
-		if (!empty($config['max_folderlinks'])) self::$foldercount = (int)$config['max_folderlinks'];
36
+		if (!empty($config['max_folderlinks']))
37
+		{
38
+			self::$foldercount = (int)$config['max_folderlinks'];
39
+		}
37 40
 		$file_prefs    = &$GLOBALS['egw_info']['user']['preferences'][self::$appname];
38 41
 		if ($location == 'sidebox_menu')
39 42
 		{
@@ -75,7 +78,10 @@  discard block
 block discarded – undo
75 78
 			{
76 79
 				$file['Basedirectory'] = egw::link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$rootpath,'ajax'=>'true'));
77 80
 			}
78
-			if (!empty($file_prefs['startfolder'])) $file['Startfolder']= egw::link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$file_prefs['startfolder'],'ajax'=>'true'));
81
+			if (!empty($file_prefs['startfolder']))
82
+			{
83
+				$file['Startfolder']= egw::link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$file_prefs['startfolder'],'ajax'=>'true'));
84
+			}
79 85
 			for ($i=1; $i<=self::$foldercount; $i++)
80 86
 			{
81 87
 				if (!empty($file_prefs['folderlink'.$i]))
@@ -93,7 +99,10 @@  discard block
 block discarded – undo
93 99
 			$file['Shared files'] = egw::link('/index.php','menuaction=filemanager.filemanager_shares.index&ajax=true');
94 100
 			display_sidebox(self::$appname,$title,$file);
95 101
 		}
96
-		if ($GLOBALS['egw_info']['user']['apps']['admin']) self::admin(self::$appname);
102
+		if ($GLOBALS['egw_info']['user']['apps']['admin'])
103
+		{
104
+			self::admin(self::$appname);
105
+		}
97 106
 	}
98 107
 
99 108
 	/**
@@ -103,7 +112,10 @@  discard block
 block discarded – undo
103 112
 	 */
104 113
 	static function admin($location = 'admin')
105 114
 	{
106
-		if (is_array($location)) $location = $location['location'];
115
+		if (is_array($location))
116
+		{
117
+			$location = $location['location'];
118
+		}
107 119
 
108 120
 		$file = Array(
109 121
 			'Site Configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname='.self::$appname),
@@ -129,7 +141,10 @@  discard block
 block discarded – undo
129 141
 	static function settings()
130 142
 	{
131 143
 		$config = config::read(self::$appname);
132
-		if (!empty($config['max_folderlinks'])) self::$foldercount = (int)$config['max_folderlinks'];
144
+		if (!empty($config['max_folderlinks']))
145
+		{
146
+			self::$foldercount = (int)$config['max_folderlinks'];
147
+		}
133 148
 
134 149
 		$yes_no = array(
135 150
 			'no'  => lang('No'),
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_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   +80 added lines, -34 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
 							}
@@ -158,7 +171,8 @@  discard block
 block discarded – undo
158 171
 						}
159 172
 					}
160 173
 				}
161
-				if($id) {
174
+				if($id)
175
+				{
162 176
 					$p_participants[$id] = calendar_so::combine_status(
163 177
 						$this->status_map[lang($status[$key])] ? $this->status_map[lang($status[$key])] : $status[$key][0],
164 178
 						$quantity[$key] ? $quantity[$key] : 1,
@@ -187,27 +201,38 @@  discard block
 block discarded – undo
187 201
 		}
188 202
 		$record->tzid = calendar_timezones::id2tz($record->tz_id);
189 203
 
190
-		if ( $options['conditions'] ) {
191
-			foreach ( $options['conditions'] as $condition ) {
204
+		if ( $options['conditions'] )
205
+		{
206
+			foreach ( $options['conditions'] as $condition )
207
+			{
192 208
 				$records = array();
193
-				switch ( $condition['type'] ) {
209
+				switch ( $condition['type'] )
210
+				{
194 211
 					// exists
195 212
 					case 'exists' :
196 213
 						// Check for that record
197 214
 						$result = $this->exists($record, $condition, $records);
198 215
 
199
-						if ( is_array( $records ) && count( $records ) >= 1) {
216
+						if ( is_array( $records ) && count( $records ) >= 1)
217
+						{
200 218
 							// apply action to all records matching this exists condition
201 219
 							$action = $condition['true'];
202
-							foreach ( (array)$records as $event ) {
220
+							foreach ( (array)$records as $event )
221
+							{
203 222
 								$record->id = $event['id'];
204
-								if ( $this->definition->plugin_options['update_cats'] == 'add' ) {
205
-									if ( !is_array( $record->category ) ) $record->category = explode( ',', $record->category );
223
+								if ( $this->definition->plugin_options['update_cats'] == 'add' )
224
+								{
225
+									if ( !is_array( $record->category ) )
226
+									{
227
+										$record->category = explode( ',', $record->category );
228
+									}
206 229
 									$record->category = implode( ',', array_unique( array_merge( $record->category, $event['category'] ) ) );
207 230
 								}
208 231
 								$success = $this->action(  $action['action'], $record, $import_csv->get_current_position() );
209 232
 							}
210
-						} else {
233
+						}
234
+						else
235
+						{
211 236
 							$action = $condition['false'];
212 237
 							$success = ($this->action(  $action['action'], $record, $import_csv->get_current_position() ));
213 238
 						}
@@ -218,9 +243,14 @@  discard block
 block discarded – undo
218 243
 						die('condition / action not supported!!!');
219 244
 						break;
220 245
 				}
221
-				if ($action['last']) break;
246
+				if ($action['last'])
247
+				{
248
+					break;
249
+				}
222 250
 			}
223
-		} else {
251
+		}
252
+		else
253
+		{
224 254
 			// unconditional insert
225 255
 			$success = $this->action( 'insert', $record, $import_csv->get_current_position() );
226 256
 		}
@@ -239,12 +269,14 @@  discard block
 block discarded – undo
239 269
 	 */
240 270
 	protected function exists(importexport_iface_egw_record &$record, Array &$condition, &$records = array())
241 271
 	{
242
-		if($record->__get($condition['string']) && $condition['string'] == 'id') {
272
+		if($record->__get($condition['string']) && $condition['string'] == 'id')
273
+		{
243 274
 			$event = $this->bo->read($record->__get($condition['string']));
244 275
 			$records = array($event);
245 276
 		}
246 277
 
247
-		if ( is_array( $records ) && count( $records ) >= 1) {
278
+		if ( is_array( $records ) && count( $records ) >= 1)
279
+		{
248 280
 			return true;
249 281
 		}
250 282
 		return false;
@@ -260,7 +292,8 @@  discard block
 block discarded – undo
260 292
 	protected function action ( $_action, importexport_iface_egw_record &$record, $record_num = 0 )
261 293
 	{
262 294
 		$_data = $record->get_record_array();
263
-		switch ($_action) {
295
+		switch ($_action)
296
+		{
264 297
 			case 'none' :
265 298
 				return true;
266 299
 			case 'update' :
@@ -268,7 +301,8 @@  discard block
 block discarded – undo
268 301
 				$old = $this->bo->read($_data['id']);
269 302
 
270 303
 				// Don't change a user account into a record
271
-				if(!$this->definition->plugin_options['change_owner']) {
304
+				if(!$this->definition->plugin_options['change_owner'])
305
+				{
272 306
 					// Don't change owner of an existing record
273 307
 					unset($_data['owner']);
274 308
 				}
@@ -276,31 +310,40 @@  discard block
 block discarded – undo
276 310
 				// Merge to deal with fields not in import record
277 311
 				$_data = array_merge($old, $_data);
278 312
 				$changed = $this->tracking->changed_fields($_data, $old);
279
-				if(count($changed) == 0) {
313
+				if(count($changed) == 0)
314
+				{
280 315
 					return true;
281 316
 				}
282 317
 				// Fall through
283 318
 			case 'insert' :
284
-				if($_action == 'insert') {
319
+				if($_action == 'insert')
320
+				{
285 321
 					// Backend doesn't like inserting with ID specified, can overwrite existing
286 322
 					unset($_data['id']);
287 323
 				}
288 324
 				// Make sure participants are set
289
-				if(!$_data['participants']) {
325
+				if(!$_data['participants'])
326
+				{
290 327
 					$user = $_data['owner'] ? $_data['owner'] : $this->user;
291 328
 					$_data['participants'] = array(
292 329
 						$user => 'U'
293 330
 					);
294 331
 				}
295
-				if ( $this->dry_run ) {
332
+				if ( $this->dry_run )
333
+				{
296 334
 					//print_r($_data);
297 335
 					$this->results[$_action]++;
298 336
 					return true;
299
-				} else {
337
+				}
338
+				else
339
+				{
300 340
 					$result = $this->bo->save( $_data, $this->is_admin);
301
-					if(!$result) {
341
+					if(!$result)
342
+					{
302 343
 						$this->errors[$record_num] = lang('Unable to save');
303
-					} else {
344
+					}
345
+					else
346
+					{
304 347
 						$this->results[$_action]++;
305 348
 						// This does nothing (yet?) but update the identifier
306 349
 						$record->save($result);
@@ -318,7 +361,8 @@  discard block
 block discarded – undo
318 361
 	 *
319 362
 	 * @return string name
320 363
 	 */
321
-	public static function get_name() {
364
+	public static function get_name()
365
+	{
322 366
 		return lang('Calendar CSV import');
323 367
 	}
324 368
 
@@ -327,7 +371,8 @@  discard block
 block discarded – undo
327 371
 	 *
328 372
 	 * @return string descriprion
329 373
 	 */
330
-	public static function get_description() {
374
+	public static function get_description()
375
+	{
331 376
 		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.");
332 377
 	}
333 378
 
@@ -336,7 +381,8 @@  discard block
 block discarded – undo
336 381
 	 *
337 382
 	 * @return string suffix (comma seperated)
338 383
 	 */
339
-	public static function get_filesuffix() {
384
+	public static function get_filesuffix()
385
+	{
340 386
 		return 'csv';
341 387
 	}
342 388
 
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   +202 added lines, -50 removed lines patch added patch discarded remove patch
@@ -11,10 +11,13 @@  discard block
 block discarded – undo
11 11
  * @version $Id$
12 12
  */
13 13
 
14
-if (!defined('ACL_TYPE_IDENTIFER'))	// used to mark ACL-values for the debug_message methode
14
+if (!defined('ACL_TYPE_IDENTIFER'))
15
+{
16
+	// used to mark ACL-values for the debug_message methode
15 17
 {
16 18
 	define('ACL_TYPE_IDENTIFER','***ACL***');
17 19
 }
20
+}
18 21
 
19 22
 define('HOUR_s',60*60);
20 23
 define('DAY_s',24*HOUR_s);
@@ -225,7 +228,10 @@  discard block
 block discarded – undo
225 228
 	 */
226 229
 	function __construct()
227 230
 	{
228
-		if ($this->debug > 0) $this->debug_message('calendar_bo::bocal() started',True);
231
+		if ($this->debug > 0)
232
+		{
233
+			$this->debug_message('calendar_bo::bocal() started',True);
234
+		}
229 235
 
230 236
 		$this->so = new calendar_so();
231 237
 		$this->datetime = $GLOBALS['egw']->datetime;
@@ -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)
@@ -382,22 +391,31 @@  discard block
 block discarded – undo
382 391
 			$user = trim($user);
383 392
 			if ($ignore_acl || $this->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|($use_freebusy?EGW_ACL_FREEBUSY:0),0,$user))
384 393
 			{
385
-				if ($user && !in_array($user,$users))	// already added?
394
+				if ($user && !in_array($user,$users))
395
+				{
396
+					// already added?
386 397
 				{
387 398
 					$users[] = $user;
388 399
 				}
400
+				}
389 401
 			}
390 402
 			elseif ($GLOBALS['egw']->accounts->get_type($user) != 'g')
391 403
 			{
392 404
 				continue;	// for non-groups (eg. users), we stop here if we have no read-rights
393 405
 			}
394 406
 			// the further code is only for real users
395
-			if (!is_numeric($user)) continue;
407
+			if (!is_numeric($user))
408
+			{
409
+				continue;
410
+			}
396 411
 
397 412
 			// for groups we have to include the members
398 413
 			if ($GLOBALS['egw']->accounts->get_type($user) == 'g')
399 414
 			{
400
-				if ($no_enum_groups) continue;
415
+				if ($no_enum_groups)
416
+				{
417
+					continue;
418
+				}
401 419
 
402 420
 				$members = $GLOBALS['egw']->accounts->member($user);
403 421
 				if (is_array($members))
@@ -477,11 +495,14 @@  discard block
 block discarded – undo
477 495
 		}
478 496
 
479 497
 		if (!isset($params['users']) || !$params['users'] ||
480
-			count($params['users']) == 1 && isset($params['users'][0]) && !$params['users'][0])	// null or '' casted to an array
498
+			count($params['users']) == 1 && isset($params['users'][0]) && !$params['users'][0])
499
+		{
500
+			// null or '' casted to an array
481 501
 		{
482 502
 			// for a search use all account you have read grants from
483 503
 			$params['users'] = $params['query'] ? array_keys($this->grants) : $this->user;
484 504
 		}
505
+		}
485 506
 		// resolve users to add memberships for users and members for groups
486 507
 		// for search, do NOT use freebusy rights, as it would allow to probe the content of event entries
487 508
 		$users = $this->resolve_users($params['users'], $params['filter'] == 'no-enum-groups', $params['ignore_acl'], empty($params['query']));
@@ -492,7 +513,10 @@  discard block
 block discarded – undo
492 513
 			$params['private_grants'] = array();
493 514
 			foreach($this->grants as $user => $rights)
494 515
 			{
495
-				if ($rights & EGW_ACL_PRIVATE) $params['private_grants'][] = $user;
516
+				if ($rights & EGW_ACL_PRIVATE)
517
+				{
518
+					$params['private_grants'][] = $user;
519
+				}
496 520
 			}
497 521
 		}
498 522
 
@@ -507,7 +531,10 @@  discard block
 block discarded – undo
507 531
 		{
508 532
 			return false;
509 533
 		}
510
-		if (isset($params['start'])) $start = $this->date2ts($params['start']);
534
+		if (isset($params['start']))
535
+		{
536
+			$start = $this->date2ts($params['start']);
537
+		}
511 538
 
512 539
 		if (isset($params['end']))
513 540
 		{
@@ -571,10 +598,13 @@  discard block
 block discarded – undo
571 598
 				$this->debug_message('socalendar::search daywise sorting from %1 to %2 of %3',False,$start,$end,$events);
572 599
 			}
573 600
 			// create empty entries for each day in the reported time
574
-			for($ts = $start; $ts <= $end; $ts += DAY_s) // good enough for array creation, but see while loop below.
601
+			for($ts = $start; $ts <= $end; $ts += DAY_s)
602
+			{
603
+				// good enough for array creation, but see while loop below.
575 604
 			{
576 605
 				$daysEvents[$this->date2string($ts)] = array();
577 606
 			}
607
+			}
578 608
 			foreach($events as $k => $event)
579 609
 			{
580 610
 				$e_start = max($this->date2ts($event['start']),$start);
@@ -626,7 +656,10 @@  discard block
 block discarded – undo
626 656
 			$integration_data = calendar_so::get_integration_data();
627 657
 		}
628 658
 
629
-		if (!isset($integration_data[$app])) return null;
659
+		if (!isset($integration_data[$app]))
660
+		{
661
+			return null;
662
+		}
630 663
 
631 664
 		return $part ? $integration_data[$app][$part] : $integration_data[$app];
632 665
 	}
@@ -673,8 +706,14 @@  discard block
 block discarded – undo
673 706
 	 */
674 707
 	function clear_private_infos(&$event,$allowed_participants = array())
675 708
 	{
676
-		if ($event == false) return;
677
-		if (!is_array($event['participants'])) error_log(__METHOD__.'('.array2string($event).', '.array2string($allowed_participants).') NO PARTICIPANTS '.function_backtrace());
709
+		if ($event == false)
710
+		{
711
+			return;
712
+		}
713
+		if (!is_array($event['participants']))
714
+		{
715
+			error_log(__METHOD__.'('.array2string($event).', '.array2string($allowed_participants).') NO PARTICIPANTS '.function_backtrace());
716
+		}
678 717
 
679 718
 		$event = array(
680 719
 			'id'    => $event['id'],
@@ -719,19 +758,29 @@  discard block
 block discarded – undo
719 758
 		}
720 759
 		$new_horizont = $this->date2ts($_new_horizont,true);	// now we are in server-time, where this function operates
721 760
 
722
-		if ($new_horizont <= $this->config['horizont'])	// no move necessary
761
+		if ($new_horizont <= $this->config['horizont'])
762
+		{
763
+			// no move necessary
723 764
 		{
724 765
 			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']);
766
+		}
725 767
 			return;
726 768
 		}
727 769
 		if (!empty($GLOBALS['egw_info']['server']['calendar_horizont']))
728 770
 		{
729 771
 			$maxdays = abs($GLOBALS['egw_info']['server']['calendar_horizont']);
730 772
 		}
731
-		if (empty($maxdays)) $maxdays = 1000; // old default
732
-		if ($new_horizont > time()+$maxdays*DAY_s)		// some user tries to "look" more then the maximum number of days in the future
773
+		if (empty($maxdays))
774
+		{
775
+			$maxdays = 1000;
776
+		}
777
+		// old default
778
+		if ($new_horizont > time()+$maxdays*DAY_s)
779
+		{
780
+			// some user tries to "look" more then the maximum number of days in the future
733 781
 		{
734 782
 			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);
783
+		}
735 784
 			$this->warnings['horizont'] = lang('Requested date %1 outside allowed range of %2 days: recurring events obmitted!', egw_time::to($new_horizont,true), $maxdays);
736 785
 			return;
737 786
 		}
@@ -759,7 +808,10 @@  discard block
 block discarded – undo
759 808
 		// update the horizont
760 809
 		config::save_value('horizont',$this->config['horizont'],'calendar');
761 810
 
762
-		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']);
811
+		if ($this->debug == 'check_move_horizont')
812
+		{
813
+			$this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting',true,$new_horizont,(int)$this->config['horizont']);
814
+		}
763 815
 	}
764 816
 
765 817
 	/**
@@ -790,7 +842,10 @@  discard block
 block discarded – undo
790 842
 				$event['end'] = $event_read['end'];
791 843
 			}
792 844
 		}
793
-		if (!$start) $start = $event['start'];
845
+		if (!$start)
846
+		{
847
+			$start = $event['start'];
848
+		}
794 849
 
795 850
 		$events = array();
796 851
 		$this->insert_all_recurrences($event,$start,$this->date2usertime($this->config['horizont']),$events);
@@ -831,7 +886,10 @@  discard block
 block discarded – undo
831 886
 	 */
832 887
 	function db2data(&$events,$date_format='ts')
833 888
 	{
834
-		if (!is_array($events)) echo "<p>calendar_bo::db2data(\$events,$date_format) \$events is no array<br />\n".function_backtrace()."</p>\n";
889
+		if (!is_array($events))
890
+		{
891
+			echo "<p>calendar_bo::db2data(\$events,$date_format) \$events is no array<br />\n".function_backtrace()."</p>\n";
892
+		}
835 893
 		foreach ($events as &$event)
836 894
 		{
837 895
 			// convert timezone id of event to tzid (iCal id like 'Europe/Berlin')
@@ -915,7 +973,10 @@  discard block
 block discarded – undo
915 973
 	 */
916 974
 	function date2usertime($ts,$date_format='ts')
917 975
 	{
918
-		if (empty($ts) || $date_format == 'server') return $ts;
976
+		if (empty($ts) || $date_format == 'server')
977
+		{
978
+			return $ts;
979
+		}
919 980
 
920 981
 		return egw_time::server2user($ts,$date_format);
921 982
 	}
@@ -933,9 +994,15 @@  discard block
 block discarded – undo
933 994
 	 */
934 995
 	function read($ids,$date=null,$ignore_acl=False,$date_format='ts',$clear_private_infos_users=null)
935 996
 	{
936
-		if (!$ids) return false;
997
+		if (!$ids)
998
+		{
999
+			return false;
1000
+		}
937 1001
 
938
-		if ($date) $date = $this->date2ts($date);
1002
+		if ($date)
1003
+		{
1004
+			$date = $this->date2ts($date);
1005
+		}
939 1006
 
940 1007
 		$return = null;
941 1008
 
@@ -1100,7 +1167,10 @@  discard block
 block discarded – undo
1100 1167
 	{
1101 1168
 		static $res_info_cache = array();
1102 1169
 
1103
-		if (!is_scalar($uid)) throw new egw_exception_wrong_parameter(__METHOD__.'('.array2string($uid).') parameter must be scalar');
1170
+		if (!is_scalar($uid))
1171
+		{
1172
+			throw new egw_exception_wrong_parameter(__METHOD__.'('.array2string($uid).') parameter must be scalar');
1173
+		}
1104 1174
 
1105 1175
 		if (!isset($res_info_cache[$uid]))
1106 1176
 		{
@@ -1155,7 +1225,10 @@  discard block
 block discarded – undo
1155 1225
 	 */
1156 1226
 	function check_perms($needed,$event=0,$other=0,$date_format='ts',$date_to_read=null,$user=null)
1157 1227
 	{
1158
-		if (!$user) $user = $this->user;
1228
+		if (!$user)
1229
+		{
1230
+			$user = $this->user;
1231
+		}
1159 1232
 		if ($user == $this->user)
1160 1233
 		{
1161 1234
 			$grants = $this->grants;
@@ -1194,7 +1267,10 @@  discard block
 block discarded – undo
1194 1267
 		$grant = $grants[$owner];
1195 1268
 
1196 1269
 		// now any ACL rights (but invite rights!) implicate FREEBUSY rights (at least READ has to include FREEBUSY)
1197
-		if ($grant & ~EGW_ACL_INVITE) $grant |= EGW_ACL_FREEBUSY;
1270
+		if ($grant & ~EGW_ACL_INVITE)
1271
+		{
1272
+			$grant |= EGW_ACL_FREEBUSY;
1273
+		}
1198 1274
 
1199 1275
 		if (is_array($event) && ($needed == EGW_ACL_READ || $needed == EGW_ACL_FREEBUSY))
1200 1276
 		{
@@ -1220,7 +1296,10 @@  discard block
 block discarded – undo
1220 1296
 					elseif (!is_numeric($uid))
1221 1297
 					{
1222 1298
 						// if the owner only grants EGW_ACL_FREEBUSY we are not interested in the recources explicit rights
1223
-						if ($grant == EGW_ACL_FREEBUSY) continue;
1299
+						if ($grant == EGW_ACL_FREEBUSY)
1300
+						{
1301
+							continue;
1302
+						}
1224 1303
 						// if we have a resource as participant
1225 1304
 						$resource = $this->resource_info($uid);
1226 1305
 						$grant |= $resource['rights'];
@@ -1370,14 +1449,20 @@  discard block
 block discarded – undo
1370 1449
 						$param = $param ? 'True' : 'False';
1371 1450
 						break;
1372 1451
 					case 'integer':
1373
-						if ($param >= mktime(0,0,0,1,1,2000)) $param = adodb_date('Y-m-d H:i:s',$param)." ($param)";
1452
+						if ($param >= mktime(0,0,0,1,1,2000))
1453
+						{
1454
+							$param = adodb_date('Y-m-d H:i:s',$param)." ($param)";
1455
+						}
1374 1456
 						break;
1375 1457
 				}
1376 1458
 			}
1377 1459
 			$msg = str_replace('%'.($i-1),$param,$msg);
1378 1460
 		}
1379 1461
 		error_log($msg);
1380
-		if ($backtrace) error_log(function_backtrace(1));
1462
+		if ($backtrace)
1463
+		{
1464
+			error_log(function_backtrace(1));
1465
+		}
1381 1466
 	}
1382 1467
 
1383 1468
 	/**
@@ -1485,14 +1570,20 @@  discard block
 block discarded – undo
1485 1570
 	function timespan($start_m,$end_m,$both=false)
1486 1571
 	{
1487 1572
 		$duration = $end_m - $start_m;
1488
-		if ($end_m == 24*60-1) ++$duration;
1573
+		if ($end_m == 24*60-1)
1574
+		{
1575
+			++$duration;
1576
+		}
1489 1577
 		$duration = floor($duration/60).lang('h').($duration%60 ? $duration%60 : '');
1490 1578
 
1491 1579
 		$timespan = $t = common::formattime(sprintf('%02d',$start_m/60),sprintf('%02d',$start_m%60));
1492 1580
 
1493
-		if ($both)	// end-time too
1581
+		if ($both)
1582
+		{
1583
+			// end-time too
1494 1584
 		{
1495 1585
 			$timespan .= ' - '.common::formattime(sprintf('%02d',$end_m/60),sprintf('%02d',$end_m%60));
1586
+		}
1496 1587
 			// dont double am/pm if they are the same in both times
1497 1588
 			if ($this->common_prefs['timeformat'] == 12 && substr($timespan,-2) == substr($t,-2))
1498 1589
 			{
@@ -1516,8 +1607,14 @@  discard block
 block discarded – undo
1516 1607
 		static $id2lid = array();
1517 1608
 		static $id2email = array();
1518 1609
 
1519
-		if ($use_type && $use_type != 'u') $id = $use_type.$id;
1520
-		if($id === 0 || $id === '0') $id = $this->user;
1610
+		if ($use_type && $use_type != 'u')
1611
+		{
1612
+			$id = $use_type.$id;
1613
+		}
1614
+		if($id === 0 || $id === '0')
1615
+		{
1616
+			$id = $this->user;
1617
+		}
1521 1618
 
1522 1619
 		if (!isset($id2lid[$id]))
1523 1620
 		{
@@ -1527,7 +1624,10 @@  discard block
 block discarded – undo
1527 1624
 				if (($info = $this->resource_info($id)))
1528 1625
 				{
1529 1626
 					$id2lid[$id] = $info['name'] ? $info['name'] : $info['email'];
1530
-					if ($info['name']) $id2email[$id] = $info['email'];
1627
+					if ($info['name'])
1628
+					{
1629
+						$id2email[$id] = $info['email'];
1630
+					}
1531 1631
 				}
1532 1632
 			}
1533 1633
 			else
@@ -1553,11 +1653,18 @@  discard block
 block discarded – undo
1553 1653
 		$names = array();
1554 1654
 		foreach((array)$event['participants'] as $id => $status)
1555 1655
 		{
1556
-			if (!is_string($status)) continue;
1656
+			if (!is_string($status))
1657
+			{
1658
+				continue;
1659
+			}
1557 1660
 			$quantity = $role = null;
1558 1661
 			calendar_so::split_status($status,$quantity,$role);
1559 1662
 
1560
-			if ($status == 'G' && !$show_group_invitation) continue;	// dont show group-invitation
1663
+			if ($status == 'G' && !$show_group_invitation)
1664
+			{
1665
+				continue;
1666
+			}
1667
+			// dont show group-invitation
1561 1668
 
1562 1669
 			$lang_status = lang($this->verbose_status[$status]);
1563 1670
 			if (!$long_status)
@@ -1630,7 +1737,10 @@  discard block
 block discarded – undo
1630 1737
 
1631 1738
 		foreach(explode(',',$category) as $cat_id)
1632 1739
 		{
1633
-			if (!$cat_id) continue;
1740
+			if (!$cat_id)
1741
+			{
1742
+				continue;
1743
+			}
1634 1744
 
1635 1745
 			if (!isset($id2cat[$cat_id]))
1636 1746
 			{
@@ -1696,7 +1806,10 @@  discard block
 block discarded – undo
1696 1806
 	 */
1697 1807
 	public static function list_calendars($user, array $grants=null)
1698 1808
 	{
1699
-		if (is_null($grants)) $grants = $GLOBALS['egw']->acl->get_grants('calendar', true, $user);
1809
+		if (is_null($grants))
1810
+		{
1811
+			$grants = $GLOBALS['egw']->acl->get_grants('calendar', true, $user);
1812
+		}
1700 1813
 
1701 1814
 		$users = $groups = array();
1702 1815
 		foreach(array_keys($grants) as $id)
@@ -1744,7 +1857,10 @@  discard block
 block discarded – undo
1744 1857
 	 */
1745 1858
 	function recure2string($event)
1746 1859
 	{
1747
-		if (!is_array($event)) return false;
1860
+		if (!is_array($event))
1861
+		{
1862
+			return false;
1863
+		}
1748 1864
 		return (string)calendar_rrule::event2rrule($event);
1749 1865
 	}
1750 1866
 
@@ -1766,12 +1882,18 @@  discard block
 block discarded – undo
1766 1882
 	 */
1767 1883
 	function read_holidays($year=0)
1768 1884
 	{
1769
-		if (!$year) $year = (int) date('Y',$this->now_su);
1885
+		if (!$year)
1886
+		{
1887
+			$year = (int) date('Y',$this->now_su);
1888
+		}
1770 1889
 
1771
-		if (!$this->cached_holidays)	// try reading the holidays from the session
1890
+		if (!$this->cached_holidays)
1891
+		{
1892
+			// try reading the holidays from the session
1772 1893
 		{
1773 1894
 			$this->cached_holidays = $GLOBALS['egw']->session->appsession('holidays','calendar');
1774 1895
 		}
1896
+		}
1775 1897
 		if (!isset($this->cached_holidays[$year]))
1776 1898
 		{
1777 1899
 			if (!is_object($this->holidays))
@@ -1811,7 +1933,11 @@  discard block
 block discarded – undo
1811 1933
 							continue;
1812 1934
 						}
1813 1935
 						list($y,$m,$d) = explode('-',$pers['bday']);
1814
-						if ($y > $year) continue; 	// not yet born
1936
+						if ($y > $year)
1937
+						{
1938
+							continue;
1939
+						}
1940
+						// not yet born
1815 1941
 						$this->cached_holidays[$year][sprintf('%04d%02d%02d',$year,$m,$d)][] = array(
1816 1942
 							'day'       => $d,
1817 1943
 							'month'     => $m,
@@ -1904,7 +2030,10 @@  discard block
 block discarded – undo
1904 2030
 				}
1905 2031
 			}
1906 2032
 			$str_fields = implode(', ',$extra_fields);
1907
-			if (is_array($extra_fields)) return $this->format_date($event['start']) . ': ' . $event['title'] . ($str_fields? ', ' . $str_fields:'');
2033
+			if (is_array($extra_fields))
2034
+			{
2035
+				return $this->format_date($event['start']) . ': ' . $event['title'] . ($str_fields? ', ' . $str_fields:'');
2036
+			}
1908 2037
 		}
1909 2038
 		return $this->format_date($event['start']) . ': ' . $event['title'];
1910 2039
 	}
@@ -1925,7 +2054,8 @@  discard block
 block discarded – undo
1925 2054
 			'offset' =>	$options['start'],
1926 2055
 			'order' => 'cal_start DESC',
1927 2056
 		);
1928
-		if($options['num_rows']) {
2057
+		if($options['num_rows'])
2058
+		{
1929 2059
 			$query['num_rows'] = $options['num_rows'];
1930 2060
 		}
1931 2061
 		foreach((array) $this->search($query) as $event)
@@ -1991,7 +2121,10 @@  discard block
 block discarded – undo
1991 2121
 			if ((!isset($default_prefs[$var]) || (string)$default_prefs[$var] === '') && (!isset($forced_prefs[$var]) || (string)$forced_prefs[$var] === ''))
1992 2122
 			{
1993 2123
 				$GLOBALS['egw']->preferences->add('calendar',$var,$default,'default');	// always store default, even if we have a forced too
1994
-				if ($type == 'forced') $GLOBALS['egw']->preferences->add('calendar',$var,$default,'forced');
2124
+				if ($type == 'forced')
2125
+				{
2126
+					$GLOBALS['egw']->preferences->add('calendar',$var,$default,'forced');
2127
+				}
1995 2128
 				$this->cal_prefs[$var] = $default;
1996 2129
 				$need_save = True;
1997 2130
 			}
@@ -2011,7 +2144,10 @@  discard block
 block discarded – undo
2011 2144
 	 */
2012 2145
 	static function freebusy_url($user='',$pw=null)
2013 2146
 	{
2014
-		if (is_numeric($user)) $user = $GLOBALS['egw']->accounts->id2name($user);
2147
+		if (is_numeric($user))
2148
+		{
2149
+			$user = $GLOBALS['egw']->accounts->id2name($user);
2150
+		}
2015 2151
 
2016 2152
 		$credentials = '';
2017 2153
 
@@ -2079,13 +2215,19 @@  discard block
 block discarded – undo
2079 2215
 	 */
2080 2216
 	public function get_ctag($user, $filter='owner', $master_only=false)
2081 2217
 	{
2082
-		if ($this->debug > 1) $startime = microtime(true);
2218
+		if ($this->debug > 1)
2219
+		{
2220
+			$startime = microtime(true);
2221
+		}
2083 2222
 
2084 2223
 		// resolve users to add memberships for users and members for groups
2085 2224
 		$users = $this->resolve_users($user);
2086 2225
 		$ctag = $users ? $this->so->get_ctag($users, $filter == 'owner', $master_only) : 0;	// no rights, return 0 as ctag (otherwise we get SQL error!)
2087 2226
 
2088
-		if ($this->debug > 1) error_log(__METHOD__. "($user, '$filter') = $ctag = ".date('Y-m-d H:i:s',$ctag)." took ".(microtime(true)-$startime)." secs");
2227
+		if ($this->debug > 1)
2228
+		{
2229
+			error_log(__METHOD__. "($user, '$filter') = $ctag = ".date('Y-m-d H:i:s',$ctag)." took ".(microtime(true)-$startime)." secs");
2230
+		}
2089 2231
 		return $ctag;
2090 2232
 	}
2091 2233
 
@@ -2127,15 +2269,21 @@  discard block
 block discarded – undo
2127 2269
 				$content['link_app'][] = $link['app'];
2128 2270
 				$content['link_id'][]  = $link['id'];
2129 2271
 			}
2130
-			if ($link['app'] == 'addressbook')	// prefering contact as primary contact over calendar entry set above
2272
+			if ($link['app'] == 'addressbook')
2273
+			{
2274
+				// prefering contact as primary contact over calendar entry set above
2131 2275
 			{
2132 2276
 				$content['info_contact'] = 'addressbook:'.$link['id'];
2133 2277
 			}
2278
+			}
2134 2279
 		}
2135 2280
 		// Copy same custom fields
2136 2281
 		foreach(array_keys(config::get_customfields('infolog')) as $name)
2137 2282
 		{
2138
-			if ($this->customfields[$name]) $content['#'.$name] = $calendar['#'.$name];
2283
+			if ($this->customfields[$name])
2284
+			{
2285
+				$content['#'.$name] = $calendar['#'.$name];
2286
+			}
2139 2287
 		}
2140 2288
 		//error_log(__METHOD__.'('.array2string($data).') calendar='.array2string($calendar).' returning '.array2string($content));
2141 2289
 		return $content;
@@ -2158,7 +2306,11 @@  discard block
 block discarded – undo
2158 2306
 			$set['ts_title'] = $this->link_title($event);
2159 2307
 			$set['start_time'] = egw_time::to($event['start'],'H:i');
2160 2308
 			$set['ts_description'] = $event['description'];
2161
-			if ($this->isWholeDay($event)) $event['end']++;	// whole day events are 1sec short
2309
+			if ($this->isWholeDay($event))
2310
+			{
2311
+				$event['end']++;
2312
+			}
2313
+			// whole day events are 1sec short
2162 2314
 			$set['ts_duration']	= ($event['end'] - $event['start']) / 60;
2163 2315
 			$set['ts_quantity'] = ($event['end'] - $event['start']) / 3600;
2164 2316
 			$set['end_time'] = null;	// unset end-time
Please login to merge, or discard this patch.
calendar/inc/class.calendar_boupdate.inc.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1504,22 +1504,22 @@  discard block
 block discarded – undo
1504 1504
 		// check the old list against the new list
1505 1505
 		foreach ($old_event['participants'] as $userid => $status)
1506 1506
   		{
1507
-            if (!isset($new_event['participants'][$userid])){
1508
-            	// Attendee will be deleted this way
1509
-            	$new_event['participants'][$userid] = 'G';
1510
-            }
1511
-            elseif ($new_event['participants'][$userid] == $status)
1512
-            {
1513
-            	// Same status -- nothing to do.
1514
-            	unset($new_event['participants'][$userid]);
1515
-            }
1507
+			if (!isset($new_event['participants'][$userid])){
1508
+				// Attendee will be deleted this way
1509
+				$new_event['participants'][$userid] = 'G';
1510
+			}
1511
+			elseif ($new_event['participants'][$userid] == $status)
1512
+			{
1513
+				// Same status -- nothing to do.
1514
+				unset($new_event['participants'][$userid]);
1515
+			}
1516 1516
 		}
1517 1517
 		// write the changes
1518 1518
 		foreach ($new_event['participants'] as $userid => $status)
1519 1519
 		{
1520 1520
 			$this->set_status($old_event, $userid, $status, $recur_date, true, false,$skip_notification);
1521 1521
 		}
1522
-    }
1522
+	}
1523 1523
 
1524 1524
 	/**
1525 1525
 	 * deletes an event
@@ -2493,24 +2493,24 @@  discard block
 block discarded – undo
2493 2493
 	/**
2494 2494
 	 * classifies an incoming event from the eGW point-of-view
2495 2495
 	 *
2496
-     * exceptions: unlike other calendar apps eGW does not create an event exception
2497
-     * if just the participant state changes - therefore we have to distinguish between
2498
-     * real exceptions and status only exceptions
2499
-     *
2500
-     * @param array $event the event to check
2501
-     *
2502
-     * @return array
2503
-     * 	type =>
2504
-     * 		SINGLE a single event
2505
-     * 		SERIES-MASTER the series master
2506
-     * 		SERIES-EXCEPTION event is a real exception
2507
-	  * 		SERIES-PSEUDO-EXCEPTION event is a status only exception
2508
-	  * 		SERIES-EXCEPTION-PROPAGATE event was a status only exception in the past and is now a real exception
2509
-	  * 	stored_event => if event already exists in the database array with event data or false
2510
-	  * 	master_event => for event type SERIES-EXCEPTION, SERIES-PSEUDO-EXCEPTION or SERIES-EXCEPTION-PROPAGATE
2511
-	  * 		the corresponding series master event array
2512
-	  * 		NOTE: this param is false if event is of type SERIES-MASTER
2513
-     */
2496
+	 * exceptions: unlike other calendar apps eGW does not create an event exception
2497
+	 * if just the participant state changes - therefore we have to distinguish between
2498
+	 * real exceptions and status only exceptions
2499
+	 *
2500
+	 * @param array $event the event to check
2501
+	 *
2502
+	 * @return array
2503
+	 * 	type =>
2504
+	 * 		SINGLE a single event
2505
+	 * 		SERIES-MASTER the series master
2506
+	 * 		SERIES-EXCEPTION event is a real exception
2507
+	 * 		SERIES-PSEUDO-EXCEPTION event is a status only exception
2508
+	 * 		SERIES-EXCEPTION-PROPAGATE event was a status only exception in the past and is now a real exception
2509
+	 * 	stored_event => if event already exists in the database array with event data or false
2510
+	 * 	master_event => for event type SERIES-EXCEPTION, SERIES-PSEUDO-EXCEPTION or SERIES-EXCEPTION-PROPAGATE
2511
+	 * 		the corresponding series master event array
2512
+	 * 		NOTE: this param is false if event is of type SERIES-MASTER
2513
+	 */
2514 2514
 	function get_event_info($event)
2515 2515
 	{
2516 2516
 		$type = 'SINGLE'; // default
@@ -2681,16 +2681,16 @@  discard block
 block discarded – undo
2681 2681
 			'stored_event' => $stored_event,
2682 2682
 			'master_event' => $master_event,
2683 2683
 		);
2684
-    }
2685
-
2686
-    /**
2687
-     * Translates all timestamps for a given event from server-time to user-time.
2688
-     * The update() and save() methods expect timestamps in user-time.
2689
-     * @param &$event	the event we are working on
2690
-     *
2691
-     */
2692
-    function server2usertime (&$event)
2693
-    {
2684
+	}
2685
+
2686
+	/**
2687
+	 * Translates all timestamps for a given event from server-time to user-time.
2688
+	 * The update() and save() methods expect timestamps in user-time.
2689
+	 * @param &$event	the event we are working on
2690
+	 *
2691
+	 */
2692
+	function server2usertime (&$event)
2693
+	{
2694 2694
 		// we run all dates through date2usertime, to adjust to user-time
2695 2695
 		foreach(array('start','end','recur_enddate','recurrence') as $ts)
2696 2696
 		{
@@ -2713,7 +2713,7 @@  discard block
 block discarded – undo
2713 2713
 				$event['alarm'][$id]['time'] = $this->date2usertime($alarm['time']);
2714 2714
 			}
2715 2715
 		}
2716
-    }
2716
+	}
2717 2717
 	/**
2718 2718
 	 * Delete events that are more than $age years old
2719 2719
 	 *
Please login to merge, or discard this patch.
Braces   +216 added lines, -55 removed lines patch added patch discarded remove patch
@@ -81,11 +81,17 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	function __construct()
83 83
 	{
84
-		if ($this->debug > 0) $this->debug_message('calendar_boupdate::__construct() started',True);
84
+		if ($this->debug > 0)
85
+		{
86
+			$this->debug_message('calendar_boupdate::__construct() started',True);
87
+		}
85 88
 
86 89
 		parent::__construct();	// calling the parent constructor
87 90
 
88
-		if ($this->debug > 0) $this->debug_message('calendar_boupdate::__construct() finished',True);
91
+		if ($this->debug > 0)
92
+		{
93
+			$this->debug_message('calendar_boupdate::__construct() finished',True);
94
+		}
89 95
 	}
90 96
 
91 97
 	/**
@@ -115,7 +121,10 @@  discard block
 block discarded – undo
115 121
 	function update(&$event,$ignore_conflicts=false,$touch_modified=true,$ignore_acl=false,$updateTS=true,&$messages=null, $skip_notification=false)
116 122
 	{
117 123
 		//error_log(__METHOD__."(".array2string($event).",$ignore_conflicts,$touch_modified,$ignore_acl)");
118
-		if (!is_array($messages)) $messages = $messages ? (array)$messages : array();
124
+		if (!is_array($messages))
125
+		{
126
+			$messages = $messages ? (array)$messages : array();
127
+		}
119 128
 
120 129
 		if ($this->debug > 1 || $this->debug == 'update')
121 130
 		{
@@ -135,10 +144,13 @@  discard block
 block discarded – undo
135 144
 
136 145
 		$status_reset_to_unknown = false;
137 146
 
138
-		if (($new_event = !$event['id']))	// some defaults for new entries
147
+		if (($new_event = !$event['id']))
148
+		{
149
+			// some defaults for new entries
139 150
 		{
140 151
 			// if no owner given, set user to owner
141 152
 			if (!$event['owner']) $event['owner'] = $this->user;
153
+		}
142 154
 			// set owner as participant if none is given
143 155
 			if (!is_array($event['participants']) || !count($event['participants']))
144 156
 			{
@@ -178,7 +190,10 @@  discard block
 block discarded – undo
178 190
 		// check category based ACL
179 191
 		if ($event['category'])
180 192
 		{
181
-			if (!is_array($event['category'])) $event['category'] = explode(',',$event['category']);
193
+			if (!is_array($event['category']))
194
+			{
195
+				$event['category'] = explode(',',$event['category']);
196
+			}
182 197
 			if (!$old_event || !isset($old_event['category']))
183 198
 			{
184 199
 				$old_event['category'] = array();
@@ -231,18 +246,28 @@  discard block
 block discarded – undo
231 246
 			$types_with_quantity = array();
232 247
 			foreach($this->resources as $type => $data)
233 248
 			{
234
-				if ($data['max_quantity']) $types_with_quantity[] = $type;
249
+				if ($data['max_quantity'])
250
+				{
251
+					$types_with_quantity[] = $type;
252
+				}
235 253
 			}
236 254
 			// get all NOT rejected participants and evtl. their quantity
237 255
 			$quantity = $users = array();
238 256
 			foreach($event['participants'] as $uid => $status)
239 257
 			{
240 258
 				calendar_so::split_status($status,$q,$r);
241
-				if ($status[0] == 'R') continue;	// ignore rejected participants
259
+				if ($status[0] == 'R')
260
+				{
261
+					continue;
262
+				}
263
+				// ignore rejected participants
242 264
 
243
-				if ($uid < 0)	// group, check it's members too
265
+				if ($uid < 0)
266
+				{
267
+					// group, check it's members too
244 268
 				{
245 269
 					$users += (array)$GLOBALS['egw']->accounts->members($uid,true);
270
+				}
246 271
 					$users = array_unique($users);
247 272
 				}
248 273
 				$users[] = $uid;
@@ -273,10 +298,13 @@  discard block
 block discarded – undo
273 298
 			{
274 299
 				if ($overlap['id'] == $event['id'] ||	// that's the event itself
275 300
 					$overlap['id'] == $event['reference'] ||	// event is an exception of overlap
276
-					$overlap['non_blocking'])			// that's a non_blocking event
301
+					$overlap['non_blocking'])
302
+				{
303
+					// that's a non_blocking event
277 304
 				{
278 305
 					continue;
279 306
 				}
307
+				}
280 308
 				if ($this->debug > 3 || $this->debug == 'update')
281 309
 				{
282 310
 					$this->debug_message('calendar_boupdate::update() checking overlapping event %1',false,$overlap);
@@ -434,7 +462,11 @@  discard block
 block discarded – undo
434 462
 	 */
435 463
 	public function check_acl_invite($uid)
436 464
 	{
437
-		if (!is_numeric($uid)) return true;	// nothing implemented for resources so far
465
+		if (!is_numeric($uid))
466
+		{
467
+			return true;
468
+		}
469
+		// nothing implemented for resources so far
438 470
 
439 471
 		if (!$this->require_acl_invite)
440 472
 		{
@@ -775,14 +807,20 @@  discard block
 block discarded – undo
775 807
 		$startdate = new egw_time($event['start']);
776 808
 		$enddate = new egw_time($event['end']);
777 809
 		$modified = new egw_time($event['modified']);
778
-		if ($old_event) $olddate = new egw_time($old_event['start']);
810
+		if ($old_event)
811
+		{
812
+			$olddate = new egw_time($old_event['start']);
813
+		}
779 814
 		//error_log(__METHOD__."() date_default_timezone_get()=".date_default_timezone_get().", user-timezone=".egw_time::$user_timezone->getName().", startdate=".$startdate->format().", enddate=".$enddate->format().", updated=".$modified->format().", olddate=".($olddate ? $olddate->format() : ''));
780 815
 		$owner_prefs = $ics = null;
781 816
 		foreach($to_notify as $userid => $statusid)
782 817
 		{
783 818
 			$res_info = $quantity = $role = null;
784 819
 			calendar_so::split_status($statusid, $quantity, $role);
785
-			if ($this->debug > 0) error_log(__METHOD__." trying to notify $userid, with $statusid ($role)");
820
+			if ($this->debug > 0)
821
+			{
822
+				error_log(__METHOD__." trying to notify $userid, with $statusid ($role)");
823
+			}
786 824
 
787 825
 			if (!is_numeric($userid))
788 826
 			{
@@ -801,7 +839,11 @@  discard block
 block discarded – undo
801 839
 
802 840
 				if (!isset($userid))
803 841
 				{
804
-					if (empty($res_info['email'])) continue;	// no way to notify
842
+					if (empty($res_info['email']))
843
+					{
844
+						continue;
845
+					}
846
+					// no way to notify
805 847
 					// check if event-owner wants non-EGroupware users notified
806 848
 					if (is_null($owner_prefs))
807 849
 					{
@@ -866,11 +908,20 @@  discard block
 block discarded – undo
866 908
 				$details = $this->_get_event_details(isset($cleared_event) ? $cleared_event : $event,
867 909
 					$action, $event_arr, $disinvited);
868 910
 				$details['to-fullname'] = $fullname;
869
-				if (isset($tfn)) $details['to-firstname'] = $tfn;
870
-				if (isset($tln)) $details['to-lastname'] = $tln;
911
+				if (isset($tfn))
912
+				{
913
+					$details['to-firstname'] = $tfn;
914
+				}
915
+				if (isset($tln))
916
+				{
917
+					$details['to-lastname'] = $tln;
918
+				}
871 919
 
872 920
 				// event is in user-time of current user, now we need to calculate the tz-difference to the notified user and take it into account
873
-				if (!isset($part_prefs['common']['tz'])) $part_prefs['common']['tz'] = $GLOBALS['egw_info']['server']['server_timezone'];
921
+				if (!isset($part_prefs['common']['tz']))
922
+				{
923
+					$part_prefs['common']['tz'] = $GLOBALS['egw_info']['server']['server_timezone'];
924
+				}
874 925
 				$timezone = new DateTimeZone($part_prefs['common']['tz']);
875 926
 				$timeformat = $part_prefs['common']['timeformat'];
876 927
 				switch($timeformat)
@@ -905,9 +956,12 @@  discard block
 block discarded – undo
905 956
 				switch($msg_type == MSG_ALARM ? 'extended' : $part_prefs['calendar']['update_format'])
906 957
 				{
907 958
 					case 'ical':
908
-						if (is_null($ics) || $m_type != $msg_type)	// need different ical for organizer notification
959
+						if (is_null($ics) || $m_type != $msg_type)
960
+						{
961
+							// need different ical for organizer notification
909 962
 						{
910 963
 							$calendar_ical = new calendar_ical();
964
+						}
911 965
 							$calendar_ical->setSupportedFields('full');	// full iCal fields+event TZ
912 966
 							// we need to pass $event[id] so iCal class reads event again,
913 967
 							// as event is in user TZ, but iCal class expects server TZ!
@@ -921,7 +975,10 @@  discard block
 block discarded – undo
921 975
 							'encoding' => '8bit',
922 976
 							'type' => 'text/calendar; method='.$method,
923 977
 						);
924
-						if ($m_type != $msg_type) unset($ics);
978
+						if ($m_type != $msg_type)
979
+						{
980
+							unset($ics);
981
+						}
925 982
 						$subject = isset($cleared_event) ? $cleared_event['title'] : $event['title'];
926 983
 						// fall through
927 984
 					case 'extended':
@@ -972,7 +1029,9 @@  discard block
 block discarded – undo
972 1029
 						$notification->set_popupmessage($notify_body."\n\n".$details['description']."\n\n".$details_body);
973 1030
 						$notification->set_popuplinks(array($details['link_arr']));
974 1031
 
975
-						if(is_array($attachment)) { $notification->set_attachments(array($attachment)); }
1032
+						if(is_array($attachment))
1033
+						{
1034
+$notification->set_attachments(array($attachment)); }
976 1035
 						$notification->send();
977 1036
 					}
978 1037
 					catch (Exception $exception) {
@@ -999,7 +1058,10 @@  discard block
 block discarded – undo
999 1058
 			translation::init();
1000 1059
 		}
1001 1060
 		// restore timezone, in case we had to reset it to server-timezone
1002
-		if ($restore_tz) date_default_timezone_set($restore_tz);
1061
+		if ($restore_tz)
1062
+		{
1063
+			date_default_timezone_set($restore_tz);
1064
+		}
1003 1065
 
1004 1066
 		return true;
1005 1067
 	}
@@ -1034,10 +1096,13 @@  discard block
 block discarded – undo
1034 1096
 		{
1035 1097
 			$to_notify = $event['participants'];
1036 1098
 		}
1037
-		elseif ($this->check_perms(EGW_ACL_READ,$event))	// checks agains $this->owner set to $alarm[owner]
1099
+		elseif ($this->check_perms(EGW_ACL_READ,$event))
1100
+		{
1101
+			// checks agains $this->owner set to $alarm[owner]
1038 1102
 		{
1039 1103
 			$to_notify[$alarm['owner']] = 'A';
1040 1104
 		}
1105
+		}
1041 1106
 		else
1042 1107
 		{
1043 1108
 			return False;	// no rights
@@ -1087,7 +1152,10 @@  discard block
 block discarded – undo
1087 1152
 		if ($event['id'])
1088 1153
 		{
1089 1154
 			// invalidate the read-cache if it contains the event we store now
1090
-			if ($event['id'] == self::$cached_event['id']) self::$cached_event = array();
1155
+			if ($event['id'] == self::$cached_event['id'])
1156
+			{
1157
+				self::$cached_event = array();
1158
+			}
1091 1159
 			$old_event = $this->read($event['id'], $event['recurrence'], false, 'server');
1092 1160
 		}
1093 1161
 		else
@@ -1095,7 +1163,10 @@  discard block
 block discarded – undo
1095 1163
 			$old_event = null;
1096 1164
 		}
1097 1165
 
1098
-		if (!isset($event['whole_day'])) $event['whole_day'] = $this->isWholeDay($event);
1166
+		if (!isset($event['whole_day']))
1167
+		{
1168
+			$event['whole_day'] = $this->isWholeDay($event);
1169
+		}
1099 1170
 		$save_event = $event;
1100 1171
 		if ($event['whole_day'])
1101 1172
 		{
@@ -1136,7 +1207,10 @@  discard block
 block discarded – undo
1136 1207
 		foreach($timestamps as $ts)
1137 1208
 		{
1138 1209
 			// we convert here from user-time to timestamps in server-time!
1139
-			if (isset($event[$ts])) $event[$ts] = $event[$ts] ? $this->date2ts($event[$ts],true) : 0;
1210
+			if (isset($event[$ts]))
1211
+			{
1212
+				$event[$ts] = $event[$ts] ? $this->date2ts($event[$ts],true) : 0;
1213
+			}
1140 1214
 		}
1141 1215
 		// convert tzid name to integer tz_id, of set user default
1142 1216
 		if (empty($event['tzid']) || !($event['tz_id'] = calendar_timezones::tz2id($event['tzid'])))
@@ -1186,7 +1260,10 @@  discard block
 block discarded – undo
1186 1260
 				if (!isset($event['alarm'][$id]))
1187 1261
 				{
1188 1262
 					$alarm['time'] = $event['start'] - $alarm['offset'];
1189
-					if ($alarm['time'] < time()) calendar_so::shift_alarm($event, $alarm);
1263
+					if ($alarm['time'] < time())
1264
+					{
1265
+						calendar_so::shift_alarm($event, $alarm);
1266
+					}
1190 1267
 						// remove (not store) alarms belonging to not longer existing or rejected participants
1191 1268
 					$status = isset($event['participants']) ? $event['participants'][$alarm['owner']] :
1192 1269
 						$old_event['participants'][$alarm['owner']];
@@ -1222,7 +1299,10 @@  discard block
 block discarded – undo
1222 1299
 			unset($save_event['participants']);
1223 1300
 			$this->set_recurrences($save_event, $set_recurrences_start);
1224 1301
 		}
1225
-		if ($updateTS) $GLOBALS['egw']->contenthistory->updateTimeStamp('calendar', $cal_id, $event['id'] ? 'modify' : 'add', $this->now);
1302
+		if ($updateTS)
1303
+		{
1304
+			$GLOBALS['egw']->contenthistory->updateTimeStamp('calendar', $cal_id, $event['id'] ? 'modify' : 'add', $this->now);
1305
+		}
1226 1306
 
1227 1307
 		// create links for new participants from addressbook, if configured
1228 1308
 		if ($cal_id && $GLOBALS['egw_info']['server']['link_contacts'] && $event['participants'])
@@ -1240,7 +1320,10 @@  discard block
 block discarded – undo
1240 1320
 
1241 1321
 		// Update history
1242 1322
 		$tracking = new calendar_tracking($this);
1243
-		if (empty($event['id']) && !empty($cal_id)) $event['id']=$cal_id;
1323
+		if (empty($event['id']) && !empty($cal_id))
1324
+		{
1325
+			$event['id']=$cal_id;
1326
+		}
1244 1327
 		$tracking->track($event, $old_event);
1245 1328
 
1246 1329
 		return $cal_id;
@@ -1257,9 +1340,12 @@  discard block
 block discarded – undo
1257 1340
 	 */
1258 1341
 	function check_status_perms($uid,$event)
1259 1342
 	{
1260
-		if ($uid[0] == 'c' || $uid[0] == 'e')	// for contact we use the owner of the event
1343
+		if ($uid[0] == 'c' || $uid[0] == 'e')
1344
+		{
1345
+			// for contact we use the owner of the event
1261 1346
 		{
1262 1347
 			if (!is_array($event) && !($event = $this->read($event))) return false;
1348
+		}
1263 1349
 
1264 1350
 			return $this->check_perms(EGW_ACL_EDIT,0,$event['owner']);
1265 1351
 		}
@@ -1270,13 +1356,19 @@  discard block
 block discarded – undo
1270 1356
 			return $access;
1271 1357
 		}
1272 1358
 		// no access or denied access because of category acl --> regular check
1273
-		if (!is_numeric($uid))	// this is eg. for resources (r123)
1359
+		if (!is_numeric($uid))
1360
+		{
1361
+			// this is eg. for resources (r123)
1274 1362
 		{
1275 1363
 			$resource = $this->resource_info($uid);
1364
+		}
1276 1365
 
1277 1366
 			return EGW_ACL_EDIT & $resource['rights'];
1278 1367
 		}
1279
-		if (!is_array($event) && !($event = $this->read($event))) return false;
1368
+		if (!is_array($event) && !($event = $this->read($event)))
1369
+		{
1370
+			return false;
1371
+		}
1280 1372
 
1281 1373
 		// regular user and groups (need to check memberships too)
1282 1374
 		if (!isset($event['participants'][$uid]))
@@ -1300,7 +1392,10 @@  discard block
 block discarded – undo
1300 1392
 	 */
1301 1393
 	function check_cat_acl($right,$event)
1302 1394
 	{
1303
-		if (!is_array($event)) $event = $this->read($event);
1395
+		if (!is_array($event))
1396
+		{
1397
+			$event = $this->read($event);
1398
+		}
1304 1399
 
1305 1400
 		$ret = null;
1306 1401
 		if ($event['category'])
@@ -1357,7 +1452,10 @@  discard block
 block discarded – undo
1357 1452
 	public static function set_cat_rights($cat_id,$user,$rights)
1358 1453
 	{
1359 1454
 		//echo "<p>".__METHOD__."($cat_id,$user,$rights)</p>\n";
1360
-		if (!isset(self::$cat_rights_cache)) self::get_cat_rights($cat_id);
1455
+		if (!isset(self::$cat_rights_cache))
1456
+		{
1457
+			self::get_cat_rights($cat_id);
1458
+		}
1361 1459
 
1362 1460
 		if ((int)$rights != (int)self::$cat_rights_cache['L'.$cat_id][$user])
1363 1461
 		{
@@ -1369,7 +1467,10 @@  discard block
 block discarded – undo
1369 1467
 			else
1370 1468
 			{
1371 1469
 				unset(self::$cat_rights_cache['L'.$cat_id][$user]);
1372
-				if (!self::$cat_rights_cache['L'.$cat_id]) unset(self::$cat_rights_cache['L'.$cat_id]);
1470
+				if (!self::$cat_rights_cache['L'.$cat_id])
1471
+				{
1472
+					unset(self::$cat_rights_cache['L'.$cat_id]);
1473
+				}
1373 1474
 				$GLOBALS['egw']->acl->delete_repository('calendar','L'.$cat_id,$user);
1374 1475
 			}
1375 1476
 			egw_cache::setSession('calendar','cat_rights',self::$cat_rights_cache);
@@ -1402,7 +1503,10 @@  discard block
 block discarded – undo
1402 1503
 				foreach($cat_rights as $uid => $value)
1403 1504
 				{
1404 1505
 					$all |= $value;
1405
-					if (in_array($uid,$memberships)) $own |= $value;
1506
+					if (in_array($uid,$memberships))
1507
+					{
1508
+						$own |= $value;
1509
+					}
1406 1510
 				}
1407 1511
 			}
1408 1512
 			foreach(array(self::CAT_ACL_ADD,self::CAT_ACL_STATUS) as $mask)
@@ -1449,13 +1553,16 @@  discard block
 block discarded – undo
1449 1553
 				is_numeric($uid)?$uid:substr($uid,1),$status,
1450 1554
 				$recur_date?$this->date2ts($recur_date,true):0,$role)))
1451 1555
 		{
1452
-			if ($status == 'R')	// remove alarms belonging to rejected participants
1556
+			if ($status == 'R')
1557
+			{
1558
+				// remove alarms belonging to rejected participants
1453 1559
 			{
1454 1560
 				foreach(isset($event['alarm']) ? $event['alarm'] : $old_event['alarm'] as $id => $alarm)
1455 1561
 				{
1456 1562
 					if ((string)$alarm['owner'] === (string)$uid)
1457 1563
 					{
1458 1564
 						$this->so->delete_alarm($id);
1565
+			}
1459 1566
 						//error_log(__LINE__.': '.__METHOD__."(".array2string($event).", '$uid', '$status', ...) deleting alarm=".array2string($alarm).", $status=".array2string($alarm));
1460 1567
 					}
1461 1568
 				}
@@ -1473,8 +1580,15 @@  discard block
 block discarded – undo
1473 1580
 			);
1474 1581
 			if (isset($status2msg[$status]) && !$skip_notification)
1475 1582
 			{
1476
-				if (!is_array($event)) $event = $this->read($cal_id);
1477
-				if (isset($recur_date)) $event = $this->read($event['id'],$recur_date); //re-read the actually edited recurring event
1583
+				if (!is_array($event))
1584
+				{
1585
+					$event = $this->read($cal_id);
1586
+				}
1587
+				if (isset($recur_date))
1588
+				{
1589
+					$event = $this->read($event['id'],$recur_date);
1590
+				}
1591
+				//re-read the actually edited recurring event
1478 1592
 				$this->send_update($status2msg[$status],$event['participants'],$event);
1479 1593
 			}
1480 1594
 
@@ -1497,12 +1611,16 @@  discard block
 block discarded – undo
1497 1611
 	 */
1498 1612
 	function update_status($new_event, $old_event , $recur_date=0, $skip_notification=false)
1499 1613
 	{
1500
-		if (!isset($new_event['participants'])) return;
1614
+		if (!isset($new_event['participants']))
1615
+		{
1616
+			return;
1617
+		}
1501 1618
 
1502 1619
 		// check the old list against the new list
1503 1620
 		foreach ($old_event['participants'] as $userid => $status)
1504
-  		{
1505
-            if (!isset($new_event['participants'][$userid])){
1621
+		{
1622
+            if (!isset($new_event['participants'][$userid]))
1623
+            {
1506 1624
             	// Attendee will be deleted this way
1507 1625
             	$new_event['participants'][$userid] = 'G';
1508 1626
             }
@@ -1586,7 +1704,10 @@  discard block
 block discarded – undo
1586 1704
 					}
1587 1705
 					else
1588 1706
 					{
1589
-						if (!($exception = $this->read($id))) continue;
1707
+						if (!($exception = $this->read($id)))
1708
+						{
1709
+							continue;
1710
+						}
1590 1711
 						$exception['uid'] = common::generate_uid('calendar', $id);
1591 1712
 						$exception['reference'] = $exception['recurrence'] = 0;
1592 1713
 						$this->update($exception, true, true, false, true, $msg=null, true);
@@ -1657,7 +1778,10 @@  discard block
 block discarded – undo
1657 1778
 		$event_arr = $this->event2array($event);
1658 1779
 		foreach($event_arr as $key => $val)
1659 1780
 		{
1660
-			if ($key == 'recur_type') $key = 'repetition';
1781
+			if ($key == 'recur_type')
1782
+			{
1783
+				$key = 'repetition';
1784
+			}
1661 1785
 			$details[$key] = $val['data'];
1662 1786
 		}
1663 1787
 		$details['participants'] = $details['participants'] ? implode("\n",$details['participants']) : '';
@@ -1830,7 +1954,10 @@  discard block
 block discarded – undo
1830 1954
 	 */
1831 1955
 	function check_move_alarms(Array &$event, Array $old_event = null, egw_time $instance_date = null)
1832 1956
 	{
1833
-		if ($old_event !== null && $event['start'] == $old_event['start']) return;
1957
+		if ($old_event !== null && $event['start'] == $old_event['start'])
1958
+		{
1959
+			return;
1960
+		}
1834 1961
 
1835 1962
 		$time = new egw_time($event['start']);
1836 1963
 		if(!is_array($event['alarm']))
@@ -1908,7 +2035,10 @@  discard block
 block discarded – undo
1908 2035
 		if (is_array($old_event) || $old_event > 0)
1909 2036
 		{
1910 2037
 			// preserve categories without users read access
1911
-			if (!is_array($old_event)) $old_event = $this->read($old_event);
2038
+			if (!is_array($old_event))
2039
+			{
2040
+				$old_event = $this->read($old_event);
2041
+			}
1912 2042
 			$old_categories = explode(',',$old_event['category']);
1913 2043
 			$old_cats_preserve = array();
1914 2044
 			if (is_array($old_categories) && count($old_categories) > 0)
@@ -1999,7 +2129,10 @@  discard block
 block discarded – undo
1999 2129
 				"($filter)[EVENT]:" . array2string($event)."\n",3,$this->logfile);
2000 2130
 		}
2001 2131
 
2002
-		if (!isset($event['recurrence'])) $event['recurrence'] = 0;
2132
+		if (!isset($event['recurrence']))
2133
+		{
2134
+			$event['recurrence'] = 0;
2135
+		}
2003 2136
 
2004 2137
 		if ($filter == 'master')
2005 2138
 		{
@@ -2053,19 +2186,26 @@  discard block
 block discarded – undo
2053 2186
 							$matchingEvents[] = $egwEvent['id'] . ':' . (int)$event['recurrence'];
2054 2187
 						}
2055 2188
 					}
2056
-				} elseif ($filter != 'master' && ($filter == 'exact' ||
2189
+				}
2190
+				elseif ($filter != 'master' && ($filter == 'exact' ||
2057 2191
 							$event['recur_type'] == $egwEvent['recur_type'] &&
2058 2192
 							strpos($egwEvent['title'], $event['title']) === 0))
2059 2193
 				{
2060 2194
 					$matchingEvents[] = $egwEvent['id']; // we found the event
2061 2195
 				}
2062 2196
 			}
2063
-			if (!empty($matchingEvents) || $filter == 'exact') return $matchingEvents;
2197
+			if (!empty($matchingEvents) || $filter == 'exact')
2198
+			{
2199
+				return $matchingEvents;
2200
+			}
2064 2201
 		}
2065 2202
 		unset($event['id']);
2066 2203
 
2067 2204
 		// No chance to find a master without [U]ID
2068
-		if ($filter == 'master' && empty($event['uid'])) return $matchingEvents;
2205
+		if ($filter == 'master' && empty($event['uid']))
2206
+		{
2207
+			return $matchingEvents;
2208
+		}
2069 2209
 
2070 2210
 		// only query calendars of users, we have READ-grants from
2071 2211
 		$users = array();
@@ -2074,17 +2214,23 @@  discard block
 block discarded – undo
2074 2214
 			$user = trim($user);
2075 2215
 			if ($this->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|EGW_ACL_FREEBUSY,0,$user))
2076 2216
 			{
2077
-				if ($user && !in_array($user,$users))	// already added?
2217
+				if ($user && !in_array($user,$users))
2218
+				{
2219
+					// already added?
2078 2220
 				{
2079 2221
 					$users[] = $user;
2080 2222
 				}
2223
+				}
2081 2224
 			}
2082 2225
 			elseif ($GLOBALS['egw']->accounts->get_type($user) != 'g')
2083 2226
 			{
2084 2227
 				continue;	// for non-groups (eg. users), we stop here if we have no read-rights
2085 2228
 			}
2086 2229
 			// the further code is only for real users
2087
-			if (!is_numeric($user)) continue;
2230
+			if (!is_numeric($user))
2231
+			{
2232
+				continue;
2233
+			}
2088 2234
 
2089 2235
 			// for groups we have to include the members
2090 2236
 			if ($GLOBALS['egw']->accounts->get_type($user) == 'g')
@@ -2164,7 +2310,10 @@  discard block
 block discarded – undo
2164 2310
 			}
2165 2311
 			foreach ($matchFields as $key)
2166 2312
 			{
2167
-				if (isset($event[$key])) $query['cal_'.$key] = $event[$key];
2313
+				if (isset($event[$key]))
2314
+				{
2315
+					$query['cal_'.$key] = $event[$key];
2316
+				}
2168 2317
 			}
2169 2318
 		}
2170 2319
 
@@ -2204,7 +2353,10 @@  discard block
 block discarded – undo
2204 2353
 					'[FOUND]: ' . array2string($egwEvent)."\n",3,$this->logfile);
2205 2354
 			}
2206 2355
 
2207
-			if (in_array($egwEvent['id'], $matchingEvents)) continue;
2356
+			if (in_array($egwEvent['id'], $matchingEvents))
2357
+			{
2358
+				continue;
2359
+			}
2208 2360
 
2209 2361
 			// convert timezone id of event to tzid (iCal id like 'Europe/Berlin')
2210 2362
 			if (!$egwEvent['tz_id'] || !($egwEvent['tzid'] = calendar_timezones::id2tz($egwEvent['tz_id'])))
@@ -2371,13 +2523,16 @@  discard block
 block discarded – undo
2371 2523
 					foreach ($event['participants'] as $attendee => $status)
2372 2524
 					{
2373 2525
 						if (!isset($egwEvent['participants'][$attendee]) &&
2374
-								$attendee != $egwEvent['owner']) // ||
2526
+								$attendee != $egwEvent['owner'])
2527
+						{
2528
+							// ||
2375 2529
 							//(!$relax && $egw_event['participants'][$attendee] != $status))
2376 2530
 						{
2377 2531
 							if ($this->log)
2378 2532
 							{
2379 2533
 								error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
2380 2534
 								"() additional event['participants']: $attendee\n",3,$this->logfile);
2535
+						}
2381 2536
 							}
2382 2537
 							continue 2;
2383 2538
 						}
@@ -2699,7 +2854,10 @@  discard block
 block discarded – undo
2699 2854
 		foreach(array('start','end','recur_enddate','recurrence') as $ts)
2700 2855
 		{
2701 2856
 			// we convert here from server-time to timestamps in user-time!
2702
-			if (isset($event[$ts])) $event[$ts] = $event[$ts] ? $this->date2usertime($event[$ts]) : 0;
2857
+			if (isset($event[$ts]))
2858
+			{
2859
+				$event[$ts] = $event[$ts] ? $this->date2usertime($event[$ts]) : 0;
2860
+			}
2703 2861
 		}
2704 2862
 		// same with the recur exceptions
2705 2863
 		if (isset($event['recur_exception']) && is_array($event['recur_exception']))
@@ -2727,9 +2885,12 @@  discard block
 block discarded – undo
2727 2885
 	 */
2728 2886
 	function purge($age)
2729 2887
 	{
2730
-		if (is_numeric($age) && $age > 0)	// just make sure bogus values dont delete everything
2888
+		if (is_numeric($age) && $age > 0)
2889
+		{
2890
+			// just make sure bogus values dont delete everything
2731 2891
 		{
2732 2892
 			$this->so->purge(time() - 365*24*3600*(float)$age);
2733 2893
 		}
2894
+		}
2734 2895
 	}
2735 2896
 }
Please login to merge, or discard this patch.
calendar/inc/class.calendar_merge.inc.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -326,20 +326,20 @@  discard block
 block discarded – undo
326 326
 	}
327 327
 
328 328
 	/**
329
-	* Table plugin for event
330
-	* Lists events for a certain day of the week.  Only works for one week at a time, so for multiple weeks,
331
-	* use multiple date ranges.
332
-	*
333
-	* Use:
334
-	* $$table/Monday$$ $$starttime$$ $$title$$ $$endtable$$
335
-	* The day of the week may be language specific (date('l')).
336
-	*
337
-	* @param string $plugin (Monday-Sunday)
338
-	* @param int/array date or date range
339
-	* @param int $n Row number
340
-	* @param string $repeat Text being repeated for each entry
341
-	* @return array
342
-	*/
329
+	 * Table plugin for event
330
+	 * Lists events for a certain day of the week.  Only works for one week at a time, so for multiple weeks,
331
+	 * use multiple date ranges.
332
+	 *
333
+	 * Use:
334
+	 * $$table/Monday$$ $$starttime$$ $$title$$ $$endtable$$
335
+	 * The day of the week may be language specific (date('l')).
336
+	 *
337
+	 * @param string $plugin (Monday-Sunday)
338
+	 * @param int/array date or date range
339
+	 * @param int $n Row number
340
+	 * @param string $repeat Text being repeated for each entry
341
+	 * @return array
342
+	 */
343 343
 	public function day_plugin($plugin,$date,$n,$repeat)
344 344
 	{
345 345
 		static $days = null;
@@ -414,16 +414,16 @@  discard block
 block discarded – undo
414 414
 	}
415 415
 
416 416
 	/**
417
-	* Table plugin for a certain date
418
-	*
419
-	* Can be either a particular date (2011-02-15) or a day of the month (15)
420
-	*
421
-	* @param string $plugin
422
-	* @param int $id ID for this record
423
-	* @param int $n Repeated row number
424
-	* @param string $repeat Text being repeated for each entry
425
-	* @return array
426
-	*/
417
+	 * Table plugin for a certain date
418
+	 *
419
+	 * Can be either a particular date (2011-02-15) or a day of the month (15)
420
+	 *
421
+	 * @param string $plugin
422
+	 * @param int $id ID for this record
423
+	 * @param int $n Repeated row number
424
+	 * @param string $repeat Text being repeated for each entry
425
+	 * @return array
426
+	 */
427 427
 	public function day($plugin,$id,$n,$repeat)
428 428
 	{
429 429
 		static $days = null;
@@ -515,15 +515,15 @@  discard block
 block discarded – undo
515 515
 	}
516 516
 
517 517
 	/**
518
-	* Table plugin for participants
519
-	*
520
-	* Copied from eventmgr resources
521
-	*
522
-	* @param string $plugin
523
-	* @param int $id
524
-	* @param int $n
525
-	* @return array
526
-	*/
518
+	 * Table plugin for participants
519
+	 *
520
+	 * Copied from eventmgr resources
521
+	 *
522
+	 * @param string $plugin
523
+	 * @param int $id
524
+	 * @param int $n
525
+	 * @return array
526
+	 */
527 527
 	public function participant($plugin,$id,$n)
528 528
 	{
529 529
 		unset($plugin);	// not used, but required by function signature
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 				{
583 583
 					foreach($resource as $name => $value)
584 584
 					{
585
-					    $replacements['$$'.$name.'$$'] = $value;
585
+						$replacements['$$'.$name.'$$'] = $value;
586 586
 					}
587 587
 				}
588 588
 				break;
Please login to merge, or discard this patch.
Braces   +165 added lines, -52 removed lines patch added patch discarded remove patch
@@ -86,10 +86,12 @@  discard block
 block discarded – undo
86 86
 		{
87 87
 			$this->table_plugins[date('l', strtotime("+$i days"))] = 'day_plugin';
88 88
 		}
89
-		for($i = 1; $i <= 31; $i++) {
89
+		for($i = 1; $i <= 31; $i++)
90
+		{
90 91
 			$this->table_plugins['day_'.$i] = 'day'; // Numerically by day number (1-31)
91 92
 		}
92
-		foreach(self::$relative as $day) {
93
+		foreach(self::$relative as $day)
94
+		{
93 95
 			$this->table_plugins[$day] = 'day'; // Current day
94 96
 		}
95 97
 		$this->query = $GLOBALS['egw']->session->appsession('session_data','calendar');
@@ -125,9 +127,16 @@  discard block
 block discarded – undo
125 127
 				$events = $ids;
126 128
 				$ids = array('start' => PHP_INT_MAX, 'end' => 0);
127 129
 				$this->ids = array();
128
-				foreach($events as $event) {
129
-					if($event['start'] && egw_time::to($event['start'],'ts') < $ids['start']) $ids['start'] = egw_time::to($event['start'],'ts');
130
-					if($event['end'] && egw_time::to($event['end'],'ts') > $ids['end']) $ids['end'] = egw_time::to($event['end'],'ts');
130
+				foreach($events as $event)
131
+				{
132
+					if($event['start'] && egw_time::to($event['start'],'ts') < $ids['start'])
133
+					{
134
+						$ids['start'] = egw_time::to($event['start'],'ts');
135
+					}
136
+					if($event['end'] && egw_time::to($event['end'],'ts') > $ids['end'])
137
+					{
138
+						$ids['end'] = egw_time::to($event['end'],'ts');
139
+					}
131 140
 					// Keep ids for future use
132 141
 					$this->ids[] = $event['id'];
133 142
 				}
@@ -167,9 +176,16 @@  discard block
 block discarded – undo
167 176
 			$events = $id;
168 177
 			$id = array('start' => PHP_INT_MAX, 'end' => 0);
169 178
 			$this->ids = array();
170
-			foreach($events as $event) {
171
-				if($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start'];
172
-				if($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end'];
179
+			foreach($events as $event)
180
+			{
181
+				if($event['start'] && $event['start'] < $id['start'])
182
+				{
183
+					$id['start'] = $event['start'];
184
+				}
185
+				if($event['end'] && $event['end'] > $id['end'])
186
+				{
187
+					$id['end'] = $event['end'];
188
+				}
173 189
 				// Keep ids for future use
174 190
 				$this->ids[]  = $event['id'];
175 191
 			}
@@ -196,7 +212,10 @@  discard block
 block discarded – undo
196 212
 				foreach(self::$range_tags as $key => $format)
197 213
 				{
198 214
 					$value = date($format, $key == 'end' ? $id['end'] : $id['start']);
199
-					if($key == 'month') $value = lang($value);
215
+					if($key == 'month')
216
+					{
217
+						$value = lang($value);
218
+					}
200 219
 					$values["$\$range/$key$$"] = $value;
201 220
 				}
202 221
 			}
@@ -215,9 +234,12 @@  discard block
 block discarded – undo
215 234
 	public function calendar_replacements($id,$prefix = '', &$content = '')
216 235
 	{
217 236
 		$replacements = array();
218
-		if(!is_array($id) || !$id['start']) {
237
+		if(!is_array($id) || !$id['start'])
238
+		{
219 239
 			$event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null);
220
-		} else {
240
+		}
241
+		else
242
+		{
221 243
 			$event = $id;
222 244
 		}
223 245
 
@@ -236,7 +258,10 @@  discard block
 block discarded – undo
236 258
 		$replacements['$$' . ($prefix ? $prefix . '/' : '') . 'calendar_id'. '$$'] = $event['id'];
237 259
 		foreach($this->bo->event2array($event) as $name => $data)
238 260
 		{
239
-			if (substr($name,-4) == 'date') $name = substr($name,0,-4);
261
+			if (substr($name,-4) == 'date')
262
+			{
263
+				$name = substr($name,0,-4);
264
+			}
240 265
 			$replacements['$$' . ($prefix ? $prefix . '/' : '') . 'calendar_'.$name . '$$'] = is_array($data['data']) ? implode(', ',$data['data']) : $data['data'];
241 266
 		}
242 267
 		// Add seperate lists of participants by type
@@ -275,7 +300,10 @@  discard block
 block discarded – undo
275 300
 			) as $name => $format)
276 301
 			{
277 302
 				$value = egw_time::to($event[$what],$format);
278
-				if ($format == 'l') $value = lang($value);
303
+				if ($format == 'l')
304
+				{
305
+					$value = lang($value);
306
+				}
279 307
 				$replacements['$$' .($prefix ? $prefix.'/':'').'calendar_'.$what.$name.'$$'] = $value;
280 308
 			}
281 309
 		}
@@ -318,24 +346,41 @@  discard block
 block discarded – undo
318 346
 	public function day_plugin($plugin,$date,$n,$repeat)
319 347
 	{
320 348
 		static $days = null;
321
-		if(is_array($date) && !$date['start']) {
349
+		if(is_array($date) && !$date['start'])
350
+		{
322 351
 			// List of IDs
323
-			if($date[0]['start']) {
352
+			if($date[0]['start'])
353
+			{
324 354
 				$id = array('start' => PHP_INT_MAX, 'end' => 0);
325
-				foreach($date as $event) {
326
-					if($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start'];
327
-					if($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end'];
355
+				foreach($date as $event)
356
+				{
357
+					if($event['start'] && $event['start'] < $id['start'])
358
+					{
359
+						$id['start'] = $event['start'];
360
+					}
361
+					if($event['end'] && $event['end'] > $id['end'])
362
+					{
363
+						$id['end'] = $event['end'];
364
+					}
328 365
 				}
329 366
 				$date = $id;
330
-			} else {
367
+			}
368
+			else
369
+			{
331 370
 				$event = $this->bo->read(is_array($date) ? $date['id'] : $date, is_array($date) ? $date['recur_date'] : null);
332
-				if(date('l',$event['start']) != $plugin) return array();
371
+				if(date('l',$event['start']) != $plugin)
372
+				{
373
+					return array();
374
+				}
333 375
 				$date = $event['start'];
334 376
 			}
335 377
 		}
336 378
 
337 379
 		$_date = $date['start'] ? $date['start'] : $date;
338
-		if($days[date('Ymd',$_date)][$plugin]) return $days[date('Ymd',$_date)][$plugin][$n];
380
+		if($days[date('Ymd',$_date)][$plugin])
381
+		{
382
+			return $days[date('Ymd',$_date)][$plugin][$n];
383
+		}
339 384
 
340 385
 		$events = $this->bo->search($this->query + array(
341 386
 			'start' => $date['end'] ? $date['start'] : mktime(0,0,0,date('m',$_date),date('d',$_date),date('Y',$_date)),
@@ -347,20 +392,29 @@  discard block
 block discarded – undo
347 392
 			'cfs' => array(),	// read all custom-fields
348 393
 		));
349 394
 
350
-		if (true) $days = array();
395
+		if (true)
396
+		{
397
+			$days = array();
398
+		}
351 399
 		$replacements = array();
352 400
 		$time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i';
353 401
 		foreach($events as $day => $list)
354 402
 		{
355 403
 			foreach($list as $event)
356 404
 			{
357
-				if($this->ids && !in_array($event['id'], $this->ids)) continue;
405
+				if($this->ids && !in_array($event['id'], $this->ids))
406
+				{
407
+					continue;
408
+				}
358 409
 				$start = egw_time::to($event['start'], 'array');
359 410
 				$end = egw_time::to($event['end'], 'array');
360 411
 				$replacements = $this->calendar_replacements($event);
361
-				if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) {
412
+				if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day'])
413
+				{
362 414
 					$dow = date('l',$event['start']);
363
-				} else {
415
+				}
416
+				else
417
+				{
364 418
 					$dow = date('l', strtotime($day));
365 419
 					// Fancy date+time formatting for multi-day events
366 420
 					$replacements['$$calendar_starttime$$'] = date($time_format, $day == date('Ymd', $event['start']) ? $event['start'] : mktime(0,0,0,0,0,1));
@@ -369,12 +423,14 @@  discard block
 block discarded – undo
369 423
 
370 424
 				$days[date('Ymd',$_date)][$dow][] = $replacements;
371 425
 			}
372
-			if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) {
426
+			if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false)
427
+			{
373 428
 				$date_marker = array(
374 429
 					'$$day/date$$' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], strtotime($day)),
375 430
 					'$$day/name$$' => lang(date('l', strtotime($day)))
376 431
 				);
377
-				if(!is_array($days[date('Ymd',$_date)][date('l',strtotime($day))])) {
432
+				if(!is_array($days[date('Ymd',$_date)][date('l',strtotime($day))]))
433
+				{
378 434
 					$blank = $this->calendar_replacements(array());
379 435
 					foreach($blank as &$value)
380 436
 					{
@@ -410,16 +466,26 @@  discard block
 block discarded – undo
410 466
 			if($id[0]['start'])
411 467
 			{
412 468
 				$dates = array('start' => PHP_INT_MAX, 'end' => 0);
413
-				foreach($id as $event) {
414
-					if($event['start'] && $event['start'] < $dates['start']) $dates['start'] = $event['start'];
415
-					if($event['end'] && $event['end'] > $dates['end']) $dates['end'] = $event['end'];
469
+				foreach($id as $event)
470
+				{
471
+					if($event['start'] && $event['start'] < $dates['start'])
472
+					{
473
+						$dates['start'] = $event['start'];
474
+					}
475
+					if($event['end'] && $event['end'] > $dates['end'])
476
+					{
477
+						$dates['end'] = $event['end'];
478
+					}
416 479
 				}
417 480
 				$id = $dates;
418 481
 			}
419 482
 			$arr = $this->bo->date2array($id['start']);
420 483
 			$arr['day'] = $which;
421 484
 			$date = $this->bo->date2ts($arr);
422
-			if(is_array($id) && $id['start'] && ($date < $id['start'] || $date > $id['end'])) return array();
485
+			if(is_array($id) && $id['start'] && ($date < $id['start'] || $date > $id['end']))
486
+			{
487
+				return array();
488
+			}
423 489
 		}
424 490
 		elseif ($plugin == 'selected')
425 491
 		{
@@ -429,16 +495,26 @@  discard block
 block discarded – undo
429 495
 		{
430 496
 			$date = strtotime($plugin);
431 497
 		}
432
-		if($type == 'day' && is_array($id) && !$id['start']) {
498
+		if($type == 'day' && is_array($id) && !$id['start'])
499
+		{
433 500
 			$event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null);
434
-			if($which && date('d',$event['start']) != $which) return array();
435
-			if(date('Ymd',$date) != date('Ymd', $event['start'])) return array();
501
+			if($which && date('d',$event['start']) != $which)
502
+			{
503
+				return array();
504
+			}
505
+			if(date('Ymd',$date) != date('Ymd', $event['start']))
506
+			{
507
+				return array();
508
+			}
436 509
 			return $n == 0 ? $this->calendar_replacements($event) : array();
437 510
 		}
438 511
 
439 512
 		// Use start for cache, in case of multiple months
440 513
 		$_date = $id['start'] ? $id['start'] : $date;
441
-		if($days[date('Ymd',$_date)][$plugin]) return $days[date('Ymd',$_date)][$plugin][$n];
514
+		if($days[date('Ymd',$_date)][$plugin])
515
+		{
516
+			return $days[date('Ymd',$_date)][$plugin][$n];
517
+		}
442 518
 
443 519
 		$events = $this->bo->search($this->query + array(
444 520
 			'start' => $date,
@@ -451,31 +527,42 @@  discard block
 block discarded – undo
451 527
 		));
452 528
 
453 529
 		$replacements = array();
454
-		if (true) $days = array();
530
+		if (true)
531
+		{
532
+			$days = array();
533
+		}
455 534
 		$time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i';
456 535
 		foreach($events as $day => $list)
457 536
 		{
458 537
 			foreach($list as $event)
459 538
 			{
460
-				if($this->ids && !in_array($event['id'], $this->ids)) continue;
539
+				if($this->ids && !in_array($event['id'], $this->ids))
540
+				{
541
+					continue;
542
+				}
461 543
 				$start = egw_time::to($event['start'], 'array');
462 544
 				$end = egw_time::to($event['end'], 'array');
463 545
 				$replacements = $this->calendar_replacements($event);
464
-				if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) {
546
+				if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day'])
547
+				{
465 548
 					//$dow = date('l',$event['start']);
466
-				} else {
549
+				}
550
+				else
551
+				{
467 552
 					// Fancy date+time formatting for multi-day events
468 553
 					$replacements['$$calendar_starttime$$'] = date($time_format, $day == date('Ymd', $event['start']) ? $event['start'] : mktime(0,0,0,0,0,1));
469 554
 					$replacements['$$calendar_endtime$$'] = date($time_format, $day == date('Ymd', $event['end']) ? $event['end'] : mktime(23,59,59,0,0,0));
470 555
 				}
471 556
 				$days[date('Ymd',$_date)][$plugin][] = $replacements;
472 557
 			}
473
-			if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) {
558
+			if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false)
559
+			{
474 560
 				$date_marker = array(
475 561
 					'$$day/date$$' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], strtotime($day)),
476 562
 					'$$day/name$$' => lang(date('l', strtotime($day)))
477 563
 				);
478
-				if(!is_array($days[date('Ymd',$_date)][$plugin])) {
564
+				if(!is_array($days[date('Ymd',$_date)][$plugin]))
565
+				{
479 566
 					$blank = $this->calendar_replacements(array());
480 567
 					foreach($blank as &$value)
481 568
 					{
@@ -503,22 +590,35 @@  discard block
 block discarded – undo
503 590
 	{
504 591
 		unset($plugin);	// not used, but required by function signature
505 592
 
506
-		if(!is_array($id) || !$id['start']) {
593
+		if(!is_array($id) || !$id['start'])
594
+		{
507 595
 			$event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null);
508
-		} else {
596
+		}
597
+		else
598
+		{
509 599
 			$event = $id;
510 600
 		}
511 601
 
512
-		if(!is_array($event['participants']) || $n >= count($event['participants'])) return array();
602
+		if(!is_array($event['participants']) || $n >= count($event['participants']))
603
+		{
604
+			return array();
605
+		}
513 606
 
514 607
 		$participant = null;
515 608
 		$status = null;
516 609
 		$i = -1;
517
-		foreach($event['participants'] as $participant => $status) {
518
-			if(++$i == $n) break;
610
+		foreach($event['participants'] as $participant => $status)
611
+		{
612
+			if(++$i == $n)
613
+			{
614
+				break;
615
+			}
519 616
 		}
520 617
 
521
-		if(!$participant) return array();
618
+		if(!$participant)
619
+		{
620
+			return array();
621
+		}
522 622
 
523 623
 		// Add some common information
524 624
 		$quantity = $role = null;
@@ -552,7 +652,10 @@  discard block
 block discarded – undo
552 652
 				$replacements = $this->contact_replacements(substr($participant,1),'');
553 653
 				break;
554 654
 			case 'r':
555
-				if (is_null(self::$resources)) self::$resources = CreateObject('resources.resources_bo');
655
+				if (is_null(self::$resources))
656
+				{
657
+					self::$resources = CreateObject('resources.resources_bo');
658
+				}
556 659
 				if (($resource = self::$resources->read(substr($participant,1))))
557 660
 				{
558 661
 					foreach($resource as $name => $value)
@@ -613,14 +716,23 @@  discard block
 block discarded – undo
613 716
 			'calendar_owner'    => lang('Owner'),
614 717
 		) as $name => $label)
615 718
 		{
616
-			if (in_array($name,array('start','end')) && $n&1)		// main values, which should be in the first column
719
+			if (in_array($name,array('start','end')) && $n&1)
720
+			{
721
+				// main values, which should be in the first column
617 722
 			{
618 723
 				echo "</tr>\n";
724
+			}
619 725
 				$n++;
620 726
 			}
621
-			if (!($n&1)) echo '<tr>';
727
+			if (!($n&1))
728
+			{
729
+				echo '<tr>';
730
+			}
622 731
 			echo '<td>{{'.$name.'}}</td><td>'.$label.'</td>';
623
-			if ($n&1) echo "</tr>\n";
732
+			if ($n&1)
733
+			{
734
+				echo "</tr>\n";
735
+			}
624 736
 			$n++;
625 737
 		}
626 738
 
@@ -671,7 +783,8 @@  discard block
 block discarded – undo
671 783
 		}
672 784
 		echo '</table></td><td colspan="2"><table >';
673 785
 		echo '<tr><td><h3>'.lang('Daily tables').":</h3></td></tr>";
674
-		foreach(self::$relative as $value) {
786
+		foreach(self::$relative as $value)
787
+		{
675 788
 			echo '<tr><td>{{table/'.$value. '}} ... {{endtable}}</td></tr>';
676 789
 		}
677 790
 		echo '<tr><td>{{table/day_n}} ... {{endtable}}</td><td>1 <= n <= 31</td></tr>';
Please login to merge, or discard this patch.
calendar/inc/class.calendar_export_csv.inc.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -323,17 +323,17 @@
 block discarded – undo
323 323
 		$days = $states['days'];
324 324
 		$ui = new calendar_uiviews($states);
325 325
 		if (!$days)
326
-                {
327
-                        $days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview'];
328
-                        if ($days != 5) $days = 7;
329
-                }
326
+				{
327
+						$days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview'];
328
+						if ($days != 5) $days = 7;
329
+				}
330 330
 		if ($states['view'] == 'week' && $days == 4)         // next 4 days view
331
-                {
332
-                        $query['start'] = $this->bo->date2ts($states['date']);
333
-                        $query['end'] = strtotime("+$days days",$query['start']) - 1;
334
-                }
335
-                else
336
-                {
331
+				{
332
+						$query['start'] = $this->bo->date2ts($states['date']);
333
+						$query['end'] = strtotime("+$days days",$query['start']) - 1;
334
+				}
335
+				else
336
+				{
337 337
 			$query['start'] = $ui->datetime->get_weekday_start($states['year'],$states['month'],$states['day']);
338 338
 			if ($days == 5)         // no weekend-days
339 339
 			{
Please login to merge, or discard this patch.
Braces   +97 added lines, -36 removed lines patch added patch discarded remove patch
@@ -14,9 +14,11 @@  discard block
 block discarded – undo
14 14
 /**
15 15
  * export CSV plugin of calendar
16 16
  */
17
-class calendar_export_csv implements importexport_iface_export_plugin {
17
+class calendar_export_csv implements importexport_iface_export_plugin
18
+{
18 19
 
19
-	public function __construct() {
20
+	public function __construct()
21
+	{
20 22
 		translation::add_app('calendar');
21 23
 		$this->bo = new calendar_bo();
22 24
 		$this->get_selects();
@@ -27,15 +29,23 @@  discard block
 block discarded – undo
27 29
 	 *
28 30
 	 * @param egw_record $_definition
29 31
 	 */
30
-	public function export( $_stream, importexport_definition $_definition) {
32
+	public function export( $_stream, importexport_definition $_definition)
33
+	{
31 34
 		$options = $_definition->plugin_options;
32 35
 
33 36
 		$limit_exception = bo_merge::is_export_limit_excepted();
34
-		if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar');
37
+		if (!$limit_exception)
38
+		{
39
+			$export_limit = bo_merge::getExportLimit('calendar');
40
+		}
35 41
 		// Custom fields need to be specifically requested
36 42
 		$cfs = array();
37
-		foreach($options['mapping'] + (array)$_definition->filter as $key => $label) {
38
-			if($key[0] == '#') $cfs[] = substr($key,1);
43
+		foreach($options['mapping'] + (array)$_definition->filter as $key => $label)
44
+		{
45
+			if($key[0] == '#')
46
+			{
47
+				$cfs[] = substr($key,1);
48
+			}
39 49
 		}
40 50
 
41 51
 		$query = array(
@@ -55,7 +65,8 @@  discard block
 block discarded – undo
55 65
 					'users'         => $options['criteria']['owner'],
56 66
 					'cfs'		=> $cfs // Otherwise we shouldn't get any custom fields
57 67
 				);
58
-				if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
68
+				if(bo_merge::hasExportLimit($export_limit) && !$limit_exception)
69
+				{
59 70
 					$query['offset'] = 0;
60 71
 					$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
61 72
 				}
@@ -63,28 +74,34 @@  discard block
 block discarded – undo
63 74
 				break;
64 75
 			case 'search_results':
65 76
 				$states = $GLOBALS['egw']->session->appsession('session_data','calendar');
66
-				if($states['view'] == 'listview') {
77
+				if($states['view'] == 'listview')
78
+				{
67 79
 					$query = $GLOBALS['egw']->session->appsession('calendar_list','calendar');
68 80
 					$query['num_rows'] = -1;        // all
69 81
 					$query['csv_export'] = true;	// so get_rows method _can_ produce different content or not store state in the session
70 82
 					$query['start'] = 0;
71 83
 					$query['cfs'] = $cfs;
72 84
 
73
-					if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
85
+					if(bo_merge::hasExportLimit($export_limit) && !$limit_exception)
86
+					{
74 87
 						$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
75 88
 					}
76 89
 					$ui = new calendar_uilist();
77 90
 					$ui->get_rows($query, $events, $unused);
78
-				} else {
91
+				}
92
+				else
93
+				{
79 94
 					$query = $GLOBALS['egw']->session->appsession('session_data','calendar');
80 95
 					$query['users'] = explode(',', $query['owner']);
81 96
 					$query['num_rows'] = -1;
82
-					if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
97
+					if(bo_merge::hasExportLimit($export_limit) && !$limit_exception)
98
+					{
83 99
 						$query['num_rows'] = (int)$export_limit;  // ! int of 'no' is 0
84 100
 					}
85 101
 
86 102
 					$events = array();
87
-					switch($states['view']) {
103
+					switch($states['view'])
104
+					{
88 105
 						case 'month':
89 106
 							$query += $this->get_query_month($states);
90 107
 							break;
@@ -136,8 +153,14 @@  discard block
 block discarded – undo
136 153
 					}
137 154
 
138 155
 					// Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10)
139
-					if($value['from']) $query['sql_filter'][] = "cal_$field >= " . (int)$value['from'];
140
-					if($value['to']) $query['sql_filter'][] = "cal_$field <= " . (int)$value['to'];
156
+					if($value['from'])
157
+					{
158
+						$query['sql_filter'][] = "cal_$field >= " . (int)$value['from'];
159
+					}
160
+					if($value['to'])
161
+					{
162
+						$query['sql_filter'][] = "cal_$field <= " . (int)$value['to'];
163
+					}
141 164
 
142 165
 				}
143 166
 				if($query['sql_filter'] && is_array($query['sql_filter']))
@@ -155,36 +178,52 @@  discard block
 block discarded – undo
155 178
 		}
156 179
 
157 180
 		$export_object = new importexport_export_csv($_stream, (array)$options);
158
-		if (!$limit_exception) $export_object->export_limit = $export_limit;
181
+		if (!$limit_exception)
182
+		{
183
+			$export_object->export_limit = $export_limit;
184
+		}
159 185
 		$export_object->set_mapping($options['mapping']);
160 186
 		$convert_fields = calendar_egw_record::$types;
161 187
 
162 188
 		$recurrence = $this->bo->recur_types;
163 189
 
164 190
 		$record = new calendar_egw_record();
165
-		foreach ($events as $event) {
191
+		foreach ($events as $event)
192
+		{
166 193
 			// the condition below (2 lines) may only work on enum_recuring=false and using the iterator to test an recurring event on the given timerange
167 194
 			// Get rid of yearly recurring events that don't belong
168 195
 			//if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue;
169 196
 			// Add in participants
170
-			if($options['mapping']['participants']) {
197
+			if($options['mapping']['participants'])
198
+			{
171 199
 				$event['participants'] = implode(", ",$this->bo->participants($event,true));
172 200
 			}
173 201
 			if (is_array($event))
174 202
 			{
175 203
 				$record->set_record($event);
176
-				if($options['mapping']['recurrence']) {
204
+				if($options['mapping']['recurrence'])
205
+				{
177 206
 					$record->recurrence = $recurrence[$record->recur_type];
178
-					if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval;
207
+					if($record->recur_type != MCAL_RECUR_NONE)
208
+					{
209
+						$record->recurrence .= ' / '. $record->recur_interval;
210
+					}
179 211
 				}
180 212
 
181 213
 				// Standard stuff
182
-				if($options['convert']) {
214
+				if($options['convert'])
215
+				{
183 216
 					importexport_export_csv::convert($record, $convert_fields, 'calendar', $this->selects);
184
-				} else {
217
+				}
218
+				else
219
+				{
185 220
 					// Implode arrays, so they don't say 'Array'
186
-					foreach($record->get_record_array() as $key => $value) {
187
-						if(is_array($value)) $record->$key = implode(',', $value);
221
+					foreach($record->get_record_array() as $key => $value)
222
+					{
223
+						if(is_array($value))
224
+						{
225
+							$record->$key = implode(',', $value);
226
+						}
188 227
 					}
189 228
 	 			}
190 229
 				$export_object->export_record($record);
@@ -199,7 +238,8 @@  discard block
 block discarded – undo
199 238
 	 *
200 239
 	 * @return string name
201 240
 	 */
202
-	public static function get_name() {
241
+	public static function get_name()
242
+	{
203 243
 		return lang('Calendar CSV export');
204 244
 	}
205 245
 
@@ -208,7 +248,8 @@  discard block
 block discarded – undo
208 248
 	 *
209 249
 	 * @return string descriprion
210 250
 	 */
211
-	public static function get_description() {
251
+	public static function get_description()
252
+	{
212 253
 		return lang("Exports events from your Calendar into a CSV File.");
213 254
 	}
214 255
 
@@ -217,11 +258,13 @@  discard block
 block discarded – undo
217 258
 	 *
218 259
 	 * @return string suffix
219 260
 	 */
220
-	public static function get_filesuffix() {
261
+	public static function get_filesuffix()
262
+	{
221 263
 		return 'csv';
222 264
 	}
223 265
 
224
-	public static function get_mimetype() {
266
+	public static function get_mimetype()
267
+	{
225 268
 		return 'text/csv';
226 269
 	}
227 270
 
@@ -229,16 +272,19 @@  discard block
 block discarded – undo
229 272
 	 * return html for options.
230 273
 	 *
231 274
 	 */
232
-	public function get_options_etpl($definition = null) {
275
+	public function get_options_etpl($definition = null)
276
+	{
233 277
 	}
234 278
 
235 279
 	/**
236 280
 	 * returns selectors of this plugin
237 281
 	 *
238 282
 	 */
239
-	public function get_selectors_etpl($definition = null) {
283
+	public function get_selectors_etpl($definition = null)
284
+	{
240 285
 		$states = $GLOBALS['egw']->session->appsession('session_data','calendar');
241
-		switch($states['view']) {
286
+		switch($states['view'])
287
+		{
242 288
 			case 'month':
243 289
 				$query = $this->get_query_month($states);
244 290
 				break;
@@ -264,7 +310,10 @@  discard block
 block discarded – undo
264 310
 			$end = $ui->last;
265 311
 
266 312
 			// Special handling
267
-			if($list['filter'] == 'all') $start = $end = null;
313
+			if($list['filter'] == 'all')
314
+			{
315
+				$start = $end = null;
316
+			}
268 317
 			if($list['filter'] == 'before')
269 318
 			{
270 319
 				$end = $start;
@@ -312,24 +361,33 @@  discard block
 block discarded – undo
312 361
 		$days = $states['days'];
313 362
 		$ui = new calendar_uiviews($states);
314 363
 		if (!$days)
315
-                {
364
+		{
316 365
                         $days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview'];
317
-                        if ($days != 5) $days = 7;
366
+                        if ($days != 5)
367
+                        {
368
+                        	$days = 7;
369
+                        }
318 370
                 }
319
-		if ($states['view'] == 'week' && $days == 4)         // next 4 days view
371
+		if ($states['view'] == 'week' && $days == 4)
372
+		{
373
+			// next 4 days view
320 374
                 {
321 375
                         $query['start'] = $this->bo->date2ts($states['date']);
376
+		}
322 377
                         $query['end'] = strtotime("+$days days",$query['start']) - 1;
323 378
                 }
324 379
                 else
325 380
                 {
326 381
 			$query['start'] = $ui->datetime->get_weekday_start($states['year'],$states['month'],$states['day']);
327
-			if ($days == 5)         // no weekend-days
382
+			if ($days == 5)
383
+			{
384
+				// no weekend-days
328 385
 			{
329 386
 				switch($ui->cal_prefs['weekdaystarts'])
330 387
 				{
331 388
 					case 'Saturday':
332 389
 						$query['start'] = strtotime("+2 days",$query['start']);
390
+			}
333 391
 						break;
334 392
 					case 'Sunday':
335 393
 						$query['start'] = strtotime("+1 day",$query['start']);
@@ -405,7 +463,10 @@  discard block
 block discarded – undo
405 463
 			}
406 464
 
407 465
 			// Pass on select options
408
-			if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
466
+			if($this->selects[$field_name])
467
+			{
468
+				$settings['values'] = $this->selects[$field_name];
469
+			}
409 470
 		}
410 471
 
411 472
 	}
Please login to merge, or discard this patch.
calendar/inc/class.calendar_tracking.inc.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 		}
133 133
 
134 134
 		/**
135
-		* Do some magic with the participants and recurrance.
136
-		* If this is one of a recurring event, append the recur_date to the participant field so we can
137
-		* filter by it later.
138
-		*/
135
+		 * Do some magic with the participants and recurrance.
136
+		 * If this is one of a recurring event, append the recur_date to the participant field so we can
137
+		 * filter by it later.
138
+		 */
139 139
 		if(is_array($data['participants']))
140 140
 		{
141 141
 			$participants = $data['participants'];
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 	}
196 196
 
197 197
 	/**
198
-	* Do some magic with the participants and recurrance.
199
-	* If this is one of a recurring event, append the recur_date to the participant field so we can
200
-	* filter by it later.
201
-	*/
198
+	 * Do some magic with the participants and recurrance.
199
+	 * If this is one of a recurring event, append the recur_date to the participant field so we can
200
+	 * filter by it later.
201
+	 */
202 202
 	protected function alter_participants($participants)
203 203
 	{
204 204
 		$data = array();
Please login to merge, or discard this patch.