/** * @brief deletes an object with the data provided by \Sabredav * @param integer $cid calendar id * @param string $uri the uri of the object * @return boolean */ public static function deleteFromDAVData($cid, $uri) { $oldobject = self::findWhereDAVDataIs($cid, $uri); $calendar = Calendar::find($cid); if ($calendar['userid'] != \OCP\User::getUser()) { $sharedCalendar = \OCP\Share::getItemSharedWithBySource(App::SHARECALENDAR, App::SHARECALENDARPREFIX . $cid); if (!$sharedCalendar || !($sharedCalendar['permissions'] & \OCP\PERMISSION_DELETE)) { throw new VObject_DAV_Exception_Forbidden(App::$l10n->t('You do not have the permissions to delete this event.')); } } $stmt = \OCP\DB::prepare('DELETE FROM `' . App::CldObjectTable . '` WHERE `calendarid`= ? AND `uri`=?'); $stmt->execute(array($cid, $uri)); Calendar::touchCalendar($cid); \OCP\Util::emitHook('\\OCA\\CalendarPlus', 'deleteEvent', $oldobject['id']); $params = array('mode' => 'deleted', 'link' => '', 'trans_type' => App::$l10n->t($oldobject['objecttype']), 'summary' => $oldobject['summary'], 'cal_user' => $calendar['userid'], 'cal_displayname' => $calendar['displayname']); ActivityData::logEventActivity($params, true); return true; }