@@ -886,7 +886,9 @@ discard block |
||
| 886 | 886 | |
| 887 | 887 | // Attempt to set attributes |
| 888 | 888 | $result = @ldap_mod_replace($this->ldap, $dn, $attributes); |
| 889 | - if ($result === false) throw $this->makeException('Library - LDAP setAttributes(): Failed to set attributes for DN \''.$dn.'\'. Bind necessary?'); |
|
| 889 | + if ($result === false) { |
|
| 890 | + throw $this->makeException('Library - LDAP setAttributes(): Failed to set attributes for DN \''.$dn.'\'. Bind necessary?'); |
|
| 891 | + } |
|
| 890 | 892 | |
| 891 | 893 | return $result; |
| 892 | 894 | } |
@@ -911,7 +913,9 @@ discard block |
||
| 911 | 913 | |
| 912 | 914 | // Attempt to add attributes |
| 913 | 915 | $result = @ldap_mod_add($this->ldap, $dn, $attributes); |
| 914 | - if ($result === false) throw $this->makeException('Library - LDAP addAttributes(): Failed to set attributes for DN \''.$dn.'\'. Bind necessary?'); |
|
| 916 | + if ($result === false) { |
|
| 917 | + throw $this->makeException('Library - LDAP addAttributes(): Failed to set attributes for DN \''.$dn.'\'. Bind necessary?'); |
|
| 918 | + } |
|
| 915 | 919 | |
| 916 | 920 | return $result; |
| 917 | 921 | } |
@@ -877,42 +877,42 @@ |
||
| 877 | 877 | * Result of operation |
| 878 | 878 | */ |
| 879 | 879 | public function setAttributes($dn, $attributes) { |
| 880 | - if (!is_array($attributes)) { |
|
| 880 | + if (!is_array($attributes)) { |
|
| 881 | 881 | Logger::warning('Library - LDAP setAttributes(): No array of attributes given for DN \''.$dn.'\''); |
| 882 | 882 | return false; |
| 883 | - } else { |
|
| 883 | + } else { |
|
| 884 | 884 | Logger::debug('Library - LDAP setAttributes(): Received arraydata:'.print_r($attributes,true)); |
| 885 | - } |
|
| 885 | + } |
|
| 886 | 886 | |
| 887 | - // Attempt to set attributes |
|
| 888 | - $result = @ldap_mod_replace($this->ldap, $dn, $attributes); |
|
| 889 | - if ($result === false) throw $this->makeException('Library - LDAP setAttributes(): Failed to set attributes for DN \''.$dn.'\'. Bind necessary?'); |
|
| 887 | + // Attempt to set attributes |
|
| 888 | + $result = @ldap_mod_replace($this->ldap, $dn, $attributes); |
|
| 889 | + if ($result === false) throw $this->makeException('Library - LDAP setAttributes(): Failed to set attributes for DN \''.$dn.'\'. Bind necessary?'); |
|
| 890 | 890 | |
| 891 | - return $result; |
|
| 891 | + return $result; |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | /** |
| 895 | - * Adds for a given DN attributes |
|
| 896 | - * |
|
| 897 | - * @param string $dn |
|
| 898 | - * The DN of an element. |
|
| 899 | - * @param array $attributes |
|
| 900 | - * The names and value of the attribute(s) to set using ldap_mod_add structure; |
|
| 901 | - * @return bool |
|
| 902 | - * Result of operation |
|
| 903 | - */ |
|
| 904 | - public function addAttributes($dn, $attributes) { |
|
| 905 | - if (!is_array($attributes)) { |
|
| 906 | - Logger::warning('Library - LDAP addAttributes(): No array of attributes given for DN \''.$dn.'\''); |
|
| 907 | - return false; |
|
| 908 | - } else { |
|
| 909 | - Logger::debug('Library - LDAP addAttributes(): Received arraydata:'.print_r($attributes,true)); |
|
| 910 | - } |
|
| 911 | - |
|
| 912 | - // Attempt to add attributes |
|
| 913 | - $result = @ldap_mod_add($this->ldap, $dn, $attributes); |
|
| 914 | - if ($result === false) throw $this->makeException('Library - LDAP addAttributes(): Failed to set attributes for DN \''.$dn.'\'. Bind necessary?'); |
|
| 915 | - |
|
| 916 | - return $result; |
|
| 917 | - } |
|
| 895 | + * Adds for a given DN attributes |
|
| 896 | + * |
|
| 897 | + * @param string $dn |
|
| 898 | + * The DN of an element. |
|
| 899 | + * @param array $attributes |
|
| 900 | + * The names and value of the attribute(s) to set using ldap_mod_add structure; |
|
| 901 | + * @return bool |
|
| 902 | + * Result of operation |
|
| 903 | + */ |
|
| 904 | + public function addAttributes($dn, $attributes) { |
|
| 905 | + if (!is_array($attributes)) { |
|
| 906 | + Logger::warning('Library - LDAP addAttributes(): No array of attributes given for DN \''.$dn.'\''); |
|
| 907 | + return false; |
|
| 908 | + } else { |
|
| 909 | + Logger::debug('Library - LDAP addAttributes(): Received arraydata:'.print_r($attributes,true)); |
|
| 910 | + } |
|
| 911 | + |
|
| 912 | + // Attempt to add attributes |
|
| 913 | + $result = @ldap_mod_add($this->ldap, $dn, $attributes); |
|
| 914 | + if ($result === false) throw $this->makeException('Library - LDAP addAttributes(): Failed to set attributes for DN \''.$dn.'\'. Bind necessary?'); |
|
| 915 | + |
|
| 916 | + return $result; |
|
| 917 | + } |
|
| 918 | 918 | } |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | Logger::warning('Library - LDAP setAttributes(): No array of attributes given for DN \''.$dn.'\''); |
| 882 | 882 | return false; |
| 883 | 883 | } else { |
| 884 | - Logger::debug('Library - LDAP setAttributes(): Received arraydata:'.print_r($attributes,true)); |
|
| 884 | + Logger::debug('Library - LDAP setAttributes(): Received arraydata:'.print_r($attributes, true)); |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | // Attempt to set attributes |
@@ -906,7 +906,7 @@ discard block |
||
| 906 | 906 | Logger::warning('Library - LDAP addAttributes(): No array of attributes given for DN \''.$dn.'\''); |
| 907 | 907 | return false; |
| 908 | 908 | } else { |
| 909 | - Logger::debug('Library - LDAP addAttributes(): Received arraydata:'.print_r($attributes,true)); |
|
| 909 | + Logger::debug('Library - LDAP addAttributes(): Received arraydata:'.print_r($attributes, true)); |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | // Attempt to add attributes |