function _ldapdata_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 '_ldapdata_ajax_test'
- ldapdata_menu in ./
ldapdata.module - Implements hook_menu().
File
- ./
ldapdata.admin.inc, line 421 - Module admin page callbacks.
Code
function _ldapdata_ajax_test($sid) {
global $_ldapdata_ldap;
if (!is_numeric($sid)) {
return;
}
_ldapdata_init($sid);
if ($_POST['bindpw_clear'] == 'undefined') {
$binddn = $_POST['binddn'];
$bindpw = $_POST['bindpw'];
}
else {
$binddn = $_ldapdata_ldap
->getOption('binddn');
$bindpw = $_ldapdata_ldap
->getOption('bindpw');
}
drupal_json($_ldapdata_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;
}