Completed
Push — 16.1 ( b5bda6...d590ad )
by Nathan
30:38 queued 15:41
created
admin/inc/class.admin_ui.inc.php 1 patch
Spacing   +38 added lines, -42 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @param array $content
42 42
 	 */
43
-	public function index(array $content=null)
43
+	public function index(array $content = null)
44 44
 	{
45 45
 		if (admin_statistics::check(false))
46 46
 		{
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		//$content['msg'] = 'Hi Ralf ;-)';
76 76
 		$sel_options['tree'] = $this->tree_data();
77 77
 		$sel_options['filter'] = array('' => lang('All groups'));
78
-		foreach(self::$accounts->search(array(
78
+		foreach (self::$accounts->search(array(
79 79
 			'type' => 'groups',
80 80
 			'start' => false,
81 81
 			'order' => 'account_lid',
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		}
106 106
 		else
107 107
 		{
108
-			$content['iframe'] = 'about:blank';	// we show accounts-list be default now
108
+			$content['iframe'] = 'about:blank'; // we show accounts-list be default now
109 109
 		}
110 110
 
111 111
 		$tpl->exec('admin.admin_ui.index', $content, $sel_options);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	{
121 121
 		$actions = static::group_actions();
122 122
 
123
-		foreach($actions as $action_id =>  &$action)
123
+		foreach ($actions as $action_id =>  &$action)
124 124
 		{
125 125
 			if (!isset($action['enableId']) && !in_array($action_id, array('add')))
126 126
 			{
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 					'default' => true,
149 149
 					'allowOnMultiple' => false,
150 150
 					'onExecute' => 'javaScript:app.admin.account',
151
-					'group' => $group=0,
151
+					'group' => $group = 0,
152 152
 				),
153 153
 				'add' => array(
154 154
 					'caption' => 'Add user',
@@ -159,25 +159,25 @@  discard block
 block discarded – undo
159 159
 			// generate urls for add/edit accounts via addressbook
160 160
 			$edit = Link::get_registry('addressbook', 'edit');
161 161
 			$edit['account_id'] = '$id';
162
-			foreach($edit as $name => $val)
162
+			foreach ($edit as $name => $val)
163 163
 			{
164 164
 				$actions['edit']['url'] .= ($actions['edit']['url'] ? '&' : '').$name.'='.$val;
165 165
 			}
166 166
 			unset($edit['account_id']);
167 167
 			$edit['owner'] = 0;
168
-			foreach($edit as $name => $val)
168
+			foreach ($edit as $name => $val)
169 169
 			{
170 170
 				$actions['add']['url'] .= ($actions['edit']['url'] ? '&' : '').$name.'='.$val;
171 171
 			}
172 172
 			++$group;
173 173
 			// supporting both old way using $GLOBALS['menuData'] and new just returning data in hook
174 174
 			$apps = array_unique(array_merge(array('admin'), Api\Hooks::implemented('edit_user')));
175
-			foreach($apps as $app)
175
+			foreach ($apps as $app)
176 176
 			{
177 177
 				$GLOBALS['menuData'] = $data = array();
178 178
 				$data = Api\Hooks::single('edit_user', $app);
179 179
 				if (!is_array($data)) $data = $GLOBALS['menuData'];
180
-				foreach($data as $item)
180
+				foreach ($data as $item)
181 181
 				{
182 182
 					// allow hook to return "real" actions, but still support legacy: description, url, extradata, options
183 183
 					if (empty($item['caption']))
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 				'onExecute' => 'javaScript:app.admin.group',
233 233
 				'caption' => 'Show members',
234 234
 				'default' => true,
235
-				'group' => $group=1,
235
+				'group' => $group = 1,
236 236
 				'allowOnMultiple' => false
237 237
 			),
238 238
 			'add' => array(
239 239
 				'group' => $group,
240
-			)+$user_actions['add'],
240
+			) + $user_actions['add'],
241 241
 			'acl' => array(
242 242
 				'onExecute' => 'javaScript:app.admin.group',
243 243
 				'caption' => 'Access control',
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 				'allowOnMultiple' => false
249 249
 			),
250 250
 		);
251
-		if (!$GLOBALS['egw']->acl->check('account_access',64,'admin'))	// no rights to set ACL-rights
251
+		if (!$GLOBALS['egw']->acl->check('account_access', 64, 'admin'))	// no rights to set ACL-rights
252 252
 		{
253 253
 			$actions['deny'] = array(
254 254
 				'caption'   => 'Deny access',
@@ -260,17 +260,17 @@  discard block
 block discarded – undo
260 260
 			);
261 261
 		}
262 262
 
263
-		$group = 5;	// allow to place actions in different groups by hook, this is the default
263
+		$group = 5; // allow to place actions in different groups by hook, this is the default
264 264
 
265 265
 		// supporting both old way using $GLOBALS['menuData'] and new just returning data in hook
266 266
 		$apps = array_unique(array_merge(array('admin'), Api\Hooks::implemented('edit_group')));
267
-		foreach($apps as $app)
267
+		foreach ($apps as $app)
268 268
 		{
269 269
 			$GLOBALS['menuData'] = $data = array();
270 270
 			$data = Api\Hooks::single('edit_group', $app);
271 271
 			if (!is_array($data)) $data = $GLOBALS['menuData'];
272 272
 
273
-			foreach($data as $item)
273
+			foreach ($data as $item)
274 274
 			{
275 275
 				// allow hook to return "real" actions, but still support legacy: description, url, extradata, options
276 276
 				if (empty($item['caption']))
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * @param array &$rows=null
311 311
 	 * @return int total number of rows available
312 312
 	 */
313
-	public static function get_users(array $query, array &$rows=null)
313
+	public static function get_users(array $query, array &$rows = null)
314 314
 	{
315 315
 		$params = array(
316 316
 			'type' => (int)$query['filter'] ? (int)$query['filter'] : 'accounts',
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 			$params['query'] = $query['searchletter'];
326 326
 			$params['query_type'] = 'start';
327 327
 		}
328
-		elseif($query['search'])
328
+		elseif ($query['search'])
329 329
 		{
330 330
 			$params['query'] = $query['search'];
331 331
 			$params['query_type'] = 'all';
@@ -334,13 +334,10 @@  discard block
 block discarded – undo
334 334
 		$rows = array_values(self::$accounts->search($params));
335 335
 		//error_log(__METHOD__."() accounts->search(".array2string($params).") total=".self::$accounts->total);
336 336
 
337
-		foreach($rows as &$row)
337
+		foreach ($rows as &$row)
338 338
 		{
339 339
 			$row['status'] = self::$accounts->is_expired($row) ?
340
-				lang('Expired').' '.Api\DateTime::to($row['account_expires'], true) :
341
-					(!self::$accounts->is_active($row) ? lang('Disabled') :
342
-						($row['account_expires'] != -1 ? lang('Expires').' '.Api\DateTime::to($row['account_expires'], true) :
343
-							lang('Enabled')));
340
+				lang('Expired').' '.Api\DateTime::to($row['account_expires'], true) : (!self::$accounts->is_active($row) ? lang('Disabled') : ($row['account_expires'] != -1 ? lang('Expires').' '.Api\DateTime::to($row['account_expires'], true) : lang('Enabled')));
344 341
 
345 342
 			if (!self::$accounts->is_active($row)) $row['status_class'] = 'adminAccountInactive';
346 343
 		}
@@ -362,29 +359,29 @@  discard block
 block discarded – undo
362 359
 			));
363 360
 
364 361
 		$apps = array();
365
-		foreach($GLOBALS['egw_info']['apps'] as $app => $data)
362
+		foreach ($GLOBALS['egw_info']['apps'] as $app => $data)
366 363
 		{
367 364
 			if (!$data['enabled'] || !$data['status'] || $data['status'] == 3)
368 365
 			{
369
-				continue;	// do NOT show disabled apps, or our API (status = 3)
366
+				continue; // do NOT show disabled apps, or our API (status = 3)
370 367
 			}
371 368
 
372 369
 			$apps[] = $app;
373 370
 		}
374 371
 
375 372
 		$rows = array();
376
-		foreach($groups as &$group)
373
+		foreach ($groups as &$group)
377 374
 		{
378 375
 			$run_rights = $GLOBALS['egw']->acl->get_user_applications($group['account_id'], false, false);
379
-			foreach($apps as $app)
376
+			foreach ($apps as $app)
380 377
 			{
381
-				if((boolean)$run_rights[$app])
378
+				if ((boolean)$run_rights[$app])
382 379
 				{
383 380
 					$group['apps'][] = $app;
384 381
 				}
385 382
 			}
386 383
 
387
-			$group['members'] = $GLOBALS['egw']->accounts->members($group['account_id'],true);
384
+			$group['members'] = $GLOBALS['egw']->accounts->members($group['account_id'], true);
388 385
 			$rows[] = $group;
389 386
 		}
390 387
 
@@ -424,14 +421,14 @@  discard block
 block discarded – undo
424 421
 		if ($root == '/')
425 422
 		{
426 423
 			$hook_data = self::call_hook();
427
-			foreach($hook_data as $app => $app_data)
424
+			foreach ($hook_data as $app => $app_data)
428 425
 			{
429
-				if(!is_array($app_data))
426
+				if (!is_array($app_data))
430 427
 				{
431 428
 					// Application has no data
432 429
 					continue;
433 430
 				}
434
-				foreach($app_data as $text => $data)
431
+				foreach ($app_data as $text => $data)
435 432
 				{
436 433
 					if (!is_array($data))
437 434
 					{
@@ -462,18 +459,17 @@  discard block
 block discarded – undo
462 459
 						}
463 460
 					}
464 461
 					unset($data['icon']);
465
-					$parent =& $tree['item'];
462
+					$parent = & $tree['item'];
466 463
 					$parts = explode('/', $data['id']);
467
-					if ($data['id'][0] == '/') array_shift($parts);	// remove root
464
+					if ($data['id'][0] == '/') array_shift($parts); // remove root
468 465
 					array_pop($parts);
469 466
 					$path = '';
470
-					foreach($parts as $part)
467
+					foreach ($parts as $part)
471 468
 					{
472 469
 						$path .= ($path == '/' ? '' : '/').$part;
473 470
 						if (!isset($parent[$path]))
474 471
 						{
475
-							$icon = Etemplate\Widget\Tree::imagePath($part == 'apps' ? Api\Image::find('api', 'home') :
476
-								(($i=Api\Image::find($part, 'navbar')) ? $i : Api\Image::find('api', 'nonav')));
472
+							$icon = Etemplate\Widget\Tree::imagePath($part == 'apps' ? Api\Image::find('api', 'home') : (($i = Api\Image::find($part, 'navbar')) ? $i : Api\Image::find('api', 'nonav')));
477 473
 							$parent[$path] = array(
478 474
 								'id' => $path,
479 475
 								'text' => $part == 'apps' ? lang('Applications') : lang($part),
@@ -485,7 +481,7 @@  discard block
 block discarded – undo
485 481
 							);
486 482
 							if ($path == '/admin') $parent[$path]['open'] = true;
487 483
 						}
488
-						$parent =& $parent[$path]['item'];
484
+						$parent = & $parent[$path]['item'];
489 485
 					}
490 486
 					$data['text'] = lang($data['text']);
491 487
 					if (!empty($data['tooltip'])) $data['tooltip'] = lang($data['tooltip']);
@@ -497,7 +493,7 @@  discard block
 block discarded – undo
497 493
 		}
498 494
 		elseif ($root == '/groups')
499 495
 		{
500
-			foreach($GLOBALS['egw']->accounts->search(array(
496
+			foreach ($GLOBALS['egw']->accounts->search(array(
501 497
 				'type' => 'groups',
502 498
 				'order' => 'account_lid',
503 499
 				'sort' => 'ASC',
@@ -524,8 +520,8 @@  discard block
 block discarded – undo
524 520
 	private static function fix_userdata(array $data)
525 521
 	{
526 522
 		// store link as userdata, maybe we should store everything not directly understood by tree this way ...
527
-		foreach(array_diff_key($data, array_flip(array(
528
-			'id','text','tooltip','im0','im1','im2','item','child','select','open','call',
523
+		foreach (array_diff_key($data, array_flip(array(
524
+			'id', 'text', 'tooltip', 'im0', 'im1', 'im2', 'item', 'child', 'select', 'open', 'call',
529 525
 		))) as $name => $content)
530 526
 		{
531 527
 			$data['userdata'][] = array(
@@ -545,7 +541,7 @@  discard block
 block discarded – undo
545 541
 	private static function strip_item_keys(array &$items)
546 542
 	{
547 543
 		$items = array_values($items);
548
-		foreach($items as &$item)
544
+		foreach ($items as &$item)
549 545
 		{
550 546
 			if (is_array($item) && isset($item['item']))
551 547
 			{
@@ -563,7 +559,7 @@  discard block
 block discarded – undo
563 559
 	protected static function call_hook()
564 560
 	{
565 561
 		self::$hook_data = array();
566
-		function display_section($appname,$file,$file2=False)
562
+		function display_section($appname, $file, $file2 = False)
567 563
 		{
568 564
 			admin_ui::$hook_data[$appname] = $file2 ? $file2 : $file;
569 565
 			//error_log(__METHOD__."(".array2string(func_get_args()).")");
Please login to merge, or discard this patch.