From 7a084ed0d01ab640e1b0abd1b4ff6d797b893b83 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 14 Oct 2009 21:40:17 +1300 Subject: [PATCH] Non-working start on support for a DAV MOVE request. --- inc/caldav-MOVE.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 inc/caldav-MOVE.php diff --git a/inc/caldav-MOVE.php b/inc/caldav-MOVE.php new file mode 100644 index 00000000..7a6d93d9 --- /dev/null +++ b/inc/caldav-MOVE.php @@ -0,0 +1,42 @@ + +* @copyright Morphoss Ltd +* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 +*/ +dbg_error_log("MOVE", "method handler"); + +if ( ! $request->AllowedTo("read") ) { + $request->DoResponse(403); +} + +if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put']) && $c->dbg['put'])) ) { + $fh = fopen('/tmp/MOVE.txt','w'); + if ( $fh ) { + fwrite($fh,$request->raw_post); + fclose($fh); + } +} + +include_once('caldav-PUT-functions.php'); +controlRequestContainer( $request->username, $request->user_no, $request->path, true); + +$lock_opener = $request->FailIfLocked(); + + +if ( $request->IsCollection() ) { + /** + * CalDAV does not define the result of a PUT on a collection. We treat that + * as an import. The code is in caldav-PUT-functions.php + */ + import_collection($request->raw_post,$request->user_no,$request->path,true); + $request->DoResponse( 200 ); + return; +} + +$put_action_type = putCalendarResource( $request, $session->user_no, true ); +$request->DoResponse( ($put_action_type == 'INSERT' ? 201 : 204) );