@@ -134,6 +134,10 @@ |
||
134 | 134 | protected $userDN; |
135 | 135 | |
136 | 136 | # Create AD password (Microsoft Active Directory password format) |
137 | + |
|
138 | + /** |
|
139 | + * @param string $password |
|
140 | + */ |
|
137 | 141 | protected static function encodePassword($password) { |
138 | 142 | $password = "\"" . $password . "\""; |
139 | 143 | $adpassword = mb_convert_encoding($password, "UTF-16LE", "UTF-8"); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | # Create AD password (Microsoft Active Directory password format) |
137 | 137 | protected static function encodePassword($password) { |
138 | - $password = "\"" . $password . "\""; |
|
138 | + $password = "\"".$password."\""; |
|
139 | 139 | $adpassword = mb_convert_encoding($password, "UTF-16LE", "UTF-8"); |
140 | 140 | return $adpassword; |
141 | 141 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function open($anonymous = false) |
186 | 186 | { |
187 | - $token = 'Opening LDAP connection: ' . LdapUtils::recursive_implode($this->dc, ' or '); |
|
187 | + $token = 'Opening LDAP connection: '.LdapUtils::recursive_implode($this->dc, ' or '); |
|
188 | 188 | Yii::info($token, __METHOD__); |
189 | 189 | Yii::beginProfile($token, __METHOD__); |
190 | 190 | // Connect to the LDAP server. |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | # Search for user and get user DN |
244 | 244 | $searchResult = ldap_search($this->resource, $this->baseDn, "(&(objectClass=person)($this->loginAttribute=$username))", [$this->loginAttribute]); |
245 | 245 | $entry = $this->getFirstEntry($searchResult); |
246 | - if($entry) { |
|
246 | + if ($entry) { |
|
247 | 247 | $this->userDN = $this->getDn($entry); |
248 | 248 | } else { |
249 | 249 | // User not found. |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | // Open connection with user |
276 | - if(!$this->auth($username, $oldPassword)){ |
|
276 | + if (!$this->auth($username, $oldPassword)) { |
|
277 | 277 | return false; |
278 | 278 | } |
279 | 279 | |
@@ -330,20 +330,20 @@ discard block |
||
330 | 330 | $this->open(); |
331 | 331 | $results = []; |
332 | 332 | $cookie = ''; |
333 | - $token = $function . ' - params: ' . LdapUtils::recursive_implode($params, ';'); |
|
333 | + $token = $function.' - params: '.LdapUtils::recursive_implode($params, ';'); |
|
334 | 334 | |
335 | - Yii::info($token , 'chrmorandi\ldap\Connection::query'); |
|
335 | + Yii::info($token, 'chrmorandi\ldap\Connection::query'); |
|
336 | 336 | |
337 | 337 | Yii::beginProfile($token, 'chrmorandi\ldap\Connection::query'); |
338 | 338 | do { |
339 | - if($this->pageSize > 0) { |
|
339 | + if ($this->pageSize > 0) { |
|
340 | 340 | $this->setControlPagedResult($cookie); |
341 | 341 | } |
342 | 342 | |
343 | 343 | // Run the search. |
344 | 344 | $result = call_user_func($function, $this->resource, ...$params); |
345 | 345 | |
346 | - if($this->pageSize > 0) { |
|
346 | + if ($this->pageSize > 0) { |
|
347 | 347 | $this->setControlPagedResultResponse($result, $cookie); |
348 | 348 | } |
349 | 349 |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | return []; |
129 | 129 | } |
130 | 130 | |
131 | - $token = 'Get entries with limit pagination ' . $this->_conn->pageSize; |
|
131 | + $token = 'Get entries with limit pagination '.$this->_conn->pageSize; |
|
132 | 132 | Yii::beginProfile($token, __METHOD__); |
133 | 133 | if ($this->_conn->offset > 0) { |
134 | 134 | $this->setEntries($this->_results[intval($this->_conn->offset / $this->_conn->pageSize)]); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | Yii::endProfile($token, __METHOD__); |
145 | 145 | |
146 | - $token = 'Get Attributes of entries with limit pagination in ' . $this->_conn->pageSize; |
|
146 | + $token = 'Get Attributes of entries with limit pagination in '.$this->_conn->pageSize; |
|
147 | 147 | Yii::beginProfile($token, __METHOD__); |
148 | 148 | $data = []; |
149 | 149 | foreach ($this as $item) { |