Completed
Push — 14.2 ( c53e78...a8db63 )
by Ralf
29:08
created
resources/inc/class.resources_favorite_portlet.inc.php 4 patches
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,9 +76,12 @@
 block discarded – undo
76 76
 
77 77
 		// This is just copy+pasted from resources_ui line 816, but we don't want
78 78
 		// the etemplate exec to fire again.
79
-		if (is_array($content) && isset($content['nm']['rows']['document']))  // handle insert in default document button like an action
79
+		if (is_array($content) && isset($content['nm']['rows']['document']))
80
+		{
81
+			// handle insert in default document button like an action
80 82
 		{
81 83
 			list($id) = @each($content['nm']['rows']['document']);
84
+		}
82 85
 			$content['nm']['action'] = 'document';
83 86
 			$content['nm']['selected'] = array($id);
84 87
 		}
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		$context['appname'] = 'resources';
27 27
 		
28 28
 		// Let parent handle the basic stuff
29
-		parent::__construct($context,$need_reload);
29
+		parent::__construct($context, $need_reload);
30 30
 
31 31
 		$ui = new resources_ui();
32 32
 
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 		);
49 49
 	}
50 50
 
51
-	public function exec($id = null, etemplate_new &$etemplate = null)
51
+	public function exec($id = null, etemplate_new&$etemplate = null)
52 52
 	{
53 53
 		$ui = new resources_ui();
54 54
 
55
-		$this->context['sel_options']['filter']= array(''=>lang('all categories'))+(array)$ui->bo->acl->get_cats(EGW_ACL_READ);
55
+		$this->context['sel_options']['filter'] = array(''=>lang('all categories')) + (array)$ui->bo->acl->get_cats(EGW_ACL_READ);
56 56
 		$this->context['sel_options']['filter2'] = resources_bo::$filter_options;
57
-		if(!$content['nm']['filter2'])
57
+		if (!$content['nm']['filter2'])
58 58
 		{
59 59
 			$content['nm']['filter2'] = key(resources_bo::$filter_options);
60 60
 		}
@@ -93,28 +93,28 @@  discard block
 block discarded – undo
93 93
 			if (!count($content['nm']['selected']) && !$content['nm']['select_all'])
94 94
 			{
95 95
 				$msg = lang('You need to select some entries first!');
96
-				egw_json_response::get()->apply('egw.message',array($msg,'error'));
96
+				egw_json_response::get()->apply('egw.message', array($msg, 'error'));
97 97
 			}
98 98
 			else
99 99
 			{
100 100
 				$success = $failed = $action_msg = null;
101
-				if ($ui->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'],
102
-					$success,$failed,$action_msg,'index',$msg))
101
+				if ($ui->action($content['nm']['action'], $content['nm']['selected'], $content['nm']['select_all'],
102
+					$success, $failed, $action_msg, 'index', $msg))
103 103
 				{
104
-					$msg .= lang('%1 resource(s) %2',$success,$action_msg);
104
+					$msg .= lang('%1 resource(s) %2', $success, $action_msg);
105 105
 
106
-					egw_json_response::get()->apply('egw.message',array($msg,'success'));
107
-					foreach($content['nm']['selected'] as &$id)
106
+					egw_json_response::get()->apply('egw.message', array($msg, 'success'));
107
+					foreach ($content['nm']['selected'] as &$id)
108 108
 					{
109 109
 						$id = 'resources::'.$id;
110 110
 					}
111 111
 					// Directly request an update - this will get resources tab too
112
-					egw_json_response::get()->apply('egw.dataRefreshUIDs',array($content['nm']['selected']));
112
+					egw_json_response::get()->apply('egw.dataRefreshUIDs', array($content['nm']['selected']));
113 113
 				}
114
-				elseif(empty($msg))
114
+				elseif (empty($msg))
115 115
 				{
116
-					$msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
117
-					egw_json_response::get()->apply('egw.message',array($msg,'error'));
116
+					$msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed);
117
+					egw_json_response::get()->apply('egw.message', array($msg, 'error'));
118 118
 				}
119 119
 			}
120 120
 		}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 *
50 50
 	 * @param boolean $need_reload Flag to indicate that the portlet needs to be reloaded (exec will be called)
51 51
 	 */
