ILIAS  release_8 Revision v8.24
Util.php
Go to the documentation of this file.
1<?php
2
20
22
23final class Util
24{
28 public const LTI_VERSION1 = 'LTI-1p0';
29
33 public const LTI_VERSION1P3 = '1.3.0';
34
38 public const LTI_VERSION2 = 'LTI-2p0';
39
43 public const JWT_CLAIM_PREFIX = 'https://purl.imsglobal.org/spec/lti';
44
48 public const MESSAGE_TYPE_MAPPING = array(
49 'basic-lti-launch-request' => 'LtiResourceLinkRequest',
50 'ContentItemSelectionRequest' => 'LtiDeepLinkingRequest',
51 'ContentItemSelection' => 'LtiDeepLinkingResponse',
52 'ContentItemUpdateRequest' => 'LtiDeepLinkingUpdateRequest'
53 );
54
58 public const JWT_CLAIM_MAPPING = array(
59 'accept_types' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'accept_types', 'isArray' => true),
60 'accept_copy_advice' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'copyAdvice', 'isBoolean' => true),
61 'accept_media_types' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'accept_media_types'),
62 'accept_multiple' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'accept_multiple', 'isBoolean' => true),
63 'accept_presentation_document_targets' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'accept_presentation_document_targets', 'isArray' => true),
64 'accept_unsigned' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'accept_unsigned', 'isBoolean' => true),
65 'auto_create' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'auto_create', 'isBoolean' => true),
66 'can_confirm' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'can_confirm'),
67 'content_item_return_url' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'deep_link_return_url'),
68 'content_items' => array('suffix' => 'dl', 'group' => '', 'claim' => 'content_items', 'isObject' => true),
69 'data' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'data'),
70 'data.LtiDeepLinkingResponse' => array('suffix' => 'dl', 'group' => '', 'claim' => 'data'),
71 'text' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'text'),
72 'title' => array('suffix' => 'dl', 'group' => 'deep_linking_settings', 'claim' => 'title'),
73 'lti_msg' => array('suffix' => 'dl', 'group' => '', 'claim' => 'msg'),
74 'lti_errormsg' => array('suffix' => 'dl', 'group' => '', 'claim' => 'errormsg'),
75 'lti_log' => array('suffix' => 'dl', 'group' => '', 'claim' => 'log'),
76 'lti_errorlog' => array('suffix' => 'dl', 'group' => '', 'claim' => 'errorlog'),
77 'context_id' => array('suffix' => '', 'group' => 'context', 'claim' => 'id'),
78 'context_label' => array('suffix' => '', 'group' => 'context', 'claim' => 'label'),
79 'context_title' => array('suffix' => '', 'group' => 'context', 'claim' => 'title'),
80 'context_type' => array('suffix' => '', 'group' => 'context', 'claim' => 'type', 'isArray' => true),
81 'lis_course_offering_sourcedid' => array('suffix' => '', 'group' => 'lis', 'claim' => 'course_offering_sourcedid'),
82 'lis_course_section_sourcedid' => array('suffix' => '', 'group' => 'lis', 'claim' => 'course_section_sourcedid'),
83 'launch_presentation_css_url' => array('suffix' => '', 'group' => 'launch_presentation', 'claim' => 'css_url'),
84 'launch_presentation_document_target' => array('suffix' => '', 'group' => 'launch_presentation', 'claim' => 'document_target'),
85 'launch_presentation_height' => array('suffix' => '', 'group' => 'launch_presentation', 'claim' => 'height'),
86 'launch_presentation_locale' => array('suffix' => '', 'group' => 'launch_presentation', 'claim' => 'locale'),
87 'launch_presentation_return_url' => array('suffix' => '', 'group' => 'launch_presentation', 'claim' => 'return_url'),
88 'launch_presentation_width' => array('suffix' => '', 'group' => 'launch_presentation', 'claim' => 'width'),
89 'lis_person_contact_email_primary' => array('suffix' => '', 'group' => null, 'claim' => 'email'),
90 'lis_person_name_family' => array('suffix' => '', 'group' => null, 'claim' => 'family_name'),
91 'lis_person_name_full' => array('suffix' => '', 'group' => null, 'claim' => 'name'),
92 'lis_person_name_given' => array('suffix' => '', 'group' => null, 'claim' => 'given_name'),
93 'lis_person_sourcedid' => array('suffix' => '', 'group' => 'lis', 'claim' => 'person_sourcedid'),
94 'user_id' => array('suffix' => '', 'group' => null, 'claim' => 'sub'),
95 'user_image' => array('suffix' => '', 'group' => null, 'claim' => 'picture'),
96 'roles' => array('suffix' => '', 'group' => '', 'claim' => 'roles', 'isArray' => true),
97 'platform_id' => array('suffix' => '', 'group' => null, 'claim' => 'iss'),
98 'deployment_id' => array('suffix' => '', 'group' => '', 'claim' => 'deployment_id'),
99 'lti_message_type' => array('suffix' => '', 'group' => '', 'claim' => 'message_type'),
100 'lti_version' => array('suffix' => '', 'group' => '', 'claim' => 'version'),
101 'resource_link_description' => array('suffix' => '', 'group' => 'resource_link', 'claim' => 'description'),
102 'resource_link_id' => array('suffix' => '', 'group' => 'resource_link', 'claim' => 'id'),
103 'resource_link_title' => array('suffix' => '', 'group' => 'resource_link', 'claim' => 'title'),
104 'target_link_uri' => array('suffix' => '', 'group' => '', 'claim' => 'target_link_uri'),
105 'tool_consumer_info_product_family_code' => array('suffix' => '', 'group' => 'tool_platform', 'claim' => 'product_family_code'),
106 'tool_consumer_info_version' => array('suffix' => '', 'group' => 'tool_platform', 'claim' => 'version'),
107 'tool_consumer_instance_contact_email' => array('suffix' => '', 'group' => 'tool_platform', 'claim' => 'contact_email'),
108 'tool_consumer_instance_description' => array('suffix' => '', 'group' => 'tool_platform', 'claim' => 'description'),
109 'tool_consumer_instance_guid' => array('suffix' => '', 'group' => 'tool_platform', 'claim' => 'guid'),
110 'tool_consumer_instance_name' => array('suffix' => '', 'group' => 'tool_platform', 'claim' => 'name'),
111 'tool_consumer_instance_url' => array('suffix' => '', 'group' => 'tool_platform', 'claim' => 'url'),
112 'tool_state' => array('suffix' => '', 'group' => 'tool', 'claim' => 'state'),
113 'custom_context_memberships_v2_url' => array('suffix' => 'nrps', 'group' => 'namesroleservice', 'claim' => 'context_memberships_url'),
114 'custom_nrps_versions' => array('suffix' => 'nrps', 'group' => 'namesroleservice', 'claim' => 'service_versions', 'isArray' => true),
115 'custom_lineitems_url' => array('suffix' => 'ags', 'group' => 'endpoint', 'claim' => 'lineitems'),
116 'custom_lineitem_url' => array('suffix' => 'ags', 'group' => 'endpoint', 'claim' => 'lineitem'),
117 'custom_ags_scopes' => array('suffix' => 'ags', 'group' => 'endpoint', 'claim' => 'scope', 'isArray' => true),
118 'custom_context_groups_url' => array('suffix' => 'gs', 'group' => 'groupsservice', 'claim' => 'context_groups_url'),
119 'custom_context_group_sets_url' => array('suffix' => 'gs', 'group' => 'groupsservice', 'claim' => 'context_group_sets_url'),
120 'custom_gs_scopes' => array('suffix' => 'gs', 'group' => 'groupsservice', 'claim' => 'scope', 'isArray' => true),
121 'custom_gs_versions' => array('suffix' => 'gs', 'group' => 'groupsservice', 'claim' => 'service_versions', 'isArray' => true),
122 'lis_outcome_service_url' => array('suffix' => 'bo', 'group' => 'basicoutcome', 'claim' => 'lis_outcome_service_url'),
123 'lis_result_sourcedid' => array('suffix' => 'bo', 'group' => 'basicoutcome', 'claim' => 'lis_result_sourcedid'),
124 'custom_ap_attempt_number' => array('suffix' => 'ap', 'group' => '', 'claim' => 'attempt_number', 'isInteger' => true),
125 'custom_ap_start_assessment_url' => array('suffix' => 'ap', 'group' => '', 'claim' => 'start_assessment_url'),
126 'custom_ap_session_data' => array('suffix' => 'ap', 'group' => '', 'claim' => 'session_data'),
127 'custom_ap_acs_actions' => array('suffix' => 'ap', 'group' => 'acs', 'claim' => 'actions', 'isArray' => true),
128 'custom_ap_acs_url' => array('suffix' => 'ap', 'group' => 'acs', 'claim' => 'assessment_control_url'),
129 'custom_ap_proctoring_settings_data' => array('suffix' => 'ap', 'group' => 'proctoring_settings', 'claim' => 'data'),
130 'custom_ap_email_verified' => array('suffix' => '', 'group' => null, 'claim' => 'email_verified', 'isBoolean' => true),
131 'custom_ap_verified_user_given_name' => array('suffix' => 'ap', 'group' => 'verified_user', 'claim' => 'given_name'),
132 'custom_ap_verified_user_family_name' => array('suffix' => 'ap', 'group' => 'verified_user', 'claim' => 'family_name'),
133 'custom_ap_verified_user_full_name' => array('suffix' => 'ap', 'group' => 'verified_user', 'claim' => 'full_name'),
134 'custom_ap_verified_user_image' => array('suffix' => 'ap', 'group' => 'verified_user', 'claim' => 'picture'),
135 'custom_ap_end_assessment_return' => array('suffix' => 'ap', 'group' => '', 'claim' => 'end_assessment_return', 'isBoolean' => true)
136 );
137
141 public const LOGLEVEL_NONE = 0;
142
146 public const LOGLEVEL_ERROR = 1;
147
151 public const LOGLEVEL_INFO = 2;
152
156 public const LOGLEVEL_DEBUG = 3;
157
161 public static array $LTI_VERSIONS = array(self::LTI_VERSION1, self::LTI_VERSION1P3, self::LTI_VERSION2);
162
166 public static array $METHOD_NAMES = array(
167 'basic-lti-launch-request' => 'onLaunch',
168 'ConfigureLaunchRequest' => 'onConfigure',
169 'DashboardRequest' => 'onDashboard',
170 'ContentItemSelectionRequest' => 'onContentItem',
171 'ContentItemSelection' => 'onContentItem',
172 'ContentItemUpdateRequest' => 'onContentItemUpdate',
173 'ToolProxyRegistrationRequest' => 'onRegister',
174 'LtiStartProctoring' => 'onLtiStartProctoring',
175 'LtiStartAssessment' => 'onLtiStartAssessment',
176 'LtiEndAssessment' => 'onLtiEndAssessment'
177 );
178
182 public static ?array $requestParameters = null;
183
189 public static int $logLevel = self::LOGLEVEL_NONE;
190
196 public static function isLtiMessage(): bool
197 {
198// $isLti = ($_SERVER['REQUEST_METHOD'] === 'POST') &&
199// (!empty($_POST['lti_message_type']) || !empty($_POST['id_token']) || !empty($_POST['JWT']) ||
200// !empty($_POST['iss']));
201// if (!$isLti) {
202// $isLti = ($_SERVER['REQUEST_METHOD'] === 'GET') && (!empty($_GET['iss']) || !empty($_GET['openid_configuration']));
203// }
204 global $DIC;
205 $wrapper = $DIC->http()->wrapper()->post();
206 $refString = $DIC->refinery()->kindlyTo()->string();
207 $isLti = ($wrapper->has('lti_message_type') && $wrapper->retrieve('lti_message_type', $refString) != '') ||
208 ($wrapper->has('id_token') && $wrapper->retrieve('id_token', $refString) != '') ||
209 ($wrapper->has('JWT') && $wrapper->retrieve('JWT', $refString) != '') ||
210 ($wrapper->has('iss') && $wrapper->retrieve('iss', $refString) != '');
211 if (!$isLti) {
212 $wrapper = $DIC->http()->wrapper()->query();
213 $isLti = ($wrapper->has('iss') && $wrapper->retrieve('iss', $refString) != '') ||
214 ($wrapper->has('openid_configuration') && $wrapper->retrieve('openid_configuration', $refString) != '');
215 }
216 return $isLti;
217 }
218
224 public static function getRequestParameters(): ?array
225 {
226 if (is_null(self::$requestParameters)) {
227// special for ILIAS instead of
228// self::$requestParameters = array_merge($_GET, $_POST);
229// also not possible
230// self::$requestParameters = array_merge(
231// //Argument 1 passed to Symfony\Component\HttpFoundation\Request::createRequestFromFactory() must be of the type array, object given
232// (array) \Symfony\Component\HttpFoundation\Request::createFromGlobals()->query->all(),
233// (array) \Symfony\Component\HttpFoundation\Request::createFromGlobals()->request->all()
234// (array) $_GET, (array) $_POST
235// );
236 global $DIC;
237 $post = $DIC->http()->wrapper()->post();
238 $query = $DIC->http()->wrapper()->query();
239 $refinery = $DIC->refinery()->kindlyTo()->string();
240
241 $divAr = ['accept_copy_advice',
242 'accept_media_types',
243 'accept_multiple',
244 'accept_presentation_document_targets',
245 'accept_types',
246 'accept_unsigned',
247 'auto_create',
248 'can_confirm',
249 'client_id',
250 'content_item_return_url',
251 'context_id',
252 'context_title',
253 'context_type',
254 'custom_ap_attempt_number',
255 'custom_content_item_id',
256 'custom_share_key',
257 'custom_tc_profile_url',
258 'custom_user_username',
259 'custom_username',
260 'deployment_id',
261 'ext_launch_presentation_css_url',
262 'ext_lms',
263 'ext_user_username',
264 'ext_username',
265 'iss',
266 'launch_presentation_css_url',
267 'launch_presentation_document_target',
268 'launch_presentation_height',
269 'launch_presentation_return_url',
270 'launch_presentation_width',
271 'lis_person_contact_email_primary',
272 'lis_person_name_family',
273 'lis_person_name_full',
274 'lis_person_name_given',
275 'lis_person_sourcedid',
276 'login_hint',
277 'lti_deployment_id',
278 'lti_message_hint',
279 'lti_message_type',
280 'lti_version',
281 'oauth_consumer_key',
282 'oauth_signature_method',
283 'openid_configuration',
284 'platform_state',
285 'reg_key',
286 'reg_password',
287 'registration_token',
288 'relaunch_url',
289 'resource_link_id',
290 'resource_link_title',
291 'roles',
292 'target_link_uri',
293 'tc_profile_url',
294 'tool_consumer_info_product_family_code',
295 'tool_consumer_info_version',
296 'tool_consumer_instance_guid',
297 'tool_consumer_instance_name',
298 'user_id',
299 'user_image'
300 ];
301 $LTI_CONSUMER_SETTING_NAMES = ['custom_tc_profile_url', 'custom_system_setting_url', 'custom_oauth2_access_token_url'];
302 $LTI_CONTEXT_SETTING_NAMES = ['custom_context_setting_url',
303 'ext_ims_lis_memberships_id', 'ext_ims_lis_memberships_url',
304 'custom_context_memberships_url', 'custom_context_memberships_v2_url',
305 'custom_context_group_sets_url', 'custom_context_groups_url',
306 'custom_lineitems_url', 'custom_ags_scopes'
307 ];
308 $LTI_RESOURCE_LINK_SETTING_NAMES = ['lis_result_sourcedid', 'lis_outcome_service_url',
309 'ext_ims_lis_basic_outcome_url', 'ext_ims_lis_resultvalue_sourcedids', 'ext_outcome_data_values_accepted',
310 'ext_ims_lis_memberships_id', 'ext_ims_lis_memberships_url',
311 'ext_ims_lti_tool_setting', 'ext_ims_lti_tool_setting_id', 'ext_ims_lti_tool_setting_url',
312 'custom_link_setting_url', 'custom_link_memberships_url',
313 'custom_lineitems_url', 'custom_lineitem_url', 'custom_ags_scopes',
314 'custom_ap_acs_url'
315 ];
316
317 $requestAr = array_merge($divAr, $LTI_CONSUMER_SETTING_NAMES, $LTI_CONTEXT_SETTING_NAMES, $LTI_RESOURCE_LINK_SETTING_NAMES);
318
319 foreach ($requestAr as $param) {
320 if ($query->has($param)) {
321 self::$requestParameters[$param] = $query->retrieve($param, $refinery);
322 }
323 if ($post->has($param)) {
324 self::$requestParameters[$param] = $post->retrieve($param, $refinery);
325 }
326 }
327 }
329 }
330
337 public static function logError(string $message, bool $showSource = true)
338 {
339 if (self::$logLevel >= self::LOGLEVEL_ERROR) {
340 self::log("[ERROR] {$message}", $showSource);
341 }
342 }
343
350 public static function logInfo(string $message, bool $showSource = false)
351 {
352 if (self::$logLevel >= self::LOGLEVEL_INFO) {
353 self::log("[INFO] {$message}", $showSource);
354 }
355 }
356
363 public static function logDebug(string $message, bool $showSource = false)
364 {
365 if (self::$logLevel >= self::LOGLEVEL_DEBUG) {
366 self::log("[DEBUG] {$message}", $showSource);
367 }
368 }
369
375 public static function logRequest(bool $debugLevel = false)
376 {
377 if (!$debugLevel) {
379 } else {
381 }
382 if (self::$logLevel >= $logLevel) {
383 $message = "{$_SERVER['REQUEST_METHOD']} request received for '{$_SERVER['REQUEST_URI']}'";
384// $body = file_get_contents(OAuth\OAuthRequest::$POST_INPUT);
385 $body = file_get_contents(LTIOAuth\OAuthRequest::$POST_INPUT);
386 if (!empty($body)) {
387// $params = OAuth\OAuthUtil::parse_parameters($body);
388 $params = LTIOAuth\OAuthUtil::parse_parameters($body);
389 if (!empty($params)) {
390 $message .= " with body parameters of:\n" . var_export($params, true);
391 } else {
392 $message .= " with a body of:\n" . var_export($body, true);
393 }
394 }
395 if (!$debugLevel) {
397 } else {
399 }
400 }
401 }
402
411 public static function logForm(string $url, array $params, string $method = 'POST', bool $debugLevel = false)
412 {
413 if (!$debugLevel) {
415 } else {
417 }
418 if (self::$logLevel >= self::LOGLEVEL_INFO) {
419 $message = "Form submitted using {$method} to '{$url}'";
420 if (!empty($params)) {
421 $message .= " with parameters of:\n" . var_export($params, true);
422 } else {
423 $message .= " with no parameters";
424 }
425 if ($logLevel < self::LOGLEVEL_DEBUG) {
427 } else {
429 }
430 }
431 }
432
439 public static function log(string $message, bool $showSource = false)
440 {
441 $source = '';
442 if ($showSource) {
443 $backtraces = debug_backtrace();
444 foreach ($backtraces as $backtrace) {
445 if (isset($backtrace['file'])) {
446 $source .= PHP_EOL . " {$backtrace['file']}";
447 if (isset($backtrace['line'])) {
448 $source .= " line {$backtrace['line']}";
449 }
450 }
451 }
452 if (!empty($source)) {
453 $source = PHP_EOL . "See: {$source}";
454 }
455 }
456 error_log($message . $source);
457 }
458
466 public static function sendForm(string $url, array $params, string $target = ''): string
467 {
468 self::logForm($url, $params, 'POST');
469 $page = <<< EOD
470<html>
471<head>
472<title>IMS LTI message</title>
473<script type="text/javascript">
474//<![CDATA[
475function doOnLoad() {
476 document.forms[0].submit();
477}
478
479window.onload=doOnLoad;
480//]]>
481</script>
482</head>
483<body>
484<form action="{$url}" method="post" target="{$target}" encType="application/x-www-form-urlencoded">
485
486EOD;
487 if (!empty($params)) {
488 foreach ($params as $key => $value) {
489 $key = htmlentities($key, ENT_COMPAT | ENT_HTML401, 'UTF-8');
490 if (!is_array($value)) {
491 $value = htmlentities($value, ENT_COMPAT | ENT_HTML401, 'UTF-8');
492 $page .= <<< EOD
493 <input type="hidden" name="{$key}" value="{$value}" />
494
495EOD;
496 } else {
497 foreach ($value as $element) {
498 $element = htmlentities($element, ENT_COMPAT | ENT_HTML401, 'UTF-8');
499 $page .= <<< EOD
500 <input type="hidden" name="{$key}" value="{$element}" />
501
502EOD;
503 }
504 }
505 }
506 }
507
508 $page .= <<< EOD
509</form>
510</body>
511</html>
512EOD;
513
514 return $page;
515 }
516
523 public static function redirect(string $url, array $params): string
524 {
525 if (!empty($params)) {
526 if (strpos($url, '?') === false) {
527 $url .= '?';
528 $sep = '';
529 } else {
530 $sep = '&';
531 }
532 foreach ($params as $key => $value) {
533 $key = urlencode($key);
534 if (!is_array($value)) {
535 $value = urlencode($value);
536 $url .= "{$sep}{$key}={$value}";
537 $sep = '&';
538 } else {
539 foreach ($value as $element) {
540 $element = urlencode($element);
541 $url .= "{$sep}{$key}={$element}";
542 $sep = '&';
543 }
544 }
545 }
546 }
547
548 header("Location: {$url}");
549 exit;
550 }
551
558 public static function getRandomString(int $length = 8): string
559 {
560 $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
561
562 $value = '';
563 $charsLength = strlen($chars) - 1;
564
565 for ($i = 1; $i <= $length; $i++) {
566 $value .= $chars[rand(0, $charsLength)];
567 }
568
569 return $value;
570 }
571
577 public static function stripHtml(string $html): string
578 {
579 $html = strip_tags($html);
580 $html = html_entity_decode($html, ENT_QUOTES | ENT_HTML401);
581
582 return $html;
583 }
584
590 public static function cloneObject(object $obj): object
591 {
592 $clone = clone $obj;
593 $objVars = get_object_vars($clone);
594 foreach ($objVars as $attrName => $attrValue) {
595 if (is_object($clone->$attrName)) {
596 $clone->$attrName = self::cloneObject($clone->$attrName);
597 } elseif (is_array($clone->$attrName)) {
598 foreach ($clone->$attrName as &$attrArrayValue) {
599 if (is_object($attrArrayValue)) {
600 $attrArrayValue = self::cloneObject($attrArrayValue);
601 }
602 unset($attrArrayValue);
603 }
604 }
605 }
606
607 return $clone;
608 }
609
610
611 public static function logtxt(string $msg)
612 {
613 file_put_contents("log.txt", $msg . "\n", FILE_APPEND);
614 }
615}
static isLtiMessage()
Check whether the request received could be an LTI message.
Definition: Util.php:196
const LTI_VERSION1
LTI version 1 for messages.
Definition: Util.php:28
static array $LTI_VERSIONS
Permitted LTI versions for messages.
Definition: Util.php:161
static redirect(string $url, array $params)
Redirect to a URL with query parameters.
Definition: Util.php:523
const LOGLEVEL_ERROR
Log errors only.
Definition: Util.php:146
static logInfo(string $message, bool $showSource=false)
Log an information message.
Definition: Util.php:350
const LOGLEVEL_DEBUG
Log all messages.
Definition: Util.php:156
static sendForm(string $url, array $params, string $target='')
Generate a web page containing an auto-submitted form of parameters.
Definition: Util.php:466
static log(string $message, bool $showSource=false)
Log an error message irrespective of the logging level.
Definition: Util.php:439
const JWT_CLAIM_MAPPING
Mapping for standard message parameters to JWT claim.
Definition: Util.php:58
static logRequest(bool $debugLevel=false)
Log a request received.
Definition: Util.php:375
static array $METHOD_NAMES
List of supported message types and associated class methods.
Definition: Util.php:166
static int $logLevel
Current logging level.
Definition: Util.php:189
const LOGLEVEL_NONE
No logging.
Definition: Util.php:141
static logDebug(string $message, bool $showSource=false)
Log a debug message.
Definition: Util.php:363
const LTI_VERSION2
LTI version 2 for messages.
Definition: Util.php:38
const LTI_VERSION1P3
LTI version 1.3 for messages.
Definition: Util.php:33
const LOGLEVEL_INFO
Log error and information messages.
Definition: Util.php:151
static array $requestParameters
GET and POST request parameters.
Definition: Util.php:182
static getRandomString(int $length=8)
Generate a random string.
Definition: Util.php:558
static logForm(string $url, array $params, string $method='POST', bool $debugLevel=false)
Log a form submission.
Definition: Util.php:411
static logError(string $message, bool $showSource=true)
Log an error message.
Definition: Util.php:337
static getRequestParameters()
Return GET and POST request parameters (POST parameters take precedence)
Definition: Util.php:224
static cloneObject(object $obj)
Clone an object and any objects it contains.
Definition: Util.php:590
const MESSAGE_TYPE_MAPPING
Mapping for standard message types.
Definition: Util.php:48
static logtxt(string $msg)
Definition: Util.php:611
static stripHtml(string $html)
Strip HTML tags from a string.
Definition: Util.php:577
const JWT_CLAIM_PREFIX
Prefix for standard JWT message claims.
Definition: Util.php:43
global $DIC
Definition: feed.php:28
exit
Definition: login.php:28
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
$post
Definition: ltitoken.php:49
$i
Definition: metadata.php:41
$source
Definition: metadata.php:93
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: OAuth.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: AccessToken.php:19
string $key
Consumer key/client ID value.
Definition: System.php:193
Refinery Factory $refinery
form( $class_path, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$query
$url
$message
Definition: xapiexit.php:32
$param
Definition: xapitoken.php:46