WARNING * WARNING * WARNING * WARNING * WARNING This script is still considered alpha level. Please backup your database before using it. WARNING * WARNING * WARNING * WARNING * WARNING

Description: Creates the iCal output for a single user's calendar so that remote users can "subscribe" to a WebCalendar calendar. Both Apple iCal and Mozilla's calendar (Sunbird) support subscribing to remote calendars and publishing events back to the server (WebCalendar in this case).

This file was based on publish.php and may replace it when it is found to be stable.

Note that unlike the export to iCal, this page does not include attendee info. This improves the performance considerably, BTW.

ERROR !!!!! There seems to be a bug in certain versions of PHP where the fgets () returns a blank string when reading stdin. I found this to be a problem with PHP 4.1.2 on Linux. If this is true for your PHP, you will not be able to import the events back from the ical client. It did work correctly with PHP 5.0.2.

The script sends an error message back to the iCal client, but Mozilla Calendar does not seem to display the message. (Strange, since it did display a PHP compile error message...)

Usage Requirements: For this work, at least on some Apache intallations, the following may need to be added to the httpd.conf file:

  1.   <Directory "/var/www/html/webcalendar">
  2.     Script PUT /icalclient.php
  3.   </Directory>
Of course, replace "/var/www/html/webcalendar" with the directory where you installed WebCalendar.

Input parameters: None

Security: If $PUBLISH_ENABLED is not 'Y' (set in Admin System Settings), do not allow. If $USER_PUBLISH_RW_ENABLED is not 'Y' (set in each user's Preferences), do not allow.

Change List: 06-Jan-2005 Ray Jones Added logic to publish calendars to remote iCal clients. The clients I've tested use METHOD:PUT to upload their data to the server. This file does not use WEBDAV, but the client doesn't know or seem to care.

Notes: Because data is being written back to WebCalendar, the user is prompted for username and password via the 401 HEADER. SEE TO DO for needed work.

To Delete an event from the iCal client, mark it as 'Cancelled'. This will translate into a 'D' in webcal_entry_user.cal_status.

TODO: Security! If an event update comes back from an iCal client, we need to make sure that the remote user has the authority to modify the event. (If they are only a participant and not the creator of the event or an admin, then they should not be able to update an event.)

MAYBE add logic to loop through webcal_import_data and delete any records that don't come back from the iCal client. This would indicate events were deleted from the client instead of being marked 'Cancelled'.

HTML in cal_description gets escaped when coming back from iCal client. Some formatting is getting deleted. I added a couple lines to modify these and it seems to work. never know what it might break.

Testing needs to be done with various RRULE options on import.

Better support for event reminders. Reminders for past events are not sent currently. This is because Mozilla Calendar may popup all reminders (even ones that are years old) when the calendar is loaded. Ideally, we should check the webcal_reminders table to see if an event reminder was already sent. Also, not sure if reminders for repeated events are handled properly yet.

 include ('includes/dbi4php.php') (line 94)
 include ('includes/functions.php') (line 96)
 include ('includes/config.php') (line 93)
 include ('includes/formvars.php') (line 95)
 include ('includes/'.$user_inc) (line 100)
 include ('includes/site_extras.php') (line 103)
 include_once ('includes/translate.php') (line 88)

includes here

 include_once ('includes/xcal.php') (line 105)
 include_once ('includes/validate.php') (line 102)
 require_once ('includes/classes/WebCalendar.class.php') (line 89)
dump_globals (line 190)
void dump_globals ()

Documentation generated on Thu, 10 Jun 2010 17:08:30 -0400 by phpDocumentor 1.4.3