IntVal($obj["data_uri"]), "calendardata" => $obj["calendardata"], "uri" => $obj["data_uri"], "lastmodified" => $obj["date"], "calendarid" => $calendarId, "etag" => $obj["etag"], "size" => IntVal($obj["size"]), ); } return $ret; } /** * Returns information from a single calendar object, based on it's object * uri. * * The returned array must have the same keys as getCalendarObjects. The * 'calendardata' object is required here though, while it's not required * for getCalendarObjects. * * @param string $calendarId * @param string $objectUri * @throws Sabre_DAV_Exception_NotFound * @return array */ public function getCalendarObject($calendarId, $objectUri) { $calendarId = IntVal($calendarId); $r = q("SELECT COUNT(*) n FROM %s%scal_virtual_object_sync WHERE `calendar_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendarId)); if ($r[0]["n"] == 0) static::createCache($calendarId); $r = q("SELECT * FROM %s%scal_virtual_object_cache WHERE `data_uri` = '%s' AND `calendar_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, dbesc($objectUri), IntVal($calendarId)); if (count($r) == 0) throw new Sabre_DAV_Exception_NotFound(); $obj = $r[0]; $ret = array( "id" => IntVal($obj["data_uri"]), "calendardata" => $obj["calendardata"], "uri" => $obj["data_uri"], "lastmodified" => $obj["date"], "calendarid" => $calendarId, "etag" => $obj["etag"], "size" => IntVal($obj["size"]), ); return $ret; } /** * Creates a new calendar for a principal. * * If the creation was a success, an id must be returned that can be used to reference * this calendar in other methods, such as updateCalendar. * * @param string $principalUri * @param string $calendarUri * @param array $properties * @throws Sabre_DAV_Exception_Forbidden * @return void */ public function createCalendar($principalUri, $calendarUri, array $properties) { throw new Sabre_DAV_Exception_Forbidden(); } /** * Delete a calendar and all it's objects * * @param string $calendarId * @throws Sabre_DAV_Exception_Forbidden * @return void */ public function deleteCalendar($calendarId) { throw new Sabre_DAV_Exception_Forbidden(); } /** * Creates a new calendar object. * * @param string $calendarId * @param string $objectUri * @param string $calendarData * @throws Sabre_DAV_Exception_Forbidden * @return null|string|void */ function createCalendarObject($calendarId, $objectUri, $calendarData) { throw new Sabre_DAV_Exception_Forbidden(); } /** * Updates an existing calendarobject, based on it's uri. * * @param string $calendarId * @param string $objectUri * @param string $calendarData * @throws Sabre_DAV_Exception_Forbidden * @return null|string|void */ function updateCalendarObject($calendarId, $objectUri, $calendarData) { throw new Sabre_DAV_Exception_Forbidden(); } /** * Deletes an existing calendar object. * * @param string $calendarId * @param string $objectUri * @throws Sabre_DAV_Exception_Forbidden * @return void */ function deleteCalendarObject($calendarId, $objectUri) { throw new Sabre_DAV_Exception_Forbidden(); } }