[imp] $imp vs. $_SESSION['imp']

Otto Stolz Otto.Stolz at uni-konstanz.de
Fri Sep 15 09:55:01 PDT 2006


Hello,

I am still tryíng to adapt
   Horde: 3.1.2
   Imp: H3 (4.1.2)
to our environment.

In a nutshell:
- How are $imp or $_SESSION['imp'] meant to be used?
   Is there any difference?
- How can I hand over session-related info from one custom
   hook function to another?

The whole story:

Several of my custom hooks will have to process
data from the pertinent LDAP server, such as the
IMAP user-id, the e-mail address, and the common
name of the current user.

To avoid multiple LDAP requests, I want to cache these
results between the various hook invocations. Which
mechanisms could I use? I was thinking of putting these
data in the $imp, or the $_SESSION['imp'] array, but
apparently I do not yet fully understand their features.

- The _imp_hook_vinfo example  in hooks.php.dist obtains
   information from $_SESSION['imp']['user'].

- Some of the custom hooks in our current Imp 3.2.2
   installation use $imp for this purpose. (The author
   of that code has left our shop, si I cannt ask him.)
   So I tried my 1st hook with a
       switch ($imp['server'])
   and it worked, properly.

- I have found that these arrays are set, when
   _prefs_hook_fullname is called (at least when it's called
   the 2nd time), but not when _imp_hook_vinfo is called
   (cf. my recent note, Message-ID: <450AD023.3000103 at uni-konstanz.de>).

Now the questions are:
- Is there any difference between $imp and $_SESSION['imp']?
- Are they preserved over a user session, and are they
   kept apart across user sessions?
- Can I write in my own component, say $imp['knu'],
   and will this component be preserved over a user session?
- Or should I rather use $imp['cache']['knu']?
   Or perhaps $_SESSION['imp']$imp['cache']['knu']?
- When and how are these arrays set, during login;
   which custom hooks can rely on them, and which can't?

Thanks, in advance, for any enlightment.

Best wishes,
   Otto Stolz





More information about the imp mailing list