auth/cas MDL-23371 Add missing detection of PHP LDAP module like we do in auth/ldap

This commit is contained in:
Inaki 2010-07-25 22:55:45 +00:00
parent fe3b9da3fa
commit 840fcf0c30
2 changed files with 14 additions and 4 deletions

View File

@ -188,6 +188,20 @@ class auth_plugin_cas extends auth_plugin_ldap {
function config_form($config, $err, $user_fields) {
global $CFG, $OUTPUT;
if (!function_exists('ldap_connect')) { // Is php-ldap really there?
echo $OUTPUT->notification(get_string('auth_ldap_noextension', 'auth_ldap'));
// Don't return here, like we do in auth/ldap. We cas use CAS without LDAP.
// So just warn the user (done above) and define the LDAP constants we use
// in config.html, to silence the warnings.
if (!defined('LDAP_DEREF_NEVER')) {
define ('LDAP_DEREF_NEVER', 0);
}
if (!defined('LDAP_DEREF_ALWAYS')) {
define ('LDAP_DEREF_ALWAYS', 3);
}
}
include($CFG->dirroot.'/auth/cas/config.html');
}

View File

@ -80,10 +80,6 @@ if (!isset($config->removeuser)) {
$yesno = array( get_string('no'), get_string('yes') );
if (!function_exists('ldap_connect')) { // Is php-ldap really there?
echo $OUTPUT->notification(get_string('auth_ldap_noextension', 'auth_ldap'));
}
?>
<table cellspacing="0" cellpadding="5" border="0">
<tr>