/**
  * Deletes an existing calendar object.
  *
  * @param string $calendarId
  * @param string $objectUri
  * @return void
  */
 function deleteCalendarObject($calendarId, $objectUri)
 {
     $x = explode("-", $calendarId);
     q("DELETE FROM %s%scalendarobjects WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($x[0]), IntVal($x[1]), dbesc($objectUri));
     $this->increaseCalendarCtag($x[0], $x[1]);
     renderCalDavEntry_uri($objectUri);
 }
 /**
  * Updates an existing calendarobject, based on it's uri.
  *
  * It is possible return an etag from this function, which will be used in
  * the response to this PUT request. Note that the ETag must be surrounded
  * by double-quotes.
  *
  * However, you should only really return this ETag if you don't mangle the
  * calendar-data. If the result of a subsequent GET to this object is not
  * the exact same as this request body, you should omit the ETag.
  *
  * @param mixed $calendarId
  * @param string $objectUri
  * @param string $calendarData
  * @return string|null
  */
 function updateCalendarObject($calendarId, $objectUri, $calendarData)
 {
     $calendarData = icalendar_sanitize_string($calendarData);
     $extraData = $this->getDenormalizedData($calendarData);
     q("UPDATE %s%scalendarobjects SET `calendardata` = '%s', `lastmodified` = NOW(), `etag` = '%s', `size` = %d, `componentType` = '%s', `firstOccurence` = '%s', `lastOccurence` = '%s'\n\t\t\tWHERE `calendar_id` = %d AND `uri` = '%s'", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, dbesc($calendarData), dbesc($extraData["etag"]), IntVal($extraData["size"]), dbesc($extraData["componentType"]), dbesc(wdcal_php2MySqlTime($extraData["firstOccurence"])), dbesc(wdcal_php2MySqlTime($extraData["lastOccurence"])), IntVal($calendarId), dbesc($objectUri));
     $this->increaseCalendarCtag($calendarId);
     renderCalDavEntry_uri($objectUri);
     return '"' . $extraData['etag'] . '"';
 }