ILIAS  release_4-3 Revision
 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("Services/Init/classes/class.ilInitialisation.php");
44 
45 // special handling for direct navigation request
46 require_once "./Services/Navigation/classes/class.ilNavigationHistoryGUI.php";
48 $nav_hist->handleNavigationRequest();
49 
50 // store original parameter before plugin slot may influence it
51 $orig_target = $_GET['target'];
52 
53 // user interface plugin slot hook
54 if (is_object($ilPluginAdmin))
55 {
56  // get user interface plugins
57  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
58 
59  // search
60  foreach ($pl_names as $pl)
61  {
62  $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
63  $gui_class = $ui_plugin->getUIClassInstance();
64  $gui_class->gotoHook();
65  }
66 }
67 
68 if(IS_PAYMENT_ENABLED)
69 {
70  if(strpos($_GET['target'], 'purchasetypedemo') !== false)
71  {
72  $_GET['purchasetype'] = 'demo';
73  $_GET['cmd'] = 'showDemoVersion';
74  $_GET['target'] = str_replace('purchasetypedemo', '', $_GET['target']);
75  }
76  else if(strpos($_GET['target'], 'purchasetypebuy') !== false)
77  {
78  $_GET['purchasetype'] = 'buy';
79  $_GET['cmd'] = 'showDetails';
80  $_GET['target'] = str_replace('purchasetypebuy', '', $_GET['target']);
81  }
82 }
83 
84 $r_pos = strpos($_GET["target"], "_");
85 $rest = substr($_GET["target"], $r_pos+1);
86 $target_arr = explode("_", $_GET["target"]);
89 $additional = $target_arr[2]; // optional for pages
90 
91 if(IS_PAYMENT_ENABLED)
92 {
93  include_once './Services/Payment/classes/class.ilShopLinkBuilder.php';
94  $shop_classes = array_keys(ilShopLinkBuilder::$linkArray);
95  if(in_array($target_type, $shop_classes))
96  {
97  $class = $target_type;
98  if(ilShopLinkBuilder::$linkArray[strtolower($class)]['public'] == 'true'
99  || ($_SESSION["AccountId"] != ANONYMOUS_USER_ID && ilShopLinkBuilder::$linkArray[strtolower($class)]['public'] == 'false'))
100  {
101  if($additional != '')
102  {
103  $additional_param .= "&cmd=".$additional;
104  }
105  else
106  {
107  $additional_param = '';
108  }
109 
110  $link = 'ilias.php?baseClass='.ilShopLinkBuilder::$linkArray[strtolower($class)]['baseClass']
111  .'&cmdClass='.strtolower(ilShopLinkBuilder::$linkArray[strtolower($class)]['cmdClass']).$additional_param;
112 
113  ilUtil::redirect($link);
114  }
115  }
116 }
117 
118 // imprint has no ref id...
119 if($target_type == "impr")
120 {
121  ilUtil::redirect('ilias.php?baseClass=ilImprintGUI');
122 }
123 
124 // goto is not granted?
125 include_once("Services/Init/classes/class.ilStartUpGUI.php");
126 if(!ilStartUpGUI::_checkGoto($_GET["target"]))
127 {
128  // if anonymous: go to login page
129  if($ilUser->getId() == ANONYMOUS_USER_ID)
130  {
131  ilUtil::redirect("login.php?target=".$orig_target."&cmd=force_login&lang=".$ilUser->getCurrentLanguage());
132  }
133  else
134  {
135  // message if target given but not accessible
136  $tarr = explode("_", $_GET["target"]);
137  if ($tarr[0] != "pg" && $tarr[0] != "st" && $tarr[1] > 0)
138  {
139  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
141  }
142 
143  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
144  }
145 }
146 
147 
148 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
149 //
150 // FOR NEW OBJECT TYPES:
151 // PLEASE USE DEFAULT IMPLEMENTATION ONLY
152 //
153 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
154 
155 switch($target_type)
156 {
157  // exception, must be kept for now
158  case "pg":
159  require_once("./Modules/LearningModule/classes/class.ilLMPageObjectGUI.php");
161  break;
162 
163  // exception, must be kept for now
164  case "st":
165  require_once("./Modules/LearningModule/classes/class.ilStructureObjectGUI.php");
167  break;
168 
169  // exception, must be kept for now
170  case "git":
171  require_once("./Modules/Glossary/classes/class.ilGlossaryTermGUI.php");
172  $target_ref_id = $target_arr[2];
173  ilGlossaryTermGUI::_goto($target_id, $target_ref_id);
174  break;
175 
176  // please migrate to default branch implementation
177  case "glo":
178  require_once("./Modules/Glossary/classes/class.ilObjGlossaryGUI.php");
180  break;
181 
182  // please migrate to default branch implementation
183  case "lm":
184  case "dbk":
185  require_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
187  break;
188 
189  // please migrate to default branch implementation
190  case "htlm":
191  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMGUI.php");
193  break;
194 
195  // please migrate to default branch implementation
196  case "frm":
197  require_once("./Modules/Forum/classes/class.ilObjForumGUI.php");
198  $target_thread = $target_arr[2];
199  $target_posting = $target_arr[3];
200  ilObjForumGUI::_goto($target_id, $target_thread, $target_posting);
201  break;
202 
203  // please migrate to default branch implementation
204  case "exc":
205  require_once("./Modules/Exercise/classes/class.ilObjExerciseGUI.php");
207  break;
208 
209  // please migrate to default branch implementation
210  case "tst":
211  require_once("./Modules/Test/classes/class.ilObjTestGUI.php");
213  break;
214 
215  // please migrate to default branch implementation
216  case "qpl":
217  require_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php");
219  break;
220 
221  // please migrate to default branch implementation
222  case "spl":
223  require_once("./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPoolGUI.php");
225  break;
226 
227  // please migrate to default branch implementation
228  case "svy":
229  require_once("./Modules/Survey/classes/class.ilObjSurveyGUI.php");
230  if (array_key_exists("accesscode", $_GET))
231  {
232  ilObjSurveyGUI::_goto($target_id, $_GET["accesscode"]);
233  }
234  else
235  {
237  }
238  break;
239 
240  // please migrate to default branch implementation
241  case "webr":
242  require_once("./Modules/WebResource/classes/class.ilObjLinkResourceGUI.php");
244  break;
245 
246  // please migrate to default branch implementation
247  case "sahs":
248  require_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleGUI.php");
250  break;
251 
252  // please migrate to default branch implementation
253  case "cat":
254  require_once("./Modules/Category/classes/class.ilObjCategoryGUI.php");
256  break;
257 
258  // please migrate to default branch implementation
259  case "crs":
260  require_once("Modules/Course/classes/class.ilObjCourseGUI.php");
262  break;
263 
264  // please migrate to default branch implementation
265  case "grp":
266  require_once("./Modules/Group/classes/class.ilObjGroupGUI.php");
268  break;
269 
270  // please migrate to default branch implementation
271  case 'fold':
272  require_once("./Modules/Folder/classes/class.ilObjFolderGUI.php");
274  break;
275 
276  // please migrate to default branch implementation
277  case "file":
278  require_once("./Modules/File/classes/class.ilObjFileGUI.php");
280  break;
281 
282  // please migrate to default branch implementation
283  case "mcst":
284  require_once("./Modules/MediaCast/classes/class.ilObjMediaCastGUI.php");
286  break;
287 
288  // please migrate to default branch implementation
289  case 'icrs':
290  require_once 'Modules/ILinc/classes/class.ilObjiLincCourseGUI.php';
292  break;
293 
294  // please migrate to default branch implementation
295  case 'root':
296  require_once('./Modules/RootFolder/classes/class.ilObjRootFolderGUI.php');
298  break;
299 
300  // please migrate to default branch implementation
301  case 'cert':
302  require_once('./Services/Certificate/classes/class.ilCertificate.php');
304  break;
305 
306  //
307  // default implementation (should be used by all new object types)
308  //
309  default:
310  if (!$objDefinition->isPlugin($target_type))
311  {
312  $class_name = "ilObj".$objDefinition->getClassName($target_type)."GUI";
313  $location = $objDefinition->getLocation($target_type);
314  if (is_file($location."/class.".$class_name.".php"))
315  {
316  include_once($location."/class.".$class_name.".php");
317  call_user_func(array($class_name, "_goto"), $rest);
318  }
319  }
320  else
321  {
322  $class_name = "ilObj".$objDefinition->getClassName($target_type)."GUI";
323  $location = $objDefinition->getLocation($target_type);
324  if (is_file($location."/class.".$class_name.".php"))
325  {
326  include_once($location."/class.".$class_name.".php");
327  call_user_func(array($class_name, "_goto"), array($rest, $class_name));
328  }
329  }
330  break;
331 }
332 ?>