t('LDAP Help'),
'description' => t('Debugging and Configuration Help with LDAP'),
'page callback' => 'ldaphelp_main',
'access arguments' => array('administer ldap modules'),
);
$items['admin/settings/ldap/help/resources'] = array(
'title' => t('Resources'),
'description' => t('Some help resources for LDAP modules'),
'page callback' => 'ldaphelp_main',
'access arguments' => array('administer ldap modules'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 2,
);
$items['admin/settings/ldap/help/status'] = array(
'title' => t('Status'),
'description' => t('LDAP status page'),
'page callback' => 'ldaphelp_status',
'access arguments' => array('administer ldap modules'),
'file' => 'ldaphelp_status.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 4,
);
$items['admin/settings/ldap/help/watchdog'] = array(
'title' => t('Watchdog'),
'description' => t('LDAP watchdog logs'),
'page callback' => 'ldaphelp_watchdog',
'access arguments' => array('administer ldap modules'),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
);
$items['admin/settings/ldap/help/addcommon'] = array(
'title' => t('Common LDAPs'),
'description' => 'Add a new LDAP starting with common defaults such as Active Directory defaults.',
'page callback' => 'ldaphelp_addcommon',
'access arguments' => array('administer ldap modules'),
'type' => MENU_LOCAL_TASK,
'weight' => 7,
);
$items['admin/settings/ldap/help/wizard'] = array(
'title' => t('Wizard'),
'description' => t('A multi step form to help figure out LDAP server configuration.'),
'access arguments' => array('administer ldap modules'),
'file' => 'ldaphelp_wizard.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 13,
'page callback' => 'drupal_get_form',
'page arguments' => array('ldaphelp_wizard_form'),
);
return $items;
}
function _ldaphelp_bind_test($ldapserver) {
global $_ldapauth_ldap;
$test = array();
$_ldapauth_ldap = new LDAPInterface();
foreach ($ldapserver as $key => $value) {
$_ldapauth_ldap->setOption($key, $value);
}
if ($_ldapauth_ldap->getOption('binddn') && $_ldapauth_ldap->getOption('bindpw')) {
$test['bind_result'] = $_ldapauth_ldap->connectAndBind($_ldapauth_ldap->getOption('binddn'), $_ldapauth_ldap->getOption('bindpw'));
$test['bind_type'] = "non-anon";
}
else {
$test['bind_result'] = $_ldapauth_ldap->connectAndBind();
$test['bind_type'] = "anon";
}
if ($test['bind_result']) {
$test['bind_result_text'] = "Success";
$test['bind_success'] = TRUE;
}
else {
$test['bind_result_error'] = ldap_error($_ldapauth_ldap->connection);
$test['bind_result_errno'] = ldap_errno($_ldapauth_ldap->connection);
$test['bind_result_text'] = "Fail";
$test['bind_success'] = FALSE;
}
return $test;
}
function ldaphelp_bind_trial_message($trial) {
$tls = ($trial['tls']) ? "1" : "0";
$text = "Failed to bind to server: ". $trial['server'] .", port=". $trial['port'] .", tls=$tls
";
$text .= "error: ". $trial['results']['bind_result_error'];
return $text;
}
function ldaphelp_addcommon() {
if (!module_exists('ldapauth')) {
drupal_set_message('Links below will not work until ldapauth module is not enabled.', 'warning');
}
global $_ldaphelp_ldaps;
$content = '
'. t('These links simply start an Add LDAP Server form with some common defaults.') .'
'; $content .= '";
$content .= ldaphelp_display_settings_short($_ldaphelp_ldaps[$ldap_type]['fields']);
$content .= "
'. t('This module is meant to assist Drupal admins in configuring, debugging, sharing, and submitting support and bug request related to LDAP integration modules.') .''. t(' LDAP Help Module should be disabled unless you are debugging or configuring ldap problems.') .''. t(' It adds no functionality to the LDAP modules.') .'
'; $path = drupal_get_path("module", "ldapauth"); $text .= <<Database logging
module to be turned on. ';
$_content .= l('Module enable page', 'admin/build/modules');
}
return $_content;
}