[horde] Some questions

Nicolas Fo nicolasfo at ymail.com
Wed Dec 19 08:46:47 UTC 2012


Le 18/12/2012 15:26, Jan Schneider a écrit :
>
> Zitat von Nicolas Fo <nicolasfo at ymail.com>:
>
>> Le 14/12/2012 15:39, Nicolas Fo a écrit :
>>> Le 14/12/2012 15:00, Nicolas Fo a écrit :
>>>> Le 14/12/2012 14:47, Nicolas Fo a écrit :
>>>>> Le 28/11/2012 16:48, Oscar del Rio a écrit :
>>>>>> On 11/28/12 09:23 AM, Nicolas Fo wrote:
>>>>>>> - How to auto fill "Name" and "Surname" of a user ? Those 
>>>>>>> informations would be stored in my AD base.
>>>>>>
>>>>>> horde/config/hooks.php  (see hooks.php.dist)
>>>>>>
>>>>>>> - How to hard setup (server side, for every users) HTML 
>>>>>>> composing mails ?
>>>>>>> - How to setup IMAP folders in IMP ? What are default names for 
>>>>>>> folders ? (Junk, sent...)
>>>>>>> - How to setup deleted mails go directly in trash and don't be 
>>>>>>> crossed ?
>>>>>>
>>>>>> imp/config/prefs.local.php  (see prefs.php for all options)
>>>>>>
>>>>>>
>>>>> Hello,
>>>>>
>>>>> Sorry to be late, I don't have a lot of time those days..
>>>>>
>>>>> I've tried to set the FullName from my AD LDAP base in Horde 
>>>>> (fullname is mentionned in the "cn" field)
>>>>>
>>>>> Here's my hooks.php file :
>>>>>
>>>>> <?php
>>>>> class Horde_Hooks
>>>>> {
>>>>>    {
>>>>>        switch ($pref) {
>>>>>        case 'fullname':
>>>>>
>>>>> //            // Example #2: Set the fullname from LDAP 
>>>>> information. In this
>>>>> //            // example we look if a Spanish name exists and 
>>>>> return this or
>>>>> //            // the standard 'cn' entry if not.
>>>>>            if (is_null($username)) {
>>>>>                return $value;
>>>>>            }
>>>>>
>>>>>            $ldapServer = 'MY.AD.SERVER';
>>>>>            $ldapPort = '389';
>>>>>            $searchBase = 'ou=OUNAME,dc=DOMAIN,DC=LOCAL';
>>>>>
>>>>>            $ds = @ldap_connect($ldapServer, $ldapPort);
>>>>>
>>>>>            $searchResult = @ldap_search($ds, $searchBase, 'uid=' . 
>>>>> $username);
>>>>>            $information = @ldap_get_entries($ds, $searchResult);
>>>>>            if (($information === false) || ($information['count'] 
>>>>> == 0)) {
>>>>>                $name = '';
>>>>>            } else {
>>>>>                $name = ($information[0]['cn;lang-es'][0] != '')
>>>>>                    ? $information[0]['cn;lang-es'][0]
>>>>>                    : $information[0]['cn'][0];
>>>>>            }
>>>>>
>>>>>            ldap_close($ds);
>>>>>
>>>>>            return empty($name)
>>>>>                ? $username
>>>>>                : $name;
>>>>>        }
>>>>>    }
>>>>> }
>>>>>
>>>>> I didn't understand the example with the Spanish name... So this 
>>>>> hooks file made something wrong...lol
>>>>>
>>>>> When I try to go to login to horde, I've an error "500 Internal 
>>>>> server error"
>>>>>
>>>>> I just want to have the user fullname set in Horde when user logs 
>>>>> in.. No filter to apply etc..
>>>>>
>>>>> Someone to help me ? in add, i'm not sure of the selected code...
>>>>>
>>>>> Thanks :)
>>>> So, I changed the code to delete the "Spanish restriction" and 
>>>> always the same problem :
>>>>
>>>> <?php
>>>> class Horde_Hooks
>>>> {
>>>>    {
>>>>        switch ($pref) {
>>>>        case 'fullname':
>>>>
>>>> //            // Example #2: Set the fullname from LDAP 
>>>> information. In this
>>>> //            // example we look if a Spanish name exists and 
>>>> return this or
>>>> //            // the standard 'cn' entry if not.
>>>>            if (is_null($username)) {
>>>>                return $value;
>>>>            }
>>>>
>>>>            $ldapServer = 'MY.AD.SERVER';
>>>>            $ldapPort = '389';
>>>>            $searchBase = 'ou=OUNAME,dc=DOMAIN,DC=LOCAL';
>>>>
>>>>            $ds = @ldap_connect($ldapServer, $ldapPort);
>>>>
>>>>            $searchResult = @ldap_search($ds, $searchBase, 'cn=' . 
>>>> $username);
>>>>            $information = @ldap_get_entries($ds, $searchResult);
>>>>            if (($information === false) || ($information['count'] 
>>>> == 0)) {
>>>>                $name = '';
>>>>            }
>>>>            ldap_close($ds);
>>>>
>>>>            return empty($name)
>>>>                ? $username
>>>>                : $name;
>>>>        }
>>>>    }
>>>> }
>>>>
>>>> Thanks in advance ;)
>>>>
>>>> Nicolas
>>>
>>> I forgot this line at the begining of the file :
>>>
>>>    public function prefs_init($pref, $value, $username, $scope_ob)
>>>
>>> Now, horde login page is OK, but the username is still missing...
>>>
>>> Thanks
>> Hello,
>>
>> Here's my hooks.php :
>>
>> <?php
>> class Horde_Hooks
>> {
>>     public function prefs_init($pref, $value, $username, $scope_ob)
>>     {
>>         switch ($pref) {
>>         case 'fullname':
>>
>>             if (is_null($username)) {
>>                 return $value;
>>             }
>>
>>             $ldapServer = 'MY.ADSERVER.LAN';
>>             $ldapPort = '389';
>>             $searchBase = 'ou=OUNAME,dc=DOMAIN,dc=lan';
>>
>>             $ds = @ldap_connect($ldapServer, $ldapPort);
>>
>>             $searchResult = @ldap_search($ds, $searchBase, 
>> 'displayname=' . $username);
>>             $information = @ldap_get_entries($ds, $searchResult);
>>             if (($information === false) || ($information['count'] == 
>> 0)) {
>>                 $name = '';
>>             }
>>             ldap_close($ds);
>>
>>             return empty($name)
>>                 ? $username
>>                 : $name;
>>
>> }
>> }
>> }
>>
>> and the prefs.local.php :
>>
>> <?php
>> $_prefs['fullname'] = array(
>>     'value' => '',
>>     'locked' => true,
>>     'shared' => true,
>>     'type' => 'text',
>>     'hook' => true,
>>     'desc' => _("Your full name:")
>> );
>>
>> It doesn't work, what am I missed ?
>>
>> Thanks
>
> "Doesn't work" isn't actually a helpful error description.

I have my email adress between " < > " and at the left, the same email 
address.

By posting php pages, I hoped you could see an error..

Thanks


More information about the horde mailing list