Completed
Pull Request — master (#7057)
by Blizzz
16:13
created
apps/user_ldap/composer/composer/autoload_classmap.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -6,55 +6,55 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\User_LDAP\\Access' => $baseDir . '/../lib/Access.php',
10
-    'OCA\\User_LDAP\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
11
-    'OCA\\User_LDAP\\BackendUtility' => $baseDir . '/../lib/BackendUtility.php',
12
-    'OCA\\User_LDAP\\Command\\CheckUser' => $baseDir . '/../lib/Command/CheckUser.php',
13
-    'OCA\\User_LDAP\\Command\\CreateEmptyConfig' => $baseDir . '/../lib/Command/CreateEmptyConfig.php',
14
-    'OCA\\User_LDAP\\Command\\DeleteConfig' => $baseDir . '/../lib/Command/DeleteConfig.php',
15
-    'OCA\\User_LDAP\\Command\\Search' => $baseDir . '/../lib/Command/Search.php',
16
-    'OCA\\User_LDAP\\Command\\SetConfig' => $baseDir . '/../lib/Command/SetConfig.php',
17
-    'OCA\\User_LDAP\\Command\\ShowConfig' => $baseDir . '/../lib/Command/ShowConfig.php',
18
-    'OCA\\User_LDAP\\Command\\ShowRemnants' => $baseDir . '/../lib/Command/ShowRemnants.php',
19
-    'OCA\\User_LDAP\\Command\\TestConfig' => $baseDir . '/../lib/Command/TestConfig.php',
20
-    'OCA\\User_LDAP\\Configuration' => $baseDir . '/../lib/Configuration.php',
21
-    'OCA\\User_LDAP\\Connection' => $baseDir . '/../lib/Connection.php',
22
-    'OCA\\User_LDAP\\Controller\\ConfigAPIController' => $baseDir . '/../lib/Controller/ConfigAPIController.php',
23
-    'OCA\\User_LDAP\\Controller\\RenewPasswordController' => $baseDir . '/../lib/Controller/RenewPasswordController.php',
24
-    'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => $baseDir . '/../lib/Exceptions/ConstraintViolationException.php',
25
-    'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => $baseDir . '/../lib/Exceptions/NotOnLDAP.php',
26
-    'OCA\\User_LDAP\\FilesystemHelper' => $baseDir . '/../lib/FilesystemHelper.php',
27
-    'OCA\\User_LDAP\\Group_LDAP' => $baseDir . '/../lib/Group_LDAP.php',
28
-    'OCA\\User_LDAP\\Group_Proxy' => $baseDir . '/../lib/Group_Proxy.php',
29
-    'OCA\\User_LDAP\\Helper' => $baseDir . '/../lib/Helper.php',
30
-    'OCA\\User_LDAP\\ILDAPWrapper' => $baseDir . '/../lib/ILDAPWrapper.php',
31
-    'OCA\\User_LDAP\\IUserLDAP' => $baseDir . '/../lib/IUserLDAP.php',
32
-    'OCA\\User_LDAP\\Jobs\\CleanUp' => $baseDir . '/../lib/Jobs/CleanUp.php',
33
-    'OCA\\User_LDAP\\Jobs\\Sync' => $baseDir . '/../lib/Jobs/Sync.php',
34
-    'OCA\\User_LDAP\\Jobs\\UpdateGroups' => $baseDir . '/../lib/Jobs/UpdateGroups.php',
35
-    'OCA\\User_LDAP\\LDAP' => $baseDir . '/../lib/LDAP.php',
36
-    'OCA\\User_LDAP\\LDAPProvider' => $baseDir . '/../lib/LDAPProvider.php',
37
-    'OCA\\User_LDAP\\LDAPProviderFactory' => $baseDir . '/../lib/LDAPProviderFactory.php',
38
-    'OCA\\User_LDAP\\LDAPUtility' => $baseDir . '/../lib/LDAPUtility.php',
39
-    'OCA\\User_LDAP\\LogWrapper' => $baseDir . '/../lib/LogWrapper.php',
40
-    'OCA\\User_LDAP\\Mapping\\AbstractMapping' => $baseDir . '/../lib/Mapping/AbstractMapping.php',
41
-    'OCA\\User_LDAP\\Mapping\\GroupMapping' => $baseDir . '/../lib/Mapping/GroupMapping.php',
42
-    'OCA\\User_LDAP\\Mapping\\UserMapping' => $baseDir . '/../lib/Mapping/UserMapping.php',
43
-    'OCA\\User_LDAP\\Migration\\UUIDFix' => $baseDir . '/../lib/Migration/UUIDFix.php',
44
-    'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => $baseDir . '/../lib/Migration/UUIDFixGroup.php',
45
-    'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => $baseDir . '/../lib/Migration/UUIDFixInsert.php',
46
-    'OCA\\User_LDAP\\Migration\\UUIDFixUser' => $baseDir . '/../lib/Migration/UUIDFixUser.php',
47
-    'OCA\\User_LDAP\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
48
-    'OCA\\User_LDAP\\Proxy' => $baseDir . '/../lib/Proxy.php',
49
-    'OCA\\User_LDAP\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php',
50
-    'OCA\\User_LDAP\\Settings\\Section' => $baseDir . '/../lib/Settings/Section.php',
51
-    'OCA\\User_LDAP\\User\\DeletedUsersIndex' => $baseDir . '/../lib/User/DeletedUsersIndex.php',
52
-    'OCA\\User_LDAP\\User\\IUserTools' => $baseDir . '/../lib/User/IUserTools.php',
53
-    'OCA\\User_LDAP\\User\\Manager' => $baseDir . '/../lib/User/Manager.php',
54
-    'OCA\\User_LDAP\\User\\OfflineUser' => $baseDir . '/../lib/User/OfflineUser.php',
55
-    'OCA\\User_LDAP\\User\\User' => $baseDir . '/../lib/User/User.php',
56
-    'OCA\\User_LDAP\\User_LDAP' => $baseDir . '/../lib/User_LDAP.php',
57
-    'OCA\\User_LDAP\\User_Proxy' => $baseDir . '/../lib/User_Proxy.php',
58
-    'OCA\\User_LDAP\\Wizard' => $baseDir . '/../lib/Wizard.php',
59
-    'OCA\\User_LDAP\\WizardResult' => $baseDir . '/../lib/WizardResult.php',
9
+    'OCA\\User_LDAP\\Access' => $baseDir.'/../lib/Access.php',
10
+    'OCA\\User_LDAP\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
11
+    'OCA\\User_LDAP\\BackendUtility' => $baseDir.'/../lib/BackendUtility.php',
12
+    'OCA\\User_LDAP\\Command\\CheckUser' => $baseDir.'/../lib/Command/CheckUser.php',
13
+    'OCA\\User_LDAP\\Command\\CreateEmptyConfig' => $baseDir.'/../lib/Command/CreateEmptyConfig.php',
14
+    'OCA\\User_LDAP\\Command\\DeleteConfig' => $baseDir.'/../lib/Command/DeleteConfig.php',
15
+    'OCA\\User_LDAP\\Command\\Search' => $baseDir.'/../lib/Command/Search.php',
16
+    'OCA\\User_LDAP\\Command\\SetConfig' => $baseDir.'/../lib/Command/SetConfig.php',
17
+    'OCA\\User_LDAP\\Command\\ShowConfig' => $baseDir.'/../lib/Command/ShowConfig.php',
18
+    'OCA\\User_LDAP\\Command\\ShowRemnants' => $baseDir.'/../lib/Command/ShowRemnants.php',
19
+    'OCA\\User_LDAP\\Command\\TestConfig' => $baseDir.'/../lib/Command/TestConfig.php',
20
+    'OCA\\User_LDAP\\Configuration' => $baseDir.'/../lib/Configuration.php',
21
+    'OCA\\User_LDAP\\Connection' => $baseDir.'/../lib/Connection.php',
22
+    'OCA\\User_LDAP\\Controller\\ConfigAPIController' => $baseDir.'/../lib/Controller/ConfigAPIController.php',
23
+    'OCA\\User_LDAP\\Controller\\RenewPasswordController' => $baseDir.'/../lib/Controller/RenewPasswordController.php',
24
+    'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => $baseDir.'/../lib/Exceptions/ConstraintViolationException.php',
25
+    'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => $baseDir.'/../lib/Exceptions/NotOnLDAP.php',
26
+    'OCA\\User_LDAP\\FilesystemHelper' => $baseDir.'/../lib/FilesystemHelper.php',
27
+    'OCA\\User_LDAP\\Group_LDAP' => $baseDir.'/../lib/Group_LDAP.php',
28
+    'OCA\\User_LDAP\\Group_Proxy' => $baseDir.'/../lib/Group_Proxy.php',
29
+    'OCA\\User_LDAP\\Helper' => $baseDir.'/../lib/Helper.php',
30
+    'OCA\\User_LDAP\\ILDAPWrapper' => $baseDir.'/../lib/ILDAPWrapper.php',
31
+    'OCA\\User_LDAP\\IUserLDAP' => $baseDir.'/../lib/IUserLDAP.php',
32
+    'OCA\\User_LDAP\\Jobs\\CleanUp' => $baseDir.'/../lib/Jobs/CleanUp.php',
33
+    'OCA\\User_LDAP\\Jobs\\Sync' => $baseDir.'/../lib/Jobs/Sync.php',
34
+    'OCA\\User_LDAP\\Jobs\\UpdateGroups' => $baseDir.'/../lib/Jobs/UpdateGroups.php',
35
+    'OCA\\User_LDAP\\LDAP' => $baseDir.'/../lib/LDAP.php',
36
+    'OCA\\User_LDAP\\LDAPProvider' => $baseDir.'/../lib/LDAPProvider.php',
37
+    'OCA\\User_LDAP\\LDAPProviderFactory' => $baseDir.'/../lib/LDAPProviderFactory.php',
38
+    'OCA\\User_LDAP\\LDAPUtility' => $baseDir.'/../lib/LDAPUtility.php',
39
+    'OCA\\User_LDAP\\LogWrapper' => $baseDir.'/../lib/LogWrapper.php',
40
+    'OCA\\User_LDAP\\Mapping\\AbstractMapping' => $baseDir.'/../lib/Mapping/AbstractMapping.php',
41
+    'OCA\\User_LDAP\\Mapping\\GroupMapping' => $baseDir.'/../lib/Mapping/GroupMapping.php',
42
+    'OCA\\User_LDAP\\Mapping\\UserMapping' => $baseDir.'/../lib/Mapping/UserMapping.php',
43
+    'OCA\\User_LDAP\\Migration\\UUIDFix' => $baseDir.'/../lib/Migration/UUIDFix.php',
44
+    'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => $baseDir.'/../lib/Migration/UUIDFixGroup.php',
45
+    'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => $baseDir.'/../lib/Migration/UUIDFixInsert.php',
46
+    'OCA\\User_LDAP\\Migration\\UUIDFixUser' => $baseDir.'/../lib/Migration/UUIDFixUser.php',
47
+    'OCA\\User_LDAP\\Notification\\Notifier' => $baseDir.'/../lib/Notification/Notifier.php',
48
+    'OCA\\User_LDAP\\Proxy' => $baseDir.'/../lib/Proxy.php',
49
+    'OCA\\User_LDAP\\Settings\\Admin' => $baseDir.'/../lib/Settings/Admin.php',
50
+    'OCA\\User_LDAP\\Settings\\Section' => $baseDir.'/../lib/Settings/Section.php',
51
+    'OCA\\User_LDAP\\User\\DeletedUsersIndex' => $baseDir.'/../lib/User/DeletedUsersIndex.php',
52
+    'OCA\\User_LDAP\\User\\IUserTools' => $baseDir.'/../lib/User/IUserTools.php',
53
+    'OCA\\User_LDAP\\User\\Manager' => $baseDir.'/../lib/User/Manager.php',
54
+    'OCA\\User_LDAP\\User\\OfflineUser' => $baseDir.'/../lib/User/OfflineUser.php',
55
+    'OCA\\User_LDAP\\User\\User' => $baseDir.'/../lib/User/User.php',
56
+    'OCA\\User_LDAP\\User_LDAP' => $baseDir.'/../lib/User_LDAP.php',
57
+    'OCA\\User_LDAP\\User_Proxy' => $baseDir.'/../lib/User_Proxy.php',
58
+    'OCA\\User_LDAP\\Wizard' => $baseDir.'/../lib/Wizard.php',
59
+    'OCA\\User_LDAP\\WizardResult' => $baseDir.'/../lib/WizardResult.php',
60 60
 );
