-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.php
46 lines (34 loc) · 1.9 KB
/
api.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
<?php
chdir("../../../../../../../");
// Prevent a general redirect to the login screen for anonymous users.
// The checker will show an error page with login link instead
// (see ilInitialisation::InitILIAS() for details)
$_GET["baseClass"] = "ilStartUpGUI";
$basename = "/Customizing/global/plugins/Services/Repository/RepositoryObject/Opencast/api.php";
// Define a pseudo module to get a correct ILIAS_HTTP_PATH
// (needed for links on the error page).
// "data" is assumed to be the ILIAS_WEB_DIR
// (see ilInitialisation::buildHTTPPath() for details)
define("ILIAS_MODULE", substr($_SERVER['PHP_SELF'], strpos($_SERVER['PHP_SELF'], $basename) + strlen($basename) + 1));
// Define the cookie path to prevent a different session created for web access
// (see ilInitialisation::setCookieParams() for details)
$GLOBALS['COOKIE_PATH'] = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], $basename));
// Remember if the initial session was empty
// Then a new session record should not be written
// (see ilSession::_writeData for details)
$GLOBALS['WEB_ACCESS_WITHOUT_SESSION'] = (session_id() == "");
include_once "Services/Context/classes/class.ilContext.php";
ilContext::init(ilContext::CONTEXT_WAC);
// Now the ILIAS header can be included
require_once "./include/inc.header.php";
require_once "./Services/Utilities/classes/class.ilUtil.php";
require_once "./Services/Object/classes/class.ilObject.php";
require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
require_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Opencast/classes/api/class.ilAPIController.php";
$uri = parse_url($_SERVER['REQUEST_URI']);
$method = $_SERVER['REQUEST_METHOD'];
$api = new \TIK_NFL\ilias_oc_plugin\api\ilAPIController($uri, $method);
// get the requested file and its type
$path = substr($uri["path"], strpos($uri["path"], $basename) + strlen($basename));
$api->handleRequest($path);
?>