Changeset 1573 in subversion


Ignore:
Timestamp:
Jun 24, 2008 9:36:19 AM (5 years ago)
Author:
thomasb
Message:

Really fix host selection from login form

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcmail.php

    r1572 r1573  
    475475  { 
    476476    $default_host = $this->config->get('default_host'); 
    477     $host = empty($default_host) ? get_input_value('_host', RCUBE_INPUT_POST) : $default_host; 
    478      
    479     if (is_array($host)) { 
     477    $host = null; 
     478     
     479    if (is_array($default_host)) { 
     480      $post_host = get_input_value('_host', RCUBE_INPUT_POST); 
     481       
     482      // direct match in default_host array 
     483      if ($default_host[$post_host] || in_array($post_host, array_values($default_host))) { 
     484        $host = $post_host; 
     485      } 
     486       
     487      // try to select host by mail domain 
    480488      list($user, $domain) = explode('@', get_input_value('_user', RCUBE_INPUT_POST)); 
    481489      if (!empty($domain)) { 
    482         foreach ($host as $imap_host => $mail_domains) { 
     490        foreach ($default_host as $imap_host => $mail_domains) { 
    483491          if (is_array($mail_domains) && in_array($domain, $mail_domains)) { 
    484492            $host = $imap_host; 
     
    489497 
    490498      // take the first entry if $host is still an array 
    491       if (is_array($host)) 
    492         $host = array_shift($host); 
     499      if (empty($host)) { 
     500        $host = array_shift($default_host); 
     501      } 
     502    } 
     503    else if (empty($default_host)) { 
     504      $host = get_input_value('_host', RCUBE_INPUT_POST); 
    493505    } 
    494506 
Note: See TracChangeset for help on using the changeset viewer.