First phase of iSchedule support. Capabilities supported as well as validating remote requests. Still need to handle remote requests.

This commit is contained in:
Rob Ostensen authored and Andrew McMillan committed 2010-04-19 14:17:19 +12:00
1 parent 295fa0eb9b
commit 528211bc65
3 files changed
+435

No files matched your search

+4
View File
@@ -19,6 +19,10 @@ if ( isset($_SERVER['PATH_INFO']) && preg_match( '{^(/favicon.ico|davical.css|(i
}
exit(0);
}
elseif ( isset($_SERVER['PATH_INFO']) && preg_match( '{^/\.well-known/(.+)$}', $_SERVER['PATH_INFO'], $matches ) ) {
require ('well-known.php');
exit(0);
}
require_once('./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 );
+89
View File
@@ -0,0 +1,89 @@
<?
require_once('./always.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();
}
if ( $c->enable_scheduling != true )
{
$request->DoResponse( 404, translate('The application program does not understand that request.') );
exit ();
}
header ( 'iSchedule-Version: 1.0' );
switch ( $request->method ) {
case 'GET': ischedule_get(); break;
case 'POST': include('iSchedule.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 ( '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/>
<external-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;
exit ( 0 );
}