[3733] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * CalDAV Server - main program |
---|
| 4 | * |
---|
| 5 | * @package davical |
---|
| 6 | * @subpackage caldav |
---|
| 7 | * @author Andrew McMillan <andrew@catalyst.net.nz> |
---|
| 8 | * @copyright Catalyst .Net Ltd |
---|
| 9 | * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 |
---|
| 10 | */ |
---|
| 11 | require("./always.php"); |
---|
| 12 | dbg_error_log( "caldav", " User agent: %s", ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Unfortunately Mulberry does not send a 'User-agent' header with its requests :-(")) ); |
---|
| 13 | dbg_log_array( "headers", '_SERVER', $_SERVER, true ); |
---|
| 14 | require("PublicSession.php"); |
---|
| 15 | $session = new PublicSession(); |
---|
| 16 | |
---|
| 17 | /** A simplified DAV header in this case */ |
---|
| 18 | $dav = "1, 2, calendar-access"; |
---|
| 19 | header( "DAV: $dav"); |
---|
| 20 | |
---|
| 21 | require_once("CalDAVRequest.php"); |
---|
| 22 | $request = new CalDAVRequest(); |
---|
| 23 | if ( !isset($request->ticket) && !$request->IsPublic() ) { |
---|
| 24 | $request->DoResponse( 403, translate('Anonymous users may only access public calendars') ); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | switch ( $request->method ) { |
---|
| 28 | case 'OPTIONS': include_once("caldav-OPTIONS.php"); break; |
---|
| 29 | case 'REPORT': include_once("caldav-REPORT.php"); break; |
---|
| 30 | case 'PROPFIND': include_once("caldav-PROPFIND.php"); break; |
---|
| 31 | case 'GET': include_once("caldav-GET.php"); break; |
---|
| 32 | case 'HEAD': include_once("caldav-GET.php"); break; |
---|
| 33 | |
---|
| 34 | case 'PROPPATCH': |
---|
| 35 | case 'MKCALENDAR': |
---|
| 36 | case 'MKCOL': |
---|
| 37 | case 'PUT': |
---|
| 38 | case 'DELETE': |
---|
| 39 | case 'LOCK': |
---|
| 40 | case 'UNLOCK': |
---|
| 41 | $request->DoResponse( 403, translate('Anonymous users are not allowed to modify calendars') ); |
---|
| 42 | break; |
---|
| 43 | |
---|
| 44 | case 'TESTRRULE': include_once("test-RRULE.php"); break; |
---|
| 45 | |
---|
| 46 | default: |
---|
| 47 | dbg_error_log( "caldav", "Unhandled request method >>%s<<", $request->method ); |
---|
| 48 | dbg_log_array( "caldav", '_SERVER', $_SERVER, true ); |
---|
| 49 | dbg_error_log( "caldav", "RAW: %s", str_replace("\n", "",str_replace("\r", "", $request->raw_post)) ); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | $request->DoResponse( 500, translate("The application program does not understand that request.") ); |
---|
| 53 | |
---|