[cvs] [Wiki] changed: ImapSelect

Wiki Guest wiki at wiki.horde.org
Wed May 18 15:45:26 PDT 2005


guest [199.104.120.59]  Wed, 18 May 2005 15:45:26 -0700

Modified page: http://wiki.horde.org/display.php?page=ImapSelect
New Revision:  2.2

@@ -2,9 +2,11 @@
 Horde only allows a single primary server to be enabled in servers.php. Of course, we could have allowed our users to simply select
 their server by enabling IMAP server selection, but there is a better way. What follows are instructions on using a MySQL backend to 
 select an IMAP server for authentication, given a username:
 
-* The SQL table
++++ The SQL table
+
+
 
 There are many ways to do this of course. In this example, we'll just be using a table with two rows:
 
 <code>
@@ -12,17 +14,19 @@
 |   username        |     server.domain.com             |
 ---------------------------------------------------------
 </code>
 
-Your table can be constructed however you like. It can even be a part of your existing DB. The important point is that you need the
+Your table can be constructed however you like. It can even be a part of your existing Horde DB. The important point is that you need the
 table to be constructed in such a way as to be able to query a username and have the lookup return a servername. Our example
 uses a table called 'host'. 
 
-* Writing a hook
++++ Writing a hook
 
-Here's some sample code for a hook that could be placed into horde/config/hooks.php:
 
-<code>
+
+Here's some sample code for a hook placed inside horde/config/hooks.php:
+
+<code type="php">
 if (!function_exists('_imp_hook_imap')) {
         function _imp_hook_imap($userName)
         {
                 global $conf;
@@ -39,13 +43,15 @@
 } 
 
 </code>
 
-* Placing the hook into the session
++++ Placing the hook into the session
+
+
 
 The above hook returns a single line containing a server name. It's injected into /horde/imp/lib/Session.php as follows:
 
-<code>
+<code type="php">
 
         if (!empty($GLOBALS['conf']['hooks']['imap'])) {
                 require_once HORDE_BASE . '/config/hooks.php';
                 if (function_exists('_imp_hook_imap')) {
@@ -57,7 +63,11 @@
 
 On our setup, this is done right before authentication is attempted (right around line 223). As best I can tell, you're fine so long
 as you don't have $_SESSION['imp']['server']  overwritten by anything else before you get to the call to &Auth::singleton(array('imp', 'imp'));
 
-* Disclaimer 
++++ Disclaimer 
+
+
+
+This code works on our setup thus far. It could be wrong, uneccesary, foolish, or otherwise idiotic. In short, YMMV. 
 
-This code works on our setup so far. It could be wrong, uneccesary, foolish, or otherwise idiotic. In short, YMMV. 
+Questions? Send them to mp at xmission.com


More information about the cvs mailing list