ILIAS
release_10 Revision v10.1-43-ga1241a92c2f
◀ ilDoc Overview
xapiproxy.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
// hardcoded namespace
22
// attention: maybe a problem with composer v2 / psr4 autoload requires exact matching of namespace and parent folder name?
23
24
namespace
XapiProxy
;
25
26
// hardcoded context for better performance
27
// $plugin = file_exists(__DIR__."/plugin.php"); // for testing
28
$plugin
=
false
;
29
33
if
(strtoupper(
$_SERVER
[
"REQUEST_METHOD"
]) ==
"OPTIONS"
) {
34
header
(
'HTTP/1.1 204 No Content'
);
35
header
(
'Access-Control-Allow-Origin: '
.
$_SERVER
[
"HTTP_ORIGIN"
]);
36
header
(
'Access-Control-Allow-Credentials: true'
);
37
header
(
'Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS'
);
38
header
(
'Access-Control-Allow-Headers: X-Experience-API-Version,Accept,Authorization,Etag,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With'
);
39
exit
;
40
}
41
45
if
(!empty(
$_SERVER
[
'PHP_AUTH_USER'
]) && !empty(
$_SERVER
[
'PHP_AUTH_PW'
])) {
46
$client
=
$_SERVER
[
'PHP_AUTH_USER'
];
47
$token
=
$_SERVER
[
'PHP_AUTH_PW'
];
48
} elseif (!empty(
$_SERVER
[
'HTTP_AUTHORIZATION'
])) {
49
$basicAuth = explode(
':'
, base64_decode(substr(
$_SERVER
[
'HTTP_AUTHORIZATION'
], 6)));
50
$client
= $basicAuth[0];
51
$token
= $basicAuth[1];
52
}
else
{
53
header
(
'HTTP/1.1 401 Authorization Required'
);
54
header
(
'Access-Control-Allow-Origin: '
.
$_SERVER
[
"HTTP_ORIGIN"
]);
55
header
(
'Access-Control-Allow-Credentials: true'
);
56
header
(
'Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS'
);
57
header
(
'Access-Control-Allow-Headers: X-Experience-API-Version,Accept,Authorization,Etag,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With'
);
58
exit
;
59
}
60
61
require_once
'../vendor/composer/vendor/autoload.php'
;
62
//instead of DataService
63
\ilContext::init
(\
ilContext::CONTEXT_SCORM
);
64
ilInitialisation::initILIAS
();
65
// DataService::initIlias($client);
66
$dic
=
$GLOBALS
[
'DIC'
];
67
68
$xapiproxy
=
new
XapiProxy
(
$client
,
$token
,
$plugin
);
69
73
try
{
74
$xapiproxy
->initLrs();
75
}
catch
(\
Exception
$e
) {
76
$xapiproxy
->log()->error($e->getMessage());
77
}
78
$req
=
new
XapiProxyRequest
(
$xapiproxy
);
79
$resp
=
new
XapiProxyResponse
(
$xapiproxy
);
80
81
$xapiproxy
->setXapiProxyRequest(
$req
);
82
$xapiproxy
->setXapiProxyResponse(
$resp
);
83
84
$req
->handle();
XapiProxy\XapiProxyRequest
Definition:
XapiProxyRequest.php:30
XapiProxy\exit
exit
Definition:
xapiproxy.php:58
XapiProxy\XapiProxyResponse
Definition:
XapiProxyResponse.php:27
ilContext\CONTEXT_SCORM
const CONTEXT_SCORM
Definition:
class.ilContext.php:42
Vendor\Package\$e
$e
Definition:
example_cleaned.php:49
XapiProxy
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
DataService.php:21
XapiProxy\$xapiproxy
$xapiproxy
Definition:
xapiproxy.php:68
XapiProxy\$plugin
$plugin
Definition:
xapiproxy.php:28
XapiProxy\$req
catch(\Exception $e) $req
Definition:
xapiproxy.php:78
$client
$client
Definition:
dummy_client.php:43
ilInitialisation\initILIAS
static initILIAS()
ilias initialisation
Definition:
class.ilInitialisation.php:1153
$GLOBALS
$GLOBALS["DIC"]
Definition:
wac.php:30
$token
$token
Definition:
xapitoken.php:67
$_SERVER
$_SERVER['HTTP_HOST']
Definition:
raiseError.php:10
XapiProxy\$resp
$resp
Definition:
xapiproxy.php:79
ilContext\init
static init(string $a_type)
Init context by type.
Definition:
class.ilContext.php:52
$dic
$dic
Definition:
ltiresult.php:33
ILIAS\UI\examples\Symbol\Glyph\Header\header
header()
expected output: > ILIAS shows the rendered Component.
Definition:
header.php:13
Exception
components
ILIAS
CmiXapi
resources
xapiproxy.php
Generated on Wed Sep 10 2025 15:15:13 for ILIAS by
1.8.13 (using
Doxyfile
)