diff options
Diffstat (limited to 'apps/calendar/lib/share.php')
-rw-r--r-- | apps/calendar/lib/share.php | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php index 4fe88171403..e5ffc04143a 100644 --- a/apps/calendar/lib/share.php +++ b/apps/calendar/lib/share.php @@ -18,19 +18,16 @@ class OC_Calendar_Share{ * @return: array $return - information about calendars */ public static function allSharedwithuser($userid, $type, $active=null, $permission=null){ - $group_where = self::group_sql(OC_Group::getUserGroups($userid)); - $permission_where = self::permission_sql($permission); - if($type == self::CALENDAR){ - $active_where = self::active_sql($active); - }else{ - $active_where = ''; - } - $stmt = OCP\DB::prepare("SELECT * FROM *PREFIX*calendar_share_" . $type . " WHERE ((share = ? AND sharetype = 'user') " . $group_where . ") AND owner <> ? " . $permission_where . " " . $active_where); - $result = $stmt->execute(array($userid, $userid)); - $return = array(); - while( $row = $result->fetchRow()){ - $return[] = $row; + $format = OC_Share_Backend_Calendar::FORMAT_CALENDAR; + if ($type == self::EVENT) { + $format = OC_Share_Backend_Event::FORMAT_EVENT; } + $return = OCP\Share::getItemsSharedWith($type, + $format, + array( + 'active' => $active, + 'permissions' => $permission, + )); return $return; } /** |