From 8679aa2699b5dbdf9c392cc64f511c3d3990be32 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 10 Aug 2012 14:33:20 +0200 Subject: [PATCH] Contacts: Check format parameter --- lib/share/addressbook.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/share/addressbook.php b/lib/share/addressbook.php index d90700d7..62799696 100644 --- a/lib/share/addressbook.php +++ b/lib/share/addressbook.php @@ -68,11 +68,13 @@ class OC_Share_Backend_Addressbook implements OCP\Share_Backend_Collection { */ public function formatItems($items, $format, $parameters = null) { $addressbooks = array(); - foreach ($items as $item) { - $addressbook = OC_Contacts_Addressbook::find($item['item_source']); - if ($addressbook) { - $addressbook['displayname'] = $item['item_target']; - $addressbooks[] = $addressbook; + if ($format == self::FORMAT_ADDRESSBOOKS) { + foreach ($items as $item) { + $addressbook = OC_Contacts_Addressbook::find($item['item_source']); + if ($addressbook) { + $addressbook['displayname'] = $item['item_target']; + $addressbooks[] = $addressbook; + } } } return $addressbooks; @@ -88,4 +90,4 @@ class OC_Share_Backend_Addressbook implements OCP\Share_Backend_Collection { return $sources; } -} \ No newline at end of file +}