ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
groupwareserver.php
Go to the documentation of this file.
1 <?php
2 
19 date_default_timezone_set('UTC');
20 
27 // $baseUri = '/';
28 
35 $pdo = new \PDO('sqlite:data/db.sqlite');
36 $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
37 
45 function exception_error_handler($errno, $errstr, $errfile, $errline) {
46  throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
47 }
48 set_error_handler("exception_error_handler");
49 
50 // Autoloader
51 require_once 'vendor/autoload.php';
52 
59 $authBackend = new \Sabre\DAV\Auth\Backend\PDO($pdo);
60 $principalBackend = new \Sabre\DAVACL\PrincipalBackend\PDO($pdo);
61 $carddavBackend = new \Sabre\CardDAV\Backend\PDO($pdo);
62 $caldavBackend = new \Sabre\CalDAV\Backend\PDO($pdo);
63 
70 $nodes = [
71  // /principals
72  new \Sabre\CalDAV\Principal\Collection($principalBackend),
73  // /calendars
74  new \Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend),
75  // /addressbook
76  new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend),
77 ];
78 
79 // The object tree needs in turn to be passed to the server class
80 $server = new \Sabre\DAV\Server($nodes);
81 if (isset($baseUri)) $server->setBaseUri($baseUri);
82 
83 // Plugins
84 $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
85 $server->addPlugin(new \Sabre\DAV\Browser\Plugin());
86 $server->addPlugin(new \Sabre\DAV\Sync\Plugin());
87 $server->addPlugin(new \Sabre\DAV\Sharing\Plugin());
88 $server->addPlugin(new \Sabre\DAVACL\Plugin());
89 
90 // CalDAV plugins
91 $server->addPlugin(new \Sabre\CalDAV\Plugin());
92 $server->addPlugin(new \Sabre\CalDAV\Schedule\Plugin());
93 $server->addPlugin(new \Sabre\CalDAV\SharingPlugin());
94 $server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
95 
96 // CardDAV plugins
97 $server->addPlugin(new \Sabre\CardDAV\Plugin());
98 $server->addPlugin(new \Sabre\CardDAV\VCFExportPlugin());
99 
100 // And off we go!
101 $server->exec();
$carddavBackend
$principalBackend
$caldavBackend
exception_error_handler($errno, $errstr, $errfile, $errline)
Mapping PHP errors to exceptions.
$pdo
Make sure this setting is turned on and reflect the root url for your WebDAV server.
$nodes
The directory tree.
$authBackend
The backends.