coding style

This commit is contained in:
Arthur Schiwon 2013-01-18 11:42:34 +01:00
parent a53addf825
commit 1c19e66712
1 changed files with 22 additions and 12 deletions

View File

@ -23,12 +23,22 @@
OC_Util::checkAdminUser(); OC_Util::checkAdminUser();
$params = array('ldap_host', 'ldap_port', 'ldap_backup_host', 'ldap_backup_port', 'ldap_override_main_server', 'ldap_dn', 'ldap_agent_password', 'ldap_base', 'ldap_base_users', 'ldap_base_groups', 'ldap_userlist_filter', 'ldap_login_filter', 'ldap_group_filter', 'ldap_display_name', 'ldap_group_display_name', 'ldap_tls', 'ldap_turn_off_cert_check', 'ldap_nocase', 'ldap_quota_def', 'ldap_quota_attr', 'ldap_email_attr', 'ldap_group_member_assoc_attribute', 'ldap_cache_ttl', 'home_folder_naming_rule'); $params = array('ldap_host', 'ldap_port', 'ldap_backup_host',
'ldap_backup_port', 'ldap_override_main_server', 'ldap_dn',
'ldap_agent_password', 'ldap_base', 'ldap_base_users',
'ldap_base_groups', 'ldap_userlist_filter',
'ldap_login_filter', 'ldap_group_filter', 'ldap_display_name',
'ldap_group_display_name', 'ldap_tls',
'ldap_turn_off_cert_check', 'ldap_nocase', 'ldap_quota_def',
'ldap_quota_attr', 'ldap_email_attr',
'ldap_group_member_assoc_attribute', 'ldap_cache_ttl',
'home_folder_naming_rule'
);
OCP\Util::addscript('user_ldap', 'settings'); OCP\Util::addscript('user_ldap', 'settings');
OCP\Util::addstyle('user_ldap', 'settings'); OCP\Util::addstyle('user_ldap', 'settings');
if ($_POST) { if($_POST) {
$clearCache = false; $clearCache = false;
foreach($params as $param) { foreach($params as $param) {
if(isset($_POST[$param])) { if(isset($_POST[$param])) {
@ -60,22 +70,22 @@ if ($_POST) {
} }
// fill template // fill template
$tmpl = new OCP\Template( 'user_ldap', 'settings'); $tmpl = new OCP\Template('user_ldap', 'settings');
foreach($params as $param) { foreach($params as $param) {
$value = OCP\Config::getAppValue('user_ldap', $param, ''); $value = OCP\Config::getAppValue('user_ldap', $param, '');
$tmpl->assign($param, $value); $tmpl->assign($param, $value);
} }
// settings with default values // settings with default values
$tmpl->assign( 'ldap_port', OCP\Config::getAppValue('user_ldap', 'ldap_port', '389')); $tmpl->assign('ldap_port', OCP\Config::getAppValue('user_ldap', 'ldap_port', '389'));
$tmpl->assign( 'ldap_display_name', OCP\Config::getAppValue('user_ldap', 'ldap_display_name', 'uid')); $tmpl->assign('ldap_display_name', OCP\Config::getAppValue('user_ldap', 'ldap_display_name', 'uid'));
$tmpl->assign( 'ldap_group_display_name', OCP\Config::getAppValue('user_ldap', 'ldap_group_display_name', 'cn')); $tmpl->assign('ldap_group_display_name', OCP\Config::getAppValue('user_ldap', 'ldap_group_display_name', 'cn'));
$tmpl->assign( 'ldap_group_member_assoc_attribute', OCP\Config::getAppValue('user_ldap', 'ldap_group_member_assoc_attribute', 'uniqueMember')); $tmpl->assign('ldap_group_member_assoc_attribute', OCP\Config::getAppValue('user_ldap', 'ldap_group_member_assoc_attribute', 'uniqueMember'));
$tmpl->assign( 'ldap_agent_password', base64_decode(OCP\Config::getAppValue('user_ldap', 'ldap_agent_password'))); $tmpl->assign('ldap_agent_password', base64_decode(OCP\Config::getAppValue('user_ldap', 'ldap_agent_password')));
$tmpl->assign( 'ldap_cache_ttl', OCP\Config::getAppValue('user_ldap', 'ldap_cache_ttl', '600')); $tmpl->assign('ldap_cache_ttl', OCP\Config::getAppValue('user_ldap', 'ldap_cache_ttl', '600'));
$hfnr = OCP\Config::getAppValue('user_ldap', 'home_folder_naming_rule', 'opt:username'); $hfnr = OCP\Config::getAppValue('user_ldap', 'home_folder_naming_rule', 'opt:username');
$hfnr = ($hfnr == 'opt:username') ? '' : substr($hfnr, strlen('attr:')); $hfnr = ($hfnr == 'opt:username') ? '' : substr($hfnr, strlen('attr:'));
$tmpl->assign( 'home_folder_naming_rule', $hfnr, ''); $tmpl->assign('home_folder_naming_rule', $hfnr, '');
$tmpl->assign('serverConfigurationOptions', '', false); $tmpl->assign('serverConfigurationOptions', '', false);
return $tmpl->fetchPage(); return $tmpl->fetchPage();