Another small fix for BIT24 casting for the LDAP driver...
[davical.git] / htdocs / public.php
blobe5c619ca68827d94bc58e17113bdd3710b470968
1 <?php
2 /**
3 * CalDAV Server - main program
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
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();
17 /** A simplified DAV header in this case */
18 $dav = "1, 2, calendar-access";
19 header( "DAV: $dav");
20 require_once("CalDAVRequest.php");
21 $request = new CalDAVRequest();
22 if ( ! $request->IsPublic() &&
23 (! isset($request->ticket)
24 || $request->ticket->expired
25 || ! $request->ticket->MatchesPath($request->path) ) ) {
26 dbg_error_log( "caldav", 'Public: %d, Ticket: %d, Expired: %d, Matches(%s): %d',
27 $request->IsPublic(), isset($request->ticket), $request->ticket->expired, $request->path, $request->ticket->MatchesPath($request->path)
29 $request->DoResponse( 403, translate('Anonymous users may only access public calendars') );
33 switch ( $request->method ) {
34 case 'OPTIONS': include_once("caldav-OPTIONS.php"); break;
35 case 'REPORT': include_once("caldav-REPORT.php"); break;
36 case 'PROPFIND': include_once("caldav-PROPFIND.php"); break;
37 case 'GET': include_once("caldav-GET.php"); break;
38 case 'HEAD': include_once("caldav-GET.php"); break;
40 case 'PROPPATCH':
41 case 'MKCALENDAR':
42 case 'MKCOL':
43 case 'PUT':
44 case 'DELETE':
45 case 'LOCK':
46 case 'UNLOCK':
47 $request->DoResponse( 403, translate('Anonymous users are not allowed to modify calendars') );
48 break;
50 case 'TESTRRULE': include_once("test-RRULE.php"); break;
52 default:
53 dbg_error_log( "caldav", "Unhandled request method >>%s<<", $request->method );
54 dbg_log_array( "caldav", '_SERVER', $_SERVER, true );
55 dbg_error_log( "caldav", "RAW: %s", str_replace("\n", "",str_replace("\r", "", $request->raw_post)) );
58 $request->DoResponse( 500, translate("The application program does not understand that request.") );