-
Notifications
You must be signed in to change notification settings - Fork 1
/
cal.php
executable file
·34 lines (26 loc) · 1013 Bytes
/
cal.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
define('SABRE_MYSQLDSN','mysql:host=127.0.0.1;dbname=baikal');
define('SABRE_MYSQLUSER','root');
define('SABRE_MYSQLPASS','111111');
$baseURI = str_replace("\\","/",str_replace(__DIR__,"",__FILE__));
$pdo = new \PDO(SABRE_MYSQLDSN,SABRE_MYSQLUSER,SABRE_MYSQLPASS);
require_once "SabreDAV/vendor/autoload.php";
# Backends
$authBackend = new \Sabre\DAV\Auth\Backend\PDO($pdo);
$principalBackend = new \Sabre\DAVACL\PrincipalBackend\PDO($pdo);
$calendarBackend = new \Sabre\CalDAV\Backend\PDO($pdo);
# Directory structure
$nodes = array(
new \Sabre\CalDAV\Principal\Collection($principalBackend),
new \Sabre\CalDAV\CalendarRootNode($principalBackend, $calendarBackend),
);
# Initializing server
$server = new \Sabre\DAV\Server($nodes);
$server->setBaseUri("/cal.php/");
# Server Plugins
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend,"BaikalDAV"));
$server->addPlugin(new \Sabre\DAVACL\Plugin());
$server->addPlugin(new \Sabre\CalDAV\Plugin());
# And off we go!
$server->exec();
?>