aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/examples/fileserver.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-05-29 00:33:28 +0200
committerMario Vavti <mario@mariovavti.com>2016-05-29 00:33:28 +0200
commitaab9766c53e42c3141d0497fce78977d262efbc1 (patch)
treef633ad641d818d6229ea7d14e72de42e739196de /vendor/examples/fileserver.php
parent66effbfe0827fc61fff6d248797a894213ad20d6 (diff)
downloadvolse-hubzilla-aab9766c53e42c3141d0497fce78977d262efbc1.tar.gz
volse-hubzilla-aab9766c53e42c3141d0497fce78977d262efbc1.tar.bz2
volse-hubzilla-aab9766c53e42c3141d0497fce78977d262efbc1.zip
missed some files
Diffstat (limited to 'vendor/examples/fileserver.php')
-rw-r--r--vendor/examples/fileserver.php56
1 files changed, 56 insertions, 0 deletions
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();