From 15cf4fa9251f01313b5eb5cf1a91ec10643d42cb Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 21 Nov 2012 13:55:34 -0500
Subject: [PATCH] Rename rcube_bc.inc to bc.php for consistency
---
program/steps/settings/folders.inc | 81 ++++++++++++++++++++++------------------
1 files changed, 45 insertions(+), 36 deletions(-)
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index 6ca7049..0c7d906 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -85,6 +85,11 @@
else {
$deleted = $plugin['result'];
}
+
+ // #1488692: update session
+ if ($deleted && $_SESSION['mbox'] === $mbox) {
+ $RCMAIL->session->remove('mbox');
+ }
}
if ($OUTPUT->ajax_call && $deleted) {
@@ -294,40 +299,44 @@
$disabled = (($protected && $subscribed) || $noselect);
- // check if the folder is a namespace prefix, then disable subscription option on it
- if (!$disabled && $folder['virtual'] && $folder['level'] == 0 && !empty($namespace)) {
- $fname = $folder['id'] . $delimiter;
- foreach ($namespace as $ns) {
- if (is_array($ns)) {
- foreach ($ns as $item) {
- if ($item[0] === $fname) {
- $disabled = true;
- break 2;
+ // Below we will disable subscription option for "virtual" folders
+ // according to namespaces, but only if they aren't already subscribed.
+ // User should be able to unsubscribe from the folder
+ // even if it doesn't exists or is not accessible (OTRS:1000059)
+ if (!$subscribed && !$disabled && !empty($namespace) && $folder['virtual']) {
+ // check if the folder is a namespace prefix, then disable subscription option on it
+ if (!$disabled && $folder['level'] == 0) {
+ $fname = $folder['id'] . $delimiter;
+ foreach ($namespace as $ns) {
+ if (is_array($ns)) {
+ foreach ($ns as $item) {
+ if ($item[0] === $fname) {
+ $disabled = true;
+ break 2;
+ }
}
}
}
}
- }
- // check if the folder is an other users virtual-root folder, then disable subscription option on it
- if (!$disabled && $folder['virtual'] && $folder['level'] == 1
- && !empty($namespace) && !empty($namespace['other'])
- ) {
- $parts = explode($delimiter, $folder['id']);
- $fname = $parts[0] . $delimiter;
- foreach ($namespace['other'] as $item) {
- if ($item[0] === $fname) {
- $disabled = true;
- break;
+ // check if the folder is an other users virtual-root folder, then disable subscription option on it
+ if (!$disabled && $folder['level'] == 1 && !empty($namespace['other'])) {
+ $parts = explode($delimiter, $folder['id']);
+ $fname = $parts[0] . $delimiter;
+ foreach ($namespace['other'] as $item) {
+ if ($item[0] === $fname) {
+ $disabled = true;
+ break;
+ }
}
}
- }
- // check if the folder is shared, then disable subscription option on it (if not subscribed already)
- if (!$disabled && !$subscribed && $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;
+ // check if the folder is shared, then disable subscription option on it (if not subscribed already)
+ if (!$disabled) {
+ $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;
+ }
}
}
}
@@ -360,12 +369,7 @@
if (!$attrib['id'])
$attrib['id'] = 'rcmfolderframe';
- $attrib['name'] = $attrib['id'];
-
- $OUTPUT->set_env('contentframe', $attrib['name']);
- $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/resources/blank.gif');
-
- return html::iframe($attrib);
+ return $OUTPUT->frame($attrib, true);
}
function rcmail_rename_folder($oldname, $newname)
@@ -393,15 +397,20 @@
foreach ($a_threaded as $key => $val) {
if ($key == $oldname) {
unset($a_threaded[$key]);
- $a_threaded[$newname] = true;
+ $a_threaded[$newname] = true;
}
else if (preg_match($oldprefix, $key)) {
unset($a_threaded[$key]);
- $a_threaded[preg_replace($oldprefix, $newname.$delimiter, $key)] = true;
+ $a_threaded[preg_replace($oldprefix, $newname.$delimiter, $key)] = true;
}
}
$RCMAIL->user->save_prefs(array('message_threading' => $a_threaded));
+ // #1488692: update session
+ if ($_SESSION['mbox'] === $oldname) {
+ $_SESSION['mbox'] = $newname;
+ }
+
return true;
}
--
Gitblit v1.9.1