ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
goto.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
16 //var_dump ($_SESSION);
17 //var_dump ($_COOKIE);
18 
19 // this should bring us all session data of the desired
20 // client
21 if (isset($_GET["client_id"]))
22 {
23  $cookie_domain = $_SERVER['SERVER_NAME'];
24  $cookie_path = dirname( $_SERVER['PHP_SELF'] );
25 
26  /* if ilias is called directly within the docroot $cookie_path
27  is set to '/' expecting on servers running under windows..
28  here it is set to '\'.
29  in both cases a further '/' won't be appended due to the following regex
30  */
31  $cookie_path .= (!preg_match("/[\/|\\\\]$/", $cookie_path)) ? "/" : "";
32 
33  if($cookie_path == "\\") $cookie_path = '/';
34 
35  $cookie_domain = ''; // Temporary Fix
36 
37  setcookie("ilClientId", $_GET["client_id"], 0, $cookie_path, $cookie_domain);
38 
39  $_COOKIE["ilClientId"] = $_GET["client_id"];
40 }
41 
42 require_once "./include/inc.header.php";
43 
44 // special handling for direct navigation request
45 require_once "./Services/Navigation/classes/class.ilNavigationHistoryGUI.php";
47 $nav_hist->handleNavigationRequest();
48 
49 // store original parameter before plugin slot may influence it
50 $orig_target = $_GET['target'];
51 
52 // user interface plugin slot hook
53 if (is_object($ilPluginAdmin))
54 {
55  // get user interface plugins
56  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
57 
58  // search
59  foreach ($pl_names as $pl)
60  {
61  $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
62  $gui_class = $ui_plugin->getUIClassInstance();
63  $gui_class->gotoHook();
64  }
65 }
66 
67 if(strpos($_GET['target'], 'purchasetypedemo') !== false)
68 {
69  $_GET['purchasetype'] = 'demo';
70  $_GET['cmd'] = 'showDemoVersion';
71  $_GET['target'] = str_replace('purchasetypedemo', '', $_GET['target']);
72 }
73 else if(strpos($_GET['target'], 'purchasetypebuy') !== false)
74 {
75  $_GET['purchasetype'] = 'buy';
76  $_GET['cmd'] = 'showDetails';
77  $_GET['target'] = str_replace('purchasetypebuy', '', $_GET['target']);
78 }
79 
80 $r_pos = strpos($_GET["target"], "_");
81 $rest = substr($_GET["target"], $r_pos+1);
82 
83 $target_arr = explode("_", $_GET["target"]);
86 $additional = $target_arr[2]; // optional for pages
87 
88 
89 include_once './Services/Payment/classes/class.ilShopLinkBuilder.php';
91 if(in_array($target_type, $shop_classes))
92 {
93  $class = $target_type;
94  if(ilShopLinkBuilder::$linkArray[strtolower($class)]['public'] == 'true'
95  || ($_SESSION["AccountId"] != ANONYMOUS_USER_ID && ilShopLinkBuilder::$linkArray[strtolower($class)]['public'] == 'false'))
96  {
97  ilUtil::redirect('ilias.php?baseClass='.ilShopLinkBuilder::$linkArray[strtolower($class)]['baseClass']
98  .'&cmdClass='.strtolower(ilShopLinkBuilder::$linkArray[strtolower($class)]['cmdClass']));
99  exit;
100  }
101 }
102 
103 // if anonymous and goto is not granted: go to login page
104 include_once("Services/Init/classes/class.ilStartUpGUI.php");
105 if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID && !ilStartUpGUI::_checkGoto($_GET["target"]))
106 {
107  ilUtil::redirect("login.php?target=".$orig_target."&cmd=force_login&lang=".$ilUser->getCurrentLanguage());
108 }
109 
110 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
111 //
112 // FOR NEW OBJECT TYPES:
113 // PLEASE USE DEFAULT IMPLEMENTATION ONLY
114 //
115 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
116 
117 switch($target_type)
118 {
119  // exception, must be kept for now
120  case "pg":
121  require_once("./Modules/LearningModule/classes/class.ilLMPageObjectGUI.php");
123  break;
124 
125  // exception, must be kept for now
126  case "st":
127  require_once("./Modules/LearningModule/classes/class.ilStructureObjectGUI.php");
129  break;
130 
131  // exception, must be kept for now
132  case "git":
133  require_once("./Modules/Glossary/classes/class.ilGlossaryTermGUI.php");
134  $target_ref_id = $target_arr[2];
135  ilGlossaryTermGUI::_goto($target_id, $target_ref_id);
136  break;
137 
138  // please migrate to default branch implementation
139  case "glo":
140  require_once("./Modules/Glossary/classes/class.ilObjGlossaryGUI.php");
142  break;
143 
144  // please migrate to default branch implementation
145  case "lm":
146  case "dbk":
147  require_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
149  break;
150 
151  // please migrate to default branch implementation
152  case "htlm":
153  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMGUI.php");
155  break;
156 
157  // please migrate to default branch implementation
158  case "frm":
159  require_once("./Modules/Forum/classes/class.ilObjForumGUI.php");
160  $target_thread = $target_arr[2];
161  $target_posting = $target_arr[3];
162  ilObjForumGUI::_goto($target_id, $target_thread, $target_posting);
163  break;
164 
165  // please migrate to default branch implementation
166  case "exc":
167  require_once("./Modules/Exercise/classes/class.ilObjExerciseGUI.php");
169  break;
170 
171  // please migrate to default branch implementation
172  case "tst":
173  require_once("./Modules/Test/classes/class.ilObjTestGUI.php");
175  break;
176 
177  // please migrate to default branch implementation
178  case "qpl":
179  require_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php");
181  break;
182 
183  // please migrate to default branch implementation
184  case "spl":
185  require_once("./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPoolGUI.php");
187  break;
188 
189  // please migrate to default branch implementation
190  case "svy":
191  require_once("./Modules/Survey/classes/class.ilObjSurveyGUI.php");
192  if (array_key_exists("accesscode", $_GET))
193  {
194  ilObjSurveyGUI::_goto($target_id, $_GET["accesscode"]);
195  }
196  else
197  {
199  }
200  break;
201 
202  // please migrate to default branch implementation
203  case "webr":
204  require_once("./Modules/WebResource/classes/class.ilObjLinkResourceGUI.php");
206  break;
207 
208  // please migrate to default branch implementation
209  case "sahs":
210  require_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleGUI.php");
212  break;
213 
214  // please migrate to default branch implementation
215  case "cat":
216  require_once("./Modules/Category/classes/class.ilObjCategoryGUI.php");
218  break;
219 
220  // please migrate to default branch implementation
221  case "crs":
222  require_once("Modules/Course/classes/class.ilObjCourseGUI.php");
224  break;
225 
226  // please migrate to default branch implementation
227  case "grp":
228  require_once("./Modules/Group/classes/class.ilObjGroupGUI.php");
230  break;
231 
232  // please migrate to default branch implementation
233  case 'fold':
234  require_once("./Modules/Folder/classes/class.ilObjFolderGUI.php");
236  break;
237 
238  // please migrate to default branch implementation
239  case "file":
240  require_once("./Modules/File/classes/class.ilObjFileGUI.php");
242  break;
243 
244  // please migrate to default branch implementation
245  case "mcst":
246  require_once("./Modules/MediaCast/classes/class.ilObjMediaCastGUI.php");
248  break;
249 
250  // please migrate to default branch implementation
251  case 'icrs':
252  require_once 'Modules/ILinc/classes/class.ilObjiLincCourseGUI.php';
254  break;
255 
256  // please migrate to default branch implementation
257  case 'root':
258  require_once('./Modules/RootFolder/classes/class.ilObjRootFolderGUI.php');
260  break;
261 
262  // please migrate to default branch implementation
263  case 'cert':
264  require_once('./Services/Certificate/classes/class.ilCertificate.php');
266  break;
267 
268  //
269  // default implementation (should be used by all new object types)
270  //
271  default:
272  if (!$objDefinition->isPlugin($target_type))
273  {
274  $class_name = "ilObj".$objDefinition->getClassName($target_type)."GUI";
275  $location = $objDefinition->getLocation($target_type);
276  if (is_file($location."/class.".$class_name.".php"))
277  {
278  include_once($location."/class.".$class_name.".php");
279  call_user_func(array($class_name, "_goto"), $rest);
280  }
281  }
282  else
283  {
284  $class_name = "ilObj".$objDefinition->getClassName($target_type)."GUI";
285  $location = $objDefinition->getLocation($target_type);
286  if (is_file($location."/class.".$class_name.".php"))
287  {
288  include_once($location."/class.".$class_name.".php");
289  call_user_func(array($class_name, "_goto"), array($rest, $class_name));
290  }
291  }
292  break;
293 }
294 ?>