1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
12:
13: class Horde_Rpc_Webdav2 extends Horde_Rpc
14: {
15:
16: private $_server;
17:
18: public function __construct($request, $params = array())
19: {
20:
21: ini_set('display_errors', 0);
22:
23: if (strstr($_SERVER['PATH_INFO'])) {
24:
25: }
26: $this->_server = $this->_getCalDAVServer();
27:
28: parent::__construct($request, $params);
29: }
30:
31: private function _getCalDAVServer()
32: {
33:
34: $auth = $GLOBALS['injector']->getInstance('Horde_Auth');
35: $registry = $GLOBALS['injector']->getInstance('Horde_Registry');
36:
37:
38: $authBackend = new Sabre_DAV_Auth_Backend_Horde($registry);
39: $calendarBackend = new Sabre_CalDAV_Backend_Horde($auth);
40:
41:
42: $root = new Sabre_DAV_SimpleDirectory('root');
43: $principals = new Sabre_DAV_Auth_PrincipalCollection($authBackend);
44: $root->addChild($principals);
45: $calendars = new Sabre_CalDAV_CalendarRootNode($authBackend, $calendarBackend);
46: $root->addChild($calendars);
47:
48: $objectTree = new Sabre_DAV_ObjectTree($root);
49:
50:
51: Sabre_DAV_Server::__construct($objectTree);
52:
53:
54: $authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, 'Horde DAV Server');
55: $this->addPlugin($authPlugin);
56:
57: $caldavPlugin = new Sabre_CalDAV_Plugin();
58: $this->addPlugin($caldavPlugin);
59: }
60: }