Completed
Push — 14.2 ( e07840...cec2da )
by Ralf
83:18 queued 52:04
created
resources/inc/class.resources_ui.inc.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1053,7 +1053,7 @@
 block discarded – undo
1053 1053
 	 * @param int &$success number of succeded actions
1054 1054
 	 * @param int &$failed number of failed actions (not enought permissions)
1055 1055
 	 * @param string &$action_msg translated verb for the actions, to be used in a message like %1 timesheets 'deleted'
1056
-	 * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
1056
+	 * @param string $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
1057 1057
 	 * @return boolean true if all actions succeded, false otherwise
1058 1058
 	 */
1059 1059
 	function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg)
Please login to merge, or discard this patch.
Spacing   +118 added lines, -119 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	function __construct()
32 32
 	{
33 33
 // 		print_r($GLOBALS['egw_info']); die();
34
-		$this->tmpl	= new etemplate_new('resources.show');
35
-		$this->bo	= new resources_bo();
34
+		$this->tmpl = new etemplate_new('resources.show');
35
+		$this->bo = new resources_bo();
36 36
 // 		$this->calui	= CreateObject('resources.ui_calviews');
37 37
 	}
38 38
 
@@ -43,36 +43,36 @@  discard block
 block discarded – undo
43 43
 	 * @param array $content content from eTemplate callback
44 44
 	 *
45 45
 	 */
46
-	function index($content='')
46
+	function index($content = '')
47 47
 	{
48 48
 		if (is_array($content))
49 49
 		{
50 50
 			$sessiondata = $content['nm'];
51 51
 			unset($sessiondata['rows']);
52
-			$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$sessiondata);
52
+			$GLOBALS['egw']->session->appsession('session_data', 'resources_index_nm', $sessiondata);
53 53
 
54 54
 			if (isset($content['btn_delete_selected']))
55 55
 			{
56
-				foreach($content['nm']['rows'] as $row)
56
+				foreach ($content['nm']['rows'] as $row)
57 57
 				{
58
-					if($res_id = $row['checkbox'][0])
58
+					if ($res_id = $row['checkbox'][0])
59 59
 					{
60
-						$msg .= '<p>'. $this->bo->delete($res_id). '</p><br>';
60
+						$msg .= '<p>'.$this->bo->delete($res_id).'</p><br>';
61 61
 					}
62 62
 				}
63 63
 				return $this->index($msg);
64 64
 			}
65
-			foreach($content['nm']['rows'] as $row)
65
+			foreach ($content['nm']['rows'] as $row)
66 66
 			{
67
-				if(isset($row['delete']))
67
+				if (isset($row['delete']))
68 68
 				{
69
-					$res_id = array_search('pressed',$row['delete']);
69
+					$res_id = array_search('pressed', $row['delete']);
70 70
 					return $this->index($this->bo->delete($res_id));
71 71
 				}
72
-				if(isset($row['view_acc']))
72
+				if (isset($row['view_acc']))
73 73
 				{
74
-					$sessiondata['filter2'] = array_search('pressed',$row['view_acc']);
75
-					$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$sessiondata);
74
+					$sessiondata['filter2'] = array_search('pressed', $row['view_acc']);
75
+					$GLOBALS['egw']->session->appsession('session_data', 'resources_index_nm', $sessiondata);
76 76
 					return $this->index();
77 77
 				}
78 78
 			}
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
 				}
85 85
 				else
86 86
 				{
87
-					if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'],
88
-						$success,$failed,$action_msg,'resources_index_nm',$msg))
87
+					if ($this->action($content['nm']['action'], $content['nm']['selected'], $content['nm']['select_all'],
88
+						$success, $failed, $action_msg, 'resources_index_nm', $msg))
89 89
 					{
90
-						$msg .= lang('%1 resource(s) %2',$success,$action_msg);
90
+						$msg .= lang('%1 resource(s) %2', $success, $action_msg);
91 91
 					}
92
-					elseif(empty($msg))
92
+					elseif (empty($msg))
93 93
 					{
94
-						$msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
94
+						$msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed);
95 95
 					}
96 96
 					else
97 97
 					{
98
-						$msg .= lang('%1 resource(s) %2, %3 failed',$success,$action_msg,$failed);
98
+						$msg .= lang('%1 resource(s) %2, %3 failed', $success, $action_msg, $failed);
99 99
 					}
100 100
 				}
101 101
 			}
@@ -106,74 +106,74 @@  discard block
 block discarded – undo
106 106
 		$content['msg'] = $msg ? $msg : $_GET['msg'];
107 107
 
108 108
 		$content['nm']['header_row']	= 'resources.show.nm_right';
109
-		$content['nm']['get_rows']		= 'resources.resources_bo.get_rows';
109
+		$content['nm']['get_rows'] = 'resources.resources_bo.get_rows';
110 110
 		$content['nm']['no_filter'] 	= False;
111
-		$content['nm']['filter_label']	= lang('Category');
112
-		$content['nm']['filter2_label']	= 'Display';
111
+		$content['nm']['filter_label'] = lang('Category');
112
+		$content['nm']['filter2_label'] = 'Display';
113 113
 		$content['nm']['filter_no_lang'] = true;
114 114
 		$content['nm']['no_cat']	= true;
115
-		$content['nm']['bottom_too']	= true;
115
+		$content['nm']['bottom_too'] = true;
116 116
 		$content['nm']['order']		= 'name';
117
-		$content['nm']['sort']		= 'ASC';
118
-		$content['nm']['store_state']	= 'get_rows';
117
+		$content['nm']['sort'] = 'ASC';
118
+		$content['nm']['store_state'] = 'get_rows';
119 119
 		$content['nm']['row_id']	= 'res_id';
120 120
 		$content['nm']['favorites'] = true;
121 121
 
122
-		$nm_session_data = $GLOBALS['egw']->session->appsession('session_data','resources_index_nm');
123
-		if($nm_session_data)
122
+		$nm_session_data = $GLOBALS['egw']->session->appsession('session_data', 'resources_index_nm');
123
+		if ($nm_session_data)
124 124
 		{
125 125
 			$content['nm'] = $nm_session_data;
126 126
 		}
127
-		$content['nm']['options-filter']= array(''=>lang('all categories'))+(array)$this->bo->acl->get_cats(EGW_ACL_READ);
127
+		$content['nm']['options-filter'] = array(''=>lang('all categories')) + (array)$this->bo->acl->get_cats(EGW_ACL_READ);
128 128
 		$content['nm']['options-filter2'] = resources_bo::$filter_options;
129
-		if(!$content['nm']['filter2'])
129
+		if (!$content['nm']['filter2'])
130 130
 		{
131 131
 			$content['nm']['filter2'] = key(resources_bo::$filter_options);
132 132
 		}
133 133
 
134 134
 		$config = config::read('resources');
135
-		if($config['history'])
135
+		if ($config['history'])
136 136
 		{
137 137
 			$content['nm']['options-filter2'][resources_bo::DELETED] = lang('Deleted');
138 138
 		}
139 139
 
140
-		if($_GET['search']) {
140
+		if ($_GET['search']) {
141 141
 			$content['nm']['search'] = $_GET['search'];
142 142
 		}
143
-		if($_GET['view_accs_of'])
143
+		if ($_GET['view_accs_of'])
144 144
 		{
145 145
 			$content['nm']['filter2'] = (int)$_GET['view_accs_of'];
146 146
 		}
147
-		$content['nm']['actions']	= $this->get_actions();
147
+		$content['nm']['actions'] = $this->get_actions();
148 148
 
149 149
 		// check if user is permitted to add resources
150 150
 		// If they can't read any categories, they won't be able to save it
151
-		if(!$this->bo->acl->get_cats(EGW_ACL_ADD) || !$this->bo->acl->get_cats(EGW_ACL_READ))
151
+		if (!$this->bo->acl->get_cats(EGW_ACL_ADD) || !$this->bo->acl->get_cats(EGW_ACL_READ))
152 152
 		{
153 153
 			$no_button['add'] = $no_button['nm']['add'] = true;
154 154
 		}
155 155
 		$no_button['back'] = true;
156 156
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('resources');
157 157
 
158
-		egw_framework::validate_file('.','resources','resources');
158
+		egw_framework::validate_file('.', 'resources', 'resources');
159 159
 
160
-		if($content['nm']['filter2'] > 0)
160
+		if ($content['nm']['filter2'] > 0)
161 161
 		{
162 162
 			$master = $this->bo->so->read(array('res_id' => $content['nm']['filter2']));
163 163
 			$content['nm']['options-filter2'] = resources_bo::$filter_options + array(
164
-				$master['res_id'] => lang('accessories of') . ' ' . $master['name']
164
+				$master['res_id'] => lang('accessories of').' '.$master['name']
165 165
 			);
166
-			$content['nm']['get_rows'] 	= 'resources.resources_bo.get_rows';
167
-			$GLOBALS['egw_info']['flags']['app_header'] = lang('resources') . ' - ' . lang('accessories of '). ' '. $master['name'] .
168
-				($master['short_description'] ? ' [' . $master['short_description'] . ']' : '');
166
+			$content['nm']['get_rows'] = 'resources.resources_bo.get_rows';
167
+			$GLOBALS['egw_info']['flags']['app_header'] = lang('resources').' - '.lang('accessories of ').' '.$master['name'].
168
+				($master['short_description'] ? ' ['.$master['short_description'].']' : '');
169 169
 		}
170 170
 		$preserv = $content;
171 171
 
172 172
 		$options = array();
173 173
 
174
-		$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$content['nm']);
174
+		$GLOBALS['egw']->session->appsession('session_data', 'resources_index_nm', $content['nm']);
175 175
 		$this->tmpl->read('resources.show');
176
-		return $this->tmpl->exec('resources.resources_ui.index',$content,$sel_options,$no_button,$preserv);
176
+		return $this->tmpl->exec('resources.resources_ui.index', $content, $sel_options, $no_button, $preserv);
177 177
 	}
178 178
 
179 179
 	/**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				'allowOnMultiple' => false,
191 191
 				'url' => 'menuaction=resources.resources_ui.edit&res_id=$id',
192 192
 				'popup' => egw_link::get_registry('resources', 'add_popup'),
193
-				'group' => $group=1,
193
+				'group' => $group = 1,
194 194
 				'disableClass' => 'rowNoEdit',
195 195
 			),
196 196
 			'add' => array(
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
272 272
 	 * @return boolean true if all actions succeded, false otherwise
273 273
 	 */
