aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/examples
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/examples')
-rw-r--r--vendor/examples/addressbookserver.php57
-rw-r--r--vendor/examples/calendarserver.php76
-rw-r--r--vendor/examples/fileserver.php56
-rw-r--r--vendor/examples/groupwareserver.php101
-rw-r--r--vendor/examples/minimal.php20
-rw-r--r--vendor/examples/sql/mysql.addressbooks.sql28
-rw-r--r--vendor/examples/sql/mysql.calendars.sql76
-rw-r--r--vendor/examples/sql/mysql.locks.sql12
-rw-r--r--vendor/examples/sql/mysql.principals.sql20
-rw-r--r--vendor/examples/sql/mysql.propertystorage.sql9
-rw-r--r--vendor/examples/sql/mysql.users.sql9
-rw-r--r--vendor/examples/sql/pgsql.addressbooks.sql44
-rw-r--r--vendor/examples/sql/pgsql.calendars.sql105
-rw-r--r--vendor/examples/sql/pgsql.locks.sql19
-rw-r--r--vendor/examples/sql/pgsql.principals.sql30
-rw-r--r--vendor/examples/sql/pgsql.propertystorage.sql13
-rw-r--r--vendor/examples/sql/pgsql.users.sql14
-rw-r--r--vendor/examples/sql/sqlite.addressbooks.sql28
-rw-r--r--vendor/examples/sql/sqlite.calendars.sql76
-rw-r--r--vendor/examples/sql/sqlite.locks.sql12
-rw-r--r--vendor/examples/sql/sqlite.principals.sql20
-rw-r--r--vendor/examples/sql/sqlite.propertystorage.sql10
-rw-r--r--vendor/examples/sql/sqlite.users.sql9
-rw-r--r--vendor/examples/webserver/apache2_htaccess.conf16
-rw-r--r--vendor/examples/webserver/apache2_vhost.conf29
-rw-r--r--vendor/examples/webserver/apache2_vhost_cgi.conf21
26 files changed, 910 insertions, 0 deletions
diff --git a/vendor/examples/addressbookserver.php b/vendor/examples/addressbookserver.php
new file mode 100644
index 000000000..6d1c9b26c
--- /dev/null
+++ b/vendor/examples/addressbookserver.php
@@ -0,0 +1,57 @@
+<?php
+
+/*
+
+Addressbook/CardDAV server example
+
+This server features CardDAV support
+
+*/
+
+// settings
+date_default_timezone_set('Canada/Eastern');
+
+// Make sure this setting is turned on and reflect the root url for your WebDAV server.
+// This can be for example the root / or a complete path to your server script
+$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");
+
+// Autoloader
+require_once 'vendor/autoload.php';
+
+// Backends
+$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo);
+$principalBackend = new Sabre\DAVACL\PrincipalBackend\PDO($pdo);
+$carddavBackend = new Sabre\CardDAV\Backend\PDO($pdo);
+//$caldavBackend = new Sabre\CalDAV\Backend\PDO($pdo);
+
+// Setting up the directory tree //
+$nodes = [
+ new Sabre\DAVACL\PrincipalCollection($principalBackend),
+// new Sabre\CalDAV\CalendarRoot($authBackend, $caldavBackend),
+ new Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend),
+];
+
+// The object tree needs in turn to be passed to the server class
+$server = new Sabre\DAV\Server($nodes);
+$server->setBaseUri($baseUri);
+
+// Plugins
+$server->addPlugin(new Sabre\DAV\Auth\Plugin($authBackend));
+$server->addPlugin(new Sabre\DAV\Browser\Plugin());
+//$server->addPlugin(new Sabre\CalDAV\Plugin());
+$server->addPlugin(new Sabre\CardDAV\Plugin());
+$server->addPlugin(new Sabre\DAVACL\Plugin());
+$server->addPlugin(new Sabre\DAV\Sync\Plugin());
+
+// And off we go!
+$server->exec();
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();
diff --git a/vendor/examples/fileserver.php b/vendor/examples/fileserver.php
new file mode 100644
index 000000000..59a453f63
--- /dev/null
+++ b/vendor/examples/fileserver.php
@@ -0,0 +1,56 @@
+<?php
+
+/*
+
+This is the best starting point if you're just interested in setting up a fileserver.
+
+Make sure that the 'public' and 'tmpdata' exists, with write permissions
+for your server.
+
+*/
+
+// settings
+date_default_timezone_set('Canada/Eastern');
+$publicDir = 'public';
+$tmpDir = 'tmpdata';
+
+// If you want to run the SabreDAV server in a custom location (using mod_rewrite for instance)
+// You can override the baseUri here.
+// $baseUri = '/';
+
+
+// Files we need
+require_once 'vendor/autoload.php';
+
+// Create the root node
+$root = new \Sabre\DAV\FS\Directory($publicDir);
+
+// The rootnode needs in turn to be passed to the server class
+$server = new \Sabre\DAV\Server($root);
+
+if (isset($baseUri))
+ $server->setBaseUri($baseUri);
+
+// Support for LOCK and UNLOCK
+$lockBackend = new \Sabre\DAV\Locks\Backend\File($tmpDir . '/locksdb');
+$lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend);
+$server->addPlugin($lockPlugin);
+
+// Support for html frontend
+$browser = new \Sabre\DAV\Browser\Plugin();
+$server->addPlugin($browser);
+
+// Automatically guess (some) contenttypes, based on extesion
+$server->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
+
+// Authentication backend
+$authBackend = new \Sabre\DAV\Auth\Backend\File('.htdigest');
+$auth = new \Sabre\DAV\Auth\Plugin($authBackend);
+$server->addPlugin($auth);
+
+// Temporary file filter
+$tempFF = new \Sabre\DAV\TemporaryFileFilterPlugin($tmpDir);
+$server->addPlugin($tempFF);
+
+// And off we go!
+$server->exec();
diff --git a/vendor/examples/groupwareserver.php b/vendor/examples/groupwareserver.php
new file mode 100644
index 000000000..40c1844da
--- /dev/null
+++ b/vendor/examples/groupwareserver.php
@@ -0,0 +1,101 @@
+<?php
+
+/**
+ * This server combines both CardDAV and CalDAV functionality into a single
+ * server. It is assumed that the server runs at the root of a HTTP domain (be
+ * that a domainname-based vhost or a specific TCP port.
+ *
+ * This example also assumes that you're using SQLite and the database has
+ * already been setup (along with the database tables).
+ *
+ * You may choose to use MySQL instead, just change the PDO connection
+ * statement.
+ */
+
+/**
+ * UTC or GMT is easy to work with, and usually recommended for any
+ * application.
+ */
+date_default_timezone_set('UTC');
+
+/**
+ * Make sure this setting is turned on and reflect the root url for your WebDAV
+ * server.
+ *
+ * This can be for example the root / or a complete path to your server script.
+ */
+// $baseUri = '/';
+
+/**
+ * Database
+ *
+ * Feel free to switch this to MySQL, it will definitely be better for higher
+ * concurrency.
+ */
+$pdo = new \PDO('sqlite:data/db.sqlite');
+$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+/**
+ * Mapping PHP errors to exceptions.
+ *
+ * While this is not strictly needed, it makes a lot of sense to do so. If an
+ * E_NOTICE or anything appears in your code, this allows SabreDAV to intercept
+ * the issue and send a proper response back to the client (HTTP/1.1 500).
+ */
+function exception_error_handler($errno, $errstr, $errfile, $errline) {
+ throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
+}
+set_error_handler("exception_error_handler");
+
+// Autoloader
+require_once 'vendor/autoload.php';
+
+/**
+ * The backends. Yes we do really need all of them.
+ *
+ * This allows any developer to subclass just any of them and hook into their
+ * own backend systems.
+ */
+$authBackend = new \Sabre\DAV\Auth\Backend\PDO($pdo);
+$principalBackend = new \Sabre\DAVACL\PrincipalBackend\PDO($pdo);
+$carddavBackend = new \Sabre\CardDAV\Backend\PDO($pdo);
+$caldavBackend = new \Sabre\CalDAV\Backend\PDO($pdo);
+
+/**
+ * The directory tree
+ *
+ * Basically this is an array which contains the 'top-level' directories in the
+ * WebDAV server.
+ */
+$nodes = [
+ // /principals
+ new \Sabre\CalDAV\Principal\Collection($principalBackend),
+ // /calendars
+ new \Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend),
+ // /addressbook
+ new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend),
+];
+
+// The object tree needs in turn to be passed to the server class
+$server = new \Sabre\DAV\Server($nodes);
+if (isset($baseUri)) $server->setBaseUri($baseUri);
+
+// Plugins
+$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
+$server->addPlugin(new \Sabre\DAV\Browser\Plugin());
+$server->addPlugin(new \Sabre\DAV\Sync\Plugin());
+$server->addPlugin(new \Sabre\DAV\Sharing\Plugin());
+$server->addPlugin(new \Sabre\DAVACL\Plugin());
+
+// CalDAV plugins
+$server->addPlugin(new \Sabre\CalDAV\Plugin());
+$server->addPlugin(new \Sabre\CalDAV\Schedule\Plugin());
+$server->addPlugin(new \Sabre\CalDAV\SharingPlugin());
+$server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
+
+// CardDAV plugins
+$server->addPlugin(new \Sabre\CardDAV\Plugin());
+$server->addPlugin(new \Sabre\CardDAV\VCFExportPlugin());
+
+// And off we go!
+$server->exec();
diff --git a/vendor/examples/minimal.php b/vendor/examples/minimal.php
new file mode 100644
index 000000000..4ac256064
--- /dev/null
+++ b/vendor/examples/minimal.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * This example shows the smallest possible sabre/dav server.
+ */
+include 'vendor/autoload.php';
+
+$server = new Sabre\DAV\Server([
+ new Sabre\DAV\FS\Directory(__DIR__)
+]);
+
+/**
+ * Ok. Perhaps not the smallest possible. The browser plugin is 100% optional,
+ * but it really helps understanding the server.
+ */
+$server->addPlugin(
+ new Sabre\DAV\Browser\Plugin()
+);
+
+$server->exec();
diff --git a/vendor/examples/sql/mysql.addressbooks.sql b/vendor/examples/sql/mysql.addressbooks.sql
new file mode 100644
index 000000000..9ec88babe
--- /dev/null
+++ b/vendor/examples/sql/mysql.addressbooks.sql
@@ -0,0 +1,28 @@
+CREATE TABLE addressbooks (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ principaluri VARBINARY(255),
+ displayname VARCHAR(255),
+ uri VARBINARY(200),
+ description TEXT,
+ synctoken INT(11) UNSIGNED NOT NULL DEFAULT '1',
+ UNIQUE(principaluri(100), uri(100))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE cards (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ addressbookid INT(11) UNSIGNED NOT NULL,
+ carddata MEDIUMBLOB,
+ uri VARBINARY(200),
+ lastmodified INT(11) UNSIGNED,
+ etag VARBINARY(32),
+ size INT(11) UNSIGNED NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE addressbookchanges (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ uri VARBINARY(200) NOT NULL,
+ synctoken INT(11) UNSIGNED NOT NULL,
+ addressbookid INT(11) UNSIGNED NOT NULL,
+ operation TINYINT(1) NOT NULL,
+ INDEX addressbookid_synctoken (addressbookid, synctoken)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
diff --git a/vendor/examples/sql/mysql.calendars.sql b/vendor/examples/sql/mysql.calendars.sql
new file mode 100644
index 000000000..21c5bcb44
--- /dev/null
+++ b/vendor/examples/sql/mysql.calendars.sql
@@ -0,0 +1,76 @@
+CREATE TABLE calendarobjects (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ calendardata MEDIUMBLOB,
+ uri VARBINARY(200),
+ calendarid INTEGER UNSIGNED NOT NULL,
+ lastmodified INT(11) UNSIGNED,
+ etag VARBINARY(32),
+ size INT(11) UNSIGNED NOT NULL,
+ componenttype VARBINARY(8),
+ firstoccurence INT(11) UNSIGNED,
+ lastoccurence INT(11) UNSIGNED,
+ uid VARBINARY(200),
+ UNIQUE(calendarid, uri),
+ INDEX calendarid_time (calendarid, firstoccurence)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE calendars (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ synctoken INTEGER UNSIGNED NOT NULL DEFAULT '1',
+ components VARBINARY(21)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE calendarinstances (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ calendarid INTEGER UNSIGNED NOT NULL,
+ principaluri VARBINARY(100),
+ access TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1 = owner, 2 = read, 3 = readwrite',
+ displayname VARCHAR(100),
+ uri VARBINARY(200),
+ description TEXT,
+ calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ calendarcolor VARBINARY(10),
+ timezone TEXT,
+ transparent TINYINT(1) NOT NULL DEFAULT '0',
+ share_href VARBINARY(100),
+ share_displayname VARCHAR(100),
+ share_invitestatus TINYINT(1) NOT NULL DEFAULT '2' COMMENT '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid',
+ UNIQUE(principaluri, uri),
+ UNIQUE(calendarid, principaluri),
+ UNIQUE(calendarid, share_href)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE calendarchanges (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ uri VARBINARY(200) NOT NULL,
+ synctoken INT(11) UNSIGNED NOT NULL,
+ calendarid INT(11) UNSIGNED NOT NULL,
+ operation TINYINT(1) NOT NULL,
+ INDEX calendarid_synctoken (calendarid, synctoken)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE calendarsubscriptions (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ uri VARBINARY(200) NOT NULL,
+ principaluri VARBINARY(100) NOT NULL,
+ source TEXT,
+ displayname VARCHAR(100),
+ refreshrate VARCHAR(10),
+ calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ calendarcolor VARBINARY(10),
+ striptodos TINYINT(1) NULL,
+ stripalarms TINYINT(1) NULL,
+ stripattachments TINYINT(1) NULL,
+ lastmodified INT(11) UNSIGNED,
+ UNIQUE(principaluri, uri)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE schedulingobjects (
+ id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ principaluri VARBINARY(255),
+ calendardata MEDIUMBLOB,
+ uri VARBINARY(200),
+ lastmodified INT(11) UNSIGNED,
+ etag VARBINARY(32),
+ size INT(11) UNSIGNED NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
diff --git a/vendor/examples/sql/mysql.locks.sql b/vendor/examples/sql/mysql.locks.sql
new file mode 100644
index 000000000..96a3a88d9
--- /dev/null
+++ b/vendor/examples/sql/mysql.locks.sql
@@ -0,0 +1,12 @@
+CREATE TABLE locks (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ owner VARCHAR(100),
+ timeout INTEGER UNSIGNED,
+ created INTEGER,
+ token VARBINARY(100),
+ scope TINYINT,
+ depth TINYINT,
+ uri VARBINARY(1000),
+ INDEX(token),
+ INDEX(uri(100))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
diff --git a/vendor/examples/sql/mysql.principals.sql b/vendor/examples/sql/mysql.principals.sql
new file mode 100644
index 000000000..ea0d16a27
--- /dev/null
+++ b/vendor/examples/sql/mysql.principals.sql
@@ -0,0 +1,20 @@
+CREATE TABLE principals (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ uri VARBINARY(200) NOT NULL,
+ email VARBINARY(80),
+ displayname VARCHAR(80),
+ UNIQUE(uri)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE groupmembers (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ principal_id INTEGER UNSIGNED NOT NULL,
+ member_id INTEGER UNSIGNED NOT NULL,
+ UNIQUE(principal_id, member_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+INSERT INTO principals (uri,email,displayname) VALUES
+('principals/admin', 'admin@example.org','Administrator'),
+('principals/admin/calendar-proxy-read', null, null),
+('principals/admin/calendar-proxy-write', null, null);
+
diff --git a/vendor/examples/sql/mysql.propertystorage.sql b/vendor/examples/sql/mysql.propertystorage.sql
new file mode 100644
index 000000000..1b5ca5ac6
--- /dev/null
+++ b/vendor/examples/sql/mysql.propertystorage.sql
@@ -0,0 +1,9 @@
+CREATE TABLE propertystorage (
+ id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ path VARBINARY(1024) NOT NULL,
+ name VARBINARY(100) NOT NULL,
+ valuetype INT UNSIGNED,
+ value MEDIUMBLOB
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE UNIQUE INDEX path_property ON propertystorage (path(600), name(100));
diff --git a/vendor/examples/sql/mysql.users.sql b/vendor/examples/sql/mysql.users.sql
new file mode 100644
index 000000000..22ac312d5
--- /dev/null
+++ b/vendor/examples/sql/mysql.users.sql
@@ -0,0 +1,9 @@
+CREATE TABLE users (
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ username VARBINARY(50),
+ digesta1 VARBINARY(32),
+ UNIQUE(username)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+INSERT INTO users (username,digesta1) VALUES
+('admin', '87fd274b7b6c01e48d7c2f965da8ddf7');
diff --git a/vendor/examples/sql/pgsql.addressbooks.sql b/vendor/examples/sql/pgsql.addressbooks.sql
new file mode 100644
index 000000000..98f414f42
--- /dev/null
+++ b/vendor/examples/sql/pgsql.addressbooks.sql
@@ -0,0 +1,44 @@
+CREATE TABLE addressbooks (
+ id SERIAL NOT NULL,
+ principaluri VARCHAR(255),
+ displayname VARCHAR(255),
+ uri VARCHAR(200),
+ description TEXT,
+ synctoken INTEGER NOT NULL DEFAULT 1
+);
+
+ALTER TABLE ONLY addressbooks
+ ADD CONSTRAINT addressbooks_pkey PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX addressbooks_ukey
+ ON addressbooks USING btree (principaluri, uri);
+
+CREATE TABLE cards (
+ id SERIAL NOT NULL,
+ addressbookid INTEGER NOT NULL,
+ carddata BYTEA,
+ uri VARCHAR(200),
+ lastmodified INTEGER,
+ etag VARCHAR(32),
+ size INTEGER NOT NULL
+);
+
+ALTER TABLE ONLY cards
+ ADD CONSTRAINT cards_pkey PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX cards_ukey
+ ON cards USING btree (addressbookid, uri);
+
+CREATE TABLE addressbookchanges (
+ id SERIAL NOT NULL,
+ uri VARCHAR(200) NOT NULL,
+ synctoken INTEGER NOT NULL,
+ addressbookid INTEGER NOT NULL,
+ operation SMALLINT NOT NULL
+);
+
+ALTER TABLE ONLY addressbookchanges
+ ADD CONSTRAINT addressbookchanges_pkey PRIMARY KEY (id);
+
+CREATE INDEX addressbookchanges_addressbookid_synctoken_ix
+ ON addressbookchanges USING btree (addressbookid, synctoken);
diff --git a/vendor/examples/sql/pgsql.calendars.sql b/vendor/examples/sql/pgsql.calendars.sql
new file mode 100644
index 000000000..67dc41a5a
--- /dev/null
+++ b/vendor/examples/sql/pgsql.calendars.sql
@@ -0,0 +1,105 @@
+CREATE TABLE calendarobjects (
+ id SERIAL NOT NULL,
+ calendardata BYTEA,
+ uri VARCHAR(200),
+ calendarid INTEGER NOT NULL,
+ lastmodified INTEGER,
+ etag VARCHAR(32),
+ size INTEGER NOT NULL,
+ componenttype VARCHAR(8),
+ firstoccurence INTEGER,
+ lastoccurence INTEGER,
+ uid VARCHAR(200)
+);
+
+ALTER TABLE ONLY calendarobjects
+ ADD CONSTRAINT calendarobjects_pkey PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX calendarobjects_ukey
+ ON calendarobjects USING btree (calendarid, uri);
+
+
+CREATE TABLE calendars (
+ id SERIAL NOT NULL,
+ synctoken INTEGER NOT NULL DEFAULT 1,
+ components VARCHAR(21)
+);
+
+ALTER TABLE ONLY calendars
+ ADD CONSTRAINT calendars_pkey PRIMARY KEY (id);
+
+
+CREATE TABLE calendarinstances (
+ id SERIAL NOT NULL,
+ calendarid INTEGER NOT NULL,
+ principaluri VARCHAR(100),
+ access SMALLINT NOT NULL DEFAULT '1', -- '1 = owner, 2 = read, 3 = readwrite'
+ displayname VARCHAR(100),
+ uri VARCHAR(200),
+ description TEXT,
+ calendarorder INTEGER NOT NULL DEFAULT 0,
+ calendarcolor VARCHAR(10),
+ timezone TEXT,
+ transparent SMALLINT NOT NULL DEFAULT '0',
+ share_href VARCHAR(100),
+ share_displayname VARCHAR(100),
+ share_invitestatus SMALLINT NOT NULL DEFAULT '2' -- '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid'
+);
+
+ALTER TABLE ONLY calendarinstances
+ ADD CONSTRAINT calendarinstances_pkey PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX calendarinstances_principaluri_uri
+ ON calendarinstances USING btree (principaluri, uri);
+
+
+CREATE UNIQUE INDEX calendarinstances_principaluri_calendarid
+ ON calendarinstances USING btree (principaluri, calendarid);
+
+CREATE UNIQUE INDEX calendarinstances_principaluri_share_href
+ ON calendarinstances USING btree (principaluri, share_href);
+
+CREATE TABLE calendarsubscriptions (
+ id SERIAL NOT NULL,
+ uri VARCHAR(200) NOT NULL,
+ principaluri VARCHAR(100) NOT NULL,
+ source TEXT,
+ displayname VARCHAR(100),
+ refreshrate VARCHAR(10),
+ calendarorder INTEGER NOT NULL DEFAULT 0,
+ calendarcolor VARCHAR(10),
+ striptodos SMALLINT NULL,
+ stripalarms SMALLINT NULL,
+ stripattachments SMALLINT NULL,
+ lastmodified INTEGER
+);
+
+ALTER TABLE ONLY calendarsubscriptions
+ ADD CONSTRAINT calendarsubscriptions_pkey PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX calendarsubscriptions_ukey
+ ON calendarsubscriptions USING btree (principaluri, uri);
+
+CREATE TABLE calendarchanges (
+ id SERIAL NOT NULL,
+ uri VARCHAR(200) NOT NULL,
+ synctoken INTEGER NOT NULL,
+ calendarid INTEGER NOT NULL,
+ operation SMALLINT NOT NULL DEFAULT 0
+);
+
+ALTER TABLE ONLY calendarchanges
+ ADD CONSTRAINT calendarchanges_pkey PRIMARY KEY (id);
+
+CREATE INDEX calendarchanges_calendarid_synctoken_ix
+ ON calendarchanges USING btree (calendarid, synctoken);
+
+CREATE TABLE schedulingobjects (
+ id SERIAL NOT NULL,
+ principaluri VARCHAR(255),
+ calendardata BYTEA,
+ uri VARCHAR(200),
+ lastmodified INTEGER,
+ etag VARCHAR(32),
+ size INTEGER NOT NULL
+);
diff --git a/vendor/examples/sql/pgsql.locks.sql b/vendor/examples/sql/pgsql.locks.sql
new file mode 100644
index 000000000..0290528ce
--- /dev/null
+++ b/vendor/examples/sql/pgsql.locks.sql
@@ -0,0 +1,19 @@
+CREATE TABLE locks (
+ id SERIAL NOT NULL,
+ owner VARCHAR(100),
+ timeout INTEGER,
+ created INTEGER,
+ token VARCHAR(100),
+ scope SMALLINT,
+ depth SMALLINT,
+ uri TEXT
+);
+
+ALTER TABLE ONLY locks
+ ADD CONSTRAINT locks_pkey PRIMARY KEY (id);
+
+CREATE INDEX locks_token_ix
+ ON locks USING btree (token);
+
+CREATE INDEX locks_uri_ix
+ ON locks USING btree (uri);
diff --git a/vendor/examples/sql/pgsql.principals.sql b/vendor/examples/sql/pgsql.principals.sql
new file mode 100644
index 000000000..5a65260a2
--- /dev/null
+++ b/vendor/examples/sql/pgsql.principals.sql
@@ -0,0 +1,30 @@
+CREATE TABLE principals (
+ id SERIAL NOT NULL,
+ uri VARCHAR(200) NOT NULL,
+ email VARCHAR(80),
+ displayname VARCHAR(80)
+);
+
+ALTER TABLE ONLY principals
+ ADD CONSTRAINT principals_pkey PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX principals_ukey
+ ON principals USING btree (uri);
+
+CREATE TABLE groupmembers (
+ id SERIAL NOT NULL,
+ principal_id INTEGER NOT NULL,
+ member_id INTEGER NOT NULL
+);
+
+ALTER TABLE ONLY groupmembers
+ ADD CONSTRAINT groupmembers_pkey PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX groupmembers_ukey
+ ON groupmembers USING btree (principal_id, member_id);
+
+INSERT INTO principals (uri,email,displayname) VALUES
+('principals/admin', 'admin@example.org','Administrator'),
+('principals/admin/calendar-proxy-read', null, null),
+('principals/admin/calendar-proxy-write', null, null);
+
diff --git a/vendor/examples/sql/pgsql.propertystorage.sql b/vendor/examples/sql/pgsql.propertystorage.sql
new file mode 100644
index 000000000..d1463faae
--- /dev/null
+++ b/vendor/examples/sql/pgsql.propertystorage.sql
@@ -0,0 +1,13 @@
+CREATE TABLE propertystorage (
+ id SERIAL NOT NULL,
+ path VARCHAR(1024) NOT NULL,
+ name VARCHAR(100) NOT NULL,
+ valuetype INT,
+ value BYTEA
+);
+
+ALTER TABLE ONLY propertystorage
+ ADD CONSTRAINT propertystorage_pkey PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX propertystorage_ukey
+ ON propertystorage (path, name);
diff --git a/vendor/examples/sql/pgsql.users.sql b/vendor/examples/sql/pgsql.users.sql
new file mode 100644
index 000000000..9d6047b8c
--- /dev/null
+++ b/vendor/examples/sql/pgsql.users.sql
@@ -0,0 +1,14 @@
+CREATE TABLE users (
+ id SERIAL NOT NULL,
+ username VARCHAR(50),
+ digesta1 VARCHAR(32)
+);
+
+ALTER TABLE ONLY users
+ ADD CONSTRAINT users_pkey PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX users_ukey
+ ON users USING btree (username);
+
+INSERT INTO users (username,digesta1) VALUES
+('admin', '87fd274b7b6c01e48d7c2f965da8ddf7');
diff --git a/vendor/examples/sql/sqlite.addressbooks.sql b/vendor/examples/sql/sqlite.addressbooks.sql
new file mode 100644
index 000000000..0baed8bfb
--- /dev/null
+++ b/vendor/examples/sql/sqlite.addressbooks.sql
@@ -0,0 +1,28 @@
+CREATE TABLE addressbooks (
+ id integer primary key asc NOT NULL,
+ principaluri text NOT NULL,
+ displayname text,
+ uri text NOT NULL,
+ description text,
+ synctoken integer DEFAULT 1 NOT NULL
+);
+
+CREATE TABLE cards (
+ id integer primary key asc NOT NULL,
+ addressbookid integer NOT NULL,
+ carddata blob,
+ uri text NOT NULL,
+ lastmodified integer,
+ etag text,
+ size integer
+);
+
+CREATE TABLE addressbookchanges (
+ id integer primary key asc NOT NULL,
+ uri text,
+ synctoken integer NOT NULL,
+ addressbookid integer NOT NULL,
+ operation integer NOT NULL
+);
+
+CREATE INDEX addressbookid_synctoken ON addressbookchanges (addressbookid, synctoken);
diff --git a/vendor/examples/sql/sqlite.calendars.sql b/vendor/examples/sql/sqlite.calendars.sql
new file mode 100644
index 000000000..1c8070496
--- /dev/null
+++ b/vendor/examples/sql/sqlite.calendars.sql
@@ -0,0 +1,76 @@
+CREATE TABLE calendarobjects (
+ id integer primary key asc NOT NULL,
+ calendardata blob NOT NULL,
+ uri text NOT NULL,
+ calendarid integer NOT NULL,
+ lastmodified integer NOT NULL,
+ etag text NOT NULL,
+ size integer NOT NULL,
+ componenttype text,
+ firstoccurence integer,
+ lastoccurence integer,
+ uid text
+);
+
+CREATE TABLE calendars (
+ id integer primary key asc NOT NULL,
+ synctoken integer DEFAULT 1 NOT NULL,
+ components text NOT NULL
+);
+
+CREATE TABLE calendarinstances (
+ id integer primary key asc NOT NULL,
+ calendarid integer NOT NULL,
+ principaluri text NULL,
+ access integer COMMENT '1 = owner, 2 = read, 3 = readwrite' NOT NULL DEFAULT '1',
+ displayname text,
+ uri text NOT NULL,
+ description text,
+ calendarorder integer,
+ calendarcolor text,
+ timezone text,
+ transparent bool,
+ share_href text,
+ share_displayname text,
+ share_invitestatus integer DEFAULT '2',
+ UNIQUE (principaluri, uri),
+ UNIQUE (calendarid, principaluri),
+ UNIQUE (calendarid, share_href)
+);
+
+CREATE TABLE calendarchanges (
+ id integer primary key asc NOT NULL,
+ uri text,
+ synctoken integer NOT NULL,
+ calendarid integer NOT NULL,
+ operation integer NOT NULL
+);
+
+CREATE INDEX calendarid_synctoken ON calendarchanges (calendarid, synctoken);
+
+CREATE TABLE calendarsubscriptions (
+ id integer primary key asc NOT NULL,
+ uri text NOT NULL,
+ principaluri text NOT NULL,
+ source text NOT NULL,
+ displayname text,
+ refreshrate text,
+ calendarorder integer,
+ calendarcolor text,
+ striptodos bool,
+ stripalarms bool,
+ stripattachments bool,
+ lastmodified int
+);
+
+CREATE TABLE schedulingobjects (
+ id integer primary key asc NOT NULL,
+ principaluri text NOT NULL,
+ calendardata blob,
+ uri text NOT NULL,
+ lastmodified integer,
+ etag text NOT NULL,
+ size integer NOT NULL
+);
+
+CREATE INDEX principaluri_uri ON calendarsubscriptions (principaluri, uri);
diff --git a/vendor/examples/sql/sqlite.locks.sql b/vendor/examples/sql/sqlite.locks.sql
new file mode 100644
index 000000000..622baea42
--- /dev/null
+++ b/vendor/examples/sql/sqlite.locks.sql
@@ -0,0 +1,12 @@
+BEGIN TRANSACTION;
+CREATE TABLE locks (
+ id integer primary key asc NOT NULL,
+ owner text,
+ timeout integer,
+ created integer,
+ token text,
+ scope integer,
+ depth integer,
+ uri text
+);
+COMMIT;
diff --git a/vendor/examples/sql/sqlite.principals.sql b/vendor/examples/sql/sqlite.principals.sql
new file mode 100644
index 000000000..4105156f8
--- /dev/null
+++ b/vendor/examples/sql/sqlite.principals.sql
@@ -0,0 +1,20 @@
+CREATE TABLE principals (
+ id INTEGER PRIMARY KEY ASC NOT NULL,
+ uri TEXT NOT NULL,
+ email TEXT,
+ displayname TEXT,
+ UNIQUE(uri)
+);
+
+CREATE TABLE groupmembers (
+ id INTEGER PRIMARY KEY ASC NOT NULL,
+ principal_id INTEGER NOT NULL,
+ member_id INTEGER NOT NULL,
+ UNIQUE(principal_id, member_id)
+);
+
+
+INSERT INTO principals (uri,email,displayname) VALUES ('principals/admin', 'admin@example.org','Administrator');
+INSERT INTO principals (uri,email,displayname) VALUES ('principals/admin/calendar-proxy-read', null, null);
+INSERT INTO principals (uri,email,displayname) VALUES ('principals/admin/calendar-proxy-write', null, null);
+
diff --git a/vendor/examples/sql/sqlite.propertystorage.sql b/vendor/examples/sql/sqlite.propertystorage.sql
new file mode 100644
index 000000000..72e860ce3
--- /dev/null
+++ b/vendor/examples/sql/sqlite.propertystorage.sql
@@ -0,0 +1,10 @@
+CREATE TABLE propertystorage (
+ id integer primary key asc NOT NULL,
+ path text NOT NULL,
+ name text NOT NULL,
+ valuetype integer NOT NULL,
+ value string
+);
+
+
+CREATE UNIQUE INDEX path_property ON propertystorage (path, name);
diff --git a/vendor/examples/sql/sqlite.users.sql b/vendor/examples/sql/sqlite.users.sql
new file mode 100644
index 000000000..5597b058a
--- /dev/null
+++ b/vendor/examples/sql/sqlite.users.sql
@@ -0,0 +1,9 @@
+CREATE TABLE users (
+ id integer primary key asc NOT NULL,
+ username TEXT NOT NULL,
+ digesta1 TEXT NOT NULL,
+ UNIQUE(username)
+);
+
+INSERT INTO users (username,digesta1) VALUES
+('admin', '87fd274b7b6c01e48d7c2f965da8ddf7');
diff --git a/vendor/examples/webserver/apache2_htaccess.conf b/vendor/examples/webserver/apache2_htaccess.conf
new file mode 100644
index 000000000..c5f29ba80
--- /dev/null
+++ b/vendor/examples/webserver/apache2_htaccess.conf
@@ -0,0 +1,16 @@
+RewriteEngine On
+# This makes every request go to server.php
+RewriteRule (.*) server.php [L]
+
+# Output buffering needs to be off, to prevent high memory usage
+php_flag output_buffering off
+
+# This is also to prevent high memory usage
+php_flag always_populate_raw_post_data off
+
+# This is almost a given, but magic quotes is *still* on on some
+# linux distributions
+php_flag magic_quotes_gpc off
+
+# SabreDAV is not compatible with mbstring function overloading
+php_flag mbstring.func_overload off
diff --git a/vendor/examples/webserver/apache2_vhost.conf b/vendor/examples/webserver/apache2_vhost.conf
new file mode 100644
index 000000000..74289641e
--- /dev/null
+++ b/vendor/examples/webserver/apache2_vhost.conf
@@ -0,0 +1,29 @@
+# This is a sample configuration to setup a dedicated Apache vhost for WebDAV.
+#
+# The main thing that should be configured is the servername, and the path to
+# your SabreDAV installation (DocumentRoot).
+#
+# This configuration assumed mod_php5 is used, as it sets a few default php
+# settings as well.
+<VirtualHost *:*>
+
+ # Don't forget to change the server name
+ # ServerName dav.example.org
+
+ # The DocumentRoot is also required
+ # DocumentRoot /home/sabredav/
+
+ RewriteEngine On
+ # This makes every request go to server.php
+ RewriteRule ^/(.*)$ /server.php [L]
+
+ # Output buffering needs to be off, to prevent high memory usage
+ php_flag output_buffering off
+
+ # This is also to prevent high memory usage
+ php_flag always_populate_raw_post_data off
+
+ # SabreDAV is not compatible with mbstring function overloading
+ php_flag mbstring.func_overload off
+
+</VirtualHost *:*>
diff --git a/vendor/examples/webserver/apache2_vhost_cgi.conf b/vendor/examples/webserver/apache2_vhost_cgi.conf
new file mode 100644
index 000000000..607254c6e
--- /dev/null
+++ b/vendor/examples/webserver/apache2_vhost_cgi.conf
@@ -0,0 +1,21 @@
+# This is a sample configuration to setup a dedicated Apache vhost for WebDAV.
+#
+# The main thing that should be configured is the servername, and the path to
+# your SabreDAV installation (DocumentRoot).
+#
+# This configuration assumes CGI or FastCGI is used.
+<VirtualHost *:*>
+
+ # Don't forget to change the server name
+ # ServerName dav.example.org
+
+ # The DocumentRoot is also required
+ # DocumentRoot /home/sabredav/
+
+ # This makes every request go to server.php. This also makes sure
+ # the Authentication information is available. If your server script is
+ # not called server.php, be sure to change it.
+ RewriteEngine On
+ RewriteRule ^/(.*)$ /server.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+
+</VirtualHost *:*>