alecpl
2008-05-30 681a59fa52b2996d8e8fa8c2d36eee1d1e70d938
program/include/rcube_imap.php
@@ -102,7 +102,7 @@
   * @return boolean  TRUE on success, FALSE on failure
   * @access public
   */
  function connect($host, $user, $pass, $port=143, $use_ssl=null)
  function connect($host, $user, $pass, $port=143, $use_ssl=null, $auth_type='check')
    {
    global $ICL_SSL, $ICL_PORT, $IMAP_USE_INTERNAL_DATE;
    
@@ -119,8 +119,6 @@
    $ICL_PORT = $port;
    $IMAP_USE_INTERNAL_DATE = false;
    $auth_type = rcmail::get_instance()->config->get('imap_auth_type', 'check');
    $this->conn = iil_Connect($host, $user, $pass, array('imap' => $auth_type));
    $this->host = $host;
    $this->user = $user;
@@ -2491,10 +2489,12 @@
   */
  function _sort_mailbox_list($a_folders)
    {
    $a_out = $a_defaults = array();
    $a_out = $a_defaults = $folders = $subfolders = array();
    $delimiter = $this->get_hierarchy_delimiter();
    // find default folders and skip folders starting with '.'
    foreach($a_folders as $i => $folder)
    foreach ($a_folders as $i => $folder)
      {
      if ($folder{0}=='.')
        continue;
@@ -2502,15 +2502,31 @@
      if (($p = array_search(strtolower($folder), $this->default_folders_lc)) !== false && !$a_defaults[$p])
        $a_defaults[$p] = $folder;
      else
   {
   $l_folders[$folder] = mb_strtolower(rcube_charset_convert($folder, 'UTF-7'));
   $folders[$folder] = mb_strtolower(rcube_charset_convert($folder, 'UTF-7'));
      }
    asort($folders, SORT_LOCALE_STRING);
    ksort($a_defaults);
    $folders = array_merge($a_defaults, array_keys($folders));
    // finally we must rebuild the list to move
    // subfolders of default folders to their place
    while (list($key, $folder) = each($folders)) {
      $a_out[] = $folder;
      unset($folders[$key]);
      if (in_array(strtolower($folder), $this->default_folders_lc)) {
   foreach ($folders as $idx => $f) {
     if (strpos($f, $folder.$delimiter) === 0) {
           $a_out[] = $f;
       unset($folders[$idx]);
       }
     }
   reset($folders);
   }
      }
    asort($l_folders, SORT_LOCALE_STRING);
    ksort($a_defaults);
    return array_merge($a_defaults, array_keys($l_folders));
    return $a_out;
    }
  /**