@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function __construct($configPrefix, $autoRead = true) { |
111 | 111 | $this->configPrefix = $configPrefix; |
112 | - if($autoRead) { |
|
112 | + if ($autoRead) { |
|
113 | 113 | $this->readConfiguration(); |
114 | 114 | } |
115 | 115 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return mixed|null |
120 | 120 | */ |
121 | 121 | public function __get($name) { |
122 | - if(isset($this->config[$name])) { |
|
122 | + if (isset($this->config[$name])) { |
|
123 | 123 | return $this->config[$name]; |
124 | 124 | } |
125 | 125 | return null; |
@@ -150,22 +150,22 @@ discard block |
||
150 | 150 | * @return false|null |
151 | 151 | */ |
152 | 152 | public function setConfiguration($config, &$applied = null) { |
153 | - if(!is_array($config)) { |
|
153 | + if (!is_array($config)) { |
|
154 | 154 | return false; |
155 | 155 | } |
156 | 156 | |
157 | 157 | $cta = $this->getConfigTranslationArray(); |
158 | - foreach($config as $inputKey => $val) { |
|
159 | - if(strpos($inputKey, '_') !== false && array_key_exists($inputKey, $cta)) { |
|
158 | + foreach ($config as $inputKey => $val) { |
|
159 | + if (strpos($inputKey, '_') !== false && array_key_exists($inputKey, $cta)) { |
|
160 | 160 | $key = $cta[$inputKey]; |
161 | - } elseif(array_key_exists($inputKey, $this->config)) { |
|
161 | + } elseif (array_key_exists($inputKey, $this->config)) { |
|
162 | 162 | $key = $inputKey; |
163 | 163 | } else { |
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | |
167 | 167 | $setMethod = 'setValue'; |
168 | - switch($key) { |
|
168 | + switch ($key) { |
|
169 | 169 | case 'ldapAgentPassword': |
170 | 170 | $setMethod = 'setRawValue'; |
171 | 171 | break; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | break; |
190 | 190 | } |
191 | 191 | $this->$setMethod($key, $val); |
192 | - if(is_array($applied)) { |
|
192 | + if (is_array($applied)) { |
|
193 | 193 | $applied[] = $inputKey; |
194 | 194 | // storing key as index avoids duplication, and as value for simplicity |
195 | 195 | } |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | public function readConfiguration() { |
202 | - if(!$this->configRead && !is_null($this->configPrefix)) { |
|
202 | + if (!$this->configRead && !is_null($this->configPrefix)) { |
|
203 | 203 | $cta = array_flip($this->getConfigTranslationArray()); |
204 | - foreach($this->config as $key => $val) { |
|
205 | - if(!isset($cta[$key])) { |
|
204 | + foreach ($this->config as $key => $val) { |
|
205 | + if (!isset($cta[$key])) { |
|
206 | 206 | //some are determined |
207 | 207 | continue; |
208 | 208 | } |
209 | 209 | $dbKey = $cta[$key]; |
210 | - switch($key) { |
|
210 | + switch ($key) { |
|
211 | 211 | case 'ldapBase': |
212 | 212 | case 'ldapBaseUsers': |
213 | 213 | case 'ldapBaseGroups': |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function saveConfiguration() { |
252 | 252 | $cta = array_flip($this->getConfigTranslationArray()); |
253 | - foreach($this->unsavedChanges as $key) { |
|
253 | + foreach ($this->unsavedChanges as $key) { |
|
254 | 254 | $value = $this->config[$key]; |
255 | 255 | switch ($key) { |
256 | 256 | case 'ldapAgentPassword': |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | case 'ldapGroupFilterObjectclass': |
267 | 267 | case 'ldapGroupFilterGroups': |
268 | 268 | case 'ldapLoginFilterAttributes': |
269 | - if(is_array($value)) { |
|
269 | + if (is_array($value)) { |
|
270 | 270 | $value = implode("\n", $value); |
271 | 271 | } |
272 | 272 | break; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | case 'ldapUuidGroupAttribute': |
278 | 278 | continue 2; |
279 | 279 | } |
280 | - if(is_null($value)) { |
|
280 | + if (is_null($value)) { |
|
281 | 281 | $value = ''; |
282 | 282 | } |
283 | 283 | $this->saveValue($cta[$key], $value); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | protected function getMultiLine($varName) { |
294 | 294 | $value = $this->getValue($varName); |
295 | - if(empty($value)) { |
|
295 | + if (empty($value)) { |
|
296 | 296 | $value = ''; |
297 | 297 | } else { |
298 | 298 | $value = preg_split('/\r\n|\r|\n/', $value); |
@@ -308,21 +308,21 @@ discard block |
||
308 | 308 | * @param array|string $value to set |
309 | 309 | */ |
310 | 310 | protected function setMultiLine($varName, $value) { |
311 | - if(empty($value)) { |
|
311 | + if (empty($value)) { |
|
312 | 312 | $value = ''; |
313 | 313 | } else if (!is_array($value)) { |
314 | 314 | $value = preg_split('/\r\n|\r|\n|;/', $value); |
315 | - if($value === false) { |
|
315 | + if ($value === false) { |
|
316 | 316 | $value = ''; |
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
320 | - if(!is_array($value)) { |
|
320 | + if (!is_array($value)) { |
|
321 | 321 | $finalValue = trim($value); |
322 | 322 | } else { |
323 | 323 | $finalValue = []; |
324 | - foreach($value as $key => $val) { |
|
325 | - if(is_string($val)) { |
|
324 | + foreach ($value as $key => $val) { |
|
325 | + if (is_string($val)) { |
|
326 | 326 | $val = trim($val); |
327 | 327 | if ($val !== '') { |
328 | 328 | //accidental line breaks are not wanted and can cause |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | */ |
370 | 370 | protected function getValue($varName) { |
371 | 371 | static $defaults; |
372 | - if(is_null($defaults)) { |
|
372 | + if (is_null($defaults)) { |
|
373 | 373 | $defaults = $this->getDefaults(); |
374 | 374 | } |
375 | 375 | return \OC::$server->getConfig()->getAppValue('user_ldap', |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * @param mixed $value to set |
385 | 385 | */ |
386 | 386 | protected function setValue($varName, $value) { |
387 | - if(is_string($value)) { |
|
387 | + if (is_string($value)) { |
|
388 | 388 | $value = trim($value); |
389 | 389 | } |
390 | 390 | $this->config[$varName] = $value; |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | 'ldap_experienced_admin' => 'ldapExperiencedAdmin', |
532 | 532 | 'ldap_dynamic_group_member_url' => 'ldapDynamicGroupMemberURL', |
533 | 533 | 'ldap_default_ppolicy_dn' => 'ldapDefaultPPolicyDN', |
534 | - 'ldapIgnoreNamingRules' => 'ldapIgnoreNamingRules', // syconfig |
|
534 | + 'ldapIgnoreNamingRules' => 'ldapIgnoreNamingRules', // syconfig |
|
535 | 535 | ); |
536 | 536 | return $array; |
537 | 537 | } |