function ldapauth_admin_form_submit in LDAP integration 5
Same name and namespace in other branches
- 5.2 ldapauth.module \ldapauth_admin_form_submit()
- 6 ldapauth.admin.inc \ldapauth_admin_form_submit()
Submit the contact category page for submission
File
- ./
ldapauth.module, line 552
Code
function ldapauth_admin_form_submit($form_id, $form_values) {
// set the checking order
if (arg(3) == 'add') {
if (db_fetch_object(db_query("SELECT name FROM {ldapauth} WHERE name = '%s'", $form_values['name']))) {
form_set_error('name', t('An LDAP config with that name already exists.'));
}
db_query("INSERT INTO {ldapauth} (name, status, server, port, tls, encrypted, basedn, user_attr, mail_attr, binddn, bindpw) VALUES ('%s', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s')", $form_values['name'], 1, $form_values['server'], $form_values['port'], $form_values['tls'], $form_values['encrypted'], $form_values['basedn'], trim($form_values['user_attr']), trim($form_values['mail_attr']), $form_values['binddn'], $form_values['bindpw']);
drupal_set_message(t('LDAP Configuration %config has been added.', array(
'%config' => $form_values['name'],
)));
watchdog('ldap', t('ldapauth: ldap config %config added.', array(
'%config' => $form_values['name'],
)));
}
else {
if (!$form_values['bindpw_clear'] && $form_values['bindpw']) {
db_query("UPDATE {ldapauth} SET name = '%s', server = '%s', port = '%d', tls = '%d', encrypted = '%d', basedn = '%s', user_attr = '%s', mail_attr = '%s', binddn = '%s', bindpw = '%s', bindpw_clear = '%d' WHERE sid = %d", $form_values['name'], $form_values['server'], $form_values['port'], $form_values['tls'], $form_values['encrypted'], $form_values['basedn'], trim($form_values['user_attr']), trim($form_values['mail_attr']), $form_values['binddn'], $form_values['bindpw'], $form_values['bindpw_clear'], $form_values['sid']);
}
else {
// set the clear password switch
db_query("UPDATE {ldapauth} SET name = '%s', server = '%s', port = '%d', tls = '%d', encrypted = '%d', basedn = '%s', user_attr = '%s', mail_attr = '%s', binddn = '%s', bindpw_clear = '%d' WHERE sid = %d", $form_values['name'], $form_values['server'], $form_values['port'], $form_values['tls'], $form_values['encrypted'], $form_values['basedn'], trim($form_values['user_attr']), trim($form_values['mail_attr']), $form_values['binddn'], $form_values['bindpw_clear'], $form_values['sid']);
}
drupal_set_message(t('LDAP Configuration %config has been updated.', array(
'%config' => $form_values['name'],
)));
watchdog('ldap', t('ldapauth: ldap config %config updated.', array(
'%config' => $form_values['name'],
)));
}
return 'admin/settings/ldapauth';
}