Thomas Bruederli
2014-04-08 188247894f6aff3a11f68bbdf94626b8bf58b852
Make multi-folder message identifiers work with folders containing commas
7 files modified
30 ■■■■■ changed files
program/include/rcmail.php 10 ●●●● patch | view | raw | blame | history
program/js/app.js 3 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_imap.php 4 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_message.php 2 ●●● patch | view | raw | blame | history
program/steps/mail/copy.inc 5 ●●●● patch | view | raw | blame | history
program/steps/mail/func.inc 2 ●●● patch | view | raw | blame | history
program/steps/mail/mark.inc 4 ●●● patch | view | raw | blame | history
program/include/rcmail.php
@@ -2025,8 +2025,9 @@
        $_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 @@
            }
        }
        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;
program/js/app.js
@@ -3014,6 +3014,7 @@
    var icn_src, uid, i, len,
      rows = this.message_list ? this.message_list.rows : {};
    if (typeof uids == 'string')
    uids = String(uids).split(',');
    for (i=0, len=uids.length; i<len; i++) {
@@ -3027,7 +3028,7 @@
  // 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
program/lib/Roundcube/rcube_imap.php
@@ -1712,7 +1712,7 @@
        }
        // 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 @@
        }
        // decode combined UID-folder identifier
        if (preg_match('/^\d+-[^,]+$/', $uid)) {
        if (preg_match('/^\d+-.+/', $uid)) {
            list($uid, $folder) = explode('-', $uid, 2);
        }
program/lib/Roundcube/rcube_message.php
@@ -75,7 +75,7 @@
    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);
        }
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,6 +29,9 @@
    $target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true);
    foreach (rcmail::get_uids() as $mbox => $uids) {
        if ($mbox == $target)
            $copied++;
        else
      $copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox);
    }
program/steps/mail/func.inc
@@ -69,7 +69,7 @@
}
// 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;
program/steps/mail/mark.inc
@@ -68,7 +68,9 @@
    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);