Roughing out implementation of timezone server.

This commit is contained in:
Andrew McMillan 2011-09-14 23:02:34 +12:00
parent bc1e264c6b
commit 731677d623
5 changed files with 85 additions and 0 deletions

32
htdocs/tz.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* DAViCal Timezone Service handler
*
* @package davical
* @subpackage caldav
* @author Andrew McMillan <andrew@morphoss.com>
* @copyright Morphoss Ltd
* @license http://gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require("./always.php");
require("PublicSession.php");
$session = new PublicSession();
param_to_global('action','{(capabilities|list|get|expand|update)}');
param_to_global('format','{(text/calendar|application/calendar+xml)}');
param_to_global('changesince');
param_to_global('start');
param_to_global('end');
param_to_global('lang');
$returnall = isset($_GET['returnall']);
param_to_global('tzid');
$request = new CalDAVRequest();
$code_file = sprintf( 'tz/%s.php', $action );
if ( ! @include_once( $code_file ) ) {
$request->PreconditionFailed(400, "supported-action", 'The action "'+$_GET['action']+'" is not understood.' );
}
$request->DoResponse( 500, translate("The application failed to understand that request.") );

View File

@ -20,6 +20,10 @@ switch ( $request->path ) {
header('Location: ' . ConstructURL('/',true) );
$request->DoResponse(301); // Moved permanently
// does not return.
case '/.well-known/timezone':
header('Location: ' . ConstructURL('/tz.php',true) );
$request->DoResponse(301); // Moved permanently
// does not return.
}

View File

@ -0,0 +1,7 @@
#
# Request timezone server capabilities
#
TYPE=GET
URL=http://regression.host/tz.php?action=capabilities
HEAD

View File

@ -0,0 +1,7 @@
#
# List timezone server timezones
#
TYPE=GET
URL=http://regression.host/tz.php?action=list
HEAD

View File

@ -0,0 +1,35 @@
setval
--------
1649
(1 row)
setval
--------
1
(1 row)
setval
--------
10
(1 row)
setval
--------
10
(1 row)
setval
--------
1
(1 row)
setval
--------
7
(1 row)
setval
--------
1000
(1 row)