1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108:
<?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);
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);
}
if ( $c->enable_scheduling != true )
{
$request->DoResponse( 404, translate('The application program does not understand that request.') );
}
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 '<?xml version="1.0" encoding="utf-8" ?>';
echo <<<RESPONSE
<query-result xmlns="urn:ietf:params:xml:ns:ischedule">
<capability-set>
<supported-version-set>
<version>1.0</version>
</supported-version-set>
<supported-scheduling-message-set>
<comp name="VEVENT">
<method name="REQUEST"/>
<method name="ADD"/>
<method name="REPLY"/>
<method name="CANCEL"/>
</comp>
<comp name="VTODO"/>
<comp name="VFREEBUSY"/>
</supported-scheduling-message-set>
<supported-calendar-data-type>
<calendar-data-type content-type="text/calendar" version="2.0"/>
</supported-calendar-data-type>
<supported-attachment-values>
<inline-attachment/>
</supported-attachment-values>
<supported-recipient-uri-scheme-set>
<scheme>mailto</scheme>
</supported-recipient-uri-scheme-set>
<max-content-length>102400</max-content-length>
<min-date-time>19910101T000000Z</min-date-time>
<max-date-time>20381231T000000Z</max-date-time>
<max-instances>150</max-instances>
<max-recipients>250</max-recipients>
RESPONSE;
echo ' <administrator>mailto:' . $c->admin_email . '</administrator>' . "\n";
echo <<<RESPONSE
</capability-set>
</query-result>
RESPONSE;
@ob_flush(); exit(0);
}