Make multi-folder message identifiers work with folders containing commas

pull/175/head
Thomas Bruederli 10 years ago
parent 05e3d11554
commit 188247894f

@ -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;

@ -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

@ -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);
}

@ -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);
}

@ -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) {

@ -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;

@ -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);

Loading…
Cancel
Save