[horde] Set "from_addr" as pre populated "enum" field

Michael M Slusarz slusarz at horde.org
Tue Apr 23 16:31:32 UTC 2013


Quoting Nicolás Valera <nvalera at gmail.com>:

> On 03/20/2013 05:48 AM, lst_hoe02 at kwsoft.de wrote:
>>
>> With this set in horde prefs.local.php it works as expected so the user
>> can only choose aliases assigned to his/her account:
>>
>> $userId = $registry->getAuth();
>> $db = $GLOBALS['injector']->getInstance('Horde_Db_Adapter');
>> $db->connect();
>> $result = $db->selectAssoc(" SELECT alias,alias FROM
>> postfix_virtual_aliases WHERE user_uid='$userId' ");
>> $db->disconnect();
>>
>> $_prefs['from_addr'] = array(
>>     'value' => '',
>> //    'type' => 'text',
>>     'type' => 'enum',
>>     'enum' => $result,
>>     'desc' =>  _("The default e-mail address to use with this identity:")
>> );

[snip]

> Im trying to do the same but my list of aliases is in another host.
> The parameters to connect to the database are defined in the conf.php
> because they are the same i use to authenticate the horde

Then you need to manually instantiate a Horde_Db object (e.g. new  
Horde_Db_Adapter_Foo) instead of using the Horde_Db_Adapter instance.   
You can use the code in the Horde_Db_Adapter factory  
(Horde_Core_Factory_Db class) to aid you in doing this.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the horde mailing list