From 8eda2df71ea22d802d27b766228f8c52fbc50bc4 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 25 Oct 2012 15:20:33 +0200 Subject: [PATCH] Simplified default folder selection - now when private/shared annotation is properly handled (.default is removed from shared) by kolab_storage functions --- plugins/kolab_folders/kolab_folders.php | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/plugins/kolab_folders/kolab_folders.php b/plugins/kolab_folders/kolab_folders.php index 308d6d3b..28d78bf5 100644 --- a/plugins/kolab_folders/kolab_folders.php +++ b/plugins/kolab_folders/kolab_folders.php @@ -369,30 +369,11 @@ class kolab_folders extends rcube_plugin return null; } - $type .= '.default'; - $namespace = $storage->get_namespace(); - // get all folders of specified type $folderdata = array_map(array('kolab_storage', 'folder_select_metadata'), $folderdata); - $folderdata = array_intersect($folderdata, array($type)); + $folderdata = array_intersect($folderdata, array($type.'.default')); - foreach ($folderdata as $folder => $data) { - // check if folder is in personal namespace - foreach (array('shared', 'other') as $nskey) { - if (!empty($namespace[$nskey])) { - foreach ($namespace[$nskey] as $ns) { - if ($ns[0] && substr($folder, 0, strlen($ns[0])) == $ns[0]) { - continue 3; - } - } - } - } - - // There can be only one default folder of specified type - return $folder; - } - - return null; + return key($folderdata); } /**