@@ -2,7 +2,7 @@ |
||
2 | 2 | //DUTCH |
3 | 3 | if (!isset($_SESSION['settings']['cpassman_url'])) { |
4 | 4 | $TeamPass_url = ''; |
5 | -}else{ |
|
5 | +} else { |
|
6 | 6 | $TeamPass_url = $_SESSION['settings']['cpassman_url']; |
7 | 7 | } |
8 | 8 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | //DUTCH |
3 | 3 | if (!isset($_SESSION['settings']['cpassman_url'])) { |
4 | 4 | $TeamPass_url = ''; |
5 | -}else{ |
|
5 | +} else{ |
|
6 | 6 | $TeamPass_url = $_SESSION['settings']['cpassman_url']; |
7 | 7 | } |
8 | 8 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | //SPANISH |
3 | 3 | if (!isset($_SESSION['settings']['cpassman_url'])) { |
4 | 4 | $TeamPass_url = ''; |
5 | -}else{ |
|
5 | +} else { |
|
6 | 6 | $TeamPass_url = $_SESSION['settings']['cpassman_url']; |
7 | 7 | } |
8 | 8 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | //SPANISH |
3 | 3 | if (!isset($_SESSION['settings']['cpassman_url'])) { |
4 | 4 | $TeamPass_url = ''; |
5 | -}else{ |
|
5 | +} else{ |
|
6 | 6 | $TeamPass_url = $_SESSION['settings']['cpassman_url']; |
7 | 7 | } |
8 | 8 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | //TURKISH |
3 | 3 | if (!isset($_SESSION['settings']['cpassman_url'])) { |
4 | 4 | $TeamPass_url = ''; |
5 | -}else{ |
|
5 | +} else { |
|
6 | 6 | $TeamPass_url = $_SESSION['settings']['cpassman_url']; |
7 | 7 | } |
8 | 8 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | //TURKISH |
3 | 3 | if (!isset($_SESSION['settings']['cpassman_url'])) { |
4 | 4 | $TeamPass_url = ''; |
5 | -}else{ |
|
5 | +} else{ |
|
6 | 6 | $TeamPass_url = $_SESSION['settings']['cpassman_url']; |
7 | 7 | } |
8 | 8 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | //DUTCH |
3 | 3 | if (!isset($_SESSION['settings']['cpassman_url'])) { |
4 | 4 | $TeamPass_url = ''; |
5 | -}else{ |
|
5 | +} else { |
|
6 | 6 | $TeamPass_url = $_SESSION['settings']['cpassman_url']; |
7 | 7 | } |
8 | 8 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | //DUTCH |
3 | 3 | if (!isset($_SESSION['settings']['cpassman_url'])) { |
4 | 4 | $TeamPass_url = ''; |
5 | -}else{ |
|
5 | +} else{ |
|
6 | 6 | $TeamPass_url = $_SESSION['settings']['cpassman_url']; |
7 | 7 | } |
8 | 8 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | //CZECH |
3 | 3 | if (!isset($_SESSION['settings']['cpassman_url'])) { |
4 | 4 | $TeamPass_url = ''; |
5 | -}else{ |
|
5 | +} else { |
|
6 | 6 | $TeamPass_url = $_SESSION['settings']['cpassman_url']; |
7 | 7 | } |
8 | 8 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | //CZECH |
3 | 3 | if (!isset($_SESSION['settings']['cpassman_url'])) { |
4 | 4 | $TeamPass_url = ''; |
5 | -}else{ |
|
5 | +} else{ |
|
6 | 6 | $TeamPass_url = $_SESSION['settings']['cpassman_url']; |
7 | 7 | } |
8 | 8 |
@@ -755,11 +755,11 @@ discard block |
||
755 | 755 | } |
756 | 756 | |
757 | 757 | /** |
758 | - * Returns objectClass in an array |
|
759 | - * |
|
760 | - * @param string $distinguishedName The full DN of a contact |
|
761 | - * @return array |
|
762 | - */ |
|
758 | + * Returns objectClass in an array |
|
759 | + * |
|
760 | + * @param string $distinguishedName The full DN of a contact |
|
761 | + * @return array |
|
762 | + */ |
|
763 | 763 | public function getObjectClass($distinguishedName) { |
764 | 764 | if ($distinguishedName === NULL) { return false; } |
765 | 765 | if (!$this->getLdapBind()) { return false; } |
@@ -778,21 +778,21 @@ discard block |
||
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
781 | - * Find the Base DN of your domain controller |
|
782 | - * |
|
783 | - * @return string |
|
784 | - */ |
|
781 | + * Find the Base DN of your domain controller |
|
782 | + * |
|
783 | + * @return string |
|
784 | + */ |
|
785 | 785 | public function findBaseDn() { |
786 | 786 | $namingContext = $this->getRootDse(array('defaultnamingcontext')); |
787 | 787 | return $namingContext[0]['defaultnamingcontext'][0]; |
788 | 788 | } |
789 | 789 | |
790 | 790 | /** |
791 | - * Get the RootDSE properties from a domain controller |
|
792 | - * |
|
793 | - * @param string[] $attributes The attributes you wish to query e.g. defaultnamingcontext |
|
794 | - * @return array |
|
795 | - */ |
|
791 | + * Get the RootDSE properties from a domain controller |
|
792 | + * |
|
793 | + * @param string[] $attributes The attributes you wish to query e.g. defaultnamingcontext |
|
794 | + * @return array |
|
795 | + */ |
|
796 | 796 | public function getRootDse($attributes = array("*", "+")) { |
797 | 797 | if (!$this->ldapBind) { return (false); } |
798 | 798 |
@@ -480,7 +480,7 @@ |
||
480 | 480 | public function setUseSSL($useSSL) { |
481 | 481 | $this->useSSL = $useSSL; |
482 | 482 | // Set the default port correctly |
483 | - if($this->useSSL) { |
|
483 | + if ($this->useSSL) { |
|
484 | 484 | $this->setPort(self::ADLDAP_LDAPS_PORT); |
485 | 485 | } |
486 | 486 | else { |
@@ -482,8 +482,7 @@ discard block |
||
482 | 482 | // Set the default port correctly |
483 | 483 | if($this->useSSL) { |
484 | 484 | $this->setPort(self::ADLDAP_LDAPS_PORT); |
485 | - } |
|
486 | - else { |
|
485 | + } else { |
|
487 | 486 | $this->setPort(self::ADLDAP_LDAP_PORT); |
488 | 487 | } |
489 | 488 | } |
@@ -641,8 +640,7 @@ discard block |
||
641 | 640 | if ($this->useSSL && !$this->useTLS) { |
642 | 641 | // If you have problems troubleshooting, remove the @ character from the ldapldapBind command above to get the actual error message |
643 | 642 | throw new adLDAPException('Bind to Active Directory failed. Either the LDAPs connection failed or the login credentials are incorrect. AD said: '.$this->getLastError()); |
644 | - } |
|
645 | - else { |
|
643 | + } else { |
|
646 | 644 | throw new adLDAPException('Bind to Active Directory failed. Check the login credentials and/or server details. AD said: '.$this->getLastError()); |
647 | 645 | } |
648 | 646 | } |
@@ -652,8 +650,7 @@ discard block |
||
652 | 650 | $this->ldapBind = @ldap_sasl_bind($this->ldapConnection, NULL, NULL, "GSSAPI"); |
653 | 651 | if (!$this->ldapBind) { |
654 | 652 | throw new adLDAPException('Rebind to Active Directory failed. AD said: '.$this->getLastError()); |
655 | - } |
|
656 | - else { |
|
653 | + } else { |
|
657 | 654 | return true; |
658 | 655 | } |
659 | 656 | } |
@@ -694,8 +691,7 @@ discard block |
||
694 | 691 | $this->ldapBind = @ldap_sasl_bind($this->ldapConnection, NULL, NULL, "GSSAPI"); |
695 | 692 | if (!$this->ldapBind) { |
696 | 693 | throw new adLDAPException('Rebind to Active Directory failed. AD said: '.$this->getLastError()); |
697 | - } |
|
698 | - else { |
|
694 | + } else { |
|
699 | 695 | return true; |
700 | 696 | } |
701 | 697 | } |
@@ -54,25 +54,25 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | - * Validate a user's login credentials |
|
58 | - * |
|
59 | - * @param string $username A user's AD username |
|
60 | - * @param string $password A user's AD password |
|
61 | - * @param bool optional $prevent_rebind |
|
62 | - * @return bool |
|
63 | - */ |
|
57 | + * Validate a user's login credentials |
|
58 | + * |
|
59 | + * @param string $username A user's AD username |
|
60 | + * @param string $password A user's AD password |
|
61 | + * @param bool optional $prevent_rebind |
|
62 | + * @return bool |
|
63 | + */ |
|
64 | 64 | public function authenticate($username, $password, $preventRebind = false) { |
65 | 65 | return $this->adldap->authenticate($username, $password, $preventRebind); |
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | - * Create a user |
|
70 | - * |
|
71 | - * If you specify a password here, this can only be performed over SSL |
|
72 | - * |
|
73 | - * @param array $attributes The attributes to set to the user account |
|
74 | - * @return string|boolean |
|
75 | - */ |
|
69 | + * Create a user |
|
70 | + * |
|
71 | + * If you specify a password here, this can only be performed over SSL |
|
72 | + * |
|
73 | + * @param array $attributes The attributes to set to the user account |
|
74 | + * @return string|boolean |
|
75 | + */ |
|
76 | 76 | public function create($attributes) { |
77 | 77 | // Check for compulsory fields |
78 | 78 | if (!array_key_exists("username", $attributes)) { return "Missing compulsory field [username]"; } |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | - * Account control options |
|
126 | - * |
|
127 | - * @param string[] $options The options to convert to int |
|
128 | - * @return int |
|
129 | - */ |
|
125 | + * Account control options |
|
126 | + * |
|
127 | + * @param string[] $options The options to convert to int |
|
128 | + * @return int |
|
129 | + */ |
|
130 | 130 | protected function accountControl($options) { |
131 | 131 | $val = 0; |
132 | 132 | |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
161 | - * Delete a user account |
|
162 | - * |
|
163 | - * @param string $username The username to delete (please be careful here!) |
|
164 | - * @param bool $isGUID Is the username a GUID or a samAccountName |
|
165 | - * @return boolean |
|
166 | - */ |
|
161 | + * Delete a user account |
|
162 | + * |
|
163 | + * @param string $username The username to delete (please be careful here!) |
|
164 | + * @param bool $isGUID Is the username a GUID or a samAccountName |
|
165 | + * @return boolean |
|
166 | + */ |
|
167 | 167 | public function delete($username, $isGUID = false) { |
168 | 168 | $userinfo = $this->info($username, array("*"), $isGUID); |
169 | 169 | $dn = $userinfo[0]['distinguishedname'][0]; |
@@ -370,13 +370,13 @@ discard block |
||
370 | 370 | } |
371 | 371 | |
372 | 372 | /** |
373 | - * Modify a user |
|
374 | - * |
|
375 | - * @param string $username The username to query |
|
376 | - * @param array $attributes The attributes to modify. Note if you set the enabled attribute you must not specify any other attributes |
|
377 | - * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
378 | - * @return string|boolean |
|
379 | - */ |
|
373 | + * Modify a user |
|
374 | + * |
|
375 | + * @param string $username The username to query |
|
376 | + * @param array $attributes The attributes to modify. Note if you set the enabled attribute you must not specify any other attributes |
|
377 | + * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
378 | + * @return string|boolean |
|
379 | + */ |
|
380 | 380 | public function modify($username, $attributes, $isGUID = false) { |
381 | 381 | if ($username === NULL) { return "Missing compulsory field [username]"; } |
382 | 382 | if (array_key_exists("password", $attributes) && !$this->adldap->getUseSSL() && !$this->adldap->getUseTLS()) { |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | /** |
419 | - * Disable a user account |
|
420 | - * |
|
421 | - * @param string $username The username to disable |
|
422 | - * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
423 | - * @return string|boolean |
|
424 | - */ |
|
419 | + * Disable a user account |
|
420 | + * |
|
421 | + * @param string $username The username to disable |
|
422 | + * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
423 | + * @return string|boolean |
|
424 | + */ |
|
425 | 425 | public function disable($username, $isGUID = false) { |
426 | 426 | if ($username === NULL) { return "Missing compulsory field [username]"; } |
427 | 427 | $attributes = array("enabled" => 0); |
@@ -432,12 +432,12 @@ discard block |
||
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
435 | - * Enable a user account |
|
436 | - * |
|
437 | - * @param string $username The username to enable |
|
438 | - * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
439 | - * @return string|boolean |
|
440 | - */ |
|
435 | + * Enable a user account |
|
436 | + * |
|
437 | + * @param string $username The username to enable |
|
438 | + * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
439 | + * @return string|boolean |
|
440 | + */ |
|
441 | 441 | public function enable($username, $isGUID = false) { |
442 | 442 | if ($username === NULL) { return "Missing compulsory field [username]"; } |
443 | 443 | $attributes = array("enabled" => 1); |
@@ -605,19 +605,19 @@ discard block |
||
605 | 605 | } |
606 | 606 | } |
607 | 607 | if ($sorted) { |
608 | - asort($usersArray); |
|
608 | + asort($usersArray); |
|
609 | 609 | } |
610 | 610 | return ($usersArray); |
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
614 | - * Move a user account to a different OU |
|
615 | - * |
|
616 | - * @param string $username The username to move (please be careful here!) |
|
617 | - * @param array $container The container or containers to move the user to (please be careful here!). |
|
618 | - * accepts containers in 1. parent 2. child order |
|
619 | - * @return string|boolean |
|
620 | - */ |
|
614 | + * Move a user account to a different OU |
|
615 | + * |
|
616 | + * @param string $username The username to move (please be careful here!) |
|
617 | + * @param array $container The container or containers to move the user to (please be careful here!). |
|
618 | + * accepts containers in 1. parent 2. child order |
|
619 | + * @return string|boolean |
|
620 | + */ |
|
621 | 621 | public function move($username, $container) { |
622 | 622 | if (!$this->adldap->getLdapBind()) { return false; } |
623 | 623 | if ($username === null) { return "Missing compulsory field [username]"; } |
@@ -214,17 +214,17 @@ discard block |
||
214 | 214 | |
215 | 215 | if ($isGUID === true) { |
216 | 216 | $username = $this->adldap->utilities()->strGuidToHex($username); |
217 | - $filter = "objectguid=" . $username; |
|
217 | + $filter = "objectguid=".$username; |
|
218 | 218 | } |
219 | 219 | else if (strpos($username, "@")) { |
220 | - $filter = "userPrincipalName=" . $username; |
|
220 | + $filter = "userPrincipalName=".$username; |
|
221 | 221 | } |
222 | 222 | else { |
223 | - $filter = "samaccountname=" . $username; |
|
223 | + $filter = "samaccountname=".$username; |
|
224 | 224 | } |
225 | 225 | $filter = "(&(objectCategory=person)({$filter}))"; |
226 | 226 | if ($fields === NULL) { |
227 | - $fields = array("samaccountname","mail","memberof","department","displayname","telephonenumber","primarygroupid","objectsid"); |
|
227 | + $fields = array("samaccountname", "mail", "memberof", "department", "displayname", "telephonenumber", "primarygroupid", "objectsid"); |
|
228 | 228 | } |
229 | 229 | if (!in_array("objectsid", $fields)) { |
230 | 230 | $fields[] = "objectsid"; |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @param bool $isGUID Is the username passed a GUID or a samAccountName |
509 | 509 | * @return string |
510 | 510 | */ |
511 | - public function dn($username, $isGUID=false) { |
|
511 | + public function dn($username, $isGUID = false) { |
|
512 | 512 | $user = $this->info($username, array("cn"), $isGUID); |
513 | 513 | if ($user[0]["dn"] === NULL) { |
514 | 514 | return false; |
@@ -215,11 +215,9 @@ |
||
215 | 215 | if ($isGUID === true) { |
216 | 216 | $username = $this->adldap->utilities()->strGuidToHex($username); |
217 | 217 | $filter = "objectguid=" . $username; |
218 | - } |
|
219 | - else if (strpos($username, "@")) { |
|
218 | + } else if (strpos($username, "@")) { |
|
220 | 219 | $filter = "userPrincipalName=" . $username; |
221 | - } |
|
222 | - else { |
|
220 | + } else { |
|
223 | 221 | $filter = "samaccountname=" . $username; |
224 | 222 | } |
225 | 223 | $filter = "(&(objectCategory=person)({$filter}))"; |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
154 | - * Create a group |
|
155 | - * |
|
156 | - * @param array $attributes Default attributes of the group |
|
157 | - * @return string|boolean |
|
158 | - */ |
|
154 | + * Create a group |
|
155 | + * |
|
156 | + * @param array $attributes Default attributes of the group |
|
157 | + * @return string|boolean |
|
158 | + */ |
|
159 | 159 | public function create($attributes) { |
160 | 160 | if (!is_array($attributes)) { return "Attributes must be an array"; } |
161 | 161 | if (!array_key_exists("group_name", $attributes)) { return "Missing compulsory field [group_name]"; } |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
187 | - * Delete a group account |
|
188 | - * |
|
189 | - * @param string $group The group to delete (please be careful here!) |
|
190 | - * |
|
191 | - * @return string|boolean |
|
192 | - */ |
|
187 | + * Delete a group account |
|
188 | + * |
|
189 | + * @param string $group The group to delete (please be careful here!) |
|
190 | + * |
|
191 | + * @return string|boolean |
|
192 | + */ |
|
193 | 193 | public function delete($group) { |
194 | 194 | if (!$this->adldap->getLdapBind()) { return false; } |
195 | 195 | if ($group === null) { return "Missing compulsory field [group]"; } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param string $child The child group name |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | - public function addGroup($parent,$child) { |
|
63 | + public function addGroup($parent, $child) { |
|
64 | 64 | |
65 | 65 | // Find the parent group's dn |
66 | 66 | $parentGroup = $this->ginfo($parent, array("cn")); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @param string $child The child group name |
241 | 241 | * @return bool |
242 | 242 | */ |
243 | - public function removeGroup($parent , $child) { |
|
243 | + public function removeGroup($parent, $child) { |
|
244 | 244 | |
245 | 245 | // Find the parent dn |
246 | 246 | $parentGroup = $this->info($parent, array("cn")); |
@@ -345,15 +345,15 @@ discard block |
||
345 | 345 | |
346 | 346 | $groupArray = array(); |
347 | 347 | |
348 | - for ($i=0; $i<$groups["count"]; $i++) { |
|
349 | - $filter = "(&(objectCategory=group)(distinguishedName=" . $this->adldap->utilities()->ldapSlashes($groups[$i]) . "))"; |
|
348 | + for ($i = 0; $i < $groups["count"]; $i++) { |
|
349 | + $filter = "(&(objectCategory=group)(distinguishedName=".$this->adldap->utilities()->ldapSlashes($groups[$i])."))"; |
|
350 | 350 | $fields = array("samaccountname", "distinguishedname", "objectClass"); |
351 | 351 | $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields); |
352 | 352 | $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr); |
353 | 353 | |
354 | 354 | // not a person, look for a group |
355 | 355 | if ($entries['count'] == 0 && $recursive == true) { |
356 | - $filter = "(&(objectCategory=group)(distinguishedName=" . $this->adldap->utilities()->ldapSlashes($groups[$i]) . "))"; |
|
356 | + $filter = "(&(objectCategory=group)(distinguishedName=".$this->adldap->utilities()->ldapSlashes($groups[$i])."))"; |
|
357 | 357 | $fields = array("distinguishedname"); |
358 | 358 | $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields); |
359 | 359 | $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr); |
@@ -395,15 +395,15 @@ discard block |
||
395 | 395 | |
396 | 396 | $userArray = array(); |
397 | 397 | |
398 | - for ($i=0; $i<$users["count"]; $i++) { |
|
399 | - $filter = "(&(objectCategory=person)(distinguishedName=" . $this->adldap->utilities()->ldapSlashes($users[$i]) . "))"; |
|
398 | + for ($i = 0; $i < $users["count"]; $i++) { |
|
399 | + $filter = "(&(objectCategory=person)(distinguishedName=".$this->adldap->utilities()->ldapSlashes($users[$i])."))"; |
|
400 | 400 | $fields = array("samaccountname", "distinguishedname", "objectClass"); |
401 | 401 | $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields); |
402 | 402 | $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr); |
403 | 403 | |
404 | 404 | // not a person, look for a group |
405 | 405 | if ($entries['count'] == 0 && $recursive == true) { |
406 | - $filter = "(&(objectCategory=group)(distinguishedName=" . $this->adldap->utilities()->ldapSlashes($users[$i]) . "))"; |
|
406 | + $filter = "(&(objectCategory=group)(distinguishedName=".$this->adldap->utilities()->ldapSlashes($users[$i])."))"; |
|
407 | 407 | $fields = array("samaccountname"); |
408 | 408 | $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields); |
409 | 409 | $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr); |
@@ -215,8 +215,7 @@ discard block |
||
215 | 215 | $info = $this->info($group); |
216 | 216 | if ($info[0]["dn"] === NULL) { |
217 | 217 | return false; |
218 | - } |
|
219 | - else { |
|
218 | + } else { |
|
220 | 219 | $groupDN = $info[0]["dn"]; |
221 | 220 | } |
222 | 221 | $newRDN = 'CN='.$newName; |
@@ -416,15 +415,13 @@ discard block |
||
416 | 415 | $userArray = array_unique($userArray); |
417 | 416 | } |
418 | 417 | continue; |
419 | - } |
|
420 | - else if ($entries['count'] == 0) { |
|
418 | + } else if ($entries['count'] == 0) { |
|
421 | 419 | continue; |
422 | 420 | } |
423 | 421 | |
424 | 422 | if ((!isset($entries[0]['samaccountname'][0]) || $entries[0]['samaccountname'][0] === NULL) && $entries[0]['distinguishedname'][0] !== NULL) { |
425 | 423 | $userArray[] = $entries[0]['distinguishedname'][0]; |
426 | - } |
|
427 | - else if ($entries[0]['samaccountname'][0] !== NULL) { |
|
424 | + } else if ($entries[0]['samaccountname'][0] !== NULL) { |
|
428 | 425 | $userArray[] = $entries[0]['samaccountname'][0]; |
429 | 426 | } |
430 | 427 | } |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * Create an Exchange account |
|
57 | - * |
|
58 | - * @param string $username The username of the user to add the Exchange account to |
|
59 | - * @param array $storageGroup The mailbox, Exchange Storage Group, for the user account, this must be a full CN |
|
60 | - * If the storage group has a different base_dn to the adLDAP configuration, set it using $base_dn |
|
61 | - * @param string $emailAddress The primary email address to add to this user |
|
62 | - * @param string $mailNickname The mail nick name. If mail nickname is blank, the username will be used |
|
63 | - * @param bool $useDefaults Indicates whether the store should use the default quota, rather than the per-mailbox quota. |
|
64 | - * @param string $baseDn Specify an alternative base_dn for the Exchange storage group |
|
65 | - * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
66 | - * @return string|boolean |
|
67 | - */ |
|
56 | + * Create an Exchange account |
|
57 | + * |
|
58 | + * @param string $username The username of the user to add the Exchange account to |
|
59 | + * @param array $storageGroup The mailbox, Exchange Storage Group, for the user account, this must be a full CN |
|
60 | + * If the storage group has a different base_dn to the adLDAP configuration, set it using $base_dn |
|
61 | + * @param string $emailAddress The primary email address to add to this user |
|
62 | + * @param string $mailNickname The mail nick name. If mail nickname is blank, the username will be used |
|
63 | + * @param bool $useDefaults Indicates whether the store should use the default quota, rather than the per-mailbox quota. |
|
64 | + * @param string $baseDn Specify an alternative base_dn for the Exchange storage group |
|
65 | + * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
66 | + * @return string|boolean |
|
67 | + */ |
|
68 | 68 | public function createMailbox($username, $storageGroup, $emailAddress, $mailNickname = NULL, $useDefaults = TRUE, $baseDn = NULL, $isGUID = false) { |
69 | 69 | if ($username === NULL) { return "Missing compulsory field [username]"; } |
70 | 70 | if ($storageGroup === NULL) { return "Missing compulsory array [storagegroup]"; } |
@@ -96,20 +96,20 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | - * Add an X400 address to Exchange |
|
100 | - * See http://tools.ietf.org/html/rfc1685 for more information. |
|
101 | - * An X400 Address looks similar to this X400:c=US;a= ;p=Domain;o=Organization;s=Doe;g=John; |
|
102 | - * |
|
103 | - * @param string $username The username of the user to add the X400 to to |
|
104 | - * @param string $country Country |
|
105 | - * @param string $admd Administration Management Domain |
|
106 | - * @param string $pdmd Private Management Domain (often your AD domain) |
|
107 | - * @param string $org Organization |
|
108 | - * @param string $surname Surname |
|
109 | - * @param string $givenName Given name |
|
110 | - * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
111 | - * @return string|boolean |
|
112 | - */ |
|
99 | + * Add an X400 address to Exchange |
|
100 | + * See http://tools.ietf.org/html/rfc1685 for more information. |
|
101 | + * An X400 Address looks similar to this X400:c=US;a= ;p=Domain;o=Organization;s=Doe;g=John; |
|
102 | + * |
|
103 | + * @param string $username The username of the user to add the X400 to to |
|
104 | + * @param string $country Country |
|
105 | + * @param string $admd Administration Management Domain |
|
106 | + * @param string $pdmd Private Management Domain (often your AD domain) |
|
107 | + * @param string $org Organization |
|
108 | + * @param string $surname Surname |
|
109 | + * @param string $givenName Given name |
|
110 | + * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
111 | + * @return string|boolean |
|
112 | + */ |
|
113 | 113 | public function addX400($username, $country, $admd, $pdmd, $org, $surname, $givenName, $isGUID = false) { |
114 | 114 | if ($username === NULL) { return "Missing compulsory field [username]"; } |
115 | 115 | |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
142 | - * Add an address to Exchange |
|
143 | - * |
|
144 | - * @param string $username The username of the user to add the Exchange account to |
|
145 | - * @param string $emailAddress The email address to add to this user |
|
146 | - * @param bool $default Make this email address the default address, this is a bit more intensive as we have to demote any existing default addresses |
|
147 | - * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
148 | - * @return string|boolean |
|
149 | - */ |
|
142 | + * Add an address to Exchange |
|
143 | + * |
|
144 | + * @param string $username The username of the user to add the Exchange account to |
|
145 | + * @param string $emailAddress The email address to add to this user |
|
146 | + * @param bool $default Make this email address the default address, this is a bit more intensive as we have to demote any existing default addresses |
|
147 | + * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
148 | + * @return string|boolean |
|
149 | + */ |
|
150 | 150 | public function addAddress($username, $emailAddress, $default = FALSE, $isGUID = false) { |
151 | 151 | if ($username === NULL) { return "Missing compulsory field [username]"; } |
152 | 152 | if ($emailAddress === NULL) { return "Missing compulsory fields [emailAddress]"; } |
@@ -202,15 +202,15 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | - * Remove an address to Exchange |
|
206 | - * If you remove a default address the account will no longer have a default, |
|
207 | - * we recommend changing the default address first |
|
208 | - * |
|
209 | - * @param string $username The username of the user to add the Exchange account to |
|
210 | - * @param string $emailAddress The email address to add to this user |
|
211 | - * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
212 | - * @return string|boolean |
|
213 | - */ |
|
205 | + * Remove an address to Exchange |
|
206 | + * If you remove a default address the account will no longer have a default, |
|
207 | + * we recommend changing the default address first |
|
208 | + * |
|
209 | + * @param string $username The username of the user to add the Exchange account to |
|
210 | + * @param string $emailAddress The email address to add to this user |
|
211 | + * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
212 | + * @return string|boolean |
|
213 | + */ |
|
214 | 214 | public function deleteAddress($username, $emailAddress, $isGUID = false) { |
215 | 215 | if ($username === NULL) { return "Missing compulsory field [username]"; } |
216 | 216 | if ($emailAddress === NULL) { return "Missing compulsory fields [emailAddress]"; } |
@@ -280,14 +280,14 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
283 | - * Mail enable a contact |
|
284 | - * Allows email to be sent to them through Exchange |
|
285 | - * |
|
286 | - * @param string $distinguishedName The contact to mail enable |
|
287 | - * @param string $emailAddress The email address to allow emails to be sent through |
|
288 | - * @param string $mailNickname The mailnickname for the contact in Exchange. If NULL this will be set to the display name |
|
289 | - * @return string|boolean |
|
290 | - */ |
|
283 | + * Mail enable a contact |
|
284 | + * Allows email to be sent to them through Exchange |
|
285 | + * |
|
286 | + * @param string $distinguishedName The contact to mail enable |
|
287 | + * @param string $emailAddress The email address to allow emails to be sent through |
|
288 | + * @param string $mailNickname The mailnickname for the contact in Exchange. If NULL this will be set to the display name |
|
289 | + * @return string|boolean |
|
290 | + */ |
|
291 | 291 | public function contactMailEnable($distinguishedName, $emailAddress, $mailNickname = NULL) { |
292 | 292 | if ($distinguishedName === NULL) { return "Missing compulsory field [distinguishedName]"; } |
293 | 293 | if ($emailAddress === NULL) { return "Missing compulsory field [emailAddress]"; } |
@@ -320,11 +320,11 @@ discard block |
||
320 | 320 | * @param array $attributes An array of the AD attributes you wish to return |
321 | 321 | * @return array |
322 | 322 | */ |
323 | - public function servers($attributes = array('cn','distinguishedname','serialnumber')) { |
|
323 | + public function servers($attributes = array('cn', 'distinguishedname', 'serialnumber')) { |
|
324 | 324 | if (!$this->adldap->getLdapBind()) { return false; } |
325 | 325 | |
326 | 326 | $configurationNamingContext = $this->adldap->getRootDse(array('configurationnamingcontext')); |
327 | - $sr = @ldap_search($this->adldap->getLdapConnection(), $configurationNamingContext[0]['configurationnamingcontext'][0],'(&(objectCategory=msExchExchangeServer))', $attributes); |
|
327 | + $sr = @ldap_search($this->adldap->getLdapConnection(), $configurationNamingContext[0]['configurationnamingcontext'][0], '(&(objectCategory=msExchExchangeServer))', $attributes); |
|
328 | 328 | $entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr); |
329 | 329 | return $entries; |
330 | 330 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @param bool $recursive If enabled this will automatically query the databases within a storage group |
338 | 338 | * @return array |
339 | 339 | */ |
340 | - public function storageGroups($exchangeServer, $attributes = array('cn','distinguishedname'), $recursive = NULL) { |
|
340 | + public function storageGroups($exchangeServer, $attributes = array('cn', 'distinguishedname'), $recursive = NULL) { |
|
341 | 341 | if (!$this->adldap->getLdapBind()) { return false; } |
342 | 342 | if ($exchangeServer === NULL) { return "Missing compulsory field [exchangeServer]"; } |
343 | 343 | if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @param array $attributes An array of the AD attributes you wish to return |
362 | 362 | * @return array |
363 | 363 | */ |
364 | - public function storageDatabases($storageGroup, $attributes = array('cn','distinguishedname','displayname')) { |
|
364 | + public function storageDatabases($storageGroup, $attributes = array('cn', 'distinguishedname', 'displayname')) { |
|
365 | 365 | if (!$this->adldap->getLdapBind()) { return false; } |
366 | 366 | if ($storageGroup === NULL) { return "Missing compulsory field [storageGroup]"; } |
367 | 367 |
@@ -225,8 +225,7 @@ |
||
225 | 225 | for ($i = 0; $i < $user[0]['proxyaddresses']['count']; $i++) { |
226 | 226 | if (strpos($user[0]['proxyaddresses'][$i], 'SMTP:') !== false && $user[0]['proxyaddresses'][$i] == 'SMTP:'.$emailAddress) { |
227 | 227 | $mod['proxyAddresses'][0] = 'SMTP:'.$emailAddress; |
228 | - } |
|
229 | - elseif (strpos($user[0]['proxyaddresses'][$i], 'smtp:') !== false && $user[0]['proxyaddresses'][$i] == 'smtp:'.$emailAddress) { |
|
228 | + } elseif (strpos($user[0]['proxyaddresses'][$i], 'smtp:') !== false && $user[0]['proxyaddresses'][$i] == 'smtp:'.$emailAddress) { |
|
230 | 229 | $mod['proxyAddresses'][0] = 'smtp:'.$emailAddress; |
231 | 230 | } |
232 | 231 | } |