source: contrib/davical/htdocs/public.php @ 3733

Revision 3733, 1.9 KB checked in by gabriel.malheiros, 13 years ago (diff)

Ticket #1541 - <Davical customizado para o Expresso.Utiliza Caldav e CardDav?>

Line 
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*/
11require("./always.php");
12dbg_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 :-(")) );
13dbg_log_array( "headers", '_SERVER', $_SERVER, true );
14require("PublicSession.php");
15$session = new PublicSession();
16
17/** A simplified DAV header in this case */
18$dav = "1, 2, calendar-access";
19header( "DAV: $dav");
20
21require_once("CalDAVRequest.php");
22$request = new CalDAVRequest();
23if ( !isset($request->ticket) && !$request->IsPublic() ) {
24  $request->DoResponse( 403, translate('Anonymous users may only access public calendars') );
25}
26
27switch ( $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
Note: See TracBrowser for help on using the repository browser.