From ed1d212ae2daea5e4bd043417610177093e99f19 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Sat, 16 Jan 2016 03:03:51 -0500 Subject: [PATCH] Improved SVG cleanup code --- program/lib/Roundcube/rcube_result_index.php | 47 +++++++++-------------------------------------- 1 files changed, 9 insertions(+), 38 deletions(-) diff --git a/program/lib/Roundcube/rcube_result_index.php b/program/lib/Roundcube/rcube_result_index.php index 5f592c5..5ea390b 100644 --- a/program/lib/Roundcube/rcube_result_index.php +++ b/program/lib/Roundcube/rcube_result_index.php @@ -1,6 +1,6 @@ <?php -/* +/** +-----------------------------------------------------------------------+ | This file is part of the Roundcube Webmail client | | Copyright (C) 2005-2011, The Roundcube Dev Team | @@ -26,11 +26,13 @@ */ class rcube_result_index { + public $incomplete = false; + protected $raw_data; protected $mailbox; - protected $meta = array(); + protected $meta = array(); protected $params = array(); - protected $order = 'ASC'; + protected $order = 'ASC'; const SEPARATOR_ELEMENT = ' '; @@ -38,12 +40,12 @@ /** * Object constructor. */ - public function __construct($mailbox = null, $data = null) + public function __construct($mailbox = null, $data = null, $order = null) { $this->mailbox = $mailbox; + $this->order = $order == 'DESC' ? 'DESC' : 'ASC'; $this->init($data); } - /** * Initializes object with SORT command response @@ -125,7 +127,6 @@ $this->raw_data = $data; } - /** * Checks the result from IMAP command * @@ -136,7 +137,6 @@ return $this->raw_data === null ? true : false; } - /** * Checks if the result is empty * @@ -146,7 +146,6 @@ { return empty($this->raw_data) ? true : false; } - /** * Returns number of elements in the result @@ -169,7 +168,6 @@ return $this->meta['count']; } - /** * Returns number of elements in the result. * Alias for count() for compatibility with rcube_result_thread @@ -180,7 +178,6 @@ { return $this->count(); } - /** * Returns maximal message identifier in the result @@ -196,7 +193,6 @@ return $this->meta['max']; } - /** * Returns minimal message identifier in the result * @@ -211,13 +207,11 @@ return $this->meta['min']; } - /** * Slices data set. * * @param $offset Offset (as for PHP's array_slice()) * @param $length Number of elements (as for PHP's array_slice()) - * */ public function slice($offset, $length) { @@ -229,29 +223,12 @@ $this->raw_data = implode(self::SEPARATOR_ELEMENT, $data); } - /** - * Filters data set. Removes elements listed in $ids list. + * Filters data set. Removes elements not listed in $ids list. * * @param array $ids List of IDs to remove. */ public function filter($ids = array()) - { - $data = $this->get(); - $data = array_diff($data, $ids); - - $this->meta = array(); - $this->meta['count'] = count($data); - $this->raw_data = implode(self::SEPARATOR_ELEMENT, $data); - } - - - /** - * Filters data set. Removes elements not listed in $ids list. - * - * @param array $ids List of IDs to keep. - */ - public function intersect($ids = array()) { $data = $this->get(); $data = array_intersect($data, $ids); @@ -260,7 +237,6 @@ $this->meta['count'] = count($data); $this->raw_data = implode(self::SEPARATOR_ELEMENT, $data); } - /** * Reverts order of elements in the result @@ -280,7 +256,6 @@ $this->meta['pos'] = array(); } - /** * Check if the given message ID exists in the object @@ -321,7 +296,6 @@ return false; } - /** * Return all messages in the result. * @@ -332,9 +306,9 @@ if (empty($this->raw_data)) { return array(); } + return explode(self::SEPARATOR_ELEMENT, $this->raw_data); } - /** * Return all messages in the result. @@ -349,7 +323,6 @@ return rcube_imap_generic::compressMessageSet($this->get()); } - /** * Return result element at specified index @@ -410,7 +383,6 @@ return $data[$index]; } - /** * Returns response parameters, e.g. ESEARCH's MIN/MAX/COUNT/ALL/MODSEQ * or internal data e.g. MAILBOX, ORDER @@ -431,7 +403,6 @@ return $params; } - /** * Returns length of internal data representation -- Gitblit v1.9.1