@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @var array |
29 | 29 | */ |
30 | 30 | private static $dependencies = [ |
31 | - 'ldapService' => '%$' . LDAPService::class, |
|
31 | + 'ldapService' => '%$'.LDAPService::class, |
|
32 | 32 | ]; |
33 | 33 | |
34 | 34 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getTitle() |
52 | 52 | { |
53 | - return _t(__CLASS__ . '.SYNCTITLE', 'Sync all users from Active Directory'); |
|
53 | + return _t(__CLASS__.'.SYNCTITLE', 'Sync all users from Active Directory'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function log($message) |
156 | 156 | { |
157 | - $message = sprintf('[%s] ', date('Y-m-d H:i:s')) . $message; |
|
158 | - echo Director::is_cli() ? ($message . PHP_EOL) : ($message . '<br>'); |
|
157 | + $message = sprintf('[%s] ', date('Y-m-d H:i:s')).$message; |
|
158 | + echo Director::is_cli() ? ($message.PHP_EOL) : ($message.'<br>'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @var array |
28 | 28 | */ |
29 | 29 | private static $dependencies = [ |
30 | - 'ldapService' => '%$' . LDAPService::class, |
|
30 | + 'ldapService' => '%$'.LDAPService::class, |
|
31 | 31 | ]; |
32 | 32 | |
33 | 33 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function getTitle() |
37 | 37 | { |
38 | - return _t(__CLASS__ . '.SYNCONETITLE', 'Sync single user from LDAP'); |
|
38 | + return _t(__CLASS__.'.SYNCONETITLE', 'Sync single user from LDAP'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @var array |
57 | 57 | */ |
58 | 58 | private static $dependencies = [ |
59 | - 'gateway' => '%$' . LDAPGateway::class |
|
59 | + 'gateway' => '%$'.LDAPGateway::class |
|
60 | 60 | ]; |
61 | 61 | |
62 | 62 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public static function get_cache() |
134 | 134 | { |
135 | - return Injector::inst()->get(CacheInterface::class . '.ldap'); |
|
135 | + return Injector::inst()->get(CacheInterface::class.'.ldap'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | // show better errors than the defaults for various status codes returned by LDAP |
215 | 215 | if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_ACCOUNT_LOCKED_OUT') !== false) { |
216 | 216 | $message = _t( |
217 | - __CLASS__ . '.ACCOUNTLOCKEDOUT', |
|
218 | - 'Your account has been temporarily locked because of too many failed login attempts. ' . |
|
217 | + __CLASS__.'.ACCOUNTLOCKEDOUT', |
|
218 | + 'Your account has been temporarily locked because of too many failed login attempts. '. |
|
219 | 219 | 'Please try again later.' |
220 | 220 | ); |
221 | 221 | } |
222 | 222 | if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_LOGON_FAILURE') !== false) { |
223 | 223 | $message = _t( |
224 | - __CLASS__ . '.INVALIDCREDENTIALS', |
|
224 | + __CLASS__.'.INVALIDCREDENTIALS', |
|
225 | 225 | 'The provided details don\'t seem to be correct. Please try again.' |
226 | 226 | ); |
227 | 227 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | public function getNodes($cached = true, $attributes = []) |
245 | 245 | { |
246 | 246 | $cache = self::get_cache(); |
247 | - $cacheKey = 'nodes' . md5(implode('', $attributes)); |
|
247 | + $cacheKey = 'nodes'.md5(implode('', $attributes)); |
|
248 | 248 | $results = $cache->has($cacheKey); |
249 | 249 | |
250 | 250 | if (!$results || !$cached) { |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | { |
275 | 275 | $searchLocations = $this->config()->groups_search_locations ?: [null]; |
276 | 276 | $cache = self::get_cache(); |
277 | - $cacheKey = 'groups' . md5(implode('', array_merge($searchLocations, $attributes))); |
|
277 | + $cacheKey = 'groups'.md5(implode('', array_merge($searchLocations, $attributes))); |
|
278 | 278 | $results = $cache->has($cacheKey); |
279 | 279 | |
280 | 280 | if (!$results || !$cached) { |
@@ -542,13 +542,13 @@ discard block |
||
542 | 542 | } |
543 | 543 | |
544 | 544 | $member->IsExpired = ($data['useraccountcontrol'] & 2) == 2; |
545 | - $member->LastSynced = (string)DBDatetime::now(); |
|
545 | + $member->LastSynced = (string) DBDatetime::now(); |
|
546 | 546 | |
547 | 547 | foreach ($member->config()->ldap_field_mappings as $attribute => $field) { |
548 | 548 | if (!isset($data[$attribute])) { |
549 | 549 | $this->getLogger()->notice( |
550 | 550 | sprintf( |
551 | - 'Attribute %s configured in Member.ldap_field_mappings, ' . |
|
551 | + 'Attribute %s configured in Member.ldap_field_mappings, '. |
|
552 | 552 | 'but no available attribute in AD data (GUID: %s, Member ID: %s)', |
553 | 553 | $attribute, |
554 | 554 | $data['objectguid'], |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | ) { |
567 | 567 | $this->getLogger()->debug( |
568 | 568 | sprintf( |
569 | - 'Member field %s configured for thumbnailphoto AD attribute, but it isn\'t a ' . |
|
569 | + 'Member field %s configured for thumbnailphoto AD attribute, but it isn\'t a '. |
|
570 | 570 | 'valid relation to an Image class', |
571 | 571 | $field |
572 | 572 | ) |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | // Disable is_uploaded_file() check in Upload_Validator |
604 | 604 | $oldUseIsUploadedFile = Upload_Validator::config()->get('use_is_uploaded_file'); |
605 | 605 | Upload_Validator::config()->set('use_is_uploaded_file', false); |
606 | - if(!$upload->validate($tmpUpload)) { |
|
606 | + if (!$upload->validate($tmpUpload)) { |
|
607 | 607 | $errors = $upload->getErrors(); |
608 | 608 | $message = array_shift($errors); |
609 | 609 | $message = sprintf('Error while populating from file %s: %s', $tmpFilename, $message); |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $group->Description = $data['description']; |
776 | 776 | } |
777 | 777 | $group->DN = $data['dn']; |
778 | - $group->LastSynced = (string)DBDatetime::now(); |
|
778 | + $group->LastSynced = (string) DBDatetime::now(); |
|
779 | 779 | $group->write(); |
780 | 780 | |
781 | 781 | // Mappings on this group are automatically maintained to contain just the group's DN. |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | ), |
839 | 839 | ]); |
840 | 840 | } catch (Exception $e) { |
841 | - throw new ValidationException('LDAP synchronisation failure: ' . $e->getMessage()); |
|
841 | + throw new ValidationException('LDAP synchronisation failure: '.$e->getMessage()); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | $user = $this->getUserByUsername($member->Username); |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | 'distinguishedname' => $dn |
883 | 883 | ]); |
884 | 884 | } catch (Exception $e) { |
885 | - throw new ValidationException('LDAP group creation failure: ' . $e->getMessage()); |
|
885 | + throw new ValidationException('LDAP group creation failure: '.$e->getMessage()); |
|
886 | 886 | } |
887 | 887 | |
888 | 888 | $data = $this->getGroupByDN($dn); |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | try { |
1048 | 1048 | $this->update($groupDn, ['member' => $members]); |
1049 | 1049 | } catch (Exception $e) { |
1050 | - throw new ValidationException('LDAP group membership remove failure: ' . $e->getMessage()); |
|
1050 | + throw new ValidationException('LDAP group membership remove failure: '.$e->getMessage()); |
|
1051 | 1051 | } |
1052 | 1052 | } |
1053 | 1053 | } |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | try { |
1074 | 1074 | $this->update($groupDn, ['member' => $members]); |
1075 | 1075 | } catch (Exception $e) { |
1076 | - throw new ValidationException('LDAP group membership add failure: ' . $e->getMessage()); |
|
1076 | + throw new ValidationException('LDAP group membership add failure: '.$e->getMessage()); |
|
1077 | 1077 | } |
1078 | 1078 | } |
1079 | 1079 | |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | try { |
1157 | 1157 | $this->delete($data['distinguishedname']); |
1158 | 1158 | } catch (Exception $e) { |
1159 | - throw new ValidationException('LDAP delete user failed: ' . $e->getMessage()); |
|
1159 | + throw new ValidationException('LDAP delete user failed: '.$e->getMessage()); |
|
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | } else { |
114 | 114 | $resultResource = ldap_search($resource, $baseDn, $this->getFilter()); |
115 | 115 | } |
116 | - if (! is_resource($resultResource)) { |
|
116 | + if (!is_resource($resultResource)) { |
|
117 | 117 | /* |
118 | 118 | * @TODO better exception msg |
119 | 119 | */ |
120 | - throw new \Exception('ldap_search returned something wrong...' . ldap_error($resource)); |
|
120 | + throw new \Exception('ldap_search returned something wrong...'.ldap_error($resource)); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $entries = ldap_get_entries($resource, $resultResource); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $attributeValue = []; |
205 | 205 | |
206 | 206 | $limit = $offset + $maxPerRequest - 1; |
207 | - $searchedAttribute = $attrName . ';range=' . $offset . '-' . $limit; |
|
207 | + $searchedAttribute = $attrName.';range='.$offset.'-'.$limit; |
|
208 | 208 | |
209 | 209 | $ldap = $this->getLdap(); |
210 | 210 | $entry = $ldap->getEntry($dn, [ |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | } |
235 | 235 | public function current() |
236 | 236 | { |
237 | - if (! is_array($this->current)) { |
|
237 | + if (!is_array($this->current)) { |
|
238 | 238 | $this->rewind(); |
239 | 239 | } |
240 | - if (! is_array($this->current)) { |
|
240 | + if (!is_array($this->current)) { |
|
241 | 241 | return; |
242 | 242 | } |
243 | 243 | |
@@ -245,10 +245,10 @@ discard block |
||
245 | 245 | } |
246 | 246 | public function key() |
247 | 247 | { |
248 | - if (! is_array($this->current)) { |
|
248 | + if (!is_array($this->current)) { |
|
249 | 249 | $this->rewind(); |
250 | 250 | } |
251 | - if (! is_array($this->current)) { |
|
251 | + if (!is_array($this->current)) { |
|
252 | 252 | return; |
253 | 253 | } |
254 | 254 |