[imp] _prefs_hook_from_addr problem
David Chang
david at thbuo.gov.tw
Tue Apr 22 15:19:24 PDT 2003
Hi all:
There are error messages appear on Horde login screen ,if i enable
$_prefs['from_addr'] hook value to true.
Error messages:
Notice: Undefined offset: 0 in /usr/local/apache/horde.beta/config/hooks.php on
line 132
Notice: Undefined offset: 0 in /usr/local/apache/horde.beta/config/hooks.php on
line 135
Warning: Cannot add header information - headers already sent by (output started
at /usr/local/apache/horde.beta/config/hooks.php:132) in
/usr/local/apache/horde.beta/imp/templates/common-header.inc on line 3
Warning: Cannot add header information - headers already sent by (output started
at /usr/local/apache/horde.beta/config/hooks.php:132) in
/usr/local/apache/horde.beta/imp/templates/common-header.inc on line 4
Therefore before user can login to Horde,the $user = Auth::getAuth() in
hooks.php is undefine and then cause this problem,well i guess so !
My question is :
If that point is true should i specify binddn & password in hooks.php to get
entries from ldap server ?
Configuration:
horde/config/conf.php
---------------------
$conf['auth']['driver'] = 'application';
$conf['auth']['params']['app'] = 'imp';
imp/config/prefs.php
--------------------
// user preferred email address for From: line
$_prefs['from_addr'] = array(
'value' => '',
'hook' => true,
'locked' => false,
'shared' => true,
'type' => 'implicit');
horde/config/hooks.php
----------------------
function _prefs_hook_from_addr()
{
$ldapServer = 'localhost';
$ldapPort = '389';
$searchBase = 'dc=test,dc=example.com';
$ds = @ldap_connect($ldapServer, $ldapPort);
$user = Auth::getAuth();
// You will probably need to replace cn= with uid=; this
// syntax is for Netware 5.1 nldap.
$searchResult = @ldap_search($ds, $searchBase, 'uid=' . $user);
$information = @ldap_get_entries($ds, $searchResult);
if ($information[0]['maill'][0] != '') {
$name = $information[0]['mail'][0];
} else {
$name = $information[0]['cn'][0];
}
ldap_close($ds);
return (empty($name) ? $user : $name);
}
Ldap server is Openldap 2.0.25
More information about the imp
mailing list