[gollem] Selecting server based on IMP server

Jacob Elder jake.horde at trec.us
Thu Oct 13 11:45:00 PDT 2005


Like I said, my PHP is a little rusty. I think the last time I really worked
with PHP was 1999. Here's what I've put together from a naïve reading
of the other code:

imp/lib/api.php:

$_services['server'] = array(
   'type' => 'string'
);

function _imp_server()
{
   return $imp['server'];
}

/etc/horde/gollem/backends.php:

$backends['auto'] = array(
   'name' => 'Automatic',
   'driver' => 'ftp',
   'preferred' => '',
   'hordeauth' => full,
   'params' => array(
       'hostspec' => Imp::server,
   ),
   'root' => '/',
   'home' => '',
   'createhome' => 'false',
   // 'filter' => '^regex$',
   'attributes' => array('type', 'name', 'download', 'modified', 'size',
'permission', 'owner')
);

As I'm sure you can guess, this results in a blank page. What should the API
call look like when used?

-- 
Jacob Elder


Quoting Michael M Slusarz <slusarz at mail.curecanti.org>:

> Quoting Jacob Elder <jake.horde at trec.us>:
>
>> I want to automatically select the backend hostspec based on which
>> IMAP server
>> Imp is using. My organization has 5 backend servers running IMAP and
>> FTP, so I
>> was imagining something like this:
>>
>> $backends['auto'] = array(
>>    'name' => 'Automatic',
>>    'driver' => 'ftp',
>>    'preferred' => '',
>>    'hordeauth' => full,
>>    'params' => array(
>>        'hostspec' => // PHP magic here,
>>    ),
>>    'root' => '/',
>>    'home' => '',
>>    'createhome' => 'false',
>>    // 'filter' => '^regex$',
>>    'attributes' => array('type', 'name', 'download', 'modified', 'size',
>> 'permission', 'owner', 'group')
>> );
>>
>>
>> It's been a couple of years since I've done anything serious with PHP (more
>> comfortable in Perl), so I'm not really sure where to start. Is 
>> there any way
>> to see the which server the user selected from the Imp login screen?
>
> Yes, by looking in the $_SESSION['imp'] array.  But you are responsible
> for making sure this variable is set (i.e. the user has logged in)
> before you can check it in gollem.
>
> better yet, write an api method for imp that will return the current
> imap server used (see imp/lib/api.php) - then you can use Horde
> Registry:: calls to access the information rather than trying to access
> session variables - this is a much cleaner solution.  If you decide to
> go this route, sharing the api code with us would be great since this
> is definitely something that would be added.
>
> michael
>
> _______________________________________
> Michael Slusarz [slusarz at curecanti.org]
> --
> Gollem mailing list - Join the hunt: http://horde.org/bounties/#gollem
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: gollem-unsubscribe at lists.horde.org
>



More information about the gollem mailing list