function _ldapauth_ajax_test in LDAP integration 6
Implements the AJAX server test.
Parameters
$sid: LDAP server ID.
Return value
The JSON data.
1 string reference to '_ldapauth_ajax_test'
- ldapauth_menu in ./
ldapauth.module - Implements hook_menu().
File
- ./
ldapauth.admin.inc, line 695 - Module admin page callbacks.
Code
function _ldapauth_ajax_test($sid) {
global $_ldapauth_ldap;
if (!is_numeric($sid)) {
return;
}
_ldapauth_init($sid);
if ($_POST['bindpw_clear'] == 'undefined') {
$binddn = $_POST['binddn'];
$bindpw = $_POST['bindpw'];
}
else {
$binddn = $_ldapauth_ldap
->getOption('binddn');
$bindpw = $_ldapauth_ldap
->getOption('bindpw');
}
drupal_json($_ldapauth_ldap
->connect($binddn, $bindpw) ? array(
'status' => 1,
'message' => t('Authentication with the LDAP server succeeded.'),
) : array(
'status' => 0,
'message' => t('Authentication with the LDAP server failed.'),
));
exit;
}