forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webdav.php
55 lines (50 loc) · 1.96 KB
/
webdav.php
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
<?php
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
/**
* This script provides a WebDAV interface for the ILIAS repository.
*
* @author Werner Randelshofer, Hochschule Luzern, [email protected]
* @version $Id: class.ilDAVServer.php,v 1.0 2005/07/08 12:00:00 wrandelshofer Exp $
*
* @package webdav
*/
// Initialize
// -----------------------------------------------------
// Retrieve the client id from PATH_INFO
// Component 1 contains the ILIAS client_id.
require_once("Services/Init/classes/class.ilInitialisation.php");
$path_info_components = explode('/', $_SERVER['PATH_INFO']);
$client_id = $path_info_components[1];
$show_mount_instr = isset($_GET['mount-instructions']);
// Set context for authentication
ilAuthFactory::setContext(ilAuthFactory::CONTEXT_HTTP);
// Launch ILIAS using the client id we have determined
$_GET["client_id"] = $client_id;
include_once "Services/Context/classes/class.ilContext.php";
$context = ilContext::CONTEXT_WEBDAV;
ilContext::init($context);
ilInitialisation::initILIAS();
if (!ilDAVActivationChecker::_isActive()) {
header("HTTP/1.1 403 Forbidden");
header("X-WebDAV-Status: 403 Forbidden", true);
echo '<html><body><h1>Sorry</h1>' .
'<p><b>Please enable the WebDAV plugin in the ILIAS Administration panel.</b></p>' .
'<p>You can only access this page, if WebDAV is enabled on this server.</p>' .
'</body></html>';
exit;
}
if ($show_mount_instr) {
// Show mount instructions page for WebDAV
$f = new ilWebDAVMountInstructionsFactory(
new ilWebDAVMountInstructionsRepositoryImpl($DIC->database()),
$DIC->http()->request(),
$DIC->user()
);
$mount_instructions = $f->getMountInstructionsObject();
$mount_gui = new ilWebDAVMountInstructionsGUI($mount_instructions);
$mount_gui->renderMountInstructionsContent();
} else {
// Launch the WebDAV Server
$server = ilWebDAVRequestHandler::getInstance();
$server->handleRequest();
}