ILIAS  Release_4_4_x_branch Revision 61816
 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  //additional parameters needed for shop
114  if(isset($target_arr[3]))
115  {
116  $link .='&'.$target_arr[3];
117  }
118 
119  ilUtil::redirect($link);
120  }
121  }
122 }
123 
124 // imprint has no ref id...
125 if($target_type == "impr")
126 {
127  ilUtil::redirect('ilias.php?baseClass=ilImprintGUI');
128 }
129 
130 // goto is not granted?
131 include_once("Services/Init/classes/class.ilStartUpGUI.php");
132 if(!ilStartUpGUI::_checkGoto($_GET["target"]))
133 {
134  // if anonymous: go to login page
135  if($ilUser->getId() == ANONYMOUS_USER_ID)
136  {
137  ilUtil::redirect("login.php?target=".$orig_target."&cmd=force_login&lang=".$ilUser->getCurrentLanguage());
138  }
139  else
140  {
141  // message if target given but not accessible
142  $tarr = explode("_", $_GET["target"]);
143  if ($tarr[0] != "pg" && $tarr[0] != "st" && $tarr[1] > 0)
144  {
145  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
147  }
148 
149  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
150  }
151 }
152 
153 
154 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
155 //
156 // FOR NEW OBJECT TYPES:
157 // PLEASE USE DEFAULT IMPLEMENTATION ONLY
158 //
159 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
160 
161 switch($target_type)
162 {
163  // exception, must be kept for now
164  case "pg":
165  require_once("./Modules/LearningModule/classes/class.ilLMPageObjectGUI.php");
167  break;
168 
169  // exception, must be kept for now
170  case "st":
171  require_once("./Modules/LearningModule/classes/class.ilStructureObjectGUI.php");
173  break;
174 
175  // exception, must be kept for now
176  case "git":
177  require_once("./Modules/Glossary/classes/class.ilGlossaryTermGUI.php");
178  $target_ref_id = $target_arr[2];
179  ilGlossaryTermGUI::_goto($target_id, $target_ref_id);
180  break;
181 
182  // please migrate to default branch implementation
183  case "glo":
184  require_once("./Modules/Glossary/classes/class.ilObjGlossaryGUI.php");
186  break;
187 
188  // please migrate to default branch implementation
189  case "lm":
190  case "dbk":
191  require_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
193  break;
194 
195  // please migrate to default branch implementation
196  case "htlm":
197  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMGUI.php");
199  break;
200 
201  // please migrate to default branch implementation
202  case "frm":
203  require_once("./Modules/Forum/classes/class.ilObjForumGUI.php");
204  $target_thread = $target_arr[2];
205  $target_posting = $target_arr[3];
206  ilObjForumGUI::_goto($target_id, $target_thread, $target_posting);
207  break;
208 
209  // please migrate to default branch implementation
210  case "exc":
211  require_once("./Modules/Exercise/classes/class.ilObjExerciseGUI.php");
213  break;
214 
215  // please migrate to default branch implementation
216  case "tst":
217  require_once("./Modules/Test/classes/class.ilObjTestGUI.php");
219  break;
220 
221  // please migrate to default branch implementation
222  case "qpl":
223  require_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php");
225  break;
226 
227  // please migrate to default branch implementation
228  case "spl":
229  require_once("./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPoolGUI.php");
231  break;
232 
233  // please migrate to default branch implementation
234  case "svy":
235  require_once("./Modules/Survey/classes/class.ilObjSurveyGUI.php");
236  if (array_key_exists("accesscode", $_GET))
237  {
238  ilObjSurveyGUI::_goto($target_id, $_GET["accesscode"]);
239  }
240  else
241  {
243  }
244  break;
245 
246  // please migrate to default branch implementation
247  case "webr":
248  require_once("./Modules/WebResource/classes/class.ilObjLinkResourceGUI.php");
250  break;
251 
252  // please migrate to default branch implementation
253  case "sahs":
254  require_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleGUI.php");
256  break;
257 
258  // please migrate to default branch implementation
259  case "cat":
260  require_once("./Modules/Category/classes/class.ilObjCategoryGUI.php");
262  break;
263 
264  // please migrate to default branch implementation
265  case "crs":
266  require_once("Modules/Course/classes/class.ilObjCourseGUI.php");
268  break;
269 
270  // please migrate to default branch implementation
271  case "grp":
272  require_once("./Modules/Group/classes/class.ilObjGroupGUI.php");
274  break;
275 
276  // please migrate to default branch implementation
277  case 'fold':
278  require_once("./Modules/Folder/classes/class.ilObjFolderGUI.php");
280  break;
281 
282  // please migrate to default branch implementation
283  case "file":
284  require_once("./Modules/File/classes/class.ilObjFileGUI.php");
286  break;
287 
288  // please migrate to default branch implementation
289  case "mcst":
290  require_once("./Modules/MediaCast/classes/class.ilObjMediaCastGUI.php");
292  break;
293 
294  // please migrate to default branch implementation
295  case 'icrs':
296  require_once 'Modules/ILinc/classes/class.ilObjiLincCourseGUI.php';
298  break;
299 
300  // please migrate to default branch implementation
301  case 'root':
302  require_once('./Modules/RootFolder/classes/class.ilObjRootFolderGUI.php');
304  break;
305 
306  // please migrate to default branch implementation
307  case 'cert':
308  require_once('./Services/Certificate/classes/class.ilCertificate.php');
310  break;
311 
312  //
313  // default implementation (should be used by all new object types)
314  //
315  default:
316  if (!$objDefinition->isPlugin($target_type))
317  {
318  $class_name = "ilObj".$objDefinition->getClassName($target_type)."GUI";
319  $location = $objDefinition->getLocation($target_type);
320  if (is_file($location."/class.".$class_name.".php"))
321  {
322  include_once($location."/class.".$class_name.".php");
323  call_user_func(array($class_name, "_goto"), $rest);
324  }
325  }
326  else
327  {
328  $class_name = "ilObj".$objDefinition->getClassName($target_type)."GUI";
329  $location = $objDefinition->getLocation($target_type);
330  if (is_file($location."/class.".$class_name.".php"))
331  {
332  include_once($location."/class.".$class_name.".php");
333  call_user_func(array($class_name, "_goto"), array($rest, $class_name));
334  }
335  }
336  break;
337 }
338 ?>