From 5d682f384cef41e36829c557bb1d59a5b7ebf702 Mon Sep 17 00:00:00 2001 From: thomasb Date: Tue, 9 Nov 2010 21:04:28 +0000 Subject: Little code cleanup: use static getters of rcube_kolab class to get Kolab_Storage objects git-svn-id: https://svn.roundcube.net/trunk@4205 208e9e7b-5314-0410-a742-e7e81cd9613c --- plugins/kolab_addressbook/lib/rcube_kolab.php | 44 ++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'plugins/kolab_addressbook/lib') diff --git a/plugins/kolab_addressbook/lib/rcube_kolab.php b/plugins/kolab_addressbook/lib/rcube_kolab.php index 44c37a68f..985691a51 100644 --- a/plugins/kolab_addressbook/lib/rcube_kolab.php +++ b/plugins/kolab_addressbook/lib/rcube_kolab.php @@ -1,6 +1,5 @@ getByType($type); + } + /** + * Get storage object for read/write access to the Kolab backend + * + * @param string IMAP folder to access + * @param string Object type to deal with (leave empty for auto-detection using annotations) + * @return object Kolab_Data The data storage object + */ + public static function get_storage($folder, $data_type = null) + { + self::setup(); + $kolab = Kolab_List::singleton(); + return $kolab->getFolder($folder)->getData($data_type); + } + + /** + * Cleanup session data when done + */ + public static function shutdown() + { + if (isset($_SESSION['__auth'])) { + // unset auth data from session. no need to store it persistantly + unset($_SESSION['__auth']); + + // FIXME: remove strange numeric entries + foreach ($_SESSION as $key => $val) { + if (!$val && is_numeric($key)) + unset($_SESSION[$key]); + } + } + } } -- cgit v1.2.3