case 'MOVE': include 'caldav-MOVE.php'; break; case 'ACL': include 'caldav-ACL.php'; break; case 'LOCK': include 'caldav-LOCK.php'; break; case 'UNLOCK': include 'caldav-LOCK.php'; break; case 'MKTICKET': include 'caldav-MKTICKET.php'; break; case 'DELTICKET': include 'caldav-DELTICKET.php'; break; case 'BIND': include 'caldav-BIND.php'; break; case 'TESTRRULE': include 'test-RRULE-v2.php'; break; default: dbg_error_log('caldav', 'Unhandled request method >>%s<<', $request->method); dbg_log_array('caldav', '_SERVER', $_SERVER, true); dbg_error_log('caldav', 'RAW: %s', str_replace("\n", '', str_replace("\r", '', $request->raw_post))); } $request->DoResponse(400, translate('The application program does not understand that request.'));
* @copyright Catalyst .Net Ltd * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 */ require "./always.php"; 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 :-("); dbg_log_array("headers", '_SERVER', $_SERVER, true); require "PublicSession.php"; $session = new PublicSession(); /** A simplified DAV header in this case */ $dav = "1, 2, calendar-access"; header("DAV: {$dav}"); require_once "CalDAVRequest.php"; $request = new CalDAVRequest(); if (!$request->IsPublic() && (!isset($request->ticket) || $request->ticket->expired || !$request->ticket->MatchesPath($request->path))) { dbg_error_log("caldav", 'Public: %d, Ticket: %d, Expired: %d, Matches(%s): %d', $request->IsPublic(), isset($request->ticket), isset($request->ticket) ? $request->ticket->expired : '--', $request->path, isset($request->ticket) ? $request->ticket->MatchesPath($request->path) : '--'); $request->DoResponse(403, translate('Anonymous users may only access public calendars')); } switch ($request->method) { case 'OPTIONS': include_once "caldav-OPTIONS.php"; break; case 'REPORT': include_once "caldav-REPORT.php"; break; case 'PROPFIND': include_once "caldav-PROPFIND.php"; break; case 'GET': include_once "caldav-GET.php"; break; case 'HEAD':
<?php /** * Errors are sent as an XML document. * @param int $code * @param string $message * @param string $debugdata */ require_once 'HTTPAuthSession.php'; $session = new HTTPAuthSession(); require_once 'CalDAVRequest.php'; $request = new CalDAVRequest(); if (!isset($c->enable_autodiscover) || !$c->enable_autodiscover) { $request->DoResponse(404); exit(0); // unneccessary } $ns_outlook_req_2006 = "http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"; $ns_exchange_resp_2006 = "http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006"; $ns_outlook_resp_2006a = "http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a"; function errorResponse($code, $message, $debugdata = '') { global $request, $ns_exchange_resp_2006; $error_time_id = time(); $error_time = gmdate('h:i:s', $error_time_id); $response = <<<ERROR <?xml version="1.0" encoding="utf-8" ?> <Autodiscover xmlns="{$ns_exchange_resp_2006}"> <Response> <Error Time="{$error_time}" Id="{$error_time_id}"> <ErrorCode>{$code}</ErrorCode>
<?php /** * DAViCal Timezone Service handler * * @package davical * @subpackage tzservice * @author Andrew McMillan <*****@*****.**> * @copyright Morphoss Ltd * @license http://gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require "./always.php"; require "PublicSession.php"; $session = new PublicSession(); param_to_global('action', '{[a-z_-]+}'); param_to_global('format', '{[a-z]+/[a-zA-Z0-9.+_-]+}'); param_to_global('changedsince', '{.*}', 'changesince'); param_to_global('start'); param_to_global('end'); param_to_global('lang'); $returnall = isset($_GET['returnall']); param_to_global('tzid'); require_once 'CalDAVRequest.php'; $request = new CalDAVRequest(); $code_file = sprintf('tz/%s.php', $action); if (!@(include_once $code_file)) { $request->PreconditionFailed(400, "supported-action", 'The action "' . $action . '" is not understood.', 'urn:ietf:params:xml:ns:timezone-service'); } $request->DoResponse(500, translate("The application failed to understand that request."));
} /** * We also allow URLs like .../freebusy.php/user@example.com to work, so long as * the e-mail matches a single user whose calendar we have rights to. * @NOTE: It is OK for there to *be* duplicate e-mail addresses, just so long as we * only have read permission (or more) for only one of them. */ require_once "CalDAVRequest.php"; $request = new CalDAVRequest(array("allow_by_email" => 1)); $path_match = '^' . $request->path; if (preg_match('{^/(\\S+@[a-z0-9][a-z0-9-]*[.][a-z0-9.-]+)/?$}i', $request->path, $matches)) { $principal = new Principal('email', $matches[1]); $path_match = '^' . $principal->dav_name(); } if (isset($fb_format) && $fb_format != 'text/calendar') { $request->DoResponse(406, translate('This server only supports the text/calendar format for freebusy URLs')); } if (!$request->HavePrivilegeTo('read-free-busy')) { $request->DoResponse(404); } require_once "freebusy-functions.php"; switch ($_SERVER['REQUEST_METHOD']) { case 'GET': $range_start = new RepeatRuleDateTime($fb_start); if (!isset($fb_end)) { $range_end = clone $range_start; $range_end->modify($fb_period); } else { $range_end = new RepeatRuleDateTime($fb_end); } $freebusy = get_freebusy($path_match, $range_start, $range_end);