Please login to merge, or discard this patch.
apps/user_ldap/composer/composer/autoload_static.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -6,77 +6,77 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitUser_LDAP
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\User_LDAP\\' => 14,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\User_LDAP\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'OCA\\User_LDAP\\Access' => __DIR__ . '/..' . '/../lib/Access.php',
25
-        'OCA\\User_LDAP\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
26
-        'OCA\\User_LDAP\\BackendUtility' => __DIR__ . '/..' . '/../lib/BackendUtility.php',
27
-        'OCA\\User_LDAP\\Command\\CheckUser' => __DIR__ . '/..' . '/../lib/Command/CheckUser.php',
28
-        'OCA\\User_LDAP\\Command\\CreateEmptyConfig' => __DIR__ . '/..' . '/../lib/Command/CreateEmptyConfig.php',
29
-        'OCA\\User_LDAP\\Command\\DeleteConfig' => __DIR__ . '/..' . '/../lib/Command/DeleteConfig.php',
30
-        'OCA\\User_LDAP\\Command\\Search' => __DIR__ . '/..' . '/../lib/Command/Search.php',
31
-        'OCA\\User_LDAP\\Command\\SetConfig' => __DIR__ . '/..' . '/../lib/Command/SetConfig.php',
32
-        'OCA\\User_LDAP\\Command\\ShowConfig' => __DIR__ . '/..' . '/../lib/Command/ShowConfig.php',
33
-        'OCA\\User_LDAP\\Command\\ShowRemnants' => __DIR__ . '/..' . '/../lib/Command/ShowRemnants.php',
34
-        'OCA\\User_LDAP\\Command\\TestConfig' => __DIR__ . '/..' . '/../lib/Command/TestConfig.php',
35
-        'OCA\\User_LDAP\\Configuration' => __DIR__ . '/..' . '/../lib/Configuration.php',
36
-        'OCA\\User_LDAP\\Connection' => __DIR__ . '/..' . '/../lib/Connection.php',
37
-        'OCA\\User_LDAP\\Controller\\ConfigAPIController' => __DIR__ . '/..' . '/../lib/Controller/ConfigAPIController.php',
38
-        'OCA\\User_LDAP\\Controller\\RenewPasswordController' => __DIR__ . '/..' . '/../lib/Controller/RenewPasswordController.php',
39
-        'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => __DIR__ . '/..' . '/../lib/Exceptions/ConstraintViolationException.php',
40
-        'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => __DIR__ . '/..' . '/../lib/Exceptions/NotOnLDAP.php',
41
-        'OCA\\User_LDAP\\FilesystemHelper' => __DIR__ . '/..' . '/../lib/FilesystemHelper.php',
42
-        'OCA\\User_LDAP\\Group_LDAP' => __DIR__ . '/..' . '/../lib/Group_LDAP.php',
43
-        'OCA\\User_LDAP\\Group_Proxy' => __DIR__ . '/..' . '/../lib/Group_Proxy.php',
44
-        'OCA\\User_LDAP\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php',
45
-        'OCA\\User_LDAP\\ILDAPWrapper' => __DIR__ . '/..' . '/../lib/ILDAPWrapper.php',
46
-        'OCA\\User_LDAP\\IUserLDAP' => __DIR__ . '/..' . '/../lib/IUserLDAP.php',
47
-        'OCA\\User_LDAP\\Jobs\\CleanUp' => __DIR__ . '/..' . '/../lib/Jobs/CleanUp.php',
48
-        'OCA\\User_LDAP\\Jobs\\Sync' => __DIR__ . '/..' . '/../lib/Jobs/Sync.php',
49
-        'OCA\\User_LDAP\\Jobs\\UpdateGroups' => __DIR__ . '/..' . '/../lib/Jobs/UpdateGroups.php',
50
-        'OCA\\User_LDAP\\LDAP' => __DIR__ . '/..' . '/../lib/LDAP.php',
51
-        'OCA\\User_LDAP\\LDAPProvider' => __DIR__ . '/..' . '/../lib/LDAPProvider.php',
52
-        'OCA\\User_LDAP\\LDAPProviderFactory' => __DIR__ . '/..' . '/../lib/LDAPProviderFactory.php',
53
-        'OCA\\User_LDAP\\LDAPUtility' => __DIR__ . '/..' . '/../lib/LDAPUtility.php',
54
-        'OCA\\User_LDAP\\LogWrapper' => __DIR__ . '/..' . '/../lib/LogWrapper.php',
55
-        'OCA\\User_LDAP\\Mapping\\AbstractMapping' => __DIR__ . '/..' . '/../lib/Mapping/AbstractMapping.php',
56
-        'OCA\\User_LDAP\\Mapping\\GroupMapping' => __DIR__ . '/..' . '/../lib/Mapping/GroupMapping.php',
57
-        'OCA\\User_LDAP\\Mapping\\UserMapping' => __DIR__ . '/..' . '/../lib/Mapping/UserMapping.php',
58
-        'OCA\\User_LDAP\\Migration\\UUIDFix' => __DIR__ . '/..' . '/../lib/Migration/UUIDFix.php',
59
-        'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixGroup.php',
60
-        'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixInsert.php',
61
-        'OCA\\User_LDAP\\Migration\\UUIDFixUser' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixUser.php',
62
-        'OCA\\User_LDAP\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
63
-        'OCA\\User_LDAP\\Proxy' => __DIR__ . '/..' . '/../lib/Proxy.php',
64
-        'OCA\\User_LDAP\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php',
65
-        'OCA\\User_LDAP\\Settings\\Section' => __DIR__ . '/..' . '/../lib/Settings/Section.php',
66
-        'OCA\\User_LDAP\\User\\DeletedUsersIndex' => __DIR__ . '/..' . '/../lib/User/DeletedUsersIndex.php',
67
-        'OCA\\User_LDAP\\User\\IUserTools' => __DIR__ . '/..' . '/../lib/User/IUserTools.php',
68
-        'OCA\\User_LDAP\\User\\Manager' => __DIR__ . '/..' . '/../lib/User/Manager.php',
69
-        'OCA\\User_LDAP\\User\\OfflineUser' => __DIR__ . '/..' . '/../lib/User/OfflineUser.php',
70
-        'OCA\\User_LDAP\\User\\User' => __DIR__ . '/..' . '/../lib/User/User.php',
71
-        'OCA\\User_LDAP\\User_LDAP' => __DIR__ . '/..' . '/../lib/User_LDAP.php',
72
-        'OCA\\User_LDAP\\User_Proxy' => __DIR__ . '/..' . '/../lib/User_Proxy.php',
73
-        'OCA\\User_LDAP\\Wizard' => __DIR__ . '/..' . '/../lib/Wizard.php',
74
-        'OCA\\User_LDAP\\WizardResult' => __DIR__ . '/..' . '/../lib/WizardResult.php',
23
+    public static $classMap = array(
24
+        'OCA\\User_LDAP\\Access' => __DIR__.'/..'.'/../lib/Access.php',
25
+        'OCA\\User_LDAP\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
26
+        'OCA\\User_LDAP\\BackendUtility' => __DIR__.'/..'.'/../lib/BackendUtility.php',
27
+        'OCA\\User_LDAP\\Command\\CheckUser' => __DIR__.'/..'.'/../lib/Command/CheckUser.php',
28
+        'OCA\\User_LDAP\\Command\\CreateEmptyConfig' => __DIR__.'/..'.'/../lib/Command/CreateEmptyConfig.php',
29
+        'OCA\\User_LDAP\\Command\\DeleteConfig' => __DIR__.'/..'.'/../lib/Command/DeleteConfig.php',
30
+        'OCA\\User_LDAP\\Command\\Search' => __DIR__.'/..'.'/../lib/Command/Search.php',
31
+        'OCA\\User_LDAP\\Command\\SetConfig' => __DIR__.'/..'.'/../lib/Command/SetConfig.php',
32
+        'OCA\\User_LDAP\\Command\\ShowConfig' => __DIR__.'/..'.'/../lib/Command/ShowConfig.php',
33
+        'OCA\\User_LDAP\\Command\\ShowRemnants' => __DIR__.'/..'.'/../lib/Command/ShowRemnants.php',
34
+        'OCA\\User_LDAP\\Command\\TestConfig' => __DIR__.'/..'.'/../lib/Command/TestConfig.php',
35
+        'OCA\\User_LDAP\\Configuration' => __DIR__.'/..'.'/../lib/Configuration.php',
36
+        'OCA\\User_LDAP\\Connection' => __DIR__.'/..'.'/../lib/Connection.php',
37
+        'OCA\\User_LDAP\\Controller\\ConfigAPIController' => __DIR__.'/..'.'/../lib/Controller/ConfigAPIController.php',
38
+        'OCA\\User_LDAP\\Controller\\RenewPasswordController' => __DIR__.'/..'.'/../lib/Controller/RenewPasswordController.php',
39
+        'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => __DIR__.'/..'.'/../lib/Exceptions/ConstraintViolationException.php',
40
+        'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => __DIR__.'/..'.'/../lib/Exceptions/NotOnLDAP.php',
41
+        'OCA\\User_LDAP\\FilesystemHelper' => __DIR__.'/..'.'/../lib/FilesystemHelper.php',
42
+        'OCA\\User_LDAP\\Group_LDAP' => __DIR__.'/..'.'/../lib/Group_LDAP.php',
43
+        'OCA\\User_LDAP\\Group_Proxy' => __DIR__.'/..'.'/../lib/Group_Proxy.php',
44
+        'OCA\\User_LDAP\\Helper' => __DIR__.'/..'.'/../lib/Helper.php',
45
+        'OCA\\User_LDAP\\ILDAPWrapper' => __DIR__.'/..'.'/../lib/ILDAPWrapper.php',
46
+        'OCA\\User_LDAP\\IUserLDAP' => __DIR__.'/..'.'/../lib/IUserLDAP.php',
47
+        'OCA\\User_LDAP\\Jobs\\CleanUp' => __DIR__.'/..'.'/../lib/Jobs/CleanUp.php',
48
+        'OCA\\User_LDAP\\Jobs\\Sync' => __DIR__.'/..'.'/../lib/Jobs/Sync.php',
49
+        'OCA\\User_LDAP\\Jobs\\UpdateGroups' => __DIR__.'/..'.'/../lib/Jobs/UpdateGroups.php',
50
+        'OCA\\User_LDAP\\LDAP' => __DIR__.'/..'.'/../lib/LDAP.php',
51
+        'OCA\\User_LDAP\\LDAPProvider' => __DIR__.'/..'.'/../lib/LDAPProvider.php',
52
+        'OCA\\User_LDAP\\LDAPProviderFactory' => __DIR__.'/..'.'/../lib/LDAPProviderFactory.php',
53
+        'OCA\\User_LDAP\\LDAPUtility' => __DIR__.'/..'.'/../lib/LDAPUtility.php',
54
+        'OCA\\User_LDAP\\LogWrapper' => __DIR__.'/..'.'/../lib/LogWrapper.php',
55
+        'OCA\\User_LDAP\\Mapping\\AbstractMapping' => __DIR__.'/..'.'/../lib/Mapping/AbstractMapping.php',
56
+        'OCA\\User_LDAP\\Mapping\\GroupMapping' => __DIR__.'/..'.'/../lib/Mapping/GroupMapping.php',
57
+        'OCA\\User_LDAP\\Mapping\\UserMapping' => __DIR__.'/..'.'/../lib/Mapping/UserMapping.php',
58
+        'OCA\\User_LDAP\\Migration\\UUIDFix' => __DIR__.'/..'.'/../lib/Migration/UUIDFix.php',
59
+        'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => __DIR__.'/..'.'/../lib/Migration/UUIDFixGroup.php',
60
+        'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => __DIR__.'/..'.'/../lib/Migration/UUIDFixInsert.php',
61
+        'OCA\\User_LDAP\\Migration\\UUIDFixUser' => __DIR__.'/..'.'/../lib/Migration/UUIDFixUser.php',
62
+        'OCA\\User_LDAP\\Notification\\Notifier' => __DIR__.'/..'.'/../lib/Notification/Notifier.php',
63
+        'OCA\\User_LDAP\\Proxy' => __DIR__.'/..'.'/../lib/Proxy.php',
64
+        'OCA\\User_LDAP\\Settings\\Admin' => __DIR__.'/..'.'/../lib/Settings/Admin.php',
65
+        'OCA\\User_LDAP\\Settings\\Section' => __DIR__.'/..'.'/../lib/Settings/Section.php',
66
+        'OCA\\User_LDAP\\User\\DeletedUsersIndex' => __DIR__.'/..'.'/../lib/User/DeletedUsersIndex.php',
67
+        'OCA\\User_LDAP\\User\\IUserTools' => __DIR__.'/..'.'/../lib/User/IUserTools.php',
68
+        'OCA\\User_LDAP\\User\\Manager' => __DIR__.'/..'.'/../lib/User/Manager.php',
69
+        'OCA\\User_LDAP\\User\\OfflineUser' => __DIR__.'/..'.'/../lib/User/OfflineUser.php',
70
+        'OCA\\User_LDAP\\User\\User' => __DIR__.'/..'.'/../lib/User/User.php',
71
+        'OCA\\User_LDAP\\User_LDAP' => __DIR__.'/..'.'/../lib/User_LDAP.php',
72
+        'OCA\\User_LDAP\\User_Proxy' => __DIR__.'/..'.'/../lib/User_Proxy.php',
73
+        'OCA\\User_LDAP\\Wizard' => __DIR__.'/..'.'/../lib/Wizard.php',
74
+        'OCA\\User_LDAP\\WizardResult' => __DIR__.'/..'.'/../lib/WizardResult.php',
75 75
     );
76 76
 
77 77
     public static function getInitializer(ClassLoader $loader)
