From 5220740c17a0d7a10e8cc82c93391d67b18fb77a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 11 Oct 2006 18:52:39 +0000 Subject: [PATCH] prevent SQL error in search method, if $params['users'] = array('') or array(null) --- calendar/inc/class.bocal.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.bocal.inc.php b/calendar/inc/class.bocal.inc.php index dd813f8f6f..a6ddf57dde 100644 --- a/calendar/inc/class.bocal.inc.php +++ b/calendar/inc/class.bocal.inc.php @@ -254,14 +254,15 @@ class bocal { $params_in = $params; - if (!isset($params['users']) || !$params['users']) + if (!isset($params['users']) || !$params['users'] || + count($params['users']) == 1 && isset($params['users'][0]) && !$params['users'][0]) // null or '' casted to an array { // for a search use all account you have read grants from $params['users'] = $params['query'] ? array_keys($this->grants) : $this->user; } if (!is_array($params['users'])) { - $params['users'] = array($params['users']); + $params['users'] = $params['users'] ? array($params['users']) : array(); } // only query calendars of users, we have READ-grants from $users = array(); @@ -269,7 +270,7 @@ class bocal { if ($params['ignore_acl'] || $this->check_perms(EGW_ACL_READ,0,$user)) { - if (!in_array($user,$users)) // already added? + if ($user && !in_array($user,$users)) // already added? { $users[] = $user; }