From 840fcf0c30d389a1d8e2868fc863e28bbcdff8fe Mon Sep 17 00:00:00 2001 From: Inaki Date: Sun, 25 Jul 2010 22:55:45 +0000 Subject: [PATCH] auth/cas MDL-23371 Add missing detection of PHP LDAP module like we do in auth/ldap --- auth/cas/auth.php | 14 ++++++++++++++ auth/cas/config.html | 4 ---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/auth/cas/auth.php b/auth/cas/auth.php index 5ea0098bf39..193c83df708 100644 --- a/auth/cas/auth.php +++ b/auth/cas/auth.php @@ -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'); } diff --git a/auth/cas/config.html b/auth/cas/config.html index 118026884ce..13c38c77dcd 100644 --- a/auth/cas/config.html +++ b/auth/cas/config.html @@ -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')); -} - ?>