summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/include/main.inc26
-rw-r--r--program/include/rcube_imap.php22
-rw-r--r--program/js/app.js2
-rw-r--r--program/steps/settings/folders.inc18
4 files changed, 43 insertions, 25 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index a3edbf7ca..82d3eb7e9 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1407,21 +1407,21 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength,
$out = '';
foreach ($arrFolders as $key => $folder) {
- if (!empty($exceptions) && in_array($folder['id'], $exceptions)) {
- continue;
- }
-
- if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id'])))
- $foldername = rcube_label($folder_class);
- else {
- $foldername = $folder['name'];
+ 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);
+ }
- // shorten the folder name to a given length
- if ($maxlength && $maxlength>1)
- $foldername = abbreviate_string($foldername, $maxlength);
+ $select->add(str_repeat(' ', $nestLevel*4) . $foldername, $folder['id']);
}
-
- $select->add(str_repeat(' ', $nestLevel*4) . $foldername, $folder['id']);
+ else if ($nestLevel)
+ continue;
if (!empty($folder['folders']))
$out .= rcmail_render_folder_tree_select($folder['folders'], $mbox_name, $maxlength,
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index e31fb887e..0e28b083a 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -3083,20 +3083,36 @@ class rcube_imap
$a_folders = $this->conn->listMailboxes($root, $name,
NULL, array('SUBSCRIBED'));
- // remove non-existent folders
- if (is_array($a_folders)) {
+ // unsubscribe non-existent folders, remove from the list
+ if (is_array($a_folders) && $name == '*') {
foreach ($a_folders as $idx => $folder) {
if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder])
&& in_array('\\NonExistent', $opts)
) {
+ $this->conn->unsubscribe($folder);
unset($a_folders[$idx]);
- }
+ }
}
}
}
// retrieve list of folders from IMAP server using LSUB
else {
$a_folders = $this->conn->listSubscribed($root, $name);
+
+ // unsubscribe non-existent folders, remove from the list
+ if (is_array($a_folders) && $name == '*') {
+ foreach ($a_folders as $idx => $folder) {
+ if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder])
+ && in_array('\\Noselect', $opts)
+ ) {
+ // Some servers returns \Noselect for existing folders
+ if (!$this->mailbox_exists($folder)) {
+ $this->conn->unsubscribe($folder);
+ unset($a_folders[$idx]);
+ }
+ }
+ }
+ }
}
}
diff --git a/program/js/app.js b/program/js/app.js
index 717b21cfe..d15950d36 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4432,7 +4432,7 @@ function rcube_webmail()
this.set_photo_actions = function(id)
{
var n, buttons = this.buttons['upload-photo'];
- for (n=0; n < buttons && buttons.length; n++)
+ for (n=0; buttons && n < buttons.length; n++)
$('#'+buttons[n].id).html(this.get_label(id == '-del-' ? 'addphoto' : 'replacephoto'));
$('#ff_photo').val(id);
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index eea58062b..1d5df46e9 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -278,9 +278,6 @@ function rcube_subscription_form($attrib)
$display_folder = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $folder['level'])
. Q($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']);
- if ($sub_key !== false)
- unset($a_subscribed[$sub_key]);
-
if ($folder['virtual']) {
$classes[] = 'virtual';
}
@@ -317,6 +314,16 @@ function rcube_subscription_form($attrib)
}
}
}
+ // check if the folder is shared, then disable subscription option on it
+ if (!$disabled && $folder['virtual'] && !empty($namespace)) {
+ $tmp_ns = array_merge((array)$namespace['other'], (array)$namespace['shared']);
+ foreach ($tmp_ns as $item) {
+ if (strpos($folder['id'], $item[0]) === 0) {
+ $disabled = true;
+ break;
+ }
+ }
+ }
$table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes),
'foldername' => $folder['id']));
@@ -329,11 +336,6 @@ function rcube_subscription_form($attrib)
Q($display_folder), $protected || $folder['virtual']);
}
- // Unsubscribe from non-existing folders
- foreach ($a_subscribed as $folder) {
- $IMAP->unsubscribe($folder);
- }
-
$RCMAIL->plugins->exec_hook('folders_list', array('table' => $table));
$OUTPUT->add_gui_object('subscriptionlist', $attrib['id']);