274
-	function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg)
274
+	function action($action, $checked, $use_all, &$success, &$failed, &$action_msg, $session_name, &$msg)
275 275
 	{
276 276
 		$success = $failed = 0;
277 277
 		if ($use_all)
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
 			// get the whole selection
280 280
 			$query = is_array($session_name) ? $session_name : $GLOBALS['egw']->session->appsession('session_data', $session_name);
281 281
 
282
-			@set_time_limit(0);                     // switch off the execution time limit, as it's for big selections to small
283
-			$query['num_rows'] = -1;        // all
284
-			$this->bo->get_rows($query,$resources,$readonlys);
282
+			@set_time_limit(0); // switch off the execution time limit, as it's for big selections to small
283
+			$query['num_rows'] = -1; // all
284
+			$this->bo->get_rows($query, $resources, $readonlys);
285 285
 			$checked = array();
286
-			foreach($resources as $resource)
286
+			foreach ($resources as $resource)
287 287
 			{
288 288
 				$checked[] = $resource['res_id'];
289 289
 			}
@@ -293,17 +293,17 @@  discard block
 block discarded – undo
293 293
 		// Dialogs to get options
294 294
 		list($action, $settings) = explode('_', $action, 2);
295 295
 
296
-		switch($action)
296
+		switch ($action)
297 297
 		{
298 298
 			case 'restore':
299 299
 				$action_msg = lang('restored');
300
-				foreach($checked as $n=>$id)
300
+				foreach ($checked as $n=>$id)
301 301
 				{
302 302
 					// Extra data
303
-					if(!$id) continue;
303
+					if (!$id) continue;
304 304
 					$resource = $this->bo->read($id);
305 305
 					$resource['deleted'] = null;
306
-					if($resource['accessory_of'] > 0)
306
+					if ($resource['accessory_of'] > 0)
307 307
 					{
308 308
 						/*
309 309
 						If restoring an accessory, and parent is deleted, and not in
@@ -311,18 +311,18 @@  discard block
 block discarded – undo
311 311
 						*/
312 312
 						$parent = $this->bo->read($resource['accessory_of']);
313 313
 						$checked_key = array_search($parent['res_id'], $checked);
314
-						if($checked_key === false && $parent['deleted'])
314
+						if ($checked_key === false && $parent['deleted'])
315 315
 						{
316 316
 							$resource['accessory_of'] = -1;
317 317
 						}
318 318
 					}
319 319
 
320 320
 					$this->bo->save($resource);
321
-					if($settings == 'accessories')
321
+					if ($settings == 'accessories')
322 322
 					{
323 323
 						// Restore accessories too
324
-						$accessories = $this->bo->get_acc_list($id,true);
325
-						foreach($accessories as $acc_id => $name)
324
+						$accessories = $this->bo->get_acc_list($id, true);
325
+						foreach ($accessories as $acc_id => $name)
326 326
 						{
327 327
 							$acc = $this->bo->read($acc_id);
328 328
 							$acc['deleted'] = null;
@@ -332,20 +332,20 @@  discard block
 block discarded – undo
332 332
 					}
333 333
 					$success++;
334 334
 				}
335
-				if($restored_accessories) $action_msg .= ", " . lang('%1 accessories restored',$restored_accessories);
335
+				if ($restored_accessories) $action_msg .= ", ".lang('%1 accessories restored', $restored_accessories);
336 336
 				break;
337 337
 			case 'delete':
338 338
 				$action_msg = lang('deleted');
339 339
 				$promoted_accessories = 0;
340
-				foreach($checked as $n => &$id)
340
+				foreach ($checked as $n => &$id)
341 341
 				{
342 342
 					// Extra data
343
-					if(!$id) continue;
343
+					if (!$id) continue;
344 344
 					$resource = $this->bo->read($id);
345
-					if($settings == 'promote')
345
+					if ($settings == 'promote')
346 346
 					{
347 347
 						// Handle a selected accessory
348
-						if($resource['accessory_of'] > 0)
348
+						if ($resource['accessory_of'] > 0)
349 349
 						{
350 350
 							$resource['accessory_of'] = -1;
351 351
 							$this->bo->save($resource);
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 						}
355 355
 
356 356
 						// Make associated accessories into resources - include deleted
357
-						$accessories = $this->bo->get_acc_list($id,true);
358
-						foreach($accessories as $acc_id => $name)
357
+						$accessories = $this->bo->get_acc_list($id, true);
358
+						foreach ($accessories as $acc_id => $name)
359 359
 						{
360 360
 							$acc = $this->bo->read($acc_id);
361 361
 							$acc['accessory_of'] = -1;
@@ -366,19 +366,19 @@  discard block
 block discarded – undo
366 366
 
367 367
 							// Don't need to process these ones now
368 368
 							$checked_key = array_search($acc_id, $checked);
369
-							if($checked_key !== false) unset($checked[$checked_key]);
369
+							if ($checked_key !== false) unset($checked[$checked_key]);
370 370
 						}
371 371
 					}
372 372
 					else
373 373
 					{
374 374
 						// Remove checked accessories, deleting resource will remove them
375 375
 						// We get an error if we try to delete them after they're gone
376
-						$accessories = $this->bo->get_acc_list($id,$resource['deleted']);
376
+						$accessories = $this->bo->get_acc_list($id, $resource['deleted']);
377 377
 
378
-						foreach($accessories as $acc_id => $name)
378
+						foreach ($accessories as $acc_id => $name)
379 379
 						{
380 380
 							$checked_key = array_search($acc_id, $checked);
381
-							if($checked_key !== false)
381
+							if ($checked_key !== false)
382 382
 							{
383 383
 								$success++;
384 384
 								unset($checked[$checked_key]);
@@ -392,11 +392,11 @@  discard block
 block discarded – undo
392 392
 					}
393 393
 					else
394 394
 					{
395
-						$msg = $error . "\n";
395
+						$msg = $error."\n";
396 396
 						$failed++;
397 397
 					}
398 398
 				}
399
-				if($promoted_accessories) $action_msg .= ", " . lang('%1 accessories now resources',$promoted_accessories);
399
+				if ($promoted_accessories) $action_msg .= ", ".lang('%1 accessories now resources', $promoted_accessories);
400 400
 				break;
401 401
 		}
402 402
 		return $failed == 0;
@@ -408,13 +408,13 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @param $content   Content from the eTemplate Exec call or id on inital call
410 410
 	 */
411
-	function edit($content=0,$accessory_of = -1)
411
+	function edit($content = 0, $accessory_of = -1)
412 412
 	{
413 413
 		if (is_array($content))
414 414
 		{
415 415
 			list($button) = @each($content['button']);
416 416
 			unset($content['button']);
417
-			switch($button)
417
+			switch ($button)
418 418
 			{
419 419
 				case 'save':
420 420
 				case 'apply':
@@ -425,20 +425,20 @@  discard block
 block discarded – undo
425 425
 // 						// links are already saved by eTemplate
426 426
 // 						unset($resource['link_to']['to_id']);
427 427
 // 					}
428
-					if($content['res_id'])
428
+					if ($content['res_id'])
429 429
 					{
430 430
 						 $acc_count = count($this->bo->get_acc_list($content['res_id']));
431 431
 					}
432 432
 					$result = $this->bo->save($content);
433 433
 
434
-					if(is_numeric($result))
434
+					if (is_numeric($result))
435 435
 					{
436
-						$msg = lang('Resource %1 saved!',$result);
436
+						$msg = lang('Resource %1 saved!', $result);
437 437
 						$content['res_id'] = $result;
438
-						if($acc_count && $content['accessory_of'] != -1)
438
+						if ($acc_count && $content['accessory_of'] != -1)
439 439
 						{
440 440
 							// Resource with accessories changed into accessory
441
-							if($acc_count) $msg = lang('%1 accessories now resources',$acc_count);
441
+							if ($acc_count) $msg = lang('%1 accessories now resources', $acc_count);
442 442
 						}
443 443
 					}
444 444
 					else
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 					break;
450 450
 				case 'delete':
451 451
 					unset($content['delete']);
452
-					if(!$this->bo->delete($content['res_id']))
452
+					if (!$this->bo->delete($content['res_id']))
453 453
 					{
454
-						$msg = lang('Resource %1 deleted!',$content['res_id']);
454
+						$msg = lang('Resource %1 deleted!', $content['res_id']);
455 455
 					}
456 456
 					else
457 457
 					{
@@ -459,16 +459,16 @@  discard block
 block discarded – undo
459 459
 						break;
460 460
 					}
461 461
 			}
462
-			egw_framework::refresh_opener($msg, 'resources',$content['res_id'],($button == 'delete'?'delete':'edit'));
462
+			egw_framework::refresh_opener($msg, 'resources', $content['res_id'], ($button == 'delete' ? 'delete' : 'edit'));
463 463
 
464
-			if($button != 'apply')
464
+			if ($button != 'apply')
465 465
 			{
466 466
 				egw_framework::window_close();
467 467
 			}
468 468
 
469 469
 		}
470 470
 
471
-		$nm_session_data = $GLOBALS['egw']->session->appsession('session_data','resources_index_nm');
471
+		$nm_session_data = $GLOBALS['egw']->session->appsession('session_data', 'resources_index_nm');
472 472
 		$res_id = is_numeric($content) ? (int)$content : $content['res_id'];
473 473
 		if (isset($_GET['res_id'])) $res_id = $_GET['res_id'];
474 474
 		if (isset($nm_session_data['filter2']) && $nm_session_data['filter2'] > 0) $accessory_of = $nm_session_data['filter2'];
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 		if ($res_id > 0)
478 478
 		{
479 479
 			$content = $this->bo->read($res_id);
480
-			$content['picture_src'] = strpos($content['picture_src'],'.') !== false ? 'gen_src' : $content['picture_src'];
480
+			$content['picture_src'] = strpos($content['picture_src'], '.') !== false ? 'gen_src' : $content['picture_src'];
481 481
 			$content['link_to'] = array(
482 482
 				'to_id' => $res_id,
483 483
 				'to_app' => 'resources'
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 		} elseif ($accessory_of > 0) {
486 486
 			// Pre-set according to parent
487 487
 			$owner = $this->bo->read($accessory_of);
488
-			if($owner['accessory_of'] > 0)
488
+			if ($owner['accessory_of'] > 0)
489 489
 			{
490 490
 				// Accessory of accessory not allowed, grab parent resource
491 491
 				$accessory_of = $owner['accessory_of'];
@@ -498,33 +498,32 @@  discard block
 block discarded – undo
498 498
 			$content['cat_id'] = $nm_session_data['filter'];
499 499
 			$content['bookable'] = true;
500 500
 		}
501
-		if($msg) {
501
+		if ($msg) {
502 502
 			$content['msg'] = $msg;
503 503
 		}
504 504
 
505 505
 		if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']);
506 506
 
507 507
 		// some presetes
508
-		$content['resource_picture'] = $this->bo->get_picture($content['res_id'],false);
508
+		$content['resource_picture'] = $this->bo->get_picture($content['res_id'], false);
509 509
 		// Set original size picture
510
-		$content['picture_original'] = $content['picture_src'] == 'own_src'?
511
-				'webdav.php/apps/resources/'.$content['res_id'].'/.picture.jpg': $this->bo->get_picture($content['res_id'],true);
510
+		$content['picture_original'] = $content['picture_src'] == 'own_src' ?
511
+				'webdav.php/apps/resources/'.$content['res_id'].'/.picture.jpg' : $this->bo->get_picture($content['res_id'], true);
512 512
 
513 513
 		$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
514 514
 		$content['useable'] = $content['useable'] ? $content['useable'] : 1;
515 515
 		$content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of;
516 516
 
517
-		if($content['res_id'] && $content['accessory_of'] == -1)
517
+		if ($content['res_id'] && $content['accessory_of'] == -1)
518 518
 		{
519 519
 			$content['acc_count'] = count($this->bo->get_acc_list($content['res_id']));
520 520
 		}
521 521
 		$sel_options['status'] = resources_bo::$field2label;
522 522
 
523 523
 		//$sel_options['gen_src_list'] = $this->bo->get_genpicturelist();
524
-		$sel_options['cat_id'] =  $this->bo->acl->get_cats(EGW_ACL_ADD);
525
-		$sel_options['cat_id'] = count($sel_options['cat_id']) == 1 ? $sel_options['cat_id'] :
526
-			array('' => lang('select one')) + $sel_options['cat_id'];
527
-		if($accessory_of > 0 || $content['accessory_of'] > 0)
524
+		$sel_options['cat_id'] = $this->bo->acl->get_cats(EGW_ACL_ADD);
525
+		$sel_options['cat_id'] = count($sel_options['cat_id']) == 1 ? $sel_options['cat_id'] : array('' => lang('select one')) + $sel_options['cat_id'];
526
+		if ($accessory_of > 0 || $content['accessory_of'] > 0)
528 527
 		{
529 528
 			$content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of;
530 529
 		}
@@ -539,19 +538,19 @@  discard block
 block discarded – undo
539 538
 			)
540 539
 		);
541 540
 
542
-		$sel_options['accessory_of'] = array(-1 => lang('none')) + (array)$this->bo->link_query('',$search_options);
543
-		if($res_id) unset($sel_options['accessory_of'][$res_id]);
541
+		$sel_options['accessory_of'] = array(-1 => lang('none')) + (array)$this->bo->link_query('', $search_options);
542
+		if ($res_id) unset($sel_options['accessory_of'][$res_id]);
544 543
 
545 544
 // 		$content['general|page|pictures|links'] = 'resources.edit_tabs.page';  //debug
546 545
 
547 546
 		// Permissions
548 547
 		$read_only = array();
549
-		if($res_id && !$this->bo->acl->is_permitted($content['cat_id'],EGW_ACL_EDIT))
548
+		if ($res_id && !$this->bo->acl->is_permitted($content['cat_id'], EGW_ACL_EDIT))
550 549
 		{
551 550
 			$read_only['__ALL__'] = true;
552 551
 		}
553 552
 		$config = config::read('resources');
554
-		if(!$this->bo->acl->is_permitted($content['cat_id'],EGW_ACL_DELETE) ||
553
+		if (!$this->bo->acl->is_permitted($content['cat_id'], EGW_ACL_DELETE) ||
555 554
 			($content['deleted'] && !$GLOBALS['egw_info']['user']['apps']['admin'] && $config['history'] == 'history'))
556 555
 		{
557 556
 			$read_only['delete'] = true;
@@ -559,19 +558,19 @@  discard block
 block discarded – undo
559 558
 
560 559
 		// Can't make a resource with accessories an accessory
561 560
 		$read_only['accessory_of'] = $content['acc_count'];
562
-		if($read_only['accessory_of'])
561
+		if ($read_only['accessory_of'])
563 562
 		{
564 563
 			$content['accessory_label'] = lang('Remove accessories before changing Accessory of');
565 564
 		}
566 565
 
567 566
 		// Disable custom tab if there are no custom fields defined
568
-		$read_only['tabs']['custom'] = !(config::get_customfields('resources',true));
569
-		$read_only['tabs']['history'] = ($content['history']['id'] != 0?false:true);
567
+		$read_only['tabs']['custom'] = !(config::get_customfields('resources', true));
568
+		$read_only['tabs']['history'] = ($content['history']['id'] != 0 ? false : true);
570 569
 
571 570
 		$preserv = $content;
572 571
 
573 572
 		$this->tmpl->read('resources.edit');
574
-		return $this->tmpl->exec('resources.resources_ui.edit',$content,$sel_options,$read_only,$preserv,2);
573
+		return $this->tmpl->exec('resources.resources_ui.edit', $content, $sel_options, $read_only, $preserv, 2);
575 574
 	}
576 575
 
577 576
 	/**
@@ -587,70 +586,70 @@  discard block
 block discarded – undo
587 586
 		$cats = $this->bo->acl->get_cats(EGW_ACL_CALREAD);
588 587
 		if (!$cats) return array();
589 588
 
590
-		if(array_key_exists('return_array', $param))
589
+		if (array_key_exists('return_array', $param))
591 590
 		{
592 591
 			$return_array = $param['return_array'];
593 592
 			unset($param['return_array']);
594 593
 		}
595 594
 
596
-		$owners = explode(',',$param['owner']);
595
+		$owners = explode(',', $param['owner']);
597 596
 		unset($param['owner']);
598 597
 		$res_cats = $selected = array();
599 598
 
600 599
 		// this gets the resource-ids of the cats and implodes them to the array-key of the selectbox,
601 600
 		// so it is possible to select all resources of a category
602 601
 		$allowed_list = array();
603
-		foreach($cats as $cat_id => $cat_name)
602
+		foreach ($cats as $cat_id => $cat_name)
604 603
 		{
605
-			if ($resources = $this->bo->so->search(array('cat_id' => $cat_id, 'bookable' => '1'),'res_id',
606
-				'','','',False,'AND',false, array('deleted' => null))
604
+			if ($resources = $this->bo->so->search(array('cat_id' => $cat_id, 'bookable' => '1'), 'res_id',
605
+				'', '', '', False, 'AND', false, array('deleted' => null))
607 606
 			)
608 607
 			{
609 608
 				$keys = array();
610
-				foreach($resources as $res)
609
+				foreach ($resources as $res)
611 610
 				{
612 611
 					$keys[] = 'r'.$res['res_id'];
613 612
 					$allowed_list[] = $res['res_id'];
614 613
 				}
615
-				$res_cats[implode(',',$keys)] = $cat_name;
614
+				$res_cats[implode(',', $keys)] = $cat_name;
616 615
 
617
-				if (count(array_intersect($keys,$owners)) == count($keys))
616
+				if (count(array_intersect($keys, $owners)) == count($keys))
618 617
 				{
619
-					$selected[] = implode(',',$keys);
620
-					$owners = array_diff($owners,$keys);
618
+					$selected[] = implode(',', $keys);
619
+					$owners = array_diff($owners, $keys);
621 620
 				}
622 621
 			}
623 622
 		}
624 623
 		// add already selected single resources to the selectbox, eg. call of the resource-calendar from the resources app
625 624
 		$resources = array();
626 625
 		$res_ids = array();
627
-		foreach($owners as $key => $owner)
626
+		foreach ($owners as $key => $owner)
628 627
 		{
629 628
 			if ($owner{0} == 'r')
630 629
 			{
631
-				$res_ids[] = (int) substr($owner,1);
630
+				$res_ids[] = (int)substr($owner, 1);
632 631
 				$selected[] = $owner;
633 632
 			}
634 633
 		}
635 634
 
636 635
 		// Take out resources not allowed by perms, above
637
-		$res_ids = array_intersect($res_ids,$allowed_list);
636
+		$res_ids = array_intersect($res_ids, $allowed_list);
638 637
 		if (count($res_ids))
639 638
 		{
640
-			foreach($this->bo->so->search(array('res_id' => $res_ids),'res_id,name') as $data)
639
+			foreach ($this->bo->so->search(array('res_id' => $res_ids), 'res_id,name') as $data)
641 640
 			{
642 641
 				$resources['r'.$data['res_id']] = $data['name'];
643 642
 			}
644 643
 		}
645
-		if(!isset($return_array))
644
+		if (!isset($return_array))
646 645
 		{
647 646
 			$selectbox = html::select(
648 647
 				'owner',
649 648
 				$selected,
650
-				$options=array_merge(array('r0' => lang('None')),$resources,$res_cats),
651
-				true,	// no lang
649
+				$options = array_merge(array('r0' => lang('None')), $resources, $res_cats),
650
+				true, // no lang
652 651
 				' style="width: 100%;" id="uical_select_resource"',
653
-				min(4, count($options)),	// multiple
652
+				min(4, count($options)), // multiple
654 653
 				false
655 654
 			);
656 655
 			return array(
@@ -664,7 +663,7 @@  discard block
 block discarded – undo
664 663
 		}
665 664
 		else
666 665
 		{
667
-			return array_merge($resources,$res_cats);
666
+			return array_merge($resources, $res_cats);
668 667
 		}
669 668
 	}
670 669
 }
Please login to merge, or discard this patch.
Braces   +62 added lines, -19 removed lines patch added patch discarded remove patch
@@ -99,7 +99,9 @@  discard block
 block discarded – undo
99 99
 					}
100 100
 				}
101 101
 			}
102
-		} else {
102
+		}
103
+		else
104
+		{
103 105
 			$msg = $content;
104 106
 		}
105 107
 		$content = array();
@@ -137,7 +139,8 @@  discard block
 block discarded – undo
137 139
 			$content['nm']['options-filter2'][resources_bo::DELETED] = lang('Deleted');
138 140
 		}
139 141
 
140
-		if($_GET['search']) {
142
+		if($_GET['search'])
143
+		{
141 144
 			$content['nm']['search'] = $_GET['search'];
142 145
 		}
143 146
 		if($_GET['view_accs_of'])
@@ -300,7 +303,10 @@  discard block
 block discarded – undo
300 303
 				foreach($checked as $n=>$id)
301 304
 				{
302 305
 					// Extra data
303
-					if(!$id) continue;
306
+					if(!$id)
307
+					{
308
+						continue;
309
+					}
304 310
 					$resource = $this->bo->read($id);
305 311
 					$resource['deleted'] = null;
306 312
 					if($resource['accessory_of'] > 0)
@@ -332,7 +338,10 @@  discard block
 block discarded – undo
332 338
 					}
333 339
 					$success++;
334 340
 				}
335
-				if($restored_accessories) $action_msg .= ", " . lang('%1 accessories restored',$restored_accessories);
341
+				if($restored_accessories)
342
+				{
343
+					$action_msg .= ", " . lang('%1 accessories restored',$restored_accessories);
344
+				}
336 345
 				break;
337 346
 			case 'delete':
338 347
 				$action_msg = lang('deleted');
@@ -340,7 +349,10 @@  discard block
 block discarded – undo
340 349
 				foreach($checked as $n => &$id)
341 350
 				{
342 351
 					// Extra data
343
-					if(!$id) continue;
352
+					if(!$id)
353
+					{
354
+						continue;
355
+					}
344 356
 					$resource = $this->bo->read($id);
345 357
 					if($settings == 'promote')
346 358
 					{
@@ -366,7 +378,10 @@  discard block
 block discarded – undo
366 378
 
367 379
 							// Don't need to process these ones now
368 380
 							$checked_key = array_search($acc_id, $checked);
369
-							if($checked_key !== false) unset($checked[$checked_key]);
381
+							if($checked_key !== false)
382
+							{
383
+								unset($checked[$checked_key]);
384
+							}
370 385
 						}
371 386
 					}
372 387
 					else
@@ -396,7 +411,10 @@  discard block
 block discarded – undo
396 411
 						$failed++;
397 412
 					}
398 413
 				}
399
-				if($promoted_accessories) $action_msg .= ", " . lang('%1 accessories now resources',$promoted_accessories);
414
+				if($promoted_accessories)
415
+				{
416
+					$action_msg .= ", " . lang('%1 accessories now resources',$promoted_accessories);
417
+				}
400 418
 				break;
401 419
 		}
402 420
 		return $failed == 0;
@@ -438,7 +456,10 @@  discard block
 block discarded – undo
438 456
 						if($acc_count && $content['accessory_of'] != -1)
439 457
 						{
440 458
 							// Resource with accessories changed into accessory
441
-							if($acc_count) $msg = lang('%1 accessories now resources',$acc_count);
459
+							if($acc_count)
460
+							{
461
+								$msg = lang('%1 accessories now resources',$acc_count);
462
+							}
442 463
 						}
443 464
 					}
444 465
 					else
@@ -470,9 +491,18 @@  discard block
 block discarded – undo
470 491
 
471 492
 		$nm_session_data = $GLOBALS['egw']->session->appsession('session_data','resources_index_nm');
472 493
 		$res_id = is_numeric($content) ? (int)$content : $content['res_id'];
473
-		if (isset($_GET['res_id'])) $res_id = $_GET['res_id'];
474
-		if (isset($nm_session_data['filter2']) && $nm_session_data['filter2'] > 0) $accessory_of = $nm_session_data['filter2'];
475
-		if (isset($_GET['accessory_of'])) $accessory_of = $_GET['accessory_of'];
494
+		if (isset($_GET['res_id']))
495
+		{
496
+			$res_id = $_GET['res_id'];
497
+		}
498
+		if (isset($nm_session_data['filter2']) && $nm_session_data['filter2'] > 0)
499
+		{
500
+			$accessory_of = $nm_session_data['filter2'];
501
+		}
502
+		if (isset($_GET['accessory_of']))
503
+		{
504
+			$accessory_of = $_GET['accessory_of'];
505
+		}
476 506
 		$content = array('res_id' => $res_id);
477 507
 		if ($res_id > 0)
478 508
 		{
@@ -482,7 +512,9 @@  discard block
 block discarded – undo
482 512
 				'to_id' => $res_id,
483 513
 				'to_app' => 'resources'
484 514
 			);
485
-		} elseif ($accessory_of > 0) {
515
+		}
516
+		elseif ($accessory_of > 0)
517
+		{
486 518
 			// Pre-set according to parent
487 519
 			$owner = $this->bo->read($accessory_of);
488 520
 			if($owner['accessory_of'] > 0)
@@ -493,16 +525,22 @@  discard block
 block discarded – undo
493 525
 			}
494 526
 			$content['cat_id'] = $owner['cat_id'];
495 527
 			$content['bookable'] = true;
496
-		} else {
528
+		}
529
+		else
530
+		{
497 531
 			// New resource
498 532
 			$content['cat_id'] = $nm_session_data['filter'];
499 533
 			$content['bookable'] = true;
500 534
 		}
501
-		if($msg) {
535
+		if($msg)
536
+		{
502 537
 			$content['msg'] = $msg;
503 538
 		}
504 539
 
505
-		if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']);
540
+		if ($_GET['msg'])
541
+		{
542
+			$content['msg'] = strip_tags($_GET['msg']);
543
+		}
506 544
 
507 545
 		// some presetes
508 546
 		$content['resource_picture'] = $this->bo->get_picture($content['res_id'],false);
@@ -540,7 +578,10 @@  discard block
 block discarded – undo
540 578
 		);
541 579
 
542 580
 		$sel_options['accessory_of'] = array(-1 => lang('none')) + (array)$this->bo->link_query('',$search_options);
543
-		if($res_id) unset($sel_options['accessory_of'][$res_id]);
581
+		if($res_id)
582
+		{
583
+			unset($sel_options['accessory_of'][$res_id]);
584
+		}
544 585
 
545 586
 // 		$content['general|page|pictures|links'] = 'resources.edit_tabs.page';  //debug
546 587
 
@@ -585,7 +626,10 @@  discard block
 block discarded – undo
585 626
 	function get_calendar_sidebox($param)
586 627
 	{
587 628
 		$cats = $this->bo->acl->get_cats(EGW_ACL_CALREAD);
588
-		if (!$cats) return array();
629
+		if (!$cats)
630
+		{
631
+			return array();
632
+		}
589 633
 
590 634
 		if(array_key_exists('return_array', $param))
591 635
 		{
@@ -604,8 +648,7 @@  discard block
 block discarded – undo
604 648
 		{
605 649
 			if ($resources = $this->bo->so->search(array('cat_id' => $cat_id, 'bookable' => '1'),'res_id',
606 650
 				'','','',False,'AND',false, array('deleted' => null))
607
-			)
608
-			{
651
+			) {
609 652
 				$keys = array();
610 653
 				foreach($resources as $res)
611 654
 				{
Please login to merge, or discard this patch.
filemanager/cli.php 3 patches
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -381,13 +381,13 @@  discard block
 block discarded – undo
381 381
 									if (!($owner = $GLOBALS['egw']->accounts->name2id($owner_was=$owner,'account_lid',$type[0])) ||
382 382
 										($owner < 0) != ($cmd == 'chgrp'))
383 383
 									{
384
-										die("Unknown $type '$owner_was'!");
384
+										die("unknown $type '$owner_was'!");
385 385
 									}
386 386
 								}
387 387
 								elseif($owner && is_object($GLOBALS['egw']) && (!$GLOBALS['egw']->accounts->id2name($owner) ||
388 388
 										($owner < 0) != ($cmd == 'chgrp')))
389 389
 								{
390
-									die("Unknown $type '$owner_was'!");
390
+									die("unknown $type '$owner_was'!");
391 391
 								}
392 392
 							}
393 393
 							$params = array($url,$owner);
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 					{
446 446
 						if (!($f = fopen($url,'r')))
447 447
 						{
448
-							echo "File $url not found !!!\n\n";
448
+							echo "file $url not found !!!\n\n";
449 449
 						}
450 450
 						else
451 451
 						{
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 	}
762 762
 	if (!($from_fp = fopen($from,'r')))
763 763
 	{
764
-		die("File $from not found!\n");
764
+		die("file $from not found!\n");
765 765
 	}
766 766
 	if (!($to_fp = fopen($to,'w')))
767 767
 	{
Please login to merge, or discard this patch.
Spacing   +136 added lines, -141 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
  * @todo --domain does NOT work with --user root_* for domains other then the first in header.inc.php
14 14
  */
15 15
 
16
-chdir(dirname(__FILE__));	// to enable our relative pathes to work
16
+chdir(dirname(__FILE__)); // to enable our relative pathes to work
17 17
 
18
-error_reporting(error_reporting() & ~E_NOTICE & ~E_DEPRECATED);
18
+error_reporting(error_reporting()&~E_NOTICE&~E_DEPRECATED);
19 19
 
20 20
 if (php_sapi_name() !== 'cli')	// security precaution: forbit calling filemanager/cli.php as web-page
21 21
 {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @param string $error_msg ='' error-message to be printed in front of usage
46 46
  */
47
-function usage($error_msg='')
47
+function usage($error_msg = '')
48 48
 {
49 49
 	if ($error_msg)
50 50
 	{
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 }
79 79
 $long = $numeric = $recursive = $perms = $all = $inode = false;
80 80
 $args = $_SERVER['argv'];
81
-$cmd = basename(array_shift($args),'.php');
82
-if ($args[0][0] != '-' && $args[0][0] != '/' && strpos($args[0],'://') === false)
81
+$cmd = basename(array_shift($args), '.php');
82
+if ($args[0][0] != '-' && $args[0][0] != '/' && strpos($args[0], '://') === false)
83 83
 {
84 84
 	$cmd = array_shift($args);
85 85
 }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 if (!$args) $args = array('-h');
88 88
 
89 89
 $argv = $find_options = array();
90
-while(!is_null($option = array_shift($args)))
90
+while (!is_null($option = array_shift($args)))
91 91
 {
92 92
 	if ($option == '-' || $option[0] != '-')	// no option --> argument
93 93
 	{
@@ -95,34 +95,34 @@  discard block
 block discarded – undo
95 95
 		continue;
96 96
 	}
97 97
 
98
-	switch($option)
98
+	switch ($option)
99 99
 	{
100 100
 		default:
101 101
 			if ($cmd == 'find')
102 102
 			{
103
-				if (!in_array($option,array('-type','-depth','-mindepth','-maxdepth','-name','-path',
104
-					'-uid','-user','-nouser','-gid','-group','-nogroup','-mime',
105
-					'-empty','-size','-cmin','-ctime','-mmin','-mtime','-limit','-order','-sort',
106
-					'-hidden','-show-deleted','-name-preg','-path','-path-preg')))
103
+				if (!in_array($option, array('-type', '-depth', '-mindepth', '-maxdepth', '-name', '-path',
104
+					'-uid', '-user', '-nouser', '-gid', '-group', '-nogroup', '-mime',
105
+					'-empty', '-size', '-cmin', '-ctime', '-mmin', '-mtime', '-limit', '-order', '-sort',
106
+					'-hidden', '-show-deleted', '-name-preg', '-path', '-path-preg')))
107 107
 				{
108 108
 					usage("Unknown find option '$option'!");
109 109
 				}
110
-				if (in_array($option,array('-empty','-depth','-nouser','-nogroup','-hidden','-show-deleted')))
110
+				if (in_array($option, array('-empty', '-depth', '-nouser', '-nogroup', '-hidden', '-show-deleted')))
111 111
 				{
112
-					$find_options[substr($option,1)] = true;
112
+					$find_options[substr($option, 1)] = true;
113 113
 				}
114 114
 				else
115 115
 				{
116
-					$find_options[str_replace('-','_',substr($option,1))] = array_shift($args);
116
+					$find_options[str_replace('-', '_', substr($option, 1))] = array_shift($args);
117 117
 				}
118 118
 				break;
119 119
 			}
120 120
 			// multiple options, eg. -rp --> -r -p
121
-			elseif($option[0] == '-' && $option[1] != '-' && strlen($option) > 2)
121
+			elseif ($option[0] == '-' && $option[1] != '-' && strlen($option) > 2)
122 122
 			{
123
-				for($i = 1; $i < strlen($option); ++$i)
123
+				for ($i = 1; $i < strlen($option); ++$i)
124 124
 				{
125
-					array_unshift($args,'-'.$option[$i]);
125
+					array_unshift($args, '-'.$option[$i]);
126 126
 				}
127 127
 				break;
128 128
 			}
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 }
179 179
 if ($user && $passwd)
180 180
 {
181
-	load_egw($user,$passwd,$domain ? $domain : 'default');
181
+	load_egw($user, $passwd, $domain ? $domain : 'default');
182 182
 }
183 183
 $argc = count($argv);
184 184
 
185
-switch($cmd)
185
+switch ($cmd)
186 186
 {
187 187
 	case 'umount':
188 188
 		if ($argc != 1 && !$all)
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
 			usage('Wrong number of parameters!');
191 191
 		}
192 192
 		if (($url = $argv[0])) load_wrapper($url);
193
-		if(!egw_vfs::$is_root)
193
+		if (!egw_vfs::$is_root)
194 194
 		{
195 195
 			die("You need to be root to do that!\n");
196 196
 		}
197 197
 		if ($all)
198 198
 		{
199
-			config::save_value('vfs_fstab',$GLOBALS['egw_info']['server']['vfs_fstab']='','phpgwapi');
199
+			config::save_value('vfs_fstab', $GLOBALS['egw_info']['server']['vfs_fstab'] = '', 'phpgwapi');
200 200
 			echo "Restored default mounts:\n";
201 201
 		}
202 202
 		elseif (!egw_vfs::umount($url))
@@ -213,16 +213,16 @@  discard block
 block discarded – undo
213 213
 		{
214 214
 			usage('Wrong number of parameters!');
215 215
 		}
216
-		load_wrapper($url=$argv[0]);
216
+		load_wrapper($url = $argv[0]);
217 217
 
218
-		if($argc > 1 && !egw_vfs::$is_root)
218
+		if ($argc > 1 && !egw_vfs::$is_root)
219 219
 		{
220 220
 			die("You need to be root to do that!\n");
221 221
 		}
222
-		$fstab = egw_vfs::mount($url,$path=$argv[1]);
222
+		$fstab = egw_vfs::mount($url, $path = $argv[1]);
223 223
 		if (is_array($fstab))
224 224
 		{
225
-			foreach($fstab as $path => $url)
225
+			foreach ($fstab as $path => $url)
226 226
 			{
227 227
 				echo "$url\t$path\n";
228 228
 			}
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		break;
243 243
 
244 244
 	case 'find':
245
-		do_find($argv,$find_options);
245
+		do_find($argv, $find_options);
246 246
 		break;
247 247
 
248 248
 	case 'lntree':
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 		break;
251 251
 
252 252
 	case 'cp':
253
-		do_cp($argv,$recursive,$perms);
253
+		do_cp($argv, $recursive, $perms);
254 254
 		break;
255 255
 
256 256
 	case 'rename':
257 257
 		if (count($argv) != 2) usage('Wrong number of parameters!');
258 258
 		load_wrapper($argv[0]);
259 259
 		load_wrapper($argv[1]);
260
-		rename($argv[0],$argv[1]);
260
+		rename($argv[0], $argv[1]);
261 261
 		break;
262 262
 
263 263
 	case 'migrate-db2fs':
@@ -265,21 +265,21 @@  discard block
 block discarded – undo
265 265
 		{
266 266
 			die("\nYou need to be root to do that!\n\n");
267 267
 		}
268
-		if (!is_writable($GLOBALS['egw_info']['server']['files_dir'])) exit;	// we need write access, error msg already given
268
+		if (!is_writable($GLOBALS['egw_info']['server']['files_dir'])) exit; // we need write access, error msg already given
269 269
 		$fstab = egw_vfs::mount();
270
-		if (!is_array($fstab) || !isset($fstab['/']) || strpos($fstab['/'],'storage=db') === false)
270
+		if (!is_array($fstab) || !isset($fstab['/']) || strpos($fstab['/'], 'storage=db') === false)
271 271
 		{
272
-			foreach($fstab as $path => $url)
272
+			foreach ($fstab as $path => $url)
273 273
 			{
274 274
 				echo "$url\t$path\n";
275 275
 			}
276 276
 			die("\n/ NOT mounted with 'storage=db' --> no need to convert!\n\n");
277 277
 		}
278
-		$num_files = sqlfs_utils::migrate_db2fs();	// throws exception on error
278
+		$num_files = sqlfs_utils::migrate_db2fs(); // throws exception on error
279 279
 		echo "\n$num_files files migrated from DB to filesystem.\n";
280
-		$new_url = preg_replace('/storage=db&?/','',$fstab['/']);
281
-		if (substr($new_url,-1) == '?') $new_url = substr($new_url,0,-1);
282
-		if (egw_vfs::mount($new_url,'/'))
280
+		$new_url = preg_replace('/storage=db&?/', '', $fstab['/']);
281
+		if (substr($new_url, -1) == '?') $new_url = substr($new_url, 0, -1);
282
+		if (egw_vfs::mount($new_url, '/'))
283 283
 		{
284 284
 			echo "/ successful re-mounted on $new_url\n";
285 285
 		}
@@ -290,24 +290,24 @@  discard block
 block discarded – undo
290 290
 		break;
291 291
 
292 292
 	default:
293
-		while($argv)
293
+		while ($argv)
294 294
 		{
295 295
 			$url = array_shift($argv);
296 296
 
297 297
 			load_wrapper($url);
298 298
 			echo "$cmd $url (long=".(int)$long.", numeric=".(int)$numeric.", recursive=".(int)$recursive.")\n";
299 299
 
300
-			switch($cmd)
300
+			switch ($cmd)
301 301
 			{
302 302
 				case 'rm':
303 303
 					if ($recursive)
304 304
 					{
305 305
 						if (!class_exists('egw_vfs'))
306 306
 						{
307
-							die("rm -r only implemented for eGW streams!");	// dont want to repeat the code here
307
+							die("rm -r only implemented for eGW streams!"); // dont want to repeat the code here
308 308
 						}
309
-						array_unshift($argv,$url);
310
-						egw_vfs::remove($argv,true);
309
+						array_unshift($argv, $url);
310
+						egw_vfs::remove($argv, true);
311 311
 						$argv = array();
312 312
 					}
313 313
 					else
@@ -321,27 +321,27 @@  discard block
 block discarded – undo
321 321
 					break;
322 322
 
323 323
 				case 'mkdir':
324
-					if (!mkdir($url,null,$recursive)) echo "Can't create directory, permission denied!\n";
324
+					if (!mkdir($url, null, $recursive)) echo "Can't create directory, permission denied!\n";
325 325
 					break;
326 326
 
327 327
 				case 'touch':
328 328
 				case 'chmod':
329 329
 				case 'chown':
330 330
 				case 'chgrp':
331
-					switch($cmd)
331
+					switch ($cmd)
332 332
 					{
333 333
 						case 'touch':
334
-							$params = array($url,$time);
334
+							$params = array($url, $time);
335 335
 							break;
336 336
 						case 'chmod':
337 337
 							if (!isset($mode))
338 338
 							{
339
-								$mode = $url;	// first param is mode
339
+								$mode = $url; // first param is mode
340 340
 								$url = array_shift($argv);
341 341
 							}
342
-							if (egw_vfs::parse_url($url,PHP_URL_SCHEME)) load_wrapper($url);	// cant use stat or egw_vfs::mode2int otherwise!
342
+							if (egw_vfs::parse_url($url, PHP_URL_SCHEME)) load_wrapper($url); // cant use stat or egw_vfs::mode2int otherwise!
343 343
 
344
-							if (strpos($mode,'+') !== false || strpos($mode,'-') !== false)
344
+							if (strpos($mode, '+') !== false || strpos($mode, '-') !== false)
345 345
 							{
346 346
 								$stat = stat($url);
347 347
 								$set = $stat['mode'];
@@ -352,19 +352,19 @@  discard block
 block discarded – undo
352 352
 							}
353 353
 							if (!class_exists('egw_vfs'))
354 354
 							{
355
-								die("chmod only implemented for eGW streams!");	// dont want to repeat the code here
355
+								die("chmod only implemented for eGW streams!"); // dont want to repeat the code here
356 356
 							}
357
-							$set = egw_vfs::mode2int($mode,$set);
358
-							$params = array($url,$set);
357
+							$set = egw_vfs::mode2int($mode, $set);
358
+							$params = array($url, $set);
359 359
 							break;
360 360
 						case 'chown':
361 361
 						case 'chgrp':
362 362
 							$type = $cmd == 'chgrp' ? 'group' : 'user';
363 363
 							if (!isset($owner))
364 364
 							{
365
-								$owner = $url;	// first param is owner/group
365
+								$owner = $url; // first param is owner/group
366 366
 								$url = array_shift($argv);
367
-								if (egw_vfs::parse_url($url,PHP_URL_SCHEME)) load_wrapper($url);	// we need the header loaded
367
+								if (egw_vfs::parse_url($url, PHP_URL_SCHEME)) load_wrapper($url); // we need the header loaded
368 368
 								if ($owner == 'root')
369 369
 								{
370 370
 									$owner = 0;
@@ -375,34 +375,34 @@  discard block
 block discarded – undo
375 375
 									{
376 376
 										die("only numeric user/group-id's allowed for non eGW streams!");
377 377
 									}
378
-									if (!($owner = $GLOBALS['egw']->accounts->name2id($owner_was=$owner,'account_lid',$type[0])) ||
378
+									if (!($owner = $GLOBALS['egw']->accounts->name2id($owner_was = $owner, 'account_lid', $type[0])) ||
379 379
 										($owner < 0) != ($cmd == 'chgrp'))
380 380
 									{
381 381
 										die("Unknown $type '$owner_was'!");
382 382
 									}
383 383
 								}
384
-								elseif($owner && is_object($GLOBALS['egw']) && (!$GLOBALS['egw']->accounts->id2name($owner) ||
384
+								elseif ($owner && is_object($GLOBALS['egw']) && (!$GLOBALS['egw']->accounts->id2name($owner) ||
385 385
 										($owner < 0) != ($cmd == 'chgrp')))
386 386
 								{
387 387
 									die("Unknown $type '$owner_was'!");
388 388
 								}
389 389
 							}
390
-							$params = array($url,$owner);
390
+							$params = array($url, $owner);
391 391
 							break;
392 392
 					}
393
-					if (($scheme = egw_vfs::parse_url($url,PHP_URL_SCHEME)))
393
+					if (($scheme = egw_vfs::parse_url($url, PHP_URL_SCHEME)))
394 394
 					{
395 395
 						load_wrapper($url);
396 396
 					}
397 397
 					if ($recursive && class_exists('egw_vfs'))
398 398
 					{
399
-						array_unshift($argv,$url);
400
-						$params = array($argv,null,$cmd,$params[1]);
401
-						$cmd = array('egw_vfs','find');
402
-						$argv = array();	// we processed all url's
399
+						array_unshift($argv, $url);
400
+						$params = array($argv, null, $cmd, $params[1]);
401
+						$cmd = array('egw_vfs', 'find');
402
+						$argv = array(); // we processed all url's
403 403
 					}
404 404
 					//echo "calling cmd=".print_r($cmd,true).", params=".print_r($params,true)."\n";
405
-					call_user_func_array($cmd,$params);
405
+					call_user_func_array($cmd, $params);
406 406
 					break;
407 407
 
408 408
 				case 'cat':
@@ -412,35 +412,35 @@  discard block
 block discarded – undo
412 412
 					if ($cmd != 'cat' && $recursive && class_exists('egw_vfs'))
413 413
 					{
414 414
 						load_wrapper($url);
415
-						array_unshift($argv,$url);
416
-						egw_vfs::find($argv,array('url'=>true,),'do_stat',array($long,$numeric,true,$inode));
415
+						array_unshift($argv, $url);
416
+						egw_vfs::find($argv, array('url'=>true,), 'do_stat', array($long, $numeric, true, $inode));
417 417
 						$argv = array();
418 418
 					}
419 419
 					elseif (is_dir($url) && ($dir = opendir($url)))
420 420
 					{
421 421
 						if ($argc)
422 422
 						{
423
-							if (!($name = basename(egw_vfs::parse_url($url,PHP_URL_PATH)))) $name = '/';
423
+							if (!($name = basename(egw_vfs::parse_url($url, PHP_URL_PATH)))) $name = '/';
424 424
 							echo "\n$name:\n";
425 425
 						}
426 426
 						// separate evtl. query part, to re-add it after the file-name
427 427
 						unset($query);
428
-						list($url,$query) = explode('?',$url,2);
428
+						list($url, $query) = explode('?', $url, 2);
429 429
 						if ($query) $query = '?'.$query;
430 430
 
431
-						if (substr($url,-1) == '/')
431
+						if (substr($url, -1) == '/')
432 432
 						{
433
-							$url = substr($url,0,-1);
433
+							$url = substr($url, 0, -1);
434 434
 						}
435
-						while(($file = readdir($dir)) !== false)
435
+						while (($file = readdir($dir)) !== false)
436 436
 						{
437
-							do_stat($url.'/'.$file.$query,$long,$numeric,false,$inode);
437
+							do_stat($url.'/'.$file.$query, $long, $numeric, false, $inode);
438 438
 						}
439 439
 						closedir($dir);
440 440
 					}
441 441
 					elseif ($cmd == 'cat')
442 442
 					{
443
-						if (!($f = fopen($url,'r')))
443
+						if (!($f = fopen($url, 'r')))
444 444
 						{
445 445
 							echo "File $url not found !!!\n\n";
446 446
 						}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 						{
449 449
 							if ($argc)
450 450
 							{
451
-								echo "\n".basename(egw_vfs::parse_url($url,PHP_URL_PATH)).":\n";
451
+								echo "\n".basename(egw_vfs::parse_url($url, PHP_URL_PATH)).":\n";
452 452
 							}
453 453
 							fpassthru($f);
454 454
 							fclose($f);
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 					}
457 457
 					else
458 458
 					{
459
-						do_stat($url,$long,$numeric,false,$inode);
459
+						do_stat($url, $long, $numeric, false, $inode);
460 460
 					}
461 461
 					if (!$long && $cmd == 'ls') echo "\n";
462 462
 					break;
@@ -471,11 +471,11 @@  discard block
 block discarded – undo
471 471
  */
472 472
 function load_wrapper($url)
473 473
 {
474
-	$scheme = parse_url($url,PHP_URL_SCHEME);
474
+	$scheme = parse_url($url, PHP_URL_SCHEME);
475 475
 
476
-	if (!in_array($scheme,stream_get_wrappers()))
476
+	if (!in_array($scheme, stream_get_wrappers()))
477 477
 	{
478
-		switch($scheme)
478
+		switch ($scheme)
479 479
 		{
480 480
 			case 'webdav':
481 481
 			case 'webdavs':
@@ -484,9 +484,9 @@  discard block
 block discarded – undo
484 484
 			case '':	// default scheme is file and always available
485 485
 				break;
486 486
 			default:
487
-				if (!isset($GLOBALS['egw']) && !in_array($scheme,array('smb','imap')))
487
+				if (!isset($GLOBALS['egw']) && !in_array($scheme, array('smb', 'imap')))
488 488
 				{
489
-					load_egw(parse_url($url,PHP_URL_USER), parse_url($url,PHP_URL_PASS), parse_url($url,PHP_URL_HOST));
489
+					load_egw(parse_url($url, PHP_URL_USER), parse_url($url, PHP_URL_PASS), parse_url($url, PHP_URL_HOST));
490 490
 				}
491 491
 				// get eGW's __autoload() function
492 492
 				include_once(EGW_API_INC.'/common_functions.inc.php');
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
  * @param string $passwd
508 508
  * @param string $domain
509 509
  */
510
-function load_egw($user,$passwd,$domain='default')
510
+function load_egw($user, $passwd, $domain = 'default')
511 511
 {
512 512
 	//echo "load_egw($user,$passwd,$domain)\n";
513 513
 	$_REQUEST['domain'] = $domain;
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 
520 520
 	if (ini_get('session.save_handler') == 'files' && !is_writable(ini_get('session.save_path')) && is_dir('/tmp') && is_writable('/tmp'))
521 521
 	{
522
-		ini_set('session.save_path','/tmp');	// regular users may have no rights to apache's session dir
522
+		ini_set('session.save_path', '/tmp'); // regular users may have no rights to apache's session dir
523 523
 	}
524 524
 
525 525
 	$GLOBALS['egw_info'] = array(
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 		)
532 532
 	);
533 533
 
534
-	if (substr($user,0,5) != 'root_')
534
+	if (substr($user, 0, 5) != 'root_')
535 535
 	{
536 536
 		include('../header.inc.php');
537 537
 	}
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	}
558 558
 
559 559
 	$cmd = $GLOBALS['cmd'];
560
-	if (!in_array($cmd,array('ls','find','mount','umount','eacl')) && $GLOBALS['egw_info']['server']['files_dir'] && !is_writable($GLOBALS['egw_info']['server']['files_dir']))
560
+	if (!in_array($cmd, array('ls', 'find', 'mount', 'umount', 'eacl')) && $GLOBALS['egw_info']['server']['files_dir'] && !is_writable($GLOBALS['egw_info']['server']['files_dir']))
561 561
 	{
562 562
 		echo "\nError: eGroupWare's files directory {$GLOBALS['egw_info']['server']['files_dir']} is NOT writable by the user running ".basename(__FILE__)."!\n".
563 563
 			"--> Please run it as the same user the webserver uses or root, otherwise the $cmd command will fail!\n\n";
@@ -588,22 +588,22 @@  discard block
 block discarded – undo
588 588
 	}
589 589
 	if ($argc == 1)
590 590
 	{
591
-		foreach(egw_vfs::get_eacl($url) as $acl)
591
+		foreach (egw_vfs::get_eacl($url) as $acl)
592 592
 		{
593
-			$mode = ($acl['rights'] & egw_vfs::READABLE ? 'r' : '-').
594
-				($acl['rights'] & egw_vfs::WRITABLE ? 'w' : '-').
595
-				($acl['rights'] & egw_vfs::EXECUTABLE ? 'x' : '-');
593
+			$mode = ($acl['rights']&egw_vfs::READABLE ? 'r' : '-').
594
+				($acl['rights']&egw_vfs::WRITABLE ? 'w' : '-').
595
+				($acl['rights']&egw_vfs::EXECUTABLE ? 'x' : '-');
596 596
 			echo $acl['path']."\t$mode\t".$GLOBALS['egw']->accounts->id2name($acl['owner'])."\n";
597 597
 		}
598 598
 		return;
599 599
 	}
600 600
 	if ($argc > 1 && !is_numeric($argv[1]))
601 601
 	{
602
-		$mode=$argv[1];
602
+		$mode = $argv[1];
603 603
 		$argv[1] = null;
604
-		for($i = 0; $mode[$i]; ++$i)
604
+		for ($i = 0; $mode[$i]; ++$i)
605 605
 		{
606
-			switch($mode[$i])
606
+			switch ($mode[$i])
607 607
 			{
608 608
 				case 'x': $argv[1] |= egw_vfs::EXECUTABLE; break;
609 609
 				case 'w': $argv[1] |= egw_vfs::WRITABLE; break;
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 			}
612 612
 		}
613 613
 	}
614
-	if (!egw_vfs::eacl($url,$argv[1],$argc > 2 && !is_numeric($argv[2]) ? $GLOBALS['egw']->accounts->name2id($argv[2]) : $argv[2]))
614
+	if (!egw_vfs::eacl($url, $argv[1], $argc > 2 && !is_numeric($argv[2]) ? $GLOBALS['egw']->accounts->name2id($argv[2]) : $argv[2]))
615 615
 	{
616 616
 		echo "Error setting extended acl for $argv[0]!\n";
617 617
 	}
@@ -626,10 +626,10 @@  discard block
 block discarded – undo
626 626
  * @param boolean $full_path =false true=give full path instead of just filename
627 627
  * @param boolean $inode =false true=display inode (sqlfs id)
628 628
  */
629
-function do_stat($url,$long=false,$numeric=false,$full_path=false,$inode=false)
629
+function do_stat($url, $long = false, $numeric = false, $full_path = false, $inode = false)
630 630
 {
631 631
 	//echo "do_stat($url,$long,$numeric,$full_path)\n";
632
-	$bname = egw_vfs::parse_url($url,PHP_URL_PATH);
632
+	$bname = egw_vfs::parse_url($url, PHP_URL_PATH);
633 633
 
634 634
 	if (!$full_path)
635 635
 	{
@@ -660,25 +660,23 @@  discard block
 block discarded – undo
660 660
 		{
661 661
 			if ($stat['uid'])
662 662
 			{
663
-				$uid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name($stat['uid']) :
664
-					(function_exists('posix_getpwuid') ? posix_getpwuid($stat['uid']) : $stat['uid']);
663
+				$uid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name($stat['uid']) : (function_exists('posix_getpwuid') ? posix_getpwuid($stat['uid']) : $stat['uid']);
665 664
 				if (is_array($uid)) $uid = $uid['name'];
666 665
 				if (empty($uid)) $uid = $stat['uid'];
667 666
 			}
668 667
 			if (!isset($uid)) $uid = 'root';
669 668
 			if ($stat['gid'])
670 669
 			{
671
-				$gid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name(-abs($stat['gid'])) :
672
-					(function_exists('posix_getgrgid') ? posix_getgrgid($stat['gid']) : $stat['gid']);
670
+				$gid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name(-abs($stat['gid'])) : (function_exists('posix_getgrgid') ? posix_getgrgid($stat['gid']) : $stat['gid']);
673 671
 				if (is_array($gid)) $gid = $gid['name'];
674 672
 				if (empty($gid)) $gid = $stat['gid'];
675 673
 			}
676 674
 			if (!isset($gid)) $gid = 'root';
677 675
 		}
678 676
 		$size = hsize($stat['size']);
679
-		$mtime = date('Y-m-d H:i:s',$stat['mtime']);
677
+		$mtime = date('Y-m-d H:i:s', $stat['mtime']);
680 678
 		$nlink = $stat['nlink'];
681
-		if (($stat['mode'] & 0xA000) == 0xA000)
679
+		if (($stat['mode']&0xA000) == 0xA000)
682 680
 		{
683 681
 			$symlink = " -> ".(class_exists('egw_vfs') ? egw_vfs::readlink($url) : readlink($url));
684 682
 		}
@@ -697,12 +695,12 @@  discard block
 block discarded – undo
697 695
 function hsize($size)
698 696
 {
699 697
 	if ($size < 1024) return $size;
700
-	if ($size < 1024*1024) return sprintf('%3.1lfk',(float)$size/1024);
701
-	return sprintf('%3.1lfM',(float)$size/(1024*1024));
698
+	if ($size < 1024 * 1024) return sprintf('%3.1lfk', (float)$size / 1024);
699
+	return sprintf('%3.1lfM', (float)$size / (1024 * 1024));
702 700
 }
703 701
 
704 702
 
705
-function do_cp($argv,$recursive=false,$perms=false)
703
+function do_cp($argv, $recursive = false, $perms = false)
706 704
 {
707 705
 	$to = array_pop($argv);
708 706
 	load_wrapper($to);
@@ -714,13 +712,13 @@  discard block
 block discarded – undo
714 712
 		usage("No such directory '$to'!");
715 713
 	}
716 714
 	$anz_dirs = $anz_files = 0;
717
-	foreach($argv as $from)
715
+	foreach ($argv as $from)
718 716
 	{
719 717
 		if (is_dir($from) && (!file_exists($to) || is_dir($to)) && $recursive && class_exists('egw_vfs'))
720 718
 		{
721
-			foreach(egw_vfs::find($from,array('url' => true)) as $f)
719
+			foreach (egw_vfs::find($from, array('url' => true)) as $f)
722 720
 			{
723
-				$t = $to.substr($f,strlen($from));
721
+				$t = $to.substr($f, strlen($from));
724 722
 				if (is_dir($f))
725 723
 				{
726 724
 					++$anz_dirs;
@@ -729,43 +727,43 @@  discard block
 block discarded – undo
729 727
 				else
730 728
 				{
731 729
 					++$anz_files;
732
-					_cp($f,$t);
730
+					_cp($f, $t);
733 731
 				}
734
-				if ($perms) _cp_perms($f,$t);
732
+				if ($perms) _cp_perms($f, $t);
735 733
 			}
736
-			echo ($anz_dirs?"$anz_dirs dir(s) created and ":'')."$anz_files file(s) copied.\n";
734
+			echo ($anz_dirs ? "$anz_dirs dir(s) created and " : '')."$anz_files file(s) copied.\n";
737 735
 		}
738 736
 		else
739 737
 		{
740
-			_cp($from,$to,true);
741
-			if ($perms) _cp_perms($from,$to);
738
+			_cp($from, $to, true);
739
+			if ($perms) _cp_perms($from, $to);
742 740
 		}
743 741
 	}
744 742
 }
745 743
 
746
-function _cp($from,$to,$verbose=false)
744
+function _cp($from, $to, $verbose = false)
747 745
 {
748 746
 	load_wrapper($from);
749 747
 
750 748
 	if (is_dir($to))
751 749
 	{
752
-		$path = egw_vfs::parse_url($from,PHP_URL_PATH);
750
+		$path = egw_vfs::parse_url($from, PHP_URL_PATH);
753 751
 		if (is_dir($to))
754 752
 		{
755
-			list($to,$query) = explode('?',$to,2);
753
+			list($to, $query) = explode('?', $to, 2);
756 754
 			$to .= '/'.basename($path).($query ? '?'.$query : '');
757 755
 		}
758 756
 	}
759
-	if (!($from_fp = fopen($from,'r')))
757
+	if (!($from_fp = fopen($from, 'r')))
760 758
 	{
761 759
 		die("File $from not found!\n");
762 760
 	}
763
-	if (!($to_fp = fopen($to,'w')))
761
+	if (!($to_fp = fopen($to, 'w')))
764 762
 	{
765 763
 		die("Can't open $to for writing!\n");
766 764
 	}
767 765
 	//stream_filter_append($from_fp,'convert.base64-decode');
768
-	$count = stream_copy_to_stream($from_fp,$to_fp);
766
+	$count = stream_copy_to_stream($from_fp, $to_fp);
769 767
 
770 768
 	if ($verbose) echo hsize($count)." bytes written to $to\n";
771 769
 
@@ -778,11 +776,11 @@  discard block
 block discarded – undo
778 776
 }
779 777
 
780 778
 
781
-function _cp_perms($from,$to)
779
+function _cp_perms($from, $to)
782 780
 {
783 781
 	if (($from_stat = stat($from)) && ($to_stat = stat($to)))
784 782
 	{
785
-		foreach(array(
783
+		foreach (array(
786 784
 			'mode' => 'chmod',
787 785
 			'uid'  => 'chown',
788 786
 			'gid'  => 'chgrp',
@@ -791,27 +789,27 @@  discard block
 block discarded – undo
791 789
 			if ($from_stat[$perm] != $to_stat[$perm])
792 790
 			{
793 791
 				//echo "egw_vfs::$cmd($to,{$from_stat[$perm]}\n";
794
-				call_user_func(array('egw_vfs',$cmd),$to,$from_stat[$perm]);
792
+				call_user_func(array('egw_vfs', $cmd), $to, $from_stat[$perm]);
795 793
 			}
796 794
 		}
797 795
 	}
798 796
 }
799 797
 
800
-function do_find($bases,$options)
798
+function do_find($bases, $options)
801 799
 {
802
-	foreach($bases as $url)
800
+	foreach ($bases as $url)
803 801
 	{
804 802
 		load_wrapper($url);
805 803
 	}
806
-	$options['url'] = true;	// we use url's not vfs pathes in filemanager/cli.php
804
+	$options['url'] = true; // we use url's not vfs pathes in filemanager/cli.php
807 805
 
808
-	foreach(egw_vfs::find($bases,$options) as $path)
806
+	foreach (egw_vfs::find($bases, $options) as $path)
809 807
 	{
810 808
 		echo "$path\n";
811 809
 	}
812 810
 }
813 811
 
814
-function do_lntree($from,$to)
812
+function do_lntree($from, $to)
815 813
 {
816 814
 	echo "lntree $from $to\n";
817 815
 	if ($from[0] == '/') $from = 'sqlfs://default'.$from;
@@ -874,33 +872,33 @@  discard block
 block discarded – undo
874 872
  * @param int $mode
875 873
  * @return string
876 874
  */
877
-function int2mode( $mode )
875
+function int2mode($mode)
878 876
 {
879
-	if(($mode & 0xA000) == 0xA000) // Symbolic Link
877
+	if (($mode&0xA000) == 0xA000) // Symbolic Link
880 878
 	{
881 879
 		$sP = 'l';
882 880
 	}
883
-	elseif(($mode & 0xC000) == 0xC000) // Socket
881
+	elseif (($mode&0xC000) == 0xC000) // Socket
884 882
 	{
885 883
 		$sP = 's';
886 884
 	}
887
-	elseif($mode & 0x1000)     // FIFO pipe
885
+	elseif ($mode&0x1000)     // FIFO pipe
888 886
 	{
889 887
 		$sP = 'p';
890 888
 	}
891
-	elseif($mode & 0x2000) // Character special
889
+	elseif ($mode&0x2000) // Character special
892 890
 	{
893 891
 		$sP = 'c';
894 892
 	}
895
-	elseif($mode & 0x4000) // Directory
893
+	elseif ($mode&0x4000) // Directory
896 894
 	{
897 895
 		$sP = 'd';
898 896
 	}
899
-	elseif($mode & 0x6000) // Block special
897
+	elseif ($mode&0x6000) // Block special
900 898
 	{
901 899
 		$sP = 'b';
902 900
 	}
903
-	elseif($mode & 0x8000) // Regular
901
+	elseif ($mode&0x8000) // Regular
904 902
 	{
905 903
 		$sP = '-';
906 904
 	}
@@ -910,22 +908,19 @@  discard block
 block discarded – undo
910 908
 	}
911 909
 
912 910
 	// owner
913
-	$sP .= (($mode & 0x0100) ? 'r' : '-') .
914
-	(($mode & 0x0080) ? 'w' : '-') .
915
-	(($mode & 0x0040) ? (($mode & 0x0800) ? 's' : 'x' ) :
916
-	(($mode & 0x0800) ? 'S' : '-'));
911
+	$sP .= (($mode&0x0100) ? 'r' : '-').
912
+	(($mode&0x0080) ? 'w' : '-').
913
+	(($mode&0x0040) ? (($mode&0x0800) ? 's' : 'x') : (($mode&0x0800) ? 'S' : '-'));
917 914
 
918 915
 	// group
919
-	$sP .= (($mode & 0x0020) ? 'r' : '-') .
920
-	(($mode & 0x0010) ? 'w' : '-') .
921
-	(($mode & 0x0008) ? (($mode & 0x0400) ? 's' : 'x' ) :
922
-	(($mode & 0x0400) ? 'S' : '-'));
916
+	$sP .= (($mode&0x0020) ? 'r' : '-').
917
+	(($mode&0x0010) ? 'w' : '-').
918
+	(($mode&0x0008) ? (($mode&0x0400) ? 's' : 'x') : (($mode&0x0400) ? 'S' : '-'));
923 919
 
924 920
 	// world
925
-	$sP .= (($mode & 0x0004) ? 'r' : '-') .
926
-	(($mode & 0x0002) ? 'w' : '-') .
927
-	(($mode & 0x0001) ? (($mode & 0x0200) ? 't' : 'x' ) :
928
-	(($mode & 0x0200) ? 'T' : '-'));
921
+	$sP .= (($mode&0x0004) ? 'r' : '-').
922
+	(($mode&0x0002) ? 'w' : '-').
923
+	(($mode&0x0001) ? (($mode&0x0200) ? 't' : 'x') : (($mode&0x0200) ? 'T' : '-'));
929 924
 
930 925
 	return $sP;
931 926
 }
Please login to merge, or discard this patch.
Braces   +131 added lines, -32 removed lines patch added patch discarded remove patch
@@ -17,10 +17,13 @@  discard block
 block discarded – undo
17 17
 
18 18
 error_reporting(error_reporting() & ~E_NOTICE & ~E_DEPRECATED);
19 19
 
20
-if (php_sapi_name() !== 'cli')	// security precaution: forbit calling filemanager/cli.php as web-page
20
+if (php_sapi_name() !== 'cli')
21
+{
22
+	// security precaution: forbit calling filemanager/cli.php as web-page
21 23
 {
22 24
 	die('<h1>'.basename(__FILE__).' must NOT be called as web-page --> exiting !!!</h1>');
23 25
 }
26
+}
24 27
 
25 28
 /**
26 29
  * callback if the session-check fails, creates session from user/passwd in $GLOBALS['egw_login_data']
@@ -84,14 +87,20 @@  discard block
 block discarded – undo
84 87
 	$cmd = array_shift($args);
85 88
 }
86 89
 
87
-if (!$args) $args = array('-h');
90
+if (!$args)
91
+{
92
+	$args = array('-h');
93
+}
88 94
 
89 95
 $argv = $find_options = array();
90 96
 while(!is_null($option = array_shift($args)))
91 97
 {
92
-	if ($option == '-' || $option[0] != '-')	// no option --> argument
98
+	if ($option == '-' || $option[0] != '-')
99
+	{
100
+		// no option --> argument
93 101
 	{
94 102
 		$argv[] = $option;
103
+	}
95 104
 		continue;
96 105
 	}
97 106
 
@@ -189,7 +198,10 @@  discard block
 block discarded – undo
189 198
 		{
190 199
 			usage('Wrong number of parameters!');
191 200
 		}
192
-		if (($url = $argv[0])) load_wrapper($url);
201
+		if (($url = $argv[0]))
202
+		{
203
+			load_wrapper($url);
204
+		}
193 205
 		if(!egw_vfs::$is_root)
194 206
 		{
195 207
 			die("You need to be root to do that!\n");
@@ -254,7 +266,10 @@  discard block
 block discarded – undo
254 266
 		break;
255 267
 
256 268
 	case 'rename':
257
-		if (count($argv) != 2) usage('Wrong number of parameters!');
269
+		if (count($argv) != 2)
270
+		{
271
+			usage('Wrong number of parameters!');
272
+		}
258 273
 		load_wrapper($argv[0]);
259 274
 		load_wrapper($argv[1]);
260 275
 		rename($argv[0],$argv[1]);
@@ -265,7 +280,11 @@  discard block
 block discarded – undo
265 280
 		{
266 281
 			die("\nYou need to be root to do that!\n\n");
267 282
 		}
268
-		if (!is_writable($GLOBALS['egw_info']['server']['files_dir'])) exit;	// we need write access, error msg already given
283
+		if (!is_writable($GLOBALS['egw_info']['server']['files_dir']))
284
+		{
285
+			exit;
286
+		}
287
+		// we need write access, error msg already given
269 288
 		$fstab = egw_vfs::mount();
270 289
 		if (!is_array($fstab) || !isset($fstab['/']) || strpos($fstab['/'],'storage=db') === false)
271 290
 		{
@@ -278,7 +297,10 @@  discard block
 block discarded – undo
278 297
 		$num_files = sqlfs_utils::migrate_db2fs();	// throws exception on error
279 298
 		echo "\n$num_files files migrated from DB to filesystem.\n";
280 299
 		$new_url = preg_replace('/storage=db&?/','',$fstab['/']);
281
-		if (substr($new_url,-1) == '?') $new_url = substr($new_url,0,-1);
300
+		if (substr($new_url,-1) == '?')
301
+		{
302
+			$new_url = substr($new_url,0,-1);
303
+		}
282 304
 		if (egw_vfs::mount($new_url,'/'))
283 305
 		{
284 306
 			echo "/ successful re-mounted on $new_url\n";
@@ -321,7 +343,10 @@  discard block
 block discarded – undo
321 343
 					break;
322 344
 
323 345
 				case 'mkdir':
324
-					if (!mkdir($url,null,$recursive)) echo "Can't create directory, permission denied!\n";
346
+					if (!mkdir($url,null,$recursive))
347
+					{
348
+						echo "Can't create directory, permission denied!\n";
349
+					}
325 350
 					break;
326 351
 
327 352
 				case 'touch':
@@ -339,7 +364,11 @@  discard block
 block discarded – undo
339 364
 								$mode = $url;	// first param is mode
340 365
 								$url = array_shift($argv);
341 366
 							}
342
-							if (egw_vfs::parse_url($url,PHP_URL_SCHEME)) load_wrapper($url);	// cant use stat or egw_vfs::mode2int otherwise!
367
+							if (egw_vfs::parse_url($url,PHP_URL_SCHEME))
368
+							{
369
+								load_wrapper($url);
370
+							}
371
+							// cant use stat or egw_vfs::mode2int otherwise!
343 372
 
344 373
 							if (strpos($mode,'+') !== false || strpos($mode,'-') !== false)
345 374
 							{
@@ -364,7 +393,11 @@  discard block
 block discarded – undo
364 393
 							{
365 394
 								$owner = $url;	// first param is owner/group
366 395
 								$url = array_shift($argv);
367
-								if (egw_vfs::parse_url($url,PHP_URL_SCHEME)) load_wrapper($url);	// we need the header loaded
396
+								if (egw_vfs::parse_url($url,PHP_URL_SCHEME))
397
+								{
398
+									load_wrapper($url);
399
+								}
400
+								// we need the header loaded
368 401
 								if ($owner == 'root')
369 402
 								{
370 403
 									$owner = 0;
@@ -420,13 +453,19 @@  discard block
 block discarded – undo
420 453
 					{
421 454
 						if ($argc)
422 455
 						{
423
-							if (!($name = basename(egw_vfs::parse_url($url,PHP_URL_PATH)))) $name = '/';
456
+							if (!($name = basename(egw_vfs::parse_url($url,PHP_URL_PATH))))
457
+							{
458
+								$name = '/';
459
+							}
424 460
 							echo "\n$name:\n";
425 461
 						}
426 462
 						// separate evtl. query part, to re-add it after the file-name
427 463
 						unset($query);
428 464
 						list($url,$query) = explode('?',$url,2);
429
-						if ($query) $query = '?'.$query;
465
+						if ($query)
466
+						{
467
+							$query = '?'.$query;
468
+						}
430 469
 
431 470
 						if (substr($url,-1) == '/')
432 471
 						{
@@ -458,7 +497,10 @@  discard block
 block discarded – undo
458 497
 					{
459 498
 						do_stat($url,$long,$numeric,false,$inode);
460 499
 					}
461
-					if (!$long && $cmd == 'ls') echo "\n";
500
+					if (!$long && $cmd == 'ls')
501
+					{
502
+						echo "\n";
503
+					}
462 504
 					break;
463 505
 			}
464 506
 		}
@@ -662,18 +704,36 @@  discard block
 block discarded – undo
662 704
 			{
663 705
 				$uid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name($stat['uid']) :
664 706
 					(function_exists('posix_getpwuid') ? posix_getpwuid($stat['uid']) : $stat['uid']);
665
-				if (is_array($uid)) $uid = $uid['name'];
666
-				if (empty($uid)) $uid = $stat['uid'];
707
+				if (is_array($uid))
708
+				{
709
+					$uid = $uid['name'];
710
+				}
711
+				if (empty($uid))
712
+				{
713
+					$uid = $stat['uid'];
714
+				}
715
+			}
716
+			if (!isset($uid))
717
+			{
718
+				$uid = 'root';
667 719
 			}
668
-			if (!isset($uid)) $uid = 'root';
669 720
 			if ($stat['gid'])
670 721
 			{
671 722
 				$gid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name(-abs($stat['gid'])) :
672 723
 					(function_exists('posix_getgrgid') ? posix_getgrgid($stat['gid']) : $stat['gid']);
673
-				if (is_array($gid)) $gid = $gid['name'];
674
-				if (empty($gid)) $gid = $stat['gid'];
724
+				if (is_array($gid))
725
+				{
726
+					$gid = $gid['name'];
727
+				}
728
+				if (empty($gid))
729
+				{
730
+					$gid = $stat['gid'];
731
+				}
732
+			}
733
+			if (!isset($gid))
734
+			{
735
+				$gid = 'root';
675 736
 			}
676
-			if (!isset($gid)) $gid = 'root';
677 737
 		}
678 738
 		$size = hsize($stat['size']);
679 739
 		$mtime = date('Y-m-d H:i:s',$stat['mtime']);
@@ -696,8 +756,14 @@  discard block
 block discarded – undo
696 756
 
697 757
 function hsize($size)
698 758
 {
699
-	if ($size < 1024) return $size;
700
-	if ($size < 1024*1024) return sprintf('%3.1lfk',(float)$size/1024);
759
+	if ($size < 1024)
760
+	{
761
+		return $size;
762
+	}
763
+	if ($size < 1024*1024)
764
+	{
765
+		return sprintf('%3.1lfk',(float)$size/1024);
766
+	}
701 767
 	return sprintf('%3.1lfM',(float)$size/(1024*1024));
702 768
 }
703 769
 
@@ -731,14 +797,20 @@  discard block
 block discarded – undo
731 797
 					++$anz_files;
732 798
 					_cp($f,$t);
733 799
 				}
734
-				if ($perms) _cp_perms($f,$t);
800
+				if ($perms)
801
+				{
802
+					_cp_perms($f,$t);
803
+				}
735 804
 			}
736 805
 			echo ($anz_dirs?"$anz_dirs dir(s) created and ":'')."$anz_files file(s) copied.\n";
737 806
 		}
738 807
 		else
739 808
 		{
740 809
 			_cp($from,$to,true);
741
-			if ($perms) _cp_perms($from,$to);
810
+			if ($perms)
811
+			{
812
+				_cp_perms($from,$to);
813
+			}
742 814
 		}
743 815
 	}
744 816
 }
@@ -767,7 +839,10 @@  discard block
 block discarded – undo
767 839
 	//stream_filter_append($from_fp,'convert.base64-decode');
768 840
 	$count = stream_copy_to_stream($from_fp,$to_fp);
769 841
 
770
-	if ($verbose) echo hsize($count)." bytes written to $to\n";
842
+	if ($verbose)
843
+	{
844
+		echo hsize($count)." bytes written to $to\n";
845
+	}
771 846
 
772 847
 	fclose($from_fp);
773 848
 
@@ -814,7 +889,10 @@  discard block
 block discarded – undo
814 889
 function do_lntree($from,$to)
815 890
 {
816 891
 	echo "lntree $from $to\n";
817
-	if ($from[0] == '/') $from = 'sqlfs://default'.$from;
892
+	if ($from[0] == '/')
893
+	{
894
+		$from = 'sqlfs://default'.$from;
895
+	}
818 896
 	load_wrapper($from);
819 897
 
820 898
 	if (!file_exists($from))
@@ -876,34 +954,55 @@  discard block
 block discarded – undo
876 954
  */
877 955
 function int2mode( $mode )
878 956
 {
879
-	if(($mode & 0xA000) == 0xA000) // Symbolic Link
957
+	if(($mode & 0xA000) == 0xA000)
958
+	{
959
+		// Symbolic Link
880 960
 	{
881 961
 		$sP = 'l';
882 962
 	}
883
-	elseif(($mode & 0xC000) == 0xC000) // Socket
963
+	}
964
+	elseif(($mode & 0xC000) == 0xC000)
965
+	{
966
+		// Socket
884 967
 	{
885 968
 		$sP = 's';
886 969
 	}
887
-	elseif($mode & 0x1000)     // FIFO pipe
970
+	}
971
+	elseif($mode & 0x1000)
972
+	{
973
+		// FIFO pipe
888 974
 	{
889 975
 		$sP = 'p';
890 976
 	}
891
-	elseif($mode & 0x2000) // Character special
977
+	}
978
+	elseif($mode & 0x2000)
979
+	{
980
+		// Character special
892 981
 	{
893 982
 		$sP = 'c';
894 983
 	}
895
-	elseif($mode & 0x4000) // Directory
984
+	}
985
+	elseif($mode & 0x4000)
986
+	{
987
+		// Directory
896 988
 	{
897 989
 		$sP = 'd';
898 990
 	}
899
-	elseif($mode & 0x6000) // Block special
991
+	}
992
+	elseif($mode & 0x6000)
993
+	{
994
+		// Block special
900 995
 	{
901 996
 		$sP = 'b';
902 997
 	}
903
-	elseif($mode & 0x8000) // Regular
998
+	}
999
+	elseif($mode & 0x8000)
1000
+	{
1001
+		// Regular
904 1002
 	{
905 1003
 		$sP = '-';
906 1004
 	}
1005
+	}
907 1006
 	else                         // UNKNOWN
908 1007
 	{
909 1008
 		$sP = 'u';
Please login to merge, or discard this patch.
calendar/sitemgr/class.module_calendar_month.inc.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,8 @@
 block discarded – undo
115 115
 			$cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']);
116 116
 		}
117 117
 		$this->arguments['category']['options'] = $cat_ids;
118
-		if (count($cat_ids) > 5) {
118
+		if (count($cat_ids) > 5)
119
+		{
119 120
 			$this->arguments['category']['multiple'] = 5;
120 121
 		}
121 122
 
Please login to merge, or discard this patch.
Spacing   +34 added lines, -35 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			'category' => array(
52 52
 				'type' => 'select',
53 53
 				'label' => lang('Choose a category'),
54
-				'options' => array(),	// specification of options is postponed into the get_user_interface function
54
+				'options' => array(), // specification of options is postponed into the get_user_interface function
55 55
 				'multiple' => true,
56 56
 			),
57 57
 			'numWeeks' => array(
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	function get_user_interface()
104 104
 	{
105 105
 		// copied from bookmarks module.
106
-		$cat = createobject('phpgwapi.categories','','calendar');
107
-		$cats = $cat->return_array('all',0,False,'','cat_name','',True);
106
+		$cat = createobject('phpgwapi.categories', '', 'calendar');
107
+		$cats = $cat->return_array('all', 0, False, '', 'cat_name', '', True);
108 108
 		$cat_ids = array();
109 109
 		while (list(,$category) = @each($cats))
110 110
 		{
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 			$this->arguments['category']['multiple'] = 5;
116 116
 		}
117 117
 
118
-		if (! isset($GLOBALS['egw']->accounts))
118
+		if (!isset($GLOBALS['egw']->accounts))
119 119
 		{
120 120
 			$GLOBALS['egw']->accounts = new accounts();
121 121
 		}
122
-		$this->accounts =& $GLOBALS['egw']->accounts;
123
-		$search_params=array(
122
+		$this->accounts = & $GLOBALS['egw']->accounts;
123
+		$search_params = array(
124 124
 			'type' => 'both',
125 125
 			'app' => 'calendar',
126 126
 		);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		// sort users and groups separately.
131 131
 		if (isset($GLOBALS['sitemgr_info']['anonymous_user']))
132 132
 		{
133
-			$anon_user = $this->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user'],'account_lid','u');
133
+			$anon_user = $this->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user'], 'account_lid', 'u');
134 134
 		}
135 135
 		else
136 136
 		{
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 			 * Get possible sitemgr paths from the HTTP_REFERRER in order to unreveal the
140 140
 			 * anonymous user for the correct site.
141 141
 			 */
142
-			$sitemgr_path = preg_replace('/^[^\/]+:\/\/[^\/]+\/([^\?]*)(\?.*)*$/',"/\${1}",$_SERVER['HTTP_REFERER']);
142
+			$sitemgr_path = preg_replace('/^[^\/]+:\/\/[^\/]+\/([^\?]*)(\?.*)*$/', "/\${1}", $_SERVER['HTTP_REFERER']);
143 143
 			// Remove the trailing file- / pathname if any
144 144
 			$sitemgr_path = preg_replace('/[^\/]*$/', '', $sitemgr_path);
145 145
 			// Add leading slash if it has been lost.
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 			// Code adapted from sitemgr-site/index.php
152 152
 			$site_urls = array();
153 153
 			$site_urls[] = $sitemgr_path;
154
-			$site_urls[] = ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_ADDR'] . $sitemgr_path;
155
-			$site_urls[] = $site_url = ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $sitemgr_path;
154
+			$site_urls[] = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_ADDR'].$sitemgr_path;
155
+			$site_urls[] = $site_url = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].$sitemgr_path;
156 156
 
157
-			$GLOBALS['egw']->db->select('egw_sitemgr_sites','anonymous_user,anonymous_passwd,site_id',
158
-				array('site_url' => $site_urls),__LINE__,__FILE__,false,'','sitemgr');
157
+			$GLOBALS['egw']->db->select('egw_sitemgr_sites', 'anonymous_user,anonymous_passwd,site_id',
158
+				array('site_url' => $site_urls), __LINE__, __FILE__, false, '', 'sitemgr');
159 159
 
160 160
 			$GLOBALS['egw']->db->next_record();
161
-			$anon_user = $this->accounts->name2id($GLOBALS['egw']->db->f('anonymous_user'),'account_lid','u');
161
+			$anon_user = $this->accounts->name2id($GLOBALS['egw']->db->f('anonymous_user'), 'account_lid', 'u');
162 162
 		}
163 163
 
164
-		$anon_groups = $this->accounts->memberships($anon_user,true);
164
+		$anon_groups = $this->accounts->memberships($anon_user, true);
165 165
 		foreach ($accounts as $entry)
166 166
 		{
167 167
 			$is_group = false;
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 			$acl = new acl($entry['account_id']);
170 170
 			$acl->read_repository();
171 171
 			// get the rights for each account to check whether the anon user has read permissions.
172
-			$rights = $acl->get_rights($anon_user,'calendar');
172
+			$rights = $acl->get_rights($anon_user, 'calendar');
173 173
 			// also add the anon user if it's his own calendar.
174
-			if (($rights & EGW_ACL_READ) || ($entry['account_id'] == $anon_user))
174
+			if (($rights&EGW_ACL_READ) || ($entry['account_id'] == $anon_user))
175 175
 			{
176 176
 				$has_read_permissions = true;
177 177
 			}
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 				// or ass permissions if this is the anon group's calendar.
182 182
 				foreach ($anon_groups as $parent_group)
183 183
 				{
184
-					$rights = $acl->get_rights($parent_group,'calendar');
185
-					if (($rights & EGW_ACL_READ) || ($entry['account_id'] == $parent_group))
184
+					$rights = $acl->get_rights($parent_group, 'calendar');
185
+					if (($rights&EGW_ACL_READ) || ($entry['account_id'] == $parent_group))
186 186
 					{
187 187
 						$has_read_permissions = true;
188 188
 						break;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 				}
199 199
 				else
200 200
 				{
201
-					$users[$entry['account_id']] = $GLOBALS['egw']->common->display_fullname($entry['account_lid'],$entry['account_firstname'],$entry['account_lastname']);
201
+					$users[$entry['account_id']] = $GLOBALS['egw']->common->display_fullname($entry['account_lid'], $entry['account_firstname'], $entry['account_lastname']);
202 202
 				}
203 203
 			}
204 204
 		}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		return parent::get_user_interface();
219 219
 	}
220 220
 
221
-	function get_content(&$arguments,$properties)
221
+	function get_content(&$arguments, $properties)
222 222
 	{
223 223
 		$html = "";
224 224
 		$GLOBALS['egw']->translation->add_app('calendar');
@@ -226,34 +226,33 @@  discard block
 block discarded – undo
226 226
 		$this->ui->allowEdit = false;
227 227
 		$this->ui->use_time_grid = isset($arguments['grid']) ? $arguments['grid'] : false;
228 228
 
229
-		$weeks = $arguments['numWeeks'] ? (int) $arguments['numWeeks'] : 2;
229
+		$weeks = $arguments['numWeeks'] ? (int)$arguments['numWeeks'] : 2;
230 230
 
231
-		if (($arguments['acceptDateParam']) && (get_var('date',array('POST','GET'))))
231
+		if (($arguments['acceptDateParam']) && (get_var('date', array('POST', 'GET'))))
232 232
 		{
233
-			$start = (int) (strtotime(get_var('date',array('POST','GET'))) +
233
+			$start = (int)(strtotime(get_var('date', array('POST', 'GET'))) +
234 234
 					(60 * 60 * 24 * 7 * $dateOffset));
235 235
 		}
236 236
 		else
237 237
 		{
238
-			$start = (int) ($this->bo->now_su +
238
+			$start = (int)($this->bo->now_su +
239 239
 					(60 * 60 * 24 * 7 * $dateOffset));
240 240
 		}
241 241
 		$first = $this->ui->datetime->get_weekday_start(
242
-					adodb_date('Y',$start),
243
-					adodb_date('m',$start),
244
-					adodb_date('d',$start));
245
-		$last = strtotime("+$weeks weeks",$first) - 1;
242
+					adodb_date('Y', $start),
243
+					adodb_date('m', $start),
244
+					adodb_date('d', $start));
245
+		$last = strtotime("+$weeks weeks", $first) - 1;
246 246
 
247 247
 		if ($arguments['showTitle'])
248 248
 		{
249 249
 			$html .= '<div id="divAppboxHeader">'.$GLOBALS['egw_info']['apps']['calendar']['title'].' - '.lang('Weekview').": ";
250
-			$html .= lang('After %1',$this->bo->long_date($first));
250
+			$html .= lang('After %1', $this->bo->long_date($first));
251 251
 			$html .= "</div>";
252 252
 		}
253 253
 
254 254
 		// set the search parameters
255
-		$search_params = Array
256
-		(
255
+		$search_params = Array(
257 256
 			'offset' => false,
258 257
 			'order' => 'cal_start ASC',
259 258
 			'start' => $first,
@@ -288,24 +287,24 @@  discard block
 block discarded – undo
288 287
 		$html .= '<!-- END Calendar info -->'."\n";
289 288
 		unset($css_file);
290 289
 		// we add DAY_s/2 to $this->first (using 12h), to deal with daylight saving changes
291
-		for ($week_start = $first; $week_start < $last; $week_start = strtotime("+1 week",$week_start))
290
+		for ($week_start = $first; $week_start < $last; $week_start = strtotime("+1 week", $week_start))
292 291
 		{
293 292
 			$week = array();
294 293
 			for ($i = 0; $i < 7; ++$i)
295 294
 			{
296
-				$day_ymd = $this->bo->date2string($i ? strtotime("+$i days",$week_start) : $week_start);
295
+				$day_ymd = $this->bo->date2string($i ? strtotime("+$i days", $week_start) : $week_start);
297 296
 				$week[$day_ymd] = array_shift($rows);
298 297
 			}
299 298
 			$week_view = array(
300 299
 				'menuaction' => false,
301 300
 				'date' => $this->bo->date2string($week_start),
302 301
 			);
303
-			$title = lang('Wk').' '.adodb_date('W',$week_start);
302
+			$title = lang('Wk').' '.adodb_date('W', $week_start);
304 303
 			if (!isset($GLOBALS['egw']->template))
305 304
 			{
306 305
 				$GLOBALS['egw']->template = new Template;
307 306
 			}
308
-			$html .= $this->ui->timeGridWidget($this->ui->tagWholeDayOnTop($week),$weeks == 2 ? 30 : 60,200,'',$title,0,$week_start+WEEK_s >= $last);
307
+			$html .= $this->ui->timeGridWidget($this->ui->tagWholeDayOnTop($week), $weeks == 2 ? 30 : 60, 200, '', $title, 0, $week_start + WEEK_s >= $last);
309 308
 		}
310 309
 		// Initialize Tooltips
311 310
 		$html .= '<script language="JavaScript" type="text/javascript" src="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/wz_tooltip/wz_tooltip.js"></script>'."\n";
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@
 block discarded – undo
280 280
 		}
281 281
 
282 282
 		// set the search parameters
283
-		$search_params = Array
283
+		$search_params = array
284 284
 		(
285 285
 			'offset' => $arguments['entryOffset'] ? (int) $arguments['entryOffset'] : false,
286 286
 			'order' => 'cal_start ASC',
Please login to merge, or discard this patch.
calendar/sitemgr/class.module_calendar_list.inc.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@
 block discarded – undo
280 280
 		}
281 281
 
282 282
 		// set the search parameters
283
-		$search_params = Array
283
+		$search_params = array
284 284
 		(
285 285
 			'offset' => $arguments['entryOffset'] ? (int) $arguments['entryOffset'] : false,
286 286
 			'order' => 'cal_start ASC',
Please login to merge, or discard this patch.
Spacing   +37 added lines, -38 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			'category' => array(
89 89
 				'type' => 'select',
90 90
 				'label' => lang('Choose a category'),
91
-				'options' => array(),	// specification of options is postponed into the get_user_interface function
91
+				'options' => array(), // specification of options is postponed into the get_user_interface function
92 92
 				'multiple' => true,
93 93
 			),
94 94
 			'numWeeks' => array(
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 	{
155 155
 		//_debug_array($GLOBALS['Common_BO']->sites->current_site);
156 156
 		// copied from bookmarks module.
157
-		$cat = createobject('phpgwapi.categories','','calendar');
158
-		$cats = $cat->return_array('all',0,False,'','cat_name','',True);
157
+		$cat = createobject('phpgwapi.categories', '', 'calendar');
158
+		$cats = $cat->return_array('all', 0, False, '', 'cat_name', '', True);
159 159
 		$cat_ids = array();
160 160
 		while (list(,$category) = @each($cats))
161 161
 		{
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		{
171 171
 			$GLOBALS['egw']->accounts = new accounts();
172 172
 		}
173
-		$this->accounts =& $GLOBALS['egw']->accounts;
173
+		$this->accounts = & $GLOBALS['egw']->accounts;
174 174
 		$search_params = array(
175 175
 			'type' => 'both',
176 176
 			'app' => 'calendar',
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 		$users = array();
180 180
 		$groups = array();
181 181
 		// sort users and groups separately.
182
-		$anon_user = $this->accounts->name2id($GLOBALS['Common_BO']->sites->current_site['anonymous_user'],'account_lid','u');
183
-		$anon_groups = $this->accounts->memberships($anon_user,true);
182
+		$anon_user = $this->accounts->name2id($GLOBALS['Common_BO']->sites->current_site['anonymous_user'], 'account_lid', 'u');
183
+		$anon_groups = $this->accounts->memberships($anon_user, true);
184 184
 		foreach ($accounts as $entry)
185 185
 		{
186 186
 			$is_group = false;
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
 			$acl = new acl($entry['account_id']);
189 189
 			$acl->read_repository();
190 190
 			// get the rights for each account to check whether the anon user has read permissions.
191
-			$rights = $acl->get_rights($anon_user,'calendar');
191
+			$rights = $acl->get_rights($anon_user, 'calendar');
192 192
 			// also add the anon user if it's his own calendar.
193
-			if (($rights & EGW_ACL_READ) || ($entry['account_id'] == $anon_user))
193
+			if (($rights&EGW_ACL_READ) || ($entry['account_id'] == $anon_user))
194 194
 			{
195 195
 				$has_read_permissions = true;
196 196
 			}
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 				// or ass permissions if this is the anon group's calendar.
201 201
 				foreach ($anon_groups as $parent_group)
202 202
 				{
203
-					$rights = $acl->get_rights($parent_group,'calendar');
204
-					if (($rights & EGW_ACL_READ) || ($entry['account_id'] == $parent_group))
203
+					$rights = $acl->get_rights($parent_group, 'calendar');
204
+					if (($rights&EGW_ACL_READ) || ($entry['account_id'] == $parent_group))
205 205
 					{
206 206
 						$has_read_permissions = true;
207 207
 						break;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				}
218 218
 				else
219 219
 				{
220
-					$users[$entry['account_id']] = $GLOBALS['egw']->common->display_fullname($entry['account_lid'],$entry['account_firstname'],$entry['account_lastname']);
220
+					$users[$entry['account_id']] = $GLOBALS['egw']->common->display_fullname($entry['account_lid'], $entry['account_firstname'], $entry['account_lastname']);
221 221
 				}
222 222
 			}
223 223
 		}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		return parent::get_user_interface();
238 238
 	}
239 239
 
240
-	function get_content(&$arguments,$properties)
240
+	function get_content(&$arguments, $properties)
241 241
 	{
242 242
 		$html = "";
243 243
 		$GLOBALS['egw']->translation->add_app('calendar');
@@ -246,41 +246,40 @@  discard block
 block discarded – undo
246 246
 		$this->ui->allowEdit = false;
247 247
 		$this->ui->use_time_grid = isset($arguments['grid']) ? $arguments['grid'] : false;
248 248
 
249
-		$weeks = $arguments['numWeeks'] ? (int) $arguments['numWeeks'] : 4;
250
-		$dateOffset = $arguments['offset'] ? (int) $arguments['offset'] : 0;
249
+		$weeks = $arguments['numWeeks'] ? (int)$arguments['numWeeks'] : 4;
250
+		$dateOffset = $arguments['offset'] ? (int)$arguments['offset'] : 0;
251 251
 
252
-		if (($arguments['acceptDateParam']) && (get_var('date',array('POST','GET'))))
252
+		if (($arguments['acceptDateParam']) && (get_var('date', array('POST', 'GET'))))
253 253
 		{
254
-			$first = $start = (int) (strtotime(get_var('date',array('POST','GET'))) +
254
+			$first = $start = (int)(strtotime(get_var('date', array('POST', 'GET'))) +
255 255
 					(60 * 60 * 24 * 7 * $dateOffset));
256 256
 		}
257 257
 		else
258 258
 		{
259
-			$first = $start = (int) ($this->bo->now_su +
259
+			$first = $start = (int)($this->bo->now_su +
260 260
 					(60 * 60 * 24 * 7 * $dateOffset));
261 261
 		}
262 262
 		if ($arguments['useWeekStart']) 
263 263
 		{
264 264
 			$first = $this->ui->datetime->get_weekday_start(
265
-				adodb_date('Y',$start),
266
-				adodb_date('m',$start),
267
-				adodb_date('d',$start));
265
+				adodb_date('Y', $start),
266
+				adodb_date('m', $start),
267
+				adodb_date('d', $start));
268 268
 		}
269 269
 
270
-		$last = (int) ($first +
270
+		$last = (int)($first +
271 271
 				(60 * 60 * 24 * 7 * $weeks));
272 272
 
273 273
 		if ($arguments['showTitle'])
274 274
 		{
275 275
 			$html .= '<div id="divAppboxHeader">'.$GLOBALS['egw_info']['apps']['calendar']['title'].' - ';
276
-			$html .= lang('After %1',$this->bo->long_date($first));
276
+			$html .= lang('After %1', $this->bo->long_date($first));
277 277
 			$html .= "</div>";
278 278
 		}
279 279
 
280 280
 		// set the search parameters
281
-		$search_params = Array
282
-		(
283
-			'offset' => $arguments['entryOffset'] ? (int) $arguments['entryOffset'] : false,
281
+		$search_params = Array(
282
+			'offset' => $arguments['entryOffset'] ? (int)$arguments['entryOffset'] : false,
284 283
 			'order' => 'cal_start ASC',
285 284
 			'start' => $first,
286 285
 			'end' => $last,
@@ -300,23 +299,23 @@  discard block
 block discarded – undo
300 299
 		}
301 300
 		if ($arguments['numEntries'])
302 301
 		{
303
-			$search_params['num_rows'] = (int) $arguments['numEntries'];
304
-			$search_params['offset'] =  $arguments['entryOffset'] ? (int) $arguments['entryOffset'] :0;
302
+			$search_params['num_rows'] = (int)$arguments['numEntries'];
303
+			$search_params['offset'] = $arguments['entryOffset'] ? (int)$arguments['entryOffset'] : 0;
305 304
 		}
306 305
 		$rows = array();
307 306
 
308
-		foreach((array) $this->bo->search($search_params) as $event)
307
+		foreach ((array)$this->bo->search($search_params) as $event)
309 308
 		{
310 309
 			$event['date'] = $this->bo->date2string($event['start']);
311
-			if (empty($event['description'])) $event['description'] = ' ';	// no description screws the titles horz. alignment
312
-			if (empty($event['location'])) $event['location'] = ' ';	// no location screws the owner horz. alignment
310
+			if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment
311
+			if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment
313 312
 			$rows[] = $event;
314 313
 		}
315 314
 		if (($arguments['showWeeks']) && ((int)$arguments['offset'] == 0))
316 315
 		{
317 316
 			$html .= "<div>".lang('Next')." ".lang('%1 weeks', $weeks).":</div>\n";
318 317
 		}
319
-		if (($search_params['offset'] && $this->bo->total == 0) || count($rows)==0)
318
+		if (($search_params['offset'] && $this->bo->total == 0) || count($rows) == 0)
320 319
 		{
321 320
 			$html .= "<div>".lang("no events found")."</div>";
322 321
 		}
@@ -329,11 +328,11 @@  discard block
 block discarded – undo
329 328
 			$html .= '  <div class="cal_list_weektop"></div>'."\n";
330 329
 			foreach ($rows as $event)
331 330
 			{
332
-				if (($last_week != 0) && (adodb_date('W-Y',$event['start']) != $last_week))
331
+				if (($last_week != 0) && (adodb_date('W-Y', $event['start']) != $last_week))
333 332
 				{
334 333
 					$html .= '  <div class="cal_list_weeksplit"></div>'."\n";
335 334
 				}
336
-				$last_week = adodb_date('W-Y',$event['start']);
335
+				$last_week = adodb_date('W-Y', $event['start']);
337 336
 				$html .= "  <!-- Event -->\n";
338 337
 				if ($event_count % 2 == 0) {
339 338
 					$html .= '  <div class="cal_list_event cal_event_even">'."\n";
@@ -345,17 +344,17 @@  discard block
 block discarded – undo
345 344
 				$html .= '    <div class="cal_list_title">'.$event['title']."</div>\n";
346 345
 				$html .= '    <div class="cal_list_date">';
347 346
 				$html .= '<span class="cal_list_start">';
348
-				$html .= '<span class="cal_list_weekday">'.lang(adodb_date('D',$event['start'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>";
347
+				$html .= '<span class="cal_list_weekday">'.lang(adodb_date('D', $event['start'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>";
349 348
 				$html .= $this->bo->format_date($event['start'])."</span>";
350 349
 				$html .= '<span class="cal_list_end"> - ';
351
-				$html .= '<span class="cal_list_weekday">'.lang(adodb_date('D',$event['end'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>";
350
+				$html .= '<span class="cal_list_weekday">'.lang(adodb_date('D', $event['end'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>";
352 351
 				$html .= $this->bo->format_date($event['end'])."</span></div>\n";
353 352
 				$descr = trim($event['description']);
354
-				if (! empty($descr)) {
355
-					$html .= "    <div class=\"cal_list_descr\">\n".preg_replace('/\\n/',"<br>\n",$event['description'])."</div>\n";
353
+				if (!empty($descr)) {
354
+					$html .= "    <div class=\"cal_list_descr\">\n".preg_replace('/\\n/', "<br>\n", $event['description'])."</div>\n";
356 355
 				}
357 356
 				$html .= "  </div><!-- cal_list_event -->\n";
358
-				$event_count ++;
357
+				$event_count++;
359 358
 			}
360 359
 			$html .= '  <div class="cal_list_weekbottom"></div>'."\n";
361 360
 			$html .= "<!-- End module -->\n";
Please login to merge, or discard this patch.
Braces   +17 added lines, -6 removed lines patch added patch discarded remove patch
@@ -162,7 +162,8 @@  discard block
 block discarded – undo
162 162
 			$cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']);
163 163
 		}
164 164
 		$this->arguments['category']['options'] = $cat_ids;
165
-		if (count($cat_ids) > 5) {
165
+		if (count($cat_ids) > 5)
166
+		{
166 167
 			$this->arguments['category']['multiple'] = 5;
167 168
 		}
168 169
 
@@ -259,7 +260,7 @@  discard block
 block discarded – undo
259 260
 			$first = $start = (int) ($this->bo->now_su +
260 261
 					(60 * 60 * 24 * 7 * $dateOffset));
261 262
 		}
262
-		if ($arguments['useWeekStart']) 
263
+		if ($arguments['useWeekStart'])
263 264
 		{
264 265
 			$first = $this->ui->datetime->get_weekday_start(
265 266
 				adodb_date('Y',$start),
@@ -308,8 +309,16 @@  discard block
 block discarded – undo
308 309
 		foreach((array) $this->bo->search($search_params) as $event)
309 310
 		{
310 311
 			$event['date'] = $this->bo->date2string($event['start']);
311
-			if (empty($event['description'])) $event['description'] = ' ';	// no description screws the titles horz. alignment
312
-			if (empty($event['location'])) $event['location'] = ' ';	// no location screws the owner horz. alignment
312
+			if (empty($event['description']))
313
+			{
314
+				$event['description'] = ' ';
315
+			}
316
+			// no description screws the titles horz. alignment
317
+			if (empty($event['location']))
318
+			{
319
+				$event['location'] = ' ';
320
+			}
321
+			// no location screws the owner horz. alignment
313 322
 			$rows[] = $event;
314 323
 		}
315 324
 		if (($arguments['showWeeks']) && ((int)$arguments['offset'] == 0))
@@ -335,7 +344,8 @@  discard block
 block discarded – undo
335 344
 				}
336 345
 				$last_week = adodb_date('W-Y',$event['start']);
337 346
 				$html .= "  <!-- Event -->\n";
338
-				if ($event_count % 2 == 0) {
347
+				if ($event_count % 2 == 0)
348
+				{
339 349
 					$html .= '  <div class="cal_list_event cal_event_even">'."\n";
340 350
 				}
341 351
 				else
@@ -351,7 +361,8 @@  discard block
 block discarded – undo
351 361
 				$html .= '<span class="cal_list_weekday">'.lang(adodb_date('D',$event['end'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>";
352 362
 				$html .= $this->bo->format_date($event['end'])."</span></div>\n";
353 363
 				$descr = trim($event['description']);
354
-				if (! empty($descr)) {
364
+				if (! empty($descr))
365
+				{
355 366
 					$html .= "    <div class=\"cal_list_descr\">\n".preg_replace('/\\n/',"<br>\n",$event['description'])."</div>\n";
356 367
 				}
357 368
 				$html .= "  </div><!-- cal_list_event -->\n";
Please login to merge, or discard this patch.
calendar/freebusy.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,15 +44,23 @@
 block discarded – undo
44 44
 if (strpos($_SERVER['QUERY_STRING'],'=3D') !== false && substr($_GET['user'],0,2) == '3D')
45 45
 {
46 46
 	$_GET['user'] = substr($_GET['user'],2);
47
-	if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'],2);
48
-	if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'],2);
49
-}
47
+	if (isset($_GET['password']))
48
+	{
49
+		$_GET['password'] = substr($_GET['password'],2);
50
+	}
51
+	if (isset($_GET['cred']))
52
+	{
53
+		$_GET['cred'] = substr($_GET['cred'],2);
54
+	}
55
+	}
50 56
 if (!is_numeric($user = $_GET['user']))
51 57
 {
52 58
 	// check if user contains the current domain --> remove it
53 59
 	list(,$domain) = explode('@',$user);
54 60
 	if ($domain === $GLOBALS['egw_info']['user']['domain'])
55
-	list($user) = explode('@',$user);
61
+	{
62
+		list($user) = explode('@',$user);
63
+	}
56 64
 	$user = $GLOBALS['egw']->accounts->name2id($user,'account_lid','u');
57 65
 }
58 66
 if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user)))
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,23 +39,23 @@  discard block
 block discarded – undo
39 39
 	$GLOBALS['egw_info']['flags']['currentapp'] = 'calendar';
40 40
 }
41 41
 // fix for SOGo connector, which does not decode the = in our f/b url
42
-if (strpos($_SERVER['QUERY_STRING'],'=3D') !== false && substr($_GET['user'],0,2) == '3D')
42
+if (strpos($_SERVER['QUERY_STRING'], '=3D') !== false && substr($_GET['user'], 0, 2) == '3D')
43 43
 {
44
-	$_GET['user'] = substr($_GET['user'],2);
45
-	if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'],2);
46
-	if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'],2);
44
+	$_GET['user'] = substr($_GET['user'], 2);
45
+	if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'], 2);
46
+	if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'], 2);
47 47
 }
48 48
 if (!is_numeric($user = $_GET['user']))
49 49
 {
50 50
 	// check if user contains the current domain --> remove it
51
-	list(,$domain) = explode('@',$user);
51
+	list(,$domain) = explode('@', $user);
52 52
 	if ($domain === $GLOBALS['egw_info']['user']['domain'])
53
-	list($user) = explode('@',$user);
54
-	$user = $GLOBALS['egw']->accounts->name2id($user,'account_lid','u');
53
+	list($user) = explode('@', $user);
54
+	$user = $GLOBALS['egw']->accounts->name2id($user, 'account_lid', 'u');
55 55
 }
56 56
 if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user)))
57 57
 {
58
-	fail_exit(lang("freebusy: Unknow user '%1', wrong password or not availible to not loged in users !!!"." $username($user)",$_GET['user']));
58
+	fail_exit(lang("freebusy: Unknow user '%1', wrong password or not availible to not loged in users !!!"." $username($user)", $_GET['user']));
59 59
 }
60 60
 if (!$loged_in)
61 61
 {
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 		if (strpos($authuser, '@') === false)
77 77
 		{
78 78
 			$domain = $GLOBALS['egw_info']['server']['default_domain'];
79
-			$authuser .= '@' . $domain;
79
+			$authuser .= '@'.$domain;
80 80
 		}
81 81
 		else
82 82
 		{
83
-			list(, $domain) = explode('@',$authuser, 2);
83
+			list(, $domain) = explode('@', $authuser, 2);
84 84
 		}
85 85
 		if (array_key_exists($domain, $GLOBALS['egw_domain']))
86 86
 		{
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 			$GLOBALS['egw_info']['user']['domain'] = $domain;
91 91
 			$GLOBALS['egw_info']['flags']['currentapp'] = 'login';
92 92
 			$GLOBALS['egw_info']['flags']['noapi'] = false;
93
-			require_once(EGW_API_INC . '/functions.inc.php');
94
-			$loged_in =  $GLOBALS['egw']->session->create($authuser, $password, 'text');
93
+			require_once(EGW_API_INC.'/functions.inc.php');
94
+			$loged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text');
95 95
 			session_unset();
96 96
 			session_destroy();
97 97
 		}
@@ -107,6 +107,6 @@  discard block
 block discarded – undo
107 107
 }
108 108
 else
109 109
 {
110
-	html::content_header('freebusy.ifb','text/calendar');
110
+	html::content_header('freebusy.ifb', 'text/calendar');
111 111
 }
112
-echo ExecMethod2('calendar.calendar_ical.freebusy',$user,$_GET['end']);
112
+echo ExecMethod2('calendar.calendar_ical.freebusy', $user, $_GET['end']);
Please login to merge, or discard this patch.
calendar/inc/class.calendar_wizard_export_csv.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
                 );
48 48
 
49 49
 		$custom = Api\Storage\Customfields::get('resources', true);
50
-		foreach($custom as $name => $data) {
50
+		foreach ($custom as $name => $data) {
51 51
 			$this->mapping_fields['#'.$name] = $data['label'];
52 52
 		}
53 53
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,8 @@  discard block
 block discarded – undo
14 14
 
15 15
 class infolog_wizard_export_csv extends importexport_wizard_basic_export_csv
16 16
 {
17
-	public function __construct() {
17
+	public function __construct()
18
+	{
18 19
 		parent::__construct();
19 20
 
20 21
 		// Field mapping
@@ -27,7 +28,8 @@  discard block
 block discarded – undo
27 28
 		// Custom fields
28 29
 		unset($this->export_fields['custom']); // Heading, not a real field
29 30
 		$custom = Api\Storage\Customfields::get('infolog', true);
30
-		foreach($custom as $name => $data) {
31
+		foreach($custom as $name => $data)
32
+		{
31 33
 			$this->export_fields['#'.$name] = $data['label'];
32 34
 		}
33 35
 	}
Please login to merge, or discard this patch.
calendar/inc/class.calendar_rrule.inc.php 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 	 *
62 62
 	 * @var array
63 63
 	 */
64
-	static public $types = Array(
64
+	static public $types = array(
65 65
 		self::NONE         => 'None',
66 66
 		self::DAILY        => 'Daily',
67 67
 		self::WEEKLY       => 'Weekly',
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -359,7 +359,7 @@
 block discarded – undo
359 359
 	/**
360 360
 	 * Return the current element
361 361
 	 *
362
-	 * @return DateTime
362
+	 * @return string
363 363
 	 */
364 364
 	public function current()
365 365
 	{
Please login to merge, or discard this patch.
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	static private $recur_egw2ical_2_0 = array(
75 75
 		self::DAILY        => 'DAILY',
76 76
 		self::WEEKLY       => 'WEEKLY',
77
-		self::MONTHLY_WDAY => 'MONTHLY',	// BYDAY={1..7, -1}{MO..SO, last workday}
78
-		self::MONTHLY_MDAY => 'MONTHLY',	// BYMONHTDAY={1..31, -1 for last day of month}
77
+		self::MONTHLY_WDAY => 'MONTHLY', // BYDAY={1..7, -1}{MO..SO, last workday}
78
+		self::MONTHLY_MDAY => 'MONTHLY', // BYMONHTDAY={1..31, -1 for last day of month}
79 79
 		self::YEARLY       => 'YEARLY',
80 80
 	);
81 81
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	static private $recur_egw2ical_1_0 = array(
86 86
 		self::DAILY        => 'D',
87 87
 		self::WEEKLY       => 'W',
88
-		self::MONTHLY_WDAY => 'MP',	// BYDAY={1..7,-1}{MO..SO, last workday}
89
-		self::MONTHLY_MDAY => 'MD',	// BYMONHTDAY={1..31,-1}
88
+		self::MONTHLY_WDAY => 'MP', // BYDAY={1..7,-1}{MO..SO, last workday}
89
+		self::MONTHLY_MDAY => 'MD', // BYMONHTDAY={1..31,-1}
90 90
 		self::YEARLY       => 'YM',
91 91
 	);
92 92
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	const THURSDAY  = 16;
143 143
 	const FRIDAY    = 32;
144 144
 	const SATURDAY  = 64;
145
-	const WORKDAYS  = 62;	// Mo, ..., Fr
145
+	const WORKDAYS  = 62; // Mo, ..., Fr
146 146
 	const ALLDAYS   = 127;
147 147
 	/**
148 148
 	 * Translate weekday bitmasks to labels
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @var array
172 172
 	 */
173
-	public $exceptions=array();
173
+	public $exceptions = array();
174 174
 
175 175
 	/**
176 176
 	 * Array of exceptions as DateTime/egw_time objects
177 177
 	 *
178 178
 	 * @var array
179 179
 	 */
180
-	public $exceptions_objs=array();
180
+	public $exceptions_objs = array();
181 181
 
182 182
 	/**
183 183
 	 * Starttime of series
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 	 * @param int $weekdays =0 self::SUNDAY=1|self::MONDAY=2|...|self::SATURDAY=64
221 221
 	 * @param array $exceptions =null DateTime objects with exceptions
222 222
 	 */
223
-	public function __construct(DateTime $time,$type,$interval=1,DateTime $enddate=null,$weekdays=0,array $exceptions=null)
223
+	public function __construct(DateTime $time, $type, $interval = 1, DateTime $enddate = null, $weekdays = 0, array $exceptions = null)
224 224
 	{
225
-		switch($GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts'])
225
+		switch ($GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts'])
226 226
 		{
227 227
 			case 'Sunday':
228 228
 				$this->lastdayofweek = self::SATURDAY;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$this->time = $time instanceof egw_time ? $time : new egw_time($time);
238 238
 
239
-		if (!in_array($type,array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY)))
239
+		if (!in_array($type, array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY)))
240 240
 		{
241 241
 			throw new egw_exception_wrong_parameter(__METHOD__."($time,$type,$interval,$enddate,$weekdays,...) type $type is NOT valid!");
242 242
 		}
@@ -246,16 +246,16 @@  discard block
 block discarded – undo
246 246
 		if ($type == self::MONTHLY_WDAY)
247 247
 		{
248 248
 			// check for last week of month
249
-			if (($day = $this->time->format('d')) >= 21 && $day > self::daysInMonth($this->time)-7)
249
+			if (($day = $this->time->format('d')) >= 21 && $day > self::daysInMonth($this->time) - 7)
250 250
 			{
251 251
 				$this->monthly_byday_num = -1;
252 252
 			}
253 253
 			else
254 254
 			{
255
-				$this->monthly_byday_num = 1 + floor(($this->time->format('d')-1) / 7);
255
+				$this->monthly_byday_num = 1 + floor(($this->time->format('d') - 1) / 7);
256 256
 			}
257 257
 		}
258
-		elseif($type == self::MONTHLY_MDAY)
258
+		elseif ($type == self::MONTHLY_MDAY)
259 259
 		{
260 260
 			$this->monthly_bymonthday = (int)$this->time->format('d');
261 261
 			// check for last day of month
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
 		if ((int)$interval < 1)
274 274
 		{
275
-			$interval = 1;	// calendar stores no (extra) interval as null, so using default 1 here
275
+			$interval = 1; // calendar stores no (extra) interval as null, so using default 1 here
276 276
 		}
277 277
 		$this->interval = (int)$interval;
278 278
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		}
303 303
 		if ($exceptions)
304 304
 		{
305
-			foreach($exceptions as $exception)
305
+			foreach ($exceptions as $exception)
306 306
 			{
307 307
 				$exception->setTimezone($this->time->getTimezone());
308 308
 				$this->exceptions[] = $exception->format('Ymd');
@@ -318,22 +318,22 @@  discard block
 block discarded – undo
318 318
 	 * @param int $interval =1
319 319
 	 * @return int
320 320
 	 */
321
-	public static function recurrence_interval($type, $interval=1)
321
+	public static function recurrence_interval($type, $interval = 1)
322 322
 	{
323
-		switch($type)
323
+		switch ($type)
324 324
 		{
325 325
 			case self::DAILY:
326
-				$duration = 24*3600;
326
+				$duration = 24 * 3600;
327 327
 				break;
328 328
 			case self::WEEKLY:
329
-				$duration = 7*24*3600;
329
+				$duration = 7 * 24 * 3600;
330 330
 				break;
331 331
 			case self::MONTHLY_MDAY:
332 332
 			case self::MONTHLY_WDAY:
333
-				$duration = 31*24*3600;
333
+				$duration = 31 * 24 * 3600;
334 334
 				break;
335 335
 			case self::YEARLY:
336
-				$duration = 366*24*3600;
336
+				$duration = 366 * 24 * 3600;
337 337
 				break;
338 338
 		}
339 339
 		if ($interval > 1) $duration *= $interval;
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	private static function daysInMonth(DateTime $time)
351 351
 	{
352
-		list($year,$month) = explode('-',$time->format('Y-m'));
352
+		list($year, $month) = explode('-', $time->format('Y-m'));
353 353
 		$last_day = new egw_time();
354
-		$last_day->setDate($year,$month+1,0);
354
+		$last_day->setDate($year, $month + 1, 0);
355 355
 
356 356
 		return (int)$last_day->format('d');
357 357
 	}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 */
382 382
 	public function next_no_exception()
383 383
 	{
384
-		switch($this->type)
384
+		switch ($this->type)
385 385
 		{
386 386
 			case self::NONE:	// need to add at least one day, to end "series", as enddate == current date
387 387
 			case self::DAILY:
@@ -396,28 +396,28 @@  discard block
 block discarded – undo
396 396
 					// --> on the last day of the week we have to additionally advance interval-1 weeks
397 397
 					if ($this->interval > 1 && self::getWeekday($this->current) == $this->lastdayofweek)
398 398
 					{
399
-						$this->current->modify(($this->interval-1).' week');
399
+						$this->current->modify(($this->interval - 1).' week');
400 400
 					}
401 401
 					$this->current->modify('1 day');
402 402
 					//echo __METHOD__.'() '.$this->current->format('l').', '.$this->current.": $this->weekdays & ".self::getWeekday($this->current)."<br />\n";
403 403
 				}
404
-				while(!($this->weekdays & self::getWeekday($this->current)));
404
+				while (!($this->weekdays&self::getWeekday($this->current)));
405 405
 				break;
406 406
 
407 407
 			case self::MONTHLY_WDAY:	// iCal: BYDAY={1, ..., 5, -1}{MO..SO}
408 408
 				// advance to start of next month
409
-				list($year,$month) = explode('-',$this->current->format('Y-m'));
410
-				$month += $this->interval+($this->monthly_byday_num < 0 ? 1 : 0);
411
-				$this->current->setDate($year,$month,$this->monthly_byday_num < 0 ? 0 : 1);
409
+				list($year, $month) = explode('-', $this->current->format('Y-m'));
410
+				$month += $this->interval + ($this->monthly_byday_num < 0 ? 1 : 0);
411
+				$this->current->setDate($year, $month, $this->monthly_byday_num < 0 ? 0 : 1);
412 412
 				//echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).": setDate($year,$month,1): ".$this->current->format('l').', '.$this->current."<br />\n";
413 413
 				// now advance to n-th week
414 414
 				if ($this->monthly_byday_num > 1)
415 415
 				{
416
-					$this->current->modify(($this->monthly_byday_num-1).' week');
416
+					$this->current->modify(($this->monthly_byday_num - 1).' week');
417 417
 					//echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).': modify('.($this->monthly_byday_num-1).' week): '.$this->current->format('l').', '.$this->current."<br />\n";
418 418
 				}
419 419
 				// advance to given weekday
420
-				while(!($this->weekdays & self::getWeekday($this->current)))
420
+				while (!($this->weekdays&self::getWeekday($this->current)))
421 421
 				{
422 422
 					$this->current->modify(($this->monthly_byday_num < 0 ? -1 : 1).' day');
423 423
 					//echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).': modify(1 day): '.$this->current->format('l').', '.$this->current."<br />\n";
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
 				break;
426 426
 
427 427
 			case self::MONTHLY_MDAY:	// iCal: monthly_bymonthday={1, ..., 31, -1}
428
-				list($year,$month) = explode('-',$this->current->format('Y-m'));
429
-				$day = $this->monthly_bymonthday+($this->monthly_bymonthday < 0 ? 1 : 0);
430
-				$month += $this->interval+($this->monthly_bymonthday < 0 ? 1 : 0);
431
-				$this->current->setDate($year,$month,$day);
428
+				list($year, $month) = explode('-', $this->current->format('Y-m'));
429
+				$day = $this->monthly_bymonthday + ($this->monthly_bymonthday < 0 ? 1 : 0);
430
+				$month += $this->interval + ($this->monthly_bymonthday < 0 ? 1 : 0);
431
+				$this->current->setDate($year, $month, $day);
432 432
 				//echo __METHOD__."() setDate($year,$month,$day): ".$this->current->format('l').', '.$this->current."<br />\n";
433 433
 				break;
434 434
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 		{
451 451
 			$this->next_no_exception();
452 452
 		}
453
-		while($this->exceptions && in_array($this->current->format('Ymd'),$this->exceptions));
453
+		while ($this->exceptions && in_array($this->current->format('Ymd'), $this->exceptions));
454 454
 	}
455 455
 
456 456
 	/**
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 		if (isset($this->current)) $backup = $this->current;
483 483
 		$this->rewind();
484 484
 
485
-		while(--$count > 0)
485
+		while (--$count > 0)
486 486
 		{
487 487
 			$this->next_no_exception();
488 488
 		}
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 		// if enddate is now before next acurrence, but not on same day, we use previous recurrence
508 508
 		// this can happen if client gives an enddate which is NOT a recurrence date
509 509
 		// eg. for a on Monday recurring weekly event a Tuesday as enddate
510
-		if ($this->enddate < $this->current  && $this->current->format('Ymd') != $this->enddate->format('Ymd'))
510
+		if ($this->enddate < $this->current && $this->current->format('Ymd') != $this->enddate->format('Ymd'))
511 511
 		{
512 512
 			$last = $previous;
513 513
 		}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 		$this->current = clone $this->time;
527 527
 		while ($this->valid() &&
528 528
 			$this->exceptions &&
529
-			in_array($this->current->format('Ymd'),$this->exceptions))
529
+			in_array($this->current->format('Ymd'), $this->exceptions))
530 530
 		{
531 531
 			$this->next_no_exception();
532 532
 		}
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 	 *
538 538
 	 * @return boolean
539 539
 	 */
540
-	public function valid ()
540
+	public function valid()
541 541
 	{
542 542
 		return $this->current->format('Ymd') <= $this->enddate_ymd;
543 543
 	}
@@ -551,9 +551,9 @@  discard block
 block discarded – undo
551 551
 	{
552 552
 		$str = '';
553 553
 		// Repeated Events
554
-		if($this->type != self::NONE)
554
+		if ($this->type != self::NONE)
555 555
 		{
556
-			list($str) = explode(' (',lang(self::$types[$this->type]));	// remove (by day/date) from Monthly
556
+			list($str) = explode(' (', lang(self::$types[$this->type])); // remove (by day/date) from Monthly
557 557
 
558 558
 			$str_extra = array();
559 559
 			switch ($this->type)
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 					{
570 570
 						$repeat_days[] = $this->type == self::WEEKLY ? lang('all') : lang('day');
571 571
 					}
572
-					elseif($this->weekdays == self::WORKDAYS)
572
+					elseif ($this->weekdays == self::WORKDAYS)
573 573
 					{
574 574
 						$repeat_days[] = $this->type == self::WEEKLY ? lang('workdays') : lang('workday');
575 575
 					}
@@ -577,24 +577,24 @@  discard block
 block discarded – undo
577 577
 					{
578 578
 						foreach (self::$days as $mask => $label)
579 579
 						{
580
-							if ($this->weekdays & $mask)
580
+							if ($this->weekdays&$mask)
581 581
 							{
582 582
 								$repeat_days[] = lang($label);
583 583
 							}
584 584
 						}
585 585
 					}
586
-					if($this->type == self::WEEKLY && count($repeat_days))
586
+					if ($this->type == self::WEEKLY && count($repeat_days))
587 587
 					{
588
-						$str_extra[] = lang('days repeated').': '.implode(', ',$repeat_days);
588
+						$str_extra[] = lang('days repeated').': '.implode(', ', $repeat_days);
589 589
 					}
590
-					elseif($this->type == self::MONTHLY_WDAY)
590
+					elseif ($this->type == self::MONTHLY_WDAY)
591 591
 					{
592
-						$str_extra[] = ($this->monthly_byday_num == -1 ? lang('last') : $this->monthly_byday_num.'.').' '.implode(', ',$repeat_days);
592
+						$str_extra[] = ($this->monthly_byday_num == -1 ? lang('last') : $this->monthly_byday_num.'.').' '.implode(', ', $repeat_days);
593 593
 					}
594 594
 					break;
595 595
 
596 596
 			}
597
-			if($this->interval > 1)
597
+			if ($this->interval > 1)
598 598
 			{
599 599
 				$str_extra[] = lang('Interval').': '.$this->interval;
600 600
 			}
@@ -610,9 +610,9 @@  discard block
 block discarded – undo
610 610
 			{
611 611
 				$str_extra[] = $this->time->getTimezone()->getName();
612 612
 			}
613
-			if(count($str_extra))
613
+			if (count($str_extra))
614 614
 			{
615
-				$str .= ' ('.implode(', ',$str_extra).')';
615
+				$str .= ' ('.implode(', ', $str_extra).')';
616 616
 			}
617 617
 		}
618 618
 		return $str;
@@ -624,24 +624,24 @@  discard block
 block discarded – undo
624 624
 	 *
625 625
 	 * $return array	vCalendar RRULE
626 626
 	 */
627
-	public function generate_rrule($version='2.0')
627
+	public function generate_rrule($version = '2.0')
628 628
 	{
629 629
 		$repeat_days = array();
630 630
 		$rrule = array();
631 631
 
632
-		if ($this->type == self::NONE) return false;	// no recuring event
632
+		if ($this->type == self::NONE) return false; // no recuring event
633 633
 
634 634
 		if ($version == '1.0')
635 635
 		{
636
-			$rrule['FREQ'] = self::$recur_egw2ical_1_0[$this->type] . $this->interval;
636
+			$rrule['FREQ'] = self::$recur_egw2ical_1_0[$this->type].$this->interval;
637 637
 			switch ($this->type)
638 638
 			{
639 639
 				case self::WEEKLY:
640 640
 					foreach (self::$days as $mask => $label)
641 641
 					{
642
-						if ($this->weekdays & $mask)
642
+						if ($this->weekdays&$mask)
643 643
 						{
644
-							$repeat_days[] = strtoupper(substr($label,0,2));
644
+							$repeat_days[] = strtoupper(substr($label, 0, 2));
645 645
 						}
646 646
 					}
647 647
 					$rrule['BYDAY'] = implode(' ', $repeat_days);
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 				case self::MONTHLY_WDAY:	// weekday of the month: BDAY={1..5}+ {MO..SO}
655 655
 					$rrule['BYDAY'] = abs($this->monthly_byday_num);
656 656
 					$rrule['BYDAY'] .= ($this->monthly_byday_num < 0) ? '- ' : '+ ';
657
-					$rrule['BYDAY'] .= strtoupper(substr($this->time->format('l'),0,2));
657
+					$rrule['BYDAY'] .= strtoupper(substr($this->time->format('l'), 0, 2));
658 658
 					$rrule['FREQ'] = $rrule['FREQ'].' '.$rrule['BYDAY'];
659 659
 					break;
660 660
 			}
@@ -672,9 +672,9 @@  discard block
 block discarded – undo
672 672
 				case self::WEEKLY:
673 673
 					foreach (self::$days as $mask => $label)
674 674
 					{
675
-						if ($this->weekdays & $mask)
675
+						if ($this->weekdays&$mask)
676 676
 						{
677
-							$repeat_days[] = strtoupper(substr($label,0,2));
677
+							$repeat_days[] = strtoupper(substr($label, 0, 2));
678 678
 						}
679 679
 					}
680 680
 					$rrule['BYDAY'] = implode(',', $repeat_days);
@@ -685,8 +685,8 @@  discard block
 block discarded – undo
685 685
 					break;
686 686
 
687 687
 				case self::MONTHLY_WDAY:	// weekday of the month: BDAY={1..5}{MO..SO}
688
-					$rrule['BYDAY'] = $this->monthly_byday_num .
689
-						strtoupper(substr($this->time->format('l'),0,2));
688
+					$rrule['BYDAY'] = $this->monthly_byday_num.
689
+						strtoupper(substr($this->time->format('l'), 0, 2));
690 690
 					break;
691 691
 			}
692 692
 			if ($this->interval > 1)
@@ -721,12 +721,12 @@  discard block
 block discarded – undo
721 721
 	 *
722 722
 	 * @return calendar_rrule		false on error
723 723
 	 */
724
-	public static function event2rrule(array $event,$usertime=true,$to_tz=null)
724
+	public static function event2rrule(array $event, $usertime = true, $to_tz = null)
725 725
 	{
726
-		if (!is_array($event)  || !isset($event['tzid'])) return false;
726
+		if (!is_array($event) || !isset($event['tzid'])) return false;
727 727
 		if (!$to_tz) $to_tz = $event['tzid'];
728 728
 		$timestamp_tz = $usertime ? egw_time::$user_timezone : egw_time::$server_timezone;
729
-		$time = is_a($event['start'],'DateTime') ? $event['start'] : new egw_time($event['start'],$timestamp_tz);
729
+		$time = is_a($event['start'], 'DateTime') ? $event['start'] : new egw_time($event['start'], $timestamp_tz);
730 730
 
731 731
 		if (!isset(self::$tz_cache[$to_tz]))
732 732
 		{
@@ -739,16 +739,16 @@  discard block
 block discarded – undo
739 739
 
740 740
 		if ($event['recur_enddate'])
741 741
 		{
742
-			$enddate = is_a($event['recur_enddate'],'DateTime') ? $event['recur_enddate'] : new egw_time($event['recur_enddate'],$timestamp_tz);
742
+			$enddate = is_a($event['recur_enddate'], 'DateTime') ? $event['recur_enddate'] : new egw_time($event['recur_enddate'], $timestamp_tz);
743 743
 		}
744 744
 		if (is_array($event['recur_exception']))
745 745
 		{
746
-			foreach($event['recur_exception'] as $exception)
746
+			foreach ($event['recur_exception'] as $exception)
747 747
 			{
748
-				$exceptions[] = is_a($exception,'DateTime') ? $exception : new egw_time($exception,$timestamp_tz);
748
+				$exceptions[] = is_a($exception, 'DateTime') ? $exception : new egw_time($exception, $timestamp_tz);
749 749
 			}
750 750
 		}
751
-		return new calendar_rrule($time,$event['recur_type'],$event['recur_interval'],$enddate,$event['recur_data'],$exceptions);
751
+		return new calendar_rrule($time, $event['recur_type'], $event['recur_interval'], $enddate, $event['recur_data'], $exceptions);
752 752
 	}
753 753
 
754 754
 	/**
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 	 * @param DateTime/string		starttime of the event (in servertime)
775 775
 	 * @param string $to_tz			new timezone
776 776
 	 */
777
-	public static function rrule2tz(array &$event,$starttime,$to_tz)
777
+	public static function rrule2tz(array &$event, $starttime, $to_tz)
778 778
 	{
779 779
 		// We assume that the difference between timezones can result
780 780
 		// in a maximum of one day
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 			self::$tz_cache[$to_tz] = calendar_timezones::DateTimeZone($to_tz);
796 796
 		}
797 797
 
798
-		$time = is_a($starttime,'DateTime') ?
798
+		$time = is_a($starttime, 'DateTime') ?
799 799
 			$starttime : new egw_time($starttime, egw_time::$server_timezone);
800 800
 		$time->setTimezone(self::$tz_cache[$event['tzid']]);
801 801
 		$remote = clone $time;
@@ -813,11 +813,11 @@  discard block
 block discarded – undo
813 813
 					if ($delta == 1 || $delta == -6)
814 814
 					{
815 815
 						$mask = $mask << 1;
816
-						if ($mask & 128) $mask = $mask - 127; // overflow
816
+						if ($mask&128) $mask = $mask - 127; // overflow
817 817
 					}
818 818
 					else
819 819
 					{
820
-						if ($mask & 1) $mask = $mask + 128; // underflow
820
+						if ($mask&1) $mask = $mask + 128; // underflow
821 821
 						$mask = $mask >> 1;
822 822
 					}
823 823
 					$event['recur_data'] = $mask;
@@ -828,8 +828,8 @@  discard block
 block discarded – undo
828 828
 
829 829
 if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)	// some tests
830 830
 {
831
-	ini_set('display_errors',1);
832
-	error_reporting(E_ALL & ~E_NOTICE);
831
+	ini_set('display_errors', 1);
832
+	error_reporting(E_ALL&~E_NOTICE);
833 833
 	function lang($str) { return $str; }
834 834
 	$GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $_REQUEST['user-tz'] ? $_REQUEST['user-tz'] : 'Europe/Berlin';
835 835
 	require_once('../../phpgwapi/inc/class.egw_time.inc.php');
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 
839 839
 	if (!isset($_REQUEST['time']))
840 840
 	{
841
-		$now = new egw_time('now',new DateTimeZone($_REQUEST['tz'] = 'UTC'));
841
+		$now = new egw_time('now', new DateTimeZone($_REQUEST['tz'] = 'UTC'));
842 842
 		$_REQUEST['time'] = $now->format();
843 843
 		$_REQUEST['type'] = calendar_rrule::WEEKLY;
844 844
 		$_REQUEST['interval'] = 2;
@@ -847,29 +847,29 @@  discard block
 block discarded – undo
847 847
 		$_REQUEST['user-tz'] = 'Europe/Berlin';
848 848
 	}
849 849
 	echo "<html>\n<head>\n\t<title>Test calendar_rrule class</title>\n</head>\n<body>\n<form method='GET'>\n";
850
-	echo "<p>Date+Time: ".html::input('time',$_REQUEST['time']).
851
-		html::select('tz',$_REQUEST['tz'],egw_time::getTimezones())."</p>\n";
852
-	echo "<p>Type: ".html::select('type',$_REQUEST['type'],calendar_rrule::$types)."\n".
853
-		"Interval: ".html::input('interval',$_REQUEST['interval'])."</p>\n";
850
+	echo "<p>Date+Time: ".html::input('time', $_REQUEST['time']).
851
+		html::select('tz', $_REQUEST['tz'], egw_time::getTimezones())."</p>\n";
852
+	echo "<p>Type: ".html::select('type', $_REQUEST['type'], calendar_rrule::$types)."\n".
853
+		"Interval: ".html::input('interval', $_REQUEST['interval'])."</p>\n";
854 854
 	echo "<table><tr><td>\n";
855
-	echo "Weekdays:<br />".html::checkbox_multiselect('weekdays',$_REQUEST['weekdays'],calendar_rrule::$days,false,'','7',false,'height: 150px;')."\n";
855
+	echo "Weekdays:<br />".html::checkbox_multiselect('weekdays', $_REQUEST['weekdays'], calendar_rrule::$days, false, '', '7', false, 'height: 150px;')."\n";
856 856
 	echo "</td><td>\n";
857
-	echo "<p>Exceptions:<br />".html::textarea('exceptions',$_REQUEST['exceptions'],'style="height: 150px;"')."\n";
857
+	echo "<p>Exceptions:<br />".html::textarea('exceptions', $_REQUEST['exceptions'], 'style="height: 150px;"')."\n";
858 858
 	echo "</td></tr></table>\n";
859
-	echo "<p>Enddate: ".html::input('enddate',$_REQUEST['enddate'])."</p>\n";
860
-	echo "<p>Display recurances in ".html::select('user-tz',$_REQUEST['user-tz'],egw_time::getTimezones())."</p>\n";
861
-	echo "<p>".html::submit_button('calc','Calculate')."</p>\n";
859
+	echo "<p>Enddate: ".html::input('enddate', $_REQUEST['enddate'])."</p>\n";
860
+	echo "<p>Display recurances in ".html::select('user-tz', $_REQUEST['user-tz'], egw_time::getTimezones())."</p>\n";
861
+	echo "<p>".html::submit_button('calc', 'Calculate')."</p>\n";
862 862
 	echo "</form>\n";
863 863
 
864 864
 	$tz = new DateTimeZone($_REQUEST['tz']);
865
-	$time = new egw_time($_REQUEST['time'],$tz);
866
-	if ($_REQUEST['enddate']) $enddate = new egw_time($_REQUEST['enddate'],$tz);
867
-	$weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; }
868
-	if ($_REQUEST['exceptions']) foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new egw_time($exception); }
865
+	$time = new egw_time($_REQUEST['time'], $tz);
866
+	if ($_REQUEST['enddate']) $enddate = new egw_time($_REQUEST['enddate'], $tz);
867
+	$weekdays = 0; foreach ((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; }
868
+	if ($_REQUEST['exceptions']) foreach (preg_split("/[,\r\n]+ ?/", $_REQUEST['exceptions']) as $exception) { $exceptions[] = new egw_time($exception); }
869 869
 
870
-	$rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions);
870
+	$rrule = new calendar_rrule($time, $_REQUEST['type'], $_REQUEST['interval'], $enddate, $weekdays, $exceptions);
871 871
 	echo "<h3>".$time->format('l').', '.$time.' ('.$tz->getName().') '.$rrule."</h3>\n";
872
-	foreach($rrule as $rtime)
872
+	foreach ($rrule as $rtime)
873 873
 	{
874 874
 		$rtime->setTimezone(egw_time::$user_timezone);
875 875
 		echo ++$n.': '.$rtime->format('l').', '.$rtime."<br />\n";
Please login to merge, or discard this patch.
Braces   +58 added lines, -14 removed lines patch added patch discarded remove patch
@@ -336,7 +336,10 @@  discard block
 block discarded – undo
336 336
 				$duration = 366*24*3600;
337 337
 				break;
338 338
 		}
339
-		if ($interval > 1) $duration *= $interval;
339
+		if ($interval > 1)
340
+		{
341
+			$duration *= $interval;
342
+		}
340 343
 
341 344
 		return $duration;
342 345
 	}
@@ -479,7 +482,10 @@  discard block
 block discarded – undo
479 482
 		{
480 483
 			return clone $this->time;
481 484
 		}
482
-		if (isset($this->current)) $backup = $this->current;
485
+		if (isset($this->current))
486
+		{
487
+			$backup = $this->current;
488
+		}
483 489
 		$this->rewind();
484 490
 
485 491
 		while(--$count > 0)
@@ -487,7 +493,10 @@  discard block
 block discarded – undo
487 493
 			$this->next_no_exception();
488 494
 		}
489 495
 		$ret = clone $this->current;
490
-		if ($backup) $this->current = $backup;
496
+		if ($backup)
497
+		{
498
+			$this->current = $backup;
499
+		}
491 500
 		return $ret;
492 501
 	}
493 502
 
@@ -629,7 +638,11 @@  discard block
 block discarded – undo
629 638
 		$repeat_days = array();
630 639
 		$rrule = array();
631 640
 
632
-		if ($this->type == self::NONE) return false;	// no recuring event
641
+		if ($this->type == self::NONE)
642
+		{
643
+			return false;
644
+		}
645
+		// no recuring event
633 646
 
634 647
 		if ($version == '1.0')
635 648
 		{
@@ -723,8 +736,14 @@  discard block
 block discarded – undo
723 736
 	 */
724 737
 	public static function event2rrule(array $event,$usertime=true,$to_tz=null)
725 738
 	{
726
-		if (!is_array($event)  || !isset($event['tzid'])) return false;
727
-		if (!$to_tz) $to_tz = $event['tzid'];
739
+		if (!is_array($event)  || !isset($event['tzid']))
740
+		{
741
+			return false;
742
+		}
743
+		if (!$to_tz)
744
+		{
745
+			$to_tz = $event['tzid'];
746
+		}
728 747
 		$timestamp_tz = $usertime ? egw_time::$user_timezone : egw_time::$server_timezone;
729 748
 		$time = is_a($event['start'],'DateTime') ? $event['start'] : new egw_time($event['start'],$timestamp_tz);
730 749
 
@@ -784,7 +803,10 @@  discard block
 block discarded – undo
784 803
 			$event['recur_type'] == self::NONE ||
785 804
 			empty($event['recur_data']) || $event['recur_data'] == ALLDAYS ||
786 805
 			empty($event['tzid']) || empty($to_tz) ||
787
-			$event['tzid'] == $to_tz) return;
806
+			$event['tzid'] == $to_tz)
807
+		{
808
+			return;
809
+		}
788 810
 
789 811
 		if (!isset(self::$tz_cache[$event['tzid']]))
790 812
 		{
@@ -813,11 +835,19 @@  discard block
 block discarded – undo
813 835
 					if ($delta == 1 || $delta == -6)
814 836
 					{
815 837
 						$mask = $mask << 1;
816
-						if ($mask & 128) $mask = $mask - 127; // overflow
838
+						if ($mask & 128)
839
+						{
840
+							$mask = $mask - 127;
841
+						}
842
+						// overflow
817 843
 					}
818 844
 					else
819 845
 					{
820
-						if ($mask & 1) $mask = $mask + 128; // underflow
846
+						if ($mask & 1)
847
+						{
848
+							$mask = $mask + 128;
849
+						}
850
+						// underflow
821 851
 						$mask = $mask >> 1;
822 852
 					}
823 853
 					$event['recur_data'] = $mask;
@@ -826,11 +856,16 @@  discard block
 block discarded – undo
826 856
 	}
827 857
 }
828 858
 
829
-if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)	// some tests
859
+if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)
860
+{
861
+	// some tests
830 862
 {
831 863
 	ini_set('display_errors',1);
864
+}
832 865
 	error_reporting(E_ALL & ~E_NOTICE);
833
-	function lang($str) { return $str; }
866
+	function lang($str)
867
+	{
868
+return $str; }
834 869
 	$GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $_REQUEST['user-tz'] ? $_REQUEST['user-tz'] : 'Europe/Berlin';
835 870
 	require_once('../../phpgwapi/inc/class.egw_time.inc.php');
836 871
 	require_once('../../phpgwapi/inc/class.html.inc.php');
@@ -863,9 +898,18 @@  discard block
 block discarded – undo
863 898
 
864 899
 	$tz = new DateTimeZone($_REQUEST['tz']);
865 900
 	$time = new egw_time($_REQUEST['time'],$tz);
866
-	if ($_REQUEST['enddate']) $enddate = new egw_time($_REQUEST['enddate'],$tz);
867
-	$weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; }
868
-	if ($_REQUEST['exceptions']) foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new egw_time($exception); }
901
+	if ($_REQUEST['enddate'])
902
+	{
903
+		$enddate = new egw_time($_REQUEST['enddate'],$tz);
904
+	}
905
+	$weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask)
906
+	{
907
+$weekdays |= $mask; }
908
+	if ($_REQUEST['exceptions'])
909
+	{
910
+		foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new egw_time($exception);
911
+	}
912
+	}
869 913
 
870 914
 	$rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions);
871 915
 	echo "<h3>".$time->format('l').', '.$time.' ('.$tz->getName().') '.$rrule."</h3>\n";
Please login to merge, or discard this patch.
calendar/inc/class.calendar_hooks.inc.php 3 patches
Braces   +25 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,9 +100,12 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	static function settings($hook_data)
102 102
 	{
103
-		if (!$hook_data['setup'])	// does not work on setup time
103
+		if (!$hook_data['setup'])
104
+		{
105
+			// does not work on setup time
104 106
 		{
105 107
 			$bo = new calendar_bo();
108
+		}
106 109
 			$bo->check_set_default_prefs();
107 110
 		}
108 111
 		$yesno = array(
@@ -195,9 +198,12 @@  discard block
 block discarded – undo
195 198
 			1		=> lang('Yes'),
196 199
 			2		=> lang('With credentials included'),
197 200
 		);
198
-		if (!$hook_data['setup'])	// does not work at setup time
201
+		if (!$hook_data['setup'])
202
+		{
203
+			// does not work at setup time
199 204
 		{
200 205
 			$options = array('0' => lang('none'));
206
+		}
201 207
 			foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group)
202 208
 			{
203 209
 				$options[$group['account_id']] = Api\Accounts::username($group['account_id']);
@@ -388,9 +394,12 @@  discard block
 block discarded – undo
388 394
 				'default' => '',
389 395
 			),
390 396
 		);
391
-		if (isset($bo))	// add custom time-spans set by CalDAV clients, not in our prefs
397
+		if (isset($bo))
398
+		{
399
+			// add custom time-spans set by CalDAV clients, not in our prefs
392 400
 		{
393 401
 			$prefs = $GLOBALS['egw_info']['user']['preferences']['calendar'];
402
+		}
394 403
 			$data = array(
395 404
 				'prefs' => &$prefs,	// use reference to get preference value back
396 405
 				'preprocess' => true,
@@ -689,7 +698,10 @@  discard block
 block discarded – undo
689 698
 	{
690 699
 		//error_log(__METHOD__."(".array2string($data).")");
691 700
 		// caldav perfs are always user specific and cant by switched off
692
-		if ($data['type'] != 'user') return;
701
+		if ($data['type'] != 'user')
702
+		{
703
+			return;
704
+		}
693 705
 
694 706
 		$account_lid = $GLOBALS['egw_info']['user']['account_lid'];
695 707
 		foreach(array(
@@ -698,16 +710,23 @@  discard block
 block discarded – undo
698 710
 		) as $name => $dav)
699 711
 		{
700 712
 			$pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav];
701
-			if (true) $pref = str_replace("\r", '', $pref);	// remove CR messing up multiline preg_match
713
+			if (true)
714
+			{
715
+				$pref = str_replace("\r", '', $pref);
716
+			}
717
+			// remove CR messing up multiline preg_match
702 718
 			$val =& $data['prefs'][$name];
703 719
 
704 720
 			//error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val");
705 721
 
706
-			if ($data['preprocess'])	// showing preferences
722
+			if ($data['preprocess'])
723
+			{
724
+				// showing preferences
707 725
 			{
708 726
 				if (!isset($val))	// no calendar pref --> read value from caldav
709 727
 				{
710 728
 					$matches = null;
729
+			}
711 730
 					if (preg_match('/^ACTION:NONE$/mi', $pref))
712 731
 					{
713 732
 						$val = '';
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	static function search_link($location)
25 25
 	{
26
-		unset($location);	// not used, but in function signature for hooks
26
+		unset($location); // not used, but in function signature for hooks
27 27
 		return array(
28 28
 			'query' => 'calendar.calendar_bo.link_query',
29 29
 			'title' => 'calendar.calendar_bo.link_title',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			'add_id'     => 'link_id',
42 42
 			'add_popup'  => '750x400',
43 43
 			'file_access' => 'calendar.calendar_bo.file_access',
44
-			'file_access_user' => true,	// file_access supports 4th parameter $user
44
+			'file_access_user' => true, // file_access supports 4th parameter $user
45 45
 			'mime' => array(
46 46
 				'text/calendar' => array(
47 47
 					'menuaction' => 'calendar.calendar_uiforms.edit',
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	static function getAppExportLimit($location)
67 67
 	{
68
-		unset($location);	// not used, but in function signature for hooks
68
+		unset($location); // not used, but in function signature for hooks
69 69
 		return $GLOBALS['egw_info']['server']['calendar_export_limit'];
70 70
 	}
71 71
 
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
 	static function admin()
76 76
 	{
77 77
 		$file = Array(
78
-			'Site Configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname=calendar'),
79
-			'Custom fields' => egw::link('/index.php','menuaction=admin.customfields.index&appname=calendar'),
80
-			'Calendar Holiday Management' => egw::link('/index.php','menuaction=calendar.uiholiday.admin'),
81
-			'Global Categories' => egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'),
82
-			'Category ACL' => egw::link('/index.php','menuaction=calendar.calendar_uiforms.cat_acl'),
83
-			'Update timezones' => egw::link('/index.php','menuaction=calendar.calendar_timezones.update'),
78
+			'Site Configuration' => egw::link('/index.php', 'menuaction=admin.uiconfig.index&appname=calendar'),
79
+			'Custom fields' => egw::link('/index.php', 'menuaction=admin.customfields.index&appname=calendar'),
80
+			'Calendar Holiday Management' => egw::link('/index.php', 'menuaction=calendar.uiholiday.admin'),
81
+			'Global Categories' => egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar'),
82
+			'Category ACL' => egw::link('/index.php', 'menuaction=calendar.calendar_uiforms.cat_acl'),
83
+			'Update timezones' => egw::link('/index.php', 'menuaction=calendar.calendar_timezones.update'),
84 84
 		);
85
-		display_section('calendar','calendar',$file);
85
+		display_section('calendar', 'calendar', $file);
86 86
 	}
87 87
 
88 88
 	/**
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 			'Saturday' => lang('Saturday')
164 164
 		);
165 165
 
166
-		for ($i=0; $i < 24; ++$i)
166
+		for ($i = 0; $i < 24; ++$i)
167 167
 		{
168
-			$times[$i] = $GLOBALS['egw']->common->formattime($i,'00');
168
+			$times[$i] = $GLOBALS['egw']->common->formattime($i, '00');
169 169
 		}
170 170
 
171 171
 		for ($i = 2; $i <= 9; ++$i)
172 172
 		{
173
-			$muliple_weeks[$i] = lang('%1 weeks',$i);
173
+			$muliple_weeks[$i] = lang('%1 weeks', $i);
174 174
 		}
175 175
 
176 176
 		$intervals = array(
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 		if (!$hook_data['setup'])	// does not work at setup time
203 203
 		{
204 204
 			$options = array('0' => lang('none'));
205
-			foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group)
205
+			foreach ($GLOBALS['egw']->accounts->search(array('type' => 'owngroups', 'app' => 'calendar')) as $group)
206 206
 			{
207 207
 				$options[$group['account_id']] = common::grab_owner_name($group['account_id']);
208 208
 			}
209
-			$freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'],$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']);
209
+			$freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'], $GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']);
210 210
 			$freebusy_url = '<a href="'.$freebusy_url.'" target="_blank">'.$freebusy_url.'</a>';
211 211
 			$freebusy_help = lang('Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is');
212
-			$freebusy_help .= ' ' . $freebusy_url;
212
+			$freebusy_help .= ' '.$freebusy_url;
213 213
 
214 214
 			// Timezone for file exports
215 215
 			$export_tzs = array('0' => 'Use Event TZ');
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 				'default'=> 60,
383 383
 			),
384 384
 			'default-alarm' => array(
385
-				'type'   => 'date-duration',//'select',
385
+				'type'   => 'date-duration', //'select',
386 386
 				'label'  => lang('Default alarm for regular events').' ('.lang('empty = no alarm').')',
387 387
 				'name'   => 'default-alarm',
388 388
 				'help'   => 'Alarm added automatic to new events before event start-time',
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 				'default' => '',
392 392
 			),
393 393
 			'default-alarm-wholeday' => array(
394
-				'type'   => 'date-duration',//'select',
394
+				'type'   => 'date-duration', //'select',
395 395
 				'label'  => lang('Default alarm for whole-day events').' ('.lang('empty = no alarm').')',
396 396
 				'name'   => 'default-alarm-wholeday',
397 397
 				'help'   => lang('Alarm added automatic to new events before event start-time').' ('.lang('Midnight').')',
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 		{
405 405
 			$prefs = $GLOBALS['egw_info']['user']['preferences']['calendar'];
406 406
 			$data = array(
407
-				'prefs' => &$prefs,	// use reference to get preference value back
407
+				'prefs' => &$prefs, // use reference to get preference value back
408 408
 				'preprocess' => true,
409 409
 				'type' => 'user',
410 410
 			);
@@ -577,9 +577,9 @@  discard block
 block discarded – undo
577 577
 				'size'   => 60,
578 578
 				'label'  => 'Default document to insert entries',
579 579
 				'name'   => 'default_document',
580
-				'help'   => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.',lang('calendar')).' '.
581
-					lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '.
582
-					lang('The following document-types are supported:'). implode(',',bo_merge::get_file_extensions()),
580
+				'help'   => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('calendar')).' '.
581
+					lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title').' '.
582
+					lang('The following document-types are supported:').implode(',', bo_merge::get_file_extensions()),
583 583
 				'run_lang' => false,
584 584
 				'xmlrpc' => True,
585 585
 				'admin'  => False,
@@ -589,9 +589,9 @@  discard block
 block discarded – undo
589 589
 				'size'   => 60,
590 590
 				'label'  => 'Directory with documents to insert entries',
591 591
 				'name'   => 'document_dir',
592
-				'help'   => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.',lang('calendar')).' '.
593
-					lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '.
594
-					lang('The following document-types are supported:'). implode(',',bo_merge::get_file_extensions()),
592
+				'help'   => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.', lang('calendar')).' '.
593
+					lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title').' '.
594
+					lang('The following document-types are supported:').implode(',', bo_merge::get_file_extensions()),
595 595
 				'run_lang' => false,
596 596
 				'xmlrpc' => True,
597 597
 				'admin'  => False,
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 				}
617 617
 				catch (Exception $e)
618 618
 				{
619
-					unset($e);	// not used
619
+					unset($e); // not used
620 620
 					// permission error
621 621
 					continue;
622 622
 				}
@@ -704,14 +704,14 @@  discard block
 block discarded – undo
704 704
 		if ($data['type'] != 'user') return;
705 705
 
706 706
 		$account_lid = $GLOBALS['egw_info']['user']['account_lid'];
707
-		foreach(array(
707
+		foreach (array(
708 708
 			'default-alarm' => 'default-alarm-vevent-datetime:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav',
709 709
 			'default-alarm-wholeday' => 'default-alarm-vevent-date:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav',
710 710
 		) as $name => $dav)
711 711
 		{
712
-			$pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav];
713
-			if (true) $pref = str_replace("\r", '', $pref);	// remove CR messing up multiline preg_match
714
-			$val =& $data['prefs'][$name];
712
+			$pref = & $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav];
713
+			if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match
714
+			$val = & $data['prefs'][$name];
715 715
 
716 716
 			//error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val");
717 717
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 							'D' => 1440,
733 733
 						);
734 734
 						$factor = $factors[strtoupper($matches[2])];
735
-						$val = $factor*(int)$matches[1];
735
+						$val = $factor * (int)$matches[1];
736 736
 					}
737 737
 					else
738 738
 					{
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 				}
764 764
 				else
765 765
 				{
766
-					$pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val)/60, 0).'H', $pref);
766
+					$pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val) / 60, 0).'H', $pref);
767 767
 				}
768 768
 				$GLOBALS['egw']->preferences->add('groupdav', $dav, $pref, 'user');
769 769
 				//error_log(__METHOD__."() storing $name=$val --> $dav='$pref'");
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 	 */
825 825
 	public static function categories($data)
826 826
 	{
827
-		unset($data);	// not used, but in function signature for hooks
827
+		unset($data); // not used, but in function signature for hooks
828 828
 		return true;
829 829
 	}
830 830
 	
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 	 */
836 836
 	public static function mail_import($args)
837 837
 	{
838
-		return array (
838
+		return array(
839 839
 			'menuaction' => 'calendar.calendar_uiforms.mail_import',
840 840
 			'popup' => egw_link::get_registry('calendar', 'edit_popup')
841 841
 		);
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 	// Cancel old purge
851 851
 	ExecMethod('phpgwapi.asyncservice.cancel_timer', $id);
852 852
 
853
-	if((float)$config > 0)
853
+	if ((float)$config > 0)
854 854
 	{
855 855
 		$result = ExecMethod2('phpgwapi.asyncservice.set_timer',
856 856
 			array('month' => '*', 'day' => 1),
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
 			'calendar.calendar_boupdate.purge',
859 859
 			(float)$config
860 860
 		);
861
-		if(!$result)
861
+		if (!$result)
862 862
 		{
863 863
 			$GLOBALS['config_error'] = 'Unable to schedule purge';
864 864
 		}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -464,7 +464,7 @@
 block discarded – undo
464 464
 	{
465 465
 		unset($args);	// unused, but required by function signature
466 466
 		$appname = 'preferences';
467
-		$file = Array(
467
+		$file = array(
468 468
 			'Site configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=' . $appname.'&ajax=true'),
469 469
 		);
470 470
 		display_section($appname, $file);
Please login to merge, or discard this patch.
setup/check_install.php 4 patches
Braces   +119 added lines, -30 removed lines patch added patch discarded remove patch
@@ -239,10 +239,15 @@  discard block
 block discarded – undo
239 239
 		foreach(explode(PATH_SEPARATOR,$open_basedir) as $dir)
240 240
 		{
241 241
 			$dir = realpath($dir);
242
-			if (($sp_visible = substr($session_path,0,strlen($dir)) == $dir)) break;
242
+			if (($sp_visible = substr($session_path,0,strlen($dir)) == $dir))
243
+			{
244
+				break;
245
+			}
243 246
 		}
244 247
 	}
245
-	if ($sp_visible)	// only check if session_save_path is visible by webserver
248
+	if ($sp_visible)
249
+	{
250
+		// only check if session_save_path is visible by webserver
246 251
 	{
247 252
 		$checks[$session_path] = array(
248 253
 			'func' => 'permission_check',
@@ -251,17 +256,25 @@  discard block
 block discarded – undo
251 256
 			'error' => lang('You will NOT be able to log into eGroupWare using PHP sessions: "session could not be verified" !!!'),
252 257
 		);
253 258
 	}
259
+	}
254 260
 }
255 261
 $setup_info = $GLOBALS['egw_setup']->detection->get_versions();
256 262
 foreach($setup_info as $app => $app_data)
257 263
 {
258
-	if (!isset($app_data['check_install'])) continue;
264
+	if (!isset($app_data['check_install']))
265
+	{
266
+		continue;
267
+	}
259 268
 
260 269
 	foreach ($app_data['check_install'] as $name => $data)
261 270
 	{
262 271
 		if (isset($checks[$name]))
263 272
 		{
264
-			if ($checks[$name] == $data) continue;	// identical check --> ignore it
273
+			if ($checks[$name] == $data)
274
+			{
275
+				continue;
276
+			}
277
+			// identical check --> ignore it
265 278
 
266 279
 			if ($data['func'] == 'pear_check' || in_array($data['func'],array('extension_check','php_ini_check')) && !isset($data['warning']))
267 280
 			{
@@ -269,9 +282,18 @@  discard block
 block discarded – undo
269 282
 				{
270 283
 					$checks[$name]['from'] = array($checks[$name]['from']);
271 284
 				}
272
-				if (!isset($data['from'])) $data['from'] = $app;
273
-				if (!isset($checks[$name]['from']) || !is_array($checks[$name]['from'])) $checks[$name]['from'] = array();
274
-				if (!in_array($data['from'],$checks[$name]['from'])) $checks[$name]['from'][] = $data['from'];
285
+				if (!isset($data['from']))
286
+				{
287
+					$data['from'] = $app;
288
+				}
289
+				if (!isset($checks[$name]['from']) || !is_array($checks[$name]['from']))
290
+				{
291
+					$checks[$name]['from'] = array();
292
+				}
293
+				if (!in_array($data['from'],$checks[$name]['from']))
294
+				{
295
+					$checks[$name]['from'][] = $data['from'];
296
+				}
275 297
 			}
276 298
 			else
277 299
 			{
@@ -280,7 +302,10 @@  discard block
 block discarded – undo
280 302
 		}
281 303
 		else
282 304
 		{
283
-			if (!isset($data['from'])) $data['from'] = $app;
305
+			if (!isset($data['from']))
306
+			{
307
+				$data['from'] = $app;
308
+			}
284 309
 			$checks[$name] = $data;
285 310
 		}
286 311
 		//echo "added check $data[func]($name) for $app"; _debug_array($data);
@@ -298,7 +323,10 @@  discard block
 block discarded – undo
298 323
 		}
299 324
 	}
300 325
 }
301
-if ($checks) $sorted_checks += $checks;
326
+if ($checks)
327
+{
328
+	$sorted_checks += $checks;
329
+}
302 330
 
303 331
 function php_version($name,$args)
304 332
 {
@@ -351,22 +379,35 @@  discard block
 block discarded – undo
351 379
 	}
352 380
 	@include_once 'PEAR/Config.php';
353 381
 
354
-	if (!class_exists('PEAR_Config')) return false;
382
+	if (!class_exists('PEAR_Config'))
383
+	{
384
+		return false;
385
+	}
355 386
 
356 387
 	$config = new PEAR_Config('',$pear_config);
357 388
 	//echo "<pre>config = ".print_r($config,true)."</pre>\n";
358 389
 
359
-	if (empty($channel)) $channel = $config->get('default_channel');
390
+	if (empty($channel))
391
+	{
392
+		$channel = $config->get('default_channel');
393
+	}
360 394
 	//echo "<pre>channel = ".print_r($channel,true)."</pre>\n";
361 395
 
362
-	if (!method_exists($config,'getRegistry')) return false;	// PEAR version to old
396
+	if (!method_exists($config,'getRegistry'))
397
+	{
398
+		return false;
399
+	}
400
+	// PEAR version to old
363 401
 
364 402
 	$reg = &$config->getRegistry();
365 403
 	//echo "<pre>reg = ".print_r($reg,true)."</pre>\n";
366 404
 
367 405
 	// a bug in pear causes an endless loop if the install-dir does not exist
368 406
 	// bug reported: http://pear.php.net/bugs/bug.php?id=11317
369
-	if (!file_exists($reg->install_dir)) return false;
407
+	if (!file_exists($reg->install_dir))
408
+	{
409
+		return false;
410
+	}
370 411
 
371 412
 	$installed = $reg->packageInfo(null,null,$channel);
372 413
 
@@ -376,7 +417,10 @@  discard block
 block discarded – undo
376 417
 	{
377 418
 		$name = isset($package['package']) ? $package['package'] : $package['name'];
378 419
 		$version = $package['version'];
379
-		if (is_array($version)) $version = $version['release'];
420
+		if (is_array($version))
421
+		{
422
+			$version = $version['release'];
423
+		}
380 424
 
381 425
 		$packages[$name] = $version;
382 426
 		//echo "<p>$name: ".print_r($package['version'],true)."</p>\n";
@@ -415,7 +459,10 @@  discard block
 block discarded – undo
415 459
 		{
416 460
 			$pear_available = $found = true;
417 461
 			// check if package is installed
418
-			if ($package && isset($pear_packages[$package])) $available = true;
462
+			if ($package && isset($pear_packages[$package]))
463
+			{
464
+				$available = true;
465
+			}
419 466
 			// check if it's the right version
420 467
 			$version_available = $pear_packages[$package ? $package : 'PEAR'];
421 468
 		}
@@ -425,7 +472,10 @@  discard block
 block discarded – undo
425 472
 			{
426 473
 				$pear_available = @include_once('PEAR.php');
427 474
 
428
-				if (!class_exists('PEAR')) $pear_available = false;
475
+				if (!class_exists('PEAR'))
476
+				{
477
+					$pear_available = false;
478
+				}
429 479
 			}
430 480
 			$found = $pear_available;
431 481
 			if ($pear_available && $package)
@@ -434,7 +484,10 @@  discard block
 block discarded – undo
434 484
 
435 485
 				$found = @include_once($file);
436 486
 
437
-				if (!class_exists($package)) $found = false;
487
+				if (!class_exists($package))
488
+				{
489
+					$found = false;
490
+				}
438 491
 			}
439 492
 		}
440 493
 	}
@@ -445,10 +498,13 @@  discard block
 block discarded – undo
445 498
 		($available ? ($version_available ? $version_available : lang('True')) :
446 499
 		($found ? lang('Found, but unknown version') : lang('False')))."</span></div>\n";
447 500
 
448
-	if (!$available)	// give further info only if not availible
501
+	if (!$available)
502
+	{
503
+		// give further info only if not availible
449 504
 	{
450 505
 		echo '<div class="setup_info">' . lang('PEAR%1 is needed by: %2.',$package ? '::'.$package : '',
451 506
 			is_array($args['from']) ? implode(', ',$args['from']) : $args['from']);
507
+	}
452 508
 
453 509
 		// if using Composer, dont confuse user with PEAR ;-)
454 510
 		if (file_exists(EGW_SERVER_ROOT.'/vendor'))
@@ -541,34 +597,55 @@  discard block
 block discarded – undo
541 597
 
542 598
 function verbosePerms( $in_Perms )
543 599
 {
544
-	if($in_Perms & 0x1000)     // FIFO pipe
600
+	if($in_Perms & 0x1000)
601
+	{
602
+		// FIFO pipe
545 603
 	{
546 604
 		$sP = 'p';
547 605
 	}
548
-	elseif($in_Perms & 0x2000) // Character special
606
+	}
607
+	elseif($in_Perms & 0x2000)
608
+	{
609
+		// Character special
549 610
 	{
550 611
 		$sP = 'c';
551 612
 	}
552
-	elseif($in_Perms & 0x4000) // Directory
613
+	}
614
+	elseif($in_Perms & 0x4000)
615
+	{
616
+		// Directory
553 617
 	{
554 618
 		$sP = 'd';
555 619
 	}
556
-	elseif($in_Perms & 0x6000) // Block special
620
+	}
621
+	elseif($in_Perms & 0x6000)
622
+	{
623
+		// Block special
557 624
 	{
558 625
 		$sP = 'b';
559 626
 	}
560
-	elseif($in_Perms & 0x8000) // Regular
627
+	}
628
+	elseif($in_Perms & 0x8000)
629
+	{
630
+		// Regular
561 631
 	{
562 632
 		$sP = '-';
563 633
 	}
564
-	elseif($in_Perms & 0xA000) // Symbolic Link
634
+	}
635
+	elseif($in_Perms & 0xA000)
636
+	{
637
+		// Symbolic Link
565 638
 	{
566 639
 		$sP = 'l';
567 640
 	}
568
-	elseif($in_Perms & 0xC000) // Socket
641
+	}
642
+	elseif($in_Perms & 0xC000)
643
+	{
644
+		// Socket
569 645
 	{
570 646
 		$sP = 's';
571 647
 	}
648
+	}
572 649
 	else                         // UNKNOWN
573 650
 	{
574 651
 		$sP = 'u';
@@ -709,9 +786,15 @@  discard block
 block discarded – undo
709 786
 				$Ok = $Ok && permission_check(($name!='.'?$name.'/':'').$file,$args,False);
710 787
 			}
711 788
 		}
712
-		if ($handle) closedir($handle);
789
+		if ($handle)
790
+		{
791
+			closedir($handle);
792
+		}
793
+	}
794
+	if ($verbose)
795
+	{
796
+		echo "\n";
713 797
 	}
714
-	if ($verbose) echo "\n";
715 798
 
716 799
 	return $Ok;
717 800
 }
@@ -719,7 +802,10 @@  discard block
 block discarded – undo
719 802
 function mk_value($value)
720 803
 {
721 804
 	$matches = null;
722
-	if (!preg_match('/^([0-9]+)([mk]+)$/i',$value,$matches)) return $value;
805
+	if (!preg_match('/^([0-9]+)([mk]+)$/i',$value,$matches))
806
+	{
807
+		return $value;
808
+	}
723 809
 
724 810
 	return (strtolower($matches[2]) == 'm' ? 1024*1024 : 1024) * (int) $matches[1];
725 811
 }
@@ -848,7 +934,8 @@  discard block
 block discarded – undo
848 934
 		'T_footer' => 'footer.tpl',
849 935
 	));
850 936
 	$ConfigDomain = $_REQUEST['ConfigDomain'];
851
-	if (@$_GET['intro']) {
937
+	if (@$_GET['intro'])
938
+	{
852 939
 		if(($ConfigLang = setup::get_lang()))
853 940
 		{
854 941
 			$GLOBALS['egw_setup']->set_cookie('ConfigLang',$ConfigLang,(int) (time()+(1200*9)),'/');
@@ -865,7 +952,9 @@  discard block
 block discarded – undo
865 952
 		echo '<p><a href="manageheader.php">'.lang('Skip the installation tests (not recommended)')."</a></p>\n";
866 953
 		$setup_tpl->pparse('out','T_footer');
867 954
 		exit;
868
-	} else {
955
+	}
956
+	else
957
+	{
869 958
 		$GLOBALS['egw_setup']->html->show_header(lang('Checking the eGroupWare Installation'),False,'config',$ConfigDomain ? $ConfigDomain . '(' . @$GLOBALS['egw_domain'][$ConfigDomain]['db_type'] . ')' : '');
870 959
 		echo '<h1>'.lang('Checking the eGroupWare Installation')."</h1>\n";
871 960
 		# echo "<pre style=\"text-align: left;\">\n";;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -313,6 +313,7 @@
 block discarded – undo
313 313
  * Check if given package is installed via composer in EGroupware's vendor directory
314 314
  *
315 315
  * @param string $package package-name in composer notation eg. "pear-pear.horde.org/Horde_Imap_Client" or "pear-pear.php.net/Net_Sieve"
316
+ * @return string
316 317
  */
317 318
 function composer_check($package)
318 319
 {
Please login to merge, or discard this patch.
Spacing   +121 added lines, -125 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @version $Id$
11 11
  */
12 12
 $run_by_webserver = !!$_SERVER['PHP_SELF'];
13
-$is_windows = strtoupper(substr(PHP_OS,0,3)) == 'WIN';
13
+$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
14 14
 
15 15
 if ($run_by_webserver)
16 16
 {
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	$error_icon = '*** Error: ';
39 39
 	$warning_icon = '!!! Warning: ';
40 40
 
41
-	function lang($msg,$arg1=NULL,$arg2=NULL,$arg3=NULL,$arg4=NULL)
41
+	function lang($msg, $arg1 = NULL, $arg2 = NULL, $arg3 = NULL, $arg4 = NULL)
42 42
 	{
43
-		return is_null($arg1) ? $msg : str_replace(array('%1','%2','%3','%4'),array($arg1,$arg2,$arg3,$arg4),$msg);
43
+		return is_null($arg1) ? $msg : str_replace(array('%1', '%2', '%3', '%4'), array($arg1, $arg2, $arg3, $arg4), $msg);
44 44
 	}
45 45
 }
46 46
 
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 		'func' => 'php_ini_check',
77 77
 		'value' => 0,
78 78
 		'verbose_value' => 'Off',
79
-		'warning' => lang('%1 is set to %2. This is NOT recommeded for a production system, as displayed error messages can contain passwords or other sensitive information!','display_errors',ini_get('display_errors')),
79
+		'warning' => lang('%1 is set to %2. This is NOT recommeded for a production system, as displayed error messages can contain passwords or other sensitive information!', 'display_errors', ini_get('display_errors')),
80 80
 	),
81 81
 	'memory_limit' => array(
82 82
 		'func' => 'php_ini_check',
83 83
 		'value' => '128M',
84 84
 		'check' => '>=',
85
-		'error' => lang('memory_limit is set to less than %1: some applications of eGroupWare need more than the recommend 8M, expect occasional failures','24M'),
85
+		'error' => lang('memory_limit is set to less than %1: some applications of eGroupWare need more than the recommend 8M, expect occasional failures', '24M'),
86 86
 		'change' => 'memory_limit = 24M'
87 87
 	),
88 88
 	'max_execution_time' => array(
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 		'func' => 'php_ini_check',
103 103
 		'value' => '8M',
104 104
 		'check' => '>=',
105
-		'error' => lang('%1 is set to %2, you will NOT be able to upload or attach files bigger then that!','upload_max_filesize',ini_get('upload_max_filesize')),
105
+		'error' => lang('%1 is set to %2, you will NOT be able to upload or attach files bigger then that!', 'upload_max_filesize', ini_get('upload_max_filesize')),
106 106
 		'change' => 'upload_max_filesize = 8M'
107 107
 	),
108 108
 	'post_max_size' => array(
109 109
 		'func' => 'php_ini_check',
110 110
 		'value' => '8M',
111 111
 		'check' => '>=',
112
-		'error' => lang('%1 is set to %2, you will NOT be able to upload or attach files bigger then that!','post_max_size',ini_get('max_post_size')),
112
+		'error' => lang('%1 is set to %2, you will NOT be able to upload or attach files bigger then that!', 'post_max_size', ini_get('max_post_size')),
113 113
 		'change' => 'post_max_size = 8M'
114 114
 	),
115 115
 	'allow_url_fopen' => array(
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		'verbose_value' => '"System/Localtime"',
136 136
 		'check' => '!=',
137 137
 		'error' => lang('No VALID timezone set! ("%1" is NOT sufficient, you have to use a timezone identifer like "%2", see %3full list of valid identifers%4)',
138
-			'System/Localtime','Europe/Berlin','<a href="http://www.php.net/manual/en/timezones.php" target="_blank">','</a>'),
138
+			'System/Localtime', 'Europe/Berlin', '<a href="http://www.php.net/manual/en/timezones.php" target="_blank">', '</a>'),
139 139
 	),
140 140
 	'pdo' => array(
141 141
 		'func' => 'extension_check',
@@ -143,19 +143,19 @@  discard block
 block discarded – undo
143 143
 	),
144 144
 	'mysqli' => array(
145 145
 		'func' => 'extension_check',
146
-		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.','mysql','MySQL')
146
+		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.', 'mysql', 'MySQL')
147 147
 	),
148 148
 	'pdo_mysql' => array(
149 149
 		'func' => 'extension_check',
150
-		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.','pdo_mysql','MySQL')
150
+		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.', 'pdo_mysql', 'MySQL')
151 151
 	),
152 152
 	'pgsql' => array(
153 153
 		'func' => 'extension_check',
154
-		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.','pgsql','pgSQL')
154
+		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.', 'pgsql', 'pgSQL')
155 155
 	),
156 156
 	'pdo_pgsql' => array(
157 157
 		'func' => 'extension_check',
158
-		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.','pdo_pgsql','pgSQL')
158
+		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.', 'pdo_pgsql', 'pgSQL')
159 159
 	),
160 160
 	/* disable checks for other database extensions, as we are not really supporting them anymore
161 161
 	'mssql' => array(
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	realpath('..') => array(
200 200
 		'func' => 'permission_check',
201 201
 		'is_world_writable' => False,
202
-		'only_if_exists' => true,	// quitens "file does not exist" for doc symlinks in Debian to files outside open_basedir
202
+		'only_if_exists' => true, // quitens "file does not exist" for doc symlinks in Debian to files outside open_basedir
203 203
 		'recursiv' => True
204 204
 	),
205 205
 	realpath('../header.inc.php') => array(
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 	$sp_visible = true;
234 234
 	if (($open_basedir = ini_get('open_basedir')) && $open_basedir != 'none')
235 235
 	{
236
-		foreach(explode(PATH_SEPARATOR,$open_basedir) as $dir)
236
+		foreach (explode(PATH_SEPARATOR, $open_basedir) as $dir)
237 237
 		{
238 238
 			$dir = realpath($dir);
239
-			if (($sp_visible = substr($session_path,0,strlen($dir)) == $dir)) break;
239
+			if (($sp_visible = substr($session_path, 0, strlen($dir)) == $dir)) break;
240 240
 		}
241 241
 	}
242 242
 	if ($sp_visible)	// only check if session_save_path is visible by webserver
@@ -244,13 +244,13 @@  discard block
 block discarded – undo
244 244
 		$checks[$session_path] = array(
245 245
 			'func' => 'permission_check',
246 246
 			'is_writable' => true,
247
-			'msg' => lang("Checking if php.ini setting session.save_path='%1' is writable by the webserver",session_save_path()),
247
+			'msg' => lang("Checking if php.ini setting session.save_path='%1' is writable by the webserver", session_save_path()),
248 248
 			'error' => lang('You will NOT be able to log into eGroupWare using PHP sessions: "session could not be verified" !!!'),
249 249
 		);
250 250
 	}
251 251
 }
252 252
 $setup_info = $GLOBALS['egw_setup']->detection->get_versions();
253
-foreach($setup_info as $app => $app_data)
253
+foreach ($setup_info as $app => $app_data)
254 254
 {
255 255
 	if (!isset($app_data['check_install'])) continue;
256 256
 
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
 	{
259 259
 		if (isset($checks[$name]))
260 260
 		{
261
-			if ($checks[$name] == $data) continue;	// identical check --> ignore it
261
+			if ($checks[$name] == $data) continue; // identical check --> ignore it
262 262
 
263
-			if ($data['func'] == 'pear_check' || in_array($data['func'],array('extension_check','php_ini_check')) && !isset($data['warning']))
263
+			if ($data['func'] == 'pear_check' || in_array($data['func'], array('extension_check', 'php_ini_check')) && !isset($data['warning']))
264 264
 			{
265 265
 				if (isset($checks[$name]['from']) && $checks[$name]['from'] && !is_array($checks[$name]['from']))
266 266
 				{
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				}
269 269
 				if (!isset($data['from'])) $data['from'] = $app;
270 270
 				if (!isset($checks[$name]['from']) || !is_array($checks[$name]['from'])) $checks[$name]['from'] = array();
271
-				if (!in_array($data['from'],$checks[$name]['from'])) $checks[$name]['from'][] = $data['from'];
271
+				if (!in_array($data['from'], $checks[$name]['from'])) $checks[$name]['from'][] = $data['from'];
272 272
 			}
273 273
 			else
274 274
 			{
@@ -284,9 +284,9 @@  discard block
 block discarded – undo
284 284
 	}
285 285
 }
286 286
 $sorted_checks = array();
287
-foreach(array('php_version','php_ini_check','extension_check','pear_check','gd_check','permission_check') as $func)
287
+foreach (array('php_version', 'php_ini_check', 'extension_check', 'pear_check', 'gd_check', 'permission_check') as $func)
288 288
 {
289
-	foreach($checks as $name => $data)
289
+	foreach ($checks as $name => $data)
290 290
 	{
291 291
 		if ($data['func'] == $func)
292 292
 		{
@@ -297,15 +297,15 @@  discard block
 block discarded – undo
297 297
 }
298 298
 if ($checks) $sorted_checks += $checks;
299 299
 
300
-function php_version($name,$args)
300
+function php_version($name, $args)
301 301
 {
302 302
 	global $passed_icon, $error_icon;
303
-	unset($name);	// not used, but required by function signature
303
+	unset($name); // not used, but required by function signature
304 304
 
305
-	$version_ok = version_compare(phpversion(),$args['value']) >= 0;
305
+	$version_ok = version_compare(phpversion(), $args['value']) >= 0;
306 306
 
307 307
 	echo '<div>'.($version_ok ? $passed_icon : $error_icon).' <span'.($version_ok ? '' : ' class="setup_error"').'>'.
308
-		lang('Checking required PHP version %1 (recommended %2)',$args['verbose_value'],$args['recommended']).': '.
308
+		lang('Checking required PHP version %1 (recommended %2)', $args['verbose_value'], $args['recommended']).': '.
309 309
 		phpversion().' ==> '.($version_ok ? lang('True') : lang('False'))."</span></div>\n";
310 310
 }
311 311
 
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
  */
317 317
 function composer_check($package)
318 318
 {
319
-	static $installed=null;
319
+	static $installed = null;
320 320
 	if (!isset($installed))
321 321
 	{
322 322
 		$installed = array();
323
-		if (file_exists(EGW_SERVER_ROOT.'/vendor') && file_exists($json=EGW_SERVER_ROOT.'/vendor/composer/installed.json'))
323
+		if (file_exists(EGW_SERVER_ROOT.'/vendor') && file_exists($json = EGW_SERVER_ROOT.'/vendor/composer/installed.json'))
324 324
 		{
325
-			foreach(json_decode(file_get_contents($json), true) as $package_data)
325
+			foreach (json_decode(file_get_contents($json), true) as $package_data)
326 326
 			{
327 327
 				$installed[strtolower($package_data['name'])] = $package_data['version'];
328 328
 			}
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
  * @param $channel =null use default or given channel
339 339
  * @return array with package-name => version pairs, eg. array('Log' => '1.9.8','PEAR' => '1.4.11')
340 340
  */
341
-function get_installed_pear_packages($channel=null)
341
+function get_installed_pear_packages($channel = null)
342 342
 {
343
-	$pear_config = '';	// use the system default
343
+	$pear_config = ''; // use the system default
344 344
 	// fix for SuSE having the pear.conf only for cli, will fail with open_basedir - no idea what to do then
345 345
 	if (@is_dir('/etc/php5/apache2') && !file_exists('/etc/php5/apache2/pear.conf') && @file_exists('/etc/php5/cli/pear.conf'))
346 346
 	{
@@ -350,13 +350,13 @@  discard block
 block discarded – undo
350 350
 
351 351
 	if (!class_exists('PEAR_Config')) return false;
352 352
 
353
-	$config = new PEAR_Config('',$pear_config);
353
+	$config = new PEAR_Config('', $pear_config);
354 354
 	//echo "<pre>config = ".print_r($config,true)."</pre>\n";
355 355
 
356 356
 	if (empty($channel)) $channel = $config->get('default_channel');
357 357
 	//echo "<pre>channel = ".print_r($channel,true)."</pre>\n";
358 358
 
359
-	if (!method_exists($config,'getRegistry')) return false;	// PEAR version to old
359
+	if (!method_exists($config, 'getRegistry')) return false; // PEAR version to old
360 360
 
361 361
 	$reg = &$config->getRegistry();
362 362
 	//echo "<pre>reg = ".print_r($reg,true)."</pre>\n";
@@ -365,11 +365,11 @@  discard block
 block discarded – undo
365 365
 	// bug reported: http://pear.php.net/bugs/bug.php?id=11317
366 366
 	if (!file_exists($reg->install_dir)) return false;
367 367
 
368
-	$installed = $reg->packageInfo(null,null,$channel);
368
+	$installed = $reg->packageInfo(null, null, $channel);
369 369
 
370 370
 	//echo "<pre>installed =".print_r($installed,true)."</pre>\n";
371 371
 	$packages = array();
372
-	foreach($installed as $package)
372
+	foreach ($installed as $package)
373 373
 	{
374 374
 		$name = isset($package['package']) ? $package['package'] : $package['name'];
375 375
 		$version = $package['version'];
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	return $packages;
384 384
 }
385 385
 
386
-function pear_check($package,$args)
386
+function pear_check($package, $args)
387 387
 {
388 388
 	global $passed_icon, $warning_icon;
389 389
 	static $pear_available = null;
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			$found = $pear_available;
428 428
 			if ($pear_available && $package)
429 429
 			{
430
-				$file = str_replace('_','/',$package == 'Mail_Mime' ? 'Mail_mime' : $package).'.php';
430
+				$file = str_replace('_', '/', $package == 'Mail_Mime' ? 'Mail_mime' : $package).'.php';
431 431
 
432 432
 				$found = @include_once($file);
433 433
 
@@ -436,16 +436,15 @@  discard block
 block discarded – undo
436 436
 		}
437 437
 	}
438 438
 	// is the right version availible
439
-	$available = $found && (!$min_version || version_compare($min_version,$version_available) <= 0);
439
+	$available = $found && (!$min_version || version_compare($min_version, $version_available) <= 0);
440 440
 	echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.
441
-		lang('Checking PEAR%1 is installed',($package?($channel?' '.$channel.'/':'::').$package:'').($min_version?" ($min_version)":'')).': '.
442
-		($available ? ($version_available ? $version_available : lang('True')) :
443
-		($found ? lang('Found, but unknown version') : lang('False')))."</span></div>\n";
441
+		lang('Checking PEAR%1 is installed', ($package ? ($channel ? ' '.$channel.'/' : '::').$package : '').($min_version ? " ($min_version)" : '')).': '.
442
+		($available ? ($version_available ? $version_available : lang('True')) : ($found ? lang('Found, but unknown version') : lang('False')))."</span></div>\n";
444 443
 
445 444
 	if (!$available)	// give further info only if not availible
446 445
 	{
447
-		echo '<div class="setup_info">' . lang('PEAR%1 is needed by: %2.',$package ? '::'.$package : '',
448
-			is_array($args['from']) ? implode(', ',$args['from']) : $args['from']);
446
+		echo '<div class="setup_info">'.lang('PEAR%1 is needed by: %2.', $package ? '::'.$package : '',
447
+			is_array($args['from']) ? implode(', ', $args['from']) : $args['from']);
449 448
 
450 449
 		// if using Composer, dont confuse user with PEAR ;-)
451 450
 		if (file_exists(EGW_SERVER_ROOT.'/vendor'))
@@ -458,7 +457,7 @@  discard block
 block discarded – undo
458 457
 			if (!$pear_available)
459 458
 			{
460 459
 				echo '<br/>'.lang('PEAR (%1) is a PHP repository and is usually in a package called %2.',
461
-					'<a href="http://pear.php.net" target="_blank">pear.php.net</a>','php-pear');
460
+					'<a href="http://pear.php.net" target="_blank">pear.php.net</a>', 'php-pear');
462 461
 			}
463 462
 			elseif ($package && !$found)
464 463
 			{
@@ -468,12 +467,12 @@  discard block
 block discarded – undo
468 467
 			}
469 468
 			elseif ($min_version && !$version_available)
470 469
 			{
471
-				echo '<br/>'.lang('We could not determine the version of %1, please make sure it is at least %2',$package,$min_version);
470
+				echo '<br/>'.lang('We could not determine the version of %1, please make sure it is at least %2', $package, $min_version);
472 471
 			}
473
-			elseif ($min_version && version_compare($min_version,$version_available) > 0)
472
+			elseif ($min_version && version_compare($min_version, $version_available) > 0)
474 473
 			{
475 474
 				echo '<br/>'.lang('Your installed version of %1 is %2, required is at least %3, please run: ',
476
-					$package,$version_available,$min_version).' pear upgrade '.$package;
475
+					$package, $version_available, $min_version).' pear upgrade '.$package;
477 476
 			}
478 477
 			echo '<br/>'.lang('Alternatively you can use %1Composer%2 to install all requirements at once. Downloading it and run:',
479 478
 				'<a href="https://getcomposer.org/" target="_blank">', '</a>').
@@ -486,26 +485,26 @@  discard block
 block discarded – undo
486 485
 	return $available;
487 486
 }
488 487
 
489
-function extension_check($name,$args)
488
+function extension_check($name, $args)
490 489
 {
491 490
 	//echo "<p>extension_check($name,".print_r($args,true).")</p>\n";
492 491
 	global $passed_icon, $warning_icon, $is_windows;
493 492
 
494 493
 	if (isset($args['win_only']) && $args['win_only'] && !$is_windows)
495 494
 	{
496
-		return True;	// check only under windows
495
+		return True; // check only under windows
497 496
 	}
498 497
 	// we check for the existens of 'dl', as multithreaded webservers dont have it !!!
499 498
 	$available = check_load_extension($name);
500 499
 
501
-	echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking extension %1 is loaded or loadable',$name).': '.($available ? lang('True') : lang('False'))."</span></div>\n";
500
+	echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking extension %1 is loaded or loadable', $name).': '.($available ? lang('True') : lang('False'))."</span></div>\n";
502 501
 
503 502
 	if (!$available)
504 503
 	{
505 504
 		if (!isset($args['warning']))
506 505
 		{
507
-			$args['warning'] = lang('The %1 extension is needed from: %2.',$name,
508
-				is_array($args['from']) ? implode(', ',$args['from']) : $args['from']);
506
+			$args['warning'] = lang('The %1 extension is needed from: %2.', $name,
507
+				is_array($args['from']) ? implode(', ', $args['from']) : $args['from']);
509 508
 		}
510 509
 		echo "<div class='setup_info'>".$args['warning'].'</div>';
511 510
 	}
@@ -514,20 +513,20 @@  discard block
 block discarded – undo
514 513
 	return $available;
515 514
 }
516 515
 
517
-function function_check($name,$args)
516
+function function_check($name, $args)
518 517
 {
519 518
 	global $passed_icon, $warning_icon;
520 519
 
521 520
 	$available = function_exists($name);
522 521
 
523
-	echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking function %1 exists',$name).': '.($available ? lang('True') : lang('False'))."</span></div>\n";
522
+	echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking function %1 exists', $name).': '.($available ? lang('True') : lang('False'))."</span></div>\n";
524 523
 
525 524
 	if (!$available)
526 525
 	{
527 526
 		if (!isset($args['warning']))
528 527
 		{
529
-			$args['warning'] = lang('The function %1 is needed from: %2.',$name,
530
-				is_array($args['from'] ? implode(', ',$args['from']) : $args['from']));
528
+			$args['warning'] = lang('The function %1 is needed from: %2.', $name,
529
+				is_array($args['from'] ? implode(', ', $args['from']) : $args['from']));
531 530
 		}
532 531
 		echo "<div class='setup_info'>".$args['warning'].'</div>';
533 532
 	}
@@ -536,33 +535,33 @@  discard block
 block discarded – undo
536 535
 	return $available;
537 536
 }
538 537
 
539
-function verbosePerms( $in_Perms )
538
+function verbosePerms($in_Perms)
540 539
 {
541
-	if($in_Perms & 0x1000)     // FIFO pipe
540
+	if ($in_Perms&0x1000)     // FIFO pipe
542 541
 	{
543 542
 		$sP = 'p';
544 543
 	}
545
-	elseif($in_Perms & 0x2000) // Character special
544
+	elseif ($in_Perms&0x2000) // Character special
546 545
 	{
547 546
 		$sP = 'c';
548 547
 	}
549
-	elseif($in_Perms & 0x4000) // Directory
548
+	elseif ($in_Perms&0x4000) // Directory
550 549
 	{
551 550
 		$sP = 'd';
552 551
 	}
553
-	elseif($in_Perms & 0x6000) // Block special
552
+	elseif ($in_Perms&0x6000) // Block special
554 553
 	{
555 554
 		$sP = 'b';
556 555
 	}
557
-	elseif($in_Perms & 0x8000) // Regular
556
+	elseif ($in_Perms&0x8000) // Regular
558 557
 	{
559 558
 		$sP = '-';
560 559
 	}
561
-	elseif($in_Perms & 0xA000) // Symbolic Link
560
+	elseif ($in_Perms&0xA000) // Symbolic Link
562 561
 	{
563 562
 		$sP = 'l';
564 563
 	}
565
-	elseif($in_Perms & 0xC000) // Socket
564
+	elseif ($in_Perms&0xC000) // Socket
566 565
 	{
567 566
 		$sP = 's';
568 567
 	}
@@ -572,33 +571,30 @@  discard block
 block discarded – undo
572 571
 	}
573 572
 
574 573
 	// owner
575
-	$sP .= (($in_Perms & 0x0100) ? 'r' : '-') .
576
-	(($in_Perms & 0x0080) ? 'w' : '-') .
577
-	(($in_Perms & 0x0040) ? (($in_Perms & 0x0800) ? 's' : 'x' ) :
578
-	(($in_Perms & 0x0800) ? 'S' : '-'));
574
+	$sP .= (($in_Perms&0x0100) ? 'r' : '-').
575
+	(($in_Perms&0x0080) ? 'w' : '-').
576
+	(($in_Perms&0x0040) ? (($in_Perms&0x0800) ? 's' : 'x') : (($in_Perms&0x0800) ? 'S' : '-'));
579 577
 
580 578
 	// group
581
-	$sP .= (($in_Perms & 0x0020) ? 'r' : '-') .
582
-	(($in_Perms & 0x0010) ? 'w' : '-') .
583
-	(($in_Perms & 0x0008) ? (($in_Perms & 0x0400) ? 's' : 'x' ) :
584
-	(($in_Perms & 0x0400) ? 'S' : '-'));
579
+	$sP .= (($in_Perms&0x0020) ? 'r' : '-').
580
+	(($in_Perms&0x0010) ? 'w' : '-').
581
+	(($in_Perms&0x0008) ? (($in_Perms&0x0400) ? 's' : 'x') : (($in_Perms&0x0400) ? 'S' : '-'));
585 582
 
586 583
 	// world
587
-	$sP .= (($in_Perms & 0x0004) ? 'r' : '-') .
588
-	(($in_Perms & 0x0002) ? 'w' : '-') .
589
-	(($in_Perms & 0x0001) ? (($in_Perms & 0x0200) ? 't' : 'x' ) :
590
-	(($in_Perms & 0x0200) ? 'T' : '-'));
584
+	$sP .= (($in_Perms&0x0004) ? 'r' : '-').
585
+	(($in_Perms&0x0002) ? 'w' : '-').
586
+	(($in_Perms&0x0001) ? (($in_Perms&0x0200) ? 't' : 'x') : (($in_Perms&0x0200) ? 'T' : '-'));
591 587
 	return $sP;
592 588
 }
593 589
 
594
-function permission_check($name,$args,$verbose=True)
590
+function permission_check($name, $args, $verbose = True)
595 591
 {
596
-	global $passed_icon, $error_icon, $warning_icon,$is_windows;
592
+	global $passed_icon, $error_icon, $warning_icon, $is_windows;
597 593
 	//echo "<p>permision_check('$name',".print_r($args,True).",'$verbose')</p>\n";
598 594
 
599 595
 	// add a ../ for non-absolute pathes
600 596
 	$rel_name = $name;
601
-	if ($name && substr($name,0,3) != '../' && $name[0] != '/' && $name[0] != '\\' && strpos($name,':') === false)
597
+	if ($name && substr($name, 0, 3) != '../' && $name[0] != '/' && $name[0] != '\\' && strpos($name, ':') === false)
602 598
 	{
603 599
 		$name = '../'.$name;
604 600
 	}
@@ -620,22 +616,22 @@  discard block
 block discarded – undo
620 616
 	if (isset($args['is_readable']))
621 617
 	{
622 618
 		$checks[] = lang('readable by the webserver');
623
-		$check_not = (!$args['is_readable']?lang('not'):'');
619
+		$check_not = (!$args['is_readable'] ? lang('not') : '');
624 620
 	}
625 621
 	if (isset($args['is_writable']))
626 622
 	{
627 623
 		$checks[] = lang('writable by the webserver');
628
-		$check_not = (!$args['is_writable']?lang('not'):'');
624
+		$check_not = (!$args['is_writable'] ? lang('not') : '');
629 625
 	}
630 626
 	if (isset($args['is_world_readable']))
631 627
 	{
632 628
 		$checks[] = lang('world readable');
633
-		$check_not = (!$args['is_world_readable']?lang('not'):'');
629
+		$check_not = (!$args['is_world_readable'] ? lang('not') : '');
634 630
 	}
635 631
 	if (isset($args['is_world_writable']))
636 632
 	{
637 633
 		$checks[] = lang('world writable');
638
-		$check_not = (!$args['is_world_writable']?lang('not'):'');
634
+		$check_not = (!$args['is_world_writable'] ? lang('not') : '');
639 635
 	}
640 636
 
641 637
 	if (isset($args['msg']) && ($msg = $args['msg']))
@@ -644,7 +640,7 @@  discard block
 block discarded – undo
644 640
 	}
645 641
 	else
646 642
 	{
647
-		$msg = lang('Checking file-permissions of %1 for %2 %3: %4',$rel_name,$check_not,implode(', ',$checks),$perms)."<br />\n";
643
+		$msg = lang('Checking file-permissions of %1 for %2 %3: %4', $rel_name, $check_not, implode(', ', $checks), $perms)."<br />\n";
648 644
 	}
649 645
 	$extra_error_msg = '';
650 646
 	if (isset($args['error']) && $args['error'])
@@ -653,13 +649,13 @@  discard block
 block discarded – undo
653 649
 	}
654 650
 	if (!file_exists($name))
655 651
 	{
656
-		echo '<div>'. $error_icon . '<span class="setup_error">' . $msg . lang('%1 does not exist !!!',$rel_name).$extra_error_msg."</span></div>\n";
652
+		echo '<div>'.$error_icon.'<span class="setup_error">'.$msg.lang('%1 does not exist !!!', $rel_name).$extra_error_msg."</span></div>\n";
657 653
 		return False;
658 654
 	}
659 655
 	$warning = False;
660 656
 	if (!$GLOBALS['run_by_webserver'] && (@$args['is_readable'] || @$args['is_writable']))
661 657
 	{
662
-		echo $warning_icon.' '.$msg. lang('Check can only be performed, if called via a webserver, as the user-id/-name of the webserver is not known.')."\n";
658
+		echo $warning_icon.' '.$msg.lang('Check can only be performed, if called via a webserver, as the user-id/-name of the webserver is not known.')."\n";
663 659
 		unset($args['is_readable']);
664 660
 		unset($args['is_writable']);
665 661
 		$warning = True;
@@ -667,22 +663,22 @@  discard block
 block discarded – undo
667 663
 	$Ok = True;
668 664
 	if (isset($args['is_writable']) && is_writable($name) != $args['is_writable'])
669 665
 	{
670
-		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!',$rel_name,$args['is_writable']?lang('not').' ':'',lang('writable by the webserver')).$extra_error_msg."</span></div>\n";
666
+		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!', $rel_name, $args['is_writable'] ? lang('not').' ' : '', lang('writable by the webserver')).$extra_error_msg."</span></div>\n";
671 667
 		$Ok = False;
672 668
 	}
673 669
 	if (isset($args['is_readable']) && is_readable($name) != $args['is_readable'])
674 670
 	{
675
-		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!',$rel_name,$args['is_readable']?lang('not').' ':'',lang('readable by the webserver')).$extra_error_msg."</span></div>\n";
671
+		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!', $rel_name, $args['is_readable'] ? lang('not').' ' : '', lang('readable by the webserver')).$extra_error_msg."</span></div>\n";
676 672
 		$Ok = False;
677 673
 	}
678
-	if (!$is_windows && isset($args['is_world_readable']) && !(fileperms($name) & 04) == $args['is_world_readable'])
674
+	if (!$is_windows && isset($args['is_world_readable']) && !(fileperms($name)&04) == $args['is_world_readable'])
679 675
 	{
680
-		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!',$rel_name,$args['is_world_readable']?lang('not').' ':'',lang('world readable')).$extra_error_msg."</span></div>\n";
676
+		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!', $rel_name, $args['is_world_readable'] ? lang('not').' ' : '', lang('world readable')).$extra_error_msg."</span></div>\n";
681 677
 		$Ok = False;
682 678
 	}
683
-	if (!$is_windows && isset($args['is_world_writable']) && !(fileperms($name) & 02) == $args['is_world_writable'])
679
+	if (!$is_windows && isset($args['is_world_writable']) && !(fileperms($name)&02) == $args['is_world_writable'])
684 680
 	{
685
-		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!',$rel_name,$args['is_world_writable']?lang('not').' ':'',lang('world writable')).$extra_error_msg."</span></div>\n";
681
+		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!', $rel_name, $args['is_world_writable'] ? lang('not').' ' : '', lang('world writable')).$extra_error_msg."</span></div>\n";
686 682
 		$Ok = False;
687 683
 	}
688 684
 	if ($Ok && !$warning && $verbose)
@@ -694,16 +690,16 @@  discard block
 block discarded – undo
694 690
 		if ($verbose)
695 691
 		{
696 692
 			@set_time_limit(0);
697
-			echo "<div class='setup_info'>" . lang('This might take a while, please wait ...')."</div>\n";
693
+			echo "<div class='setup_info'>".lang('This might take a while, please wait ...')."</div>\n";
698 694
 			flush();
699 695
 		}
700 696
 		@set_time_limit(0);
701 697
 		$handle = @opendir($name);
702
-		while($handle && ($file = readdir($handle)))
698
+		while ($handle && ($file = readdir($handle)))
703 699
 		{
704 700
 			if ($file != '.' && $file != '..')
705 701
 			{
706
-				$Ok = $Ok && permission_check(($name!='.'?$name.'/':'').$file,$args,False);
702
+				$Ok = $Ok && permission_check(($name != '.' ? $name.'/' : '').$file, $args, False);
707 703
 			}
708 704
 		}
709 705
 		if ($handle) closedir($handle);
@@ -716,12 +712,12 @@  discard block
 block discarded – undo
716 712
 function mk_value($value)
717 713
 {
718 714
 	$matches = null;
719
-	if (!preg_match('/^([0-9]+)([mk]+)$/i',$value,$matches)) return $value;
715
+	if (!preg_match('/^([0-9]+)([mk]+)$/i', $value, $matches)) return $value;
720 716
 
721
-	return (strtolower($matches[2]) == 'm' ? 1024*1024 : 1024) * (int) $matches[1];
717
+	return (strtolower($matches[2]) == 'm' ? 1024 * 1024 : 1024) * (int)$matches[1];
722 718
 }
723 719
 
724
-function php_ini_check($name,$args)
720
+function php_ini_check($name, $args)
725 721
 {
726 722
 	global $passed_icon, $error_icon, $warning_icon, $is_windows;
727 723
 
@@ -739,20 +735,20 @@  discard block
 block discarded – undo
739 735
 	{
740 736
 		case 'not set':
741 737
 			$check = lang('not set');
742
-			$result = !($ini_value & $args['value']);
738
+			$result = !($ini_value&$args['value']);
743 739
 			break;
744 740
 		case 'set':
745 741
 			$check = lang('set');
746
-			$result = !!($ini_value & $args['value']);
742
+			$result = !!($ini_value&$args['value']);
747 743
 			break;
748 744
 		case '>=':
749
-			$result = !$ini_value ||	// value not used, eg. no memory limit
750
-			(int) mk_value($ini_value) >= (int) mk_value($args['value']);
745
+			$result = !$ini_value || // value not used, eg. no memory limit
746
+			(int)mk_value($ini_value) >= (int)mk_value($args['value']);
751 747
 			break;
752 748
 		case 'contain':
753 749
 			$check = lang('contain');
754 750
 			$sep = $is_windows ? '/[; ]+/' : '/[: ]+/';
755
-			$result = in_array($args['value'],preg_split($sep,$ini_value));
751
+			$result = in_array($args['value'], preg_split($sep, $ini_value));
756 752
 			break;
757 753
 		case '!=':
758 754
 			$check = lang('set and not');
@@ -769,9 +765,9 @@  discard block
 block discarded – undo
769 765
 			$tz = new DateTimeZone($ini_value);
770 766
 			unset($tz);
771 767
 		}
772
-		catch(Exception $e) {
768
+		catch (Exception $e) {
773 769
 			unset($e);
774
-			$result = false;	// no valid timezone
770
+			$result = false; // no valid timezone
775 771
 		}
776 772
 	}
777 773
 	$msg = ' '.lang('Checking php.ini').": $name $check $verbose_value: <span class='setup_info'>ini_get('$name')='$ini_value'$ini_value_verbose</span>";
@@ -793,7 +789,7 @@  discard block
 block discarded – undo
793 789
 		elseif (!isset($args['safe_mode']))
794 790
 		{
795 791
 			echo "<div>".$warning_icon.' <span class="setup_warning">'.$msg.'</span><div class="setup_info">'.
796
-				lang('%1 is needed by: %2.',$name,is_array($args['from']) ? implode(', ',$args['from']) : $args['from'])
792
+				lang('%1 is needed by: %2.', $name, is_array($args['from']) ? implode(', ', $args['from']) : $args['from'])
797 793
 				."</div></div>\n";
798 794
 		}
799 795
 		if (isset($args['safe_mode']) && $safe_mode || @$args['change'])
@@ -803,7 +799,7 @@  discard block
 block discarded – undo
803 799
 				echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.'</span></div>';
804 800
 			}
805 801
 			echo "<div class='setup_error'>\n";
806
-			echo '*** '.lang('Please make the following change in your php.ini').' ('.get_php_ini().'): '.(@$args['safe_mode']?$args['safe_mode']:$args['change'])."<br />\n";
802
+			echo '*** '.lang('Please make the following change in your php.ini').' ('.get_php_ini().'): '.(@$args['safe_mode'] ? $args['safe_mode'] : $args['change'])."<br />\n";
807 803
 			echo '*** '.lang('AND reload your webserver, so the above changes take effect !!!')."</div>\n";
808 804
 		}
809 805
 	}
@@ -818,16 +814,16 @@  discard block
 block discarded – undo
818 814
 	ob_end_clean();
819 815
 
820 816
 	$found = null;
821
-	return preg_match('/\(php.ini\).*<\/td><td[^>]*>([^ <]+)/',$phpinfo,$found) ? $found[1] : False;
817
+	return preg_match('/\(php.ini\).*<\/td><td[^>]*>([^ <]+)/', $phpinfo, $found) ? $found[1] : False;
822 818
 }
823 819
 
824 820
 function gd_check()
825 821
 {
826 822
 	global $passed_icon, $warning_icon;
827 823
 
828
-	$available = (function_exists('imagecopyresampled')  || function_exists('imagecopyresized'));
824
+	$available = (function_exists('imagecopyresampled') || function_exists('imagecopyresized'));
829 825
 
830
-	echo "<div>".($available ? $passed_icon : $warning_icon).' <span'.($available?'':' class="setup_warning"').'>'.lang('Checking for GD support...').': '.($available ? lang('True') : lang('False'))."</span></div>\n";
826
+	echo "<div>".($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking for GD support...').': '.($available ? lang('True') : lang('False'))."</span></div>\n";
831 827
 
832 828
 	if (!$available)
833 829
 	{
@@ -839,31 +835,31 @@  discard block
 block discarded – undo
839 835
 if ($run_by_webserver)
840 836
 {
841 837
 	$tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
842
-	$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
838
+	$setup_tpl = CreateObject('phpgwapi.Template', $tpl_root);
843 839
 	$setup_tpl->set_file(array(
844 840
 		'T_head' => 'head.tpl',
845 841
 		'T_footer' => 'footer.tpl',
846 842
 	));
847
-	$ConfigDomain = get_var('ConfigDomain',Array('POST','COOKIE'));
843
+	$ConfigDomain = get_var('ConfigDomain', Array('POST', 'COOKIE'));
848 844
 	if (@$_GET['intro']) {
849
-		if(($ConfigLang = setup::get_lang()))
845
+		if (($ConfigLang = setup::get_lang()))
850 846
 		{
851
-			$GLOBALS['egw_setup']->set_cookie('ConfigLang',$ConfigLang,(int) (time()+(1200*9)),'/');
847
+			$GLOBALS['egw_setup']->set_cookie('ConfigLang', $ConfigLang, (int)(time() + (1200 * 9)), '/');
852 848
 		}
853
-		$GLOBALS['egw_setup']->html->show_header(lang('Welcome to the eGroupWare Installation'),False,'config');
849
+		$GLOBALS['egw_setup']->html->show_header(lang('Welcome to the eGroupWare Installation'), False, 'config');
854 850
 		echo '<h1>'.lang('Welcome to the eGroupWare Installation')."</h1>\n";
855
-		if(!$ConfigLang)
851
+		if (!$ConfigLang)
856 852
 		{
857
-			echo '<p><form action="check_install.php?intro=1" method="Post">Please Select your language '.setup_html::lang_select(True,'en')."</form></p>\n";
853
+			echo '<p><form action="check_install.php?intro=1" method="Post">Please Select your language '.setup_html::lang_select(True, 'en')."</form></p>\n";
858 854
 		}
859 855
 		echo '<p>'.lang('The first step in installing eGroupWare is to ensure your environment has the necessary settings to correctly run the application.').'</p>';
860 856
 		echo '<p>'.lang('We will now run a series of tests, which may take a few minutes.  Click the link below to proceed.').'</p>';
861 857
 		echo '<h3><a href="check_install.php">'.lang('Run installation tests').'</a></h3>';
862 858
 		echo '<p><a href="manageheader.php">'.lang('Skip the installation tests (not recommended)')."</a></p>\n";
863
-		$setup_tpl->pparse('out','T_footer');
859
+		$setup_tpl->pparse('out', 'T_footer');
864 860
 		exit;
865 861
 	} else {
866
-		$GLOBALS['egw_setup']->html->show_header(lang('Checking the eGroupWare Installation'),False,'config',$ConfigDomain ? $ConfigDomain . '(' . @$GLOBALS['egw_domain'][$ConfigDomain]['db_type'] . ')' : '');
862
+		$GLOBALS['egw_setup']->html->show_header(lang('Checking the eGroupWare Installation'), False, 'config', $ConfigDomain ? $ConfigDomain.'('.@$GLOBALS['egw_domain'][$ConfigDomain]['db_type'].')' : '');
867 863
 		echo '<h1>'.lang('Checking the eGroupWare Installation')."</h1>\n";
868 864
 		# echo "<pre style=\"text-align: left;\">\n";;
869 865
 	}
@@ -877,7 +873,7 @@  discard block
 block discarded – undo
877 873
 $Ok = True;
878 874
 foreach ($sorted_checks as $name => $args)
879 875
 {
880
-	$check_ok = $args['func']($name,$args);
876
+	$check_ok = $args['func']($name, $args);
881 877
 	$Ok = $Ok && $check_ok;
882 878
 }
883 879
 
@@ -889,9 +885,9 @@  discard block
 block discarded – undo
889 885
 	{
890 886
 		if (!$Ok)
891 887
 		{
892
-			echo '<h3>'.lang('Please fix the above errors (%1) and warnings(%2)',$error_icon,$warning_icon)."</h3>\n";
888
+			echo '<h3>'.lang('Please fix the above errors (%1) and warnings(%2)', $error_icon, $warning_icon)."</h3>\n";
893 889
 			echo '<h3><a href="check_install.php">'.lang('Click here to re-run the installation tests')."</a></h3>\n";
894
-			echo '<h3>'.lang('or %1Continue to the Header Admin%2','<a href="manageheader.php">','</a>')."</h3>\n";
890
+			echo '<h3>'.lang('or %1Continue to the Header Admin%2', '<a href="manageheader.php">', '</a>')."</h3>\n";
895 891
 		}
896 892
 		else
897 893
 		{
@@ -903,10 +899,10 @@  discard block
 block discarded – undo
903 899
 		echo '<h3>';
904 900
 		if (!$Ok)
905 901
 		{
906
-			echo lang('Please fix the above errors (%1) and warnings(%2)',$error_icon,$warning_icon).'. ';
902
+			echo lang('Please fix the above errors (%1) and warnings(%2)', $error_icon, $warning_icon).'. ';
907 903
 		}
908
-		echo '<br /><a href="'.str_replace('check_install.php','',@$_SERVER['HTTP_REFERER']).'">'.lang('Return to Setup')."</a></h3>\n";
904
+		echo '<br /><a href="'.str_replace('check_install.php', '', @$_SERVER['HTTP_REFERER']).'">'.lang('Return to Setup')."</a></h3>\n";
909 905
 	}
910
-	$setup_tpl->pparse('out','T_footer');
906
+	$setup_tpl->pparse('out', 'T_footer');
911 907
 	//echo "</body>\n</html>\n";
912 908
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -844,7 +844,7 @@
 block discarded – undo
844 844
 		'T_head' => 'head.tpl',
845 845
 		'T_footer' => 'footer.tpl',
846 846
 	));
847
-	$ConfigDomain = get_var('ConfigDomain',Array('POST','COOKIE'));
847
+	$ConfigDomain = get_var('ConfigDomain',array('POST','COOKIE'));
848 848
 	if (@$_GET['intro']) {
849 849
 		if(($ConfigLang = setup::get_lang()))
850 850
 		{
Please login to merge, or discard this patch.