[horde] how to by pass login page of imp

Torsten Homberger homberger at helinet.de
Mon Dec 17 09:09:57 UTC 2007


Patrick DUBAU wrote:
> we want our users to launch horde/imp through  our portal (only one identification
> needed), so i want to by pass the login page from imp. 
> Is there any solution ?

Try these lines of code:

--------8<---------8<----------
<?php
@define('AUTH_HANDLER', true);
@define('HORDE_BASE', '/path/to/your/horde');
require_once HORDE_BASE . '/lib/base.php';
require_once HORDE_BASE . '/imp/lib/api.php';

function countUnseenMails() {
        require_once IMP_BASE . '/lib/Mailbox.php';
        $GLOBALS['horde_api']['stream'] =_imp_getStream();
        $imp_mailbox = &IMP_Mailbox::singleton();
        $unseenMessages = $imp_mailbox->unseenMessages();
        return count($unseenMessages);
}

function sso($user, $pass, $server='localhost') {
        return _imp_authenticate($user, array('password' => $pass),
array('server' => $server));
}
--------8<---------8<----------


Now you should be able to authenticate with
sso($user, $pass);

The function countUnseenMails() should return the amount of unseen mails.

Good luck,
Torsten Homberger



More information about the horde mailing list