[imp] implementing 'realm' support in IMP 6.1

Michael M Slusarz slusarz at horde.org
Wed Jun 5 18:31:20 UTC 2013


Quoting Enrico Scholz <enrico.scholz at sigma-chemnitz.de>:

> Hi,
>
> with horde/imp 6.0 I use a horde/hooks.php with
>
> ----
> class Horde_Hooks
> {
>     public function authusername($userId, $toHorde)
>     {
> 	if ($toHorde) {
> 	    $server =  
> IMP_Imap::loadServerConfig($GLOBALS['auth_params']['imp_server_key']);
> 	    if ($server && $server['realm']) {
>                 /* required for logins on webfrontend */
> 		$realm = $server['realm'];
> 	    } else {
>                 /* required for logins via activesync */
> 		$imap = $GLOBALS['injector']->getInstance('IMP_Factory_Imap')->create();
>
> 		switch ($imap->ob->getParam('port')) {
> 		case 1430: $realm = '...realmA...'; break;
> 		case 1431: $realm = '...otherealmB...'; break;
> ----
>
> Unfortunately, this does not work anymore with imp 6.1.  Now, I get
>
> | PHP Fatal error:  Cannot use object of type IMP_Imap_Config as array
> | PHP Fatal error:  Call to a member function getParam() on a non-object in
>
> in the corresponding branch.
>
>
> What would be the best way to express this with 6.1?  Upgrade notes do
> not mention an API change there.

This was an internal change, and not part of the public API, so that  
is why it was not documented.

IMP_Imap::loadServerConfig() now will return a IMP_Imap_Config object.  
  Documentation on this object is here:

http://dev.horde.org/api/master/app/imp/classes/IMP_Imap_Config.html

Do note there is no such entry as "realm" in the current config.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the imp mailing list