Connecting to proper IMAP server?

mgb@uwm.edu mgb@uwm.edu
Tue, 26 Mar 2002 08:26:17 -0600



Hello, 

I hope someone here can help me. 

I have inherited a server running IMP 2.2.4 and Horde 1.2, that's providing web-
 
based IMAP client access for a large number of users. The users are split 
across three seperate servers, based on the first letter of their username, and 
are directed to the proper server automatically by the following snippet of 
code in the construct() function in horde/lib/horde.lib: 

  function construct () { 
    global $imapuser, $pass, $server, $port, $servtype, $folders, $default, 
$ses 
s, $auth; 

    $this->user = $imapuser; 
    $this->pass = $pass; 

    if ($default->use_server_list) { 
      include './config/servers.php3'; 
      global $IMAPServer; 
    } 

/* this is CODE I ENTERED TO GET IMP TO GO WHERE IT SHOULD FOR ALL USERS */ 
//      Note this is not in the default imp install 

    $login_letter = substr ($imapuser, 0, 1); 

        if ( ( $login_letter >= 'a' and $login_letter <= 'h' ) or ( 
$login_lette 
r >= 'A' and $login_letter <= 'H' ) ) 
                        $this->server = "server1.uwm.edu"; 
        if ( ( $login_letter >= 'n' and $login_letter <= 'z' ) or ( 
$login_lette 
r >= 'N' and $login_letter <= 'Z' ) ) 
                        $this->server = "server2.uwm.edu"; 
        if ( ( $login_letter >= 'i' and $login_letter <= 'm' ) or ( 
$login_lette 
r >= 'I' and $login_letter <= 'M' ) ) 
                        $this->server = "server3.uwm.edu"; 
// end add 
// 
// 

    if ($default->use_server_list && ($iserver = @$IMAPServers[$IMAPServer])) { 
      $this->server   = $iserver->server; 
      $this->port     = $iserver->port; 
      $this->folders  = $iserver->folders; 
      $this->servtype = $iserver->servtype; 
      $this->from_server = $iserver->from_server; 
    } else { 
      // only set these if they are there - there are already sane defaults 
      if ($default->user_change_server && isset($server) && $server) $this-
>serv 
er = $server; 
      if ($default->user_change_port && isset($port) && $port) $this->port = 
$po 
rt; 
      if ($default->user_change_folder && isset($folders) && $folders) $this-
>fo 
lders = $folders; 
      if ($default->user_change_servtype && isset($servtype) && $servtype) 
$this 
->servtype = $servtype; 
      if (isset($from_server) && $from_server) $this->from_server = 
$from_server 
; 
    } 

    if (isset($sortby) && $sortby) $this->sortby = $sortby; 
    if (isset($sortdir) && $sortdir) $this->sortdir = $sortdir; 
    if (isset($mailbox) && $mailbox) $this->mailbox = $mailbox; 

    $this->delhide = $default->hide_deleted; 

    // internal 
    $this->config(); 
    $this->setSorting(); 
    $this->setMailbox(); 
    $this->setLabel(); 
  } // construct() 


This works just fine for us currently, but I have been tasked with upgrading to 
Horde 2.0 and IMP 3.0 for some other reasons, and to maintain the same 
functionality on login I am trying to find the right file to edit. I am not a 
strong PHP programmer, and any help that can be given, or even a pointer in the 
right direction will be greatly appreciated. 

IMP is a great piece of software, I'm very impressed, kudos to the developers. 

---- 
Matt Baran 
Technical Solutions Specialist 
University of Wisconsin - Milwaukee