-
Notifications
You must be signed in to change notification settings - Fork 0
/
goto.php
executable file
·338 lines (290 loc) · 9.85 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<?php
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
/**
* redirection script
* todo: (a better solution should control the processing
* via a xml file)
*
* $_GET["target"] should be of format <type>_<id>
*
* @author Alex Killing <[email protected]>
* @package ilias-core
* @version $Id$
*/
//var_dump ($_SESSION);
//var_dump ($_COOKIE);
// this should bring us all session data of the desired
// client
if (isset($_GET["client_id"]))
{
$cookie_domain = $_SERVER['SERVER_NAME'];
$cookie_path = dirname( $_SERVER['PHP_SELF'] );
/* if ilias is called directly within the docroot $cookie_path
is set to '/' expecting on servers running under windows..
here it is set to '\'.
in both cases a further '/' won't be appended due to the following regex
*/
$cookie_path .= (!preg_match("/[\/|\\\\]$/", $cookie_path)) ? "/" : "";
if($cookie_path == "\\") $cookie_path = '/';
$cookie_domain = ''; // Temporary Fix
setcookie("ilClientId", $_GET["client_id"], 0, $cookie_path, $cookie_domain);
$_COOKIE["ilClientId"] = $_GET["client_id"];
}
require_once("Services/Init/classes/class.ilInitialisation.php");
ilInitialisation::initILIAS();
// special handling for direct navigation request
require_once "./Services/Navigation/classes/class.ilNavigationHistoryGUI.php";
$nav_hist = new ilNavigationHistoryGUI();
$nav_hist->handleNavigationRequest();
// store original parameter before plugin slot may influence it
$orig_target = $_GET['target'];
// user interface plugin slot hook
if (is_object($ilPluginAdmin))
{
// get user interface plugins
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
// search
foreach ($pl_names as $pl)
{
$ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
$gui_class = $ui_plugin->getUIClassInstance();
$gui_class->gotoHook();
}
}
if(IS_PAYMENT_ENABLED)
{
if(strpos($_GET['target'], 'purchasetypedemo') !== false)
{
$_GET['purchasetype'] = 'demo';
$_GET['cmd'] = 'showDemoVersion';
$_GET['target'] = str_replace('purchasetypedemo', '', $_GET['target']);
}
else if(strpos($_GET['target'], 'purchasetypebuy') !== false)
{
$_GET['purchasetype'] = 'buy';
$_GET['cmd'] = 'showDetails';
$_GET['target'] = str_replace('purchasetypebuy', '', $_GET['target']);
}
}
$r_pos = strpos($_GET["target"], "_");
$rest = substr($_GET["target"], $r_pos+1);
$target_arr = explode("_", $_GET["target"]);
$target_type = $target_arr[0];
$target_id = $target_arr[1];
$additional = $target_arr[2]; // optional for pages
if(IS_PAYMENT_ENABLED)
{
include_once './Services/Payment/classes/class.ilShopLinkBuilder.php';
$shop_classes = array_keys(ilShopLinkBuilder::$linkArray);
if(in_array($target_type, $shop_classes))
{
$class = $target_type;
if(ilShopLinkBuilder::$linkArray[strtolower($class)]['public'] == 'true'
|| ($_SESSION["AccountId"] != ANONYMOUS_USER_ID && ilShopLinkBuilder::$linkArray[strtolower($class)]['public'] == 'false'))
{
if($additional != '')
{
$additional_param .= "&cmd=".$additional;
}
else
{
$additional_param = '';
}
$link = 'ilias.php?baseClass='.ilShopLinkBuilder::$linkArray[strtolower($class)]['baseClass']
.'&cmdClass='.strtolower(ilShopLinkBuilder::$linkArray[strtolower($class)]['cmdClass']).$additional_param;
//additional parameters needed for shop
if(isset($target_arr[3]))
{
$link .='&'.$target_arr[3];
}
ilUtil::redirect($link);
}
}
}
// imprint has no ref id...
if($target_type == "impr")
{
ilUtil::redirect('ilias.php?baseClass=ilImprintGUI');
}
// goto is not granted?
include_once("Services/Init/classes/class.ilStartUpGUI.php");
if(!ilStartUpGUI::_checkGoto($_GET["target"]))
{
// if anonymous: go to login page
if($ilUser->getId() == ANONYMOUS_USER_ID)
{
ilUtil::redirect("login.php?target=".$orig_target."&cmd=force_login&lang=".$ilUser->getCurrentLanguage());
}
else
{
// message if target given but not accessible
$tarr = explode("_", $_GET["target"]);
if ($tarr[0] != "pg" && $tarr[0] != "st" && $tarr[1] > 0)
{
ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
ilObject::_lookupTitle(ilObject::_lookupObjId($tarr[1]))), true);
}
ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
}
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
// FOR NEW OBJECT TYPES:
// PLEASE USE DEFAULT IMPLEMENTATION ONLY
//
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
switch($target_type)
{
// exception, must be kept for now
case "pg":
require_once("./Modules/LearningModule/classes/class.ilLMPageObjectGUI.php");
ilLMPageObjectGUI::_goto($rest);
break;
// exception, must be kept for now
case "st":
require_once("./Modules/LearningModule/classes/class.ilStructureObjectGUI.php");
ilStructureObjectGUI::_goto($target_id, $additional);
break;
// exception, must be kept for now
case "git":
require_once("./Modules/Glossary/classes/class.ilGlossaryTermGUI.php");
$target_ref_id = $target_arr[2];
ilGlossaryTermGUI::_goto($target_id, $target_ref_id);
break;
// please migrate to default branch implementation
case "glo":
require_once("./Modules/Glossary/classes/class.ilObjGlossaryGUI.php");
ilObjGlossaryGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "lm":
case "dbk":
require_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
ilObjContentObjectGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "htlm":
require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMGUI.php");
ilObjFileBasedLMGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "frm":
require_once("./Modules/Forum/classes/class.ilObjForumGUI.php");
$target_thread = $target_arr[2];
$target_posting = $target_arr[3];
ilObjForumGUI::_goto($target_id, $target_thread, $target_posting);
break;
// please migrate to default branch implementation
case "exc":
require_once("./Modules/Exercise/classes/class.ilObjExerciseGUI.php");
ilObjExerciseGUI::_goto($target_id, $rest);
break;
// please migrate to default branch implementation
case "tst":
require_once("./Modules/Test/classes/class.ilObjTestGUI.php");
ilObjTestGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "qpl":
require_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php");
ilObjQuestionPoolGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "spl":
require_once("./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPoolGUI.php");
ilObjSurveyQuestionPoolGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "svy":
require_once("./Modules/Survey/classes/class.ilObjSurveyGUI.php");
if (array_key_exists("accesscode", $_GET))
{
ilObjSurveyGUI::_goto($target_id, $_GET["accesscode"]);
}
else
{
ilObjSurveyGUI::_goto($target_id);
}
break;
// please migrate to default branch implementation
case "webr":
require_once("./Modules/WebResource/classes/class.ilObjLinkResourceGUI.php");
ilObjLinkResourceGUI::_goto($target_id, $rest);
break;
// please migrate to default branch implementation
case "sahs":
require_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleGUI.php");
ilObjSAHSLearningModuleGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "cat":
require_once("./Modules/Category/classes/class.ilObjCategoryGUI.php");
ilObjCategoryGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "crs":
require_once("Modules/Course/classes/class.ilObjCourseGUI.php");
ilObjCourseGUI::_goto($target_id, $additional);
break;
// please migrate to default branch implementation
case "grp":
require_once("./Modules/Group/classes/class.ilObjGroupGUI.php");
ilObjGroupGUI::_goto($target_id, $additional);
break;
// please migrate to default branch implementation
case 'fold':
require_once("./Modules/Folder/classes/class.ilObjFolderGUI.php");
ilObjFolderGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case "file":
require_once("./Modules/File/classes/class.ilObjFileGUI.php");
ilObjFileGUI::_goto($target_id, $rest);
break;
// please migrate to default branch implementation
case "mcst":
require_once("./Modules/MediaCast/classes/class.ilObjMediaCastGUI.php");
ilObjMediaCastGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case 'icrs':
require_once 'Modules/ILinc/classes/class.ilObjiLincCourseGUI.php';
ilObjiLincCourseGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case 'root':
require_once('./Modules/RootFolder/classes/class.ilObjRootFolderGUI.php');
ilObjRootFolderGUI::_goto($target_id);
break;
// please migrate to default branch implementation
case 'cert':
require_once('./Services/Certificate/classes/class.ilCertificate.php');
ilCertificate::_goto($target_id);
break;
//
// default implementation (should be used by all new object types)
//
default:
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"))
{
include_once($location."/class.".$class_name.".php");
call_user_func(array($class_name, "_goto"), array($rest, $class_name));
}
}
break;
}
?>