@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | 'IsExpired', |
| 107 | 107 | $ldapMetadata[] = ReadonlyField::create( |
| 108 | 108 | 'IsExpired', |
| 109 | - _t(__CLASS__ . '.ISEXPIRED', 'Has user\'s LDAP/AD login expired?') |
|
| 109 | + _t(__CLASS__.'.ISEXPIRED', 'Has user\'s LDAP/AD login expired?') |
|
| 110 | 110 | ) |
| 111 | 111 | ); |
| 112 | 112 | $fields->replaceField( |
| 113 | 113 | 'LastSynced', |
| 114 | 114 | $ldapMetadata[] = ReadonlyField::create( |
| 115 | 115 | 'LastSynced', |
| 116 | - _t(__CLASS__ . '.LASTSYNCED', 'Last synced') |
|
| 116 | + _t(__CLASS__.'.LASTSYNCED', 'Last synced') |
|
| 117 | 117 | ) |
| 118 | 118 | ); |
| 119 | 119 | $fields->addFieldsToTab('Root.LDAP', $ldapMetadata); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $message = ''; |
| 122 | 122 | if ($this->owner->GUID && $this->owner->config()->update_ldap_from_local) { |
| 123 | 123 | $message = _t( |
| 124 | - __CLASS__ . '.CHANGEFIELDSUPDATELDAP', |
|
| 124 | + __CLASS__.'.CHANGEFIELDSUPDATELDAP', |
|
| 125 | 125 | 'Changing fields here will update them in LDAP.' |
| 126 | 126 | ); |
| 127 | 127 | } elseif ($this->owner->GUID && !$this->owner->config()->update_ldap_from_local) { |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | // Set to readonly, but not disabled so that the data is still sent to the |
| 134 | 134 | // server and doesn't break Member_Validator |
| 135 | 135 | $field->setReadonly(true); |
| 136 | - $field->setTitle($field->Title()._t(__CLASS__ . '.IMPORTEDFIELD', ' (imported)')); |
|
| 136 | + $field->setTitle($field->Title()._t(__CLASS__.'.IMPORTEDFIELD', ' (imported)')); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | $message = _t( |
| 140 | - __CLASS__ . '.INFOIMPORTED', |
|
| 140 | + __CLASS__.'.INFOIMPORTED', |
|
| 141 | 141 | 'This user is automatically imported from LDAP. '. |
| 142 | 142 | 'Manual changes to imported fields will be removed upon sync.' |
| 143 | 143 | ); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | * @var array |
| 33 | 33 | */ |
| 34 | 34 | private static $dependencies = [ |
| 35 | - 'ldapService' => '%$' . LDAPService::class |
|
| 35 | + 'ldapService' => '%$'.LDAPService::class |
|
| 36 | 36 | ]; |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -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 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 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 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | protected function log($message) |
| 148 | 148 | { |
| 149 | - $message = sprintf('[%s] ', date('Y-m-d H:i:s')) . $message; |
|
| 150 | - echo Director::is_cli() ? ($message . PHP_EOL) : ($message . '<br>'); |
|
| 149 | + $message = sprintf('[%s] ', date('Y-m-d H:i:s')).$message; |
|
| 150 | + echo Director::is_cli() ? ($message.PHP_EOL) : ($message.'<br>'); |
|
| 151 | 151 | } |
| 152 | 152 | } |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | if (Config::inst()->get(LDAPAuthenticator::class, 'allow_email_login') === 'yes') { |
| 46 | 46 | $loginField = TextField::create( |
| 47 | 47 | 'Login', |
| 48 | - _t(__CLASS__ . '.USERNAMEOREMAIL', 'Username or email'), |
|
| 48 | + _t(__CLASS__.'.USERNAMEOREMAIL', 'Username or email'), |
|
| 49 | 49 | null, |
| 50 | 50 | null, |
| 51 | 51 | $this |
| 52 | 52 | ); |
| 53 | 53 | } else { |
| 54 | - $loginField = TextField::create('Login', _t(__CLASS__ . '.USERNAME', 'Username'), null, null, $this); |
|
| 54 | + $loginField = TextField::create('Login', _t(__CLASS__.'.USERNAME', 'Username'), null, null, $this); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $this->Fields()->replaceField('Email', $loginField); |
@@ -98,6 +98,6 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function getAuthenticatorName() |
| 100 | 100 | { |
| 101 | - return _t(__CLASS__ . '.AUTHENTICATORNAME', 'LDAP'); |
|
| 101 | + return _t(__CLASS__.'.AUTHENTICATORNAME', 'LDAP'); |
|
| 102 | 102 | } |
| 103 | 103 | } |
@@ -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 | |
@@ -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 | /** |