3 // !!!! Make sure the Sabre directory is in the include_path !!!
5 set_include_path('lib/' . PATH_SEPARATOR . get_include_path());
9 This is the best starting point if you're just interested in setting up a fileserver.
11 Make sure that the 'public' and 'tmpdata' exists, with write permissions
17 date_default_timezone_set('Canada/Eastern');
18 $publicDir = 'public';
21 // If you want to run the SabreDAV server in a custom location (using mod_rewrite for instance)
22 // You can override the baseUri here.
27 require_once 'Sabre/autoload.php';
29 // Create the root node
30 $root = new Sabre_DAV_FS_Directory($publicDir);
32 // The rootnode needs in turn to be passed to the server class
33 $server = new Sabre_DAV_Server($root);
36 $server->setBaseUri($baseUri);
38 // Support for LOCK and UNLOCK
39 $lockBackend = new Sabre_DAV_Locks_Backend_File($tmpDir . '/locksdb');
40 $lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
41 $server->addPlugin($lockPlugin);
43 // Support for html frontend
44 $browser = new Sabre_DAV_Browser_Plugin();
45 $server->addPlugin($browser);
47 // Automatically guess (some) contenttypes, based on extesion
48 $server->addPlugin(new Sabre_DAV_Browser_GuessContentType());
50 // Authentication backend
51 $authBackend = new Sabre_DAV_Auth_Backend_File('.htdigest');
52 $auth = new Sabre_DAV_Auth_Plugin($authBackend,'SabreDAV');
53 $server->addPlugin($auth);
55 // Temporary file filter
56 $tempFF = new Sabre_DAV_TemporaryFileFilterPlugin($tmpDir);
57 $server->addPlugin($tempFF);