Thomas Bruederli
2013-10-21 f06aa8058b7e32ba32d4551074b6e0b8a300f751
program/include/rcube_result_thread.php
@@ -478,16 +478,18 @@
            $items = explode(self::SEPARATOR_ITEM, $elem);
            $root  = (int) array_shift($items);
            $result[$elem] = $elem;
            foreach ($items as $item) {
                list($lv, $id) = explode(self::SEPARATOR_LEVEL, $item);
            if ($root) {
                $result[$root] = $root;
                foreach ($items as $item) {
                    list($lv, $id) = explode(self::SEPARATOR_LEVEL, $item);
                    $result[$id] = $root;
                }
            }
        }
        // get only unique roots
        $result = array_filter($result); // make sure there are no nulls
        $result = array_unique($result, SORT_NUMERIC);
        $result = array_unique($result);
        // Re-sort raw data
        $result = array_fill_keys($result, null);