From bd0551b22076b82a6d49e9f7a2b2e0c90a1b2326 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 05 Feb 2016 07:25:27 -0500
Subject: [PATCH] Secure also downloads of addressbook exports, managesieve script exports and Enigma keys exports

---
 program/lib/Roundcube/rcube_result_index.php |   28 +++++++---------------------
 1 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/program/lib/Roundcube/rcube_result_index.php b/program/lib/Roundcube/rcube_result_index.php
index 058f25c..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)
     {
@@ -228,7 +222,6 @@
         $this->meta['count'] = count($data);
         $this->raw_data      = implode(self::SEPARATOR_ELEMENT, $data);
     }
-
 
     /**
      * Filters data set. Removes elements not listed in $ids list.
@@ -244,7 +237,6 @@
         $this->meta['count'] = count($data);
         $this->raw_data      = implode(self::SEPARATOR_ELEMENT, $data);
     }
-
 
     /**
      * Reverts order of elements in the result
@@ -264,7 +256,6 @@
 
         $this->meta['pos'] = array();
     }
-
 
     /**
      * Check if the given message ID exists in the object
@@ -305,7 +296,6 @@
         return false;
     }
 
-
     /**
      * Return all messages in the result.
      *
@@ -320,7 +310,6 @@
         return explode(self::SEPARATOR_ELEMENT, $this->raw_data);
     }
 
-
     /**
      * Return all messages in the result.
      *
@@ -334,7 +323,6 @@
 
         return rcube_imap_generic::compressMessageSet($this->get());
     }
-
 
     /**
      * Return result element at specified index
@@ -395,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
@@ -416,7 +403,6 @@
 
         return $params;
     }
-
 
     /**
      * Returns length of internal data representation

--
Gitblit v1.9.1