52
-	public function __construct(Array &$context = array(), &$need_reload = false)
52
+	public function __construct(array &$context = array(), &$need_reload = false)
53 53
 	{
54 54
 		if (false) parent::__construct();
55 55
 
Please login to merge, or discard this patch.
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -86,8 +86,6 @@
 block discarded – undo
86 86
 	 * Here we need to handle any incoming data.  Setup is done in the constructor,
87 87
 	 * output is handled by parent.
88 88
 	 *
89
-	 * @param type $id
90
-	 * @param etemplate_new $etemplate
91 89
 	 */
92 90
 	public static function process($content = array())
93 91
 	{
Please login to merge, or discard this patch.
resources/inc/class.resources_bo.inc.php 5 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -572,7 +572,7 @@
 block discarded – undo
572 572
 	 * @param array $options Array of options for the search
573 573
 	 *
574 574
 	 */
575
-	function link_query( $pattern, Array &$options = array() )
575
+	function link_query( $pattern, array &$options = array() )
576 576
 	{
577 577
 		if (is_array($pattern))
578 578
 		{
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,6 @@  discard block
 block discarded – undo
69 69
 	/**
70 70
 	 * Constructor
71 71
 	 *
72
-	 * @param int $user=null account_id of user to use for acl, default current user
73 72
 	 */
74 73
 	function __construct($user=null)
75 74
 	{
@@ -765,7 +764,7 @@  discard block
 block discarded – undo
765 764
 	 *
766 765
 	 * Cornelius Weiss <[email protected]>
767 766
 	 * @param array $file array with key => value
768
-	 * @param int $resource_id
767
+	 * @param int $resouce_id
769 768
 	 * @return mixed string with msg if somthing went wrong; nothing if all right
770 769
 	 */
771 770
 	function save_picture($file,$resouce_id)
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 		}
359 359
 
360 360
 		// Check for restore of deleted, restore held links
361
-                if($old && $old['deleted'] && !$resource['deleted'])
362
-                {
363
-                        egw_link::restore('resources', $resource['res_id']);
364
-                }
361
+				if($old && $old['deleted'] && !$resource['deleted'])
362
+				{
363
+						egw_link::restore('resources', $resource['res_id']);
364
+				}
365 365
 
366 366
 		// delete old pictures
367 367
 		if($resource['picture_src'] != 'own_src')
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 						$list[$id] = ' ('.lang('conflict').') '.$resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
687 687
 					}
688 688
 				} else {
689
-				        $list[$id] = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
689
+						$list[$id] = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
690 690
 				}
691 691
 			}
692 692
 		} else {
Please login to merge, or discard this patch.
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param int $user=null account_id of user to use for acl, default current user
73 73
 	 */
74
-	function __construct($user=null)
74
+	function __construct($user = null)
75 75
 	{
76 76
 		$this->so = new resources_so();
77 77
 		$this->acl = CreateObject('resources.bo_acl', $user);
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 
80 80
 		$this->cal_right_transform = array(
81 81
 			EGW_ACL_CALREAD 	=> EGW_ACL_READ,
82
-			EGW_ACL_DIRECT_BOOKING 	=> EGW_ACL_READ | EGW_ACL_ADD | EGW_ACL_EDIT | EGW_ACL_DELETE,
83
-			EGW_ACL_CAT_ADMIN 	=> EGW_ACL_READ | EGW_ACL_ADD | EGW_ACL_EDIT | EGW_ACL_DELETE,
82
+			EGW_ACL_DIRECT_BOOKING 	=> EGW_ACL_READ|EGW_ACL_ADD|EGW_ACL_EDIT|EGW_ACL_DELETE,
83
+			EGW_ACL_CAT_ADMIN 	=> EGW_ACL_READ|EGW_ACL_ADD|EGW_ACL_EDIT|EGW_ACL_DELETE,
84 84
 		);
85 85
 	}
86 86
 
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * Cornelius Weiss <[email protected]>
91 91
 	 */
92
-	function get_rows($query,&$rows,&$readonlys)
92
+	function get_rows($query, &$rows, &$readonlys)
93 93
 	{
94
-		if(!$query['csv_export'])
94
+		if (!$query['csv_export'])
95 95
 		{
96
-			$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$query);
96
+			$GLOBALS['egw']->session->appsession('session_data', 'resources_index_nm', $query);
97 97
 		}
98 98
 		if ($query['store_state'])	// request to store state in session and filter in prefs?
99 99
 		{
100
-			egw_cache::setSession('resources',$query['store_state'],$query);
100
+			egw_cache::setSession('resources', $query['store_state'], $query);
101 101
 			//echo "<p>".__METHOD__."() query[filter]=$query[filter], prefs[resources][filter]={$GLOBALS['egw_info']['user']['preferences']['resources']['filter']}</p>\n";
102 102
 			if ($query['filter'] != $GLOBALS['egw_info']['user']['preferences']['resources']['filter'])
103 103
 			{
104
-				$GLOBALS['egw']->preferences->add('resources','filter',$query['filter'],'user');
104
+				$GLOBALS['egw']->preferences->add('resources', 'filter', $query['filter'], 'user');
105 105
 				$GLOBALS['egw']->preferences->save_repository();
106 106
 			}
107 107
 		}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		// Sub-query to get the count of accessories
116 116
 		$acc_join = "LEFT JOIN (SELECT accessory_of AS accessory_id, count(res_id) as acc_count FROM {$this->so->table_name} GROUP BY accessory_of) AS acc ON acc.accessory_id = {$this->so->table_name}.res_id ";
117 117
 
118
-		switch($query['filter2'])
118
+		switch ($query['filter2'])
119 119
 		{
120 120
 			case -1:
121 121
 				// Resources only
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 			default:
141 141
 				$filter['accessory_of'] = $query['filter2'];
142 142
 		}
143
-		if($query['filter2'] != self::DELETED)
143
+		if ($query['filter2'] != self::DELETED)
144 144
 		{
145 145
 			$filter['deleted'] = null;
146 146
 		}
147 147
 
148 148
 		if ($query['filter'])
149 149
 		{
150
-			if (($children = $this->acl->get_cats(EGW_ACL_READ,$query['filter'])))
150
+			if (($children = $this->acl->get_cats(EGW_ACL_READ, $query['filter'])))
151 151
 			{
152 152
 				$filter['cat_id'] = array_keys($children);
153 153
 				$filter['cat_id'][] = $query['filter'];
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		{
171 171
 			$filter['bookable'] = true;
172 172
 		}
173
-		$order_by = $query['order'] ? $query['order'].' '. $query['sort'] : '';
173
+		$order_by = $query['order'] ? $query['order'].' '.$query['sort'] : '';
174 174
 		$start = (int)$query['start'];
175 175
 
176 176
 		foreach ($filter as $k => $v) $query['col_filter'][$k] = $v;
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 		$nr = $this->so->total;
179 179
 
180 180
 		// we are called to serve bookable resources (e.g. calendar-dialog)
181
-		if($query['show_bookable'])
181
+		if ($query['show_bookable'])
182 182
 		{
183 183
 			// This is somehow ugly, i know...
184
-			foreach((array)$rows as $num => $resource)
184
+			foreach ((array)$rows as $num => $resource)
185 185
 			{
186 186
 				$rows[$num]['default_qty'] = 1;
187 187
 			}
@@ -190,24 +190,24 @@  discard block
 block discarded – undo
190 190
 		}
191 191
 
192 192
 		$config = config::read('resources');
193
-		foreach($rows as $num => &$resource)
193
+		foreach ($rows as $num => &$resource)
194 194
 		{
195
-			if (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_EDIT))
195
+			if (!$this->acl->is_permitted($resource['cat_id'], EGW_ACL_EDIT))
196 196
 			{
197 197
 				$readonlys["edit[$resource[res_id]]"] = true;
198 198
 			}
199
-			elseif($resource['deleted'])
199
+			elseif ($resource['deleted'])
200 200
 			{
201 201
 				$resource['class'] .= 'deleted ';
202 202
 			}
203
-			if (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_DELETE) ||
203
+			if (!$this->acl->is_permitted($resource['cat_id'], EGW_ACL_DELETE) ||
204 204
 				($resource['deleted'] && !$GLOBALS['egw_info']['user']['apps']['admin'] && $config['history'] == 'history')
205 205
 			)
206 206
 			{
207 207
 				$readonlys["delete[$resource[res_id]]"] = true;
208 208
 				$resource['class'] .= 'no_delete ';
209 209
 			}
210
-			if ((!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_ADD)) ||
210
+			if ((!$this->acl->is_permitted($resource['cat_id'], EGW_ACL_ADD)) ||
211 211
 				// Allow new accessory action when viewing accessories of a certain resource
212 212
 				$query['filter2'] <= 0 && $resource['accessory_of'] != -1)
213 213
 			{
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 				$resource['class'] .= 'no_book ';
222 222
 				$resource['class'] .= 'no_view_calendar ';
223 223
 			}
224
-			if(!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_CALREAD))
224
+			if (!$this->acl->is_permitted($resource['cat_id'], EGW_ACL_CALREAD))
225 225
 			{
226 226
 				$readonlys["calendar[$resource[res_id]]"] = true;
227 227
 				$resource['class'] .= 'no_view_calendar ';
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 				$resource['class'] .= 'no_buy ';
233 233
 			}
234 234
 			$readonlys["view_acc[{$resource['res_id']}]"] = ($resource['acc_count'] == 0);
235
-			$resource['class'] .= ($resource['accessory_of']==-1 ? 'resource ' : 'accessory ');
236
-			if($resource['acc_count'])
235
+			$resource['class'] .= ($resource['accessory_of'] == -1 ? 'resource ' : 'accessory ');
236
+			if ($resource['acc_count'])
237 237
 			{
238 238
 				$resource['class'] .= 'hasAccessories ';
239
-				$accessories = $this->get_acc_list($resource['res_id'],$query['filter2']==self::DELETED);
240
-				foreach($accessories as $acc_id => $acc_name)
239
+				$accessories = $this->get_acc_list($resource['res_id'], $query['filter2'] == self::DELETED);
240
+				foreach ($accessories as $acc_id => $acc_name)
241 241
 				{
242 242
 					$resource['accessories'][] = array('acc_id' => $acc_id, 'name' => $this->link_title($acc_id));
243 243
 				}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 				$resource['accessory_of_label'] = $this->link_title($resource['accessory_of']);
246 246
 			}
247 247
 
248
-			if($resource['deleted'])
248
+			if ($resource['deleted'])
249 249
 			{
250 250
 				$rows[$num]['picture_thumb'] = 'deleted';
251 251
 			}
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 			$rows[$num]['admin'] = $this->acl->get_cat_admin($resource['cat_id']);
267 267
 		}
268 268
 
269
-		if(!config::get_customfields('resources'))
269
+		if (!config::get_customfields('resources'))
270 270
 		{
271 271
 			$rows['no_customfields'] = true;
272 272
 		}
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
 	{
285 285
 		if (!($data = $this->so->read(array('res_id' => $res_id))))
286 286
 		{
287
-			return null;	// not found
287
+			return null; // not found
288 288
 		}
289
-		if (!$this->acl->is_permitted($data['cat_id'],EGW_ACL_READ))
289
+		if (!$this->acl->is_permitted($data['cat_id'], EGW_ACL_READ))
290 290
 		{
291
-			return false;	// permission denied
291
+			return false; // permission denied
292 292
 		}
293 293
 		return $data;
294 294
 	}
@@ -302,35 +302,35 @@  discard block
 block discarded – undo
302 302
 	 */
303 303
 	function save($resource)
304 304
 	{
305
-		if(!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_EDIT))
305
+		if (!$this->acl->is_permitted($resource['cat_id'], EGW_ACL_EDIT))
306 306
 		{
307 307
 			return lang('You are not permitted to edit this resource!');
308 308
 		}
309 309
 		$old = array();
310 310
 		// we need an id to save pictures and make links...
311
-		if(!$resource['res_id'])
311
+		if (!$resource['res_id'])
312 312
 		{
313 313
 			$resource['res_owner'] = $GLOBALS['egw_info']['user']['account_id'];
314
-			$resource['res_created'] = egw_time::server2user(time(),'ts');
314
+			$resource['res_created'] = egw_time::server2user(time(), 'ts');
315 315
 			$resource['res_id'] = $this->so->save($resource);
316 316
 		}
317 317
 		else
318 318
 		{
319 319
 			$resource['res_modifier'] = $GLOBALS['egw_info']['user']['account_id'];
320
-			$resource['res_modified'] = egw_time::server2user(time(),'ts');
320
+			$resource['res_modified'] = egw_time::server2user(time(), 'ts');
321 321
 			$old = $this->read($resource['res_id']);
322 322
 		}
323 323
 
324 324
 		switch ($resource['picture_src'])
325 325
 		{
326 326
 			case 'own_src':
327
-				if($resource['own_file']['size'] > 0)
327
+				if ($resource['own_file']['size'] > 0)
328 328
 				{
329
-					$msg = $this->save_picture($resource['own_file'],$resource['res_id']);
329
+					$msg = $this->save_picture($resource['own_file'], $resource['res_id']);
330 330
 					unset($resource['own_file']);
331 331
 					break;
332 332
 				}
333
-				elseif(@egw_vfs::stat('/apps/resources/'.$resource['res_id'].'/'.self::PICTURE_NAME))
333
+				elseif (@egw_vfs::stat('/apps/resources/'.$resource['res_id'].'/'.self::PICTURE_NAME))
334 334
 				{
335 335
 					break;
336 336
 				}
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
 				$resource['picture_src'] = 'gen_src';
342 342
 				break;
343 343
 			default:
344
-				if($resource['own_file']['size'] > 0)
344
+				if ($resource['own_file']['size'] > 0)
345 345
 				{
346 346
 					$resource['picture_src'] = 'own_src';
347
-					$msg = $this->save_picture($resource['own_file'],$resource['res_id']);
347
+					$msg = $this->save_picture($resource['own_file'], $resource['res_id']);
348 348
 				}
349 349
 				else
350 350
 				{
@@ -352,55 +352,55 @@  discard block
 block discarded – undo
352 352
 				}
353 353
 		}
354 354
 		// somthing went wrong on saving own picture
355
-		if($msg)
355
+		if ($msg)
356 356
 		{
357 357
 			return $msg;
358 358
 		}
359 359
 
360 360
 		// Check for restore of deleted, restore held links
361
-                if($old && $old['deleted'] && !$resource['deleted'])
361
+                if ($old && $old['deleted'] && !$resource['deleted'])
362 362
                 {
363 363
                         egw_link::restore('resources', $resource['res_id']);
364 364
                 }
365 365
 
366 366
 		// delete old pictures
367
-		if($resource['picture_src'] != 'own_src')
367
+		if ($resource['picture_src'] != 'own_src')
368 368
 		{
369 369
 			$this->remove_picture($resource['res_id']);
370 370
 		}
371 371
 
372 372
 		// Update link title
373
-		egw_link::notify_update('resources',$resource['res_id'], $resource);
373
+		egw_link::notify_update('resources', $resource['res_id'], $resource);
374 374
 		// save links
375
-		if(is_array($resource['link_to']['to_id']))
375
+		if (is_array($resource['link_to']['to_id']))
376 376
 		{
377
-			egw_link::link('resources',$resource['res_id'],$resource['link_to']['to_id']);
377
+			egw_link::link('resources', $resource['res_id'], $resource['link_to']['to_id']);
378 378
 		}
379
-		if($resource['accessory_of'] != $old['accessory_of'])
379
+		if ($resource['accessory_of'] != $old['accessory_of'])
380 380
 		{
381
-			egw_link::unlink(0,'resources',$resource['res_id'],'','resources',$old['accessory_of']);
381
+			egw_link::unlink(0, 'resources', $resource['res_id'], '', 'resources', $old['accessory_of']);
382 382
 
383 383
 			// Check for resource changing to accessory - move its accessories to resource
384
-			if($old['accessory_of'] == -1 && $accessories = $this->get_acc_list($resource['res_id']))
384
+			if ($old['accessory_of'] == -1 && $accessories = $this->get_acc_list($resource['res_id']))
385 385
 			{
386
-				foreach($accessories as $accessory => $name)
386
+				foreach ($accessories as $accessory => $name)
387 387
 				{
388
-					egw_link::unlink(0,'resources',$accessory,'','resources',$resource['res_id']);
388
+					egw_link::unlink(0, 'resources', $accessory, '', 'resources', $resource['res_id']);
389 389
 					$acc = $this->read($accessory);
390 390
 					$acc['accessory_of'] = -1;
391 391
 					$this->so->save($acc);
392 392
 				}
393 393
 			}
394 394
 		}
395
-		if($resource['accessory_of'] != -1)
395
+		if ($resource['accessory_of'] != -1)
396 396
 		{
397
-			egw_link::link('resources',$resource['res_id'],'resources',$resource['accessory_of']);
397
+			egw_link::link('resources', $resource['res_id'], 'resources', $resource['accessory_of']);
398 398
 		}
399 399
 
400
-		if(!empty($resource['res_id']) && $this->so->get_value("cat_id",$resource['res_id']) != $resource['cat_id'] && $resource['accessory_of'] == -1)
400
+		if (!empty($resource['res_id']) && $this->so->get_value("cat_id", $resource['res_id']) != $resource['cat_id'] && $resource['accessory_of'] == -1)
401 401
 		{
402 402
 			$accessories = $this->get_acc_list($resource['res_id']);
403
-			foreach($accessories as $accessory => $name)
403
+			foreach ($accessories as $accessory => $name)
404 404
 			{
405 405
 				$acc = $this->so->read($accessory);
406 406
 				$acc['cat_id'] = $resource['cat_id'];
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 		{
417 417
 			$this->tracking = new resources_tracking();
418 418
 		}
419
-		if ($this->tracking->track($resource,$old,$this->user) === false)
419
+		if ($this->tracking->track($resource, $old, $this->user) === false)
420 420
 		{
421
-			return implode(', ',$this->tracking->errors);
421
+			return implode(', ', $this->tracking->errors);
422 422
 		}
423 423
 
424 424
 		return $res_id ? $res_id : lang('Something went wrong by saving resource');
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	 */
433 433
 	function delete($res_id)
434 434
 	{
435
-		if(!$this->acl->is_permitted($this->so->get_value('cat_id',$res_id),EGW_ACL_DELETE))
435
+		if (!$this->acl->is_permitted($this->so->get_value('cat_id', $res_id), EGW_ACL_DELETE))
436 436
 		{
437 437
 			return lang('You are not permitted to delete this resource!');
438 438
 		}
@@ -444,17 +444,17 @@  discard block
 block discarded – undo
444 444
 		{
445 445
 			$old['deleted'] = time();
446 446
 			$this->save($old);
447
-			egw_link::unlink(0,'resources',$res_id,'','','',true);
447
+			egw_link::unlink(0, 'resources', $res_id, '', '', '', true);
448 448
 			$accessories = $this->get_acc_list($res_id);
449
-			foreach($accessories as $acc_id => $name)
449
+			foreach ($accessories as $acc_id => $name)
450 450
 			{
451 451
 				// Don't purge already deleted accessories
452 452
 				$acc = $this->read($acc_id);
453
-				if(!$acc['deleted'])
453
+				if (!$acc['deleted'])
454 454
 				{
455 455
 					$acc['deleted'] = time();
456 456
 					$this->save($acc);
457
-					egw_link::unlink(0,'resources',$acc_id,'','','',true);
457
+					egw_link::unlink(0, 'resources', $acc_id, '', '', '', true);
458 458
 				}
459 459
 			}
460 460
 			return false;
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
 		elseif ($this->so->delete(array('res_id'=>$res_id)))
463 463
 		{
464 464
 			$accessories = $this->get_acc_list($res_id, true);
465
-			foreach($accessories as $acc_id => $name)
465
+			foreach ($accessories as $acc_id => $name)
466 466
 			{
467
-				if($this->delete($acc_id))
467
+				if ($this->delete($acc_id))
468 468
 				{
469 469
 					$acc = $this->read($acc_id);
470 470
 					$acc['accessory_of'] = -1;
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
 				}
473 473
 			};
474 474
 			$this->remove_picture($res_id);
475
-	 		egw_link::unlink(0,'resources',$res_id);
475
+	 		egw_link::unlink(0, 'resources', $res_id);
476 476
 	 		// delete the resource from the calendar
477
-	 		ExecMethod('calendar.calendar_so.deleteaccount','r'.$res_id);
477
+	 		ExecMethod('calendar.calendar_so.deleteaccount', 'r'.$res_id);
478 478
 	 		return false;
479 479
 		}
480 480
 		return lang('Something went wrong by deleting resource');
@@ -488,15 +488,15 @@  discard block
 block discarded – undo
488 488
 	 * @param boolean $deleted Include deleted accessories
489 489
 	 * @return array
490 490
 	 */
491
-	function get_acc_list($res_id,$deleted=false)
491
+	function get_acc_list($res_id, $deleted = false)
492 492
 	{
493
-		if($res_id < 1){return;}
494
-		$data = $this->so->search('','res_id,name,deleted','','','','','',$start,array('accessory_of' => $res_id),'',$need_full_no_count=true);
493
+		if ($res_id < 1) {return; }
494
+		$data = $this->so->search('', 'res_id,name,deleted', '', '', '', '', '', $start, array('accessory_of' => $res_id), '', $need_full_no_count = true);
495 495
 		$acc_list = array();
496
-		if($data) {
497
-			foreach($data as $num => $resource)
496
+		if ($data) {
497
+			foreach ($data as $num => $resource)
498 498
 			{
499
-				if($resource['deleted'] && !$deleted) continue;
499
+				if ($resource['deleted'] && !$deleted) continue;
500 500
 				$acc_list[$resource['res_id']] = $resource['name'];
501 501
 			}
502 502
 		}
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
 	function get_calendar_info($res_id)
513 513
 	{
514 514
 		//echo "<p>resources_bo::get_calendar_info(".print_r($res_id,true).")</p>\n";
515
-		if(!is_array($res_id) && $res_id < 1) return;
515
+		if (!is_array($res_id) && $res_id < 1) return;
516 516
 
517
-		$data = $this->so->search(array('res_id' => $res_id),self::TITLE_COLS.',useable');
517
+		$data = $this->so->search(array('res_id' => $res_id), self::TITLE_COLS.',useable');
518 518
 		if (!is_array($data))
519 519
 		{
520 520
 			error_log(__METHOD__." No Calendar Data found for Resource with id $res_id");
521 521
 			return array();
522 522
 		}
523
-		foreach($data as $num => &$resource)
523
+		foreach ($data as $num => &$resource)
524 524
 		{
525 525
 			$resource['rights'] = false;
526
-			foreach($this->cal_right_transform as $res_right => $cal_right)
526
+			foreach ($this->cal_right_transform as $res_right => $cal_right)
527 527
 			{
528
-				if($this->acl->is_permitted($resource['cat_id'],$res_right))
528
+				if ($this->acl->is_permitted($resource['cat_id'], $res_right))
529 529
 				{
530 530
 					$resource['rights'] = $cal_right;
531 531
 				}
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 			$resource['responsible'] = $this->acl->get_cat_admin($resource['cat_id']);
534 534
 
535 535
 			// preseed the cache
536
-			egw_link::set_cache('resources',$resource['res_id'],$t=$this->link_title($resource));
536
+			egw_link::set_cache('resources', $resource['res_id'], $t = $this->link_title($resource));
537 537
 		}
538 538
 		return $data;
539 539
 	}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		{
551 551
 			return false;
552 552
 		}
553
-		return $this->acl->is_permitted($data['cat_id'],EGW_ACL_DIRECT_BOOKING) ? A : U;
553
+		return $this->acl->is_permitted($data['cat_id'], EGW_ACL_DIRECT_BOOKING) ? A : U;
554 554
 	}
555 555
 
556 556
 	/**
@@ -562,11 +562,11 @@  discard block
 block discarded – undo
562 562
 	 * @param array $options Array of options for the search
563 563
 	 *
564 564
 	 */
565
-	function link_query( $pattern, Array &$options = array() )
565
+	function link_query($pattern, Array &$options = array())
566 566
 	{
567 567
 		if (is_array($pattern))
568 568
 		{
569
-			$criteria =array('name' => $pattern['search']
569
+			$criteria = array('name' => $pattern['search']
570 570
 					,'short_description' => $pattern['search']);
571 571
 		}
572 572
 		else
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 		$only_keys = 'res_id,name,short_description,bookable,useable';
578 578
 
579 579
 		// If no read access to any category, just stop
580
-		if(!$this->acl->get_cats(EGW_ACL_READ))
580
+		if (!$this->acl->get_cats(EGW_ACL_READ))
581 581
 		{
582 582
 			$options['total'] = 0;
583 583
 			return array();
@@ -588,31 +588,31 @@  discard block
 block discarded – undo
588 588
 			'deleted' => null
589 589
 		);
590 590
 		$limit = false;
591
-		if($options['start'] || $options['num_rows']) {
591
+		if ($options['start'] || $options['num_rows']) {
592 592
 			$limit = array($options['start'], $options['num_rows']);
593 593
 		}
594
-		if($options['accessory_of'])
594
+		if ($options['accessory_of'])
595 595
 		{
596 596
 			$filter['accessory_of'] = $options['accessory_of'];
597 597
 		}
598
-		$data = $this->so->search($criteria,$only_keys,$order_by='name',$extra_cols='',$wildcard='%',$empty,$op='OR',$limit,$filter);
598
+		$data = $this->so->search($criteria, $only_keys, $order_by = 'name', $extra_cols = '', $wildcard = '%', $empty, $op = 'OR', $limit, $filter);
599 599
 		// maybe we need to check disponibility of the searched resources in the calendar if $pattern ['exec'] contains some extra args
600
-		$show_conflict=False;
600
+		$show_conflict = False;
601 601
 		if ($options['exec'])
602 602
 		{
603 603
 			// we'll use a cache for resources info taken from database
604 604
 			static $res_info_cache = array();
605
-			$cal_info=$options['exec'];
606
-			if ( isset($cal_info['start']) && isset($cal_info['duration']))
605
+			$cal_info = $options['exec'];
606
+			if (isset($cal_info['start']) && isset($cal_info['duration']))
607 607
 			{
608 608
 				//get a calendar objet for reservations
609
-				if ( (!isset($this->bocal)) || !(is_object($this->bocal)))
609
+				if ((!isset($this->bocal)) || !(is_object($this->bocal)))
610 610
 				{
611 611
 					require_once(EGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_bo.inc.php');
612
-					$this->bocal =& CreateObject('calendar.calendar_bo');
612
+					$this->bocal = & CreateObject('calendar.calendar_bo');
613 613
 				}
614 614
 				$start = new egw_time($cal_info['start']);
615
-				$startarr= getdate($start->format('ts'));
615
+				$startarr = getdate($start->format('ts'));
616 616
 				if (isset($cal_info['whole_day'])) {
617 617
 					$startarr['hour'] = $startarr['minute'] = 0;
618 618
 					$start = new egw_time($startarr);
@@ -623,39 +623,39 @@  discard block
 block discarded – undo
623 623
 				}
624 624
 
625 625
 				// search events matching our timestamps
626
- 				$resource_list=array();
627
-				foreach($data as $num => $resource)
626
+ 				$resource_list = array();
627
+				foreach ($data as $num => $resource)
628 628
 				{
629 629
 					// we only need resources id for the search, but with a 'r' prefix
630 630
 					// now we take this loop to store a new resource array indexed with resource id
631 631
 					// and as we work for calendar we use only bookable resources
632
-					if ((isset($resource['bookable'])) && ($resource['bookable'])){
633
-						$res_info_cache[$resource['res_id']]=$resource;
634
-						$resource_list[]='r'.$resource['res_id'];
632
+					if ((isset($resource['bookable'])) && ($resource['bookable'])) {
633
+						$res_info_cache[$resource['res_id']] = $resource;
634
+						$resource_list[] = 'r'.$resource['res_id'];
635 635
 					}
636 636
 				}
637
-				$overlapping_events =& $this->bocal->search(array(
637
+				$overlapping_events = & $this->bocal->search(array(
638 638
 					'start' => $start,
639 639
 					'end'   => $end,
640 640
 					'users' => $resource_list,
641
-					'ignore_acl' => true,   // otherwise we get only events readable by the user
642
-					'enum_groups' => false,  // otherwise group-events would not block time
641
+					'ignore_acl' => true, // otherwise we get only events readable by the user
642
+					'enum_groups' => false, // otherwise group-events would not block time
643 643
 				));
644 644
 
645 645
 				// parse theses overlapping events
646
-				foreach($overlapping_events as $event)
646
+				foreach ($overlapping_events as $event)
647 647
 				{
648 648
 					if ($event['non_blocking']) continue; // ignore non_blocking events
649
-					if (isset($cal_info['event_id']) && $event['id']==$cal_info['event_id']) {
649
+					if (isset($cal_info['event_id']) && $event['id'] == $cal_info['event_id']) {
650 650
 						continue; //ignore this event, it's the current edited event, no conflict by def
651 651
 					}
652 652
 					// now we are interested only on resources booked by theses events
653
-					if (isset($event['participants']) && is_array($event['participants'])){
654
-						foreach($event['participants'] as $part_key => $part_detail){
655
-							if ($part_key{0}=='r')
653
+					if (isset($event['participants']) && is_array($event['participants'])) {
654
+						foreach ($event['participants'] as $part_key => $part_detail) {
655
+							if ($part_key{0} == 'r')
656 656
 							{ //now we gatta resource here
657 657
 								//need to check the quantity of this resource
658
-								$resource_id=substr($part_key,1);
658
+								$resource_id = substr($part_key, 1);
659 659
 								// if we do not find this resource in our indexed array it's certainly
660 660
 								// because it was unset, non bookable maybe
661 661
 								if (!isset($res_info_cache[$resource_id])) continue;
@@ -675,27 +675,27 @@  discard block
 block discarded – undo
675 675
 			}
676 676
 		}
677 677
 		if (isset($res_info_cache)) {
678
-			$show_conflict= (isset($options['exec']['show_conflict'])&& ($options['exec']['show_conflict']=='0'))? False:True;
678
+			$show_conflict = (isset($options['exec']['show_conflict']) && ($options['exec']['show_conflict'] == '0')) ? False : True;
679 679
 			// if we have this array indexed on resource id it means non-bookable resource are removed and we are working for calendar
680 680
 			// so we'll loop on this one and not $data
681
-			foreach($res_info_cache as $id => $resource) {
681
+			foreach ($res_info_cache as $id => $resource) {
682 682
 				//maybe this resource is reserved
683
-				if ( ($resource['useable'] < 1) )
683
+				if (($resource['useable'] < 1))
684 684
 				{
685
-					if($show_conflict) {
686
-						$list[$id] = ' ('.lang('conflict').') '.$resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
685
+					if ($show_conflict) {
686
+						$list[$id] = ' ('.lang('conflict').') '.$resource['name'].($resource['short_description'] ? ', ['.$resource['short_description'].']' : '');
687 687
 					}
688 688
 				} else {
689
-				        $list[$id] = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
689
+				        $list[$id] = $resource['name'].($resource['short_description'] ? ', ['.$resource['short_description'].']' : '');
690 690
 				}
691 691
 			}
692 692
 		} else {
693 693
 			// we are not working for the calendar, we loop on the initial $data
694 694
 			if (is_array($data)) {
695
-				foreach($data as $num => $resource)
695
+				foreach ($data as $num => $resource)
696 696
 				{
697
-					$id=$resource['res_id'];
698
-					$list[$id] = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
697
+					$id = $resource['res_id'];
698
+					$list[$id] = $resource['name'].($resource['short_description'] ? ', ['.$resource['short_description'].']' : '');
699 699
 				}
700 700
 			} else {
701 701
 				error_log(__METHOD__." No Data found for Resource with id ".$resource['res_id']);
@@ -712,17 +712,17 @@  discard block
 block discarded – undo
712 712
 	 * @param int|array $resource
713 713
 	 * @return string|boolean string with title, null if resource does not exist or false if no perms to view it
714 714
 	 */
715
-	function link_title( $resource )
715
+	function link_title($resource)
716 716
 	{
717 717
 		if (!is_array($resource))
718 718
 		{
719
-			if (!($resource  = $this->read(array('res_id' => $resource)))) return $resource;
719
+			if (!($resource = $this->read(array('res_id' => $resource)))) return $resource;
720 720
 		}
721
-		elseif (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_READ))
721
+		elseif (!$this->acl->is_permitted($resource['cat_id'], EGW_ACL_READ))
722 722
 		{
723 723
 			return false;
724 724
 		}
725
-		return $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
725
+		return $resource['name'].($resource['short_description'] ? ', ['.$resource['short_description'].']' : '');
726 726
 	}
727 727
 
728 728
 	/**
@@ -742,15 +742,15 @@  discard block
 block discarded – undo
742 742
 	function link_titles(array $ids)
743 743
 	{
744 744
 		$titles = array();
745
-		if (($resources =& $this->so->search(array('res_id' => $ids),self::TITLE_COLS)))
745
+		if (($resources = & $this->so->search(array('res_id' => $ids), self::TITLE_COLS)))
746 746
 		{
747
-			foreach($resources as $resource)
747
+			foreach ($resources as $resource)
748 748
 			{
749 749
 				$titles[$resource['res_id']] = $this->link_title($resource);
750 750
 			}
751 751
 		}
752 752
 		// we assume all not returned contacts are not readable for the user (as we report all deleted contacts to egw_link)
753
-		foreach($ids as $id)
753
+		foreach ($ids as $id)
754 754
 		{
755 755
 			if (!isset($titles[$id]))
756 756
 			{
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
 	 * @param int $resource_id
769 769
 	 * @return mixed string with msg if somthing went wrong; nothing if all right
770 770
 	 */
771
-	function save_picture($file,$resouce_id)
771
+	function save_picture($file, $resouce_id)
772 772
 	{
773
-		switch($file['type'])
773
+		switch ($file['type'])
774 774
 		{
775 775
 			case 'image/gif':
776 776
 				$src_img = imagecreatefromgif($file['tmp_name']);
@@ -787,11 +787,11 @@  discard block
 block discarded – undo
787 787
 				return lang('Picture type is not supported, sorry!');
788 788
 		}
789 789
 
790
-		$tmp_name = tempnam($GLOBALS['egw_info']['server']['temp_dir'],'resources-picture');
791
-		imagejpeg($src_img,$tmp_name);
790
+		$tmp_name = tempnam($GLOBALS['egw_info']['server']['temp_dir'], 'resources-picture');
791
+		imagejpeg($src_img, $tmp_name);
792 792
 		imagedestroy($src_img);
793 793
 
794
-		egw_link::attach_file('resources',$resouce_id,array(
794
+		egw_link::attach_file('resources', $resouce_id, array(
795 795
 			'tmp_name' => $tmp_name,
796 796
 			'name'     => self::PICTURE_NAME,
797 797
 			'type'     => 'image/jpeg',
@@ -805,14 +805,14 @@  discard block
 block discarded – undo
805 805
 	 * @param bool $fullsize false = thumb, true = full pic
806 806
 	 * @return string url of picture
807 807
 	 */
808
-	function get_picture($resource,$fullsize=false)
808
+	function get_picture($resource, $fullsize = false)
809 809
 	{
810 810
 		if ($resource && !is_array($resource)) $resource = $this->read($resource);
811 811
 
812
-		switch($resource['picture_src'])
812
+		switch ($resource['picture_src'])
813 813
 		{
814 814
 			case 'own_src':
815
-				$picture = egw_link::vfs_path('resources',$resource['res_id'],self::PICTURE_NAME,true);	// vfs path
815
+				$picture = egw_link::vfs_path('resources', $resource['res_id'], self::PICTURE_NAME, true); // vfs path
816 816
 				if ($fullsize)
817 817
 				{
818 818
 					$picture = egw::link(egw_vfs::download_url($picture));
@@ -828,17 +828,17 @@  discard block
 block discarded – undo
828 828
 			case 'cat_src':
829 829
 				list($picture) = $this->cats->return_single($resource['cat_id']);
830 830
 				$picture = unserialize($picture['data']);
831
-				if($picture['icon'])
831
+				if ($picture['icon'])
832 832
 				{
833
-					$picture = !$fullsize?$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/images/'.$picture['icon']:'/phpgwapi/images/'.$picture['icon'];
833
+					$picture = !$fullsize ? $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/images/'.$picture['icon'] : '/phpgwapi/images/'.$picture['icon'];
834 834
 					break;
835 835
 				}
836 836
 				// fall through
837 837
 			case 'gen_src':
838 838
 			default :
839 839
 				$src = $resource['picture_src'];
840
-				$picture = !$fullsize?$GLOBALS['egw_info']['server']['webserver_url'].$this->resource_icons:$this->resource_icons;
841
-				$picture .= strpos($src,'.') !== false ? $src : 'generic.png';
840
+				$picture = !$fullsize ? $GLOBALS['egw_info']['server']['webserver_url'].$this->resource_icons : $this->resource_icons;
841
+				$picture .= strpos($src, '.') !== false ? $src : 'generic.png';
842 842
 		}
843 843
 		return $picture;
844 844
 	}
@@ -852,9 +852,9 @@  discard block
 block discarded – undo
852 852
 	 */
853 853
 	function remove_picture($res_id)
854 854
 	{
855
-		if (($arr = egw_link::delete_attached('resources',$res_id,self::PICTURE_NAME)) && is_array($arr))
855
+		if (($arr = egw_link::delete_attached('resources', $res_id, self::PICTURE_NAME)) && is_array($arr))
856 856
 		{
857
-			return array_shift($arr);	// $arr = array($path => (bool)$ok);
857
+			return array_shift($arr); // $arr = array($path => (bool)$ok);
858 858
 		}
859 859
 		return false;
860 860
 	}
@@ -870,11 +870,11 @@  discard block
 block discarded – undo
870 870
 	{
871 871
 		$icons['generic.png'] = lang('gernal resource');
872 872
 		$dir = dir(EGW_SERVER_ROOT.$this->resource_icons);
873
-		while($file = $dir->read())
873
+		while ($file = $dir->read())
874 874
 		{
875
-			if (preg_match('/\\.(png|gif|jpe?g)$/i',$file) && $file != 'generic.png')
875
+			if (preg_match('/\\.(png|gif|jpe?g)$/i', $file) && $file != 'generic.png')
876 876
 			{
877
-				$icons[$file] = substr($file,0,strpos($file,'.'));
877
+				$icons[$file] = substr($file, 0, strpos($file, '.'));
878 878
 			}
879 879
 		}
880 880
 		$dir->close();
Please login to merge, or discard this patch.
Braces   +84 added lines, -31 removed lines patch added patch discarded remove patch
@@ -95,9 +95,12 @@  discard block
 block discarded – undo
95 95
 		{
96 96
 			$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$query);
97 97
 		}
98
-		if ($query['store_state'])	// request to store state in session and filter in prefs?
98
+		if ($query['store_state'])
99
+		{
100
+			// request to store state in session and filter in prefs?
99 101
 		{
100 102
 			egw_cache::setSession('resources',$query['store_state'],$query);
103
+		}
101 104
 			//echo "<p>".__METHOD__."() query[filter]=$query[filter], prefs[resources][filter]={$GLOBALS['egw_info']['user']['preferences']['resources']['filter']}</p>\n";
102 105
 			if ($query['filter'] != $GLOBALS['egw_info']['user']['preferences']['resources']['filter'])
103 106
 			{
@@ -105,7 +108,10 @@  discard block
 block discarded – undo
105 108
 				$GLOBALS['egw']->preferences->save_repository();
106 109
 			}
107 110
 		}
108
-		if ($this->debug) _debug_array($query);
111
+		if ($this->debug)
112
+		{
113
+			_debug_array($query);
114
+		}
109 115
 		$read_onlys = 'res_id,name,short_description,quantity,useable,bookable,buyable,cat_id,location,storage_info';
110 116
 
111 117
 		$filter = array();
@@ -162,7 +168,8 @@  discard block
 block discarded – undo
162 168
 			$filter['cat_id'] = array_keys($readcats);
163 169
 		}
164 170
 		// if there is no catfilter -> this means you have no rights, so set the cat filter to null
165
-		if (!isset($filter['cat_id']) || empty($filter['cat_id'])) {
171
+		if (!isset($filter['cat_id']) || empty($filter['cat_id']))
172
+		{
166 173
 			$filter['cat_id'] = NUll;
167 174
 		}
168 175
 
@@ -173,7 +180,10 @@  discard block
 block discarded – undo
173 180
 		$order_by = $query['order'] ? $query['order'].' '. $query['sort'] : '';
174 181
 		$start = (int)$query['start'];
175 182
 
176
-		foreach ($filter as $k => $v) $query['col_filter'][$k] = $v;
183
+		foreach ($filter as $k => $v)
184
+		{
185
+			$query['col_filter'][$k] = $v;
186
+		}
177 187
 		$this->so->get_rows($query, $rows, $readonlys, $join, false, false, $extra_cols);
178 188
 		$nr = $this->so->total;
179 189
 
@@ -202,8 +212,7 @@  discard block
 block discarded – undo
202 212
 			}
203 213
 			if (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_DELETE) ||
204 214
 				($resource['deleted'] && !$GLOBALS['egw_info']['user']['apps']['admin'] && $config['history'] == 'history')
205
-			)
206
-			{
215
+			) {
207 216
 				$readonlys["delete[$resource[res_id]]"] = true;
208 217
 				$resource['class'] .= 'no_delete ';
209 218
 			}
@@ -241,7 +250,9 @@  discard block
 block discarded – undo
241 250
 				{
242 251
 					$resource['accessories'][] = array('acc_id' => $acc_id, 'name' => $this->link_title($acc_id));
243 252
 				}
244
-			} elseif ($resource['accessory_of'] > 0) {
253
+			}
254
+			elseif ($resource['accessory_of'] > 0)
255
+			{
245 256
 				$resource['accessory_of_label'] = $this->link_title($resource['accessory_of']);
246 257
 			}
247 258
 
@@ -490,13 +501,19 @@  discard block
 block discarded – undo
490 501
 	 */
491 502
 	function get_acc_list($res_id,$deleted=false)
492 503
 	{
493
-		if($res_id < 1){return;}
504
+		if($res_id < 1)
505
+		{
506
+return;}
494 507
 		$data = $this->so->search('','res_id,name,deleted','','','','','',$start,array('accessory_of' => $res_id),'',$need_full_no_count=true);
495 508
 		$acc_list = array();
496
-		if($data) {
509
+		if($data)
510
+		{
497 511
 			foreach($data as $num => $resource)
498 512
 			{
499
-				if($resource['deleted'] && !$deleted) continue;
513
+				if($resource['deleted'] && !$deleted)
514
+				{
515
+					continue;
516
+				}
500 517
 				$acc_list[$resource['res_id']] = $resource['name'];
501 518
 			}
502 519
 		}
@@ -512,7 +529,10 @@  discard block
 block discarded – undo
512 529
 	function get_calendar_info($res_id)
513 530
 	{
514 531
 		//echo "<p>resources_bo::get_calendar_info(".print_r($res_id,true).")</p>\n";
515
-		if(!is_array($res_id) && $res_id < 1) return;
532
+		if(!is_array($res_id) && $res_id < 1)
533
+		{
534
+			return;
535
+		}
516 536
 
517 537
 		$data = $this->so->search(array('res_id' => $res_id),self::TITLE_COLS.',useable');
518 538
 		if (!is_array($data))
@@ -588,7 +608,8 @@  discard block
 block discarded – undo
588 608
 			'deleted' => null
589 609
 		);
590 610
 		$limit = false;
591
-		if($options['start'] || $options['num_rows']) {
611
+		if($options['start'] || $options['num_rows'])
612
+		{
592 613
 			$limit = array($options['start'], $options['num_rows']);
593 614
 		}
594 615
 		if($options['accessory_of'])
@@ -613,11 +634,14 @@  discard block
 block discarded – undo
613 634
 				}
614 635
 				$start = new egw_time($cal_info['start']);
615 636
 				$startarr= getdate($start->format('ts'));
616
-				if (isset($cal_info['whole_day'])) {
637
+				if (isset($cal_info['whole_day']))
638
+				{
617 639
 					$startarr['hour'] = $startarr['minute'] = 0;
618 640
 					$start = new egw_time($startarr);
619 641
 					$end = $start->format('ts') + 86399;
620
-				} else {
642
+				}
643
+				else
644
+				{
621 645
 					$start = $start->format('ts');
622 646
 					$end = $start + ($cal_info['duration']);
623 647
 				}
@@ -629,7 +653,8 @@  discard block
 block discarded – undo
629 653
 					// we only need resources id for the search, but with a 'r' prefix
630 654
 					// now we take this loop to store a new resource array indexed with resource id
631 655
 					// and as we work for calendar we use only bookable resources
632
-					if ((isset($resource['bookable'])) && ($resource['bookable'])){
656
+					if ((isset($resource['bookable'])) && ($resource['bookable']))
657
+					{
633 658
 						$res_info_cache[$resource['res_id']]=$resource;
634 659
 						$resource_list[]='r'.$resource['res_id'];
635 660
 					}
@@ -645,22 +670,34 @@  discard block
 block discarded – undo
645 670
 				// parse theses overlapping events
646 671
 				foreach($overlapping_events as $event)
647 672
 				{
648
-					if ($event['non_blocking']) continue; // ignore non_blocking events
649
-					if (isset($cal_info['event_id']) && $event['id']==$cal_info['event_id']) {
673
+					if ($event['non_blocking'])
674
+					{
675
+						continue;
676
+					}
677
+					// ignore non_blocking events
678
+					if (isset($cal_info['event_id']) && $event['id']==$cal_info['event_id'])
679
+					{
650 680
 						continue; //ignore this event, it's the current edited event, no conflict by def
651 681
 					}
652 682
 					// now we are interested only on resources booked by theses events
653
-					if (isset($event['participants']) && is_array($event['participants'])){
654
-						foreach($event['participants'] as $part_key => $part_detail){
683
+					if (isset($event['participants']) && is_array($event['participants']))
684
+					{
685
+						foreach($event['participants'] as $part_key => $part_detail)
686
+						{
655 687
 							if ($part_key{0}=='r')
656
-							{ //now we gatta resource here
688
+							{
689
+//now we gatta resource here
657 690
 								//need to check the quantity of this resource
658 691
 								$resource_id=substr($part_key,1);
659 692
 								// if we do not find this resource in our indexed array it's certainly
660 693
 								// because it was unset, non bookable maybe
661
-								if (!isset($res_info_cache[$resource_id])) continue;
694
+								if (!isset($res_info_cache[$resource_id]))
695
+								{
696
+									continue;
697
+								}
662 698
 								// to detect ressources with default to 1 quantity
663
-								if (!isset($res_info_cache[$resource_id]['useable'])) {
699
+								if (!isset($res_info_cache[$resource_id]['useable']))
700
+								{
664 701
 									$res_info_cache[$resource_id]['useable'] = 1;
665 702
 								}
666 703
 								// now decrement this quantity useable
@@ -674,30 +711,40 @@  discard block
 block discarded – undo
674 711
 				}
675 712
 			}
676 713
 		}
677
-		if (isset($res_info_cache)) {
714
+		if (isset($res_info_cache))
715
+		{
678 716
 			$show_conflict= (isset($options['exec']['show_conflict'])&& ($options['exec']['show_conflict']=='0'))? False:True;
679 717
 			// if we have this array indexed on resource id it means non-bookable resource are removed and we are working for calendar
680 718
 			// so we'll loop on this one and not $data
681
-			foreach($res_info_cache as $id => $resource) {
719
+			foreach($res_info_cache as $id => $resource)
720
+			{
682 721
 				//maybe this resource is reserved
683 722
 				if ( ($resource['useable'] < 1) )
684 723
 				{
685
-					if($show_conflict) {
724
+					if($show_conflict)
725
+					{
686 726
 						$list[$id] = ' ('.lang('conflict').') '.$resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
687 727
 					}
688
-				} else {
728
+				}
729
+				else
730
+				{
689 731
 				        $list[$id] = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
690 732
 				}
691 733
 			}
692
-		} else {
734
+		}
735
+		else
736
+		{
693 737
 			// we are not working for the calendar, we loop on the initial $data
694
-			if (is_array($data)) {
738
+			if (is_array($data))
739
+			{
695 740
 				foreach($data as $num => $resource)
696 741
 				{
697 742
 					$id=$resource['res_id'];
698 743
 					$list[$id] = $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':'');
699 744
 				}
700
-			} else {
745
+			}
746
+			else
747
+			{
701 748
 				error_log(__METHOD__." No Data found for Resource with id ".$resource['res_id']);
702 749
 			}
703 750
 		}
@@ -716,7 +763,10 @@  discard block
 block discarded – undo
716 763
 	{
717 764
 		if (!is_array($resource))
718 765
 		{
719
-			if (!($resource  = $this->read(array('res_id' => $resource)))) return $resource;
766
+			if (!($resource  = $this->read(array('res_id' => $resource))))
767
+			{
768
+				return $resource;
769
+			}
720 770
 		}
721 771
 		elseif (!$this->acl->is_permitted($resource['cat_id'],EGW_ACL_READ))
722 772
 		{
@@ -807,7 +857,10 @@  discard block
 block discarded – undo
807 857
 	 */
808 858
 	function get_picture($resource,$fullsize=false)
809 859
 	{
810
-		if ($resource && !is_array($resource)) $resource = $this->read($resource);
860
+		if ($resource && !is_array($resource))
861
+		{
862
+			$resource = $this->read($resource);
863
+		}
811 864
 
812 865
 		switch($resource['picture_src'])
813 866
 		{
Please login to merge, or discard this patch.
resources/inc/class.resources_hooks.inc.php 3 patches
Braces   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,11 @@  discard block
 block discarded – undo
119 119
 	{
120 120
 		$cat = Api\Categories::read($args['cat_id']);
121 121
 
122
-		if(!$cat) return; // Can't find current cat?
122
+		if(!$cat)
123
+		{
124
+			return;
125
+		}
126
+		// Can't find current cat?
123 127
 
124 128
 		if($cat['parent'] == 0)
125 129
 		{
@@ -134,7 +138,8 @@  discard block
 block discarded – undo
134 138
 			{
135 139
 				// Default missing, look for 'No category'
136 140
 				$new_cat_id = $categories->name2id('No category');
137
-				if($new_cat_id == 0) {
141
+				if($new_cat_id == 0)
142
+				{
138 143
 					// No category not there, add it
139 144
 					$new_cat_id = $categories->add(array(
140 145
 						'name'		=> 'No category',
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 {
20 20
 	function admin_prefs_sidebox($args)
21 21
 	{
22
-		$this->acl =& CreateObject('resources.bo_acl');
22
+		$this->acl = & CreateObject('resources.bo_acl');
23 23
 
24 24
 		$appname = 'resources';
25 25
 		$location = is_array($args) ? $args['location'] : $args;
@@ -31,25 +31,25 @@  discard block
 block discarded – undo
31 31
 
32 32
 			$title = $GLOBALS['egw_info']['apps']['resources']['title'].' '.lang('Menu');
33 33
 			$file = array(
34
-				'Resources list' => egw::link('/index.php',array(
34
+				'Resources list' => egw::link('/index.php', array(
35 35
 				'menuaction' => 'resources.resources_ui.index',
36 36
 				'ajax' => 'true')),
37 37
 			);
38
-			if($this->acl->get_cats(EGW_ACL_ADD))
38
+			if ($this->acl->get_cats(EGW_ACL_ADD))
39 39
 			{
40
-				$file['Add resource'] = "javascript:egw_openWindowCentered2('".egw::link('/index.php',array(
40
+				$file['Add resource'] = "javascript:egw_openWindowCentered2('".egw::link('/index.php', array(
41 41
 						'menuaction' => 'resources.resources_ui.edit',
42 42
 						'accessory_of' => -1
43
-					),false)."','_blank',800,600,'yes')";
43
+					), false)."','_blank',800,600,'yes')";
44 44
 			}
45
-			display_sidebox($appname,$title,$file);
45
+			display_sidebox($appname, $title, $file);
46 46
 		}
47 47
 
48 48
 		if ($GLOBALS['egw_info']['user']['apps']['admin'])
49 49
 		{
50 50
 			$file = Array(
51
-				'Site Configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
52
-				'Global Categories'  => egw::link('/index.php',array(
51
+				'Site Configuration' => egw::link('/index.php', 'menuaction=admin.uiconfig.index&appname='.$appname),
52
+				'Global Categories'  => egw::link('/index.php', array(
53 53
 					'menuaction' => 'admin.admin_categories.index',
54 54
 					'appname'    => $appname,
55 55
 					'global_cats'=> true)),
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 			);
61 61
 			if ($location == 'admin')
62 62
 			{
63
-				display_section($appname,$file);
63
+				display_section($appname, $file);
64 64
 			}
65 65
 			else
66 66
 			{
67
-				display_sidebox($appname,lang('Admin'),$file);
67
+				display_sidebox($appname, lang('Admin'), $file);
68 68
 			}
69 69
 		}
70 70
 	}
@@ -87,19 +87,19 @@  discard block
 block discarded – undo
87 87
 			'add_app'    => 'link_app',
88 88
 			'add_id'     => 'link_id',
89 89
 			'add_popup'  => '800x600',
90
-			'find_extra' => array('name_preg' => '/^(?(?=^.picture.jpg$)|.+)$/'),	// remove pictures from regular attachment list
90
+			'find_extra' => array('name_preg' => '/^(?(?=^.picture.jpg$)|.+)$/'), // remove pictures from regular attachment list
91 91
 		);
92 92
 	}
93 93
 
94 94
 	function calendar_resources($args)
95 95
 	{
96 96
 		return array(
97
-			'widget' => 'resources_select',// widget to use for the selection of resources
98
-			'info' => 'resources.resources_bo.get_calendar_info',// info method, returns array with id, type & name for a given id
99
-			'max_quantity' => 'useable',// if set, key for max. quantity in array returned by info method
100
-			'new_status' => 'resources.resources_bo.get_calendar_new_status',// method returning the status for new items, else 'U' is used
101
-			'type' => 'r',// one char type-identifiy for this resources
102
-			'icon' => 'calicon',//icon
97
+			'widget' => 'resources_select', // widget to use for the selection of resources
98
+			'info' => 'resources.resources_bo.get_calendar_info', // info method, returns array with id, type & name for a given id
99
+			'max_quantity' => 'useable', // if set, key for max. quantity in array returned by info method
100
+			'new_status' => 'resources.resources_bo.get_calendar_new_status', // method returning the status for new items, else 'U' is used
101
+			'type' => 'r', // one char type-identifiy for this resources
102
+			'icon' => 'calicon', //icon
103 103
 			'participants_header' => lang('resources'), // header of participants from this type
104 104
 			'cal_sidebox' => array(
105 105
 				'menu_title' => lang('Select resources'),
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
 	{
119 119
 		$cat = categories::read($args['cat_id']);
120 120
 
121
-		if(!$cat) return; // Can't find current cat?
121
+		if (!$cat) return; // Can't find current cat?
122 122
 
123
-		if($cat['parent'] == 0)
123
+		if ($cat['parent'] == 0)
124 124
 		{
125 125
 			// No parent, try the default cat from setup
126 126
 			$categories = new categories('', 'resources');
127 127
 			$default = $categories->name2id('General resources');
128
-			if($default)
128
+			if ($default)
129 129
 			{
130 130
 				$new_cat_id = $default;
131 131
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 			{
134 134
 				// Default missing, look for 'No category'
135 135
 				$new_cat_id = $categories->name2id('No category');
136
-				if($new_cat_id == 0) {
136
+				if ($new_cat_id == 0) {
137 137
 					// No category not there, add it
138 138
 					$new_cat_id = $categories->add(array(
139 139
 						'name'		=> 'No category',
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 						'parent'	=> 0
142 142
 					));
143 143
 					$admin = -2;
144
-					ExecMethod2('resources.bo_acl.set_rights', $new_cat_id, array($admin), array($admin), array($admin), array($admin),array($admin));
144
+					ExecMethod2('resources.bo_acl.set_rights', $new_cat_id, array($admin), array($admin), array($admin), array($admin), array($admin));
145 145
 				}
146 146
 			}
147 147
 		}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 		$bo = new resources_bo();
156 156
 		$bo->get_rows($query, $resources, $readonly);
157 157
 		
158
-		foreach($resources as $resource)
158
+		foreach ($resources as $resource)
159 159
 		{
160
-			if(is_array($resource))
160
+			if (is_array($resource))
161 161
 			{
162 162
 				$resource['cat_id'] = $new_cat_id;
163 163
 				$bo->save($resource);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
 
109 109
 		if ($GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile())
110 110
 		{
111
-			$file = Array(
111
+			$file = array(
112 112
 				'Site configuration' => Egw::link('/index.php',array(
113 113
 					'menuaction' => 'infolog.infolog_ui.admin' )),
114 114
 				'Global Categories'  => Egw::link('/index.php',array(
Please login to merge, or discard this patch.
addressbook/inc/class.addressbook_wizard_export_vcard.inc.php 3 patches
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,9 +37,13 @@  discard block
 block discarded – undo
37 37
          */
38 38
         function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv)
39 39
         {
40
-                if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true));
40
+                if($this->debug)
41
+                {
42
+                	error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true));
43
+                }
41 44
                 // return from step40
42
-                if ($content['step'] == 'wizard_step40') {
45
+                if ($content['step'] == 'wizard_step40')
46
+                {
43 47
                         switch (array_search('pressed', $content['button']))
44 48
                         {
45 49
                                 case 'next':
@@ -57,7 +61,8 @@  discard block
 block discarded – undo
57 61
                 {
58 62
                         $content['msg'] = $this->steps['wizard_step40'];
59 63
                         $content['step'] = 'wizard_step40';
60
-			if(!$content['charset'] && $content['plugin_options']['charset']) {
64
+			if(!$content['charset'] && $content['plugin_options']['charset'])
65
+			{
61 66
                                 $content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user';
62 67
                         }
63 68
 			$sel_options['charset'] = Api\Translation::get_installed_charsets()+
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -26,54 +26,54 @@
 block discarded – undo
26 26
 	}
27 27
 
28 28
 	/**
29
-         * choose charset
30
-         *
31
-         * @param array $content
32
-         * @param array $sel_options
33
-         * @param array $readonlys
34
-         * @param array $preserv
35
-         * @return string template name
36
-         */
37
-        function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv)
38
-        {
39
-                if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true));
40
-                // return from step40
41
-                if ($content['step'] == 'wizard_step40') {
42
-                        switch (array_search('pressed', $content['button']))
43
-                        {
44
-                                case 'next':
45
-                                        return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1);
46
-                                case 'previous' :
47
-                                        return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1);
48
-                                case 'finish':
49
-                                        return 'wizard_finish';
50
-                                default :
51
-                                        return $this->wizard_step40($content,$sel_options,$readonlys,$preserv);
52
-                        }
53
-                }
54
-                // init step40
55
-                else
56
-                {
57
-                        $content['msg'] = $this->steps['wizard_step40'];
58
-                        $content['step'] = 'wizard_step40';
29
+	 * choose charset
30
+	 *
31
+	 * @param array $content
32
+	 * @param array $sel_options
33
+	 * @param array $readonlys
34
+	 * @param array $preserv
35
+	 * @return string template name
36
+	 */
37
+		function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv)
38
+		{
39
+				if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true));
40
+				// return from step40
41
+				if ($content['step'] == 'wizard_step40') {
42
+						switch (array_search('pressed', $content['button']))
43
+						{
44
+								case 'next':
45
+										return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1);
46
+								case 'previous' :
47
+										return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1);
48
+								case 'finish':
49
+										return 'wizard_finish';
50
+								default :
51
+										return $this->wizard_step40($content,$sel_options,$readonlys,$preserv);
52
+						}
53
+				}
54
+				// init step40
55
+				else
56
+				{
57
+						$content['msg'] = $this->steps['wizard_step40'];
58
+						$content['step'] = 'wizard_step40';
59 59
 			if(!$content['charset'] && $content['plugin_options']['charset']) {
60
-                                $content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user';
61
-                        }
60
+								$content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user';
61
+						}
62 62
 			$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+
63
-                        array(
64
-                                'user'  => lang('User preference'),
65
-                        );
63
+						array(
64
+								'user'  => lang('User preference'),
65
+						);
66 66
 			$preserv = $content;
67 67
 
68
-                        // Add in extra allowed charsets
69
-                        $config = config::read('importexport');
70
-                        $extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
71
-                        if($extra_charsets)
72
-                        {
73
-                                $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets));
74
-                        }
68
+						// Add in extra allowed charsets
69
+						$config = config::read('importexport');
70
+						$extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
71
+						if($extra_charsets)
72
+						{
73
+								$sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets));
74
+						}
75 75
 			unset ($preserv['button']);
76
-                        return $this->step_templates[$content['step']];
76
+						return $this->step_templates[$content['step']];
77 77
 		}
78 78
 	}
79 79
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
          */
37 37
         function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv)
38 38
         {
39
-                if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true));
39
+                if ($this->debug) error_log(get_class($this).'::wizard_step40->$content '.print_r($content, true));
40 40
                 // return from step40
41 41
                 if ($content['step'] == 'wizard_step40') {
42 42
                         switch (array_search('pressed', $content['button']))
43 43
                         {
44 44
                                 case 'next':
45
-                                        return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1);
45
+                                        return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1);
46 46
                                 case 'previous' :
47
-                                        return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1);
47
+                                        return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1);
48 48
                                 case 'finish':
49 49
                                         return 'wizard_finish';
50 50
                                 default :
51
-                                        return $this->wizard_step40($content,$sel_options,$readonlys,$preserv);
51
+                                        return $this->wizard_step40($content, $sel_options, $readonlys, $preserv);
52 52
                         }
53 53
                 }
54 54
                 // init step40
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
                 {
57 57
                         $content['msg'] = $this->steps['wizard_step40'];
58 58
                         $content['step'] = 'wizard_step40';
59
-			if(!$content['charset'] && $content['plugin_options']['charset']) {
59
+			if (!$content['charset'] && $content['plugin_options']['charset']) {
60 60
                                 $content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user';
61 61
                         }
62
-			$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+
62
+			$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets() +
63 63
                         array(
64 64
                                 'user'  => lang('User preference'),
65 65
                         );
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 
68 68
                         // Add in extra allowed charsets
69 69
                         $config = config::read('importexport');
70
-                        $extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
71
-                        if($extra_charsets)
70
+                        $extra_charsets = array_intersect(explode(',', $config['import_charsets']), mb_list_encodings());
71
+                        if ($extra_charsets)
72 72
                         {
73
-                                $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets));
73
+                                $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets, $extra_charsets));
74 74
                         }
75 75
 			unset ($preserv['button']);
76 76
                         return $this->step_templates[$content['step']];
Please login to merge, or discard this patch.
addressbook/inc/class.addressbook_egw_record.inc.php 2 patches
Braces   +28 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,10 +45,12 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @param string $_identifier
47 47
 	 */
48
-	public function __construct( $_identifier='' ){
48
+	public function __construct( $_identifier='' )
49
+	{
49 50
 		$this->identifier = $_identifier;
50 51
 		$this->bocontacts = new Api\Contacts();
51
-		if($_identifier) {
52
+		if($_identifier)
53
+		{
52 54
 			$this->contact = $this->bocontacts->read($this->identifier);
53 55
 		}
54 56
 	}
@@ -58,7 +60,8 @@  discard block
 block discarded – undo
58 60
 	 *
59 61
 	 * @param string $_attribute_name
60 62
 	 */
61
-	public function __get($_attribute_name) {
63
+	public function __get($_attribute_name)
64
+	{
62 65
 		return $this->contact[$_attribute_name];
63 66
 	}
64 67
 
@@ -68,7 +71,8 @@  discard block
 block discarded – undo
68 71
 	 * @param string $_attribute_name
69 72
 	 * @param data $data
70 73
 	 */
71
-	public function __set($_attribute_name, $data) {
74
+	public function __set($_attribute_name, $data)
75
+	{
72 76
 		$this->contact[$_attribute_name] = $data;
73 77
 	}
74 78
 
@@ -80,7 +84,8 @@  discard block
 block discarded – undo
80 84
 	 *
81 85
 	 * @return array complete record as associative array
82 86
 	 */
83
-	public function get_record_array() {
87
+	public function get_record_array()
88
+	{
84 89
 		return $this->contact;
85 90
 	}
86 91
 
@@ -89,7 +94,8 @@  discard block
 block discarded – undo
89 94
 	 *
90 95
 	 *@return string tiltle
91 96
 	 */
92
-	public function get_title() {
97
+	public function get_title()
98
+	{
93 99
 		return $this->bocontacts->link_title(empty($this->contact) ? $this->identifier : $this->contact);
94 100
 	}
95 101
 
@@ -99,7 +105,8 @@  discard block
 block discarded – undo
99 105
 	 * @todo add some checks
100 106
 	 * @return void
101 107
 	 */
102
-	public function set_record(array $_record){
108
+	public function set_record(array $_record)
109
+	{
103 110
 		$this->contact = $_record;
104 111
 	}
105 112
 
@@ -108,7 +115,8 @@  discard block
 block discarded – undo
108 115
 	 *
109 116
 	 * @return string identifier of current record
110 117
 	 */
111
-	public function get_identifier() {
118
+	public function get_identifier()
119
+	{
112 120
 		return $this->identifier ? $this->identifier : $this->id;
113 121
 	}
114 122
 
@@ -118,7 +126,8 @@  discard block
 block discarded – undo
118 126
 	 *
119 127
 	 * @return string Full URL of an icon, or appname/icon_name
120 128
 	 */
121
-	public function get_icon() {
129
+	public function get_icon()
130
+	{
122 131
 		$ui = new addressbook_ui();
123 132
 
124 133
 		// Type as default
@@ -133,7 +142,8 @@  discard block
 block discarded – undo
133 142
 	 *
134 143
 	 * @return string identifier
135 144
 	 */
136
-	public function save ( $_dst_identifier ) {
145
+	public function save ( $_dst_identifier )
146
+	{
137 147
 		// Not yet implemeted
138 148
 		$this->identifier = $_dst_identifier;
139 149
 	}
@@ -144,7 +154,8 @@  discard block
 block discarded – undo
144 154
 	 * @param string $_dst_identifier
145 155
 	 * @return string dst_identifier
146 156
 	 */
147
-	public function copy ( $_dst_identifier ) {
157
+	public function copy ( $_dst_identifier )
158
+	{
148 159
 		unset($_dst_identifier);	// not used, but required by function signature
149 160
 	}
150 161
 
@@ -155,7 +166,8 @@  discard block
 block discarded – undo
155 166
 	 * @param string $_dst_identifier
156 167
 	 * @return string dst_identifier
157 168
 	 */
158
-	public function move ( $_dst_identifier ) {
169
+	public function move ( $_dst_identifier )
170
+	{
159 171
 		unset($_dst_identifier);	// not used, but required by function signature
160 172
 	}
161 173
 
@@ -163,7 +175,8 @@  discard block
 block discarded – undo
163 175
 	 * delets current record from backend
164 176
 	 *
165 177
 	 */
166
-	public function delete () {
178
+	public function delete ()
179
+	{
167 180
 
168 181
 	}
169 182
 
@@ -171,7 +184,8 @@  discard block
 block discarded – undo
171 184
 	 * destructor
172 185
 	 *
173 186
 	 */
174
-	public function __destruct() {
187
+	public function __destruct()
188
+	{
175 189
 		unset ($this->bocontacts);
176 190
 	}
177 191
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 
29 29
 	// Used in conversions
30 30
 	static $types = array(
31
-		'select-account' => array('owner','creator','modifier'),
32
-		'date-time' => array('modified','created','last_event','next_event'),
31
+		'select-account' => array('owner', 'creator', 'modifier'),
32
+		'date-time' => array('modified', 'created', 'last_event', 'next_event'),
33 33
 		'date' => array('bday'),
34 34
 		'select-cat' => array('cat_id'),
35 35
 		'select' => array('tid')
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @param string $_identifier
44 44
 	 */
45
-	public function __construct( $_identifier='' ){
45
+	public function __construct($_identifier = '') {
46 46
 		$this->identifier = $_identifier;
47 47
 		$this->bocontacts = new addressbook_bo();
48
-		if($_identifier) {
48
+		if ($_identifier) {
49 49
 			$this->contact = $this->bocontacts->read($this->identifier);
50 50
 		}
51 51
 	}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @todo add some checks
97 97
 	 * @return void
98 98
 	 */
99
-	public function set_record(array $_record){
99
+	public function set_record(array $_record) {
100 100
 		$this->contact = $_record;
101 101
 	}
102 102
 
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
 		$ui->type_icon($this->owner, $this->private, $this->tid, $icon, $label);
124 124
 
125 125
 		// Specific photo
126
-		return $this->jpegphoto ? egw_framework::link('/index.php',$ui->photo_src($this->identifier,$this->jpegphoto)):$icon;
126
+		return $this->jpegphoto ? egw_framework::link('/index.php', $ui->photo_src($this->identifier, $this->jpegphoto)) : $icon;
127 127
 	}
128 128
 	/**
129 129
 	 * saves record into backend
130 130
 	 *
131 131
 	 * @return string identifier
132 132
 	 */
133
-	public function save ( $_dst_identifier ) {
133
+	public function save($_dst_identifier) {
134 134
 		// Not yet implemeted
135 135
 		$this->identifier = $_dst_identifier;
136 136
 	}
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 	 * @param string $_dst_identifier
142 142
 	 * @return string dst_identifier
143 143
 	 */
144
-	public function copy ( $_dst_identifier ) {
145
-		unset($_dst_identifier);	// not used, but required by function signature
144
+	public function copy($_dst_identifier) {
145
+		unset($_dst_identifier); // not used, but required by function signature
146 146
 	}
147 147
 
148 148
 	/**
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 	 * @param string $_dst_identifier
153 153
 	 * @return string dst_identifier
154 154
 	 */
155
-	public function move ( $_dst_identifier ) {
156
-		unset($_dst_identifier);	// not used, but required by function signature
155
+	public function move($_dst_identifier) {
156
+		unset($_dst_identifier); // not used, but required by function signature
157 157
 	}
158 158
 
159 159
 	/**
160 160
 	 * delets current record from backend
161 161
 	 *
162 162
 	 */
163
-	public function delete () {
163
+	public function delete() {
164 164
 
165 165
 	}
166 166
 
Please login to merge, or discard this patch.
addressbook/inc/class.addressbook_wizard_import_contacts_csv.inc.php 2 patches
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,11 +46,13 @@  discard block
 block discarded – undo
46 46
 				'title' => $cat['description'],
47 47
 			);
48 48
 		}
49
-		if(count($cat_list) > 0) {
49
+		if(count($cat_list) > 0)
50
+		{
50 51
 			$this->mapping_fields[lang('Categories')] = $cat_list;
51 52
 		}
52 53
 
53
-		foreach($bocontacts->customfields as $name => $data) {
54
+		foreach($bocontacts->customfields as $name => $data)
55
+		{
54 56
 			$this->mapping_fields['#'.$name] = $data['label'];
55 57
 		}
56 58
 		unset($this->mapping_fields['jpegphoto']);        // can't cvs import that
@@ -75,7 +77,8 @@  discard block
 block discarded – undo
75 77
 
76 78
 	function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv)
77 79
 	{
78
-		if($content['field_mapping'][0] == lang('Categories')) {
80
+		if($content['field_mapping'][0] == lang('Categories'))
81
+		{
79 82
 			unset($content['field_mapping'][0]);
80 83
 		}
81 84
 		$result = parent::wizard_step50($content, $sel_options, $readonlys, $preserv);
@@ -86,7 +89,10 @@  discard block
 block discarded – undo
86 89
 
87 90
 	function wizard_step60(&$content, &$sel_options, &$readonlys, &$preserv)
88 91
 	{
89
-		if($this->debug) error_log('addressbook.importexport.addressbook_csv_import::wizard_step60->$content '.print_r($content,true));
92
+		if($this->debug)
93
+		{
94
+			error_log('addressbook.importexport.addressbook_csv_import::wizard_step60->$content '.print_r($content,true));
95
+		}
90 96
 		unset($content['no_owner_map']);
91 97
 		// return from step60
92 98
 		if ($content['step'] == 'wizard_step60')
@@ -108,19 +114,23 @@  discard block
 block discarded – undo
108 114
 		{
109 115
 			$content['msg'] = $this->steps['wizard_step60'];
110 116
 			$content['step'] = 'wizard_step60';
111
-			if(!array_key_exists($content['contact_owner']) && $content['plugin_options']) {
117
+			if(!array_key_exists($content['contact_owner']) && $content['plugin_options'])
118
+			{
112 119
 				$content['contact_owner'] = $content['plugin_options']['contact_owner'];
113 120
 			}
114
-			if(!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) {
121
+			if(!array_key_exists($content['owner_from_csv']) && $content['plugin_options'])
122
+			{
115 123
 				$content['owner_from_csv'] = $content['plugin_options']['owner_from_csv'];
116 124
 			}
117
-			if(!array_key_exists($content['change_owner']) && $content['plugin_options']) {
125
+			if(!array_key_exists($content['change_owner']) && $content['plugin_options'])
126
+			{
118 127
 				$content['change_owner'] = $content['plugin_options']['change_owner'];
119 128
 			}
120 129
 
121 130
 			$bocontacts = new Api\Contacts();
122 131
 			$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(Acl::ADD);
123
-			if(!in_array('owner', $content['field_mapping'])) {
132
+			if(!in_array('owner', $content['field_mapping']))
133
+			{
124 134
 				$content['no_owner_map'] = true;
125 135
 			}
126 136
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 		$bocontacts = new addressbook_bo();
29 29
 		$this->mapping_fields = $bocontacts->contact_fields;
30 30
 
31
-		$categories = new categories('','addressbook');
31
+		$categories = new categories('', 'addressbook');
32 32
 		$cat_list = array();
33
-		foreach((array)$categories->return_sorted_array(0,False,'','','',true,0,true) as $cat)
33
+		foreach ((array)$categories->return_sorted_array(0, False, '', '', '', true, 0, true) as $cat)
34 34
 		{
35
-			$s = str_repeat('&nbsp;',$cat['level']) . stripslashes($cat['name']);
35
+			$s = str_repeat('&nbsp;', $cat['level']).stripslashes($cat['name']);
36 36
 
37 37
 			if (categories::is_global($cat))
38 38
 			{
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 				'title' => $cat['description'],
44 44
 			);
45 45
 		}
46
-		if(count($cat_list) > 0) {
46
+		if (count($cat_list) > 0) {
47 47
 			$this->mapping_fields[lang('Categories')] = $cat_list;
48 48
 		}
49 49
 
50
-		foreach($bocontacts->customfields as $name => $data) {
50
+		foreach ($bocontacts->customfields as $name => $data) {
51 51
 			$this->mapping_fields['#'.$name] = $data['label'];
52 52
 		}
53
-		unset($this->mapping_fields['jpegphoto']);        // can't cvs import that
53
+		unset($this->mapping_fields['jpegphoto']); // can't cvs import that
54 54
 		
55 55
 		// Add in special handled fields
56 56
 		$this->mapping_fields[lang('Special')] = addressbook_import_contacts_csv::$special_fields;
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 
73 73
 	function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv)
74 74
 	{
75
-		if($content['field_mapping'][0] == lang('Categories')) {
75
+		if ($content['field_mapping'][0] == lang('Categories')) {
76 76
 			unset($content['field_mapping'][0]);
77 77
 		}
78 78
 		$result = parent::wizard_step50($content, $sel_options, $readonlys, $preserv);
79
-		$content['msg'] .= "\n*" . lang('Contact ID cannot be changed by import');
79
+		$content['msg'] .= "\n*".lang('Contact ID cannot be changed by import');
80 80
 		
81 81
 		return $result;
82 82
 	}
83 83
 	
84 84
 	function wizard_step60(&$content, &$sel_options, &$readonlys, &$preserv)
85 85
 	{
86
-		if($this->debug) error_log('addressbook.importexport.addressbook_csv_import::wizard_step60->$content '.print_r($content,true));
86
+		if ($this->debug) error_log('addressbook.importexport.addressbook_csv_import::wizard_step60->$content '.print_r($content, true));
87 87
 		unset($content['no_owner_map']);
88 88
 		// return from step60
89 89
 		if ($content['step'] == 'wizard_step60')
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 			switch (array_search('pressed', $content['button']))
92 92
 			{
93 93
 				case 'next':
94
-					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1);
94
+					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1);
95 95
 				case 'previous' :
96
-					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1);
96
+					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1);
97 97
 				case 'finish':
98 98
 					return 'wizard_finish';
99 99
 				default :
100
-					return $this->wizard_step60($content,$sel_options,$readonlys,$preserv);
100
+					return $this->wizard_step60($content, $sel_options, $readonlys, $preserv);
101 101
 			}
102 102
 		}
103 103
 		// init step60
@@ -105,19 +105,19 @@  discard block
 block discarded – undo
105 105
 		{
106 106
 			$content['msg'] = $this->steps['wizard_step60'];
107 107
 			$content['step'] = 'wizard_step60';
108
-			if(!array_key_exists($content['contact_owner']) && $content['plugin_options']) {
108
+			if (!array_key_exists($content['contact_owner']) && $content['plugin_options']) {
109 109
 				$content['contact_owner'] = $content['plugin_options']['contact_owner'];
110 110
 			}
111
-			if(!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) {
111
+			if (!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) {
112 112
 				$content['owner_from_csv'] = $content['plugin_options']['owner_from_csv'];
113 113
 			}
114
-			if(!array_key_exists($content['change_owner']) && $content['plugin_options']) {
114
+			if (!array_key_exists($content['change_owner']) && $content['plugin_options']) {
115 115
 				$content['change_owner'] = $content['plugin_options']['change_owner'];
116 116
 			}
117 117
 
118 118
 			$bocontacts = new addressbook_bo();
119 119
 			$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(EGW_ACL_ADD);
120
-			if(!in_array('owner', $content['field_mapping'])) {
120
+			if (!in_array('owner', $content['field_mapping'])) {
121 121
 				$content['no_owner_map'] = true;
122 122
 			}
123 123
 
Please login to merge, or discard this patch.
infolog/inc/class.infolog_customfields.inc.php 2 patches
Braces   +24 added lines, -6 removed lines patch added patch discarded remove patch
@@ -109,25 +109,34 @@  discard block
 block discarded – undo
109 109
 				unset($this->fields[$old_name]);
110 110
 				continue;
111 111
 			}
112
-			if (isset($field['name']) && empty($name) && ($create || !empty($old_name)))	// empty name not allowed
112
+			if (isset($field['name']) && empty($name) && ($create || !empty($old_name)))
113
+			{
114
+				// empty name not allowed
113 115
 			{
114 116
 				$content['error_msg'] = lang('Name must not be empty !!!');
115 117
 			}
118
+			}
116 119
 			if (isset($field['old_name']))
117 120
 			{
118
-				if (!empty($name) && $old_name != $name)	// renamed
121
+				if (!empty($name) && $old_name != $name)
122
+				{
123
+					// renamed
119 124
 				{
120 125
 					unset($this->fields[$old_name]);
121 126
 				}
127
+				}
122 128
 				elseif (empty($name))
123 129
 				{
124 130
 					$name = $old_name;
125 131
 				}
126 132
 			}
127
-			elseif (empty($name))		// new item and empty ==> ignore it
133
+			elseif (empty($name))
134
+			{
135
+				// new item and empty ==> ignore it
128 136
 			{
129 137
 				continue;
130 138
 			}
139
+			}
131 140
 			$values = array();
132 141
 			if (!empty($field['values']))
133 142
 			{
@@ -193,15 +202,21 @@  discard block
 block discarded – undo
193 202
 				unset($this->status[$typ][$old_name]);
194 203
 				continue;
195 204
 			}
196
-			if (isset($stat['name']) && empty($name) && ($create || !empty($old_name)))	// empty name not allowed
205
+			if (isset($stat['name']) && empty($name) && ($create || !empty($old_name)))
206
+			{
207
+				// empty name not allowed
197 208
 			{
198 209
 				$content['error_msg'] = lang('Name must not be empty !!!');
199 210
 			}
211
+			}
200 212
 			if (isset($stat['old_name']))
201 213
 			{
202
-				if (!empty($name) && $old_name != $name)	// renamed
214
+				if (!empty($name) && $old_name != $name)
215
+				{
216
+					// renamed
203 217
 				{
204 218
 					unset($this->status[$typ][$old_name]);
219
+				}
205 220
 
206 221
 					if ($default == $old_name)
207 222
 					{
@@ -213,10 +228,13 @@  discard block
 block discarded – undo
213 228
 					$name = $old_name;
214 229
 				}
215 230
 			}
216
-			elseif (empty($name))		// new item and empty ==> ignore it
231
+			elseif (empty($name))
232
+			{
233
+				// new item and empty ==> ignore it
217 234
 			{
218 235
 				continue;
219 236
 			}
237
+			}
220 238
 			$this->status[$typ][$name] = empty($stat['label']) ? $name : $stat['label'];
221 239
 		}
222 240
 		$this->status['defaults'][$typ] = empty($default) ? $name : $default;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 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
 
13
-require_once(EGW_INCLUDE_ROOT . '/admin/inc/class.customfields.inc.php');
13
+require_once(EGW_INCLUDE_ROOT.'/admin/inc/class.customfields.inc.php');
14 14
 /**
15 15
  * Administration of custom fields, type and status
16 16
  */
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		$this->status = &$this->bo->status;
47 47
 		$this->config_data = config::read('infolog');
48 48
 		$this->fields = &$this->bo->customfields;
49
-		$this->group_owners =& $this->bo->group_owners;
49
+		$this->group_owners = & $this->bo->group_owners;
50 50
 	}
51 51
 
52 52
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	protected function app_index(&$content, &$sel_options, &$readonlys, &$preserve)
57 57
 	{
58 58
 		$n = 0;
59
-		foreach($this->status[$this->content_type] as $name => $label)
59
+		foreach ($this->status[$this->content_type] as $name => $label)
60 60
 		{
61 61
 			$content['content_type_options']['status'][++$n] = array(
62 62
 				'name'     => $name,
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			unset($fields['delete']);
96 96
 		}
97 97
 
98
-		foreach($fields as $field)
98
+		foreach ($fields as $field)
99 99
 		{
100 100
 			$name = trim($field['name']);
101 101
 			$old_name = $field['old_name'];
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 			$values = array();
128 128
 			if (!empty($field['values']))
129 129
 			{
130
-				foreach(explode("\n",$field['values']) as $line)
130
+				foreach (explode("\n", $field['values']) as $line)
131 131
 				{
132
-					list($var,$value) = explode('=',trim($line),2);
132
+					list($var, $value) = explode('=', trim($line), 2);
133 133
 					$var = trim($var);
134 134
 					$values[$var] = empty($value) ? $var : $value;
135 135
 				}
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 		}
149 149
 		if (!function_exists('sort_by_order'))
150 150
 		{
151
-			function sort_by_order($arr1,$arr2)
151
+			function sort_by_order($arr1, $arr2)
152 152
 			{
153 153
 				return $arr1['order'] - $arr2['order'];
154 154
 			}
155 155
 		}
156
-		uasort($this->fields,sort_by_order);
156
+		uasort($this->fields, sort_by_order);
157 157
 
158 158
 		$n = 0;
159
-		foreach($this->fields as $name => $data)
159
+		foreach ($this->fields as $name => $data)
160 160
 		{
161 161
 			$this->fields[$name]['order'] = ($n += 10);
162 162
 		}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			unset($status['delete']);
180 180
 		}
181 181
 
182
-		foreach($status as $stat)
182
+		foreach ($status as $stat)
183 183
 		{
184 184
 			$name = trim($stat['name']);
185 185
 			$old_name = $stat['old_name'];
@@ -260,16 +260,16 @@  discard block
 block discarded – undo
260 260
 		$new_name = trim($content['content_types']['name']);
261 261
 		if (empty($new_name))
262 262
 		{
263
-			$this->tmpl->set_validation_error('content_types[name]','You have to enter a name, to create a new type!!!');
263
+			$this->tmpl->set_validation_error('content_types[name]', 'You have to enter a name, to create a new type!!!');
264 264
 			return false;
265 265
 		}
266 266
 		else
267 267
 		{
268
-			foreach($this->content_types as $letter => $name)
268
+			foreach ($this->content_types as $letter => $name)
269 269
 			{
270
-				if($name == $new_name)
270
+				if ($name == $new_name)
271 271
 				{
272
-					$this->tmpl->set_validation_error('content_types[name]',lang("type '%1' already exists !!!",$new_name));
272
+					$this->tmpl->set_validation_error('content_types[name]', lang("type '%1' already exists !!!", $new_name));
273 273
 					return false;
274 274
 				}
275 275
 			}
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
 	function save_repository()
290 290
 	{
291 291
 		// save changes to repository
292
-		config::save_value('types',$this->content_types,'infolog');
292
+		config::save_value('types', $this->content_types, 'infolog');
293 293
 		//echo '<p>'.__METHOD__.'() \$this->status=<pre style="text-aling: left;">'; print_r($this->status); echo "</pre>\n";
294
-		config::save_value('status',$this->status,'infolog');
294
+		config::save_value('status', $this->status, 'infolog');
295 295
 		//echo '<p>'.__METHOD__.'() \$this->fields=<pre style="text-aling: left;">'; print_r($this->fields); echo "</pre>\n";
296 296
 		egw_customfields::save('infolog', $this->fields);
297
-		config::save_value('group_owners',$this->group_owners,'infolog');
297
+		config::save_value('group_owners', $this->group_owners, 'infolog');
298 298
 	}
299 299
 }
Please login to merge, or discard this patch.
infolog/inc/class.infolog_merge.inc.php 2 patches
Braces   +50 added lines, -12 removed lines patch added patch discarded remove patch
@@ -76,7 +76,10 @@  discard block
 block discarded – undo
76 76
 			{
77 77
 				$replacements += $this->contact_replacements($replacements['$$info_link$$']['id'],'info_contact');
78 78
 			}
79
-			if(is_array($replacements['$$info_link$$'])) unset($replacements['$$info_link$$']);
79
+			if(is_array($replacements['$$info_link$$']))
80
+			{
81
+				unset($replacements['$$info_link$$']);
82
+			}
80 83
 		}
81 84
 		return $replacements;
82 85
 	}
@@ -99,7 +102,10 @@  discard block
 block discarded – undo
99 102
 		foreach($_selects as $name => $value)
100 103
 		{
101 104
 			$selects['info_'.$name] = $value;
102
-			if(!in_array('info_'.$name, $types['select'])) $types['select'][] = 'info_'.$name;
105
+			if(!in_array('info_'.$name, $types['select']))
106
+			{
107
+				$types['select'][] = 'info_'.$name;
108
+			}
103 109
 		}
104 110
 
105 111
 		if($content && strpos($content, '$$#') !== FALSE)
@@ -152,7 +158,10 @@  discard block
 block discarded – undo
152 158
 		// Add markers
153 159
 		foreach($array as $key => &$value)
154 160
 		{
155
-			if(!$value) $value = '';
161
+			if(!$value)
162
+			{
163
+				$value = '';
164
+			}
156 165
 			$info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value;
157 166
 		}
158 167
 
@@ -183,16 +192,29 @@  discard block
 block discarded – undo
183 192
 		Api\Translation::add_app('projectmanager');
184 193
 		foreach($fields as $name => $label)
185 194
 		{
186
-			if (in_array($name,array('custom'))) continue;	// dont show them
195
+			if (in_array($name,array('custom')))
196
+			{
197
+				continue;
198
+			}
199
+			// dont show them
187 200
 
188
-			if (in_array($name,array('info_subject', 'info_des')) && $n&1)		// main values, which should be in the first column
201
+			if (in_array($name,array('info_subject', 'info_des')) && $n&1)
202
+			{
203
+				// main values, which should be in the first column
189 204
 			{
190 205
 				echo "</tr>\n";
206
+			}
191 207
 				$n++;
192 208
 			}
193
-			if (!($n&1)) echo '<tr>';
209
+			if (!($n&1))
210
+			{
211
+				echo '<tr>';
212
+			}
194 213
 			echo '<td>{{'.$name.'}}</td><td>'.lang($label).'</td>';
195
-			if ($n&1) echo "</tr>\n";
214
+			if ($n&1)
215
+			{
216
+				echo "</tr>\n";
217
+			}
196 218
 			$n++;
197 219
 		}
198 220
 
@@ -201,7 +223,10 @@  discard block
 block discarded – undo
201 223
 		foreach($this->bo->customfields as $name => $field)
202 224
 		{
203 225
 			echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label'].($field['type'] == 'select-account' ? '*':'')."</td></tr>\n";
204
-			if($field['type'] == 'select-account') $contact_custom = true;
226
+			if($field['type'] == 'select-account')
227
+			{
228
+				$contact_custom = true;
229
+			}
205 230
 		}
206 231
 		if($contact_custom)
207 232
 		{
@@ -215,16 +240,29 @@  discard block
 block discarded – undo
215 240
 		$i = 0;
216 241
 		foreach($this->contacts->contact_fields as $name => $label)
217 242
 		{
218
-			if (in_array($name,array('tid','label','geo'))) continue;       // dont show them, as they are not used in the UI atm.
243
+			if (in_array($name,array('tid','label','geo')))
244
+			{
245
+				continue;
246
+			}
247
+			// dont show them, as they are not used in the UI atm.
219 248
 
220
-			if (in_array($name,array('email','org_name','tel_work','url')) && $n&1)         // main values, which should be in the first column
249
+			if (in_array($name,array('email','org_name','tel_work','url')) && $n&1)
250
+			{
251
+				// main values, which should be in the first column
221 252
 			{
222 253
 					echo "</tr>\n";
254
+			}
223 255
 					$i++;
224 256
 			}
225
-			if (!($i&1)) echo '<tr>';
257
+			if (!($i&1))
258
+			{
259
+				echo '<tr>';
260
+			}
226 261
 			echo '<td>{{info_contact/'.$name.'}}</td><td>'.$label.'</td>';
227
-			if ($i&1) echo "</tr>\n";
262
+			if ($i&1)
263
+			{
264
+				echo "</tr>\n";
265
+			}
228 266
 			$i++;
229 267
 		}
230 268
 
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 	 * @param string &$content=null content to create some replacements only if they are use
61 61
 	 * @return array|boolean
62 62
 	 */
63
-	protected function get_replacements($id,&$content=null)
63
+	protected function get_replacements($id, &$content = null)
64 64
 	{
65 65
 		if (!($replacements = $this->infolog_replacements($id, '', $content)))
66 66
 		{
67 67
 			return false;
68 68
 		}
69
-		if (!(strpos($content,'$$info_contact/') === false))
69
+		if (!(strpos($content, '$$info_contact/') === false))
70 70
 		{
71 71
 			// Check to see if it's actually a contact, then load
72
-			if(is_array($replacements['$$info_link$$']) && $replacements['$$info_link$$']['app'] == 'addressbook')
72
+			if (is_array($replacements['$$info_link$$']) && $replacements['$$info_link$$']['app'] == 'addressbook')
73 73
 			{
74
-				$replacements += $this->contact_replacements($replacements['$$info_link$$']['id'],'info_contact');
74
+				$replacements += $this->contact_replacements($replacements['$$info_link$$']['id'], 'info_contact');
75 75
 			}
76
-			if(is_array($replacements['$$info_link$$'])) unset($replacements['$$info_link$$']);
76
+			if (is_array($replacements['$$info_link$$'])) unset($replacements['$$info_link$$']);
77 77
 		}
78 78
 		return $replacements;
79 79
 	}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @param string $prefix='' prefix like eg. 'erole'
86 86
 	 * @return array|boolean
87 87
 	 */
88
-	public function infolog_replacements($id,$prefix='', &$content = '')
88
+	public function infolog_replacements($id, $prefix = '', &$content = '')
89 89
 	{
90 90
 		$record = new infolog_egw_record($id);
91 91
 		$info = array();
@@ -93,33 +93,33 @@  discard block
 block discarded – undo
93 93
 		// Convert to human friendly values
94 94
 		$types = infolog_egw_record::$types;
95 95
 		$_selects = $this->bo->enums + array('status' => $this->bo->status[$record->info_type]);
96
-		foreach($_selects as $name => $value)
96
+		foreach ($_selects as $name => $value)
97 97
 		{
98 98
 			$selects['info_'.$name] = $value;
99
-			if(!in_array('info_'.$name, $types['select'])) $types['select'][] = 'info_'.$name;
99
+			if (!in_array('info_'.$name, $types['select'])) $types['select'][] = 'info_'.$name;
100 100
 		}
101 101
 
102
-		if($content && strpos($content, '$$#') !== FALSE)
102
+		if ($content && strpos($content, '$$#') !== FALSE)
103 103
 		{
104 104
 			$this->cf_link_to_expand($record->get_record_array(), $content, $info);
105 105
 		}
106 106
 
107 107
 		importexport_export_csv::convert($record, $types, 'infolog', $selects);
108
-		if($record->info_contact)
108
+		if ($record->info_contact)
109 109
 		{
110 110
 			$array['info_contact'] = $array['info_link']['title'];
111 111
 		}
112 112
 
113 113
 		// Set any missing custom fields, or the marker will stay
114 114
 		$array = $record->get_record_array();
115
-		foreach($this->bo->customfields as $name => $field)
115
+		foreach ($this->bo->customfields as $name => $field)
116 116
 		{
117
-			if(!$array['#'.$name])
117
+			if (!$array['#'.$name])
118 118
 			{
119 119
 				$array['#'.$name] = '';
120 120
 			}
121 121
 			// Format date cfs per user preferences
122
-			if($field['type'] == 'date' || $field['type'] == 'date-time')
122
+			if ($field['type'] == 'date' || $field['type'] == 'date-time')
123 123
 			{
124 124
 				$this->date_fields[] = '#'.$name;
125 125
 				$array['#'.$name] = egw_time::to($array['#'.$name], $field['type'] == 'date' ? true : '');
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
 		$array += $this->get_all_links('infolog', $id, $prefix, $content);
131 131
 
132 132
 		// Timesheet time
133
-		if(strpos($content, 'info_sum_timesheets'))
133
+		if (strpos($content, 'info_sum_timesheets'))
134 134
 		{
135
-			$links = egw_link::get_links('infolog',$id,'timesheet');
136
-			$sum = ExecMethod('timesheet.timesheet_bo.sum',$links);
135
+			$links = egw_link::get_links('infolog', $id, 'timesheet');
136
+			$sum = ExecMethod('timesheet.timesheet_bo.sum', $links);
137 137
 			$info['$$info_sum_timesheets$$'] = $sum['duration'];
138 138
 		}
139 139
 
140 140
 		// Check for linked project ID
141 141
 		$links = egw_link::get_links('infolog', $id, 'projectmanager');
142
-		foreach($links as $app_id)
142
+		foreach ($links as $app_id)
143 143
 		{
144 144
 			$array['pm_id'] = $app_id;
145 145
 			$array['project'] = egw_link::title('projectmanager', $app_id);
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 		}
148 148
 
149 149
 		// Add markers
150
-		foreach($array as $key => &$value)
150
+		foreach ($array as $key => &$value)
151 151
 		{
152
-			if(!$value) $value = '';
153
-			$info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value;
152
+			if (!$value) $value = '';
153
+			$info['$$'.($prefix ? $prefix.'/' : '').$key.'$$'] = $value;
154 154
 		}
155 155
 
156 156
 		// Add parent
157
-		if($record->info_id_parent)
157
+		if ($record->info_id_parent)
158 158
 		{
159 159
 			$info += $this->infolog_replacements($record->info_id_parent, 'info_id_parent', $content);
160 160
 		}
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 		$tracking = new infolog_tracking($this->bo);
179 179
 		$fields = array('info_id' => lang('Infolog ID'), 'pm_id' => lang('Project ID'), 'project' => lang('Project name')) + $tracking->field2label + array('info_sum_timesheets' => lang('Used time'));
180 180
 		translation::add_app('projectmanager');
181
-		foreach($fields as $name => $label)
181
+		foreach ($fields as $name => $label)
182 182
 		{
183
-			if (in_array($name,array('custom'))) continue;	// dont show them
183
+			if (in_array($name, array('custom'))) continue; // dont show them
184 184
 
185
-			if (in_array($name,array('info_subject', 'info_des')) && $n&1)		// main values, which should be in the first column
185
+			if (in_array($name, array('info_subject', 'info_des')) && $n&1)		// main values, which should be in the first column
186 186
 			{
187 187
 				echo "</tr>\n";
188 188
 				$n++;
@@ -195,26 +195,26 @@  discard block
 block discarded – undo
195 195
 
196 196
 		echo '<tr><td colspan="4"><h3>'.lang('Custom fields').":</h3></td></tr>";
197 197
 		$contact_custom = false;
198
-		foreach($this->bo->customfields as $name => $field)
198
+		foreach ($this->bo->customfields as $name => $field)
199 199
 		{
200
-			echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label'].($field['type'] == 'select-account' ? '*':'')."</td></tr>\n";
201
-			if($field['type'] == 'select-account') $contact_custom = true;
200
+			echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label'].($field['type'] == 'select-account' ? '*' : '')."</td></tr>\n";
201
+			if ($field['type'] == 'select-account') $contact_custom = true;
202 202
 		}
203
-		if($contact_custom)
203
+		if ($contact_custom)
204 204
 		{
205
-			echo '<tr><td /><td colspan="3">* '.lang('Addressbook placeholders available'). '</td></tr>';
205
+			echo '<tr><td /><td colspan="3">* '.lang('Addressbook placeholders available').'</td></tr>';
206 206
 		}
207 207
 
208 208
 		echo '<tr><td colspan="4"><h3>'.lang('Parent').":</h3></td></tr>";
209
-		echo '<tr><td>{{info_id_parent/info_subject}}</td><td colspan="3">'.lang('All other %1 fields are valid',lang('infolog'))."</td></tr>\n";
209
+		echo '<tr><td>{{info_id_parent/info_subject}}</td><td colspan="3">'.lang('All other %1 fields are valid', lang('infolog'))."</td></tr>\n";
210 210
 
211 211
 		echo '<tr><td colspan="4"><h3>'.lang('Contact fields').':</h3></td></tr>';
212 212
 		$i = 0;
213
-		foreach($this->contacts->contact_fields as $name => $label)
213
+		foreach ($this->contacts->contact_fields as $name => $label)
214 214
 		{
215
-			if (in_array($name,array('tid','label','geo'))) continue;       // dont show them, as they are not used in the UI atm.
215
+			if (in_array($name, array('tid', 'label', 'geo'))) continue; // dont show them, as they are not used in the UI atm.
216 216
 
217
-			if (in_array($name,array('email','org_name','tel_work','url')) && $n&1)         // main values, which should be in the first column
217
+			if (in_array($name, array('email', 'org_name', 'tel_work', 'url')) && $n&1)         // main values, which should be in the first column
218 218
 			{
219 219
 					echo "</tr>\n";
220 220
 					$i++;
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
 		}
227 227
 
228 228
 		echo '<tr><td colspan="4"><h3>'.lang('Custom fields').":</h3></td></tr>";
229
-		foreach($this->contacts->customfields as $name => $field)
229
+		foreach ($this->contacts->customfields as $name => $field)
230 230
 		{
231 231
 				echo '<tr><td>{{info_contact/#'.$name.'}}</td><td colspan="3">'.$field['label']."</td></tr>\n";
232 232
 		}
233 233
 
234 234
 		echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>";
235
-		foreach(array(
235
+		foreach (array(
236 236
 			'link' => lang('HTML link to the current record'),
237 237
 			'links' => lang('Titles of any entries linked to the current record, excluding attached files'),
238 238
 			'attachments' => lang('List of files linked to the current record'),
Please login to merge, or discard this patch.
infolog/inc/class.infolog_bo.inc.php 5 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1272,7 +1272,7 @@
 block discarded – undo
1272 1272
 	 * @param array $options Array of options for the search
1273 1273
 	 * @return array with info_id - title pairs of the matching entries
1274 1274
 	 */
1275
-	function link_query($pattern, Array &$options = array())
1275
+	function link_query($pattern, array &$options = array())
1276 1276
 	{
1277 1277
 		$query = array(
1278 1278
 			'search' => $pattern,
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 	 * Is called as hook to participate in the linking
1241 1241
 	 *
1242 1242
 	 * @param int|array $info int info_id or array with infolog entry
1243
-	 * @return string|boolean string with the title, null if $info not found, false if no perms to view
1243
+	 * @return string string with the title, null if $info not found, false if no perms to view
1244 1244
 	 */
1245 1245
 	function link_title($info)
1246 1246
 	{
@@ -1338,9 +1338,6 @@  discard block
 block discarded – undo
1338 1338
 	/**
1339 1339
 	 * hook called be calendar to include events or todos in the cal-dayview
1340 1340
 	 *
1341
-	 * @param int $args[year], $args[month], $args[day] date of the events
1342
-	 * @param int $args[owner] owner of the events
1343
-	 * @param string $args[location] calendar_include_{events|todos}
1344 1341
 	 * @return array of events (array with keys starttime, endtime, title, view, icon, content)
1345 1342
 	 */
1346 1343
 	function cal_to_include($args)
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -700,20 +700,20 @@  discard block
 block discarded – undo
700 700
 	}
701 701
 
702 702
 	/**
703
-	* writes the given $values to InfoLog, a new entry gets created if info_id is not set or 0
704
-	*
705
-	* checks and asures ACL
706
-	*
707
-	* @param array &$values values to write
708
-	* @param boolean $check_defaults = true check and set certain defaults
709
-	* @param boolean|int $touch_modified = true touch the modification date and sets the modifier's user-id, 2: only modifier
710
-	* @param boolean $user2server = true conversion between user- and server-time necessary
711
-	* @param boolean $skip_notification = false true = do NOT send notification, false (default) = send notifications
712
-	* @param boolean $throw_exception = false Throw an exception (if required fields are not set)
713
-	* @param string $purge_cfs = null null=dont, 'ical'=only iCal X-properties (cfs name starting with "#"), 'all'=all cfs
714
-	*
715
-	* @return int|boolean info_id on a successfull write or false
716
-	*/
703
+	 * writes the given $values to InfoLog, a new entry gets created if info_id is not set or 0
704
+	 *
705
+	 * checks and asures ACL
706
+	 *
707
+	 * @param array &$values values to write
708
+	 * @param boolean $check_defaults = true check and set certain defaults
709
+	 * @param boolean|int $touch_modified = true touch the modification date and sets the modifier's user-id, 2: only modifier
710
+	 * @param boolean $user2server = true conversion between user- and server-time necessary
711
+	 * @param boolean $skip_notification = false true = do NOT send notification, false (default) = send notifications
712
+	 * @param boolean $throw_exception = false Throw an exception (if required fields are not set)
713
+	 * @param string $purge_cfs = null null=dont, 'ical'=only iCal X-properties (cfs name starting with "#"), 'all'=all cfs
714
+	 *
715
+	 * @return int|boolean info_id on a successfull write or false
716
+	 */
717 717
 	function write(&$values_in, $check_defaults=true, $touch_modified=true, $user2server=true,
718 718
 		$skip_notification=false, $throw_exception=false, $purge_cfs=null)
719 719
 	{
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 			}
751 751
 		}
752 752
 		if ($values['info_id'] && !$this->check_access($values['info_id'],EGW_ACL_EDIT) && !$status_only ||
753
-		    !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],EGW_ACL_ADD))
753
+			!$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],EGW_ACL_ADD))
754 754
 		{
755 755
 			return false;
756 756
 		}
Please login to merge, or discard this patch.
Spacing   +243 added lines, -244 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @version $Id$
12 12
  */
13 13
 
14
-define('EGW_ACL_UNDELETE',EGW_ACL_CUSTOM_1);	// undelete right
14
+define('EGW_ACL_UNDELETE', EGW_ACL_CUSTOM_1); // undelete right
15 15
 
16 16
 /**
17 17
  * This class is the BO-layer of InfoLog
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	var $total;
34 34
 	var $vfs;
35
-	var $vfs_basedir='/infolog';
35
+	var $vfs_basedir = '/infolog';
36 36
 	/**
37 37
 	 * Set Logging
38 38
 	 *
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @var array
59 59
 	 */
60
-	var $timestamps = array('info_startdate','info_enddate','info_datemodified','info_datecompleted','info_created');
60
+	var $timestamps = array('info_startdate', 'info_enddate', 'info_datemodified', 'info_datecompleted', 'info_created');
61 61
 	/**
62 62
 	 * fields the responsible user can change
63 63
 	 *
64 64
 	 * @var array
65 65
 	 */
66
-	var $responsible_edit=array('info_status','info_percent','info_datecompleted');
66
+	var $responsible_edit = array('info_status', 'info_percent', 'info_datecompleted');
67 67
 	/**
68 68
 	 * Fields to exclude from copy, if an entry is copied, the ones below are excluded by default.
69 69
 	 *
@@ -87,19 +87,19 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @var string
89 89
 	 */
90
-	var $implicit_rights='read';
90
+	var $implicit_rights = 'read';
91 91
 	/**
92 92
 	 * Custom fields read from the infolog config
93 93
 	 *
94 94
 	 * @var array
95 95
 	 */
96
-	var $customfields=array();
96
+	var $customfields = array();
97 97
 	/**
98 98
 	 * Group owners for certain types read from the infolog config
99 99
 	 *
100 100
 	 * @var array
101 101
 	 */
102
-	var $group_owners=array();
102
+	var $group_owners = array();
103 103
 	/**
104 104
 	 * Current user
105 105
 	 *
@@ -166,55 +166,55 @@  discard block
 block discarded – undo
166 166
 	function __construct($info_id = 0)
167 167
 	{
168 168
 		$this->enums = $this->stock_enums = array(
169
-			'priority' => array (
169
+			'priority' => array(
170 170
 				3 => 'urgent',
171 171
 				2 => 'high',
172 172
 				1 => 'normal',
173 173
 				0 => 'low'
174 174
 			),
175 175
 			'confirm'   => array(
176
-				'not' => 'not','accept' => 'accept','finish' => 'finish',
176
+				'not' => 'not', 'accept' => 'accept', 'finish' => 'finish',
177 177
 				'both' => 'both' ),
178 178
 			'type'      => array(
179
-				'task' => 'task','phone' => 'phone','note' => 'note','email' => 'email'
179
+				'task' => 'task', 'phone' => 'phone', 'note' => 'note', 'email' => 'email'
180 180
 			/*	,'confirm' => 'confirm','reject' => 'reject','fax' => 'fax' not implemented so far */ )
181 181
 		);
182 182
 		$this->status = $this->stock_status = array(
183 183
 			'defaults' => array(
184
-				'task' => 'not-started', 'phone' => 'not-started', 'note' => 'done','email' => 'done'),
184
+				'task' => 'not-started', 'phone' => 'not-started', 'note' => 'done', 'email' => 'done'),
185 185
 			'task' => array(
186
-				'offer' => 'offer',				// -->  NEEDS-ACTION
187
-				'not-started' => 'not-started',	// iCal NEEDS-ACTION
188
-				'ongoing' => 'ongoing',			// iCal IN-PROCESS
189
-				'done' => 'done',				// iCal COMPLETED
190
-				'cancelled' => 'cancelled',		// iCal CANCELLED
191
-				'billed' => 'billed',			// -->  DONE
192
-				'template' => 'template',		// -->  cancelled
193
-				'nonactive' => 'nonactive',		// -->  cancelled
194
-				'archive' => 'archive' ), 		// -->  cancelled
186
+				'offer' => 'offer', // -->  NEEDS-ACTION
187
+				'not-started' => 'not-started', // iCal NEEDS-ACTION
188
+				'ongoing' => 'ongoing', // iCal IN-PROCESS
189
+				'done' => 'done', // iCal COMPLETED
190
+				'cancelled' => 'cancelled', // iCal CANCELLED
191
+				'billed' => 'billed', // -->  DONE
192
+				'template' => 'template', // -->  cancelled
193
+				'nonactive' => 'nonactive', // -->  cancelled
194
+				'archive' => 'archive' ), // -->  cancelled
195 195
 			'phone' => array(
196
-				'not-started' => 'call',		// iCal NEEDS-ACTION
197
-				'ongoing' => 'will-call',		// iCal IN-PROCESS
198
-				'done' => 'done', 				// iCal COMPLETED
199
-				'billed' => 'billed' ),			// -->  DONE
196
+				'not-started' => 'call', // iCal NEEDS-ACTION
197
+				'ongoing' => 'will-call', // iCal IN-PROCESS
198
+				'done' => 'done', // iCal COMPLETED
199
+				'billed' => 'billed' ), // -->  DONE
200 200
 			'note' => array(
201
-				'ongoing' => 'ongoing',			// iCal has no status on notes
201
+				'ongoing' => 'ongoing', // iCal has no status on notes
202 202
 				'done' => 'done' ),
203 203
 			'email' => array(
204
-				'ongoing' => 'ongoing',			// iCal has no status on notes
204
+				'ongoing' => 'ongoing', // iCal has no status on notes
205 205
 				'done' => 'done' ),
206 206
 		);
207 207
 		if (($config_data = config::read('infolog')))
208 208
 		{
209 209
 			if (isset($config_data['status']) && is_array($config_data['status']))
210 210
 			{
211
-				foreach(array_keys($config_data['status']) as $key)
211
+				foreach (array_keys($config_data['status']) as $key)
212 212
 				{
213 213
 					if (!is_array($this->status[$key]))
214 214
 					{
215 215
 						$this->status[$key] = array();
216 216
 					}
217
-					$this->status[$key] = array_merge($this->status[$key],(array)$config_data['status'][$key]);
217
+					$this->status[$key] = array_merge($this->status[$key], (array)$config_data['status'][$key]);
218 218
 				}
219 219
 			}
220 220
 			if (isset($config_data['types']) && is_array($config_data['types']))
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 			$this->customfields = egw_customfields::get('infolog');
230 230
 			if ($this->customfields)
231 231
 			{
232
-				foreach($this->customfields as $name => $field)
232
+				foreach ($this->customfields as $name => $field)
233 233
 				{
234 234
 					// old infolog customefield record
235
-					if(empty($field['type']))
235
+					if (empty($field['type']))
236 236
 					{
237 237
 						if (count($field['values'])) $field['type'] = 'select'; // selectbox
238 238
 						elseif ($field['rows'] > 1) $field['type'] = 'textarea'; // textarea
@@ -244,23 +244,23 @@  discard block
 block discarded – undo
244 244
 						$save_config = true;
245 245
 					}
246 246
 				}
247
-				if ($save_config) config::save_value('customfields',$this->customfields,'infolog');
247
+				if ($save_config) config::save_value('customfields', $this->customfields, 'infolog');
248 248
 			}
249 249
 			if (is_array($config_data['responsible_edit']))
250 250
 			{
251
-				$this->responsible_edit = array_merge($this->responsible_edit,$config_data['responsible_edit']);
251
+				$this->responsible_edit = array_merge($this->responsible_edit, $config_data['responsible_edit']);
252 252
 			}
253 253
 			if (is_array($config_data['copy_excludefields']))
254 254
 			{
255
-				$this->copy_excludefields = array_merge($this->copy_excludefields,$config_data['copy_excludefields']);
255
+				$this->copy_excludefields = array_merge($this->copy_excludefields, $config_data['copy_excludefields']);
256 256
 			}
257 257
 			if (is_array($config_data['sub_excludefields']) && $config_data['sub_excludefields'])
258 258
 			{
259
-				$this->sub_excludefields = array_merge($this->sub_excludefields,$config_data['sub_excludefields']);
259
+				$this->sub_excludefields = array_merge($this->sub_excludefields, $config_data['sub_excludefields']);
260 260
 			}
261 261
 			else
262 262
 			{
263
-				$this->sub_excludefields = array_merge($this->sub_excludefields,$this->default_sub_excludefields);
263
+				$this->sub_excludefields = array_merge($this->sub_excludefields, $this->default_sub_excludefields);
264 264
 			}
265 265
 			if ($config_data['implicit_rights'] == 'edit')
266 266
 			{
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 			$this->history = $config_data['history'];
270 270
 		}
271 271
 		// sort types by there translation
272
-		foreach($this->enums['type'] as $key => $val)
272
+		foreach ($this->enums['type'] as $key => $val)
273 273
 		{
274 274
 			if (($val = lang($key)) != $key.'*') $this->enums['type'][$key] = lang($key);
275 275
 		}
@@ -278,14 +278,14 @@  discard block
 block discarded – undo
278 278
 		$this->user = $GLOBALS['egw_info']['user']['account_id'];
279 279
 
280 280
 		$this->now = time();
281
-		$this->user_time_now = egw_time::server2user($this->now,'ts');
281
+		$this->user_time_now = egw_time::server2user($this->now, 'ts');
282 282
 
283
-		$this->grants = $GLOBALS['egw']->acl->get_grants('infolog',$this->group_owners ? $this->group_owners : true);
283
+		$this->grants = $GLOBALS['egw']->acl->get_grants('infolog', $this->group_owners ? $this->group_owners : true);
284 284
 		$this->so = new infolog_so($this->grants);
285 285
 
286 286
 		if ($info_id)
287 287
 		{
288
-			$this->read( $info_id );
288
+			$this->read($info_id);
289 289
 		}
290 290
 		else
291 291
 		{
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 	 * @param boolean $links = false if true check only customfields containing links, default false = all custom fields
301 301
 	 * @return boolean True if there are customfields for $typ, else False
302 302
 	 */
303
-	function has_customfields($type,$links=false)
303
+	function has_customfields($type, $links = false)
304 304
 	{
305 305
 		if ($links) $link_types = customfields_widget::get_customfield_link_types();
306 306
 
307
-		foreach($this->customfields as $field)
307
+		foreach ($this->customfields as $field)
308 308
 		{
309
-			if ((!$type || empty($field['type2']) || in_array($type,is_array($field['type2']) ? $field['type2'] : explode(',',$field['type2']))) &&
310
-				(!$links || in_array($field['type'],$link_types)))
309
+			if ((!$type || empty($field['type2']) || in_array($type, is_array($field['type2']) ? $field['type2'] : explode(',', $field['type2']))) &&
310
+				(!$links || in_array($field['type'], $link_types)))
311 311
 			{
312 312
 				return True;
313 313
 			}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 * @param int $user = null user whos rights to check, default current user
325 325
 	 * @return boolean
326 326
 	 */
327
-	function check_access($info,$required_rights,$other=0,$user=null)
327
+	function check_access($info, $required_rights, $other = 0, $user = null)
328 328
 	{
329 329
 		static $cache = array();
330 330
 
@@ -334,17 +334,17 @@  discard block
 block discarded – undo
334 334
 		if ($user == $this->user)
335 335
 		{
336 336
 			$grants = $this->grants;
337
-			if ($info_id) $access =& $cache[$info_id][$required_rights];	// we only cache the current user!
337
+			if ($info_id) $access = & $cache[$info_id][$required_rights]; // we only cache the current user!
338 338
 		}
339 339
 		else
340 340
 		{
341
-			$grants = $GLOBALS['egw']->acl->get_grants('infolog',$this->group_owners ? $this->group_owners : true,$user);
341
+			$grants = $GLOBALS['egw']->acl->get_grants('infolog', $this->group_owners ? $this->group_owners : true, $user);
342 342
 		}
343 343
 		if (!$info)
344 344
 		{
345 345
 			$owner = $other ? $other : $user;
346 346
 			$grant = $grants[$owner];
347
-			return $grant & $required_rights;
347
+			return $grant&$required_rights;
348 348
 		}
349 349
 
350 350
 
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 				if (!is_array($info) && !($info = $this->so->read(array('info_id' => $info_id)))) return false;
357 357
 
358 358
 				if ($info['info_status'] == 'deleted' &&
359
-					($required_rights == EGW_ACL_EDIT ||		// no edit rights for deleted entries
360
-					 $required_rights == EGW_ACL_ADD  ||		// no add rights for deleted entries
359
+					($required_rights == EGW_ACL_EDIT || // no edit rights for deleted entries
360
+					 $required_rights == EGW_ACL_ADD || // no add rights for deleted entries
361 361
 					 $required_rights == EGW_ACL_DELETE && ($this->history == 'history_no_delete' || // no delete at all!
362
-					 $this->history == 'history_admin_delete' && (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || $user!=$this->user))))	// delete only for admins
362
+					 $this->history == 'history_admin_delete' && (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || $user != $this->user))))	// delete only for admins
363 363
 				{
364 364
 					$access = false;
365 365
 				}
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 				{
368 368
 					if ($info['info_status'] != 'deleted')
369 369
 					{
370
-						$access = false;	// can only undelete deleted items
370
+						$access = false; // can only undelete deleted items
371 371
 					}
372 372
 					else
373 373
 					{
374 374
 						// undelete requires edit rights
375
-						$access = $this->so->check_access( $info,EGW_ACL_EDIT,$this->implicit_rights == 'edit',$grants,$user );
375
+						$access = $this->so->check_access($info, EGW_ACL_EDIT, $this->implicit_rights == 'edit', $grants, $user);
376 376
 					}
377 377
 				}
378 378
 			}
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 			}
383 383
 			if (!isset($access))
384 384
 			{
385
-				$access = $this->so->check_access( $info,$required_rights,$this->implicit_rights == 'edit',$grants,$user );
385
+				$access = $this->so->check_access($info, $required_rights, $this->implicit_rights == 'edit', $grants, $user);
386 386
 			}
387 387
 		}
388 388
 		// else $cached = ' (from cache)';
@@ -417,12 +417,12 @@  discard block
 block discarded – undo
417 417
 	 * @param string $not_id = '' id to exclude
418 418
 	 * @return boolean True if we have a linked item, False otherwise
419 419
 	 */
420
-	function link_id2from(&$info,$not_app='',$not_id='')
420
+	function link_id2from(&$info, $not_app = '', $not_id = '')
421 421
 	{
422 422
 		//echo "<p>boinfolog::link_id2from(subject='$info[info_subject]', link_id='$info[info_link_id]', from='$info[info_from]', not_app='$not_app', not_id='$not_id')";
423 423
 
424 424
 		if ($info['info_link_id'] > 0 &&
425
-			(isset($info['links']) && ($link = $info['links'][$info['info_link_id']]) ||	// use supplied links info
425
+			(isset($info['links']) && ($link = $info['links'][$info['info_link_id']]) || // use supplied links info
426 426
 			 ($link = egw_link::get_link($info['info_link_id'])) !== False))	// if link not found in supplied links, we always search!
427 427
 		{
428 428
 			if (isset($info['links']) && isset($link['app']))
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
 				$app = $link['link_app'.$nr];
437 437
 				$id  = $link['link_id'.$nr];
438 438
 			}
439
-			$title = egw_link::title($app,$id);
439
+			$title = egw_link::title($app, $id);
440 440
 
441 441
 			if ((string)$info['info_custom_from'] === '')	// old entry
442 442
 			{
443
-				$info['info_custom_from'] = (int) ($title != $info['info_from'] && @htmlentities($title) != $info['info_from']);
443
+				$info['info_custom_from'] = (int)($title != $info['info_from'] && @htmlentities($title) != $info['info_from']);
444 444
 			}
445 445
 			if (!$info['info_custom_from'])
446 446
 			{
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 			return $info['blur_title'] = $title;
463 463
 		}
464 464
 		$info['info_link'] = array('title' => $info['info_from']);
465
-		$info['info_link_id'] = 0;	// link might have been deleted
465
+		$info['info_link_id'] = 0; // link might have been deleted
466 466
 		$info['info_custom_from'] = (int)!!$info['info_from'];
467 467
 
468 468
 		return False;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 	 */
474 474
 	static function subject_from_des($des)
475 475
 	{
476
-		return substr($des,0,60).' ...';
476
+		return substr($des, 0, 60).' ...';
477 477
 	}
478 478
 
479 479
 	/**
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 	 * 			or NULL for timestamps in user-time
489 489
 	 * 			or false for timestamps in server-time
490 490
 	 */
491
-	 function time2time(&$values, $fromTZId=false, $toTZId=null)
491
+	 function time2time(&$values, $fromTZId = false, $toTZId = null)
492 492
 	 {
493 493
 
494 494
 		if ($fromTZId === $toTZId) return;
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 			$toTZ = egw_time::$server_timezone;
530 530
 		}
531 531
 		//error_log(__METHOD__.'(values[info_enddate]='.date('Y-m-d H:i:s',$values['info_enddate']).", from=".array2string($fromTZId).", to=".array2string($toTZId).") tz=".$tz->getName().', fromTZ='.$fromTZ->getName().', toTZ='.$toTZ->getName().', userTZ='.egw_time::$user_timezone->getName());
532
-	 	foreach($this->timestamps as $key)
532
+	 	foreach ($this->timestamps as $key)
533 533
 		{
534 534
 		 	if ($values[$key])
535 535
 		 	{
@@ -538,14 +538,14 @@  discard block
 block discarded – undo
538 538
 			 	if ($time->format('Hi') == '0000')
539 539
 			 	{
540 540
 				 	// we keep dates the same in new timezone
541
-				 	$arr = egw_time::to($time,'array');
541
+				 	$arr = egw_time::to($time, 'array');
542 542
 				 	$time = new egw_time($arr, $toTZ);
543 543
 			 	}
544 544
 			 	else
545 545
 			 	{
546 546
 				 	$time->setTimezone($toTZ);
547 547
 			 	}
548
-			 	$values[$key] = egw_time::to($time,'ts');
548
+			 	$values[$key] = egw_time::to($time, 'ts');
549 549
 		 	}
550 550
 		}
551 551
 		//error_log(__METHOD__.'() --> values[info_enddate]='.date('Y-m-d H:i:s',$values['info_enddate']));
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 	 * @param string $date_format = 'ts' date-formats: 'ts'=timestamp, 'server'=timestamp in server-time, 'array'=array or string with date-format
559 559
 	 * @return mixed depending of $date_format
560 560
 	 */
561
-	function date2usertime($ts,$date_format='ts')
561
+	function date2usertime($ts, $date_format = 'ts')
562 562
 	{
563 563
 		if (empty($ts) || $date_format == 'server') return $ts;
564 564
 
565
-		return egw_time::server2user($ts,$date_format);
565
+		return egw_time::server2user($ts, $date_format);
566 566
 	}
567 567
 
568 568
 	/**
@@ -577,10 +577,10 @@  discard block
 block discarded – undo
577 577
 	 *
578 578
 	 * @return array|boolean infolog entry, null if not found or false if no permission to read it
579 579
 	 */
580
-	function &read($info_id,$run_link_id2from=true,$date_format='ts',$ignore_acl=false)
580
+	function &read($info_id, $run_link_id2from = true, $date_format = 'ts', $ignore_acl = false)
581 581
 	{
582 582
 		//error_log(__METHOD__.'('.array2string($info_id).', '.array2string($run_link_id2from).", '$date_format') ".function_backtrace());
583
-		if (is_scalar($info_id) || isset($info_id[count($info_id)-1]))
583
+		if (is_scalar($info_id) || isset($info_id[count($info_id) - 1]))
584 584
 		{
585 585
 			if (is_scalar($info_id) && !is_numeric($info_id))
586 586
 			{
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
 		{
597 597
 			return null;
598 598
 		}
599
-		$info_id = $data['info_id'];	// in case the uid was specified
599
+		$info_id = $data['info_id']; // in case the uid was specified
600 600
 
601
-		if (!$ignore_acl && !$this->check_access($data,EGW_ACL_READ))	// check behind read, to prevent a double read
601
+		if (!$ignore_acl && !$this->check_access($data, EGW_ACL_READ))	// check behind read, to prevent a double read
602 602
 		{
603 603
 			return False;
604 604
 		}
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * @param boolean $skip_notification Do not send notification of delete
631 631
 	 * @return boolean True if delete was successful, False otherwise ($info_id does not exist or no rights)
632 632
 	 */
633
-	function delete($info_id,$delete_children=False,$new_parent=False, $skip_notification=False)
633
+	function delete($info_id, $delete_children = False, $new_parent = False, $skip_notification = False)
634 634
 	{
635 635
 		if (is_array($info_id))
636 636
 		{
@@ -640,18 +640,18 @@  discard block
 block discarded – undo
640 640
 		{
641 641
 			return False;
642 642
 		}
643
-		if (!$this->check_access($info,EGW_ACL_DELETE))
643
+		if (!$this->check_access($info, EGW_ACL_DELETE))
644 644
 		{
645 645
 			return False;
646 646
 		}
647 647
 		// check if we have children and delete or re-parent them
648 648
 		if (($children = $this->so->get_children($info_id)))
649 649
 		{
650
-			foreach($children as $id => $owner)
650
+			foreach ($children as $id => $owner)
651 651
 			{
652
-				if ($delete_children && $this->so->grants[$owner] & EGW_ACL_DELETE)
652
+				if ($delete_children && $this->so->grants[$owner]&EGW_ACL_DELETE)
653 653
 				{
654
-					$this->delete($id,$delete_children,$new_parent,$skip_notification);	// call ourself recursive to delete the child
654
+					$this->delete($id, $delete_children, $new_parent, $skip_notification); // call ourself recursive to delete the child
655 655
 				}
656 656
 				else	// dont delete or no rights to delete the child --> re-parent it
657 657
 				{
@@ -670,30 +670,30 @@  discard block
 block discarded – undo
670 670
 		// if we have history switched on and not an already deleted item --> set only status deleted
671 671
 		if ($this->history && $info['info_status'] != 'deleted')
672 672
 		{
673
-			if ($info['info_status'] == 'deleted') return false;	// entry already deleted
673
+			if ($info['info_status'] == 'deleted') return false; // entry already deleted
674 674
 
675 675
 			$this->so->write($deleted);
676 676
 
677
-			egw_link::unlink(0,'infolog',$info_id,'','!file','',true);	// keep the file attachments, hide the rest
677
+			egw_link::unlink(0, 'infolog', $info_id, '', '!file', '', true); // keep the file attachments, hide the rest
678 678
 		}
679 679
 		else
680 680
 		{
681
-			$this->so->delete($info_id,false);	// we delete the children via bo to get all notifications!
681
+			$this->so->delete($info_id, false); // we delete the children via bo to get all notifications!
682 682
 
683
-			egw_link::unlink(0,'infolog',$info_id);
683
+			egw_link::unlink(0, 'infolog', $info_id);
684 684
 		}
685 685
 		if ($info['info_status'] != 'deleted')	// dont notify of final purge of already deleted items
686 686
 		{
687 687
 			$GLOBALS['egw']->contenthistory->updateTimeStamp('infolog_'.$info['info_type'], $info_id, 'delete', time());
688 688
 
689 689
 			// send email notifications and do the history logging
690
-			if(!$skip_notification)
690
+			if (!$skip_notification)
691 691
 			{
692 692
 				if (!is_object($this->tracking))
693 693
 				{
694 694
 					$this->tracking = new infolog_tracking($this);
695 695
 				}
696
-				$this->tracking->track($deleted,$info,$this->user,true);
696
+				$this->tracking->track($deleted, $info, $this->user, true);
697 697
 			}
698 698
 		}
699 699
 		return True;
@@ -714,13 +714,13 @@  discard block
 block discarded – undo
714 714
 	*
715 715
 	* @return int|boolean info_id on a successfull write or false
716 716
 	*/
717
-	function write(&$values_in, $check_defaults=true, $touch_modified=true, $user2server=true,
718
-		$skip_notification=false, $throw_exception=false, $purge_cfs=null)
717
+	function write(&$values_in, $check_defaults = true, $touch_modified = true, $user2server = true,
718
+		$skip_notification = false, $throw_exception = false, $purge_cfs = null)
719 719
 	{
720 720
 		$values = $values_in;
721 721
 		//echo "boinfolog::write()values="; _debug_array($values);
722
-		if (!$values['info_id'] && !$this->check_access(0,EGW_ACL_EDIT,$values['info_owner']) &&
723
-			!$this->check_access(0,EGW_ACL_ADD,$values['info_owner']))
722
+		if (!$values['info_id'] && !$this->check_access(0, EGW_ACL_EDIT, $values['info_owner']) &&
723
+			!$this->check_access(0, EGW_ACL_ADD, $values['info_owner']))
724 724
 		{
725 725
 			return false;
726 726
 		}
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 			$old = $this->read($values['info_id'], false, 'server');
731 731
 		}
732 732
 
733
-		if (($status_only = $values['info_id'] && !$this->check_access($values,EGW_ACL_EDIT)))
733
+		if (($status_only = $values['info_id'] && !$this->check_access($values, EGW_ACL_EDIT)))
734 734
 		{
735 735
 			if (!isset($values['info_responsible']))
736 736
 			{
@@ -742,31 +742,31 @@  discard block
 block discarded – undo
742 742
 			}
743 743
 			if (!($status_only = in_array($this->user, (array)$responsible)))	// responsible has implicit right to change status
744 744
 			{
745
-				$status_only = !!array_intersect((array)$responsible,array_keys($GLOBALS['egw']->accounts->memberships($this->user)));
745
+				$status_only = !!array_intersect((array)$responsible, array_keys($GLOBALS['egw']->accounts->memberships($this->user)));
746 746
 			}
747 747
 			if (!$status_only && $values['info_status'] != 'deleted')
748 748
 			{
749
-				$status_only = $undelete = $this->check_access($values['info_id'],EGW_ACL_UNDELETE);
749
+				$status_only = $undelete = $this->check_access($values['info_id'], EGW_ACL_UNDELETE);
750 750
 			}
751 751
 		}
752
-		if ($values['info_id'] && !$this->check_access($values['info_id'],EGW_ACL_EDIT) && !$status_only ||
753
-		    !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],EGW_ACL_ADD))
752
+		if ($values['info_id'] && !$this->check_access($values['info_id'], EGW_ACL_EDIT) && !$status_only ||
753
+		    !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'], EGW_ACL_ADD))
754 754
 		{
755 755
 			return false;
756 756
 		}
757 757
 		
758 758
 		// Make sure status is still valid if the type changes
759
-		if($old['info_type'] != $values['info_type'] && $values['info_status'])
759
+		if ($old['info_type'] != $values['info_type'] && $values['info_status'])
760 760
 		{
761
-			if(!in_array($values['info_status'], array_keys($this->status[$values['info_type']])))
761
+			if (!in_array($values['info_status'], array_keys($this->status[$values['info_type']])))
762 762
 			{
763 763
 				$values['info_status'] = $this->status['defaults'][$values['info_type']];
764 764
 			}
765 765
 		}
766 766
 		if ($status_only && !$undelete)	// make sure only status gets writen
767 767
 		{
768
-			$set_completed = !$values['info_datecompleted'] &&	// set date completed of finished job, only if its not already set
769
-				in_array($values['info_status'],array('done','billed','cancelled'));
768
+			$set_completed = !$values['info_datecompleted'] && // set date completed of finished job, only if its not already set
769
+				in_array($values['info_status'], array('done', 'billed', 'cancelled'));
770 770
 
771 771
 			$values = $old;
772 772
 			// only overwrite explicitly allowed fields
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 				$values['info_percent'] = 100;
782 782
 				$forcestatus = true;
783 783
 				$status = 'done';
784
-				if (isset($values['info_type']) && !in_array($values['info_status'],array('done','billed','cancelled'))) {
784
+				if (isset($values['info_type']) && !in_array($values['info_status'], array('done', 'billed', 'cancelled'))) {
785 785
 					$forcestatus = false;
786 786
 					//echo "set_completed:"; _debug_array($this->status[$values['info_type']]);
787 787
 					if (isset($this->status[$values['info_type']]['done'])) {
@@ -795,19 +795,19 @@  discard block
 block discarded – undo
795 795
 						$status = 'cancelled';
796 796
 					}
797 797
 				}
798
-				if ($forcestatus && !in_array($values['info_status'],array('done','billed','cancelled'))) $values['info_status'] = $status;
798
+				if ($forcestatus && !in_array($values['info_status'], array('done', 'billed', 'cancelled'))) $values['info_status'] = $status;
799 799
 			}
800 800
 			$check_defaults = false;
801 801
 		}
802 802
 		if ($check_defaults)
803 803
 		{
804 804
 			if (!$values['info_datecompleted'] &&
805
-				(in_array($values['info_status'],array('done','billed'))))
805
+				(in_array($values['info_status'], array('done', 'billed'))))
806 806
 			{
807
-				$values['info_datecompleted'] = $user2server ? $this->user_time_now : $this->now;	// set date completed to today if status == done
807
+				$values['info_datecompleted'] = $user2server ? $this->user_time_now : $this->now; // set date completed to today if status == done
808 808
 			}
809 809
 			// Check for valid status / percent combinations
810
-			if (in_array($values['info_status'],array('done','billed')))
810
+			if (in_array($values['info_status'], array('done', 'billed')))
811 811
 			{
812 812
 				$values['info_percent'] = 100;
813 813
 			}
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
 				// We change percent to match status, not status to match percent
823 823
 				$values['info_percent'] = 10;
824 824
 			}
825
-			if ((int)$values['info_percent'] == 100 && !in_array($values['info_status'],array('done','billed','cancelled','archive')))
825
+			if ((int)$values['info_percent'] == 100 && !in_array($values['info_status'], array('done', 'billed', 'cancelled', 'archive')))
826 826
 			{
827 827
 				//echo "check_defaults:"; _debug_array($this->status[$values['info_type']]);
828 828
 				//$values['info_status'] = 'done';
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 			}
844 844
 			if ($values['info_responsible'] && $values['info_status'] == 'offer')
845 845
 			{
846
-				$values['info_status'] = 'not-started';   // have to match if not finished
846
+				$values['info_status'] = 'not-started'; // have to match if not finished
847 847
 			}
848 848
 			if (isset($values['info_subject']) && empty($values['info_subject']))
849 849
 			{
@@ -851,18 +851,18 @@  discard block
 block discarded – undo
851 851
 			}
852 852
 
853 853
 			// Check required custom fields
854
-			if($throw_exception)
854
+			if ($throw_exception)
855 855
 			{
856 856
 				$custom = egw_customfields::get('infolog');
857
-				foreach($custom as $c_name => $c_field)
857
+				foreach ($custom as $c_name => $c_field)
858 858
 				{
859
-					if($c_field['type2']) $type2 = is_array($c_field['type2']) ? $c_field['type2'] : explode(',',$c_field['type2']);
860
-					if($c_field['needed'] && (!$c_field['type2'] || $c_field['type2'] && in_array($values['info_type'],$type2)))
859
+					if ($c_field['type2']) $type2 = is_array($c_field['type2']) ? $c_field['type2'] : explode(',', $c_field['type2']);
860
+					if ($c_field['needed'] && (!$c_field['type2'] || $c_field['type2'] && in_array($values['info_type'], $type2)))
861 861
 					{
862 862
 						// Required custom field
863
-						if(!$values['#'.$c_name])
863
+						if (!$values['#'.$c_name])
864 864
 						{
865
-							throw new egw_exception_wrong_userinput(lang('For infolog type %1, %2 is required',lang($values['info_type']),$c_field['label']));
865
+							throw new egw_exception_wrong_userinput(lang('For infolog type %1, %2 is required', lang($values['info_type']), $c_field['label']));
866 866
 						}
867 867
 					}
868 868
 				}
@@ -871,16 +871,16 @@  discard block
 block discarded – undo
871 871
 		if (isset($this->group_owners[$values['info_type']]))
872 872
 		{
873 873
 			$values['info_owner'] = $this->group_owners[$values['info_type']];
874
-			if (!($this->grants[$this->group_owners[$values['info_type']]] & EGW_ACL_EDIT))
874
+			if (!($this->grants[$this->group_owners[$values['info_type']]]&EGW_ACL_EDIT))
875 875
 			{
876
-				if (!$this->check_access($values['info_id'],EGW_ACL_EDIT) ||
877
-					!$values['info_id'] && !$this->check_access($values,EGW_ACL_ADD)
876
+				if (!$this->check_access($values['info_id'], EGW_ACL_EDIT) ||
877
+					!$values['info_id'] && !$this->check_access($values, EGW_ACL_ADD)
878 878
 				)
879 879
 				{
880
-					return false;	// no edit rights from the group-owner and no implicit rights (delegated and sufficient rights)
880
+					return false; // no edit rights from the group-owner and no implicit rights (delegated and sufficient rights)
881 881
 				}
882 882
 			}
883
-			$values['info_access'] = 'public';	// group-owners are allways public
883
+			$values['info_access'] = 'public'; // group-owners are allways public
884 884
 		}
885 885
 		elseif (!$values['info_id'] && !$values['info_owner'] || $GLOBALS['egw']->accounts->get_type($values['info_owner']) == 'g')
886 886
 		{
@@ -955,23 +955,23 @@  discard block
 block discarded – undo
955 955
 			$to_write['info_id'] = $info_id;
956 956
 
957 957
 			// if the info responbsible array is not passed, fetch it from old.
958
-			if (!array_key_exists('info_responsible',$values)) $values['info_responsible'] = $old['info_responsible'];
958
+			if (!array_key_exists('info_responsible', $values)) $values['info_responsible'] = $old['info_responsible'];
959 959
 			if (!is_array($values['info_responsible']))		// this should not happen, bug it does ;-)
960 960
 			{
961
-				$values['info_responsible'] = $values['info_responsible'] ? explode(',',$values['info_responsible']) : array();
961
+				$values['info_responsible'] = $values['info_responsible'] ? explode(',', $values['info_responsible']) : array();
962 962
 				$to_write['info_responsible'] = $values['info_responsible'];
963 963
 			}
964 964
 			// create (and remove) links in custom fields
965
-			customfields_widget::update_customfield_links('infolog',$values,$old,'info_id');
965
+			customfields_widget::update_customfield_links('infolog', $values, $old, 'info_id');
966 966
 
967 967
 			// Check for restore of deleted entry, restore held links
968
-			if($old['info_status'] == 'deleted' && $values['info_status'] != 'deleted')
968
+			if ($old['info_status'] == 'deleted' && $values['info_status'] != 'deleted')
969 969
 			{
970 970
 				egw_link::restore('infolog', $info_id);
971 971
 			}
972 972
 
973 973
 			// notify the link-class about the update, as other apps may be subscribt to it
974
-			egw_link::notify_update('infolog',$info_id,$values);
974
+			egw_link::notify_update('infolog', $info_id, $values);
975 975
 
976 976
 			// pre-cache the new values
977 977
 			self::set_link_cache($values);
@@ -982,42 +982,42 @@  discard block
 block discarded – undo
982 982
 				$this->tracking = new infolog_tracking($this);
983 983
 			}
984 984
 
985
-			if ($old && ($missing_fields = array_diff_key($old,$values)))
985
+			if ($old && ($missing_fields = array_diff_key($old, $values)))
986 986
 			{
987 987
 				// Some custom fields (multiselect with nothing selected) will be missing,
988 988
 				// and that's OK.  Don't put them back.
989
-				foreach(array_keys($missing_fields) as $field)
989
+				foreach (array_keys($missing_fields) as $field)
990 990
 				{
991
-					if(array_key_exists($field, $values_in))
991
+					if (array_key_exists($field, $values_in))
992 992
 					{
993 993
 						unset($missing_fields[$field]);
994 994
 					}
995 995
 				}
996
-				$values = array_merge($values,$missing_fields);
996
+				$values = array_merge($values, $missing_fields);
997 997
 			}
998 998
 			// Add keys missing in the $to_write array
999
-			if (($missing_fields = array_diff_key($values,$to_write)))
999
+			if (($missing_fields = array_diff_key($values, $to_write)))
1000 1000
 			{
1001
-				$to_write = array_merge($to_write,$missing_fields);
1001
+				$to_write = array_merge($to_write, $missing_fields);
1002 1002
 			}
1003
-			$this->tracking->track($to_write,$old,$this->user,$values['info_status'] == 'deleted' || $old['info_status'] == 'deleted',
1004
-				null,$skip_notification);
1003
+			$this->tracking->track($to_write, $old, $this->user, $values['info_status'] == 'deleted' || $old['info_status'] == 'deleted',
1004
+				null, $skip_notification);
1005 1005
 
1006 1006
 			if ($info_from_set) $values['info_from'] = '';
1007 1007
 
1008 1008
 			// Change new values back to user time before sending them back
1009
-			if($user2server)
1009
+			if ($user2server)
1010 1010
 			{
1011 1011
 				$this->time2time($values);
1012 1012
 			}
1013 1013
 			// merge changes (keeping extra values from the UI)
1014
-			$values_in = array_merge($values_in,$values);
1014
+			$values_in = array_merge($values_in, $values);
1015 1015
 
1016 1016
 			// Update modified timestamp of parent
1017
-			if($values['info_id_parent'])
1017
+			if ($values['info_id_parent'])
1018 1018
 			{
1019
-				$parent = $this->read($values['info_id_parent'], false, 'server',true);
1020
-				$this->write($parent,false, true, false, true);
1019
+				$parent = $this->read($values['info_id_parent'], false, 'server', true);
1020
+				$this->write($parent, false, true, false, true);
1021 1021
 			}
1022 1022
 		}
1023 1023
 		return $info_id;
@@ -1029,9 +1029,9 @@  discard block
 block discarded – undo
1029 1029
 	 * @param int|array $info_id id
1030 1030
 	 * @return int|array number of subs
1031 1031
 	 */
1032
-	function anzSubs( $info_id )
1032
+	function anzSubs($info_id)
1033 1033
 	{
1034
-		return $this->so->anzSubs( $info_id );
1034
+		return $this->so->anzSubs($info_id);
1035 1035
 	}
1036 1036
 
1037 1037
 	/**
@@ -1051,19 +1051,19 @@  discard block
 block discarded – undo
1051 1051
 	{
1052 1052
 		//error_log(__METHOD__.'('.array2string($query).')');
1053 1053
 
1054
-		if($query['filter'] == 'bydate')
1054
+		if ($query['filter'] == 'bydate')
1055 1055
 		{
1056 1056
 			if (is_int($query['startdate'])) $query['col_filter'][] = 'info_startdate >= '.$GLOBALS['egw']->db->quote($query['startdate']);
1057
-			if (is_int($query['enddate'])) $query['col_filter'][] = 'info_startdate <= '.$GLOBALS['egw']->db->quote($query['enddate']+(60*60*24)-1);
1057
+			if (is_int($query['enddate'])) $query['col_filter'][] = 'info_startdate <= '.$GLOBALS['egw']->db->quote($query['enddate'] + (60 * 60 * 24) - 1);
1058 1058
 		}
1059 1059
 		elseif ($query['filter'] == 'duedate')
1060 1060
 		{
1061 1061
 			if (is_int($query['startdate'])) $query['col_filter'][] = 'info_enddate >= '.$GLOBALS['egw']->db->quote($query['startdate']);
1062
-			if (is_int($query['enddate'])) $query['col_filter'][] = 'info_enddate <= '.$GLOBALS['egw']->db->quote($query['enddate']+(60*60*24)-1);
1062
+			if (is_int($query['enddate'])) $query['col_filter'][] = 'info_enddate <= '.$GLOBALS['egw']->db->quote($query['enddate'] + (60 * 60 * 24) - 1);
1063 1063
 		}
1064 1064
 		elseif ($query['filter'] == 'private')
1065 1065
 		{
1066
-			$query['col_filter'][] = 'info_access = ' . $GLOBALS['egw']->db->quote('private');
1066
+			$query['col_filter'][] = 'info_access = '.$GLOBALS['egw']->db->quote('private');
1067 1067
 		}
1068 1068
 		if (!isset($query['date_format']) || $query['date_format'] != 'server')
1069 1069
 		{
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 				{
1074 1074
 					if (!empty($query['col_filter'][$key]))
1075 1075
 					{
1076
-						$query['col_filter'][$key] = egw_time::user2server($query['col_filter'][$key],'ts');
1076
+						$query['col_filter'][$key] = egw_time::user2server($query['col_filter'][$key], 'ts');
1077 1077
 					}
1078 1078
 				}
1079 1079
 			}
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 		{
1087 1087
 			foreach ($ret as $id => &$data)
1088 1088
 			{
1089
-				if (!$this->check_access($data,EGW_ACL_READ))
1089
+				if (!$this->check_access($data, EGW_ACL_READ))
1090 1090
 				{
1091 1091
 					unset($ret[$id]);
1092 1092
 					continue;
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
 							if ($time->format('Hi') == '0000')
1103 1103
 							{
1104 1104
 								// we keep dates the same in user-time
1105
-								$arr = egw_time::to($time,'array');
1105
+								$arr = egw_time::to($time, 'array');
1106 1106
 								$time = new egw_time($arr, egw_time::$user_timezone);
1107 1107
 							}
1108 1108
 							else
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 								$time->setTimezone(egw_time::$user_timezone);
1111 1111
 							}
1112 1112
 						}
1113
-						$data[$key] = egw_time::to($time,'ts');
1113
+						$data[$key] = egw_time::to($time, 'ts');
1114 1114
 					}
1115 1115
 				}
1116 1116
 				// pre-cache title and file access
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 	 * @param array $filter = array('filter'=>'own','info_type'=>'task')
1128 1128
 	 * @return string
1129 1129
 	 */
1130
-	public function getctag(array $filter=array('filter'=>'own','info_type'=>'task'))
1130
+	public function getctag(array $filter = array('filter'=>'own', 'info_type'=>'task'))
1131 1131
 	{
1132 1132
 		$filter += array(
1133 1133
 			'order'			=> 'info_datemodified',
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 		// we need to query deleted entries too for a ctag!
1140 1140
 		$filter['filter'] .= '+deleted';
1141 1141
 
1142
-		$result =& $this->search($filter);
1142
+		$result = & $this->search($filter);
1143 1143
 
1144 1144
 		if (empty($result)) return 'EGw-empty-wGE';
1145 1145
 
@@ -1161,12 +1161,12 @@  discard block
 block discarded – undo
1161 1161
 	 * @param string $_date
1162 1162
 	 * @return array $content array for uiinfolog
1163 1163
 	 */
1164
-	function import_mail($_addresses,$_subject,$_message,$_attachments,$_date)
1164
+	function import_mail($_addresses, $_subject, $_message, $_attachments, $_date)
1165 1165
 	{
1166
-		foreach($_addresses as $address)
1166
+		foreach ($_addresses as $address)
1167 1167
 		{
1168 1168
 			$names[] = $address['name'];
1169
-			$emails[] =$address['email'];
1169
+			$emails[] = $address['email'];
1170 1170
 		}
1171 1171
 		
1172 1172
 		$type = isset($this->enums['type']['email']) ? 'email' : 'note';
@@ -1174,8 +1174,8 @@  discard block
 block discarded – undo
1174 1174
 		$info = array(
1175 1175
 			'info_id' => 0,
1176 1176
 			'info_type' => $type,
1177
-			'info_from' => implode(', ',$names),
1178
-			'info_addr' => implode(', ',$emails),
1177
+			'info_from' => implode(', ', $names),
1178
+			'info_addr' => implode(', ', $emails),
1179 1179
 			'info_subject' => $_subject,
1180 1180
 			'info_des' => $_message,
1181 1181
 			'info_startdate' => egw_time::server2user($_date),
@@ -1194,16 +1194,16 @@  discard block
 block discarded – undo
1194 1194
 		$contacts = array();
1195 1195
 		foreach ($emails as $mailadr)
1196 1196
 		{
1197
-			$contacts = array_merge($contacts,(array)$addressbook->search(
1197
+			$contacts = array_merge($contacts, (array)$addressbook->search(
1198 1198
 				array(
1199 1199
 					'email' => $mailadr,
1200 1200
 					'email_home' => $mailadr
1201
-				),True,'','','',false,'OR',false,null,'',false));
1201
+				), True, '', '', '', false, 'OR', false, null, '', false));
1202 1202
 		}
1203 1203
 		if (!$contacts || !is_array($contacts) || !is_array($contacts[0]))
1204 1204
 		{
1205
-			$info['msg'] = lang('Attention: No Contact with address %1 found.',$info['info_addr']);
1206
-			$info['info_custom_from'] = true;	// show the info_from line and NOT only the link
1205
+			$info['msg'] = lang('Attention: No Contact with address %1 found.', $info['info_addr']);
1206
+			$info['info_custom_from'] = true; // show the info_from line and NOT only the link
1207 1207
 		}
1208 1208
 		else
1209 1209
 		{
@@ -1213,21 +1213,21 @@  discard block
 block discarded – undo
1213 1213
 			// create the rest a "ordinary" links
1214 1214
 			foreach ($contacts as $contact)
1215 1215
 			{
1216
-				egw_link::link('infolog',$info['link_to']['to_id'],'addressbook',$contact['id']);
1216
+				egw_link::link('infolog', $info['link_to']['to_id'], 'addressbook', $contact['id']);
1217 1217
 			}
1218 1218
 		}
1219 1219
 		if (is_array($_attachments))
1220 1220
 		{
1221 1221
 			foreach ($_attachments as $attachment)
1222 1222
 			{
1223
-				if($attachment['egw_data'])
1223
+				if ($attachment['egw_data'])
1224 1224
 				{
1225
-					egw_link::link('infolog',$info['link_to']['to_id'],egw_link::DATA_APPNAME,  $attachment);
1225
+					egw_link::link('infolog', $info['link_to']['to_id'], egw_link::DATA_APPNAME, $attachment);
1226 1226
 				}
1227
-				else if(is_readable($attachment['tmp_name']) ||
1227
+				else if (is_readable($attachment['tmp_name']) ||
1228 1228
 					(egw_vfs::is_readable($attachment['tmp_name']) && parse_url($attachment['tmp_name'], PHP_URL_SCHEME) === 'vfs'))
1229 1229
 				{
1230
-					egw_link::link('infolog',$info['link_to']['to_id'],'file',  $attachment);
1230
+					egw_link::link('infolog', $info['link_to']['to_id'], 'file', $attachment);
1231 1231
 				}
1232 1232
 			}
1233 1233
 		}
@@ -1246,14 +1246,14 @@  discard block
 block discarded – undo
1246 1246
 	{
1247 1247
 		if (!is_array($info))
1248 1248
 		{
1249
-			$info = $this->read( $info,false );
1249
+			$info = $this->read($info, false);
1250 1250
 		}
1251 1251
 		if (!$info)
1252 1252
 		{
1253 1253
 			return $info;
1254 1254
 		}
1255
-		$title = !empty($info['info_subject']) ? $info['info_subject'] :self::subject_from_des($info['info_descr']);
1256
-		return $title.($GLOBALS['egw_info']['user']['preferences']['infolog']['show_id']?' (#'.$info['info_id'].')':'');
1255
+		$title = !empty($info['info_subject']) ? $info['info_subject'] : self::subject_from_des($info['info_descr']);
1256
+		return $title.($GLOBALS['egw_info']['user']['preferences']['infolog']['show_id'] ? ' (#'.$info['info_id'].')' : '');
1257 1257
 	}
1258 1258
 
1259 1259
 	/**
@@ -1264,15 +1264,15 @@  discard block
 block discarded – undo
1264 1264
 	function link_titles(array $ids)
1265 1265
 	{
1266 1266
 		$titles = array();
1267
-		foreach ($this->search($params=array(
1267
+		foreach ($this->search($params = array(
1268 1268
 			'col_filter' => array('info_id' => $ids),
1269 1269
 		)) as $info)
1270 1270
 		{
1271 1271
 			$titles[$info['info_id']] = $this->link_title($info);
1272 1272
 		}
1273
-		foreach (array_diff($ids,array_keys($titles)) as $id)
1273
+		foreach (array_diff($ids, array_keys($titles)) as $id)
1274 1274
 		{
1275
-			$titles[$id] = false;	// we assume every not returned entry to be not readable, as we notify the link class about all deletes
1275
+			$titles[$id] = false; // we assume every not returned entry to be not readable, as we notify the link class about all deletes
1276 1276
 		}
1277 1277
 		return $titles;
1278 1278
 	}
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 		$content = array();
1300 1300
 		if (is_array($ids))
1301 1301
 		{
1302
-			foreach(array_keys($ids) as $id)
1302
+			foreach (array_keys($ids) as $id)
1303 1303
 			{
1304 1304
 				$content[$id] = $this->link_title($id);
1305 1305
 			}
@@ -1316,10 +1316,10 @@  discard block
 block discarded – undo
1316 1316
 	 * @param int $user = null for which user to check, default current user
1317 1317
 	 * @return boolean true if access is granted or false otherwise
1318 1318
 	 */
1319
-	function file_access($id,$check,$rel_path=null,$user=null)
1319
+	function file_access($id, $check, $rel_path = null, $user = null)
1320 1320
 	{
1321
-		unset($rel_path);	// not used
1322
-		return $this->check_access($id,$check,0,$user);
1321
+		unset($rel_path); // not used
1322
+		return $this->check_access($id, $check, 0, $user);
1323 1323
 	}
1324 1324
 
1325 1325
 	/**
@@ -1329,10 +1329,9 @@  discard block
 block discarded – undo
1329 1329
 	 */
1330 1330
 	function set_link_cache(array $info)
1331 1331
 	{
1332
-		egw_link::set_cache('infolog',$info['info_id'],
1332
+		egw_link::set_cache('infolog', $info['info_id'],
1333 1333
 			$this->link_title($info),
1334
-			$this->file_access($info,EGW_ACL_EDIT) ? EGW_ACL_READ|EGW_ACL_EDIT :
1335
-			($this->file_access($info,EGW_ACL_READ) ? EGW_ACL_READ : 0));
1334
+			$this->file_access($info, EGW_ACL_EDIT) ? EGW_ACL_READ|EGW_ACL_EDIT : ($this->file_access($info, EGW_ACL_READ) ? EGW_ACL_READ : 0));
1336 1335
 	}
1337 1336
 
1338 1337
 	/**
@@ -1346,8 +1345,8 @@  discard block
 block discarded – undo
1346 1345
 	function cal_to_include($args)
1347 1346
 	{
1348 1347
 		//echo "<p>cal_to_include("; print_r($args); echo ")</p>\n";
1349
-		$user = (int) $args['owner'];
1350
-		if ($user <= 0 && !checkdate($args['month'],$args['day'],$args['year']))
1348
+		$user = (int)$args['owner'];
1349
+		if ($user <= 0 && !checkdate($args['month'], $args['day'], $args['year']))
1351 1350
 		{
1352 1351
 			return False;
1353 1352
 		}
@@ -1355,7 +1354,7 @@  discard block
 block discarded – undo
1355 1354
 
1356 1355
 		$do_events = $args['location'] == 'calendar_include_events';
1357 1356
 		$to_include = array();
1358
-		$date_wanted = sprintf('%04d/%02d/%02d',$args['year'],$args['month'],$args['day']);
1357
+		$date_wanted = sprintf('%04d/%02d/%02d', $args['year'], $args['month'], $args['day']);
1359 1358
 		$query = array(
1360 1359
 			'order' => 'info_startdate',
1361 1360
 			'sort'  => $do_events ? 'ASC' : 'DESC',
@@ -1364,32 +1363,32 @@  discard block
 block discarded – undo
1364 1363
 		);
1365 1364
 		if ($GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show'] || $GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show'] === '0')
1366 1365
 		{
1367
-			$query['col_filter']['info_type'] = explode(',',$GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show']);
1366
+			$query['col_filter']['info_type'] = explode(',', $GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show']);
1368 1367
 		}
1369 1368
 		elseif ($this->customfields && !$GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show_custom'])
1370 1369
 		{
1371
-			$query['col_filter']['info_type'] = array('task','phone','note','email');
1370
+			$query['col_filter']['info_type'] = array('task', 'phone', 'note', 'email');
1372 1371
 		}
1373 1372
 		while ($infos = $this->search($query))
1374 1373
 		{
1375 1374
 			foreach ($infos as $info)
1376 1375
 			{
1377
-				$start = new egw_time($info['info_startdate'],egw_time::$user_timezone);
1378
-				$title = ($do_events?common::formattime($start->format('H'),$start->format('i')).' ':'').
1376
+				$start = new egw_time($info['info_startdate'], egw_time::$user_timezone);
1377
+				$title = ($do_events ? common::formattime($start->format('H'), $start->format('i')).' ' : '').
1379 1378
 					$info['info_subject'];
1380
-				$view = egw_link::view('infolog',$info['info_id']);
1379
+				$view = egw_link::view('infolog', $info['info_id']);
1381 1380
 				$size = null;
1382
-				$edit = egw_link::edit('infolog',$info['info_id'], $size);
1381
+				$edit = egw_link::edit('infolog', $info['info_id'], $size);
1383 1382
 				$edit['size'] = $size;
1384
-				$content=array();
1383
+				$content = array();
1385 1384
 				foreach ($icons = array(
1386 1385
 					$info['info_type']   => 'infolog',
1387 1386
 					$this->status[$info['info_type']][$info['info_status']] => 'infolog',
1388 1387
 				) as $name => $app)
1389 1388
 				{
1390
-					$content[] = html::image($app,$name,lang($name),'border="0" width="15" height="15"').' ';
1389
+					$content[] = html::image($app, $name, lang($name), 'border="0" width="15" height="15"').' ';
1391 1390
 				}
1392
-				$content[] = html::a_href($title,$view);
1391
+				$content[] = html::a_href($title, $view);
1393 1392
 				$html = html::table(array(1 => $content));
1394 1393
 
1395 1394
 				$to_include[] = array(
@@ -1402,9 +1401,9 @@  discard block
 block discarded – undo
1402 1401
 					'content'   => $html,
1403 1402
 				);
1404 1403
 			}
1405
-			if ($query['total'] <= ($query['start']+=count($infos)))
1404
+			if ($query['total'] <= ($query['start'] += count($infos)))
1406 1405
 			{
1407
-				break;	// no more availible
1406
+				break; // no more availible
1408 1407
 			}
1409 1408
 		}
1410 1409
 		//echo "boinfolog::cal_to_include("; print_r($args); echo ")<pre>"; print_r($to_include); echo "</pre>\n";
@@ -1427,7 +1426,7 @@  discard block
 block discarded – undo
1427 1426
 				'cols' => 'info_id,info_type,info_status,info_percent,info_id_parent',
1428 1427
 			);
1429 1428
 			$infos = array();
1430
-			foreach($this->search($query) as $row)
1429
+			foreach ($this->search($query) as $row)
1431 1430
 			{
1432 1431
 				$infos[$row['info_id']] = array(
1433 1432
 					'status' => $row['info_type'] != 'phone' && $row['info_status'] == 'ongoing' ?
@@ -1436,13 +1435,13 @@  discard block
 block discarded – undo
1436 1435
 						'ongoing' : 'infolog/'.$row['info_status'],
1437 1436
 					'class'  => $row['info_id_parent'] ? 'infolog_rowHasParent' : null,
1438 1437
 				);
1439
-				if (common::image('infolog', $icon=$row['info_type'].'_element') ||
1440
-					common::image('infolog', $icon=$row['info_type']))
1438
+				if (common::image('infolog', $icon = $row['info_type'].'_element') ||
1439
+					common::image('infolog', $icon = $row['info_type']))
1441 1440
 				{
1442 1441
 					$infos[$row['info_id']]['icon'] = 'infolog/'.$icon;
1443 1442
 				}
1444 1443
 			}
1445
-			foreach($this->anzSubs(array_keys($infos)) as $info_id => $subs)
1444
+			foreach ($this->anzSubs(array_keys($infos)) as $info_id => $subs)
1446 1445
 			{
1447 1446
 				if ($subs) $infos[$info_id]['class'] .= ' infolog_rowHasSubs';
1448 1447
 			}
@@ -1461,18 +1460,18 @@  discard block
 block discarded – undo
1461 1460
 	 *  by the ones the user normally does not see due to category permissions - used to preserve categories
1462 1461
 	 * @return array category ids (found, added and preserved categories)
1463 1462
 	 */
1464
-	function find_or_add_categories($catname_list, $info_id=-1)
1463
+	function find_or_add_categories($catname_list, $info_id = -1)
1465 1464
 	{
1466 1465
 		if (!is_object($this->categories))
1467 1466
 		{
1468
-			$this->categories = new categories($this->user,'infolog');
1467
+			$this->categories = new categories($this->user, 'infolog');
1469 1468
 		}
1470 1469
 		$old_cats_preserve = array();
1471 1470
 		if ($info_id && $info_id > 0)
1472 1471
 		{
1473 1472
 			// preserve categories without users read access
1474 1473
 			$old_infolog = $this->read($info_id);
1475
-			$old_categories = explode(',',$old_infolog['info_cat']);
1474
+			$old_categories = explode(',', $old_infolog['info_cat']);
1476 1475
 			if (is_array($old_categories) && count($old_categories) > 0)
1477 1476
 			{
1478 1477
 				foreach ($old_categories as $cat_id)
@@ -1533,15 +1532,15 @@  discard block
 block discarded – undo
1533 1532
 	{
1534 1533
 		if (!is_object($this->categories))
1535 1534
 		{
1536
-			$this->categories = new categories($this->user,'infolog');
1535
+			$this->categories = new categories($this->user, 'infolog');
1537 1536
 		}
1538 1537
 
1539 1538
 		if (!is_array($cat_id_list))
1540 1539
 		{
1541
-			$cat_id_list = explode(',',$cat_id_list);
1540
+			$cat_id_list = explode(',', $cat_id_list);
1542 1541
 		}
1543 1542
 		$cat_list = array();
1544
-		foreach($cat_id_list as $cat_id)
1543
+		foreach ($cat_id_list as $cat_id)
1545 1544
 		{
1546 1545
 			if ($cat_id && $this->categories->check_perms(EGW_ACL_READ, $cat_id) &&
1547 1546
 					($cat_name = $this->categories->id2name($cat_id)) && $cat_name != '--')
@@ -1568,20 +1567,20 @@  discard block
 block discarded – undo
1568 1567
 
1569 1568
 		$save_account_id = $GLOBALS['egw_info']['user']['account_id'];
1570 1569
 		$save_prefs      = $GLOBALS['egw_info']['user']['preferences'];
1571
-		foreach($users as $user)
1570
+		foreach ($users as $user)
1572 1571
 		{
1573
-			if (!($email = $GLOBALS['egw']->accounts->id2name($user,'account_email'))) continue;
1572
+			if (!($email = $GLOBALS['egw']->accounts->id2name($user, 'account_email'))) continue;
1574 1573
 			// create the enviroment for $user
1575 1574
 			$this->user = $GLOBALS['egw_info']['user']['account_id'] = $user;
1576 1575
 			$GLOBALS['egw']->preferences->preferences($user);
1577 1576
 			$GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->read_repository();
1578 1577
 			$GLOBALS['egw']->acl->acl($user);
1579 1578
 			$GLOBALS['egw']->acl->read_repository();
1580
-			$this->grants = $GLOBALS['egw']->acl->get_grants('infolog',$this->group_owners ? $this->group_owners : true);
1581
-			$this->so = new infolog_so($this->grants);	// so caches it's filters
1579
+			$this->grants = $GLOBALS['egw']->acl->get_grants('infolog', $this->group_owners ? $this->group_owners : true);
1580
+			$this->so = new infolog_so($this->grants); // so caches it's filters
1582 1581
 
1583 1582
 			$notified_info_ids = array();
1584
-			foreach(array(
1583
+			foreach (array(
1585 1584
 				'notify_due_responsible'   => 'open-responsible-enddate',
1586 1585
 				'notify_due_delegated'     => 'open-delegated-enddate',
1587 1586
 				'notify_start_responsible' => 'open-responsible-date',
@@ -1590,44 +1589,44 @@  discard block
 block discarded – undo
1590 1589
 			{
1591 1590
 				if (!($pref_value = $GLOBALS['egw_info']['user']['preferences']['infolog'][$pref])) continue;
1592 1591
 
1593
-				$filter .= date('Y-m-d',time()+24*60*60*(int)$pref_value);
1592
+				$filter .= date('Y-m-d', time() + 24 * 60 * 60 * (int)$pref_value);
1594 1593
 				//error_log(__METHOD__."() checking with filter '$filter' ($pref_value) for user $user ($email)");
1595 1594
 
1596 1595
 				$params = array('filter' => $filter, 'custom_fields' => true, 'subs' => true);
1597
-				foreach($this->so->search($params) as $info)
1596
+				foreach ($this->so->search($params) as $info)
1598 1597
 				{
1599 1598
 					// check if we already send a notification for that infolog entry, eg. starting and due on same day
1600
-					if (in_array($info['info_id'],$notified_info_ids)) continue;
1599
+					if (in_array($info['info_id'], $notified_info_ids)) continue;
1601 1600
 
1602 1601
 					if (is_null($this->tracking) || $this->tracking->user != $user)
1603 1602
 					{
1604 1603
 						$this->tracking = new infolog_tracking($this);
1605 1604
 					}
1606
-					switch($pref)
1605
+					switch ($pref)
1607 1606
 					{
1608 1607
 						case 'notify_due_responsible':
1609
-							$info['prefix'] = lang('Due %1',$this->enums['type'][$info['info_type']]);
1610
-							$info['message'] = lang('%1 you are responsible for is due at %2',$this->enums['type'][$info['info_type']],
1611
-								$this->tracking->datetime($info['info_enddate'],false));
1608
+							$info['prefix'] = lang('Due %1', $this->enums['type'][$info['info_type']]);
1609
+							$info['message'] = lang('%1 you are responsible for is due at %2', $this->enums['type'][$info['info_type']],
1610
+								$this->tracking->datetime($info['info_enddate'], false));
1612 1611
 							break;
1613 1612
 						case 'notify_due_delegated':
1614
-							$info['prefix'] = lang('Due %1',$this->enums['type'][$info['info_type']]);
1615
-							$info['message'] = lang('%1 you delegated is due at %2',$this->enums['type'][$info['info_type']],
1616
-								$this->tracking->datetime($info['info_enddate'],false));
1613
+							$info['prefix'] = lang('Due %1', $this->enums['type'][$info['info_type']]);
1614
+							$info['message'] = lang('%1 you delegated is due at %2', $this->enums['type'][$info['info_type']],
1615
+								$this->tracking->datetime($info['info_enddate'], false));
1617 1616
 							break;
1618 1617
 						case 'notify_start_responsible':
1619
-							$info['prefix'] = lang('Starting %1',$this->enums['type'][$info['info_type']]);
1620
-							$info['message'] = lang('%1 you are responsible for is starting at %2',$this->enums['type'][$info['info_type']],
1621
-								$this->tracking->datetime($info['info_startdate'],null));
1618
+							$info['prefix'] = lang('Starting %1', $this->enums['type'][$info['info_type']]);
1619
+							$info['message'] = lang('%1 you are responsible for is starting at %2', $this->enums['type'][$info['info_type']],
1620
+								$this->tracking->datetime($info['info_startdate'], null));
1622 1621
 							break;
1623 1622
 						case 'notify_start_delegated':
1624
-							$info['prefix'] = lang('Starting %1',$this->enums['type'][$info['info_type']]);
1625
-							$info['message'] = lang('%1 you delegated is starting at %2',$this->enums['type'][$info['info_type']],
1626
-								$this->tracking->datetime($info['info_startdate'],null));
1623
+							$info['prefix'] = lang('Starting %1', $this->enums['type'][$info['info_type']]);
1624
+							$info['message'] = lang('%1 you delegated is starting at %2', $this->enums['type'][$info['info_type']],
1625
+								$this->tracking->datetime($info['info_startdate'], null));
1627 1626
 							break;
1628 1627
 					}
1629 1628
 					//error_log("notifiying $user($email) about $info[info_subject]: $info[message]");
1630
-					$this->tracking->send_notification($info,null,$email,$user,$pref);
1629
+					$this->tracking->send_notification($info, null, $email, $user, $pref);
1631 1630
 
1632 1631
 					$notified_info_ids[] = $info['info_id'];
1633 1632
 				}
@@ -1690,7 +1689,7 @@  discard block
 block discarded – undo
1690 1689
 	 * @param string $x_infolog_status preserved original infolog status
1691 1690
 	 * @return string
1692 1691
 	 */
1693
-	function vtodo2status($vtodo_status,$x_infolog_status=null)
1692
+	function vtodo2status($vtodo_status, $x_infolog_status = null)
1694 1693
 	{
1695 1694
 		$vtodo_status = strtoupper($vtodo_status);
1696 1695
 
@@ -1714,7 +1713,7 @@  discard block
 block discarded – undo
1714 1713
 	 * @param array &$icons = null on return name of icons
1715 1714
 	 * @return array value => (commaseparated) translations
1716 1715
 	 */
1717
-	function get_status($type=null, array &$icons=null)
1716
+	function get_status($type = null, array &$icons = null)
1718 1717
 	{
1719 1718
 		// if filtered by type, show only the stati of the filtered type
1720 1719
 		if ($type && isset($this->status[$type]))
@@ -1724,16 +1723,16 @@  discard block
 block discarded – undo
1724 1723
 		else	// show all stati
1725 1724
 		{
1726 1725
 			$statis = $icons = array();
1727
-			foreach($this->status as $t => $stati)
1726
+			foreach ($this->status as $t => $stati)
1728 1727
 			{
1729 1728
 				if ($t === 'defaults') continue;
1730
-				foreach($stati as $val => $label)
1729
+				foreach ($stati as $val => $label)
1731 1730
 				{
1732 1731
 					$statis[$val][$label] = lang($label);
1733 1732
 					if (!isset($icons[$val])) $icons[$val] = $label;
1734 1733
 				}
1735 1734
 			}
1736
-			foreach($statis as $val => &$labels)
1735
+			foreach ($statis as $val => &$labels)
1737 1736
 			{
1738 1737
 				$labels = implode(', ', $labels);
1739 1738
 			}
@@ -1749,7 +1748,7 @@  discard block
 block discarded – undo
1749 1748
 	 */
1750 1749
 	function activate($info)
1751 1750
 	{
1752
-		switch((int)$info['info_percent'])
1751
+		switch ((int)$info['info_percent'])
1753 1752
 		{
1754 1753
 			case 0:		return 'not-started';
1755 1754
 			case 100:	return 'done';
@@ -1768,8 +1767,8 @@  discard block
 block discarded – undo
1768 1767
 		#Horde::logMessage("getParentID($_guid)",  __FILE__, __LINE__, PEAR_LOG_DEBUG);
1769 1768
 
1770 1769
 		$parentID = False;
1771
-		$myfilter = array('col_filter' => array('info_uid'=>$_guid)) ;
1772
-		if ($_guid && ($found=$this->search($myfilter)) && ($uidmatch = array_shift($found)))
1770
+		$myfilter = array('col_filter' => array('info_uid'=>$_guid));
1771
+		if ($_guid && ($found = $this->search($myfilter)) && ($uidmatch = array_shift($found)))
1773 1772
 		{
1774 1773
 			$parentID = $uidmatch['info_id'];
1775 1774
 		}
@@ -1786,7 +1785,7 @@  discard block
 block discarded – undo
1786 1785
 	 *
1787 1786
 	 * @return array of infolog_ids of matching entries
1788 1787
 	 */
1789
-	function findInfo($infoData, $relax=false, $tzid=null)
1788
+	function findInfo($infoData, $relax = false, $tzid = null)
1790 1789
 	{
1791 1790
 		$foundInfoLogs = array();
1792 1791
 		$filter = array();
@@ -1794,7 +1793,7 @@  discard block
 block discarded – undo
1794 1793
 		if ($this->log)
1795 1794
 		{
1796 1795
 			error_log(__FILE__.'['.__LINE__.'] '.__METHOD__
1797
-				. '('. ($relax ? 'RELAX, ': 'EXACT, ') . $tzid . ')[InfoData]:'
1796
+				. '('.($relax ? 'RELAX, ' : 'EXACT, ').$tzid.')[InfoData]:'
1798 1797
 				. array2string($infoData));
1799 1798
 		}
1800 1799
 
@@ -1813,9 +1812,9 @@  discard block
 block discarded – undo
1813 1812
 		if (!$relax && !empty($infoData['info_uid']))
1814 1813
 		{
1815 1814
 			$filter = array('col_filter' => array('info_uid' => $infoData['info_uid']));
1816
-			foreach($this->so->search($filter) as $egwData)
1815
+			foreach ($this->so->search($filter) as $egwData)
1817 1816
 			{
1818
-				if (!$this->check_access($egwData,EGW_ACL_READ)) continue;
1817
+				if (!$this->check_access($egwData, EGW_ACL_READ)) continue;
1819 1818
 				$foundInfoLogs[$egwData['info_id']] = $egwData['info_id'];
1820 1819
 			}
1821 1820
 			return $foundInfoLogs;
@@ -1843,7 +1842,7 @@  discard block
 block discarded – undo
1843 1842
 				$text = '';
1844 1843
 				foreach ($matches as $chunk)
1845 1844
 				{
1846
-					if (strlen($text) <  strlen($chunk[0]))
1845
+					if (strlen($text) < strlen($chunk[0]))
1847 1846
 					{
1848 1847
 						$text = $chunk[0];
1849 1848
 					}
@@ -1867,7 +1866,7 @@  discard block
 block discarded – undo
1867 1866
 
1868 1867
 		foreach ($this->so->search($filter) as $itemID => $egwData)
1869 1868
 		{
1870
-			if (!$this->check_access($egwData,EGW_ACL_READ)) continue;
1869
+			if (!$this->check_access($egwData, EGW_ACL_READ)) continue;
1871 1870
 
1872 1871
 			switch ($infoData['info_type'])
1873 1872
 			{
@@ -1884,7 +1883,7 @@  discard block
 block discarded – undo
1884 1883
 						{
1885 1884
 							error_log(__FILE__.'['.__LINE__.'] '.__METHOD__
1886 1885
 								. '()[location mismatch]: '
1887
-								. $infoData['info_location'] . ' <> ' . $egwData['info_location']);
1886
+								. $infoData['info_location'].' <> '.$egwData['info_location']);
1888 1887
 						}
1889 1888
 						continue;
1890 1889
 					}
@@ -1901,7 +1900,7 @@  discard block
 block discarded – undo
1901 1900
 						{
1902 1901
 							error_log(__FILE__.'['.__LINE__.'] '.__METHOD__
1903 1902
 								. '()[description mismatch]: '
1904
-								. $infoData['info_des'] . ' <> ' . $egwData['info_des']);
1903
+								. $infoData['info_des'].' <> '.$egwData['info_des']);
1905 1904
 						}
1906 1905
 						continue;
1907 1906
 					}
@@ -1915,7 +1914,7 @@  discard block
 block discarded – undo
1915 1914
 			if ($this->log)
1916 1915
 			{
1917 1916
 				error_log(__FILE__.'['.__LINE__.'] '.__METHOD__
1918
-					. '()[FOUND]:' . array2string($foundInfoLogs));
1917
+					. '()[FOUND]:'.array2string($foundInfoLogs));
1919 1918
 			}
1920 1919
 			return $foundInfoLogs;
1921 1920
 		}
@@ -1940,7 +1939,7 @@  discard block
 block discarded – undo
1940 1939
 		//	__FILE__, __LINE__, PEAR_LOG_DEBUG);
1941 1940
 		foreach ($this->so->search($filter) as $itemID => $egwData)
1942 1941
 		{
1943
-			if (!$this->check_access($egwData,EGW_ACL_READ)) continue;
1942
+			if (!$this->check_access($egwData, EGW_ACL_READ)) continue;
1944 1943
 			// Horde::logMessage("findVTODO Trying\n"
1945 1944
 			//	. print_r($egwData, true),
1946 1945
 			//	__FILE__, __LINE__, PEAR_LOG_DEBUG);
@@ -1952,7 +1951,7 @@  discard block
 block discarded – undo
1952 1951
 				{
1953 1952
 					error_log(__FILE__.'['.__LINE__.'] '.__METHOD__
1954 1953
 						. '()[category mismatch]: '
1955
-						. $infoData['info_cat'] . ' <> ' . $egwData['info_cat']);
1954
+						. $infoData['info_cat'].' <> '.$egwData['info_cat']);
1956 1955
 				}
1957 1956
 				continue;
1958 1957
 			}
@@ -1962,15 +1961,15 @@  discard block
 block discarded – undo
1962 1961
 				if (isset($egwData['info_startdate']) && $egwData['info_startdate'])
1963 1962
 				{
1964 1963
 					// We compare the date only
1965
-					$taskTime = new egw_time($infoData['info_startdate'],egw_time::$server_timezone);
1966
-					$egwTime = new egw_time($egwData['info_startdate'],egw_time::$server_timezone);
1964
+					$taskTime = new egw_time($infoData['info_startdate'], egw_time::$server_timezone);
1965
+					$egwTime = new egw_time($egwData['info_startdate'], egw_time::$server_timezone);
1967 1966
 					if ($taskTime->format('Ymd') != $egwTime->format('Ymd'))
1968 1967
 					{
1969 1968
 						if ($this->log)
1970 1969
 						{
1971 1970
 							error_log(__FILE__.'['.__LINE__.'] '.__METHOD__
1972 1971
 								. '()[start mismatch]: '
1973
-								. $taskTime->format('Ymd') . ' <> ' . $egwTime->format('Ymd'));
1972
+								. $taskTime->format('Ymd').' <> '.$egwTime->format('Ymd'));
1974 1973
 						}
1975 1974
 						continue;
1976 1975
 					}
@@ -1997,7 +1996,7 @@  discard block
 block discarded – undo
1997 1996
 					{
1998 1997
 						error_log(__FILE__.'['.__LINE__.'] '.__METHOD__
1999 1998
 							. '()[status mismatch]: '
2000
-							. $infoData['info_status'] . ' <> ' . $egwData['info_status']);
1999
+							. $infoData['info_status'].' <> '.$egwData['info_status']);
2001 2000
 					}
2002 2001
 					continue;
2003 2002
 				}
@@ -2007,15 +2006,15 @@  discard block
 block discarded – undo
2007 2006
 					if (isset($egwData['info_enddate']) && $egwData['info_enddate'])
2008 2007
 					{
2009 2008
 						// We compare the date only
2010
-						$taskTime = new egw_time($infoData['info_enddate'],egw_time::$server_timezone);
2011
-						$egwTime = new egw_time($egwData['info_enddate'],egw_time::$server_timezone);
2009
+						$taskTime = new egw_time($infoData['info_enddate'], egw_time::$server_timezone);
2010
+						$egwTime = new egw_time($egwData['info_enddate'], egw_time::$server_timezone);
2012 2011
 						if ($taskTime->format('Ymd') != $egwTime->format('Ymd'))
2013 2012
 						{
2014 2013
 							if ($this->log)
2015 2014
 							{
2016 2015
 								error_log(__FILE__.'['.__LINE__.'] '.__METHOD__
2017 2016
 									. '()[DUE mismatch]: '
2018
-									. $taskTime->format('Ymd') . ' <> ' . $egwTime->format('Ymd'));
2017
+									. $taskTime->format('Ymd').' <> '.$egwTime->format('Ymd'));
2019 2018
 							}
2020 2019
 							continue;
2021 2020
 						}
@@ -2036,15 +2035,15 @@  discard block
 block discarded – undo
2036 2035
 					if (isset($egwData['info_datecompleted']) && $egwData['info_datecompleted'])
2037 2036
 					{
2038 2037
 						// We compare the date only
2039
-						$taskTime = new egw_time($infoData['info_datecompleted'],egw_time::$server_timezone);
2040
-						$egwTime = new egw_time($egwData['info_datecompleted'],egw_time::$server_timezone);
2038
+						$taskTime = new egw_time($infoData['info_datecompleted'], egw_time::$server_timezone);
2039
+						$egwTime = new egw_time($egwData['info_datecompleted'], egw_time::$server_timezone);
2041 2040
 						if ($taskTime->format('Ymd') != $egwTime->format('Ymd'))
2042 2041
 						{
2043 2042
 							if ($this->log)
2044 2043
 							{
2045 2044
 								error_log(__FILE__.'['.__LINE__.'] '.__METHOD__
2046 2045
 									. '()[completed mismatch]: '
2047
-									. $taskTime->format('Ymd') . ' <> ' . $egwTime->format('Ymd'));
2046
+									. $taskTime->format('Ymd').' <> '.$egwTime->format('Ymd'));
2048 2047
 							}
2049 2048
 							continue;
2050 2049
 						}
@@ -2074,7 +2073,7 @@  discard block
 block discarded – undo
2074 2073
 		if ($this->log)
2075 2074
 		{
2076 2075
 			error_log(__FILE__.'['.__LINE__.'] '.__METHOD__
2077
-				. '()[FOUND]:' . array2string($foundInfoLogs));
2076
+				. '()[FOUND]:'.array2string($foundInfoLogs));
2078 2077
 		}
2079 2078
 		return $foundInfoLogs;
2080 2079
 	}
Please login to merge, or discard this patch.
Braces   +207 added lines, -57 removed lines patch added patch discarded remove patch
@@ -224,7 +224,10 @@  discard block
 block discarded – undo
224 224
 				$this->enums['type'] += $config_data['types'];
225 225
 				//echo "types:<pre>"; print_r($this->enums['type']); echo "</pre>\n";
226 226
 			}
227
-			if ($config_data['group_owners']) $this->group_owners = $config_data['group_owners'];
227
+			if ($config_data['group_owners'])
228
+			{
229
+				$this->group_owners = $config_data['group_owners'];
230
+			}
228 231
 
229 232
 			$this->customfields = egw_customfields::get('infolog');
230 233
 			if ($this->customfields)
@@ -234,17 +237,35 @@  discard block
 block discarded – undo
234 237
 					// old infolog customefield record
235 238
 					if(empty($field['type']))
236 239
 					{
237
-						if (count($field['values'])) $field['type'] = 'select'; // selectbox
238
-						elseif ($field['rows'] > 1) $field['type'] = 'textarea'; // textarea
239
-						elseif (intval($field['len']) > 0) $field['type'] = 'text'; // regular input field
240
-						else $field['type'] = 'label'; // header-row
240
+						if (count($field['values']))
241
+						{
242
+							$field['type'] = 'select';
243
+						}
244
+						// selectbox
245
+						elseif ($field['rows'] > 1)
246
+						{
247
+							$field['type'] = 'textarea';
248
+						}
249
+						// textarea
250
+						elseif (intval($field['len']) > 0)
251
+						{
252
+							$field['type'] = 'text';
253
+						}
254
+						// regular input field
255
+						else {
256
+							$field['type'] = 'label';
257
+						}
258
+						// header-row
241 259
 						$field['type2'] = $field['typ'];
242 260
 						unset($field['typ']);
243 261
 						$this->customfields[$name] = $field;
244 262
 						$save_config = true;
245 263
 					}
246 264
 				}
247
-				if ($save_config) config::save_value('customfields',$this->customfields,'infolog');
265
+				if ($save_config)
266
+				{
267
+					config::save_value('customfields',$this->customfields,'infolog');
268
+				}
248 269
 			}
249 270
 			if (is_array($config_data['responsible_edit']))
250 271
 			{
@@ -271,7 +292,10 @@  discard block
 block discarded – undo
271 292
 		// sort types by there translation
272 293
 		foreach($this->enums['type'] as $key => $val)
273 294
 		{
274
-			if (($val = lang($key)) != $key.'*') $this->enums['type'][$key] = lang($key);
295
+			if (($val = lang($key)) != $key.'*')
296
+			{
297
+				$this->enums['type'][$key] = lang($key);
298
+			}
275 299
 		}
276 300
 		natcasesort($this->enums['type']);
277 301
 
@@ -302,7 +326,10 @@  discard block
 block discarded – undo
302 326
 	 */
303 327
 	function has_customfields($type,$links=false)
304 328
 	{
305
-		if ($links) $link_types = customfields_widget::get_customfield_link_types();
329
+		if ($links)
330
+		{
331
+			$link_types = customfields_widget::get_customfield_link_types();
332
+		}
306 333
 
307 334
 		foreach($this->customfields as $field)
308 335
 		{
@@ -330,11 +357,18 @@  discard block
 block discarded – undo
330 357
 
331 358
 		$info_id = is_array($info) ? $info['info_id'] : $info;
332 359
 
333
-		if (!$user) $user = $this->user;
360
+		if (!$user)
361
+		{
362
+			$user = $this->user;
363
+		}
334 364
 		if ($user == $this->user)
335 365
 		{
336 366
 			$grants = $this->grants;
337
-			if ($info_id) $access =& $cache[$info_id][$required_rights];	// we only cache the current user!
367
+			if ($info_id)
368
+			{
369
+				$access =& $cache[$info_id][$required_rights];
370
+			}
371
+			// we only cache the current user!
338 372
 		}
339 373
 		else
340 374
 		{
@@ -353,16 +387,22 @@  discard block
 block discarded – undo
353 387
 			// handle delete for the various history modes
354 388
 			if ($this->history)
355 389
 			{
356
-				if (!is_array($info) && !($info = $this->so->read(array('info_id' => $info_id)))) return false;
390
+				if (!is_array($info) && !($info = $this->so->read(array('info_id' => $info_id))))
391
+				{
392
+					return false;
393
+				}
357 394
 
358 395
 				if ($info['info_status'] == 'deleted' &&
359 396
 					($required_rights == EGW_ACL_EDIT ||		// no edit rights for deleted entries
360 397
 					 $required_rights == EGW_ACL_ADD  ||		// no add rights for deleted entries
361 398
 					 $required_rights == EGW_ACL_DELETE && ($this->history == 'history_no_delete' || // no delete at all!
362
-					 $this->history == 'history_admin_delete' && (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || $user!=$this->user))))	// delete only for admins
399
+					 $this->history == 'history_admin_delete' && (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || $user!=$this->user))))
400
+				{
401
+					// delete only for admins
363 402
 				{
364 403
 					$access = false;
365 404
 				}
405
+				}
366 406
 				elseif ($required_rights == EGW_ACL_UNDELETE)
367 407
 				{
368 408
 					if ($info['info_status'] != 'deleted')
@@ -423,11 +463,14 @@  discard block
 block discarded – undo
423 463
 
424 464
 		if ($info['info_link_id'] > 0 &&
425 465
 			(isset($info['links']) && ($link = $info['links'][$info['info_link_id']]) ||	// use supplied links info
426
-			 ($link = egw_link::get_link($info['info_link_id'])) !== False))	// if link not found in supplied links, we always search!
466
+			 ($link = egw_link::get_link($info['info_link_id'])) !== False))
467
+		{
468
+			// if link not found in supplied links, we always search!
427 469
 		{
428 470
 			if (isset($info['links']) && isset($link['app']))
429 471
 			{
430 472
 				$app = $link['app'];
473
+		}
431 474
 				$id  = $link['id'];
432 475
 			}
433 476
 			else
@@ -438,10 +481,13 @@  discard block
 block discarded – undo
438 481
 			}
439 482
 			$title = egw_link::title($app,$id);
440 483
 
441
-			if ((string)$info['info_custom_from'] === '')	// old entry
484
+			if ((string)$info['info_custom_from'] === '')
485
+			{
486
+				// old entry
442 487
 			{
443 488
 				$info['info_custom_from'] = (int) ($title != $info['info_from'] && @htmlentities($title) != $info['info_from']);
444 489
 			}
490
+			}
445 491
 			if (!$info['info_custom_from'])
446 492
 			{
447 493
 				$info['info_from'] = '';
@@ -491,12 +537,15 @@  discard block
 block discarded – undo
491 537
 	 function time2time(&$values, $fromTZId=false, $toTZId=null)
492 538
 	 {
493 539
 
494
-		if ($fromTZId === $toTZId) return;
540
+		if ($fromTZId === $toTZId)
541
+		{
542
+			return;
543
+		}
495 544
 
496 545
 		$tz = egw_time::$server_timezone;
497 546
 
498 547
 	 	if ($fromTZId)
499
-		{
548
+	 	{
500 549
 			if (!isset(self::$tz_cache[$fromTZId]))
501 550
 			{
502 551
 				self::$tz_cache[$fromTZId] = calendar_timezones::DateTimeZone($fromTZId);
@@ -530,7 +579,7 @@  discard block
 block discarded – undo
530 579
 		}
531 580
 		//error_log(__METHOD__.'(values[info_enddate]='.date('Y-m-d H:i:s',$values['info_enddate']).", from=".array2string($fromTZId).", to=".array2string($toTZId).") tz=".$tz->getName().', fromTZ='.$fromTZ->getName().', toTZ='.$toTZ->getName().', userTZ='.egw_time::$user_timezone->getName());
532 581
 	 	foreach($this->timestamps as $key)
533
-		{
582
+	 	{
534 583
 		 	if ($values[$key])
535 584
 		 	{
536 585
 			 	$time = new egw_time($values[$key], $tz);
@@ -560,7 +609,10 @@  discard block
 block discarded – undo
560 609
 	 */
561 610
 	function date2usertime($ts,$date_format='ts')
562 611
 	{
563
-		if (empty($ts) || $date_format == 'server') return $ts;
612
+		if (empty($ts) || $date_format == 'server')
613
+		{
614
+			return $ts;
615
+		}
564 616
 
565 617
 		return egw_time::server2user($ts,$date_format);
566 618
 	}
@@ -598,16 +650,22 @@  discard block
 block discarded – undo
598 650
 		}
599 651
 		$info_id = $data['info_id'];	// in case the uid was specified
600 652
 
601
-		if (!$ignore_acl && !$this->check_access($data,EGW_ACL_READ))	// check behind read, to prevent a double read
653
+		if (!$ignore_acl && !$this->check_access($data,EGW_ACL_READ))
654
+		{
655
+			// check behind read, to prevent a double read
602 656
 		{
603 657
 			return False;
604 658
 		}
659
+		}
605 660
 
606 661
 		if ($data['info_subject'] == $this->subject_from_des($data['info_des']))
607 662
 		{
608 663
 			$data['info_subject'] = '';
609 664
 		}
610
-		if ($run_link_id2from) $this->link_id2from($data);
665
+		if ($run_link_id2from)
666
+		{
667
+			$this->link_id2from($data);
668
+		}
611 669
 
612 670
 		// convert server- to user-time
613 671
 		if ($date_format == 'ts')
@@ -670,7 +728,11 @@  discard block
 block discarded – undo
670 728
 		// if we have history switched on and not an already deleted item --> set only status deleted
671 729
 		if ($this->history && $info['info_status'] != 'deleted')
672 730
 		{
673
-			if ($info['info_status'] == 'deleted') return false;	// entry already deleted
731
+			if ($info['info_status'] == 'deleted')
732
+			{
733
+				return false;
734
+			}
735
+			// entry already deleted
674 736
 
675 737
 			$this->so->write($deleted);
676 738
 
@@ -682,9 +744,12 @@  discard block
 block discarded – undo
682 744
 
683 745
 			egw_link::unlink(0,'infolog',$info_id);
684 746
 		}
685
-		if ($info['info_status'] != 'deleted')	// dont notify of final purge of already deleted items
747
+		if ($info['info_status'] != 'deleted')
748
+		{
749
+			// dont notify of final purge of already deleted items
686 750
 		{
687 751
 			$GLOBALS['egw']->contenthistory->updateTimeStamp('infolog_'.$info['info_type'], $info_id, 'delete', time());
752
+		}
688 753
 
689 754
 			// send email notifications and do the history logging
690 755
 			if(!$skip_notification)
@@ -740,10 +805,13 @@  discard block
 block discarded – undo
740 805
 			{
741 806
 				$responsible = $values['info_responsible'];
742 807
 			}
743
-			if (!($status_only = in_array($this->user, (array)$responsible)))	// responsible has implicit right to change status
808
+			if (!($status_only = in_array($this->user, (array)$responsible)))
809
+			{
810
+				// responsible has implicit right to change status
744 811
 			{
745 812
 				$status_only = !!array_intersect((array)$responsible,array_keys($GLOBALS['egw']->accounts->memberships($this->user)));
746 813
 			}
814
+			}
747 815
 			if (!$status_only && $values['info_status'] != 'deleted')
748 816
 			{
749 817
 				$status_only = $undelete = $this->check_access($values['info_id'],EGW_ACL_UNDELETE);
@@ -763,17 +831,23 @@  discard block
 block discarded – undo
763 831
 				$values['info_status'] = $this->status['defaults'][$values['info_type']];
764 832
 			}
765 833
 		}
766
-		if ($status_only && !$undelete)	// make sure only status gets writen
834
+		if ($status_only && !$undelete)
835
+		{
836
+			// make sure only status gets writen
767 837
 		{
768 838
 			$set_completed = !$values['info_datecompleted'] &&	// set date completed of finished job, only if its not already set
769 839
 				in_array($values['info_status'],array('done','billed','cancelled'));
840
+		}
770 841
 
771 842
 			$values = $old;
772 843
 			// only overwrite explicitly allowed fields
773 844
 			$values['info_datemodified'] = $values_in['info_datemodified'];
774 845
 			foreach ($this->responsible_edit as $name)
775 846
 			{
776
-				if (isset($values_in[$name])) $values[$name] = $values_in[$name];
847
+				if (isset($values_in[$name]))
848
+				{
849
+					$values[$name] = $values_in[$name];
850
+				}
777 851
 			}
778 852
 			if ($set_completed)
779 853
 			{
@@ -781,21 +855,30 @@  discard block
 block discarded – undo
781 855
 				$values['info_percent'] = 100;
782 856
 				$forcestatus = true;
783 857
 				$status = 'done';
784
-				if (isset($values['info_type']) && !in_array($values['info_status'],array('done','billed','cancelled'))) {
858
+				if (isset($values['info_type']) && !in_array($values['info_status'],array('done','billed','cancelled')))
859
+				{
785 860
 					$forcestatus = false;
786 861
 					//echo "set_completed:"; _debug_array($this->status[$values['info_type']]);
787
-					if (isset($this->status[$values['info_type']]['done'])) {
862
+					if (isset($this->status[$values['info_type']]['done']))
863
+					{
788 864
 						$forcestatus = true;
789 865
 						$status = 'done';
790
-					} elseif (isset($this->status[$values['info_type']]['billed'])) {
866
+					}
867
+					elseif (isset($this->status[$values['info_type']]['billed']))
868
+					{
791 869
 						$forcestatus = true;
792 870
 						$status = 'billed';
793
-					} elseif (isset($this->status[$values['info_type']]['cancelled'])) {
871
+					}
872
+					elseif (isset($this->status[$values['info_type']]['cancelled']))
873
+					{
794 874
 						$forcestatus = true;
795 875
 						$status = 'cancelled';
796 876
 					}
797 877
 				}
798
-				if ($forcestatus && !in_array($values['info_status'],array('done','billed','cancelled'))) $values['info_status'] = $status;
878
+				if ($forcestatus && !in_array($values['info_status'],array('done','billed','cancelled')))
879
+				{
880
+					$values['info_status'] = $status;
881
+				}
799 882
 			}
800 883
 			$check_defaults = false;
801 884
 		}
@@ -827,14 +910,22 @@  discard block
 block discarded – undo
827 910
 				//echo "check_defaults:"; _debug_array($this->status[$values['info_type']]);
828 911
 				//$values['info_status'] = 'done';
829 912
 				$status = 'done';
830
-				if (isset($values['info_type'])) {
831
-					if (isset($this->status[$values['info_type']]['done'])) {
913
+				if (isset($values['info_type']))
914
+				{
915
+					if (isset($this->status[$values['info_type']]['done']))
916
+					{
832 917
 						$status = 'done';
833
-					} elseif (isset($this->status[$values['info_type']]['billed'])) {
918
+					}
919
+					elseif (isset($this->status[$values['info_type']]['billed']))
920
+					{
834 921
 						$status = 'billed';
835
-					} elseif (isset($this->status[$values['info_type']]['cancelled'])) {
922
+					}
923
+					elseif (isset($this->status[$values['info_type']]['cancelled']))
924
+					{
836 925
 						$status = 'cancelled';
837
-					} else {
926
+					}
927
+					else
928
+					{
838 929
 						// since the comlete stati above do not exist for that type, dont change it
839 930
 						$status = $values['info_status'];
840 931
 					}
@@ -856,7 +947,10 @@  discard block
 block discarded – undo
856 947
 				$custom = egw_customfields::get('infolog');
857 948
 				foreach($custom as $c_name => $c_field)
858 949
 				{
859
-					if($c_field['type2']) $type2 = is_array($c_field['type2']) ? $c_field['type2'] : explode(',',$c_field['type2']);
950
+					if($c_field['type2'])
951
+					{
952
+						$type2 = is_array($c_field['type2']) ? $c_field['type2'] : explode(',',$c_field['type2']);
953
+					}
860 954
 					if($c_field['needed'] && (!$c_field['type2'] || $c_field['type2'] && in_array($values['info_type'],$type2)))
861 955
 					{
862 956
 						// Required custom field
@@ -875,8 +969,7 @@  discard block
 block discarded – undo
875 969
 			{
876 970
 				if (!$this->check_access($values['info_id'],EGW_ACL_EDIT) ||
877 971
 					!$values['info_id'] && !$this->check_access($values,EGW_ACL_ADD)
878
-				)
879
-				{
972
+				) {
880 973
 					return false;	// no edit rights from the group-owner and no implicit rights (delegated and sufficient rights)
881 974
 				}
882 975
 			}
@@ -955,10 +1048,16 @@  discard block
 block discarded – undo
955 1048
 			$to_write['info_id'] = $info_id;
956 1049
 
957 1050
 			// if the info responbsible array is not passed, fetch it from old.
958
-			if (!array_key_exists('info_responsible',$values)) $values['info_responsible'] = $old['info_responsible'];
959
-			if (!is_array($values['info_responsible']))		// this should not happen, bug it does ;-)
1051
+			if (!array_key_exists('info_responsible',$values))
1052
+			{
1053
+				$values['info_responsible'] = $old['info_responsible'];
1054
+			}
1055
+			if (!is_array($values['info_responsible']))
1056
+			{
1057
+				// this should not happen, bug it does ;-)
960 1058
 			{
961 1059
 				$values['info_responsible'] = $values['info_responsible'] ? explode(',',$values['info_responsible']) : array();
1060
+			}
962 1061
 				$to_write['info_responsible'] = $values['info_responsible'];
963 1062
 			}
964 1063
 			// create (and remove) links in custom fields
@@ -1003,7 +1102,10 @@  discard block
 block discarded – undo
1003 1102
 			$this->tracking->track($to_write,$old,$this->user,$values['info_status'] == 'deleted' || $old['info_status'] == 'deleted',
1004 1103
 				null,$skip_notification);
1005 1104
 
1006
-			if ($info_from_set) $values['info_from'] = '';
1105
+			if ($info_from_set)
1106
+			{
1107
+				$values['info_from'] = '';
1108
+			}
1007 1109
 
1008 1110
 			// Change new values back to user time before sending them back
1009 1111
 			if($user2server)
@@ -1053,13 +1155,25 @@  discard block
 block discarded – undo
1053 1155
 
1054 1156
 		if($query['filter'] == 'bydate')
1055 1157
 		{
1056
-			if (is_int($query['startdate'])) $query['col_filter'][] = 'info_startdate >= '.$GLOBALS['egw']->db->quote($query['startdate']);
1057
-			if (is_int($query['enddate'])) $query['col_filter'][] = 'info_startdate <= '.$GLOBALS['egw']->db->quote($query['enddate']+(60*60*24)-1);
1158
+			if (is_int($query['startdate']))
1159
+			{
1160
+				$query['col_filter'][] = 'info_startdate >= '.$GLOBALS['egw']->db->quote($query['startdate']);
1161
+			}
1162
+			if (is_int($query['enddate']))
1163
+			{
1164
+				$query['col_filter'][] = 'info_startdate <= '.$GLOBALS['egw']->db->quote($query['enddate']+(60*60*24)-1);
1165
+			}
1058 1166
 		}
1059 1167
 		elseif ($query['filter'] == 'duedate')
1060 1168
 		{
1061
-			if (is_int($query['startdate'])) $query['col_filter'][] = 'info_enddate >= '.$GLOBALS['egw']->db->quote($query['startdate']);
1062
-			if (is_int($query['enddate'])) $query['col_filter'][] = 'info_enddate <= '.$GLOBALS['egw']->db->quote($query['enddate']+(60*60*24)-1);
1169
+			if (is_int($query['startdate']))
1170
+			{
1171
+				$query['col_filter'][] = 'info_enddate >= '.$GLOBALS['egw']->db->quote($query['startdate']);
1172
+			}
1173
+			if (is_int($query['enddate']))
1174
+			{
1175
+				$query['col_filter'][] = 'info_enddate <= '.$GLOBALS['egw']->db->quote($query['enddate']+(60*60*24)-1);
1176
+			}
1063 1177
 		}
1064 1178
 		elseif ($query['filter'] == 'private')
1065 1179
 		{
@@ -1141,7 +1255,10 @@  discard block
 block discarded – undo
1141 1255
 
1142 1256
 		$result =& $this->search($filter);
1143 1257
 
1144
-		if (empty($result)) return 'EGw-empty-wGE';
1258
+		if (empty($result))
1259
+		{
1260
+			return 'EGw-empty-wGE';
1261
+		}
1145 1262
 
1146 1263
 		$entry = array_shift($result);
1147 1264
 
@@ -1188,7 +1305,10 @@  discard block
 block discarded – undo
1188 1305
 				'to_id' => 0,
1189 1306
 			),
1190 1307
 		);
1191
-		if ($GLOBALS['egw_info']['user']['preferences']['infolog']['cat_add_default']) $info['info_cat'] = $GLOBALS['egw_info']['user']['preferences']['infolog']['cat_add_default'];
1308
+		if ($GLOBALS['egw_info']['user']['preferences']['infolog']['cat_add_default'])
1309
+		{
1310
+			$info['info_cat'] = $GLOBALS['egw_info']['user']['preferences']['infolog']['cat_add_default'];
1311
+		}
1192 1312
 		// find the addressbookentry to link with
1193 1313
 		$addressbook = new addressbook_bo();
1194 1314
 		$contacts = array();
@@ -1444,7 +1564,10 @@  discard block
 block discarded – undo
1444 1564
 			}
1445 1565
 			foreach($this->anzSubs(array_keys($infos)) as $info_id => $subs)
1446 1566
 			{
1447
-				if ($subs) $infos[$info_id]['class'] .= ' infolog_rowHasSubs';
1567
+				if ($subs)
1568
+				{
1569
+					$infos[$info_id]['class'] .= ' infolog_rowHasSubs';
1570
+				}
1448 1571
 			}
1449 1572
 		}
1450 1573
 		return $infos;
@@ -1570,7 +1693,10 @@  discard block
 block discarded – undo
1570 1693
 		$save_prefs      = $GLOBALS['egw_info']['user']['preferences'];
1571 1694
 		foreach($users as $user)
1572 1695
 		{
1573
-			if (!($email = $GLOBALS['egw']->accounts->id2name($user,'account_email'))) continue;
1696
+			if (!($email = $GLOBALS['egw']->accounts->id2name($user,'account_email')))
1697
+			{
1698
+				continue;
1699
+			}
1574 1700
 			// create the enviroment for $user
1575 1701
 			$this->user = $GLOBALS['egw_info']['user']['account_id'] = $user;
1576 1702
 			$GLOBALS['egw']->preferences->preferences($user);
@@ -1588,7 +1714,10 @@  discard block
 block discarded – undo
1588 1714
 				'notify_start_delegated'   => 'open-delegated-date',
1589 1715
 			) as $pref => $filter)
1590 1716
 			{
1591
-				if (!($pref_value = $GLOBALS['egw_info']['user']['preferences']['infolog'][$pref])) continue;
1717
+				if (!($pref_value = $GLOBALS['egw_info']['user']['preferences']['infolog'][$pref]))
1718
+				{
1719
+					continue;
1720
+				}
1592 1721
 
1593 1722
 				$filter .= date('Y-m-d',time()+24*60*60*(int)$pref_value);
1594 1723
 				//error_log(__METHOD__."() checking with filter '$filter' ($pref_value) for user $user ($email)");
@@ -1597,7 +1726,10 @@  discard block
 block discarded – undo
1597 1726
 				foreach($this->so->search($params) as $info)
1598 1727
 				{
1599 1728
 					// check if we already send a notification for that infolog entry, eg. starting and due on same day
1600
-					if (in_array($info['info_id'],$notified_info_ids)) continue;
1729
+					if (in_array($info['info_id'],$notified_info_ids))
1730
+					{
1731
+						continue;
1732
+					}
1601 1733
 
1602 1734
 					if (is_null($this->tracking) || $this->tracking->user != $user)
1603 1735
 					{
@@ -1726,11 +1858,17 @@  discard block
 block discarded – undo
1726 1858
 			$statis = $icons = array();
1727 1859
 			foreach($this->status as $t => $stati)
1728 1860
 			{
1729
-				if ($t === 'defaults') continue;
1861
+				if ($t === 'defaults')
1862
+				{
1863
+					continue;
1864
+				}
1730 1865
 				foreach($stati as $val => $label)
1731 1866
 				{
1732 1867
 					$statis[$val][$label] = lang($label);
1733
-					if (!isset($icons[$val])) $icons[$val] = $label;
1868
+					if (!isset($icons[$val]))
1869
+					{
1870
+						$icons[$val] = $label;
1871
+					}
1734 1872
 				}
1735 1873
 			}
1736 1874
 			foreach($statis as $val => &$labels)
@@ -1806,7 +1944,10 @@  discard block
 block discarded – undo
1806 1944
 			{
1807 1945
 				return array($egwData['info_id']);
1808 1946
 			}
1809
-			if (!$relax) return array();
1947
+			if (!$relax)
1948
+			{
1949
+				return array();
1950
+			}
1810 1951
 		}
1811 1952
 		unset($infoData['info_id']);
1812 1953
 
@@ -1815,7 +1956,10 @@  discard block
 block discarded – undo
1815 1956
 			$filter = array('col_filter' => array('info_uid' => $infoData['info_uid']));
1816 1957
 			foreach($this->so->search($filter) as $egwData)
1817 1958
 			{
1818
-				if (!$this->check_access($egwData,EGW_ACL_READ)) continue;
1959
+				if (!$this->check_access($egwData,EGW_ACL_READ))
1960
+				{
1961
+					continue;
1962
+				}
1819 1963
 				$foundInfoLogs[$egwData['info_id']] = $egwData['info_id'];
1820 1964
 			}
1821 1965
 			return $foundInfoLogs;
@@ -1867,7 +2011,10 @@  discard block
 block discarded – undo
1867 2011
 
1868 2012
 		foreach ($this->so->search($filter) as $itemID => $egwData)
1869 2013
 		{
1870
-			if (!$this->check_access($egwData,EGW_ACL_READ)) continue;
2014
+			if (!$this->check_access($egwData,EGW_ACL_READ))
2015
+			{
2016
+				continue;
2017
+			}
1871 2018
 
1872 2019
 			switch ($infoData['info_type'])
1873 2020
 			{
@@ -1940,7 +2087,10 @@  discard block
 block discarded – undo
1940 2087
 		//	__FILE__, __LINE__, PEAR_LOG_DEBUG);
1941 2088
 		foreach ($this->so->search($filter) as $itemID => $egwData)
1942 2089
 		{
1943
-			if (!$this->check_access($egwData,EGW_ACL_READ)) continue;
2090
+			if (!$this->check_access($egwData,EGW_ACL_READ))
2091
+			{
2092
+				continue;
2093
+			}
1944 2094
 			// Horde::logMessage("findVTODO Trying\n"
1945 2095
 			//	. print_r($egwData, true),
1946 2096
 			//	__FILE__, __LINE__, PEAR_LOG_DEBUG);
Please login to merge, or discard this patch.