$config->ntlmsso_type = 'ntlm';
}
+ // Try to remove duplicates before storing the contexts (to avoid problems in sync_users()).
+ $config->contexts = explode(';', $config->contexts);
+ $config->contexts = array_map(create_function('$x', 'return textlib::strtolower(trim($x));'),
+ $config->contexts);
+ $config->contexts = implode(';', array_unique($config->contexts));
+
// Save settings
set_config('host_url', trim($config->host_url), $this->pluginconfig);
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
- set_config('contexts', trim($config->contexts), $this->pluginconfig);
+ set_config('contexts', $config->contexts, $this->pluginconfig);
set_config('user_type', moodle_strtolower(trim($config->user_type)), $this->pluginconfig);
set_config('user_attribute', moodle_strtolower(trim($config->user_attribute)), $this->pluginconfig);
set_config('search_sub', $config->search_sub, $this->pluginconfig);