-
Notifications
You must be signed in to change notification settings - Fork 2
/
davsrv.module
64 lines (52 loc) · 1.46 KB
/
davsrv.module
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
62
63
64
<?php
require_once(dirname(__FILE__).'/vendors/IMAG/Autoloader/Autoloader.php');
require_once(dirname(__FILE__).'/vendors/ezcomponents/Base/src/base.php');
use IMAG\Autoloader\Autoloader,
IMAG\davSrv\Backend\Backend,
IMAG\davSrv\Router\Router,
IMAG\davSrv\Authentication\Authentication
;
$loader = new Autoloader();
$loader->register();
spl_autoload_register("ezcBase::autoload");
define("DRUPAL_WEBDAV_URL", 'davsrv');
define("DOCUMENT_ROOT", '/sharing');
/**
* Implementation of hook_menu
*/
function davsrv_menu() {
$items = array (
DRUPAL_WEBDAV_URL => array (
'page callback' => 'entry_point',
'type' => MENU_CALLBACK,
'access arguments' => array('access content'),
),
);
return $items;
}
/**
* Implementation of hook_permission
*/
function davsrv_permission() {
return array (
'Webdav access' => array (
'title' => t('Webdav access'),
'restrict access' => true
)
);
}
function entry_point() {
$server = ezcWebdavServer::getInstance();
$router = new Router();
$router
->setDrupalUrlRoot(DRUPAL_WEBDAV_URL)
->setDocumentRoot(DOCUMENT_ROOT)
// ->setRootCollection(array('sharing', 'partage'))
;
$server->auth = new Authentication($router);
$backend = Backend::getInstance()
->setRouter($router)
// ->setExtensionCheck()
;
$server->handle($backend);
}