4 * Script to export a calendar in iCalendar format from the command line.
13 $basename davical.example.com /username/calendar/ calendarfile.ics
16 'davical.example.com' is the hostname of your DAViCal server.
17 '/username/calendar/' is the (sub-)path of the calendar to be updated.
19 This script can be used to export whole calendars in iCalendar format to
26 $_SERVER['SERVER_NAME'] = $argv[1];
29 // Change into the web application root directory so includes work.
30 $script_file = __FILE__
;
31 chdir(preg_replace('{/scripts/[^/]+.php$}','/htdocs',$script_file));
32 require_once("./always.php");
44 function __construct($user_no = null) {
45 if ( empty($user_no) ) {
47 $this->principal_id
= -1;
48 $this->logged_in
= false;
52 $this->user_no
= $user_no;
53 $principal = new Principal('user_no',$user_no);
54 // Assign each field in the selected record to the object
55 foreach( $principal AS $k => $v ) {
58 $this->username
= $principal->username();
59 $this->principal_id
= $principal->principal_id();
60 $this->email
= $principal->email();
61 $this->dav_name
= $principal->dav_name();
62 $this->principal
= $principal;
64 $this->logged_in
= true;
68 function AllowedTo($do_something) {
69 return $this->logged_in
;
72 $session = new FakeSession();
74 require("caldav-GET-functions.php");
75 $calendar = new DAVResource($source);
77 echo export_iCalendar($calendar);