[horde] Hooks - from_addr & fullname
Jan Schneider
jan at horde.org
Thu Mar 2 05:36:34 PST 2006
Zitat von Lee Evans <horde at leeevans.org>:
> Hi,
>
> I'm hoping somebody will be able to help me. I've setup horde, imp & turba
> to provide a webmail interface to our corporate exchange server.
>
> I've succesfully setup turba to provide the Exchange GAL using LDAP queries
> back to our domain controllers.
>
> I have a couple of final changes I need to make to ensure that the users get
> a smooth experience - automatically configured from addresses, full names
> and signatures. Once I've got one of these working I'm pretty confident I
> can work out the others, but at the moment I'm struggling.
>
> I have the following in hooks.php and have configured prefs.php to use the
> hook.
>
> function _prefs_hook_fullname($user = null)
> {
> $ldapServer = '192.168.x.x';
> $ldapPort = '389';
> $binddn = 'ldapuser at company.com';
> $bindpw = 'password';
> $searchBase = 'ou=Company Users,cn=company,cn=com';
>
> $ds = @ldap_connect($ldapServer, $ldapPort);
>
> if (is_null($user)) {
> $user = Auth::getAuth();
> }
> if (@ldap_bind($ds, $binddn, $bindpw)) {
> $searchResult = @ldap_list($ds, $searchBase, 'mail=' . $user);
> }
>
> $information = @ldap_get_entries($ds, $searchResult);
> $name = $information[0]['cn'][0];
>
> ldap_close($ds);
>
> return $name;
> }
>
>
> Which isn't working. If I substitue the last $name for an arbitrary string
> this is correctly assigned to the fullname so the hook itself is being run -
> so I guess it must be the LDAP parts that aren't working. I've tried
> different combinations of attributes etc to search for, but without any
> luck.
Start with removing the "@" operator to see error messages returned
from the ldap functions.
Jan.
--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/
More information about the horde
mailing list