My favorites | Sign in
Project Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php

// {$Id$} //

// !!!! Make sure the Sabre directory is in the include_path !!!
// example:
set_include_path('lib/' . PATH_SEPARATOR . get_include_path());

/*

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';

// 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 = '/';

if (!isset($baseUri)) die('Please setup \$baseUri first!');

// Files we need
require_once 'Sabre.includes.php';

// Create the parent node
$publicDirObj = new Sabre_DAV_FS_Directory($publicDir);

// Now we create an ObjectTree, which dispatches all requests to your newly created file system
$objectTree = new Sabre_DAV_ObjectTree($publicDirObj);

// The object tree needs in turn to be passed to the server class
$server = new Sabre_DAV_Server($objectTree);
$server->setBaseUri($baseUri);

// Support for LOCK and UNLOCK
$lockBackend = new Sabre_DAV_Locks_Backend_FS($tmpDir);
$lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
$server->addPlugin($lockPlugin);

// Support for html frontend
$browser = new Sabre_DAV_Browser_Plugin();
$server->addPlugin($browser);

// Authentication backend
$authBackend = new Sabre_DAV_Auth_Backend_File('.htdigest');
$auth = new Sabre_DAV_Auth_Plugin($authBackend,'SabreDAV');
$server->addPlugin($auth);

// Temporary file filter
$tempFF = new Sabre_DAV_TemporaryFileFilterPlugin($tmpDir);
$server->addPlugin($tempFF);

// And off we go!
$server->exec();
Show details Hide details

Change log

r479 by evertpot on Jul 22, 2009   Diff
Fixed  Issue 9 
Go to: 
Sign in to write a code review

Older revisions

r465 by evertpot on Jul 16, 2009   Diff
Updated fileserver example
Removed streamwrapperserver example
r457 by evertpot on Jul 12, 2009   Diff
Adding $Id$ property to file that
didn't already have it
r456 by evertpot on Jul 12, 2009   Diff
Merging all changes back in from
refactoring branch
All revisions of this file

File info

Size: 1737 bytes, 61 lines

File properties

svn:keywords
Id
Hosted by Google Code