@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | list($adminGroup, $groups) = $groupsInfo->get(); |
73 | 73 | |
74 | 74 | $recoveryAdminEnabled = OC_App::isEnabled('encryption') && |
75 | - $config->getAppValue( 'encryption', 'recoveryAdminEnabled', null ); |
|
75 | + $config->getAppValue('encryption', 'recoveryAdminEnabled', null); |
|
76 | 76 | |
77 | -if($isAdmin) { |
|
77 | +if ($isAdmin) { |
|
78 | 78 | $subAdmins = \OC::$server->getGroupManager()->getSubAdmin()->getAllSubAdmins(); |
79 | 79 | // New class returns IUser[] so convert back |
80 | 80 | $result = []; |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | ]; |
86 | 86 | } |
87 | 87 | $subAdmins = $result; |
88 | -}else{ |
|
88 | +} else { |
|
89 | 89 | /* Retrieve group IDs from $groups array, so we can pass that information into OC_Group::displayNamesInGroups() */ |
90 | 90 | $gids = array(); |
91 | - foreach($groups as $group) { |
|
91 | + foreach ($groups as $group) { |
|
92 | 92 | if (isset($group['id'])) { |
93 | 93 | $gids[] = $group['id']; |
94 | 94 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | $disabledUsers = 0; |
99 | 99 | foreach (OC_User::getUsers() as $uid) { |
100 | - if(!$userManager->get($uid)->isEnabled()) { |
|
100 | + if (!$userManager->get($uid)->isEnabled()) { |
|
101 | 101 | $disabledUsers++; |
102 | 102 | } |
103 | 103 | } |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | ); |
109 | 109 | |
110 | 110 | // load preset quotas |
111 | -$quotaPreset=$config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB'); |
|
112 | -$quotaPreset=explode(',', $quotaPreset); |
|
113 | -foreach($quotaPreset as &$preset) { |
|
114 | - $preset=trim($preset); |
|
111 | +$quotaPreset = $config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB'); |
|
112 | +$quotaPreset = explode(',', $quotaPreset); |
|
113 | +foreach ($quotaPreset as &$preset) { |
|
114 | + $preset = trim($preset); |
|
115 | 115 | } |
116 | -$quotaPreset=array_diff($quotaPreset, array('default', 'none')); |
|
116 | +$quotaPreset = array_diff($quotaPreset, array('default', 'none')); |
|
117 | 117 | |
118 | -$defaultQuota=$config->getAppValue('files', 'default_quota', 'none'); |
|
119 | -$defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false |
|
120 | - && array_search($defaultQuota, array('none', 'default'))===false; |
|
118 | +$defaultQuota = $config->getAppValue('files', 'default_quota', 'none'); |
|
119 | +$defaultQuotaIsUserDefined = array_search($defaultQuota, $quotaPreset) === false |
|
120 | + && array_search($defaultQuota, array('none', 'default')) === false; |
|
121 | 121 | |
122 | 122 | \OC::$server->getEventDispatcher()->dispatch('OC\Settings\Users::loadAdditionalScripts'); |
123 | 123 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $tmpl->assign('sortGroups', $sortGroupsBy); |
127 | 127 | $tmpl->assign('adminGroup', $adminGroup); |
128 | 128 | $tmpl->assign('disabledUsersGroup', $disabledUsersGroup); |
129 | -$tmpl->assign('isAdmin', (int)$isAdmin); |
|
129 | +$tmpl->assign('isAdmin', (int) $isAdmin); |
|
130 | 130 | $tmpl->assign('subadmins', $subAdmins); |
131 | 131 | $tmpl->assign('numofgroups', count($groups) + count($adminGroup)); |
132 | 132 | $tmpl->assign('quota_preset', $quotaPreset); |
@@ -28,33 +28,33 @@ |
||
28 | 28 | </li> |
29 | 29 | |
30 | 30 | <!-- The Admin Group --> |
31 | - <?php foreach($_["adminGroup"] as $adminGroup): ?> |
|
32 | - <li data-gid="admin" data-usercount="<?php if($adminGroup['usercount'] > 0) { p($adminGroup['usercount']); } ?>" class="isgroup"> |
|
31 | + <?php foreach ($_["adminGroup"] as $adminGroup): ?> |
|
32 | + <li data-gid="admin" data-usercount="<?php if ($adminGroup['usercount'] > 0) { p($adminGroup['usercount']); } ?>" class="isgroup"> |
|
33 | 33 | <a href="#"><span class="groupname"><?php p($l->t('Admins')); ?></span></a> |
34 | 34 | <span class="utils"> |
35 | - <span class="usercount"><?php if($adminGroup['usercount'] > 0) { p($adminGroup['usercount']); } ?></span> |
|
35 | + <span class="usercount"><?php if ($adminGroup['usercount'] > 0) { p($adminGroup['usercount']); } ?></span> |
|
36 | 36 | </span> |
37 | 37 | </li> |
38 | 38 | <?php endforeach; ?> |
39 | 39 | |
40 | 40 | <!-- Disabled Users --> |
41 | 41 | <?php $disabledUsersGroup = $_["disabledUsersGroup"] ?> |
42 | - <li data-gid="_disabledUsers" data-usercount="<?php if($disabledUsersGroup['usercount'] > 0) { p($disabledUsersGroup['usercount']); } ?>" class="isgroup"> |
|
42 | + <li data-gid="_disabledUsers" data-usercount="<?php if ($disabledUsersGroup['usercount'] > 0) { p($disabledUsersGroup['usercount']); } ?>" class="isgroup"> |
|
43 | 43 | <a href="#"><span class="groupname"><?php p($l->t('Disabled')); ?></span></a> |
44 | 44 | <span class="utils"> |
45 | - <span class="usercount"><?php if($disabledUsersGroup['usercount'] > 0) { p($disabledUsersGroup['usercount']); } ?></span> |
|
45 | + <span class="usercount"><?php if ($disabledUsersGroup['usercount'] > 0) { p($disabledUsersGroup['usercount']); } ?></span> |
|
46 | 46 | </span> |
47 | 47 | </li> |
48 | 48 | |
49 | 49 | <!--List of Groups--> |
50 | - <?php foreach($_["groups"] as $group): ?> |
|
50 | + <?php foreach ($_["groups"] as $group): ?> |
|
51 | 51 | <li data-gid="<?php p($group['name']) ?>" data-usercount="<?php p($group['usercount']) ?>" class="isgroup"> |
52 | 52 | <a href="#" class="dorename"> |
53 | 53 | <span class="groupname"><?php p($group['name']); ?></span> |
54 | 54 | </a> |
55 | 55 | <span class="utils"> |
56 | - <span class="usercount"><?php if($group['usercount'] > 0) { p($group['usercount']); } ?></span> |
|
57 | - <?php if($_['isAdmin']): ?> |
|
56 | + <span class="usercount"><?php if ($group['usercount'] > 0) { p($group['usercount']); } ?></span> |
|
57 | + <?php if ($_['isAdmin']): ?> |
|
58 | 58 | <a href="#" class="action delete" original-title="<?php p($l->t('Delete'))?>"> |
59 | 59 | <img src="<?php print_unescaped(image_path('core', 'actions/delete.svg')) ?>" /> |
60 | 60 | </a> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | // check for encryption state - TODO see formatUserForIndex |
135 | 135 | $this->isEncryptionAppEnabled = $appManager->isEnabledForUser('encryption'); |
136 | - if($this->isEncryptionAppEnabled) { |
|
136 | + if ($this->isEncryptionAppEnabled) { |
|
137 | 137 | // putting this directly in empty is possible in PHP 5.5+ |
138 | 138 | $result = $config->getAppValue('encryption', 'recoveryAdminEnabled', 0); |
139 | 139 | $this->isRestoreEnabled = !empty($result); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | $subAdminGroups = $this->groupManager->getSubAdmin()->getSubAdminsGroups($user); |
176 | - foreach($subAdminGroups as $key => $subAdminGroup) { |
|
176 | + foreach ($subAdminGroups as $key => $subAdminGroup) { |
|
177 | 177 | $subAdminGroups[$key] = $subAdminGroup->getGID(); |
178 | 178 | } |
179 | 179 | |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function index($offset = 0, $limit = 10, $gid = '', $pattern = '', $backend = '') { |
233 | 233 | // Remove backends |
234 | - if(!empty($backend)) { |
|
234 | + if (!empty($backend)) { |
|
235 | 235 | $activeBackends = $this->userManager->getBackends(); |
236 | 236 | $this->userManager->clearBackends(); |
237 | - foreach($activeBackends as $singleActiveBackend) { |
|
238 | - if($backend === get_class($singleActiveBackend)) { |
|
237 | + foreach ($activeBackends as $singleActiveBackend) { |
|
238 | + if ($backend === get_class($singleActiveBackend)) { |
|
239 | 239 | $this->userManager->registerBackend($singleActiveBackend); |
240 | 240 | break; |
241 | 241 | } |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | |
245 | 245 | $users = []; |
246 | 246 | if ($this->isAdmin) { |
247 | - if($gid !== '' && $gid !== '_disabledUsers') { |
|
247 | + if ($gid !== '' && $gid !== '_disabledUsers') { |
|
248 | 248 | $batch = $this->getUsersForUID($this->groupManager->displayNamesInGroup($gid, $pattern, $limit, $offset)); |
249 | 249 | } else { |
250 | 250 | $batch = $this->userManager->search($pattern, $limit, $offset); |
251 | 251 | } |
252 | 252 | |
253 | 253 | foreach ($batch as $user) { |
254 | - if( ($gid !== '_disabledUsers' && $user->isEnabled()) || |
|
254 | + if (($gid !== '_disabledUsers' && $user->isEnabled()) || |
|
255 | 255 | ($gid === '_disabledUsers' && !$user->isEnabled()) |
256 | 256 | ) { |
257 | 257 | $users[] = $this->formatUserForIndex($user); |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | $subAdminOfGroups = $gids; |
269 | 269 | |
270 | 270 | // Set the $gid parameter to an empty value if the subadmin has no rights to access a specific group |
271 | - if($gid !== '' && $gid !== '_disabledUsers' && !in_array($gid, $subAdminOfGroups)) { |
|
271 | + if ($gid !== '' && $gid !== '_disabledUsers' && !in_array($gid, $subAdminOfGroups)) { |
|
272 | 272 | $gid = ''; |
273 | 273 | } |
274 | 274 | |
275 | 275 | // Batch all groups the user is subadmin of when a group is specified |
276 | 276 | $batch = []; |
277 | - if($gid === '') { |
|
278 | - foreach($subAdminOfGroups as $group) { |
|
277 | + if ($gid === '') { |
|
278 | + foreach ($subAdminOfGroups as $group) { |
|
279 | 279 | $groupUsers = $this->groupManager->displayNamesInGroup($group, $pattern, $limit, $offset); |
280 | 280 | |
281 | - foreach($groupUsers as $uid => $displayName) { |
|
281 | + foreach ($groupUsers as $uid => $displayName) { |
|
282 | 282 | $batch[$uid] = $displayName; |
283 | 283 | } |
284 | 284 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $this->groupManager->getUserGroupIds($user), |
294 | 294 | $subAdminOfGroups |
295 | 295 | )); |
296 | - if( ($gid !== '_disabledUsers' && $user->isEnabled()) || |
|
296 | + if (($gid !== '_disabledUsers' && $user->isEnabled()) || |
|
297 | 297 | ($gid === '_disabledUsers' && !$user->isEnabled()) |
298 | 298 | ) { |
299 | 299 | $users[] = $this->formatUserForIndex($user, $userGroups); |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | * @param string $email |
315 | 315 | * @return DataResponse |
316 | 316 | */ |
317 | - public function create($username, $password, array $groups=[], $email='') { |
|
318 | - if($email !== '' && !$this->mailer->validateMailAddress($email)) { |
|
317 | + public function create($username, $password, array $groups = [], $email = '') { |
|
318 | + if ($email !== '' && !$this->mailer->validateMailAddress($email)) { |
|
319 | 319 | return new DataResponse( |
320 | 320 | [ |
321 | - 'message' => (string)$this->l10n->t('Invalid mail address') |
|
321 | + 'message' => (string) $this->l10n->t('Invalid mail address') |
|
322 | 322 | ], |
323 | 323 | Http::STATUS_UNPROCESSABLE_ENTITY |
324 | 324 | ); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | if (!empty($groups)) { |
331 | 331 | foreach ($groups as $key => $group) { |
332 | 332 | $groupObject = $this->groupManager->get($group); |
333 | - if($groupObject === null) { |
|
333 | + if ($groupObject === null) { |
|
334 | 334 | unset($groups[$key]); |
335 | 335 | continue; |
336 | 336 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | if ($this->userManager->userExists($username)) { |
355 | 355 | return new DataResponse( |
356 | 356 | [ |
357 | - 'message' => (string)$this->l10n->t('A user with that name already exists.') |
|
357 | + 'message' => (string) $this->l10n->t('A user with that name already exists.') |
|
358 | 358 | ], |
359 | 359 | Http::STATUS_CONFLICT |
360 | 360 | ); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | if ($email === '') { |
366 | 366 | return new DataResponse( |
367 | 367 | [ |
368 | - 'message' => (string)$this->l10n->t('To send a password link to the user an email address is required.') |
|
368 | + 'message' => (string) $this->l10n->t('To send a password link to the user an email address is required.') |
|
369 | 369 | ], |
370 | 370 | Http::STATUS_UNPROCESSABLE_ENTITY |
371 | 371 | ); |
@@ -390,12 +390,12 @@ discard block |
||
390 | 390 | ); |
391 | 391 | } |
392 | 392 | |
393 | - if($user instanceof IUser) { |
|
394 | - if($groups !== null) { |
|
395 | - foreach($groups as $groupName) { |
|
393 | + if ($user instanceof IUser) { |
|
394 | + if ($groups !== null) { |
|
395 | + foreach ($groups as $groupName) { |
|
396 | 396 | $group = $this->groupManager->get($groupName); |
397 | 397 | |
398 | - if(empty($group)) { |
|
398 | + if (empty($group)) { |
|
399 | 399 | $group = $this->groupManager->createGroup($groupName); |
400 | 400 | } |
401 | 401 | $group->addUser($user); |
@@ -404,13 +404,13 @@ discard block |
||
404 | 404 | /** |
405 | 405 | * Send new user mail only if a mail is set |
406 | 406 | */ |
407 | - if($email !== '') { |
|
407 | + if ($email !== '') { |
|
408 | 408 | $user->setEMailAddress($email); |
409 | 409 | try { |
410 | 410 | $emailTemplate = $this->newUserMailHelper->generateTemplate($user, $generatePasswordResetToken); |
411 | 411 | $this->newUserMailHelper->sendMail($user, $emailTemplate); |
412 | - } catch(\Exception $e) { |
|
413 | - $this->log->error("Can't send new user mail to $email: " . $e->getMessage(), ['app' => 'settings']); |
|
412 | + } catch (\Exception $e) { |
|
413 | + $this->log->error("Can't send new user mail to $email: ".$e->getMessage(), ['app' => 'settings']); |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | // fetch users groups |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | $userId = $this->userSession->getUser()->getUID(); |
443 | 443 | $user = $this->userManager->get($id); |
444 | 444 | |
445 | - if($userId === $id) { |
|
445 | + if ($userId === $id) { |
|
446 | 446 | return new DataResponse( |
447 | 447 | [ |
448 | 448 | 'status' => 'error', |
@@ -454,20 +454,20 @@ discard block |
||
454 | 454 | ); |
455 | 455 | } |
456 | 456 | |
457 | - if(!$this->isAdmin && !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user)) { |
|
457 | + if (!$this->isAdmin && !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user)) { |
|
458 | 458 | return new DataResponse( |
459 | 459 | [ |
460 | 460 | 'status' => 'error', |
461 | 461 | 'data' => [ |
462 | - 'message' => (string)$this->l10n->t('Authentication error') |
|
462 | + 'message' => (string) $this->l10n->t('Authentication error') |
|
463 | 463 | ] |
464 | 464 | ], |
465 | 465 | Http::STATUS_FORBIDDEN |
466 | 466 | ); |
467 | 467 | } |
468 | 468 | |
469 | - if($user) { |
|
470 | - if($user->delete()) { |
|
469 | + if ($user) { |
|
470 | + if ($user->delete()) { |
|
471 | 471 | return new DataResponse( |
472 | 472 | [ |
473 | 473 | 'status' => 'success', |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | [ |
485 | 485 | 'status' => 'error', |
486 | 486 | 'data' => [ |
487 | - 'message' => (string)$this->l10n->t('Unable to delete user.') |
|
487 | + 'message' => (string) $this->l10n->t('Unable to delete user.') |
|
488 | 488 | ] |
489 | 489 | ], |
490 | 490 | Http::STATUS_FORBIDDEN |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | } |
514 | 514 | |
515 | 515 | if ($user) { |
516 | - if(!$this->isAdmin && !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user)) { |
|
516 | + if (!$this->isAdmin && !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user)) { |
|
517 | 517 | return new DataResponse( |
518 | 518 | [ |
519 | 519 | 'status' => 'error', |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | ); |
571 | 571 | } |
572 | 572 | |
573 | - if($user) { |
|
573 | + if ($user) { |
|
574 | 574 | if (!$this->isAdmin && !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user)) { |
575 | 575 | return new DataResponse( |
576 | 576 | [ |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | |
776 | 776 | $uniqueUsers = []; |
777 | 777 | foreach ($groups as $group) { |
778 | - foreach($group->getUsers() as $uid => $displayName) { |
|
778 | + foreach ($group->getUsers() as $uid => $displayName) { |
|
779 | 779 | $uniqueUsers[$uid] = true; |
780 | 780 | } |
781 | 781 | } |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | ); |
877 | 877 | } |
878 | 878 | |
879 | - if($mailAddress !== '' && !$this->mailer->validateMailAddress($mailAddress)) { |
|
879 | + if ($mailAddress !== '' && !$this->mailer->validateMailAddress($mailAddress)) { |
|
880 | 880 | return new DataResponse( |
881 | 881 | [ |
882 | 882 | 'status' => 'error', |