function ldapauth_admin_form_validate in LDAP integration 6
Validate hook for the LDAP server form.
File
- ./
ldapauth.admin.inc, line 437 - Module admin page callbacks.
Code
function ldapauth_admin_form_validate($form, &$form_state) {
$values = $form_state['values'];
if (!isset($values['sid'])) {
if (db_fetch_object(db_query("SELECT name FROM {ldapauth} WHERE name = '%s'", $values['name']))) {
form_set_error('name', t('An LDAP config with the name %name already exists.', array(
'%name' => $values['name'],
)));
}
if (db_fetch_object(db_query("SELECT machine_name FROM {ldapauth} WHERE machine_name = '%s'", $values['machine_name']))) {
form_set_error('name', t('An LDAP config with the machine name %name already exists.', array(
'%name' => $values['machine_name'],
)));
}
}
if (!is_numeric($values['port'])) {
form_set_error('port', t('The TCP/IP port must be an integer.'));
}
}