[3733] | 1 | <?php |
---|
| 2 | |
---|
| 3 | require_once('./always.php'); |
---|
| 4 | |
---|
| 5 | dbg_error_log( 'well-known', 'iSchedule requested' ); |
---|
| 6 | |
---|
| 7 | require_once('HTTPAuthSession.php'); |
---|
| 8 | //$c->allow_unauthenticated = true; |
---|
| 9 | $session = new HTTPAuthSession(); |
---|
| 10 | |
---|
| 11 | if ( ! isset ( $request ) ) { |
---|
| 12 | require_once('CalDAVRequest.php'); |
---|
| 13 | $request = new CalDAVRequest(); |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | dbg_log_array( 'well-known', 'SESSAO', $session, true ); |
---|
| 17 | switch ( $request->path ) { |
---|
| 18 | case '/.well-known/caldav': |
---|
| 19 | case '/.well-known/carddav': |
---|
| 20 | header('Location: ' . ConstructURL('/'.$session->username.'/addressbook/',true) ); |
---|
| 21 | exit(0); |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | if ( $c->enable_scheduling != true ) |
---|
| 27 | { |
---|
| 28 | $request->DoResponse( 404, translate('The application program does not understand that request.') ); |
---|
| 29 | exit (); |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | header ( 'iSchedule-Version: 1.0' ); |
---|
| 33 | |
---|
| 34 | switch ( $request->method ) { |
---|
| 35 | case 'GET': ischedule_get(); break; |
---|
| 36 | case 'POST': include('iSchedule.php'); break; |
---|
| 37 | |
---|
| 38 | default: |
---|
| 39 | dbg_error_log( 'well-known', 'Unhandled request method >>%s<<', $request->method ); |
---|
| 40 | dbg_log_array( 'well-known', '_SERVER', $_SERVER, true ); |
---|
| 41 | dbg_error_log( 'well-known', 'RAW: %s', str_replace("\n", '',str_replace("\r", '', $request->raw_post)) ); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | $request->DoResponse( 500, translate('The application program does not understand that request.') ); |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | function ischedule_get ( ) |
---|
| 51 | { |
---|
| 52 | global $request,$c; |
---|
| 53 | if ( $request->path != '/.well-known/ischedule' || $_GET['query'] != 'capabilities' ) |
---|
| 54 | { |
---|
| 55 | $request->DoResponse( 404, translate('The application program does not understand that request.' . $request->path ) ); |
---|
| 56 | return false; |
---|
| 57 | } |
---|
| 58 | header ( 'Content-Type: application/xml; charset=utf-8' ); |
---|
| 59 | echo '<?xml version="1.0" encoding="utf-8" ?>'; |
---|
| 60 | echo <<<RESPONSE |
---|
| 61 | <query-result xmlns="urn:ietf:params:xml:ns:ischedule"> |
---|
| 62 | <capability-set> |
---|
| 63 | <supported-version-set> |
---|
| 64 | <version>1.0</version> |
---|
| 65 | </supported-version-set> |
---|
| 66 | <supported-scheduling-message-set> |
---|
| 67 | <comp name="VEVENT"> |
---|
| 68 | <method name="REQUEST"/> |
---|
| 69 | <method name="ADD"/> |
---|
| 70 | <method name="REPLY"/> |
---|
| 71 | <method name="CANCEL"/> |
---|
| 72 | </comp> |
---|
| 73 | <comp name="VTODO"/> |
---|
| 74 | <comp name="VFREEBUSY"/> |
---|
| 75 | </supported-scheduling-message-set> |
---|
| 76 | <supported-calendar-data-type> |
---|
| 77 | <calendar-data-type content-type="text/calendar" version="2.0"/> |
---|
| 78 | </supported-calendar-data-type> |
---|
| 79 | <supported-attachment-values> |
---|
| 80 | <inline-attachment/> |
---|
| 81 | <external-attachment/> |
---|
| 82 | </supported-attachment-values> |
---|
| 83 | <supported-recipient-uri-scheme-set> |
---|
| 84 | <scheme>mailto</scheme> |
---|
| 85 | </supported-recipient-uri-scheme-set> |
---|
| 86 | <max-content-length>102400</max-content-length> |
---|
| 87 | <min-date-time>19910101T000000Z</min-date-time> |
---|
| 88 | <max-date-time>20381231T000000Z</max-date-time> |
---|
| 89 | <max-instances>150</max-instances> |
---|
| 90 | <max-recipients>250</max-recipients> |
---|
| 91 | |
---|
| 92 | RESPONSE; |
---|
| 93 | echo ' <administrator>mailto:' . $c->admin_email . '</administrator>' . "\n"; |
---|
| 94 | echo <<<RESPONSE |
---|
| 95 | </capability-set> |
---|
| 96 | </query-result> |
---|
| 97 | RESPONSE; |
---|
| 98 | exit ( 0 ); |
---|
| 99 | } |
---|