From 28b6872b566da870865f5f6cda087967acc98559 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 4 Aug 2014 06:40:32 -0400 Subject: [PATCH] Fix missing parent folder in folder selector if the folder does not exist or is not accessible (#3237) --- plugins/libkolab/lib/kolab_storage.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/libkolab/lib/kolab_storage.php b/plugins/libkolab/lib/kolab_storage.php index d2412afb..7bae562a 100644 --- a/plugins/libkolab/lib/kolab_storage.php +++ b/plugins/libkolab/lib/kolab_storage.php @@ -672,8 +672,17 @@ class kolab_storage $name = $c_folder->name; // skip current folder and it's subfolders - if ($len && ($name == $current || strpos($name, $current.$delim) === 0)) { - continue; + if ($len) { + if ($name == $current) { + // Make sure parent folder is listed (might be skipped e.g. if it's namespace root) + if ($p_len && !isset($names[$parent])) { + $names[$parent] = self::object_name($parent); + } + continue; + } + if (strpos($name, $current.$delim) === 0) { + continue; + } } // always show the parent of current folder @@ -687,11 +696,6 @@ class kolab_storage } } - // Make sure parent folder is listed (might be skipped e.g. if it's namespace root) - if ($p_len && !isset($names[$parent]) && strpos($name, $parent.$delim) === 0) { - $names[$parent] = self::object_name($parent); - } - $names[$name] = self::object_name($name); }