* @copyright Catalyst .Net Ltd * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 */ //require_once("../inc/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_once "Cal/HTTPAuthSession.php"; class Cal extends HTML_FlexyFramework_Page { var $conf; function iniConf() { // Default some of the configurable values $this->conf->sysabbr = 'davical'; $this->conf->admin_email = 'admin@davical.example.com'; $this->conf->system_name = "DAViCal CalDAV Server"; $this->conf->domain_name = $_SERVER['SERVER_NAME']; $this->conf->save_time_zone_defs = true; $this->conf->collections_always_exist = true; $this->conf->home_calendar_name = 'home'; $this->conf->enable_row_linking = true; $this->conf->http_auth_mode = 'Basic'; // $this->conf->default_locale = array('es_MX', 'es_AR', 'es', 'pt'); // An array of locales to try, or just a single locale // $this->conf->local_tzid = 'Pacific/Auckland'; // Perhaps we should read from /etc/timezone - I wonder how standard that is? $this->conf->default_locale = "en"; $this->conf->base_url = $this->baseURL; $this->conf->base_directory = $this->rootURL; //$c->stylesheets = array( $c->base_url."/davical.css" ); //$c->images = $c->base_url . "/images"; } function getAuth() { return true; } function start() { $session = new HTTPAuthSession(); /** * From reading the "Scheduling Extensions to CalDAV" draft I don't think that we will * be doing 'calendar-schedule' any time soon. The current spec is at: * http://www.ietf.org/internet-drafts/draft-desruisseaux-caldav-sched-03.txt * * access-control is rfc3744, so we will say we do it, but I doubt if we do it * in all (or even much of) it's glory really. */ if ( isset($this->conf->override_dav_header) ) { $dav = $this->conf->->override_dav_header; } else { $dav = "1, 2, access-control, calendar-access"; } header( "DAV: $dav"); require_once("Cal/DAVRequest.php"); $request = new Cal_DAVRequest(); if (!file_exists(dirname(__FILE__).'/Cal/'.$request->method .'.php'))){ $request->DoResponse( 500, "The application program does not understand that request." ); exit; } require_once dirname(__FILE__).'/Cal/'.$request->method .'.php'; $m = 'Cal_'.$request->method; $hand = new $m($this); $hand->handle(); /* 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 'PROPPATCH': include_once("caldav-PROPPATCH.php"); break; case 'MKCALENDAR': include_once("caldav-MKCALENDAR.php"); break; case 'MKCOL': include_once("caldav-MKCALENDAR.php"); break; case 'PUT': include_once("caldav-PUT.php"); break; case 'GET': include_once("caldav-GET.php"); break; case 'HEAD': include_once("caldav-GET.php"); break; case 'DELETE': include_once("caldav-DELETE.php"); break; case 'LOCK': include_once("caldav-LOCK.php"); break; case 'UNLOCK': include_once("caldav-LOCK.php"); break; case 'TESTRRULE': include_once("test-RRULE.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)) ); } */ } }