From b160ead5a0227673dc9411a6958ae073113ec86d Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 17 Sep 2011 17:59:36 +1200 Subject: [PATCH] Basic 'capabilities' response for timezone protocol. --- htdocs/tz.php | 9 +-- inc/tz/capabilities.php | 125 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 inc/tz/capabilities.php diff --git a/htdocs/tz.php b/htdocs/tz.php index 9b7cdddb..a744e644 100644 --- a/htdocs/tz.php +++ b/htdocs/tz.php @@ -3,7 +3,7 @@ * DAViCal Timezone Service handler * * @package davical -* @subpackage caldav +* @subpackage tzservice * @author Andrew McMillan * @copyright Morphoss Ltd * @license http://gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -12,8 +12,8 @@ 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('action','{[a-z_-]+}'); +param_to_global('format','{[a-z]+/[a-zA-Z0-9.+_-]+}'); param_to_global('changesince'); param_to_global('start'); param_to_global('end'); @@ -21,11 +21,12 @@ param_to_global('lang'); $returnall = isset($_GET['returnall']); param_to_global('tzid'); +require_once('CalDAVRequest.php'); $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->PreconditionFailed(400, "supported-action", 'The action "'.$_GET['action'].'" is not understood.' ); } $request->DoResponse( 500, translate("The application failed to understand that request.") ); diff --git a/inc/tz/capabilities.php b/inc/tz/capabilities.php new file mode 100644 index 00000000..fd2610d3 --- /dev/null +++ b/inc/tz/capabilities.php @@ -0,0 +1,125 @@ + +* @copyright Morphoss Ltd +* @license http://gnu.org/copyleft/gpl.html GNU GPL v3 or later +*/ + +header('Content-Type: application/xml; charset="utf-8"'); +?> + + + + Olson:2011m + mailto:tzs@example.org + + + + list + List timezone identifiers and localized forms + + + + lang + false + true + Specify desired localized form(s) + + + + changedsince + false + false + Limit result to timezones changed since the + given date + + + + + returnall + false + false + If present inactive timezones will be returned. + + + + + + get + + Returns one or more timezones as specified by the + tzid parameter. + + + + format + false + false + text/calendar + application/calendar+xml + Specify required format for timezone. + + + + + lang + false + true + Specify desired localized form(s) + + + + tzid + true + true + Specify desired timezone identifiers + + + + + + expand + + Expands the specified timezone(s) into local onset and UTC + offsets + + + + tzid + true + true + Specify desired timezone identifiers + + + + start + false + false + + Specify start of the period of interest. If omitted the + current year is assumed. + + + + + end + false + false + + Specify end of the period of interest. + If omitted the current year + 10 is assumed. + + + + + + capabilities + Gets the capabilities of the server + + +