mkprop('creationdate', $stat['ctime']); $file['props'][] = $this->mkprop('getlastmodified', $stat['mtime']); if (is_dir($absolutePath)) { $file['props'][] = $this->mkprop('resourcetype', 'collection'); $handle = opendir($absolutePath); if (!$handle) { return; } while (($pathComponent = readdir($handle)) !== false) { if ($pathComponent != '.' && $pathComponent != '..') { $paths[] = "$path/$pathComponent"; } } closedir($handle); } else { $file['props'][] = $this->mkprop('getcontentlength', $stat['size']); $file['props'][] = $this->mkprop('resourcetype', null); } $files[] = $file; $path = array_pop($paths); } return true; } function put(&$options) { $absolutePath = HTTP_CalDAV_Server_PHPiCalendar::getBasePath() . '/' . $options['path']; if (!is_dir(dirname($absolutePath))) { return '409 Conflict'; } $options['new'] = !file_exists($absolutePath); $handle = @fopen($absolutePath, 'w'); if (!$handle) { return '403 Forbidden'; } return $handle; } function report($options, &$responses) { global $ALL_CALENDARS_COMBINED; $responses = array(); $paths = availableCalendars(null, null, $ALL_CALENDARS_COMBINED); foreach ($paths as $path) { $response = array(); $response['ns_hash'] = array(); $response['ns_hash']['urn:ietf:params:xml:ns:caldav'] = 'C'; $response['href'] = $this->getHref(array_pop(explode('/', $path))); $response['propstat'] = array(); $props = array(); $props[] = $this->mkprop('urn:ietf:params:xml:ns:caldav', 'calendar-data', file_get_contents($path)); $response['propstat']['200 OK'] = $props; $responses[] = $response; } return true; } } $server = new HTTP_CalDAV_Server_PHPiCalendar(); $server->ServeRequest(); ?>