* * See the enclosed file LICENSE for license information (ASL). If you * did not receive this file, see http://www.horde.org/licenses/asl.php. */ /* Include Horde's core.php file. */ include_once '../lib/core.php'; /* We should have loaded the String class, from the Horde_Util * package, in core.php. If String:: isn't defined, then we're not * finding some critical libraries. */ if (!class_exists('String')) { echo '
The Horde_Util package was not found. If PHP\'s error_reporting setting is high enough, there should be error messages printed above that may help you in debugging the problem. If you are simply missing these files, then you need to get the framework module from Horde CVS, and install the packages in it with the install-packages.php script.'; exit; } /* Initialize the Horde_Test:: class. */ if (!(@is_readable('../lib/Test.php'))) { echo 'ERROR: You must install Horde before running this script.'; exit; } require_once '../lib/Test.php'; $horde_test = &new Horde_Test; /* Turba version. */ $module = 'Turba'; require_once './lib/version.php'; $module_version = TURBA_VERSION; require TEST_TEMPLATES . 'header.inc'; require TEST_TEMPLATES . 'version.inc'; /* Display PHP Version information. */ $php_info = $horde_test->getPhpVersionInformation(); require TEST_TEMPLATES . 'php_version.inc'; /* PHP modules. */ $module_list = array( 'mysql' => 'MySQL Support', 'pgsql' => 'PostgreSQL Support', 'mssql' => 'Microsoft SQL Support', 'oci8' => 'Oracle Support', 'odbc' => 'Unified ODBC Support', 'ldap' => 'LDAP Support' ); /* Get the status output now. */ $module_output = $horde_test->phpModuleCheck($module_list); ?>

PHP Module Capabilities

PHP LDAP Support Test

'; if ($user) { echo 'bind as user="', $user, '"
'; } else { echo 'bind anonymously
'; } $ldap = ldap_connect($server, $port); if ($ldap) { if (!empty($user) && !ldap_bind($ldap, $user, $passwd)) { echo "

unable to bind as $user to LDAP server

\n"; ldap_close($ldap); $ldap = ''; } elseif (empty($user) && !ldap_bind($ldap)) { echo "

unable to bind anonymously to LDAP server

\n"; ldap_close($ldap); $ldap = ''; } if ($ldap) { $result = ldap_search($ldap, $basedn, $filter); if ($result) { echo '

search returned ' . ldap_count_entries($ldap, $result) . " entries

\n"; $info = ldap_get_entries($ldap, $result); for ($i = 0; $i < $info['count']; $i++) { echo '

dn is: ' . $info[$i]['dn'] . '
'; echo 'first cn entry is: ' . $info[$i]['cn'][0] . '
'; echo 'first mail entry is: ' . $info[$i]['mail'][0] . '

'; if ($i >= 10) { echo '

(only first 10 entries displayed)

'; break; } } } else { echo '

unable to search LDAP server

'; } } } else { echo '

unable to connect to LDAP server

'; } } else { ?>
Server
Port(defaults to "389")
Base DN(e.g. "dc=example,dc=com")
User(leave blank for anonymous)
Password
Filter(e.g. "cn=Babs Jensen")