mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-04-28 15:40:14 +00:00
For what it's worth, we can now try and make DAVE collections.
This commit is contained in:
parent
0ed02b6c2e
commit
487c53d838
30
inc/caldav-MKCOL.php
Normal file
30
inc/caldav-MKCOL.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
dbg_error_log("MKCOL", "method handler");
|
||||
|
||||
dbg_log_array( "MKCOL", 'HEADERS', $raw_headers );
|
||||
dbg_log_array( "MKCOL", '_SERVER', $_SERVER, true );
|
||||
dbg_error_log( "MKCOL", "RAW: %s", str_replace("\n", "",str_replace("\r", "", $raw_post)) );
|
||||
|
||||
$make_path = $_SERVER['PATH_INFO'];
|
||||
|
||||
$displayname = $make_path;
|
||||
$parent_container = '/';
|
||||
if ( preg_match( '#^(.*/)([^/]+)(/)?$#', $make_path, $matches ) ) {
|
||||
$parent_container = $matches[1];
|
||||
$displayname = $matches[2];
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO collection ( user_no, parent_container, dav_name, dav_etag, dav_displayname, is_calendar, created, modified ) VALUES( ?, ?, ?, ?, ?, FALSE, current_timestamp, current_timestamp );";
|
||||
$qry = new PgQuery( $sql, $session->user_no, $parent_container, $make_path, md5($session->user_no. $make_path), $displayname );
|
||||
|
||||
if ( $qry->Exec("MKCOL",__LINE__,__FILE__) ) {
|
||||
header("HTTP/1.1 200 Created");
|
||||
dbg_error_log( "MKCOL", "New collection '%s' created named '%s' for user '%d' in parent '%s'", $make_path, $displayname, $session->user_no, $parent_container);
|
||||
}
|
||||
else {
|
||||
header("HTTP/1.1 500 Infernal Server Error");
|
||||
dbg_error_log( "ERROR", " MKCOL Failed for '%s' named '%s', user '%d' in parent '%s'", $make_path, $displayname, $session->user_no, $parent_container);
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user