summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-04-08 19:11:12 +0200
committerThomas Bruederli <thomas@roundcube.net>2014-04-08 19:11:12 +0200
commit188247894f6aff3a11f68bbdf94626b8bf58b852 (patch)
treeb6997429e9b4d1bdf787dbfdf3e29cdbc72cf5db /program
parent05e3d11554f751ed6a614abe343141aa1e6ea6da (diff)
Make multi-folder message identifiers work with folders containing commas
Diffstat (limited to 'program')
-rw-r--r--program/include/rcmail.php10
-rw-r--r--program/js/app.js5
-rw-r--r--program/lib/Roundcube/rcube_imap.php4
-rw-r--r--program/lib/Roundcube/rcube_message.php2
-rw-r--r--program/steps/mail/copy.inc7
-rw-r--r--program/steps/mail/func.inc2
-rw-r--r--program/steps/mail/mark.inc4
7 files changed, 22 insertions, 12 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 2ccad03c6..5da181438 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -2025,8 +2025,9 @@ class rcmail extends rcube
$_uid = $uids ?: rcube_utils::get_input_value('_uid', RCUBE_INPUT_GPC);
$_mbox = $mbox ?: (string)rcube_utils::get_input_value('_mbox', RCUBE_INPUT_GPC);
- if (is_array($uid)) {
- return $uid;
+ // already a hash array
+ if (is_array($_uid) && !isset($_uid[0])) {
+ return $_uid;
}
$result = array();
@@ -2040,8 +2041,11 @@ class rcmail extends rcube
}
}
else {
+ if (is_string($_uid))
+ $_uid = explode(',', $_uid);
+
// create a per-folder UIDs array
- foreach (explode(',', $_uid) as $uid) {
+ foreach ((array)$_uid as $uid) {
list($uid, $mbox) = explode('-', $uid, 2);
if (empty($mbox))
$mbox = $_mbox;
diff --git a/program/js/app.js b/program/js/app.js
index 952c542a0..7f19382e0 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3014,7 +3014,8 @@ function rcube_webmail()
var icn_src, uid, i, len,
rows = this.message_list ? this.message_list.rows : {};
- uids = String(uids).split(',');
+ if (typeof uids == 'string')
+ uids = String(uids).split(',');
for (i=0, len=uids.length; i<len; i++) {
uid = uids[i];
@@ -3027,7 +3028,7 @@ function rcube_webmail()
// with select_all mode checking
this.uids_to_list = function(uids)
{
- return this.select_all_mode ? '*' : uids.join(',');
+ return this.select_all_mode ? '*' : (uids.length <= 1 ? uids.join(',') : uids);
};
// Sets title of the delete button
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index a2f610a0a..5c30327a1 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -1712,7 +1712,7 @@ class rcube_imap extends rcube_storage
}
// decode combined UID-folder identifier
- if (preg_match('/^\d+-[^,]+$/', $uid)) {
+ if (preg_match('/^\d+-.+/', $uid)) {
list($uid, $folder) = explode('-', $uid, 2);
}
@@ -1748,7 +1748,7 @@ class rcube_imap extends rcube_storage
}
// decode combined UID-folder identifier
- if (preg_match('/^\d+-[^,]+$/', $uid)) {
+ if (preg_match('/^\d+-.+/', $uid)) {
list($uid, $folder) = explode('-', $uid, 2);
}
diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php
index edfd339d8..a648ae722 100644
--- a/program/lib/Roundcube/rcube_message.php
+++ b/program/lib/Roundcube/rcube_message.php
@@ -75,7 +75,7 @@ class rcube_message
function __construct($uid, $folder = null)
{
// decode combined UID-folder identifier
- if (preg_match('/^\d+-[^,]+$/', $uid)) {
+ if (preg_match('/^\d+-.+/', $uid)) {
list($uid, $folder) = explode('-', $uid, 2);
}
diff --git a/program/steps/mail/copy.inc b/program/steps/mail/copy.inc
index 79e207aa7..5668f7c4b 100644
--- a/program/steps/mail/copy.inc
+++ b/program/steps/mail/copy.inc
@@ -5,7 +5,7 @@
| program/steps/mail/copy.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2013, The Roundcube Dev Team |
+ | Copyright (C) 2005-2014, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -29,7 +29,10 @@ if (!empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) {
$target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true);
foreach (rcmail::get_uids() as $mbox => $uids) {
- $copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox);
+ if ($mbox == $target)
+ $copied++;
+ else
+ $copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox);
}
if (!$copied) {
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 630086a68..f711da3e1 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -69,7 +69,7 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'])
}
// remove mbox part from _uid
-if (($_uid = get_input_value('_uid', RCUBE_INPUT_GPC)) && preg_match('/^\d+-[^,]+$/', $_uid)) {
+if (($_uid = rcube_utils::get_input_value('_uid', RCUBE_INPUT_GPC)) && !is_array($_uid) && preg_match('/^\d+-.+/', $_uid)) {
list($_uid, $mbox) = explode('-', $_uid, 2);
if (isset($_GET['_uid'])) $_GET['_uid'] = $_uid;
if (isset($_POST['_uid'])) $_POST['_uid'] = $_uid;
diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc
index e81f6c9f5..4e83f975c 100644
--- a/program/steps/mail/mark.inc
+++ b/program/steps/mail/mark.inc
@@ -68,7 +68,9 @@ if (($_uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST))
if ($flag == 'DELETED' && $read_deleted && !empty($_POST['_ruid'])) {
$ruids = rcube_utils::get_input_value('_ruid', rcube_utils::INPUT_POST);
- $read = $RCMAIL->storage->set_flag($ruids, 'SEEN');
+ foreach (rcmail::get_uids($ruids) as $mbox => $uids) {
+ $read += (int)$RCMAIL->storage->set_flag($uids, 'SEEN', $mbox);
+ }
if ($read && !$skip_deleted) {
$OUTPUT->command('flag_deleted_as_read', $ruids);