78 78
     {
79
-        return \Closure::bind(function () use ($loader) {
79
+        return \Closure::bind(function() use ($loader) {
80 80
             $loader->prefixLengthsPsr4 = ComposerStaticInitUser_LDAP::$prefixLengthsPsr4;
81 81
             $loader->prefixDirsPsr4 = ComposerStaticInitUser_LDAP::$prefixDirsPsr4;
82 82
             $loader->classMap = ComposerStaticInitUser_LDAP::$classMap;
Please login to merge, or discard this patch.
apps/user_ldap/lib/Access.php 2 patches
Doc Comments   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 
501 501
 	/**
502 502
 	 * returns the internal Nextcloud name for the given LDAP DN of the user, false on DN outside of search DN or failure
503
-	 * @param string $dn the dn of the user object
503
+	 * @param string $fdn the dn of the user object
504 504
 	 * @param string $ldapName optional, the display name of the object
505 505
 	 * @return string|false with with the name to use in Nextcloud
506 506
 	 */
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 	 * the login filter.
787 787
 	 *
788 788
 	 * @param string $loginName
789
-	 * @param array $attributes optional, list of attributes to read
789
+	 * @param string[] $attributes optional, list of attributes to read
790 790
 	 * @return array
791 791
 	 */
792 792
 	public function fetchUsersByLoginName($loginName, $attributes = array('dn')) {
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 
871 871
 	/**
872 872
 	 * @param string $filter
873
-	 * @param string|string[] $attr
873
+	 * @param string[] $attr
874 874
 	 * @param int $limit
875 875
 	 * @param int $offset
876 876
 	 * @return array
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 
919 919
 	/**
920 920
 	 * @param string $filter
921
-	 * @param string|string[] $attr
921
+	 * @param string[] $attr
922 922
 	 * @param int $limit
923 923
 	 * @param int $offset
924 924
 	 * @return false|int
@@ -1018,6 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 	 * retrieved. Results will according to the order in the array.
1019 1019
 	 * @param int $limit optional, maximum results to be counted
1020 1020
 	 * @param int $offset optional, a starting point
1021
+	 * @param string $filter
1021 1022
 	 * @return array|false array with the search result as first value and pagedSearchOK as
1022 1023
 	 * second | false if not successful
1023 1024
 	 * @throws \OC\ServerNotAvailableException
@@ -1274,7 +1275,7 @@  discard block
 block discarded – undo
1274 1275
 
1275 1276
 	/**
1276 1277
 	 * @param string $name
1277
-	 * @return bool|mixed|string
1278
+	 * @return string
1278 1279
 	 */
1279 1280
 	public function sanitizeUsername($name) {
1280 1281
 		if($this->connection->ldapIgnoreNamingRules) {
@@ -1298,6 +1299,7 @@  discard block
 block discarded – undo
1298 1299
 	* escapes (user provided) parts for LDAP filter
1299 1300
 	* @param string $input, the provided value
1300 1301
 	* @param bool $allowAsterisk whether in * at the beginning should be preserved
1302
+	* @param string $input
1301 1303
 	* @return string the escaped string
1302 1304
 	*/
1303 1305
 	public function escapeFilterPart($input, $allowAsterisk = false) {
Please login to merge, or discard this patch.
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @return AbstractMapping
122 122
 	 */
123 123
 	public function getUserMapper() {
124
-		if(is_null($this->userMapper)) {
124
+		if (is_null($this->userMapper)) {
125 125
 			throw new \Exception('UserMapper was not assigned to this Access instance.');
126 126
 		}
127 127
 		return $this->userMapper;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return AbstractMapping
142 142
 	 */
143 143
 	public function getGroupMapper() {
144
-		if(is_null($this->groupMapper)) {
144
+		if (is_null($this->groupMapper)) {
145 145
 			throw new \Exception('GroupMapper was not assigned to this Access instance.');
146 146
 		}
147 147
 		return $this->groupMapper;
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 	 *          array if $attr is empty, false otherwise
173 173
 	 */
174 174
 	public function readAttribute($dn, $attr, $filter = 'objectClass=*') {
175
-		if(!$this->checkConnection()) {
175
+		if (!$this->checkConnection()) {
176 176
 			\OCP\Util::writeLog('user_ldap',
177 177
 				'No LDAP Connector assigned, access impossible for readAttribute.',
178 178
 				\OCP\Util::WARN);
179 179
 			return false;
180 180
 		}
181 181
 		$cr = $this->connection->getConnectionResource();
182
-		if(!$this->ldap->isResource($cr)) {
182
+		if (!$this->ldap->isResource($cr)) {
183 183
 			//LDAP not available
184 184
 			\OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', \OCP\Util::DEBUG);
185 185
 			return false;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		$isRangeRequest = false;
203 203
 		do {
204 204
 			$result = $this->executeRead($cr, $dn, $attrToRead, $filter, $maxResults);
205
-			if(is_bool($result)) {
205
+			if (is_bool($result)) {
206 206
 				// when an exists request was run and it was successful, an empty
207 207
 				// array must be returned
208 208
 				return $result ? [] : false;
@@ -219,22 +219,22 @@  discard block
 block discarded – undo
219 219
 			$result = $this->extractRangeData($result, $attr);
220 220
 			if (!empty($result)) {
221 221
 				$normalizedResult = $this->extractAttributeValuesFromResult(
222
-					[ $attr => $result['values'] ],
222
+					[$attr => $result['values']],
223 223
 					$attr
224 224
 				);
225 225
 				$values = array_merge($values, $normalizedResult);
226 226
 
227
-				if($result['rangeHigh'] === '*') {
227
+				if ($result['rangeHigh'] === '*') {
228 228
 					// when server replies with * as high range value, there are
229 229
 					// no more results left
230 230
 					return $values;
231 231
 				} else {
232
-					$low  = $result['rangeHigh'] + 1;
233
-					$attrToRead = $result['attributeName'] . ';range=' . $low . '-*';
232
+					$low = $result['rangeHigh'] + 1;
233
+					$attrToRead = $result['attributeName'].';range='.$low.'-*';
234 234
 					$isRangeRequest = true;
235 235
 				}
236 236
 			}
237
-		} while($isRangeRequest);
237
+		} while ($isRangeRequest);
238 238
 
239 239
 		\OCP\Util::writeLog('user_ldap', 'Requested attribute '.$attr.' not found for '.$dn, \OCP\Util::DEBUG);
240 240
 		return false;
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 		if (!$this->ldap->isResource($rr)) {
260 260
 			if ($attribute !== '') {
261 261
 				//do not throw this message on userExists check, irritates
262
-				\OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN ' . $dn, \OCP\Util::DEBUG);
262
+				\OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN '.$dn, \OCP\Util::DEBUG);
263 263
 			}
264 264
 			//in case an error occurs , e.g. object does not exist
265 265
 			return false;
266 266
 		}
267 267
 		if ($attribute === '' && ($filter === 'objectclass=*' || $this->invokeLDAPMethod('countEntries', $cr, $rr) === 1)) {
268
-			\OCP\Util::writeLog('user_ldap', 'readAttribute: ' . $dn . ' found', \OCP\Util::DEBUG);
268
+			\OCP\Util::writeLog('user_ldap', 'readAttribute: '.$dn.' found', \OCP\Util::DEBUG);
269 269
 			return true;
270 270
 		}
271 271
 		$er = $this->invokeLDAPMethod('firstEntry', $cr, $rr);
@@ -290,12 +290,12 @@  discard block
 block discarded – undo
290 290
 	 */
291 291
 	public function extractAttributeValuesFromResult($result, $attribute) {
292 292
 		$values = [];
293
-		if(isset($result[$attribute]) && $result[$attribute]['count'] > 0) {
293
+		if (isset($result[$attribute]) && $result[$attribute]['count'] > 0) {
294 294
 			$lowercaseAttribute = strtolower($attribute);
295
-			for($i=0;$i<$result[$attribute]['count'];$i++) {
296
-				if($this->resemblesDN($attribute)) {
295
+			for ($i = 0; $i < $result[$attribute]['count']; $i++) {
296
+				if ($this->resemblesDN($attribute)) {
297 297
 					$values[] = $this->helper->sanitizeDN($result[$attribute][$i]);
298
-				} elseif($lowercaseAttribute === 'objectguid' || $lowercaseAttribute === 'guid') {
298
+				} elseif ($lowercaseAttribute === 'objectguid' || $lowercaseAttribute === 'guid') {
299 299
 					$values[] = $this->convertObjectGUID2Str($result[$attribute][$i]);
300 300
 				} else {
301 301
 					$values[] = $result[$attribute][$i];
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function extractRangeData($result, $attribute) {
319 319
 		$keys = array_keys($result);
320
-		foreach($keys as $key) {
321
-			if($key !== $attribute && strpos($key, $attribute) === 0) {
320
+		foreach ($keys as $key) {
321
+			if ($key !== $attribute && strpos($key, $attribute) === 0) {
322 322
 				$queryData = explode(';', $key);
323
-				if(strpos($queryData[1], 'range=') === 0) {
323
+				if (strpos($queryData[1], 'range=') === 0) {
324 324
 					$high = substr($queryData[1], 1 + strpos($queryData[1], '-'));
325 325
 					$data = [
326 326
 						'values' => $result[$key],
@@ -345,18 +345,18 @@  discard block
 block discarded – undo
345 345
 	 * @throws \Exception
346 346
 	 */
347 347
 	public function setPassword($userDN, $password) {
348
-		if(intval($this->connection->turnOnPasswordChange) !== 1) {
348
+		if (intval($this->connection->turnOnPasswordChange) !== 1) {
349 349
 			throw new \Exception('LDAP password changes are disabled.');
350 350
 		}
351 351
 		$cr = $this->connection->getConnectionResource();
352
-		if(!$this->ldap->isResource($cr)) {
352
+		if (!$this->ldap->isResource($cr)) {
353 353
 			//LDAP not available
354 354
 			\OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', \OCP\Util::DEBUG);
355 355
 			return false;
356 356
 		}
357 357
 		try {
358 358
 			return @$this->invokeLDAPMethod('modReplace', $cr, $userDN, $password);
359
-		} catch(ConstraintViolationException $e) {
359
+		} catch (ConstraintViolationException $e) {
360 360
 			throw new HintException('Password change rejected.', \OC::$server->getL10N('user_ldap')->t('Password change rejected. Hint: ').$e->getMessage(), $e->getCode());
361 361
 		}
362 362
 	}
@@ -398,17 +398,17 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	public function getDomainDNFromDN($dn) {
400 400
 		$allParts = $this->ldap->explodeDN($dn, 0);
401
-		if($allParts === false) {
401
+		if ($allParts === false) {
402 402
 			//not a valid DN
403 403
 			return '';
404 404
 		}
405 405
 		$domainParts = array();
406 406
 		$dcFound = false;
407
-		foreach($allParts as $part) {
408
-			if(!$dcFound && strpos($part, 'dc=') === 0) {
407
+		foreach ($allParts as $part) {
408
+			if (!$dcFound && strpos($part, 'dc=') === 0) {
409 409
 				$dcFound = true;
410 410
 			}
411
-			if($dcFound) {
411
+			if ($dcFound) {
412 412
 				$domainParts[] = $part;
413 413
 			}
414 414
 		}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 
436 436
 		//Check whether the DN belongs to the Base, to avoid issues on multi-
437 437
 		//server setups
438
-		if(is_string($fdn) && $this->isDNPartOfBase($fdn, $this->connection->ldapBaseUsers)) {
438
+		if (is_string($fdn) && $this->isDNPartOfBase($fdn, $this->connection->ldapBaseUsers)) {
439 439
 			return $fdn;
440 440
 		}
441 441
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		//To avoid bypassing the base DN settings under certain circumstances
453 453
 		//with the group support, check whether the provided DN matches one of
454 454
 		//the given Bases
455
-		if(!$this->isDNPartOfBase($fdn, $this->connection->ldapBaseGroups)) {
455
+		if (!$this->isDNPartOfBase($fdn, $this->connection->ldapBaseGroups)) {
456 456
 			return false;
457 457
 		}
458 458
 
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 	 */
470 470
 	public function groupsMatchFilter($groupDNs) {
471 471
 		$validGroupDNs = [];
472
-		foreach($groupDNs as $dn) {
472
+		foreach ($groupDNs as $dn) {
473 473
 			$cacheKey = 'groupsMatchFilter-'.$dn;
474 474
 			$groupMatchFilter = $this->connection->getFromCache($cacheKey);
475
-			if(!is_null($groupMatchFilter)) {
476
-				if($groupMatchFilter) {
475
+			if (!is_null($groupMatchFilter)) {
476
+				if ($groupMatchFilter) {
477 477
 					$validGroupDNs[] = $dn;
478 478
 				}
479 479
 				continue;
@@ -481,13 +481,13 @@  discard block
 block discarded – undo
481 481
 
482 482
 			// Check the base DN first. If this is not met already, we don't
483 483
 			// need to ask the server at all.
484
-			if(!$this->isDNPartOfBase($dn, $this->connection->ldapBaseGroups)) {
484
+			if (!$this->isDNPartOfBase($dn, $this->connection->ldapBaseGroups)) {
485 485
 				$this->connection->writeToCache($cacheKey, false);
486 486
 				continue;
487 487
 			}
488 488
 
489 489
 			$result = $this->readAttribute($dn, 'cn', $this->connection->ldapGroupFilter);
490
-			if(is_array($result)) {
490
+			if (is_array($result)) {
491 491
 				$this->connection->writeToCache($cacheKey, true);
492 492
 				$validGroupDNs[] = $dn;
493 493
 			} else {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		//To avoid bypassing the base DN settings under certain circumstances
509 509
 		//with the group support, check whether the provided DN matches one of
510 510
 		//the given Bases
511
-		if(!$this->isDNPartOfBase($fdn, $this->connection->ldapBaseUsers)) {
511
+		if (!$this->isDNPartOfBase($fdn, $this->connection->ldapBaseUsers)) {
512 512
 			return false;
513 513
 		}
514 514
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 */
528 528
 	public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped = null, array $record = null) {
529 529
 		$newlyMapped = false;
530
-		if($isUser) {
530
+		if ($isUser) {
531 531
 			$mapper = $this->getUserMapper();
532 532
 			$nameAttribute = $this->connection->ldapUserDisplayName;
533 533
 		} else {
@@ -537,15 +537,15 @@  discard block
 block discarded – undo
537 537
 
538 538
 		//let's try to retrieve the Nextcloud name from the mappings table
539 539
 		$ncName = $mapper->getNameByDN($fdn);
540
-		if(is_string($ncName)) {
540
+		if (is_string($ncName)) {
541 541
 			return $ncName;
542 542
 		}
543 543
 
544 544
 		//second try: get the UUID and check if it is known. Then, update the DN and return the name.
545 545
 		$uuid = $this->getUUID($fdn, $isUser, $record);
546
-		if(is_string($uuid)) {
546
+		if (is_string($uuid)) {
547 547
 			$ncName = $mapper->getNameByUUID($uuid);
548
-			if(is_string($ncName)) {
548
+			if (is_string($ncName)) {
549 549
 				$mapper->setDNbyUUID($fdn, $uuid);
550 550
 				return $ncName;
551 551
 			}
@@ -555,16 +555,16 @@  discard block
 block discarded – undo
555 555
 			return false;
556 556
 		}
557 557
 
558
-		if(is_null($ldapName)) {
558
+		if (is_null($ldapName)) {
559 559
 			$ldapName = $this->readAttribute($fdn, $nameAttribute);
560
-			if(!isset($ldapName[0]) && empty($ldapName[0])) {
560
+			if (!isset($ldapName[0]) && empty($ldapName[0])) {
561 561
 				\OCP\Util::writeLog('user_ldap', 'No or empty name for '.$fdn.'.', \OCP\Util::INFO);
562 562
 				return false;
563 563
 			}
564 564
 			$ldapName = $ldapName[0];
565 565
 		}
566 566
 
567
-		if($isUser) {
567
+		if ($isUser) {
568 568
 			$usernameAttribute = strval($this->connection->ldapExpertUsernameAttr);
569 569
 			if ($usernameAttribute !== '') {
570 570
 				$username = $this->readAttribute($fdn, $usernameAttribute);
@@ -583,9 +583,9 @@  discard block
 block discarded – undo
583 583
 		// outside of core user management will still cache the user as non-existing.
584 584
 		$originalTTL = $this->connection->ldapCacheTTL;
585 585
 		$this->connection->setConfiguration(array('ldapCacheTTL' => 0));
586
-		if(($isUser && !\OCP\User::userExists($intName))
586
+		if (($isUser && !\OCP\User::userExists($intName))
587 587
 			|| (!$isUser && !\OC::$server->getGroupManager()->groupExists($intName))) {
588
-			if($mapper->map($fdn, $intName, $uuid)) {
588
+			if ($mapper->map($fdn, $intName, $uuid)) {
589 589
 				$this->connection->setConfiguration(array('ldapCacheTTL' => $originalTTL));
590 590
 				$newlyMapped = true;
591 591
 				return $intName;
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 		$this->connection->setConfiguration(array('ldapCacheTTL' => $originalTTL));
595 595
 
596 596
 		$altName = $this->createAltInternalOwnCloudName($intName, $isUser);
597
-		if(is_string($altName) && $mapper->map($fdn, $altName, $uuid)) {
597
+		if (is_string($altName) && $mapper->map($fdn, $altName, $uuid)) {
598 598
 			$newlyMapped = true;
599 599
 			return $altName;
600 600
 		}
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 	 * @return array
633 633
 	 */
634 634
 	private function ldap2NextcloudNames($ldapObjects, $isUsers) {
635
-		if($isUsers) {
635
+		if ($isUsers) {
636 636
 			$nameAttribute = $this->connection->ldapUserDisplayName;
637 637
 			$sndAttribute  = $this->connection->ldapUserDisplayName2;
638 638
 		} else {
@@ -640,9 +640,9 @@  discard block
 block discarded – undo
640 640
 		}
641 641
 		$nextcloudNames = array();
642 642
 
643
-		foreach($ldapObjects as $ldapObject) {
643
+		foreach ($ldapObjects as $ldapObject) {
644 644
 			$nameByLDAP = null;
645
-			if(    isset($ldapObject[$nameAttribute])
645
+			if (isset($ldapObject[$nameAttribute])
646 646
 				&& is_array($ldapObject[$nameAttribute])
647 647
 				&& isset($ldapObject[$nameAttribute][0])
648 648
 			) {
@@ -651,12 +651,12 @@  discard block
 block discarded – undo
651 651
 			}
652 652
 
653 653
 			$ncName = $this->dn2ocname($ldapObject['dn'][0], $nameByLDAP, $isUsers);
654
-			if($ncName) {
654
+			if ($ncName) {
655 655
 				$nextcloudNames[] = $ncName;
656
-				if($isUsers) {
656
+				if ($isUsers) {
657 657
 					//cache the user names so it does not need to be retrieved
658 658
 					//again later (e.g. sharing dialogue).
659
-					if(is_null($nameByLDAP)) {
659
+					if (is_null($nameByLDAP)) {
660 660
 						continue;
661 661
 					}
662 662
 					$sndName = isset($ldapObject[$sndAttribute][0])
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 	 */
695 695
 	public function cacheUserDisplayName($ocName, $displayName, $displayName2 = '') {
696 696
 		$user = $this->userManager->get($ocName);
697
-		if($user === null) {
697
+		if ($user === null) {
698 698
 			return;
699 699
 		}
700 700
 		$displayName = $user->composeAndStoreDisplayName($displayName, $displayName2);
@@ -714,9 +714,9 @@  discard block
 block discarded – undo
714 714
 		$attempts = 0;
715 715
 		//while loop is just a precaution. If a name is not generated within
716 716
 		//20 attempts, something else is very wrong. Avoids infinite loop.
717
-		while($attempts < 20){
718
-			$altName = $name . '_' . rand(1000,9999);
719
-			if(!\OCP\User::userExists($altName)) {
717
+		while ($attempts < 20) {
718
+			$altName = $name.'_'.rand(1000, 9999);
719
+			if (!\OCP\User::userExists($altName)) {
720 720
 				return $altName;
721 721
 			}
722 722
 			$attempts++;
@@ -738,25 +738,25 @@  discard block
 block discarded – undo
738 738
 	 */
739 739
 	private function _createAltInternalOwnCloudNameForGroups($name) {
740 740
 		$usedNames = $this->groupMapper->getNamesBySearch($name, "", '_%');
741
-		if(!($usedNames) || count($usedNames) === 0) {
741
+		if (!($usedNames) || count($usedNames) === 0) {
742 742
 			$lastNo = 1; //will become name_2
743 743
 		} else {
744 744
 			natsort($usedNames);
745 745
 			$lastName = array_pop($usedNames);
746 746
 			$lastNo = intval(substr($lastName, strrpos($lastName, '_') + 1));
747 747
 		}
748
-		$altName = $name.'_'.strval($lastNo+1);
748
+		$altName = $name.'_'.strval($lastNo + 1);
749 749
 		unset($usedNames);
750 750
 
751 751
 		$attempts = 1;
752
-		while($attempts < 21){
752
+		while ($attempts < 21) {
753 753
 			// Check to be really sure it is unique
754 754
 			// while loop is just a precaution. If a name is not generated within
755 755
 			// 20 attempts, something else is very wrong. Avoids infinite loop.
756
-			if(!\OC::$server->getGroupManager()->groupExists($altName)) {
756
+			if (!\OC::$server->getGroupManager()->groupExists($altName)) {
757 757
 				return $altName;
758 758
 			}
759
-			$altName = $name . '_' . ($lastNo + $attempts);
759
+			$altName = $name.'_'.($lastNo + $attempts);
760 760
 			$attempts++;
761 761
 		}
762 762
 		return false;
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	private function createAltInternalOwnCloudName($name, $isUser) {
772 772
 		$originalTTL = $this->connection->ldapCacheTTL;
773 773
 		$this->connection->setConfiguration(array('ldapCacheTTL' => 0));
774
-		if($isUser) {
774
+		if ($isUser) {
775 775
 			$altName = $this->_createAltInternalOwnCloudNameForUsers($name);
776 776
 		} else {
777 777
 			$altName = $this->_createAltInternalOwnCloudNameForGroups($name);
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 	public function fetchListOfUsers($filter, $attr, $limit = null, $offset = null, $forceApplyAttributes = false) {
822 822
 		$ldapRecords = $this->searchUsers($filter, $attr, $limit, $offset);
823 823
 		$recordsToUpdate = $ldapRecords;
824
-		if(!$forceApplyAttributes) {
824
+		if (!$forceApplyAttributes) {
825 825
 			$isBackgroundJobModeAjax = $this->c->getConfig()
826 826
 					->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax';
827 827
 			$recordsToUpdate = array_filter($ldapRecords, function($record) use ($isBackgroundJobModeAjax) {
@@ -840,20 +840,20 @@  discard block
 block discarded – undo
840 840
 	 * and their values
841 841
 	 * @param array $ldapRecords
842 842
 	 */
843
-	public function batchApplyUserAttributes(array $ldapRecords){
843
+	public function batchApplyUserAttributes(array $ldapRecords) {
844 844
 		$displayNameAttribute = strtolower($this->connection->ldapUserDisplayName);
845
-		foreach($ldapRecords as $userRecord) {
846
-			if(!isset($userRecord[$displayNameAttribute])) {
845
+		foreach ($ldapRecords as $userRecord) {
846
+			if (!isset($userRecord[$displayNameAttribute])) {
847 847
 				// displayName is obligatory
848 848
 				continue;
849 849
 			}
850
-			$ocName  = $this->dn2ocname($userRecord['dn'][0], null, true);
851
-			if($ocName === false) {
850
+			$ocName = $this->dn2ocname($userRecord['dn'][0], null, true);
851
+			if ($ocName === false) {
852 852
 				continue;
853 853
 			}
854 854
 			$this->cacheUserExists($ocName);
855 855
 			$user = $this->userManager->get($ocName);
856
-			if($user instanceof OfflineUser) {
856
+			if ($user instanceof OfflineUser) {
857 857
 				$user->unmark();
858 858
 				$user = $this->userManager->get($ocName);
859 859
 			}
@@ -885,8 +885,8 @@  discard block
 block discarded – undo
885 885
 	 * @return array
886 886
 	 */
887 887
 	private function fetchList($list, $manyAttributes) {
888
-		if(is_array($list)) {
889
-			if($manyAttributes) {
888
+		if (is_array($list)) {
889
+			if ($manyAttributes) {
890 890
 				return $list;
891 891
 			} else {
892 892
 				$list = array_reduce($list, function($carry, $item) {
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 		// php no longer supports call-time pass-by-reference
985 985
 		// thus cannot support controlPagedResultResponse as the third argument
986 986
 		// is a reference
987
-		$doMethod = function () use ($command, &$arguments) {
987
+		$doMethod = function() use ($command, &$arguments) {
988 988
 			if ($command == 'controlPagedResultResponse') {
989 989
 				throw new \InvalidArgumentException('Invoker does not support controlPagedResultResponse, call LDAP Wrapper directly instead.');
990 990
 			} else {
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 			$this->connection->resetConnectionResource();
1003 1003
 			$cr = $this->connection->getConnectionResource();
1004 1004
 
1005
-			if(!$this->ldap->isResource($cr)) {
1005
+			if (!$this->ldap->isResource($cr)) {
1006 1006
 				// Seems like we didn't find any resource.
1007 1007
 				\OCP\Util::writeLog('user_ldap', "Could not $command, because resource is missing.", \OCP\Util::DEBUG);
1008 1008
 				throw $e;
@@ -1023,13 +1023,13 @@  discard block
 block discarded – undo
1023 1023
 	 * @throws \OC\ServerNotAvailableException
1024 1024
 	 */
1025 1025
 	private function executeSearch($filter, $base, &$attr = null, $limit = null, $offset = null) {
1026
-		if(!is_null($attr) && !is_array($attr)) {
1026
+		if (!is_null($attr) && !is_array($attr)) {
1027 1027
 			$attr = array(mb_strtolower($attr, 'UTF-8'));
1028 1028
 		}
1029 1029
 
1030 1030
 		// See if we have a resource, in case not cancel with message
1031 1031
 		$cr = $this->connection->getConnectionResource();
1032
-		if(!$this->ldap->isResource($cr)) {
1032
+		if (!$this->ldap->isResource($cr)) {
1033 1033
 			// Seems like we didn't find any resource.
1034 1034
 			// Return an empty array just like before.
1035 1035
 			\OCP\Util::writeLog('user_ldap', 'Could not search, because resource is missing.', \OCP\Util::DEBUG);
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 		$sr = $this->invokeLDAPMethod('search', $linkResources, $base, $filter, $attr);
1044 1044
 		// cannot use $cr anymore, might have changed in the previous call!
1045 1045
 		$error = $this->ldap->errno($this->connection->getConnectionResource());
1046
-		if(!is_array($sr) || $error !== 0) {
1046
+		if (!is_array($sr) || $error !== 0) {
1047 1047
 			\OCP\Util::writeLog('user_ldap', 'Attempt for Paging?  '.print_r($pagedSearchOK, true), \OCP\Util::ERROR);
1048 1048
 			return false;
1049 1049
 		}
@@ -1066,26 +1066,26 @@  discard block
 block discarded – undo
1066 1066
 	 */
1067 1067
 	private function processPagedSearchStatus($sr, $filter, $base, $iFoundItems, $limit, $offset, $pagedSearchOK, $skipHandling) {
1068 1068
 		$cookie = null;
1069
-		if($pagedSearchOK) {
1069
+		if ($pagedSearchOK) {
1070 1070
 			$cr = $this->connection->getConnectionResource();
1071
-			foreach($sr as $key => $res) {
1072
-				if($this->ldap->controlPagedResultResponse($cr, $res, $cookie)) {
1071
+			foreach ($sr as $key => $res) {
1072
+				if ($this->ldap->controlPagedResultResponse($cr, $res, $cookie)) {
1073 1073
 					$this->setPagedResultCookie($base[$key], $filter, $limit, $offset, $cookie);
1074 1074
 				}
1075 1075
 			}
1076 1076
 
1077 1077
 			//browsing through prior pages to get the cookie for the new one
1078
-			if($skipHandling) {
1078
+			if ($skipHandling) {
1079 1079
 				return false;
1080 1080
 			}
1081 1081
 			// if count is bigger, then the server does not support
1082 1082
 			// paged search. Instead, he did a normal search. We set a
1083 1083
 			// flag here, so the callee knows how to deal with it.
1084
-			if($iFoundItems <= $limit) {
1084
+			if ($iFoundItems <= $limit) {
1085 1085
 				$this->pagedSearchedSuccessful = true;
1086 1086
 			}
1087 1087
 		} else {
1088
-			if(!is_null($limit)) {
1088
+			if (!is_null($limit)) {
1089 1089
 				\OCP\Util::writeLog('user_ldap', 'Paged search was not available', \OCP\Util::INFO);
1090 1090
 			}
1091 1091
 		}
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 		\OCP\Util::writeLog('user_ldap', 'Count filter:  '.print_r($filter, true), \OCP\Util::DEBUG);
1115 1115
 
1116 1116
 		$limitPerPage = intval($this->connection->ldapPagingSize);
1117
-		if(!is_null($limit) && $limit < $limitPerPage && $limit > 0) {
1117
+		if (!is_null($limit) && $limit < $limitPerPage && $limit > 0) {
1118 1118
 			$limitPerPage = $limit;
1119 1119
 		}
1120 1120
 
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 		do {
1126 1126
 			$search = $this->executeSearch($filter, $base, $attr,
1127 1127
 										   $limitPerPage, $offset);
1128
-			if($search === false) {
1128
+			if ($search === false) {
1129 1129
 				return $counter > 0 ? $counter : false;
1130 1130
 			}
1131 1131
 			list($sr, $pagedSearchOK) = $search;
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 			 * Continue now depends on $hasMorePages value
1145 1145
 			 */
1146 1146
 			$continue = $pagedSearchOK && $hasMorePages;
1147
-		} while($continue && (is_null($limit) || $limit <= 0 || $limit > $counter));
1147
+		} while ($continue && (is_null($limit) || $limit <= 0 || $limit > $counter));
1148 1148
 
1149 1149
 		return $counter;
1150 1150
 	}
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 	private function countEntriesInSearchResults($searchResults) {
1157 1157
 		$counter = 0;
1158 1158
 
1159
-		foreach($searchResults as $res) {
1159
+		foreach ($searchResults as $res) {
1160 1160
 			$count = intval($this->invokeLDAPMethod('countEntries', $this->connection->getConnectionResource(), $res));
1161 1161
 			$counter += $count;
1162 1162
 		}
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 	 */
1177 1177
 	public function search($filter, $base, $attr = null, $limit = null, $offset = null, $skipHandling = false) {
1178 1178
 		$limitPerPage = intval($this->connection->ldapPagingSize);
1179
-		if(!is_null($limit) && $limit < $limitPerPage && $limit > 0) {
1179
+		if (!is_null($limit) && $limit < $limitPerPage && $limit > 0) {
1180 1180
 			$limitPerPage = $limit;
1181 1181
 		}
1182 1182
 
@@ -1190,13 +1190,13 @@  discard block
 block discarded – undo
1190 1190
 		$savedoffset = $offset;
1191 1191
 		do {
1192 1192
 			$search = $this->executeSearch($filter, $base, $attr, $limitPerPage, $offset);
1193
-			if($search === false) {
1193
+			if ($search === false) {
1194 1194
 				return array();
1195 1195
 			}
1196 1196
 			list($sr, $pagedSearchOK) = $search;
1197 1197
 			$cr = $this->connection->getConnectionResource();
1198 1198
 
1199
-			if($skipHandling) {
1199
+			if ($skipHandling) {
1200 1200
 				//i.e. result do not need to be fetched, we just need the cookie
1201 1201
 				//thus pass 1 or any other value as $iFoundItems because it is not
1202 1202
 				//used
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 			}
1208 1208
 
1209 1209
 			$iFoundItems = 0;
1210
-			foreach($sr as $res) {
1210
+			foreach ($sr as $res) {
1211 1211
 				$findings = array_merge($findings, $this->invokeLDAPMethod('getEntries', $cr, $res));
1212 1212
 				$iFoundItems = max($iFoundItems, $findings['count']);
1213 1213
 				unset($findings['count']);
@@ -1223,25 +1223,25 @@  discard block
 block discarded – undo
1223 1223
 
1224 1224
 		// if we're here, probably no connection resource is returned.
1225 1225
 		// to make Nextcloud behave nicely, we simply give back an empty array.
1226
-		if(is_null($findings)) {
1226
+		if (is_null($findings)) {
1227 1227
 			return array();
1228 1228
 		}
1229 1229
 
1230
-		if(!is_null($attr)) {
1230
+		if (!is_null($attr)) {
1231 1231
 			$selection = array();
1232 1232
 			$i = 0;
1233
-			foreach($findings as $item) {
1234
-				if(!is_array($item)) {
1233
+			foreach ($findings as $item) {
1234
+				if (!is_array($item)) {
1235 1235
 					continue;
1236 1236
 				}
1237 1237
 				$item = \OCP\Util::mb_array_change_key_case($item, MB_CASE_LOWER, 'UTF-8');
1238
-				foreach($attr as $key) {
1238
+				foreach ($attr as $key) {
1239 1239
 					$key = mb_strtolower($key, 'UTF-8');
1240
-					if(isset($item[$key])) {
1241
-						if(is_array($item[$key]) && isset($item[$key]['count'])) {
1240
+					if (isset($item[$key])) {
1241
+						if (is_array($item[$key]) && isset($item[$key]['count'])) {
1242 1242
 							unset($item[$key]['count']);
1243 1243
 						}
1244
-						if($key !== 'dn') {
1244
+						if ($key !== 'dn') {
1245 1245
 							$selection[$i][$key] = $this->resemblesDN($key) ?
1246 1246
 								$this->helper->sanitizeDN($item[$key])
1247 1247
 								: $key === 'objectguid' || $key === 'guid' ?
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 		//we slice the findings, when
1261 1261
 		//a) paged search unsuccessful, though attempted
1262 1262
 		//b) no paged search, but limit set
1263
-		if((!$this->getPagedSearchResultState()
1263
+		if ((!$this->getPagedSearchResultState()
1264 1264
 			&& $pagedSearchOK)
1265 1265
 			|| (
1266 1266
 				!$pagedSearchOK
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
 	 * @return bool|mixed|string
1278 1278
 	 */
1279 1279
 	public function sanitizeUsername($name) {
1280
-		if($this->connection->ldapIgnoreNamingRules) {
1280
+		if ($this->connection->ldapIgnoreNamingRules) {
1281 1281
 			return $name;
1282 1282
 		}
1283 1283
 
@@ -1302,13 +1302,13 @@  discard block
 block discarded – undo
1302 1302
 	*/
1303 1303
 	public function escapeFilterPart($input, $allowAsterisk = false) {
1304 1304
 		$asterisk = '';
1305
-		if($allowAsterisk && strlen($input) > 0 && $input[0] === '*') {
1305
+		if ($allowAsterisk && strlen($input) > 0 && $input[0] === '*') {
1306 1306
 			$asterisk = '*';
1307 1307
 			$input = mb_substr($input, 1, null, 'UTF-8');
1308 1308
 		}
1309 1309
 		$search  = array('*', '\\', '(', ')');
1310 1310
 		$replace = array('\\*', '\\\\', '\\(', '\\)');
1311
-		return $asterisk . str_replace($search, $replace, $input);
1311
+		return $asterisk.str_replace($search, $replace, $input);
1312 1312
 	}
1313 1313
 
1314 1314
 	/**
@@ -1338,13 +1338,13 @@  discard block
 block discarded – undo
1338 1338
 	 */
1339 1339
 	private function combineFilter($filters, $operator) {
1340 1340
 		$combinedFilter = '('.$operator;
1341
-		foreach($filters as $filter) {
1341
+		foreach ($filters as $filter) {
1342 1342
 			if ($filter !== '' && $filter[0] !== '(') {
1343 1343
 				$filter = '('.$filter.')';
1344 1344
 			}
1345
-			$combinedFilter.=$filter;
1345
+			$combinedFilter .= $filter;
1346 1346
 		}
1347
-		$combinedFilter.=')';
1347
+		$combinedFilter .= ')';
1348 1348
 		return $combinedFilter;
1349 1349
 	}
1350 1350
 
@@ -1380,17 +1380,17 @@  discard block
 block discarded – undo
1380 1380
 	 * @throws \Exception
1381 1381
 	 */
1382 1382
 	private function getAdvancedFilterPartForSearch($search, $searchAttributes) {
1383
-		if(!is_array($searchAttributes) || count($searchAttributes) < 2) {
1383
+		if (!is_array($searchAttributes) || count($searchAttributes) < 2) {
1384 1384
 			throw new \Exception('searchAttributes must be an array with at least two string');
1385 1385
 		}
1386 1386
 		$searchWords = explode(' ', trim($search));
1387 1387
 		$wordFilters = array();
1388
-		foreach($searchWords as $word) {
1388
+		foreach ($searchWords as $word) {
1389 1389
 			$word = $this->prepareSearchTerm($word);
1390 1390
 			//every word needs to appear at least once
1391 1391
 			$wordMatchOneAttrFilters = array();
1392
-			foreach($searchAttributes as $attr) {
1393
-				$wordMatchOneAttrFilters[] = $attr . '=' . $word;
1392
+			foreach ($searchAttributes as $attr) {
1393
+				$wordMatchOneAttrFilters[] = $attr.'='.$word;
1394 1394
 			}
1395 1395
 			$wordFilters[] = $this->combineFilterWithOr($wordMatchOneAttrFilters);
1396 1396
 		}
@@ -1408,10 +1408,10 @@  discard block
 block discarded – undo
1408 1408
 	private function getFilterPartForSearch($search, $searchAttributes, $fallbackAttribute) {
1409 1409
 		$filter = array();
1410 1410
 		$haveMultiSearchAttributes = (is_array($searchAttributes) && count($searchAttributes) > 0);
1411
-		if($haveMultiSearchAttributes && strpos(trim($search), ' ') !== false) {
1411
+		if ($haveMultiSearchAttributes && strpos(trim($search), ' ') !== false) {
1412 1412
 			try {
1413 1413
 				return $this->getAdvancedFilterPartForSearch($search, $searchAttributes);
1414
-			} catch(\Exception $e) {
1414
+			} catch (\Exception $e) {
1415 1415
 				\OCP\Util::writeLog(
1416 1416
 					'user_ldap',
1417 1417
 					'Creating advanced filter for search failed, falling back to simple method.',
@@ -1421,17 +1421,17 @@  discard block
 block discarded – undo
1421 1421
 		}
1422 1422
 
1423 1423
 		$search = $this->prepareSearchTerm($search);
1424
-		if(!is_array($searchAttributes) || count($searchAttributes) === 0) {
1424
+		if (!is_array($searchAttributes) || count($searchAttributes) === 0) {
1425 1425
 			if ($fallbackAttribute === '') {
1426 1426
 				return '';
1427 1427
 			}
1428
-			$filter[] = $fallbackAttribute . '=' . $search;
1428
+			$filter[] = $fallbackAttribute.'='.$search;
1429 1429
 		} else {
1430
-			foreach($searchAttributes as $attribute) {
1431
-				$filter[] = $attribute . '=' . $search;
1430
+			foreach ($searchAttributes as $attribute) {
1431
+				$filter[] = $attribute.'='.$search;
1432 1432
 			}
1433 1433
 		}
1434
-		if(count($filter) === 1) {
1434
+		if (count($filter) === 1) {
1435 1435
 			return '('.$filter[0].')';
1436 1436
 		}
1437 1437
 		return $this->combineFilterWithOr($filter);
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
 		if ($term === '') {
1453 1453
 			$result = '*';
1454 1454
 		} else if ($allowEnum !== 'no') {
1455
-			$result = $term . '*';
1455
+			$result = $term.'*';
1456 1456
 		}
1457 1457
 		return $result;
1458 1458
 	}
@@ -1464,7 +1464,7 @@  discard block
 block discarded – undo
1464 1464
 	public function getFilterForUserCount() {
1465 1465
 		$filter = $this->combineFilterWithAnd(array(
1466 1466
 			$this->connection->ldapUserFilter,
1467
-			$this->connection->ldapUserDisplayName . '=*'
1467
+			$this->connection->ldapUserDisplayName.'=*'
1468 1468
 		));
1469 1469
 
1470 1470
 		return $filter;
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
 			'ldapAgentName' => $name,
1483 1483
 			'ldapAgentPassword' => $password
1484 1484
 		);
1485
-		if(!$testConnection->setConfiguration($credentials)) {
1485
+		if (!$testConnection->setConfiguration($credentials)) {
1486 1486
 			return false;
1487 1487
 		}
1488 1488
 		return $testConnection->bind();
@@ -1504,30 +1504,30 @@  discard block
 block discarded – undo
1504 1504
 			// Sacrebleu! The UUID attribute is unknown :( We need first an
1505 1505
 			// existing DN to be able to reliably detect it.
1506 1506
 			$result = $this->search($filter, $base, ['dn'], 1);
1507
-			if(!isset($result[0]) || !isset($result[0]['dn'])) {
1507
+			if (!isset($result[0]) || !isset($result[0]['dn'])) {
1508 1508
 				throw new \Exception('Cannot determine UUID attribute');
1509 1509
 			}
1510 1510
 			$dn = $result[0]['dn'][0];
1511
-			if(!$this->detectUuidAttribute($dn, true)) {
1511
+			if (!$this->detectUuidAttribute($dn, true)) {
1512 1512
 				throw new \Exception('Cannot determine UUID attribute');
1513 1513
 			}
1514 1514
 		} else {
1515 1515
 			// The UUID attribute is either known or an override is given.
1516 1516
 			// By calling this method we ensure that $this->connection->$uuidAttr
1517 1517
 			// is definitely set
1518
-			if(!$this->detectUuidAttribute('', true)) {
1518
+			if (!$this->detectUuidAttribute('', true)) {
1519 1519
 				throw new \Exception('Cannot determine UUID attribute');
1520 1520
 			}
1521 1521
 		}
1522 1522
 
1523 1523
 		$uuidAttr = $this->connection->ldapUuidUserAttribute;
1524
-		if($uuidAttr === 'guid' || $uuidAttr === 'objectguid') {
1524
+		if ($uuidAttr === 'guid' || $uuidAttr === 'objectguid') {
1525 1525
 			$uuid = $this->formatGuid2ForFilterUser($uuid);
1526 1526
 		}
1527 1527
 
1528
-		$filter = $uuidAttr . '=' . $uuid;
1528
+		$filter = $uuidAttr.'='.$uuid;
1529 1529
 		$result = $this->searchUsers($filter, ['dn'], 2);
1530
-		if(is_array($result) && isset($result[0]) && isset($result[0]['dn']) && count($result) === 1) {
1530
+		if (is_array($result) && isset($result[0]) && isset($result[0]['dn']) && count($result) === 1) {
1531 1531
 			// we put the count into account to make sure that this is
1532 1532
 			// really unique
1533 1533
 			return $result[0]['dn'][0];
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 	 * @return bool true on success, false otherwise
1547 1547
 	 */
1548 1548
 	private function detectUuidAttribute($dn, $isUser = true, $force = false, array $ldapRecord = null) {
1549
-		if($isUser) {
1549
+		if ($isUser) {
1550 1550
 			$uuidAttr     = 'ldapUuidUserAttribute';
1551 1551
 			$uuidOverride = $this->connection->ldapExpertUUIDUserAttr;
1552 1552
 		} else {
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
 			$uuidOverride = $this->connection->ldapExpertUUIDGroupAttr;
1555 1555
 		}
1556 1556
 
1557
-		if(($this->connection->$uuidAttr !== 'auto') && !$force) {
1557
+		if (($this->connection->$uuidAttr !== 'auto') && !$force) {
1558 1558
 			return true;
1559 1559
 		}
1560 1560
 
@@ -1563,10 +1563,10 @@  discard block
 block discarded – undo
1563 1563
 			return true;
1564 1564
 		}
1565 1565
 
1566
-		foreach(self::UUID_ATTRIBUTES as $attribute) {
1567
-			if($ldapRecord !== null) {
1566
+		foreach (self::UUID_ATTRIBUTES as $attribute) {
1567
+			if ($ldapRecord !== null) {
1568 1568
 				// we have the info from LDAP already, we don't need to talk to the server again
1569
-				if(isset($ldapRecord[$attribute])) {
1569
+				if (isset($ldapRecord[$attribute])) {
1570 1570
 					$this->connection->$uuidAttr = $attribute;
1571 1571
 					return true;
1572 1572
 				} else {
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
 			}
1576 1576
 
1577 1577
 			$value = $this->readAttribute($dn, $attribute);
1578
-			if(is_array($value) && isset($value[0]) && !empty($value[0])) {
1578
+			if (is_array($value) && isset($value[0]) && !empty($value[0])) {
1579 1579
 				\OCP\Util::writeLog('user_ldap',
1580 1580
 									'Setting '.$attribute.' as '.$uuidAttr,
1581 1581
 									\OCP\Util::DEBUG);
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
 	 * @return bool|string
1598 1598
 	 */
1599 1599
 	public function getUUID($dn, $isUser = true, $ldapRecord = null) {
1600
-		if($isUser) {
1600
+		if ($isUser) {
1601 1601
 			$uuidAttr     = 'ldapUuidUserAttribute';
1602 1602
 			$uuidOverride = $this->connection->ldapExpertUUIDUserAttr;
1603 1603
 		} else {
@@ -1606,10 +1606,10 @@  discard block
 block discarded – undo
1606 1606
 		}
1607 1607
 
1608 1608
 		$uuid = false;
1609
-		if($this->detectUuidAttribute($dn, $isUser, false, $ldapRecord)) {
1609
+		if ($this->detectUuidAttribute($dn, $isUser, false, $ldapRecord)) {
1610 1610
 			$attr = $this->connection->$uuidAttr;
1611 1611
 			$uuid = isset($ldapRecord[$attr]) ? $ldapRecord[$attr] : $this->readAttribute($dn, $attr);
1612
-			if( !is_array($uuid)
1612
+			if (!is_array($uuid)
1613 1613
 				&& $uuidOverride !== ''
1614 1614
 				&& $this->detectUuidAttribute($dn, $isUser, true, $ldapRecord))
1615 1615
 			{
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
 					? $ldapRecord[$this->connection->$uuidAttr]
1618 1618
 					: $this->readAttribute($dn, $this->connection->$uuidAttr);
1619 1619
 			}
1620
-			if(is_array($uuid) && isset($uuid[0]) && !empty($uuid[0])) {
1620
+			if (is_array($uuid) && isset($uuid[0]) && !empty($uuid[0])) {
1621 1621
 				$uuid = $uuid[0];
1622 1622
 			}
1623 1623
 		}
@@ -1634,19 +1634,19 @@  discard block
 block discarded – undo
1634 1634
 	private function convertObjectGUID2Str($oguid) {
1635 1635
 		$hex_guid = bin2hex($oguid);
1636 1636
 		$hex_guid_to_guid_str = '';
1637
-		for($k = 1; $k <= 4; ++$k) {
1637
+		for ($k = 1; $k <= 4; ++$k) {
1638 1638
 			$hex_guid_to_guid_str .= substr($hex_guid, 8 - 2 * $k, 2);
1639 1639
 		}
1640 1640
 		$hex_guid_to_guid_str .= '-';
1641
-		for($k = 1; $k <= 2; ++$k) {
1641
+		for ($k = 1; $k <= 2; ++$k) {
1642 1642
 			$hex_guid_to_guid_str .= substr($hex_guid, 12 - 2 * $k, 2);
1643 1643
 		}
1644 1644
 		$hex_guid_to_guid_str .= '-';
1645
-		for($k = 1; $k <= 2; ++$k) {
1645
+		for ($k = 1; $k <= 2; ++$k) {
1646 1646
 			$hex_guid_to_guid_str .= substr($hex_guid, 16 - 2 * $k, 2);
1647 1647
 		}
1648
-		$hex_guid_to_guid_str .= '-' . substr($hex_guid, 16, 4);
1649
-		$hex_guid_to_guid_str .= '-' . substr($hex_guid, 20);
1648
+		$hex_guid_to_guid_str .= '-'.substr($hex_guid, 16, 4);
1649
+		$hex_guid_to_guid_str .= '-'.substr($hex_guid, 20);
1650 1650
 
1651 1651
 		return strtoupper($hex_guid_to_guid_str);
1652 1652
 	}
@@ -1663,11 +1663,11 @@  discard block
 block discarded – undo
1663 1663
 	 * @return string
1664 1664
 	 */
1665 1665
 	public function formatGuid2ForFilterUser($guid) {
1666
-		if(!is_string($guid)) {
1666
+		if (!is_string($guid)) {
1667 1667
 			throw new \InvalidArgumentException('String expected');
1668 1668
 		}
1669 1669
 		$blocks = explode('-', $guid);
1670
-		if(count($blocks) !== 5) {
1670
+		if (count($blocks) !== 5) {
1671 1671
 			/*
1672 1672
 			 * Why not throw an Exception instead? This method is a utility
1673 1673
 			 * called only when trying to figure out whether a "missing" known
@@ -1680,20 +1680,20 @@  discard block
 block discarded – undo
1680 1680
 			 * user. Instead we write a log message.
1681 1681
 			 */
1682 1682
 			\OC::$server->getLogger()->info(
1683
-				'Passed string does not resemble a valid GUID. Known UUID ' .
1683
+				'Passed string does not resemble a valid GUID. Known UUID '.
1684 1684
 				'({uuid}) probably does not match UUID configuration.',
1685
-				[ 'app' => 'user_ldap', 'uuid' => $guid ]
1685
+				['app' => 'user_ldap', 'uuid' => $guid]
1686 1686
 			);
1687 1687
 			return $guid;
1688 1688
 		}
1689
-		for($i=0; $i < 3; $i++) {
1689
+		for ($i = 0; $i < 3; $i++) {
1690 1690
 			$pairs = str_split($blocks[$i], 2);
1691 1691
 			$pairs = array_reverse($pairs);
1692 1692
 			$blocks[$i] = implode('', $pairs);
1693 1693
 		}
1694
-		for($i=0; $i < 5; $i++) {
1694
+		for ($i = 0; $i < 5; $i++) {
1695 1695
 			$pairs = str_split($blocks[$i], 2);
1696
-			$blocks[$i] = '\\' . implode('\\', $pairs);
1696
+			$blocks[$i] = '\\'.implode('\\', $pairs);
1697 1697
 		}
1698 1698
 		return implode('', $blocks);
1699 1699
 	}
@@ -1707,12 +1707,12 @@  discard block
 block discarded – undo
1707 1707
 		$domainDN = $this->getDomainDNFromDN($dn);
1708 1708
 		$cacheKey = 'getSID-'.$domainDN;
1709 1709
 		$sid = $this->connection->getFromCache($cacheKey);
1710
-		if(!is_null($sid)) {
1710
+		if (!is_null($sid)) {
1711 1711
 			return $sid;
1712 1712
 		}
1713 1713
 
1714 1714
 		$objectSid = $this->readAttribute($domainDN, 'objectsid');
1715
-		if(!is_array($objectSid) || empty($objectSid)) {
1715
+		if (!is_array($objectSid) || empty($objectSid)) {
1716 1716
 			$this->connection->writeToCache($cacheKey, false);
1717 1717
 			return false;
1718 1718
 		}
@@ -1770,12 +1770,12 @@  discard block
 block discarded – undo
1770 1770
 		$belongsToBase = false;
1771 1771
 		$bases = $this->helper->sanitizeDN($bases);
1772 1772
 
1773
-		foreach($bases as $base) {
1773
+		foreach ($bases as $base) {
1774 1774
 			$belongsToBase = true;
1775
-			if(mb_strripos($dn, $base, 0, 'UTF-8') !== (mb_strlen($dn, 'UTF-8')-mb_strlen($base, 'UTF-8'))) {
1775
+			if (mb_strripos($dn, $base, 0, 'UTF-8') !== (mb_strlen($dn, 'UTF-8') - mb_strlen($base, 'UTF-8'))) {
1776 1776
 				$belongsToBase = false;
1777 1777
 			}
1778
-			if($belongsToBase) {
1778
+			if ($belongsToBase) {
1779 1779
 				break;
1780 1780
 			}
1781 1781
 		}
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
 	 * resets a running Paged Search operation
1787 1787
 	 */
1788 1788
 	private function abandonPagedSearch() {
1789
-		if($this->connection->hasPagedResultSupport) {
1789
+		if ($this->connection->hasPagedResultSupport) {
1790 1790
 			$cr = $this->connection->getConnectionResource();
1791 1791
 			$this->invokeLDAPMethod('controlPagedResult', $cr, 0, false, $this->lastCookie);
1792 1792
 			$this->getPagedSearchResultState();
@@ -1804,16 +1804,16 @@  discard block
 block discarded – undo
1804 1804
 	 * @return string containing the key or empty if none is cached
1805 1805
 	 */
1806 1806
 	private function getPagedResultCookie($base, $filter, $limit, $offset) {
1807
-		if($offset === 0) {
1807
+		if ($offset === 0) {
1808 1808
 			return '';
1809 1809
 		}
1810 1810
 		$offset -= $limit;
1811 1811
 		//we work with cache here
1812
-		$cacheKey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' . intval($limit) . '-' . intval($offset);
1812
+		$cacheKey = 'lc'.crc32($base).'-'.crc32($filter).'-'.intval($limit).'-'.intval($offset);
1813 1813
 		$cookie = '';
1814
-		if(isset($this->cookies[$cacheKey])) {
1814
+		if (isset($this->cookies[$cacheKey])) {
1815 1815
 			$cookie = $this->cookies[$cacheKey];
1816
-			if(is_null($cookie)) {
1816
+			if (is_null($cookie)) {
1817 1817
 				$cookie = '';
1818 1818
 			}
1819 1819
 		}
@@ -1831,11 +1831,11 @@  discard block
 block discarded – undo
1831 1831
 	 * @return bool
1832 1832
 	 */
1833 1833
 	public function hasMoreResults() {
1834
-		if(!$this->connection->hasPagedResultSupport) {
1834
+		if (!$this->connection->hasPagedResultSupport) {
1835 1835
 			return false;
1836 1836
 		}
1837 1837
 
1838
-		if(empty($this->lastCookie) && $this->lastCookie !== '0') {
1838
+		if (empty($this->lastCookie) && $this->lastCookie !== '0') {
1839 1839
 			// as in RFC 2696, when all results are returned, the cookie will
1840 1840
 			// be empty.
1841 1841
 			return false;
@@ -1855,8 +1855,8 @@  discard block
 block discarded – undo
1855 1855
 	 */
1856 1856
 	private function setPagedResultCookie($base, $filter, $limit, $offset, $cookie) {
1857 1857
 		// allow '0' for 389ds
1858
-		if(!empty($cookie) || $cookie === '0') {
1859
-			$cacheKey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' .intval($limit) . '-' . intval($offset);
1858
+		if (!empty($cookie) || $cookie === '0') {
1859
+			$cacheKey = 'lc'.crc32($base).'-'.crc32($filter).'-'.intval($limit).'-'.intval($offset);
1860 1860
 			$this->cookies[$cacheKey] = $cookie;
1861 1861
 			$this->lastCookie = $cookie;
1862 1862
 		}
@@ -1883,22 +1883,22 @@  discard block
 block discarded – undo
1883 1883
 	 */
1884 1884
 	private function initPagedSearch($filter, $bases, $attr, $limit, $offset) {
1885 1885
 		$pagedSearchOK = false;
1886
-		if($this->connection->hasPagedResultSupport && ($limit !== 0)) {
1886
+		if ($this->connection->hasPagedResultSupport && ($limit !== 0)) {
1887 1887
 			$offset = intval($offset); //can be null
1888 1888
 			\OCP\Util::writeLog('user_ldap',
1889 1889
 				'initializing paged search for  Filter '.$filter.' base '.print_r($bases, true)
1890
-				.' attr '.print_r($attr, true). ' limit ' .$limit.' offset '.$offset,
1890
+				.' attr '.print_r($attr, true).' limit '.$limit.' offset '.$offset,
1891 1891
 				\OCP\Util::DEBUG);
1892 1892
 			//get the cookie from the search for the previous search, required by LDAP
1893
-			foreach($bases as $base) {
1893
+			foreach ($bases as $base) {
1894 1894
 
1895 1895
 				$cookie = $this->getPagedResultCookie($base, $filter, $limit, $offset);
1896
-				if(empty($cookie) && $cookie !== "0" && ($offset > 0)) {
1896
+				if (empty($cookie) && $cookie !== "0" && ($offset > 0)) {
1897 1897
 					// no cookie known from a potential previous search. We need
1898 1898
 					// to start from 0 to come to the desired page. cookie value
1899 1899
 					// of '0' is valid, because 389ds
1900 1900
 					$reOffset = 0;
1901
-					while($reOffset < $offset) {
1901
+					while ($reOffset < $offset) {
1902 1902
 						$this->search($filter, array($base), $attr, $limit, $reOffset, true);
1903 1903
 						$reOffset += $limit;
1904 1904
 					}
@@ -1906,17 +1906,17 @@  discard block
 block discarded – undo
1906 1906
 					//still no cookie? obviously, the server does not like us. Let's skip paging efforts.
1907 1907
 					// '0' is valid, because 389ds
1908 1908
 					//TODO: remember this, probably does not change in the next request...
1909
-					if(empty($cookie) && $cookie !== '0') {
1909
+					if (empty($cookie) && $cookie !== '0') {
1910 1910
 						$cookie = null;
1911 1911
 					}
1912 1912
 				}
1913
-				if(!is_null($cookie)) {
1913
+				if (!is_null($cookie)) {
1914 1914
 					//since offset = 0, this is a new search. We abandon other searches that might be ongoing.
1915 1915
 					$this->abandonPagedSearch();
1916 1916
 					$pagedSearchOK = $this->invokeLDAPMethod('controlPagedResult',
1917 1917
 						$this->connection->getConnectionResource(), $limit,
1918 1918
 						false, $cookie);
1919
-					if(!$pagedSearchOK) {
1919
+					if (!$pagedSearchOK) {
1920 1920
 						return false;
1921 1921
 					}
1922 1922
 					\OCP\Util::writeLog('user_ldap', 'Ready for a paged search', \OCP\Util::DEBUG);
@@ -1933,7 +1933,7 @@  discard block
 block discarded – undo
1933 1933
 		 * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
1934 1934
 		 * if we don't have a previous paged search.
1935 1935
 		 */
1936
-		} else if($this->connection->hasPagedResultSupport && $limit === 0 && !empty($this->lastCookie)) {
1936
+		} else if ($this->connection->hasPagedResultSupport && $limit === 0 && !empty($this->lastCookie)) {
1937 1937
 			// a search without limit was requested. However, if we do use
1938 1938
 			// Paged Search once, we always must do it. This requires us to
1939 1939
 			// initialize it with the configured page size.
Please login to merge, or discard this patch.
apps/user_ldap/lib/User/User.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
 	 * @return null
150 150
 	 */
151 151
 	public function update() {
152
-		if(is_null($this->dn)) {
152
+		if (is_null($this->dn)) {
153 153
 			return null;
154 154
 		}
155 155
 
156 156
 		$hasLoggedIn = $this->config->getUserValue($this->uid, 'user_ldap',
157 157
 				self::USER_PREFKEY_FIRSTLOGIN, 0);
158 158
 
159
-		if($this->needsRefresh()) {
159
+		if ($this->needsRefresh()) {
160 160
 			$this->updateEmail();
161 161
 			$this->updateQuota();
162
-			if($hasLoggedIn !== 0) {
162
+			if ($hasLoggedIn !== 0) {
163 163
 				//we do not need to try it, when the user has not been logged in
164 164
 				//before, because the file system will not be ready.
165 165
 				$this->updateAvatar();
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		$this->markRefreshTime();
179 179
 		//Quota
180 180
 		$attr = strtolower($this->connection->ldapQuotaAttribute);
181
-		if(isset($ldapEntry[$attr])) {
181
+		if (isset($ldapEntry[$attr])) {
182 182
 			$this->updateQuota($ldapEntry[$attr][0]);
183 183
 		} else {
184 184
 			if ($this->connection->ldapQuotaDefault !== '') {
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 		//displayName
191 191
 		$displayName = $displayName2 = '';
192 192
 		$attr = strtolower($this->connection->ldapUserDisplayName);
193
-		if(isset($ldapEntry[$attr])) {
193
+		if (isset($ldapEntry[$attr])) {
194 194
 			$displayName = strval($ldapEntry[$attr][0]);
195 195
 		}
196 196
 		$attr = strtolower($this->connection->ldapUserDisplayName2);
197
-		if(isset($ldapEntry[$attr])) {
197
+		if (isset($ldapEntry[$attr])) {
198 198
 			$displayName2 = strval($ldapEntry[$attr][0]);
199 199
 		}
200 200
 		if ($displayName !== '') {
@@ -211,22 +211,22 @@  discard block
 block discarded – undo
211 211
 		//email must be stored after displayname, because it would cause a user
212 212
 		//change event that will trigger fetching the display name again
213 213
 		$attr = strtolower($this->connection->ldapEmailAttribute);
214
-		if(isset($ldapEntry[$attr])) {
214
+		if (isset($ldapEntry[$attr])) {
215 215
 			$this->updateEmail($ldapEntry[$attr][0]);
216 216
 		}
217 217
 		unset($attr);
218 218
 
219 219
 		// LDAP Username, needed for s2s sharing
220
-		if(isset($ldapEntry['uid'])) {
220
+		if (isset($ldapEntry['uid'])) {
221 221
 			$this->storeLDAPUserName($ldapEntry['uid'][0]);
222
-		} else if(isset($ldapEntry['samaccountname'])) {
222
+		} else if (isset($ldapEntry['samaccountname'])) {
223 223
 			$this->storeLDAPUserName($ldapEntry['samaccountname'][0]);
224 224
 		}
225 225
 
226 226
 		//homePath
227
-		if(strpos($this->connection->homeFolderNamingRule, 'attr:') === 0) {
227
+		if (strpos($this->connection->homeFolderNamingRule, 'attr:') === 0) {
228 228
 			$attr = strtolower(substr($this->connection->homeFolderNamingRule, strlen('attr:')));
229
-			if(isset($ldapEntry[$attr])) {
229
+			if (isset($ldapEntry[$attr])) {
230 230
 				$this->access->cacheUserHome(
231 231
 					$this->getUsername(), $this->getHomePath($ldapEntry[$attr][0]));
232 232
 			}
@@ -235,15 +235,15 @@  discard block
 block discarded – undo
235 235
 		//memberOf groups
236 236
 		$cacheKey = 'getMemberOf'.$this->getUsername();
237 237
 		$groups = false;
238
-		if(isset($ldapEntry['memberof'])) {
238
+		if (isset($ldapEntry['memberof'])) {
239 239
 			$groups = $ldapEntry['memberof'];
240 240
 		}
241 241
 		$this->connection->writeToCache($cacheKey, $groups);
242 242
 
243 243
 		//Avatar
244 244
 		$attrs = array('jpegphoto', 'thumbnailphoto');
245
-		foreach ($attrs as $attr)  {
246
-			if(isset($ldapEntry[$attr])) {
245
+		foreach ($attrs as $attr) {
246
+			if (isset($ldapEntry[$attr])) {
247 247
 				$this->avatarImage = $ldapEntry[$attr][0];
248 248
 				// the call to the method that saves the avatar in the file
249 249
 				// system must be postponed after the login. It is to ensure
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
 		if ($path !== '') {
297 297
 			//if attribute's value is an absolute path take this, otherwise append it to data dir
298 298
 			//check for / at the beginning or pattern c:\ resp. c:/
299
-			if(   '/' !== $path[0]
299
+			if ('/' !== $path[0]
300 300
 			   && !(3 < strlen($path) && ctype_alpha($path[0])
301 301
 			       && $path[1] === ':' && ('\\' === $path[2] || '/' === $path[2]))
302 302
 			) {
303 303
 				$path = $this->config->getSystemValue('datadirectory',
304
-						\OC::$SERVERROOT.'/data' ) . '/' . $path;
304
+						\OC::$SERVERROOT.'/data').'/'.$path;
305 305
 			}
306 306
 			//we need it to store it in the DB as well in case a user gets
307 307
 			//deleted so we can clean up afterwards
@@ -311,11 +311,11 @@  discard block
 block discarded – undo
311 311
 			return $path;
312 312
 		}
313 313
 
314
-		if(    !is_null($attr)
314
+		if (!is_null($attr)
315 315
 			&& $this->config->getAppValue('user_ldap', 'enforce_home_folder_naming_rule', true)
316 316
 		) {
317 317
 			// a naming rule attribute is defined, but it doesn't exist for that LDAP user
318
-			throw new \Exception('Home dir attribute can\'t be read from LDAP for uid: ' . $this->getUsername());
318
+			throw new \Exception('Home dir attribute can\'t be read from LDAP for uid: '.$this->getUsername());
319 319
 		}
320 320
 
321 321
 		//false will apply default behaviour as defined and done by OC_User
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	public function getMemberOfGroups() {
327 327
 		$cacheKey = 'getMemberOf'.$this->getUsername();
328 328
 		$memberOfGroups = $this->connection->getFromCache($cacheKey);
329
-		if(!is_null($memberOfGroups)) {
329
+		if (!is_null($memberOfGroups)) {
330 330
 			return $memberOfGroups;
331 331
 		}
332 332
 		$groupDNs = $this->access->readAttribute($this->getDN(), 'memberOf');
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
 	 * @return string data (provided by LDAP) | false
340 340
 	 */
341 341
 	public function getAvatarImage() {
342
-		if(!is_null($this->avatarImage)) {
342
+		if (!is_null($this->avatarImage)) {
343 343
 			return $this->avatarImage;
344 344
 		}
345 345
 
346 346
 		$this->avatarImage = false;
347 347
 		$attributes = array('jpegPhoto', 'thumbnailPhoto');
348
-		foreach($attributes as $attribute) {
348
+		foreach ($attributes as $attribute) {
349 349
 			$result = $this->access->readAttribute($this->dn, $attribute);
350
-			if($result !== false && is_array($result) && isset($result[0])) {
350
+			if ($result !== false && is_array($result) && isset($result[0])) {
351 351
 				$this->avatarImage = $result[0];
352 352
 				break;
353 353
 			}
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 			self::USER_PREFKEY_LASTREFRESH, 0);
386 386
 
387 387
 		//TODO make interval configurable
388
-		if((time() - intval($lastChecked)) < 86400 ) {
388
+		if ((time() - intval($lastChecked)) < 86400) {
389 389
 			return false;
390 390
 		}
391 391
 		return  true;
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
 	 */
412 412
 	public function composeAndStoreDisplayName($displayName, $displayName2 = '') {
413 413
 		$displayName2 = strval($displayName2);
414
-		if($displayName2 !== '') {
415
-			$displayName .= ' (' . $displayName2 . ')';
414
+		if ($displayName2 !== '') {
415
+			$displayName .= ' ('.$displayName2.')';
416 416
 		}
417 417
 		$this->store('displayName', $displayName);
418 418
 		return $displayName;
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	 * @return bool
435 435
 	 */
436 436
 	private function wasRefreshed($feature) {
437
-		if(isset($this->refreshedFeatures[$feature])) {
437
+		if (isset($this->refreshedFeatures[$feature])) {
438 438
 			return true;
439 439
 		}
440 440
 		$this->refreshedFeatures[$feature] = 1;
@@ -447,15 +447,15 @@  discard block
 block discarded – undo
447 447
 	 * @return null
448 448
 	 */
449 449
 	public function updateEmail($valueFromLDAP = null) {
450
-		if($this->wasRefreshed('email')) {
450
+		if ($this->wasRefreshed('email')) {
451 451
 			return;
452 452
 		}
453 453
 		$email = strval($valueFromLDAP);
454
-		if(is_null($valueFromLDAP)) {
454
+		if (is_null($valueFromLDAP)) {
455 455
 			$emailAttribute = $this->connection->ldapEmailAttribute;
456 456
 			if ($emailAttribute !== '') {
457 457
 				$aEmail = $this->access->readAttribute($this->dn, $emailAttribute);
458
-				if(is_array($aEmail) && (count($aEmail) > 0)) {
458
+				if (is_array($aEmail) && (count($aEmail) > 0)) {
459 459
 					$email = strval($aEmail[0]);
460 460
 				}
461 461
 			}
@@ -492,20 +492,20 @@  discard block
 block discarded – undo
492 492
 	 * @return null
493 493
 	 */
494 494
 	public function updateQuota($valueFromLDAP = null) {
495
-		if($this->wasRefreshed('quota')) {
495
+		if ($this->wasRefreshed('quota')) {
496 496
 			return;
497 497
 		}
498 498
 
499 499
 		$quota = false;
500
-		if(is_null($valueFromLDAP)) {
500
+		if (is_null($valueFromLDAP)) {
501 501
 			$quotaAttribute = $this->connection->ldapQuotaAttribute;
502 502
 			if ($quotaAttribute !== '') {
503 503
 				$aQuota = $this->access->readAttribute($this->dn, $quotaAttribute);
504
-				if($aQuota && (count($aQuota) > 0)) {
504
+				if ($aQuota && (count($aQuota) > 0)) {
505 505
 					if ($this->verifyQuotaValue($aQuota[0])) {
506 506
 						$quota = $aQuota[0];
507 507
 					} else {
508
-						$this->log->log('not suitable LDAP quota found for user ' . $this->uid . ': [' . $aQuota[0] . ']', \OCP\Util::WARN);
508
+						$this->log->log('not suitable LDAP quota found for user '.$this->uid.': ['.$aQuota[0].']', \OCP\Util::WARN);
509 509
 					}
510 510
 				}
511 511
 			}
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 			if ($this->verifyQuotaValue($valueFromLDAP)) {
514 514
 				$quota = $valueFromLDAP;
515 515
 			} else {
516
-				$this->log->log('not suitable LDAP quota found for user ' . $this->uid . ': [' . $valueFromLDAP . ']', \OCP\Util::WARN);
516
+				$this->log->log('not suitable LDAP quota found for user '.$this->uid.': ['.$valueFromLDAP.']', \OCP\Util::WARN);
517 517
 			}
518 518
 		}
519 519
 
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
 
528 528
 		$targetUser = $this->userManager->get($this->uid);
529 529
 		if ($targetUser) {
530
-			if($quota !== false) {
530
+			if ($quota !== false) {
531 531
 				$targetUser->setQuota($quota);
532 532
 			} else {
533
-				$this->log->log('not suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', \OCP\Util::WARN);
533
+				$this->log->log('not suitable default quota found for user '.$this->uid.': ['.$defaultQuota.']', \OCP\Util::WARN);
534 534
 			}
535 535
 		} else {
536
-			$this->log->log('trying to set a quota for user ' . $this->uid . ' but the user is missing', \OCP\Util::ERROR);
536
+			$this->log->log('trying to set a quota for user '.$this->uid.' but the user is missing', \OCP\Util::ERROR);
537 537
 		}
538 538
 	}
539 539
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	 * @param array $params
548 548
 	 */
549 549
 	public function updateAvatarPostLogin($params) {
550
-		if(isset($params['uid']) && $params['uid'] === $this->getUsername()) {
550
+		if (isset($params['uid']) && $params['uid'] === $this->getUsername()) {
551 551
 			$this->updateAvatar();
552 552
 		}
553 553
 	}
@@ -557,11 +557,11 @@  discard block
 block discarded – undo
557 557
 	 * @return null
558 558
 	 */
559 559
 	public function updateAvatar() {
560
-		if($this->wasRefreshed('avatar')) {
560
+		if ($this->wasRefreshed('avatar')) {
561 561
 			return;
562 562
 		}
563 563
 		$avatarImage = $this->getAvatarImage();
564
-		if($avatarImage === false) {
564
+		if ($avatarImage === false) {
565 565
 			//not set, nothing left to do;
566 566
 			return;
567 567
 		}
@@ -574,18 +574,18 @@  discard block
 block discarded – undo
574 574
 	 * @return null
575 575
 	 */
576 576
 	private function setOwnCloudAvatar() {
577
-		if(!$this->image->valid()) {
577
+		if (!$this->image->valid()) {
578 578
 			$this->log->log('jpegPhoto data invalid for '.$this->dn, \OCP\Util::ERROR);
579 579
 			return;
580 580
 		}
581 581
 		//make sure it is a square and not bigger than 128x128
582 582
 		$size = min(array($this->image->width(), $this->image->height(), 128));
583
-		if(!$this->image->centerCrop($size)) {
583
+		if (!$this->image->centerCrop($size)) {
584 584
 			$this->log->log('croping image for avatar failed for '.$this->dn, \OCP\Util::ERROR);
585 585
 			return;
586 586
 		}
587 587
 
588
-		if(!$this->fs->isLoaded()) {
588
+		if (!$this->fs->isLoaded()) {
589 589
 			$this->fs->setup($this->uid);
590 590
 		}
591 591
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 			$avatar->set($this->image);
595 595
 		} catch (\Exception $e) {
596 596
 			\OC::$server->getLogger()->notice(
597
-				'Could not set avatar for ' . $this->dn	. ', because: ' . $e->getMessage(),
597
+				'Could not set avatar for '.$this->dn.', because: '.$e->getMessage(),
598 598
 				['app' => 'user_ldap']);
599 599
 		}
600 600
 	}
@@ -607,17 +607,17 @@  discard block
 block discarded – undo
607 607
 	public function handlePasswordExpiry($params) {
608 608
 		$ppolicyDN = $this->connection->ldapDefaultPPolicyDN;
609 609
 		if (empty($ppolicyDN) || (intval($this->connection->turnOnPasswordChange) !== 1)) {
610
-			return;//password expiry handling disabled
610
+			return; //password expiry handling disabled
611 611
 		}
612 612
 		$uid = $params['uid'];
613
-		if(isset($uid) && $uid === $this->getUsername()) {
613
+		if (isset($uid) && $uid === $this->getUsername()) {
614 614
 			//retrieve relevant user attributes
615 615
 			$result = $this->access->search('objectclass=*', $this->dn, ['pwdpolicysubentry', 'pwdgraceusetime', 'pwdreset', 'pwdchangedtime']);
616 616
 			
617
-			if(array_key_exists('pwdpolicysubentry', $result[0])) {
617
+			if (array_key_exists('pwdpolicysubentry', $result[0])) {
618 618
 				$pwdPolicySubentry = $result[0]['pwdpolicysubentry'];
619
-				if($pwdPolicySubentry && (count($pwdPolicySubentry) > 0)){
620
-					$ppolicyDN = $pwdPolicySubentry[0];//custom ppolicy DN
619
+				if ($pwdPolicySubentry && (count($pwdPolicySubentry) > 0)) {
620
+					$ppolicyDN = $pwdPolicySubentry[0]; //custom ppolicy DN
621 621
 				}
622 622
 			}
623 623
 			
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
 			$pwdChangedTime = array_key_exists('pwdchangedtime', $result[0]) ? $result[0]['pwdchangedtime'] : null;
627 627
 			
628 628
 			//retrieve relevant password policy attributes
629
-			$cacheKey = 'ppolicyAttributes' . $ppolicyDN;
629
+			$cacheKey = 'ppolicyAttributes'.$ppolicyDN;
630 630
 			$result = $this->connection->getFromCache($cacheKey);
631
-			if(is_null($result)) {
631
+			if (is_null($result)) {
632 632
 				$result = $this->access->search('objectclass=*', $ppolicyDN, ['pwdgraceauthnlimit', 'pwdmaxage', 'pwdexpirewarning']);
633 633
 				$this->connection->writeToCache($cacheKey, $result);
634 634
 			}
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 			
640 640
 			//handle grace login
641 641
 			$pwdGraceUseTimeCount = count($pwdGraceUseTime);
642
-			if($pwdGraceUseTime && $pwdGraceUseTimeCount > 0) { //was this a grace login?
643
-				if($pwdGraceAuthNLimit 
642
+			if ($pwdGraceUseTime && $pwdGraceUseTimeCount > 0) { //was this a grace login?
643
+				if ($pwdGraceAuthNLimit 
644 644
 					&& (count($pwdGraceAuthNLimit) > 0)
645 645
 					&&($pwdGraceUseTimeCount < intval($pwdGraceAuthNLimit[0]))) { //at least one more grace login available?
646 646
 					$this->config->setUserValue($uid, 'user_ldap', 'needsPasswordReset', 'true');
@@ -653,24 +653,24 @@  discard block
 block discarded – undo
653 653
 				exit();
654 654
 			}
655 655
 			//handle pwdReset attribute
656
-			if($pwdReset && (count($pwdReset) > 0) && $pwdReset[0] === 'TRUE') { //user must change his password
656
+			if ($pwdReset && (count($pwdReset) > 0) && $pwdReset[0] === 'TRUE') { //user must change his password
657 657
 				$this->config->setUserValue($uid, 'user_ldap', 'needsPasswordReset', 'true');
658 658
 				header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute(
659 659
 				'user_ldap.renewPassword.showRenewPasswordForm', array('user' => $uid)));
660 660
 				exit();
661 661
 			}
662 662
 			//handle password expiry warning
663
-			if($pwdChangedTime && (count($pwdChangedTime) > 0)) {
664
-				if($pwdMaxAge && (count($pwdMaxAge) > 0)
663
+			if ($pwdChangedTime && (count($pwdChangedTime) > 0)) {
664
+				if ($pwdMaxAge && (count($pwdMaxAge) > 0)
665 665
 					&& $pwdExpireWarning && (count($pwdExpireWarning) > 0)) {
666 666
 					$pwdMaxAgeInt = intval($pwdMaxAge[0]);
667 667
 					$pwdExpireWarningInt = intval($pwdExpireWarning[0]);
668
-					if($pwdMaxAgeInt > 0 && $pwdExpireWarningInt > 0){
668
+					if ($pwdMaxAgeInt > 0 && $pwdExpireWarningInt > 0) {
669 669
 						$pwdChangedTimeDt = \DateTime::createFromFormat('YmdHisZ', $pwdChangedTime[0]);
670 670
 						$pwdChangedTimeDt->add(new \DateInterval('PT'.$pwdMaxAgeInt.'S'));
671 671
 						$currentDateTime = new \DateTime();
672 672
 						$secondsToExpiry = $pwdChangedTimeDt->getTimestamp() - $currentDateTime->getTimestamp();
673
-						if($secondsToExpiry <= $pwdExpireWarningInt) {
673
+						if ($secondsToExpiry <= $pwdExpireWarningInt) {
674 674
 							//remove last password expiry warning if any
675 675
 							$notification = $this->notificationManager->createNotification();
676 676
 							$notification->setApp('user_ldap')
Please login to merge, or discard this patch.
apps/user_ldap/lib/Jobs/Sync.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			$pagingSize = $config->getAppValue('user_ldap', $configKey, $minPagingSize);
98 98
 			$minPagingSize = $minPagingSize === null ? $pagingSize : min($minPagingSize, $pagingSize);
99 99
 		}
100
-		return (int)$minPagingSize;
100
+		return (int) $minPagingSize;
101 101
 	}
102 102
 
103 103
 	/**
@@ -108,20 +108,20 @@  discard block
 block discarded – undo
108 108
 
109 109
 		$isBackgroundJobModeAjax = $this->c->getConfig()
110 110
 				->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax';
111
-		if($isBackgroundJobModeAjax) {
111
+		if ($isBackgroundJobModeAjax) {
112 112
 			return;
113 113
 		}
114 114
 
115 115
 		$cycleData = $this->getCycle();
116
-		if($cycleData === null) {
116
+		if ($cycleData === null) {
117 117
 			$cycleData = $this->determineNextCycle();
118
-			if($cycleData === null) {
118
+			if ($cycleData === null) {
119 119
 				$this->updateInterval();
120 120
 				return;
121 121
 			}
122 122
 		}
123 123
 
124
-		if(!$this->qualifiesToRun($cycleData)) {
124
+		if (!$this->qualifiesToRun($cycleData)) {
125 125
 			$this->updateInterval();
126 126
 			return;
127 127
 		}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
 		$filter = $access->combineFilterWithAnd(array(
152 152
 			$access->connection->ldapUserFilter,
153
-			$access->connection->ldapUserDisplayName . '=*',
153
+			$access->connection->ldapUserDisplayName.'=*',
154 154
 			$access->getFilterPartForUserSearch('')
155 155
 		));
156 156
 		$results = $access->fetchListOfUsers(
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 			true
162 162
 		);
163 163
 
164
-		if($connection->ldapPagingSize === 0) {
164
+		if ($connection->ldapPagingSize === 0) {
165 165
 			return true;
166 166
 		}
167 167
 		return count($results) !== $connection->ldapPagingSize;
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function getCycle() {
177 177
 		$prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true);
178
-		if(count($prefixes) === 0) {
178
+		if (count($prefixes) === 0) {
179 179
 			return null;
180 180
 		}
181 181
 
182 182
 		$config = $this->c->getConfig();
183 183
 		$cycleData = [
184 184
 			'prefix' => $config->getAppValue('user_ldap', 'background_sync_prefix', null),
185
-			'offset' => (int)$config->getAppValue('user_ldap', 'background_sync_offset', 0),
185
+			'offset' => (int) $config->getAppValue('user_ldap', 'background_sync_offset', 0),
186 186
 		];
187 187
 
188
-		if(
188
+		if (
189 189
 			$cycleData['prefix'] !== null
190 190
 			&& in_array($cycleData['prefix'], $prefixes)
191 191
 		) {
@@ -215,14 +215,14 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function determineNextCycle(array $cycleData = null) {
217 217
 		$prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true);
218
-		if(count($prefixes) === 0) {
218
+		if (count($prefixes) === 0) {
219 219
 			return null;
220 220
 		}
221 221
 
222 222
 		// get the next prefix in line and remember it
223 223
 		$oldPrefix = $cycleData === null ? null : $cycleData['prefix'];
224 224
 		$prefix = $this->getNextPrefix($oldPrefix);
225
-		if($prefix === null) {
225
+		if ($prefix === null) {
226 226
 			return null;
227 227
 		}
228 228
 		$cycleData['prefix'] = $prefix;
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	protected function qualifiesToRun($cycleData) {
243 243
 		$config = $this->c->getConfig();
244
-		$lastChange = $config->getAppValue('user_ldap', $cycleData['prefix'] . '_lastChange', 0);
245
-		if((time() - $lastChange) > 60 * 30) {
244
+		$lastChange = $config->getAppValue('user_ldap', $cycleData['prefix'].'_lastChange', 0);
245
+		if ((time() - $lastChange) > 60 * 30) {
246 246
 			return true;
247 247
 		}
248 248
 		return false;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	protected function increaseOffset($cycleData) {
257 257
 		$ldapConfig = new Configuration($cycleData['prefix']);
258
-		$cycleData['offset'] += (int)$ldapConfig->ldapPagingSize;
258
+		$cycleData['offset'] += (int) $ldapConfig->ldapPagingSize;
259 259
 		$this->setCycle($cycleData);
260 260
 	}
261 261
 
@@ -268,17 +268,17 @@  discard block
 block discarded – undo
268 268
 	protected function getNextPrefix($lastPrefix) {
269 269
 		$prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true);
270 270
 		$noOfPrefixes = count($prefixes);
271
-		if($noOfPrefixes === 0) {
271
+		if ($noOfPrefixes === 0) {
272 272
 			return null;
273 273
 		}
274 274
 		$i = $lastPrefix === null ? false : array_search($lastPrefix, $prefixes, true);
275
-		if($i === false) {
275
+		if ($i === false) {
276 276
 			$i = -1;
277 277
 		} else {
278 278
 			$i++;
279 279
 		}
280 280
 
281
-		if(!isset($prefixes[$i])) {
281
+		if (!isset($prefixes[$i])) {
282 282
 			$i = 0;
283 283
 		}
284 284
 		return $prefixes[$i];
@@ -290,25 +290,25 @@  discard block
 block discarded – undo
290 290
 	 * @param array $argument
291 291
 	 */
292 292
 	public function setArgument($argument) {
293
-		if(isset($argument['c'])) {
293
+		if (isset($argument['c'])) {
294 294
 			$this->c = $argument['c'];
295 295
 		} else {
296 296
 			$this->c = \OC::$server;
297 297
 		}
298 298
 
299
-		if(isset($argument['helper'])) {
299
+		if (isset($argument['helper'])) {
300 300
 			$this->ldapHelper = $argument['helper'];
301 301
 		} else {
302 302
 			$this->ldapHelper = new Helper($this->c->getConfig());
303 303
 		}
304 304
 
305
-		if(isset($argument['ldapWrapper'])) {
305
+		if (isset($argument['ldapWrapper'])) {
306 306
 			$this->ldap = $argument['ldapWrapper'];
307 307
 		} else {
308 308
 			$this->ldap = new LDAP();
309 309
 		}
310 310
 
311
-		if(isset($argument['userManager'])) {
311
+		if (isset($argument['userManager'])) {
312 312
 			$this->userManager = $argument['userManager'];
313 313
 		} else {
314 314
 			$this->userManager = new Manager(
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 			);
324 324
 		}
325 325
 
326
-		if(isset($argument['mapper'])) {
326
+		if (isset($argument['mapper'])) {
327 327
 			$this->mapper = $argument['mapper'];
328 328
 		} else {
329 329
 			$this->mapper = new UserMapping($this->c->getDatabaseConnection());
Please login to merge, or discard this patch.
apps/user_ldap/lib/Mapping/AbstractMapping.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return bool
54 54
 	 */
55 55
 	public function isColNameValid($col) {
56
-		switch($col) {
56
+		switch ($col) {
57 57
 			case 'ldap_dn':
58 58
 			case 'owncloud_name':
59 59
 			case 'directory_uuid':
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
 	 * @return string|false
73 73
 	 */
74 74
 	protected function getXbyY($fetchCol, $compareCol, $search) {
75
-		if(!$this->isColNameValid($fetchCol)) {
75
+		if (!$this->isColNameValid($fetchCol)) {
76 76
 			//this is used internally only, but we don't want to risk
77 77
 			//having SQL injection at all.
78 78
 			throw new \Exception('Invalid Column Name');
79 79
 		}
80 80
 		$query = $this->dbc->prepare('
81
-			SELECT `' . $fetchCol . '`
82
-			FROM `'. $this->getTableName() .'`
83
-			WHERE `' . $compareCol . '` = ?
81
+			SELECT `' . $fetchCol.'`
82
+			FROM `'. $this->getTableName().'`
83
+			WHERE `' . $compareCol.'` = ?
84 84
 		');
85 85
 
86 86
 		$res = $query->execute(array($search));
87
-		if($res !== false) {
87
+		if ($res !== false) {
88 88
 			return $query->fetchColumn();
89 89
 		}
90 90
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function setDNbyUUID($fdn, $uuid) {
122 122
 		$query = $this->dbc->prepare('
123
-			UPDATE `' . $this->getTableName() . '`
123
+			UPDATE `' . $this->getTableName().'`
124 124
 			SET `ldap_dn` = ?
125 125
 			WHERE `directory_uuid` = ?
126 126
 		');
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function setUUIDbyDN($uuid, $fdn) {
141 141
 		$query = $this->dbc->prepare('
142
-			UPDATE `' . $this->getTableName() . '`
142
+			UPDATE `' . $this->getTableName().'`
143 143
 			SET `directory_uuid` = ?
144 144
 			WHERE `ldap_dn` = ?
145 145
 		');
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 	public function getNamesBySearch($search, $prefixMatch = "", $postfixMatch = "") {
167 167
 		$query = $this->dbc->prepare('
168 168
 			SELECT `owncloud_name`
169
-			FROM `'. $this->getTableName() .'`
169
+			FROM `'. $this->getTableName().'`
170 170
 			WHERE `owncloud_name` LIKE ?
171 171
 		');
172 172
 
173 173
 		$res = $query->execute(array($prefixMatch.$this->dbc->escapeLikeParameter($search).$postfixMatch));
174 174
 		$names = array();
175
-		if($res !== false) {
176
-			while($row = $query->fetch()) {
175
+		if ($res !== false) {
176
+			while ($row = $query->fetch()) {
177 177
 				$names[] = $row['owncloud_name'];
178 178
 			}
179 179
 		}
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 				`ldap_dn` AS `dn`,
212 212
 				`owncloud_name` AS `name`,
213 213
 				`directory_uuid` AS `uuid`
214
-			FROM `' . $this->getTableName() . '`',
214
+			FROM `' . $this->getTableName().'`',
215 215
 			$limit,
216 216
 			$offset
217 217
 		);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 * @return bool
229 229
 	 */
230 230
 	public function map($fdn, $name, $uuid) {
231
-		if(mb_strlen($fdn) > 255) {
231
+		if (mb_strlen($fdn) > 255) {
232 232
 			\OC::$server->getLogger()->error(
233 233
 				'Cannot map, because the DN exceeds 255 characters: {dn}',
234 234
 				[
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 		try {
249 249
 			$result = $this->dbc->insertIfNotExist($this->getTableName(), $row);
250 250
 			// insertIfNotExist returns values as int
251
-			return (bool)$result;
251
+			return (bool) $result;
252 252
 		} catch (\Exception $e) {
253 253
 			return false;
254 254
 		}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function unmap($name) {
263 263
 		$query = $this->dbc->prepare('
264
-			DELETE FROM `'. $this->getTableName() .'`
264
+			DELETE FROM `'. $this->getTableName().'`
265 265
 			WHERE `owncloud_name` = ?');
266 266
 
267 267
 		return $this->modify($query, array($name));
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	public function clear() {
275 275
 		$sql = $this->dbc
276 276
 			->getDatabasePlatform()
277
-			->getTruncateTableSQL('`' . $this->getTableName() . '`');
277
+			->getTruncateTableSQL('`'.$this->getTableName().'`');
278 278
 		return $this->dbc->prepare($sql)->execute();
279 279
 	}
280 280
 
@@ -290,6 +290,6 @@  discard block
 block discarded – undo
290 290
 		$res = $query->execute();
291 291
 		$count = $res->fetchColumn();
292 292
 		$res->closeCursor();
293
-		return (int)$count;
293
+		return (int) $count;
294 294
 	}
295 295
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Connection.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$this->configuration = new Configuration($configPrefix,
96 96
 												 !is_null($configID));
97 97
 		$memcache = \OC::$server->getMemCacheFactory();
98
-		if($memcache->isAvailable()) {
98
+		if ($memcache->isAvailable()) {
99 99
 			$this->cache = $memcache->create();
100 100
 		}
101 101
 		$helper = new Helper(\OC::$server->getConfig());
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	}
108 108
 
109 109
 	public function __destruct() {
110
-		if(!$this->dontDestruct && $this->ldap->isResource($this->ldapConnectionRes)) {
110
+		if (!$this->dontDestruct && $this->ldap->isResource($this->ldapConnectionRes)) {
111 111
 			@$this->ldap->unbind($this->ldapConnectionRes);
112 112
 		};
113 113
 	}
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	 * @return bool|mixed
128 128
 	 */
129 129
 	public function __get($name) {
130
-		if(!$this->configured) {
130
+		if (!$this->configured) {
131 131
 			$this->readConfiguration();
132 132
 		}
133 133
 
134
-		if($name === 'hasPagedResultSupport') {
134
+		if ($name === 'hasPagedResultSupport') {
135 135
 			return $this->hasPagedResultSupport;
136 136
 		}
137 137
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		$before = $this->configuration->$name;
148 148
 		$this->configuration->$name = $value;
149 149
 		$after = $this->configuration->$name;
150
-		if($before !== $after) {
150
+		if ($before !== $after) {
151 151
 			if ($this->configID !== '') {
152 152
 				$this->configuration->saveConfiguration();
153 153
 			}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 * @param bool $state
163 163
 	 */
164 164
 	public function setIgnoreValidation($state) {
165
-		$this->ignoreValidation = (bool)$state;
165
+		$this->ignoreValidation = (bool) $state;
166 166
 	}
167 167
 
168 168
 	/**
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 	 * Returns the LDAP handler
179 179
 	 */
180 180
 	public function getConnectionResource() {
181
-		if(!$this->ldapConnectionRes) {
181
+		if (!$this->ldapConnectionRes) {
182 182
 			$this->init();
183
-		} else if(!$this->ldap->isResource($this->ldapConnectionRes)) {
183
+		} else if (!$this->ldap->isResource($this->ldapConnectionRes)) {
184 184
 			$this->ldapConnectionRes = null;
185 185
 			$this->establishConnection();
186 186
 		}
187
-		if(is_null($this->ldapConnectionRes)) {
188
-			\OCP\Util::writeLog('user_ldap', 'No LDAP Connection to server ' . $this->configuration->ldapHost, \OCP\Util::ERROR);
187
+		if (is_null($this->ldapConnectionRes)) {
188
+			\OCP\Util::writeLog('user_ldap', 'No LDAP Connection to server '.$this->configuration->ldapHost, \OCP\Util::ERROR);
189 189
 			throw new ServerNotAvailableException('Connection to LDAP server could not be established');
190 190
 		}
191 191
 		return $this->ldapConnectionRes;
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * resets the connection resource
196 196
 	 */
197 197
 	public function resetConnectionResource() {
198
-		if(!is_null($this->ldapConnectionRes)) {
198
+		if (!is_null($this->ldapConnectionRes)) {
199 199
 			@$this->ldap->unbind($this->ldapConnectionRes);
200 200
 			$this->ldapConnectionRes = null;
201 201
 		}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	private function getCacheKey($key) {
209 209
 		$prefix = 'LDAP-'.$this->configID.'-'.$this->configPrefix.'-';
210
-		if(is_null($key)) {
210
+		if (is_null($key)) {
211 211
 			return $prefix;
212 212
 		}
213 213
 		return $prefix.md5($key);
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	 * @return mixed|null
219 219
 	 */
220 220
 	public function getFromCache($key) {
221
-		if(!$this->configured) {
221
+		if (!$this->configured) {
222 222
 			$this->readConfiguration();
223 223
 		}
224
-		if(is_null($this->cache) || !$this->configuration->ldapCacheTTL) {
224
+		if (is_null($this->cache) || !$this->configuration->ldapCacheTTL) {
225 225
 			return null;
226 226
 		}
227 227
 		$key = $this->getCacheKey($key);
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 	 * @return string
237 237
 	 */
238 238
 	public function writeToCache($key, $value) {
239
-		if(!$this->configured) {
239
+		if (!$this->configured) {
240 240
 			$this->readConfiguration();
241 241
 		}
242
-		if(is_null($this->cache)
242
+		if (is_null($this->cache)
243 243
 			|| !$this->configuration->ldapCacheTTL
244 244
 			|| !$this->configuration->ldapConfigurationActive) {
245 245
 			return null;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 	public function clearCache() {
253
-		if(!is_null($this->cache)) {
253
+		if (!is_null($this->cache)) {
254 254
 			$this->cache->clear($this->getCacheKey(null));
255 255
 		}
256 256
 	}
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return null
263 263
 	 */
264 264
 	private function readConfiguration($force = false) {
265
-		if((!$this->configured || $force) && !is_null($this->configID)) {
265
+		if ((!$this->configured || $force) && !is_null($this->configID)) {
266 266
 			$this->configuration->readConfiguration();
267 267
 			$this->configured = $this->validateConfiguration();
268 268
 		}
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 	 * @return boolean true if config validates, false otherwise. Check with $setParameters for detailed success on single parameters
276 276
 	 */
277 277
 	public function setConfiguration($config, &$setParameters = null) {
278
-		if(is_null($setParameters)) {
278
+		if (is_null($setParameters)) {
279 279
 			$setParameters = array();
280 280
 		}
281 281
 		$this->doNotValidate = false;
282 282
 		$this->configuration->setConfiguration($config, $setParameters);
283
-		if(count($setParameters) > 0) {
283
+		if (count($setParameters) > 0) {
284 284
 			$this->configured = $this->validateConfiguration();
285 285
 		}
286 286
 
@@ -307,10 +307,10 @@  discard block
 block discarded – undo
307 307
 		$config = $this->configuration->getConfiguration();
308 308
 		$cta = $this->configuration->getConfigTranslationArray();
309 309
 		$result = array();
310
-		foreach($cta as $dbkey => $configkey) {
311
-			switch($configkey) {
310
+		foreach ($cta as $dbkey => $configkey) {
311
+			switch ($configkey) {
312 312
 				case 'homeFolderNamingRule':
313
-					if(strpos($config[$configkey], 'attr:') === 0) {
313
+					if (strpos($config[$configkey], 'attr:') === 0) {
314 314
 						$result[$dbkey] = substr($config[$configkey], 5);
315 315
 					} else {
316 316
 						$result[$dbkey] = '';
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 				case 'ldapBaseGroups':
322 322
 				case 'ldapAttributesForUserSearch':
323 323
 				case 'ldapAttributesForGroupSearch':
324
-					if(is_array($config[$configkey])) {
324
+					if (is_array($config[$configkey])) {
325 325
 						$result[$dbkey] = implode("\n", $config[$configkey]);
326 326
 						break;
327 327
 					} //else follows default
@@ -334,23 +334,23 @@  discard block
 block discarded – undo
334 334
 
335 335
 	private function doSoftValidation() {
336 336
 		//if User or Group Base are not set, take over Base DN setting
337
-		foreach(array('ldapBaseUsers', 'ldapBaseGroups') as $keyBase) {
337
+		foreach (array('ldapBaseUsers', 'ldapBaseGroups') as $keyBase) {
338 338
 			$val = $this->configuration->$keyBase;
339
-			if(empty($val)) {
339
+			if (empty($val)) {
340 340
 				$this->configuration->$keyBase = $this->configuration->ldapBase;
341 341
 			}
342 342
 		}
343 343
 
344
-		foreach(array('ldapExpertUUIDUserAttr'  => 'ldapUuidUserAttribute',
344
+		foreach (array('ldapExpertUUIDUserAttr'  => 'ldapUuidUserAttribute',
345 345
 					  'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute')
346 346
 				as $expertSetting => $effectiveSetting) {
347 347
 			$uuidOverride = $this->configuration->$expertSetting;
348
-			if(!empty($uuidOverride)) {
348
+			if (!empty($uuidOverride)) {
349 349
 				$this->configuration->$effectiveSetting = $uuidOverride;
350 350
 			} else {
351 351
 				$uuidAttributes = Access::UUID_ATTRIBUTES;
352 352
 				array_unshift($uuidAttributes, 'auto');
353
-				if(!in_array($this->configuration->$effectiveSetting,
353
+				if (!in_array($this->configuration->$effectiveSetting,
354 354
 							$uuidAttributes)
355 355
 					&& (!is_null($this->configID))) {
356 356
 					$this->configuration->$effectiveSetting = 'auto';
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 		//make sure empty search attributes are saved as simple, empty array
373 373
 		$saKeys = array('ldapAttributesForUserSearch',
374 374
 						'ldapAttributesForGroupSearch');
375
-		foreach($saKeys as $key) {
375
+		foreach ($saKeys as $key) {
376 376
 			$val = $this->configuration->$key;
377
-			if(is_array($val) && count($val) === 1 && empty($val[0])) {
377
+			if (is_array($val) && count($val) === 1 && empty($val[0])) {
378 378
 				$this->configuration->$key = array();
379 379
 			}
380 380
 		}
381 381
 
382
-		if((stripos($this->configuration->ldapHost, 'ldaps://') === 0)
382
+		if ((stripos($this->configuration->ldapHost, 'ldaps://') === 0)
383 383
 			&& $this->configuration->ldapTLS) {
384 384
 			$this->configuration->ldapTLS = false;
385 385
 			\OCP\Util::writeLog('user_ldap',
@@ -400,10 +400,10 @@  discard block
 block discarded – undo
400 400
 		//options that shall not be empty
401 401
 		$options = array('ldapHost', 'ldapPort', 'ldapUserDisplayName',
402 402
 						 'ldapGroupDisplayName', 'ldapLoginFilter');
403
-		foreach($options as $key) {
403
+		foreach ($options as $key) {
404 404
 			$val = $this->configuration->$key;
405
-			if(empty($val)) {
406
-				switch($key) {
405
+			if (empty($val)) {
406
+				switch ($key) {
407 407
 					case 'ldapHost':
408 408
 						$subj = 'LDAP Host';
409 409
 						break;
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		$agent = $this->configuration->ldapAgentName;
435 435
 		$pwd = $this->configuration->ldapAgentPassword;
436 436
 		if (
437
-			($agent === ''  && $pwd !== '')
437
+			($agent === '' && $pwd !== '')
438 438
 			|| ($agent !== '' && $pwd === '')
439 439
 		) {
440 440
 			\OCP\Util::writeLog('user_ldap',
@@ -449,14 +449,14 @@  discard block
 block discarded – undo
449 449
 		$baseUsers = $this->configuration->ldapBaseUsers;
450 450
 		$baseGroups = $this->configuration->ldapBaseGroups;
451 451
 
452
-		if(empty($base) && empty($baseUsers) && empty($baseGroups)) {
452
+		if (empty($base) && empty($baseUsers) && empty($baseGroups)) {
453 453
 			\OCP\Util::writeLog('user_ldap',
454 454
 								$errorStr.'Not a single Base DN given.',
455 455
 								\OCP\Util::WARN);
456 456
 			$configurationOK = false;
457 457
 		}
458 458
 
459
-		if(mb_strpos($this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8')
459
+		if (mb_strpos($this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8')
460 460
 		   === false) {
461 461
 			\OCP\Util::writeLog('user_ldap',
462 462
 								$errorStr.'login filter does not contain %uid '.
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 */
475 475
 	private function validateConfiguration() {
476 476
 
477
-		if($this->doNotValidate) {
477
+		if ($this->doNotValidate) {
478 478
 			//don't do a validation if it is a new configuration with pure
479 479
 			//default values. Will be allowed on changes via __set or
480 480
 			//setConfiguration
@@ -495,21 +495,21 @@  discard block
 block discarded – undo
495 495
 	 * Connects and Binds to LDAP
496 496
 	 */
497 497
 	private function establishConnection() {
498
-		if(!$this->configuration->ldapConfigurationActive) {
498
+		if (!$this->configuration->ldapConfigurationActive) {
499 499
 			return null;
500 500
 		}
501 501
 		static $phpLDAPinstalled = true;
502
-		if(!$phpLDAPinstalled) {
502
+		if (!$phpLDAPinstalled) {
503 503
 			return false;
504 504
 		}
505
-		if(!$this->ignoreValidation && !$this->configured) {
505
+		if (!$this->ignoreValidation && !$this->configured) {
506 506
 			\OCP\Util::writeLog('user_ldap',
507 507
 								'Configuration is invalid, cannot connect',
508 508
 								\OCP\Util::WARN);
509 509
 			return false;
510 510
 		}
511
-		if(!$this->ldapConnectionRes) {
512
-			if(!$this->ldap->areLDAPFunctionsAvailable()) {
511
+		if (!$this->ldapConnectionRes) {
512
+			if (!$this->ldap->areLDAPFunctionsAvailable()) {
513 513
 				$phpLDAPinstalled = false;
514 514
 				\OCP\Util::writeLog('user_ldap',
515 515
 									'function ldap_connect is not available. Make '.
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 
519 519
 				return false;
520 520
 			}
521
-			if($this->configuration->turnOffCertCheck) {
522
-				if(putenv('LDAPTLS_REQCERT=never')) {
521
+			if ($this->configuration->turnOffCertCheck) {
522
+				if (putenv('LDAPTLS_REQCERT=never')) {
523 523
 					\OCP\Util::writeLog('user_ldap',
524 524
 						'Turned off SSL certificate validation successfully.',
525 525
 						\OCP\Util::DEBUG);
@@ -543,23 +543,23 @@  discard block
 block discarded – undo
543 543
 					$error = $this->ldap->isResource($this->ldapConnectionRes) ?
544 544
 						$this->ldap->errno($this->ldapConnectionRes) : -1;
545 545
 				}
546
-				if($bindStatus === true) {
546
+				if ($bindStatus === true) {
547 547
 					return $bindStatus;
548 548
 				}
549 549
 			} catch (ServerNotAvailableException $e) {
550
-				if(!$isBackupHost) {
550
+				if (!$isBackupHost) {
551 551
 					throw $e;
552 552
 				}
553 553
 			}
554 554
 
555 555
 			//if LDAP server is not reachable, try the Backup (Replica!) Server
556
-			if($isBackupHost && ($error !== 0 || $isOverrideMainServer)) {
556
+			if ($isBackupHost && ($error !== 0 || $isOverrideMainServer)) {
557 557
 				$this->doConnect($this->configuration->ldapBackupHost,
558 558
 								 $this->configuration->ldapBackupPort);
559 559
 				$bindStatus = $this->bind();
560 560
 				$error = $this->ldap->isResource($this->ldapConnectionRes) ?
561 561
 					$this->ldap->errno($this->ldapConnectionRes) : -1;
562
-				if($bindStatus && $error === 0 && !$this->getFromCache('overrideMainServer')) {
562
+				if ($bindStatus && $error === 0 && !$this->getFromCache('overrideMainServer')) {
563 563
 					//when bind to backup server succeeded and failed to main server,
564 564
 					//skip contacting him until next cache refresh
565 565
 					$this->writeToCache('overrideMainServer', true);
@@ -584,17 +584,17 @@  discard block
 block discarded – undo
584 584
 
585 585
 		$this->ldapConnectionRes = $this->ldap->connect($host, $port);
586 586
 
587
-		if(!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) {
587
+		if (!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) {
588 588
 			throw new ServerNotAvailableException('Could not set required LDAP Protocol version.');
589 589
 		}
590 590
 
591
-		if(!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) {
591
+		if (!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) {
592 592
 			throw new ServerNotAvailableException('Could not disable LDAP referrals.');
593 593
 		}
594 594
 
595
-		if($this->configuration->ldapTLS) {
596
-			if(!$this->ldap->startTls($this->ldapConnectionRes)) {
597
-				throw new ServerNotAvailableException('Start TLS failed, when connecting to LDAP host ' . $host . '.');
595
+		if ($this->configuration->ldapTLS) {
596
+			if (!$this->ldap->startTls($this->ldapConnectionRes)) {
597
+				throw new ServerNotAvailableException('Start TLS failed, when connecting to LDAP host '.$host.'.');
598 598
 			}
599 599
 		}
600 600
 
@@ -605,25 +605,25 @@  discard block
 block discarded – undo
605 605
 	 * Binds to LDAP
606 606
 	 */
607 607
 	public function bind() {
608
-		if(!$this->configuration->ldapConfigurationActive) {
608
+		if (!$this->configuration->ldapConfigurationActive) {
609 609
 			return false;
610 610
 		}
611 611
 		$cr = $this->getConnectionResource();
612
-		if(!$this->ldap->isResource($cr)) {
612
+		if (!$this->ldap->isResource($cr)) {
613 613
 			return false;
614 614
 		}
615 615
 		$ldapLogin = @$this->ldap->bind($cr,
616 616
 										$this->configuration->ldapAgentName,
617 617
 										$this->configuration->ldapAgentPassword);
618
-		if(!$ldapLogin) {
618
+		if (!$ldapLogin) {
619 619
 			$errno = $this->ldap->errno($cr);
620 620
 
621 621
 			\OCP\Util::writeLog('user_ldap',
622
-				'Bind failed: ' . $errno . ': ' . $this->ldap->error($cr),
622
+				'Bind failed: '.$errno.': '.$this->ldap->error($cr),
623 623
 				\OCP\Util::WARN);
624 624
 
625 625
 			// Set to failure mode, if LDAP error code is not LDAP_SUCCESS or LDAP_INVALID_CREDENTIALS
626
-			if($errno !== 0x00 && $errno !== 0x31) {
626
+			if ($errno !== 0x00 && $errno !== 0x31) {
627 627
 				$this->ldapConnectionRes = null;
628 628
 			}
629 629
 
Please login to merge, or discard this patch.