@@ -133,6 +133,10 @@ discard block |
||
133 | 133 | protected $userDN; |
134 | 134 | |
135 | 135 | # Create AD password (Microsoft Active Directory password format) |
136 | + |
|
137 | + /** |
|
138 | + * @param string $password |
|
139 | + */ |
|
136 | 140 | protected static function encodePassword($password) { |
137 | 141 | $password = "\"" . $password . "\""; |
138 | 142 | $adpassword = mb_convert_encoding($password, "UTF-16LE", "UTF-8"); |
@@ -566,8 +570,6 @@ discard block |
||
566 | 570 | |
567 | 571 | /** |
568 | 572 | * Send LDAP pagination control. |
569 | - * @param int $pageSize |
|
570 | - * @param bool $isCritical |
|
571 | 573 | * @param string $cookie |
572 | 574 | * @return bool |
573 | 575 | */ |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | # Create AD password (Microsoft Active Directory password format) |
136 | 136 | protected static function encodePassword($password) { |
137 | - $password = "\"" . $password . "\""; |
|
137 | + $password = "\"".$password."\""; |
|
138 | 138 | $adpassword = mb_convert_encoding($password, "UTF-16LE", "UTF-8"); |
139 | 139 | return $adpassword; |
140 | 140 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function open($anonymous = false) |
185 | 185 | { |
186 | - $token = 'Opening LDAP connection: ' . LdapUtils::recursive_implode($this->dc, ' or '); |
|
186 | + $token = 'Opening LDAP connection: '.LdapUtils::recursive_implode($this->dc, ' or '); |
|
187 | 187 | Yii::info($token, __METHOD__); |
188 | 188 | Yii::beginProfile($token, __METHOD__); |
189 | 189 | // Connect to the LDAP server. |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | # Search for user and get user DN |
243 | 243 | $searchResult = ldap_search($this->resource, $this->baseDn, "(&(objectClass=person)($this->loginAttribute=$username))", [$this->loginAttribute]); |
244 | 244 | $entry = $this->getFirstEntry($searchResult); |
245 | - if($entry) { |
|
245 | + if ($entry) { |
|
246 | 246 | $this->userDN = $this->getDn($entry); |
247 | 247 | } else { |
248 | 248 | // User not found. |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | // Open connection with user |
275 | - if(!$this->auth($username, $oldPassword)){ |
|
275 | + if (!$this->auth($username, $oldPassword)) { |
|
276 | 276 | return false; |
277 | 277 | } |
278 | 278 | |
@@ -329,20 +329,20 @@ discard block |
||
329 | 329 | $this->open(); |
330 | 330 | $results = []; |
331 | 331 | $cookie = ''; |
332 | - $token = $function . ' - params: ' . LdapUtils::recursive_implode($params, ';'); |
|
332 | + $token = $function.' - params: '.LdapUtils::recursive_implode($params, ';'); |
|
333 | 333 | |
334 | - Yii::info($token , 'chrmorandi\ldap\Connection::query'); |
|
334 | + Yii::info($token, 'chrmorandi\ldap\Connection::query'); |
|
335 | 335 | |
336 | 336 | Yii::beginProfile($token, 'chrmorandi\ldap\Connection::query'); |
337 | 337 | do { |
338 | - if($this->pageSize > 0) { |
|
338 | + if ($this->pageSize > 0) { |
|
339 | 339 | $this->setControlPagedResult($cookie); |
340 | 340 | } |
341 | 341 | |
342 | 342 | // Run the search. |
343 | 343 | $result = call_user_func($function, $this->resource, ...$params); |
344 | 344 | |
345 | - if($this->pageSize > 0) { |
|
345 | + if ($this->pageSize > 0) { |
|
346 | 346 | $this->setControlPagedResultResponse($result, $cookie); |
347 | 347 | } |
348 | 348 |