diff options
author | Mario Vavti <mario@mariovavti.com> | 2016-05-29 00:33:28 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2016-05-29 00:33:28 +0200 |
commit | aab9766c53e42c3141d0497fce78977d262efbc1 (patch) | |
tree | f633ad641d818d6229ea7d14e72de42e739196de /vendor/examples/calendarserver.php | |
parent | 66effbfe0827fc61fff6d248797a894213ad20d6 (diff) | |
download | volse-hubzilla-aab9766c53e42c3141d0497fce78977d262efbc1.tar.gz volse-hubzilla-aab9766c53e42c3141d0497fce78977d262efbc1.tar.bz2 volse-hubzilla-aab9766c53e42c3141d0497fce78977d262efbc1.zip |
missed some files
Diffstat (limited to 'vendor/examples/calendarserver.php')
-rw-r--r-- | vendor/examples/calendarserver.php | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/vendor/examples/calendarserver.php b/vendor/examples/calendarserver.php new file mode 100644 index 000000000..e5f9f3387 --- /dev/null +++ b/vendor/examples/calendarserver.php @@ -0,0 +1,76 @@ +<?php + +/* + +CalendarServer example + +This server features CalDAV support + +*/ + +// settings +date_default_timezone_set('Canada/Eastern'); + +// If you want to run the SabreDAV server in a custom location (using mod_rewrite for instance) +// You can override the baseUri here. +// $baseUri = '/'; + +/* Database */ +$pdo = new PDO('sqlite:data/db.sqlite'); +$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +//Mapping PHP errors to exceptions +function exception_error_handler($errno, $errstr, $errfile, $errline) { + throw new ErrorException($errstr, 0, $errno, $errfile, $errline); +} +set_error_handler("exception_error_handler"); + +// Files we need +require_once 'vendor/autoload.php'; + +// Backends +$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo); +$calendarBackend = new Sabre\CalDAV\Backend\PDO($pdo); +$principalBackend = new Sabre\DAVACL\PrincipalBackend\PDO($pdo); + +// Directory structure +$tree = [ + new Sabre\CalDAV\Principal\Collection($principalBackend), + new Sabre\CalDAV\CalendarRoot($principalBackend, $calendarBackend), +]; + +$server = new Sabre\DAV\Server($tree); + +if (isset($baseUri)) + $server->setBaseUri($baseUri); + +/* Server Plugins */ +$authPlugin = new Sabre\DAV\Auth\Plugin($authBackend); +$server->addPlugin($authPlugin); + +$aclPlugin = new Sabre\DAVACL\Plugin(); +$server->addPlugin($aclPlugin); + +/* CalDAV support */ +$caldavPlugin = new Sabre\CalDAV\Plugin(); +$server->addPlugin($caldavPlugin); + +/* Calendar subscription support */ +$server->addPlugin( + new Sabre\CalDAV\Subscriptions\Plugin() +); + +/* Calendar scheduling support */ +$server->addPlugin( + new Sabre\CalDAV\Schedule\Plugin() +); + +/* WebDAV-Sync plugin */ +$server->addPlugin(new Sabre\DAV\Sync\Plugin()); + +// Support for html frontend +$browser = new Sabre\DAV\Browser\Plugin(); +$server->addPlugin($browser); + +// And off we go! +$server->exec(); |