From d755693944e3e5536812ec23cfe48d62d2a2e779 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 28 May 2010 07:23:30 +0000 Subject: [PATCH] correctly handle $filter[owner] to be an array with multiple owners/addressbooks --- addressbook/inc/class.addressbook_sql.inc.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/addressbook/inc/class.addressbook_sql.inc.php b/addressbook/inc/class.addressbook_sql.inc.php index 3b89043773..65cab23046 100644 --- a/addressbook/inc/class.addressbook_sql.inc.php +++ b/addressbook/inc/class.addressbook_sql.inc.php @@ -264,7 +264,7 @@ class addressbook_sql extends so_sql_cf // we have no private grants in addressbook at the moment, they have then to be added here too if (isset($filter['owner'])) { - if (!$this->grants[(int) $filter['owner']]) return false; // we have no access to that addressbook + if (!($filter['owner'] = array_intersect((array)$filter['owner'],array_keys($this->grants)))) return false; $filter['private'] = 0; } @@ -309,16 +309,6 @@ class addressbook_sql extends so_sql_cf } break; } - if (isset($filter['owner'])) - { - $filter[] = $this->table_name.'.contact_owner='.(int)$filter['owner']; - unset($filter['owner']); - } - if (is_array($criteria) && isset($criteria['owner'])) - { - $criteria[] = $this->table_name.'.contact_owner='.(int)$criteria['owner']; - unset($criteria['owner']); - } // postgres requires that expressions in order by appear in the columns of a distinct select if ($this->db->Type != 'mysql' && preg_match("/([a-zA-Z_.]+)<>''/",$order_by,$matches)) {