## /inc/caldav-PUT-functions.php

Description

CalDAV Server - handle PUT method

- author: Andrew McMillan <andrew@morphoss.com>
- copyright: Morphoss Ltd - http://www.morphoss.com/
- license: GNU GPL v2 or later version

Includes
require_once ('iCalendar.php') (line 18)

Check if the user wants to put just one VEVENT/VTODO or a whole calendar

if the collection = calendar = $request_container doesn't exist then create it return true if it's a whole calendar

Functions
controlRequestContainer (line 58)

Work out the location we are doing the PUT to, and check that we have the rights to do the needful.

void controlRequestContainer (string $username, int $user_no, string $path, boolean $caldav_context, [boolean $public = null])

- string $username: The name of the destination user
- int $user_no: The user making the change
- string $path: The DAV path the resource is bing PUT to
- boolean $caldav_context: Whether we are responding via CalDAV or interactively
- boolean $public: Whether the collection will be public, should we need to create it

create_scheduling_requests (line 148)

Create scheduling requests in the schedule inbox for the

void create_scheduling_requests ( &$resource, iCalComponent $resource)

- iCalComponent $resource: The VEVENT/VTODO/... resource we are scheduling
- &$resource

import_collection (line 213)

This function will import a whole calendar

void import_collection (string $ics_content, int $user_no, string $path, boolean $caldav_context)

- string $ics_content: the ics file to import
- int $user_no: the user wich will receive this ics file
- string $path: the $path where it will be store such as /user_foo/home/
- boolean $caldav_context:

  Whether we are responding via CalDAV or interactively

  Any VEVENTs with the same UID will be concatenated together

public_events_only (line 110)

Check if this collection should force all events to be PUBLIC.

- return: Return true if public events only are allowed.

boolean public_events_only (string $user_no, string $dav_name)

- string $user_no: the user that owns the collection
- string $dav_name: the collection to check

putCalendarResource (line 403)

Put the resource from this request - does some checking of things before calling write_event to do the actual writing (without any checking).

- return: Either 'INSERT' or 'UPDATE': the type of action that the PUT resulted in

string putCalendarResource ( &$request, int $author, boolean $caldav_context, object $request)

- object $request: A reference to the request object
- int $author: The user_no who wants to put this resource on the server
- boolean $caldav_context: Whether we are responding via CalDAV or interactively
- &$request

rollback_on_error (line 33)

This function launches an error

void rollback_on_error (boolean $caldav_context, int $user_no, string $path, [string $message = ''], [int $error_no = 500])

- boolean $caldav_context: Whether we are responding via CalDAV or interactively
- int $user_no: the user who will receive this ics file
- string $path: the $path where the PUT failed to store such as /user_foo/home/
- string $message: An optional error message to return to the client
- int $error_no: An optional value for the HTTP error code

simple_write_resource (line 698)

A slightly simpler version of write_resource which will make more sense for calling from an external program. This makes assumptions that the collection and user do exist and bypasses all checks for whether it is reasonable to write this here.

- return: True for success, false for failure.

boolean simple_write_resource (string $path, string $caldav_data, string $put_action_type)

- string $path: The path to the resource being written
- string $caldav_data: The actual resource to be written
- string $put_action_type: INSERT or UPDATE depending on what we are to do

update_scheduling_requests (line 178)

Update scheduling requests in the schedule inbox for the

void update_scheduling_requests ( &$resource, iCalComponent $resource)

- iCalComponent $resource: The VEVENT/VTODO/... resource we are scheduling
- &$resource

write_resource (line 495)

Actually write the resource to the database. All checking of whether this is reasonable should be done before this is called.

- return: True for success, false for failure.

boolean write_resource (int $user_no, string $path, string $caldav_data, int $collection_id, int $author, string $etag, object $ic, string $put_action_type, boolean $caldav_context, [string $log_action = true])

- int $user_no: The user_no owning this resource on the server
- string $path: The path to the resource being written
- string $caldav_data: The actual resource to be written
- int $collection_id: The ID of the collection containing the resource being written
- int $author: The user_no who wants to put this resource on the server
- string $etag: An etag unique for this event
- object $ic: The parsed iCalendar object
- string $put_action_type: INSERT or UPDATE depending on what we are to do
- boolean $caldav_context: True, if we are responding via CalDAV, false for other ways of calling this
- string $log_action: Either 'INSERT' or 'UPDATE': the type of action we are doing

write_scheduling_request (line 140)

Create a scheduling request in the schedule inbox for the

- return: The result of the scheduling request, per caldav-sched #3.5.4

float write_scheduling_request ( &$resource, iCalProp $attendee, iCalComponent $resource)

- iCalComponent $resource: The VEVENT/VTODO/... resource we are scheduling
- iCalProp $attendee: The attendee we are scheduling
- &$resource

Documentation generated on Thu, 25 Feb 2010 11:39:18 +1300 by phpDocumentor 1.3.2