[turba] automatically set full name

Amith Varghese amith at xalan.com
Mon Oct 27 13:51:50 PST 2003


this is what I have... you will obviously have to changed it based on the
structure of your directory.  And also I'm running CVS HEAD so that will change
some, but this works for me.

Amith


        require_once HORDE_BASE . '/lib/Util.php';

        $ldapServer = 'localhost';
        $ldapPort = '389';

        $vdomain = $_SERVER['HTTP_HOST'];
        $vdomain = preg_replace('|^mail\.|i', '', $vdomain);
        $vdomain = String::lower($vdomain);
        $domainparts = split("\.",$vdomain);
        $searchBase = 'ou=People,dc=' . $domainparts[0] . ',dc=' . $domainparts[
1] . ',c=US';
        $ldapcharset = 'utf-8';
        $outputcharset = NLS::getCharset();

        $ds = @ldap_connect($ldapServer, $ldapPort);

        // Find the user
        if (empty($user)) {
            $user = Auth::getAuth();
            if (empty($user)) {
               $user = Util::getFormData('imapuser') . '@' . Util::getFormData('
maildomain');
            }
        }

        // get the password
        $password = Auth::getCredential('password');
        if (empty($password)) {
            $password = Util::getFormData('pass');
        }

        if ($ds) {
           $ldapbind = ldap_bind($ds, 'uid=' . $user . ',' . $searchBase, $passw
ord);
        }

        $searchResult = @ldap_search($ds, $searchBase, 'uid=' . $user);
        $information = @ldap_get_entries($ds, $searchResult);
        $name = $user;

        if ($information['count'] != 0 && $information[0]['cn'][0] != '') {
            $name = $information[0]['cn'][0];
        }
        ldap_close($ds);

        $name = String::convertCharset($name, $ldapcharset, $outputcharset);
        return $name;
    }
}



Quoting kferguson at students.cncc.edu:

| Hello.
|
| I am running IMP 3.2 with Turba 1.2, and want to automatically set each
| user's
| fullname from the value in LDAP.  I have disabled multiple identities.  I've
| looked at imp/config/conf.php (the imp_set_fullname function) and tried many
| different combinations, but still can't get this to work.
|
| I know that this topic may have been covered previously, but after a lot of
| searching I still haven't found an example that I can make work.  Could
| anyone
| point me to a thread or howto which might show me what I'm missing?
|
| Thank you,
|
| Kirk Ferguson
|
|
| --
| Turba mailing list
| Frequently Asked Questions: http://horde.org/faq/
| To unsubscribe, mail: turba-unsubscribe at lists.horde.org
|


More information about the turba mailing list