Re: Selecting server based on IMP server

Michael M Slusarz <[email protected]>
Newsgroups gmane.comp.horde.gollem
Message-ID <[email protected]>
Quoting Jacob Elder <[email protected]>:

> 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 [[email protected]]
-- 
Gollem mailing list - Join the hunt: http://horde.org/bounties/#gollem
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.