diff options
author | Lennart Rosam <hello@takuto.de> | 2015-08-22 23:06:04 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-10-05 13:42:20 +0200 |
commit | 70ffa2f9f88910bbfbfb4db93c8d6199bcb1c167 (patch) | |
tree | c10187557cd02b59d6c396db172339767ad311e9 /apps/user_ldap | |
parent | b47d15cd2052b5e88214439d220461312af3493e (diff) | |
download | nextcloud-server-70ffa2f9f88910bbfbfb4db93c8d6199bcb1c167.tar.gz nextcloud-server-70ffa2f9f88910bbfbfb4db93c8d6199bcb1c167.zip |
Spaces -> Tabs, Update PHP-Doc and function logic
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/configuration.php | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/apps/user_ldap/lib/configuration.php b/apps/user_ldap/lib/configuration.php index ff839881aa2..fe3740108c2 100644 --- a/apps/user_ldap/lib/configuration.php +++ b/apps/user_ldap/lib/configuration.php @@ -145,7 +145,7 @@ class Configuration { } $setMethod = 'setValue'; - $trim = false; + $trim = false; switch($key) { case 'homeFolderNamingRule': if(!empty($val) && strpos($val, 'attr:') === false) { @@ -155,7 +155,7 @@ class Configuration { case 'ldapBase': case 'ldapBaseUsers': case 'ldapBaseGroups': - $trim = true;// Prevent login errors due to whitespace + $trim = true;// Prevent login errors due to whitespace case 'ldapAttributesForUserSearch': case 'ldapAttributesForGroupSearch': case 'ldapUserFilterObjectclass': @@ -274,8 +274,11 @@ class Configuration { } /** - * @param string $varName - * @param array|string $value + * Sets multi-line values as arrays + * + * @param string $varName name of config-key + * @param array|string $value to set + * @param boolean $trim Trim value? (default: false) */ protected function setMultiLine($varName, $value, $trim = false) { if(empty($value)) { @@ -284,11 +287,17 @@ class Configuration { $value = preg_split('/\r\n|\r|\n|;/', $value); if($value === false) { $value = ''; - } else if($trim) { - foreach($value as $key => $val) { - $value[$key] = trim($val); - } - } + } + } + + if($trim) { + if(!is_array($value)) { + $value = trim($value); + } else { + foreach($value as $key => $val) { + $value[$key] = trim($val); + } + } } $this->setValue($varName, $value); @@ -334,11 +343,17 @@ class Configuration { } /** - * @param string $varName - * @param mixed $value + * Sets a scalar value. + * + * @param string $varName name of config key + * @param mixed $value to set + * @param boolean $trim Trim value? (default: false) */ protected function setValue($varName, $value, $trim = false) { - $this->config[$varName] = $trim ? trim($value) : $value; + if($trim && is_string($value)) { + $value = trim($value); + } + $this->config[$varName] = $value; } /** |