From 3f74eeb4e0849826560e50783fcd8d8bb361d073 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 21 Jul 2014 09:54:46 +0200 Subject: [PATCH] List all unsubscribed with magic search term '*' --- plugins/libkolab/js/folderlist.js | 2 +- plugins/libkolab/lib/kolab_storage.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/libkolab/js/folderlist.js b/plugins/libkolab/js/folderlist.js index df522f6b..77105705 100644 --- a/plugins/libkolab/js/folderlist.js +++ b/plugins/libkolab/js/folderlist.js @@ -200,7 +200,7 @@ function kolab_folderlist(node, p) // send search request(s) to server if (search.query && search.execute) { // require a minimum length for the search string - if (rcmail.env.autocomplete_min_length && search.query.length < rcmail.env.autocomplete_min_length) { + if (rcmail.env.autocomplete_min_length && search.query.length < rcmail.env.autocomplete_min_length && search.query != '*') { search_messagebox = rcmail.display_message( rcmail.get_label('autocompletechars').replace('$min', rcmail.env.autocomplete_min_length)); return; diff --git a/plugins/libkolab/lib/kolab_storage.php b/plugins/libkolab/lib/kolab_storage.php index 0897428c..d2412afb 100644 --- a/plugins/libkolab/lib/kolab_storage.php +++ b/plugins/libkolab/lib/kolab_storage.php @@ -874,12 +874,13 @@ class kolab_storage } $folders = array(); + $query = str_replace('*', '', $query); // find unsubscribed IMAP folders of the given type foreach ((array)self::list_folders('', '*', $type, false, $folderdata) as $foldername) { // FIXME: only consider the last part of the folder path for searching? $realname = strtolower(rcube_charset::convert($foldername, 'UTF7-IMAP')); - if (strpos($realname, $query) !== false && + if (($query == '' || strpos($realname, $query) !== false) && !self::folder_is_subscribed($foldername, true) && !in_array(self::$imap->folder_namespace($foldername), (array)$exclude_ns) ) { @@ -1423,8 +1424,10 @@ class kolab_storage */ public static function search_users($query, $mode = 1, $required = array(), $limit = 0, &$count = 0) { + $query = str_replace('*', '', $query); + // requires a working LDAP setup - if (!self::ldap()) { + if (!self::ldap() || strlen($query) == 0) { return array(); }