} else { $dav = '1, 2, 3, access-control, calendar-access, calendar-schedule, extended-mkcol, bind, addressbook'; if ($c->enable_auto_schedule) { $dav .= ', calendar-auto-schedule'; } if (!isset($c->disable_caldav_proxy) || $c->disable_caldav_proxy == false) { $dav .= ', calendar-proxy'; } } $dav = explode("\n", wordwrap($dav)); foreach ($dav as $v) { header('DAV: ' . trim($v, ', '), false); } } require_once 'CalDAVRequest.php'; $request = new CalDAVRequest(); //if ( $request->method == 'OPTIONS' || $c->always_send_dav_header ) send_dav_header(); // Avoid polluting global namespace $allowed = implode(', ', array_keys($request->supported_methods)); // header( 'Allow: '.$allowed); if (!($request->IsPrincipal() || isset($request->collection) || $request->method == 'PUT' || $request->method == 'MKCALENDAR' || $request->method == 'MKCOL')) { if (preg_match('#^/principals/users(/.*/)$#', $request->path, $matches)) { // Although this doesn't work with the iPhone, perhaps it will with iCal... /** @todo integrate handling this URL into CalDAVRequest.php */ $redirect_url = ConstructURL('/caldav.php' . $matches[1]); dbg_error_log('LOG WARNING', 'Redirecting %s for "%s" to "%s"', $request->method, $request->path, $redirect_url); header('Location: ' . $redirect_url); @ob_flush(); exit(0); }
<?php dbg_error_log('well-known', 'iSchedule requested'); require_once 'HTTPAuthSession.php'; $c->allow_unauthenticated = true; $session = new HTTPAuthSession(); if (!isset($request)) { require_once 'CalDAVRequest.php'; $request = new CalDAVRequest(); } switch ($request->path) { case '/.well-known/caldav': case '/.well-known/carddav': header('Location: ' . $c->protocol_server_port . ConstructURL('/', true)); $request->DoResponse(301); // Moved permanently // does not return. // Moved permanently // does not return. case '/.well-known/timezone': $parameters = ''; foreach ($_GET as $k => $v) { $parameters .= $parameters == '' ? '?' : '&'; $parameters .= $k . '=' . rawurlencode($v); } header('Location: ' . $c->protocol_server_port . str_replace('/caldav.php', '', ConstructURL('/tz.php', true)) . $parameters); $request->DoResponse(301); // Moved permanently // does not return. } if ($c->enable_scheduling != true) {
* @package davical * @subpackage caldav * @author Andrew McMillan <*****@*****.**> * @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':
<?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."));
<?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>
// 44 days - 2 days more than recommended default /** * If fb_user (user, userid, user_no or email parameter) then we adjust * the path of the request to suit. */ if (isset($fb_user)) { $_SERVER['PATH_INFO'] = '/' . $fb_user . '/'; } /** * 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);