forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
goto.php
executable file
·223 lines (193 loc) · 7.22 KB
/
goto.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php
/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/
/** @noRector */
require_once("libs/composer/vendor/autoload.php");
ilInitialisation::initILIAS();
global $DIC, $ilPluginAdmin;
$requested_target = $DIC->http()->wrapper()->query()->has("target")
? $DIC->http()->wrapper()->query()->retrieve(
"target",
$DIC->refinery()->to()->string()
)
: '';
// special handling for direct navigation request
$nav_hist = new ilNavigationHistoryGUI();
$nav_hist->handleNavigationRequest();
// store original parameter before plugin slot may influence it
$orig_target = $requested_target;
// user interface plugin slot hook
if (is_object($ilPluginAdmin)) {
// search
foreach ($DIC["component.factory"]->getActivePluginsInSlot("uihk") as $ui_plugin) {
$gui_class = $ui_plugin->getUIClassInstance();
$gui_class->gotoHook();
}
}
$r_pos = strpos($requested_target, "_");
$rest = substr($requested_target, $r_pos + 1);
$target_arr = explode("_", $requested_target);
$target_type = $target_arr[0];
$target_id = $target_arr[1] ?? ''; // optional for plugins
$additional = $target_arr[2] ?? ''; // optional for pages
// imprint has no ref id...
if ($target_type === "impr") {
$DIC->ctrl()->redirectToURL('ilias.php?baseClass=ilImprintGUI');
}
// goto is not granted?
if (!ilStartUpGUI::_checkGoto($requested_target)) {
// if anonymous: go to login page
if ($DIC->user()->getId() === 0 || $DIC->user()->isAnonymous()) {
$url = "login.php?target="
. $orig_target . "&cmd=force_login&lang="
. $DIC->user()->getCurrentLanguage();
if ($DIC->http()->wrapper()->query()->has('soap_pw')) {
$url = ilUtil::appendUrlParameterString(
$url,
'soap_pw=' . $DIC->http()->wrapper()->query()->retrieve(
'soap_pw',
$DIC->refinery()->kindlyTo()->string()
)
);
}
if ($DIC->http()->wrapper()->query()->has('ext_uid')) {
$url = ilUtil::appendUrlParameterString(
$url,
'ext_uid=' . $DIC->http()->wrapper()->query()->retrieve(
'ext_uid',
$DIC->refinery()->kindlyTo()->string()
)
);
}
$DIC->ctrl()->redirectToURL($url);
} else {
// message if target given but not accessible
$tarr = explode("_", $requested_target);
if ($tarr[0] !== "pg" && $tarr[0] !== "st" && isset($tarr[1]) && is_numeric($tarr[1]) && $tarr[1] > 0) {
$DIC->ui()->mainTemplate()->setOnScreenMessage(
'failure',
sprintf(
$DIC->language()->txt("msg_no_perm_read_item"),
ilObject::_lookupTitle(ilObject::_lookupObjId((int) $tarr[1]))
),
true
);
} else {
global $DIC;
$DIC->ui()->mainTemplate()->setOnScreenMessage('failure', $DIC->language()->txt('permission_denied'), true);
}
$DIC->ctrl()->redirectToURL(ilUserUtil::getStartingPointAsUrl());
}
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
// FOR NEW OBJECT TYPES:
// PLEASE USE DEFAULT IMPLEMENTATION ONLY
//
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
switch ($target_type) {
// exception, must be kept for now
case "pg":
ilLMPageObjectGUI::_goto($rest);
break;
// exception, must be kept for now
case "st":
ilStructureObjectGUI::_goto($target_id, (int) $additional);
break;
// exception, must be kept for now
case "git":
$target_ref_id = $target_arr[2] ?? 0;
ilGlossaryTermGUI::_goto($target_id, $target_ref_id);
break;
// please migrate to default branch implementation
case "glo":
ilObjGlossaryGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "lm":
ilObjContentObjectGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "htlm":
ilObjFileBasedLMGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "frm":
$target_thread = isset($target_arr[2]) ? $target_arr[2] : 0;
$target_posting = isset($target_arr[3]) ? $target_arr[3] : 0;
ilObjForumGUI::_goto($target_id, $target_thread, $target_posting);
break;
// please migrate to default branch implementation
case "exc":
ilObjExerciseGUI::_goto($target_id, $rest);
break;
// please migrate to default branch implementation
case "tst":
ilObjTestGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "qpl":
ilObjQuestionPoolGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "webr":
ilObjLinkResourceGUI::_goto($target_id, $rest);
break;
// please migrate to default branch implementation
case "sahs":
ilObjSAHSLearningModuleGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "crs":
ilObjCourseGUI::_goto($target_id, $additional);
break;
// please migrate to default branch implementation
case "grp":
ilObjGroupGUI::_goto($target_id, $additional);
break;
// please migrate to default branch implementation
case "file":
ilObjFileGUI::_goto($target_id, $rest);
break;
// please migrate to default branch implementation
case 'cert':
ilCertificate::_goto($target_id);
break;
// links to the documentation of the kitchen sink in the administration
case 'stys':
(new ilKSDocumentationGotoLink())->redirectWithGotoLink($target_id, $target_arr, $DIC->ctrl());
break;
//
// default implementation (should be used by all new object types)
//
default:
global $objDefinition;
if (!$objDefinition->isPlugin($target_type)) {
$class_name = "ilObj" . $objDefinition->getClassName($target_type) . "GUI";
$location = $objDefinition->getLocation($target_type);
if (is_file($location . "/class." . $class_name . ".php")) {
include_once($location . "/class." . $class_name . ".php");
call_user_func(array($class_name, "_goto"), $rest);
}
} else {
$class_name = "ilObj" . $objDefinition->getClassName($target_type) . "GUI";
$location = $objDefinition->getLocation($target_type);
if (is_file($location . "/class." . $class_name . ".php")) {
call_user_func(array($class_name, "_goto"), array($rest, $class_name));
}
}
break;
}