@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ) { |
60 | 60 | $emailField = TextField::create( |
61 | 61 | 'Email', |
62 | - _t(__CLASS__ . '.USERNAMEOREMAIL', 'Email'), |
|
62 | + _t(__CLASS__.'.USERNAMEOREMAIL', 'Email'), |
|
63 | 63 | $member->Email, |
64 | 64 | null, |
65 | 65 | $this |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if (!empty($data['samaccountname'])) { |
69 | 69 | $usernameField = TextField::create( |
70 | 70 | 'Username', |
71 | - _t(__CLASS__ . '.USERNAME', 'Username'), |
|
71 | + _t(__CLASS__.'.USERNAME', 'Username'), |
|
72 | 72 | $data['samaccountname'], |
73 | 73 | null, |
74 | 74 | $this |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @var array |
48 | 48 | */ |
49 | 49 | private static $dependencies = [ |
50 | - 'gateway' => '%$' . LDAPGateway::class |
|
50 | + 'gateway' => '%$'.LDAPGateway::class |
|
51 | 51 | ]; |
52 | 52 | |
53 | 53 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public static function get_cache() |
125 | 125 | { |
126 | - return Injector::inst()->get(CacheInterface::class . '.ldap'); |
|
126 | + return Injector::inst()->get(CacheInterface::class.'.ldap'); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | // show better errors than the defaults for various status codes returned by LDAP |
193 | 193 | if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_ACCOUNT_LOCKED_OUT') !== false) { |
194 | 194 | $message = _t( |
195 | - __CLASS__ . '.ACCOUNTLOCKEDOUT', |
|
196 | - 'Your account has been temporarily locked because of too many failed login attempts. ' . |
|
195 | + __CLASS__.'.ACCOUNTLOCKEDOUT', |
|
196 | + 'Your account has been temporarily locked because of too many failed login attempts. '. |
|
197 | 197 | 'Please try again later.' |
198 | 198 | ); |
199 | 199 | } |
200 | 200 | if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_LOGON_FAILURE') !== false) { |
201 | 201 | $message = _t( |
202 | - __CLASS__ . '.INVALIDCREDENTIALS', |
|
202 | + __CLASS__.'.INVALIDCREDENTIALS', |
|
203 | 203 | 'The provided details don\'t seem to be correct. Please try again.' |
204 | 204 | ); |
205 | 205 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | public function getNodes($cached = true, $attributes = []) |
223 | 223 | { |
224 | 224 | $cache = self::get_cache(); |
225 | - $cacheKey = 'nodes' . md5(implode('', $attributes)); |
|
225 | + $cacheKey = 'nodes'.md5(implode('', $attributes)); |
|
226 | 226 | $results = $cache->has($cacheKey); |
227 | 227 | |
228 | 228 | if (!$results || !$cached) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | { |
253 | 253 | $searchLocations = $this->config()->groups_search_locations ?: [null]; |
254 | 254 | $cache = self::get_cache(); |
255 | - $cacheKey = 'groups' . md5(implode('', array_merge($searchLocations, $attributes))); |
|
255 | + $cacheKey = 'groups'.md5(implode('', array_merge($searchLocations, $attributes))); |
|
256 | 256 | $results = $cache->has($cacheKey); |
257 | 257 | |
258 | 258 | if (!$results || !$cached) { |
@@ -520,13 +520,13 @@ discard block |
||
520 | 520 | } |
521 | 521 | |
522 | 522 | $member->IsExpired = ($data['useraccountcontrol'] & 2) == 2; |
523 | - $member->LastSynced = (string)DBDatetime::now(); |
|
523 | + $member->LastSynced = (string) DBDatetime::now(); |
|
524 | 524 | |
525 | 525 | foreach ($member->config()->ldap_field_mappings as $attribute => $field) { |
526 | 526 | if (!isset($data[$attribute])) { |
527 | 527 | $this->getLogger()->notice( |
528 | 528 | sprintf( |
529 | - 'Attribute %s configured in Member.ldap_field_mappings, ' . |
|
529 | + 'Attribute %s configured in Member.ldap_field_mappings, '. |
|
530 | 530 | 'but no available attribute in AD data (GUID: %s, Member ID: %s)', |
531 | 531 | $attribute, |
532 | 532 | $data['objectguid'], |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | ) { |
545 | 545 | $this->getLogger()->warning( |
546 | 546 | sprintf( |
547 | - 'Member field %s configured for thumbnailphoto AD attribute, but it isn\'t a ' . |
|
547 | + 'Member field %s configured for thumbnailphoto AD attribute, but it isn\'t a '. |
|
548 | 548 | 'valid relation to an Image class', |
549 | 549 | $field |
550 | 550 | ) |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | } |
555 | 555 | |
556 | 556 | $filename = sprintf('thumbnailphoto-%s.jpg', $data['samaccountname']); |
557 | - $path = ASSETS_DIR . '/' . $member->config()->ldap_thumbnail_path; |
|
558 | - $absPath = BASE_PATH . '/' . $path; |
|
557 | + $path = ASSETS_DIR.'/'.$member->config()->ldap_thumbnail_path; |
|
558 | + $absPath = BASE_PATH.'/'.$path; |
|
559 | 559 | if (!file_exists($absPath)) { |
560 | 560 | Filesystem::makeFolder($absPath); |
561 | 561 | } |
@@ -567,13 +567,13 @@ discard block |
||
567 | 567 | } |
568 | 568 | |
569 | 569 | // The image data is provided in raw binary. |
570 | - file_put_contents($absPath . '/' . $filename, $data[$attribute]); |
|
570 | + file_put_contents($absPath.'/'.$filename, $data[$attribute]); |
|
571 | 571 | $record = new $imageClass(); |
572 | 572 | $record->Name = $filename; |
573 | - $record->Filename = $path . '/' . $filename; |
|
573 | + $record->Filename = $path.'/'.$filename; |
|
574 | 574 | $record->write(); |
575 | 575 | |
576 | - $relationField = $field . 'ID'; |
|
576 | + $relationField = $field.'ID'; |
|
577 | 577 | $member->{$relationField} = $record->ID; |
578 | 578 | } else { |
579 | 579 | $member->$field = $data[$attribute]; |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | $group->Description = $data['description']; |
715 | 715 | } |
716 | 716 | $group->DN = $data['dn']; |
717 | - $group->LastSynced = (string)DBDatetime::now(); |
|
717 | + $group->LastSynced = (string) DBDatetime::now(); |
|
718 | 718 | $group->write(); |
719 | 719 | |
720 | 720 | // Mappings on this group are automatically maintained to contain just the group's DN. |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | ), |
778 | 778 | ]); |
779 | 779 | } catch (Exception $e) { |
780 | - throw new ValidationException('LDAP synchronisation failure: ' . $e->getMessage()); |
|
780 | + throw new ValidationException('LDAP synchronisation failure: '.$e->getMessage()); |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | $user = $this->getUserByUsername($member->Username); |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | 'distinguishedname' => $dn |
822 | 822 | ]); |
823 | 823 | } catch (Exception $e) { |
824 | - throw new ValidationException('LDAP group creation failure: ' . $e->getMessage()); |
|
824 | + throw new ValidationException('LDAP group creation failure: '.$e->getMessage()); |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | $data = $this->getGroupByDN($dn); |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | try { |
987 | 987 | $this->update($groupDn, ['member' => $members]); |
988 | 988 | } catch (Exception $e) { |
989 | - throw new ValidationException('LDAP group membership remove failure: ' . $e->getMessage()); |
|
989 | + throw new ValidationException('LDAP group membership remove failure: '.$e->getMessage()); |
|
990 | 990 | } |
991 | 991 | } |
992 | 992 | } |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | try { |
1013 | 1013 | $this->update($groupDn, ['member' => $members]); |
1014 | 1014 | } catch (Exception $e) { |
1015 | - throw new ValidationException('LDAP group membership add failure: ' . $e->getMessage()); |
|
1015 | + throw new ValidationException('LDAP group membership add failure: '.$e->getMessage()); |
|
1016 | 1016 | } |
1017 | 1017 | } |
1018 | 1018 | |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | try { |
1096 | 1096 | $this->delete($data['distinguishedname']); |
1097 | 1097 | } catch (Exception $e) { |
1098 | - throw new ValidationException('LDAP delete user failed: ' . $e->getMessage()); |
|
1098 | + throw new ValidationException('LDAP delete user failed: '.$e->getMessage()); |
|
1099 | 1099 | } |
1100 | 1100 | } |
1101 | 1101 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @var array |
48 | 48 | */ |
49 | 49 | private static $dependencies = [ |
50 | - 'ldapService' => '%$' . LDAPService::class, |
|
50 | + 'ldapService' => '%$'.LDAPService::class, |
|
51 | 51 | ]; |
52 | 52 | |
53 | 53 | /** |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | $fields = parent::getCMSFields(); |
60 | 60 | $fields->removeByName('DN'); |
61 | 61 | |
62 | - $field = DropdownField::create('DN', _t(__CLASS__ . '.LDAPGROUP', 'LDAP Group')); |
|
63 | - $field->setEmptyString(_t(__CLASS__ . '.SELECTONE', 'Select one')); |
|
62 | + $field = DropdownField::create('DN', _t(__CLASS__.'.LDAPGROUP', 'LDAP Group')); |
|
63 | + $field->setEmptyString(_t(__CLASS__.'.SELECTONE', 'Select one')); |
|
64 | 64 | $groups = $this->ldapService->getGroups(true, ['dn', 'name']); |
65 | 65 | if ($groups) { |
66 | 66 | foreach ($groups as $dn => $record) { |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | $fields->removeByName('Scope'); |
75 | 75 | $fields->addFieldToTab( |
76 | 76 | 'Root.Main', |
77 | - DropdownField::create('Scope', _t(__CLASS__ . '.SCOPE', 'Scope'), [ |
|
77 | + DropdownField::create('Scope', _t(__CLASS__.'.SCOPE', 'Scope'), [ |
|
78 | 78 | 'Subtree' => _t( |
79 | - __CLASS__ . '.SUBTREE_DESCRIPTION', |
|
79 | + __CLASS__.'.SUBTREE_DESCRIPTION', |
|
80 | 80 | 'Users within this group and all nested groups within' |
81 | 81 | ), |
82 | - 'OneLevel' => _t(__CLASS__ . '.ONELEVEL_DESCRIPTION', 'Only users within this group'), |
|
82 | + 'OneLevel' => _t(__CLASS__.'.ONELEVEL_DESCRIPTION', 'Only users within this group'), |
|
83 | 83 | ]) |
84 | 84 | ); |
85 | 85 |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | for ($k = 1; $k <= 2; ++$k) { |
43 | 43 | $hex_guid_to_guid_str .= substr($hex_guid, 16 - 2 * $k, 2); |
44 | 44 | } |
45 | - $hex_guid_to_guid_str .= '-' . substr($hex_guid, 16, 4); |
|
46 | - $hex_guid_to_guid_str .= '-' . substr($hex_guid, 20); |
|
45 | + $hex_guid_to_guid_str .= '-'.substr($hex_guid, 16, 4); |
|
46 | + $hex_guid_to_guid_str .= '-'.substr($hex_guid, 20); |
|
47 | 47 | |
48 | 48 | return strtoupper($hex_guid_to_guid_str); |
49 | 49 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | if ($escape) { |
71 | 71 | $escaped = '\\'; |
72 | - for ($i = 0; $i < strlen($octet_str); $i+=2) { |
|
72 | + for ($i = 0; $i < strlen($octet_str); $i += 2) { |
|
73 | 73 | $escaped .= substr($octet_str, $i, 2); |
74 | 74 | if ($i != strlen($octet_str) - 2) { |
75 | 75 | $escaped .= '\\'; |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | |
96 | 96 | for ($x = 0; $x < $subcount; $x++) { |
97 | 97 | $subauth[$x] = hexdec(self::little_endian(substr($hex_sid, 16 + ($x * 8), 8))); |
98 | - $result .= '-' . $subauth[$x]; |
|
98 | + $result .= '-'.$subauth[$x]; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // Cheat by tacking on the S- |
102 | - return 'S-' . $result; |
|
102 | + return 'S-'.$result; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -46,7 +46,7 @@ |
||
46 | 46 | */ |
47 | 47 | public function getTitle() |
48 | 48 | { |
49 | - return _t(__CLASS__ . '.SYNCTITLE', 'Sync all groups and users from Active Directory, and set mappings up.'); |
|
49 | + return _t(__CLASS__.'.SYNCTITLE', 'Sync all groups and users from Active Directory, and set mappings up.'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -45,7 +45,7 @@ |
||
45 | 45 | */ |
46 | 46 | public function getTitle() |
47 | 47 | { |
48 | - return _t(__CLASS__ . '.SYNCTITLE', 'Sync all users from Active Directory'); |
|
48 | + return _t(__CLASS__.'.SYNCTITLE', 'Sync all users from Active Directory'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |