ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
sahs_server.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
32 chdir("../..");
33 require_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
34 
35 // debug
36 /*
37 $fp=fopen("./Modules/ScormAicc/log/scorm.log", "a+");
38 foreach ($HTTP_POST_VARS as $key=>$value)
39  fputs($fp, "HTTP_POST_VARS[$key] = $value \n");
40 foreach ($HTTP_GET_VARS as $key=>$value)
41  fputs($fp, "HTTP_GET_VARS[$key] = $value \n");
42 fclose($fp);
43 */
44 
45 $cmd = ($_GET["cmd"] == "")
46  ? $_POST["cmd"]
47  : $_GET["cmd"];
48 
49 $ref_id=$_GET["ref_id"];
50 
51 //get type of cbt
52 if (!empty($ref_id))
53 {
54  require_once "./include/inc.header.php";
55 
58 
59 }
60 else
61 {
62 
63  //ensure HACP
64  $requiredKeys=array("command", "version", "session_id");
65  if (count(array_diff ($requiredKeys, array_keys(array_change_key_case($HTTP_POST_VARS, CASE_LOWER))))==0)
66  {
67  //now we need to get a connection to the database and global params
68  //but that doesnt work because of missing logindata of the contentserver
69  //require_once "./include/inc.header.php";
70 
71  //highly insecure
72  $param=urldecode($HTTP_POST_VARS["session_id"]);
73  if (!empty($param) && substr_count($param, "_")==3)
74  {
75  list($session_id, $client_id, $ref_id, $obj_id)=explode("_",$param);
76 
77  $_COOKIE[session_name()] = $session_id;
78  $_COOKIE['ilClientId'] = $client_id;
79 
80 // session_id($session_id);
81  require_once "./include/inc.header.php";
82 //$ilLog->write("Session: ".$HTTP_POST_VARS["session_id"]);
83 
84  $type="hacp";
85 
86  }
87  }
88 }
89 
90 switch ($type)
91 {
92  case "scorm":
93  //SCORM
94  require_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php";
95  $track = new ilObjSCORMTracking();
96  $track->$cmd();
97  break;
98  case "aicc":
99  //AICC
100  require_once "./Modules/ScormAicc/classes/AICC/class.ilObjAICCTracking.php";
101  $track = new ilObjAICCTracking();
102  $track->$cmd();
103  break;
104  case "hacp":
105  //HACP
106  require_once "./Modules/ScormAicc/classes/HACP/class.ilObjHACPTracking.php";
107  $track = new ilObjHACPTracking($ref_id, $obj_id);
108  //$track->$cmd();
109  break;
110  default:
111  //unknown type
112  $fp=fopen("./Modules/ScormAicc/log/scorm.log", "a+");
113  fputs($fp, "unknown type >$type< in sahs_server\n");
114  foreach ($HTTP_POST_VARS as $k=>$v)
115  fputs($fp, "HTTP_POST_VARS[$k]=$v \n");
116  fclose($fp);
117 }
118 
119 exit;
120 
121 ?>