[horde] access backend params inside a hook

A. Schulze sca at andreasschulze.de
Fri Sep 19 08:28:07 UTC 2014


Jan Schneider:

> Zitat von A. Schulze <sca at andreasschulze.de>:
>> $backends['ldap']['params']['host'] = ...
>> $backends['ldap']['params']['basedn'] = ...
>> how is it possible to use these values inside the userdn hook?


> $injector->getInstance('Passwd_Factory_Driver')->backends contains  
> all backend definitions.

Hm. get an Exception...

for testing purposes I have this horde/passwd/hooks.local.php
<?php
class Passwd_Hooks
{
     public function userdn($authid) {
         Horde::logMessage('HOOK passwd.userdn: ldaphost: "' .  
$injector->getInstance('Passwd_Factory_Driver')->backends['ldap']['params']['host'] . '"',  
'INFO');
         return $authid;
     }
}

and get this log:
HORDE [passwd] Call to a member function getInstance() on a non-object  
[pid 10812 on line 5 of "/horde/passwd/config/hooks.local.php"]

and this browserpage:
Call to a member function getInstance() on a non-object

1. Horde_ErrorHandler::catchFatalError()

Details
Die vollständige Fehlermeldung wurde in Hordes Logdatei geschrieben  
und für Administratoren weiter unten ausgegeben. Benutzer, die keine  
Administratoren sind, bekommen diese Details nicht zu sehen.

ErrorException Object
(
     [message:protected] => Call to a member function getInstance() on  
a non-object
     [string:Exception:private] =>
     [code:protected] => 0
     [file:protected] => /horde/passwd/config/hooks.local.php
     [line:protected] => 5
     [trace:Exception:private] => Array
         (
             [0] => Array
                 (
                     [function] => catchFatalError
                     [class] => Horde_ErrorHandler
                     [type] => ::
                     [args] => Array
                         (
                         )

                 )

         )

     [previous:Exception:private] =>
     [severity:protected] => 1
     [logged] => 1
)




More information about the horde mailing list