From a3644638aaf0418598196a870204e0b632a4c8ad Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 17 Apr 2015 06:28:40 -0400
Subject: [PATCH] Allow preference sections to define CSS class names

---
 plugins/redundant_attachments/redundant_attachments.php |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/plugins/redundant_attachments/redundant_attachments.php b/plugins/redundant_attachments/redundant_attachments.php
index 3c71dcb..91a0275 100644
--- a/plugins/redundant_attachments/redundant_attachments.php
+++ b/plugins/redundant_attachments/redundant_attachments.php
@@ -31,7 +31,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-require_once(INSTALL_PATH . 'plugins/filesystem_attachments/filesystem_attachments.php');
+require_once(RCUBE_PLUGINS_DIR . 'filesystem_attachments/filesystem_attachments.php');
 
 class redundant_attachments extends filesystem_attachments
 {
@@ -68,13 +68,14 @@
         // load configuration
         $this->load_config();
 
+        $ttl = 12 * 60 * 60; // 12 hours
+        $ttl = $rcmail->config->get('redundant_attachments_cache_ttl', $ttl);
+
         // Init SQL cache (disable cache data serialization)
-        $this->cache = $rcmail->get_cache($this->prefix, 'db', 0, false);
+        $this->cache = $rcmail->get_cache($this->prefix, 'db', $ttl, false);
 
         // Init memcache (fallback) cache
         if ($rcmail->config->get('redundant_attachments_memcache')) {
-            $ttl = 12 * 60 * 60; // 12 hours
-            $ttl = (int) $rcmail->config->get('redundant_attachments_memcache_ttl', $ttl);
             $this->mem_cache = $rcmail->get_cache($this->prefix, 'memcache', $ttl, false);
         }
 
@@ -125,11 +126,12 @@
 
         $this->_load_drivers();
 
-        if ($args['path'])
-          $args['data'] = file_get_contents($args['path']);
+        $data = $args['path'] ? file_get_contents($args['path']) : $args['data'];
+
+        unset($args['data']);
 
         $key  = $this->_key($args);
-        $data = base64_encode($args['data']);
+        $data = base64_encode($data);
 
         $status = $this->cache->write($key, $data);
 

--
Gitblit v1.9.1