Update of /cvsroot/phpicalendar/phpicalendar
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22568
Modified Files:
caldav.php
Log Message:
* Almost working preliminary REPORT support
* ReportParser successfully parses calendar-data request values
* _componentParser almost parses iCalendar files & limits by calendar-data request value
* TODO Determine whether _componentParser is rejecting valid iCalendar files
* TODO Reduce duplicate code by factoring special property handling out of propfind_response_helper
* TODO Push filtering parser into bennu?
Index: caldav.php
===================================================================
RCS file: /cvsroot/phpicalendar/phpicalendar/caldav.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** caldav.php 9 Apr 2006 18:19:45 -0000 1.1
--- caldav.php 13 Apr 2006 05:10:24 -0000 1.2
***************
*** 8,11 ****
--- 8,17 ----
require_once(BASE . 'lib/HTTP/CalDAV/Server.php');
+ require_once(BASE . 'lib/bennu/bennu.class.php');
+ require_once(BASE . 'lib/bennu/iCalendar_components.php');
+ require_once(BASE . 'lib/bennu/iCalendar_parameters.php');
+ require_once(BASE . 'lib/bennu/iCalendar_properties.php');
+ require_once(BASE . 'lib/bennu/iCalendar_rfc2445.php');
+
class HTTP_CalDAV_Server_PHPiCalendar extends HTTP_CalDAV_Server {
function getBasePath() {
***************
*** 82,86 ****
if (is_file($absolutePath)) {
! $options['mimetype'] = 'text/calendar';
$stat = stat($absolutePath);
--- 88,92 ----
if (is_file($absolutePath)) {
! $options['mimetype'] = mime_content_type($absolutePath);
$stat = stat($absolutePath);
***************
*** 170,174 ****
while (($pathComponent = readdir($handle)) !== false) {
if ($pathComponent != '.' && $pathComponent != '..') {
! $paths[] = "$path/$pathComponent";
}
}
--- 176,181 ----
while (($pathComponent = readdir($handle)) !== false) {
if ($pathComponent != '.' && $pathComponent != '..') {
! $paths[] = $path != '' ? "$path/$pathComponent" :
! $pathComponent;
}
}
***************
*** 203,225 ****
}
! 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;
}
--- 210,251 ----
}
! function report($options, &$files) {
! $files = array();
! $paths = array();
! $path = $options['path'];
! while (isset($path)) {
! $file = array();
! $file['path'] = $path;
! $absolutePath = HTTP_CalDAV_Server_PHPiCalendar::getBasePath() .
! '/' . $path;
! $stat = stat($absolutePath);
! $file['props'] = array();
! $file['props'][] = $this->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 != '' ? "$path/$pathComponent" :
! $pathComponent;
! }
! }
! closedir($handle);
! } else {
! $file['props'][] = $this->mkprop('getcontentlength',
! $stat['size']);
! $file['props'][] = $this->mkprop('resourcetype', null);
! }
! $files[] = $file;
! $path = array_pop($paths);
}
|