/** * Sets up the object. A PDO object must be passed to setup all the backends. * * @param PDO $pdo */ public function __construct(PDO $pdo) { /* 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 = array(new Sabre_CalDAV_Principal_Collection($principalBackend), new Sabre_CalDAV_CalendarRootNode($principalBackend, $calendarBackend)); /* Initializing server */ parent::__construct($tree); /* Server Plugins */ $authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, $this->authRealm); $this->addPlugin($authPlugin); $aclPlugin = new Sabre_DAVACL_Plugin(); $this->addPlugin($aclPlugin); $caldavPlugin = new Sabre_CalDAV_Plugin(); $this->addPlugin($caldavPlugin); }
/** * Sets up the object. A PDO object must be passed to setup all the backends. * * @param PDO $pdo */ public function __construct(PDO $pdo) { /* Backends */ $authBackend = new Sabre_DAV_Auth_Backend_PDO($pdo); $calendarBackend = new Sabre_CalDAV_Backend_PDO($pdo); /* Directory structure */ $root = new Sabre_DAV_SimpleDirectory('root'); $principals = new Sabre_DAV_Auth_PrincipalCollection($authBackend); $root->addChild($principals); $calendars = new Sabre_CalDAV_CalendarRootNode($authBackend, $calendarBackend); $root->addChild($calendars); $objectTree = new Sabre_DAV_ObjectTree($root); /* Initializing server */ parent::__construct($objectTree); /* Server Plugins */ $authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, 'SabreDAV'); $this->addPlugin($authPlugin); $caldavPlugin = new Sabre_CalDAV_Plugin(); $this->addPlugin($caldavPlugin); }