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. 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 ) { $request->DoResponse( 404, translate('The application program does not understand that request.') ); // Does not return } dbg_log_array( 'well-known', 'method:'. $request->method ); switch ( $request->method ) { case 'GET': ischedule_get(); break; case 'POST': include('iSchedule-POST.php'); break; default: dbg_error_log( 'well-known', 'Unhandled request method >>%s<<', $request->method ); dbg_log_array( 'well-known', '_SERVER', $_SERVER, true ); dbg_error_log( 'well-known', 'RAW: %s', str_replace("\n", '',str_replace("\r", '', $request->raw_post)) ); } $request->DoResponse( 500, translate('The application program does not understand that request.') ); function ischedule_get ( ) { global $request,$c; if ( $request->path != '/.well-known/ischedule' || $_GET['query'] != 'capabilities' ) { $request->DoResponse( 404, translate('The application program does not understand that request.' . $request->path ) ); return false; } header ( 'iSchedule-Version: 1.0' ); header ( 'Content-Type: application/xml; charset=utf-8' ); echo ''; echo << 1.0 mailto 102400 19910101T000000Z 20381231T000000Z 150 250 RESPONSE; // // TODO: figure out if we actually support this echo ' mailto:' . $c->admin_email . '' . "\n"; echo << RESPONSE; @ob_flush(); exit(0); }