[horde] Virtual domain support in H4/IMP5
Antoine Heskia
horde at heskia.net
Fri Apr 15 20:47:36 UTC 2011
Le 15 avr. 2011 à 15:22, Patrick Domack <patrickdk at patrickdk.com> a écrit :
>
> Quoting Antoine Heskia <horde at heskia.net>:
>
>> Hi,
>>
>> In my Horde3/IMP4, I used to have a custom hook function in the
>> horde/imp/config/hooks.php to support multidomains that I am hosting.
>> The user points its browser to mail.domain.com, the the login window
>> displays "@domain.com" at the end of the username field and horde/imp
>> provides username at domain.com to the IMAP server
>> (qmail/vpopmail/courier-imap).
>>
>> This function looks like this:
>> if (!function_exists('_imp_hook_vinfo')) {
>> function _imp_hook_vinfo($type = 'username')
>> {
>> $vdomain = getenv('HTTP_HOST');
>> $vdomain = preg_replace('|^(web)?mail\.|i', '', $vdomain);
>> $vdomain = preg_replace('|^imp\.|i', '', $vdomain);
>> $vdomain = String::lower($vdomain);
>>
>> if ($type == 'username') {
>> if ($vdomain == '') {
>> return $_SESSION['imp']['user'];
>> } else {
>> return (preg_replace('|@.*$|', '',
>> $_SESSION['imp']['user']) . '@' . $vdomain);
>> }
>> } elseif ($type == 'vdomain') {
>> return $vdomain;
>> } else {
>> return PEAR::raiseError('invalid type: ' . $type);
>> }
>> }
>> }
>>
>> I did not find such a feature in Horde4/IMP5.
>>
>> I can not find a proper information in the documentation.
>> for "The 'vinfo' hook has been removed. Use Horde's 'authusername'
>> and/or IMP's
>> 'preauthenticate' hooks instead."
>>
>> I have tried to play a bit with the hook public function
>> authusername($userId, $toHorde) in horde/config/hooks.php
>> but users still need to provide user at domain.com to logon (and they are
>> recognized as user at domain.com@domain.com by horde) and the logon
>> window does not displays "@domain.com" after the username field.
>>
>> Regarding
>> "All hooks that are specific to IMP have been moved from the
>> ``horde/config/hooks.php`` file. Move your existing IMP Hooks from there to
>> ``imp/config/hooks.php``."
>> this was already in imp/config/hooks.php in Horde3/IMP4. Should I
>> copy/paste the code to Horde5/IMP4 ?
>>
>
>
> It seemed pretty easy to me:
>
> public function preauthenticate($userId, $credentials)
> {
> if (strpos($userId,'@')===false) {
> $vdomain = preg_replace('/^((web)?mail|imp)\./i', '', $_SERVER['HTTP_HOST']);
> $userId=Horde_String::lower($userId . '@' . $vdomain);
> } else {
> $userId=Horde_String::lower($userId);
> }
>
> return array(
> 'userId' => $userId
> );
> }
Manu thanks for your suggestion i'll try it. In which hooks.php i shhould put it ? horde/config/hooks.php or horde/imp/config/hooks.php ?
Kind regards,
Antoine
More information about the horde
mailing list