Changeset 2188 in subversion


Ignore:
Timestamp:
Dec 24, 2008 9:29:47 AM (4 years ago)
Author:
thomasb
Message:

Allow empty strings for imap_root config parameter (was changed in r2143) to remain backward compatible but cache imap root and delimiter in session

Location:
trunk/roundcubemail
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/UPGRADING

    r2145 r2188  
    1919   the latter one, you have to temporary set 'enable_installer' to true 
    2020   in your local config/main.inc.php file. 
    21    WARNING: If you don't know what an "IMAP root directory" is, 
    22    set the imap_root option to NULL 
    23213. Let the update script/installer check your configuration and 
    2422   update your config files as suggested by the updater. 
  • trunk/roundcubemail/config/main.inc.php.dist

    r2163 r2188  
    6363 
    6464// If you know your imap's root directory and its folder delimiter, 
    65 // you can specify them here. Otherwise they will be determined 
    66 // during every imap connection. 
     65// you can specify them here. Otherwise they will be determined automatically. 
    6766$rcmail_config['imap_root'] = null; 
    6867$rcmail_config['imap_delimiter'] = null; 
  • trunk/roundcubemail/program/include/rcmail.php

    r2143 r2188  
    353353    // set pagesize from config 
    354354    $this->imap->set_pagesize($this->config->get('pagesize', 50)); 
     355     
     356    // Setting root and delimiter before iil_Connect can save time detecting them 
     357    // using NAMESPACE and LIST  
     358    $options = array( 
     359      'imap' => $this->config->get('imap_auth_type', 'check'), 
     360      'delimiter' => isset($_SESSION['imap_delimiter']) ? $_SESSION['imap_delimiter'] : $this->config->get('imap_delimiter'), 
     361    ); 
     362     
     363    if (isset($_SESSION['imap_root'])) 
     364      $options['rootdir'] = $_SESSION['imap_root']; 
     365    else if ($imap_root = $this->config->get('imap_root')) 
     366      $options['rootdir'] = $imap_root; 
     367     
     368    $this->imap->set_options($options); 
    355369   
    356370    // set global object for backward compatibility 
     
    372386     
    373387    if ($_SESSION['imap_host'] && !$this->imap->conn) { 
    374       if (!($conn = $this->imap->connect($_SESSION['imap_host'], $_SESSION['username'], $this->decrypt_passwd($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl'], rcmail::get_instance()->config->get('imap_auth_type', 'check')))) { 
     388      if (!($conn = $this->imap->connect($_SESSION['imap_host'], $_SESSION['username'], $this->decrypt_passwd($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl']))) { 
    375389        if ($this->output) 
    376390          $this->output->show_message($this->imap->error_code == -1 ? 'imaperror' : 'sessionerror', 'error'); 
     
    453467 
    454468    // exit if IMAP login failed 
    455     if (!($imap_login  = $this->imap->connect($host, $username, $pass, $imap_port, $imap_ssl, $config['imap_auth_type']))) 
     469    if (!($imap_login  = $this->imap->connect($host, $username, $pass, $imap_port, $imap_ssl))) 
    456470      return false; 
    457471 
     
    525539      $this->imap->set_page($_SESSION['page']); 
    526540    } 
     541     
     542    // cache IMAP root and delimiter in session for performance reasons 
     543    $_SESSION['imap_root'] = $this->imap->root_dir; 
     544    $_SESSION['imap_delimiter'] = $this->imap->delimiter; 
    527545  } 
    528546 
  • trunk/roundcubemail/program/include/rcube_imap.php

    r2149 r2188  
    6767  var $debug_level = 1; 
    6868  var $error_code = 0; 
     69  var $options = array('imap' => 'check'); 
    6970 
    7071 
     
    9192   * @access public 
    9293   */ 
    93   function connect($host, $user, $pass, $port=143, $use_ssl=null, $auth_type=null) 
     94  function connect($host, $user, $pass, $port=143, $use_ssl=null) 
    9495    { 
    9596    global $ICL_SSL, $ICL_PORT, $IMAP_USE_INTERNAL_DATE; 
     
    108109    $IMAP_USE_INTERNAL_DATE = false; 
    109110 
    110     // set connection options 
    111     $options['imap'] = $auth_type ? $auth_type : 'check'; 
    112  
    113     // Setting root and delimiter before iil_Connect can save time detecting them 
    114     // using NAMESPACE and LIST  
    115     if (is_string($imap_root = rcmail::get_instance()->config->get('imap_root')))  
    116         $options['rootdir'] = $imap_root; 
    117     if($imap_delimiter = rcmail::get_instance()->config->get('imap_delimiter')) 
    118         $options['delimiter'] = $imap_delimiter; 
    119  
    120     $this->conn = iil_Connect($host, $user, $pass, $options); 
     111    $this->conn = iil_Connect($host, $user, $pass, $this->options); 
    121112    $this->host = $host; 
    122113    $this->user = $user; 
     
    183174    } 
    184175 
     176  /** 
     177   * Set options to be used in iil_Connect() 
     178   */ 
     179  function set_options($opt) 
     180  { 
     181    $this->options = array_merge((array)$opt, $this->options); 
     182  } 
    185183 
    186184  /** 
     
    199197 
    200198    $this->root_dir = $root; 
     199    $this->options['rootdir'] = $root; 
    201200     
    202201    if (empty($this->delimiter)) 
Note: See TracChangeset for help on using the changeset viewer.