From fbe54043cf598b19a753dc2b21a7ed558d23fd15 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 18 Aug 2011 13:40:07 -0400
Subject: [PATCH] Fix folders drop-down list: descend into root folder (e.g. INBOX) even if part of the exception list

---
 program/include/main.inc |   71 +++++++++++++++--------------------
 1 files changed, 30 insertions(+), 41 deletions(-)

diff --git a/program/include/main.inc b/program/include/main.inc
index 140f1be..82d3eb7 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1407,21 +1407,21 @@
   $out = '';
 
   foreach ($arrFolders as $key => $folder) {
-    if (!empty($exceptions) && in_array($folder['id'], $exceptions)) {
+    if (empty($exceptions) || !in_array($folder['id'], $exceptions)) {
+      if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id'])))
+        $foldername = rcube_label($folder_class);
+      else {
+        $foldername = $folder['name'];
+
+        // shorten the folder name to a given length
+        if ($maxlength && $maxlength>1)
+          $foldername = abbreviate_string($foldername, $maxlength);
+      }
+
+      $select->add(str_repeat('&nbsp;', $nestLevel*4) . $foldername, $folder['id']);
+    }
+    else if ($nestLevel)
       continue;
-    }
-
-    if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id'])))
-      $foldername = rcube_label($folder_class);
-    else {
-      $foldername = $folder['name'];
-
-      // shorten the folder name to a given length
-      if ($maxlength && $maxlength>1)
-        $foldername = abbreviate_string($foldername, $maxlength);
-    }
-
-    $select->add(str_repeat('&nbsp;', $nestLevel*4) . $foldername, $folder['id']);
 
     if (!empty($folder['folders']))
       $out .= rcmail_render_folder_tree_select($folder['folders'], $mbox_name, $maxlength,
@@ -1693,7 +1693,7 @@
       $temp_dir = $RCMAIL->config->get('temp_dir');
       $body_file = tempnam($temp_dir, 'rcmMsg');
       if (PEAR::isError($mime_result = $message->saveMessageBody($body_file))) {
-        raise_error(array('code' => 600, 'type' => 'php',
+        raise_error(array('code' => 650, 'type' => 'php',
             'file' => __FILE__, 'line' => __LINE__,
             'message' => "Could not create message: ".$mime_result->getMessage()),
             TRUE, FALSE);
@@ -1738,7 +1738,7 @@
     $msg_body = $message->get();
 
     if (PEAR::isError($msg_body))
-      raise_error(array('code' => 600, 'type' => 'php',
+      raise_error(array('code' => 650, 'type' => 'php',
             'file' => __FILE__, 'line' => __LINE__,
             'message' => "Could not create message: ".$msg_body->getMessage()),
             TRUE, FALSE);
@@ -2332,7 +2332,7 @@
     $RCMAIL->output->send();
 }
 
-function rcube_upload_progress_init()
+function rcube_upload_init()
 {
     global $RCMAIL;
 
@@ -2343,6 +2343,19 @@
             $RCMAIL->output->set_env('upload_progress_time', (int) $seconds);
         }
     }
+
+    // find max filesize value
+    $max_filesize = parse_bytes(ini_get('upload_max_filesize'));
+    $max_postsize = parse_bytes(ini_get('post_max_size'));
+    if ($max_postsize && $max_postsize < $max_filesize)
+        $max_filesize = $max_postsize;
+
+    $RCMAIL->output->set_env('max_filesize', $max_filesize);
+    $max_filesize = show_bytes($max_filesize);
+    $RCMAIL->output->set_env('filesizeerror', rcube_label(array(
+        'name' => 'filesizeerror', 'vars' => array('size' => $max_filesize))));
+
+    return $max_filesize;
 }
 
 /**
@@ -2369,28 +2382,4 @@
     $RCMAIL->output->set_env('autocomplete_max', (int)$RCMAIL->config->get('autocomplete_max', 15));
     $RCMAIL->output->set_env('autocomplete_min_length', $RCMAIL->config->get('autocomplete_min_length'));
     $RCMAIL->output->add_label('autocompletechars');
-}
-
-function rcmail_localize_folderpath($path)
-{
-    global $RCMAIL;
-
-    $protect_folders = $RCMAIL->config->get('protect_default_folders');
-    $default_folders = (array) $RCMAIL->config->get('default_imap_folders');
-    $delimiter       = $RCMAIL->imap->get_hierarchy_delimiter();
-    $path            = explode($delimiter, $path);
-    $result          = array();
-
-    foreach ($path as $idx => $dir) {
-        $directory = implode($delimiter, array_slice($path, 0, $idx+1));
-        if ($protect_folders && in_array($directory, $default_folders)) {
-            unset($result);
-            $result[] = rcmail_localize_foldername($directory);
-        }
-        else {
-            $result[] = rcube_charset_convert($dir, 'UTF7-IMAP');
-        }
-    }
-
-    return implode($delimiter, $result);
 }

--
Gitblit v1.9.1