/** * Delete a message from the CalDAV server. * @see BackendDiff::DeleteMessage() */ public function DeleteMessage($folderid, $id, $contentParameters) { ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendCalDAV->DeleteMessage('%s','%s')", $folderid, $id)); $url = $this->_caldav_path . substr($folderid, 1) . "/" . $id; $http_status_code = $this->_caldav->DoDELETERequest($url); if ($http_status_code == "204") { return true; } return false; }
static function rmcalendar($data, $params = false) { ob_start(); require_once ROOTPATH . '/plugins/davicalCliente/caldav-client-v2.php'; $cal = new CalDAVClient(Config::service('CalDAV', 'url') . '/', Config::me('uid'), Config::me('password')); $cal->DoDELETERequest(Config::service('CalDAV', 'url') . '/' . Config::me('uid') . '/' . $data . '/'); ob_end_clean(); }
/** * Deletes one VCALENDAR * * @access public * @param $id string ID of the VCALENDAR * @return boolean */ public function DeleteCalendar($id) { $http_status_code = $this->_caldav->DoDELETERequest(sprintf("%s%s/%s", $this->_caldav_path, CALDAV_PERSONAL, $id)); return $http_status_code == "204"; }
simple_write_resource($local_fname, $event, isset($insert_urls[$href]) ? 'INSERT' : 'UPDATE'); $newcache->local_etags[$fname] = md5($event); } $qry = new AwlQuery('SELECT collection_id, dav_displayname AS displayname, dav_etag AS getctag FROM collection WHERE dav_name = :collection_dav_name', array(':collection_dav_name' => $args->local_collection_path)); if ($qry->Exec('sync-pull', __LINE__, __FILE__) && $qry->rows() > 0) { $local_calendar = $qry->Fetch(); if (isset($local_calendar->getctag)) { $newcache->local_ctag = $local_calendar->getctag; } } } if ($sync_out) { printf("Sync out\n"); // Delete any remote events which have been removed from the local server foreach ($server_delete_urls as $href => $etag) { $caldav->DoDELETERequest($args->url . $href, $etag); printf("\nDELETE Response:\n%s\n", $caldav->GetResponseHeaders()); unset($newcache->server_etags[$fname]); } // Push locally updated events to the remote server foreach ($push_urls as $href => $etag) { $new_etag = $caldav->DoPUTRequest($args->url . $href, $push_events[$href], $etag); printf("\nPUT:\n%s\nResponse:\n%s\n", $caldav->GetHttpRequest(), $caldav->GetResponseHeaders()); if (!isset($new_etag) || $new_etag == '') { if (preg_match('{^Location:\\s+.*/([^/]+)$}im', $caldav->GetResponseHeaders(), $matches)) { /** How annoying. It seems the other server renamed the event on PUT so we move the local copy to match their name */ $new_href = preg_replace('{\\r?\\n.*$}s', '', $matches[1]); $qry = new AwlQuery('UPDATE caldav_data SET dav_name = :new_dav_name WHERE dav_name = :old_dav_name', array(':new_dav_name' => $args->local_collection_path . $new_href, ':old_dav_name' => $args->local_collection_path . $href)); $qry->Exec('sync_pull', __LINE__, __FILE__); $new_cache->local_etags[$new_href] = $new_cache->local_etags[$href]; unset($new_cache->local_etags[$href]);