ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
calendarserver.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4 
5 CalendarServer example
6 
7 This server features CalDAV support
8 
9 */
10 
11 // settings
12 date_default_timezone_set('Canada/Eastern');
13 
14 // If you want to run the SabreDAV server in a custom location (using mod_rewrite for instance)
15 // You can override the baseUri here.
16 // $baseUri = '/';
17 
18 /* Database */
19 $pdo = new PDO('sqlite:data/db.sqlite');
20 $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
21 
22 //Mapping PHP errors to exceptions
23 function exception_error_handler($errno, $errstr, $errfile, $errline) {
24  throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
25 }
26 set_error_handler("exception_error_handler");
27 
28 // Files we need
29 require_once 'vendor/autoload.php';
30 
31 // Backends
35 
36 // Directory structure
37 $tree = [
40 ];
41 
43 
44 if (isset($baseUri))
45  $server->setBaseUri($baseUri);
46 
47 /* Server Plugins */
49 $server->addPlugin($authPlugin);
50 
52 $server->addPlugin($aclPlugin);
53 
54 /* CalDAV support */
56 $server->addPlugin($caldavPlugin);
57 
58 /* Calendar subscription support */
59 $server->addPlugin(
60  new Sabre\CalDAV\Subscriptions\Plugin()
61 );
62 
63 /* Calendar scheduling support */
64 $server->addPlugin(
65  new Sabre\CalDAV\Schedule\Plugin()
66 );
67 
68 /* WebDAV-Sync plugin */
69 $server->addPlugin(new Sabre\DAV\Sync\Plugin());
70 
71 /* CalDAV Sharing support */
72 $server->addPlugin(new Sabre\DAV\Sharing\Plugin());
73 $server->addPlugin(new Sabre\CalDAV\SharingPlugin());
74 
75 // Support for html frontend
77 $server->addPlugin($browser);
78 
79 // And off we go!
80 $server->exec();
$browser
Browser Plugin.
Definition: Plugin.php:24
This plugin provides Authentication for a WebDAV server.
Definition: Plugin.php:25
exception_error_handler($errno, $errstr, $errfile, $errline)
Principal collection.
Definition: Collection.php:19
$authBackend
PDO principal backend.
Definition: PDO.php:20
$authPlugin
This is an authentication backend that uses a database to manage passwords.
Definition: PDO.php:12
$calendarBackend
$principalBackend
$server
Calendars collection.
$caldavPlugin
SabreDAV ACL Plugin.
Definition: Plugin.php:31
$aclPlugin
PDO CalDAV backend.
Definition: PDO.php:21