@@ -163,12 +163,12 @@ |
||
163 | 163 | $this->_path = $path; |
164 | 164 | // check the format and store it |
165 | 165 | switch ($format) { |
166 | - case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN: |
|
167 | - case CAS_PGT_STORAGE_FILE_FORMAT_XML: |
|
168 | - $this->_format = $format; |
|
169 | - break; |
|
170 | - default: |
|
171 | - phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)'); |
|
166 | + case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN: |
|
167 | + case CAS_PGT_STORAGE_FILE_FORMAT_XML: |
|
168 | + $this->_format = $format; |
|
169 | + break; |
|
170 | + default: |
|
171 | + phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)'); |
|
172 | 172 | } |
173 | 173 | phpCAS::traceEnd(); |
174 | 174 | } |
@@ -26,14 +26,14 @@ |
||
26 | 26 | * Redirect to the correct script to handle this type of upload |
27 | 27 | */ |
28 | 28 | switch ($_SESSION['my_tool']) { |
29 | - case TOOL_LEARNPATH: |
|
30 | - require 'upload.scorm.php'; |
|
31 | - break; |
|
32 | - //the following cases need to be distinguished later on |
|
33 | - case TOOL_DROPBOX: |
|
34 | - case TOOL_STUDENTPUBLICATION: |
|
35 | - case TOOL_DOCUMENT: |
|
36 | - default: |
|
37 | - require 'upload.document.php'; |
|
38 | - break; |
|
29 | + case TOOL_LEARNPATH: |
|
30 | + require 'upload.scorm.php'; |
|
31 | + break; |
|
32 | + //the following cases need to be distinguished later on |
|
33 | + case TOOL_DROPBOX: |
|
34 | + case TOOL_STUDENTPUBLICATION: |
|
35 | + case TOOL_DOCUMENT: |
|
36 | + default: |
|
37 | + require 'upload.document.php'; |
|
38 | + break; |
|
39 | 39 | } |
@@ -15,52 +15,52 @@ |
||
15 | 15 | } |
16 | 16 | |
17 | 17 | switch ($_REQUEST['action']) { |
18 | - case "get": |
|
19 | - print storage_get($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
20 | - break; |
|
21 | - case "set": |
|
22 | - if (storage_can_set($_REQUEST['svuser'])) { |
|
23 | - print storage_set($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']); |
|
24 | - } |
|
25 | - break; |
|
26 | - case "getall": |
|
27 | - print storage_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco']); |
|
28 | - break; |
|
29 | - case "stackpush": |
|
30 | - if (storage_can_set($_REQUEST['svuser'])) { |
|
31 | - print storage_stack_push($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']); |
|
32 | - } |
|
33 | - break; |
|
34 | - case "stackpop": |
|
35 | - if (storage_can_set($_REQUEST['svuser'])) { |
|
36 | - print storage_stack_pop($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
37 | - } |
|
38 | - break; |
|
39 | - case "stacklength": |
|
40 | - print storage_stack_length($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
41 | - break; |
|
42 | - case "stackclear": |
|
43 | - if (storage_can_set($_REQUEST['svuser'])) { |
|
44 | - print storage_stack_clear($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
45 | - } |
|
46 | - break; |
|
47 | - case "stackgetall": |
|
48 | - if (storage_can_set($_REQUEST['svuser'])) |
|
49 | - print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
50 | - break; |
|
51 | - case "getposition": |
|
52 | - print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']); |
|
53 | - break; |
|
54 | - case "getleaders": |
|
55 | - print storage_get_leaders($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc'], $_REQUEST['svlength']); |
|
56 | - break; |
|
57 | - case "usersgetall": |
|
58 | -// security issue |
|
59 | - print "NOT allowed, security issue, see sources"; |
|
60 | -// print storage_get_all_users(); |
|
61 | - break; |
|
62 | - default: |
|
63 | - // Do nothing |
|
18 | + case "get": |
|
19 | + print storage_get($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
20 | + break; |
|
21 | + case "set": |
|
22 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
23 | + print storage_set($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']); |
|
24 | + } |
|
25 | + break; |
|
26 | + case "getall": |
|
27 | + print storage_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco']); |
|
28 | + break; |
|
29 | + case "stackpush": |
|
30 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
31 | + print storage_stack_push($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']); |
|
32 | + } |
|
33 | + break; |
|
34 | + case "stackpop": |
|
35 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
36 | + print storage_stack_pop($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
37 | + } |
|
38 | + break; |
|
39 | + case "stacklength": |
|
40 | + print storage_stack_length($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
41 | + break; |
|
42 | + case "stackclear": |
|
43 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
44 | + print storage_stack_clear($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
45 | + } |
|
46 | + break; |
|
47 | + case "stackgetall": |
|
48 | + if (storage_can_set($_REQUEST['svuser'])) |
|
49 | + print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
50 | + break; |
|
51 | + case "getposition": |
|
52 | + print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']); |
|
53 | + break; |
|
54 | + case "getleaders": |
|
55 | + print storage_get_leaders($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc'], $_REQUEST['svlength']); |
|
56 | + break; |
|
57 | + case "usersgetall": |
|
58 | + // security issue |
|
59 | + print "NOT allowed, security issue, see sources"; |
|
60 | + // print storage_get_all_users(); |
|
61 | + break; |
|
62 | + default: |
|
63 | + // Do nothing |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | function storage_can_set($sv_user) { |
@@ -30,44 +30,44 @@ |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | switch ($action) { |
33 | - case 'get_file': |
|
34 | - if ($nano->get_param_value('user_id') == api_get_user_id() || api_is_allowed_to_edit()) { |
|
35 | - $file_path = $nano->load_filename_if_exists(); |
|
36 | - //$file_path = '/var/www/rocio/courses/GREAT123/exercises/0/2/5/1/1-0-1-2-5-38.mp3'; |
|
37 | - if ($file_path) { |
|
38 | - $info = pathinfo($file_path); |
|
39 | - $user_info = api_get_user_info($nano->params['user_id']); |
|
40 | - $name = get_lang('Quiz').'-'.$user_info['firstname'].'-'.$user_info['lastname'].'.'.$info['extension']; |
|
41 | - $download = true; |
|
42 | - if (isset($_REQUEST['download']) && $_REQUEST['download'] == 0) { |
|
43 | - $download = false; |
|
44 | - } |
|
45 | - DocumentManager::file_send_for_download($file_path, $download); |
|
46 | - exit; |
|
47 | - } |
|
48 | - } |
|
49 | - break; |
|
50 | - case 'show_audio': |
|
51 | - if (!$is_nano) { |
|
52 | - echo $nano->return_js($_REQUEST); |
|
53 | - } |
|
54 | - echo $nano->show_audio_file($is_nano); |
|
55 | - break; |
|
56 | - case 'delete': |
|
57 | - $return = $nano->delete_files(); |
|
58 | - if ($return == 1) { |
|
59 | - //cant' do this because the post that nano send doesnt take into account the session |
|
60 | - Display::display_confirmation_message(get_lang('FileDeleted')); |
|
61 | - } else { |
|
62 | - Display::display_confirmation_message(get_lang('FileNotFound')); |
|
63 | - } |
|
64 | - break; |
|
65 | - case 'show_form': |
|
66 | - api_protect_course_script(true); |
|
67 | - Display::display_reduced_header(); |
|
68 | - echo $nano->return_js($_REQUEST); |
|
69 | - echo $nano->return_form(); |
|
70 | - break; |
|
33 | + case 'get_file': |
|
34 | + if ($nano->get_param_value('user_id') == api_get_user_id() || api_is_allowed_to_edit()) { |
|
35 | + $file_path = $nano->load_filename_if_exists(); |
|
36 | + //$file_path = '/var/www/rocio/courses/GREAT123/exercises/0/2/5/1/1-0-1-2-5-38.mp3'; |
|
37 | + if ($file_path) { |
|
38 | + $info = pathinfo($file_path); |
|
39 | + $user_info = api_get_user_info($nano->params['user_id']); |
|
40 | + $name = get_lang('Quiz').'-'.$user_info['firstname'].'-'.$user_info['lastname'].'.'.$info['extension']; |
|
41 | + $download = true; |
|
42 | + if (isset($_REQUEST['download']) && $_REQUEST['download'] == 0) { |
|
43 | + $download = false; |
|
44 | + } |
|
45 | + DocumentManager::file_send_for_download($file_path, $download); |
|
46 | + exit; |
|
47 | + } |
|
48 | + } |
|
49 | + break; |
|
50 | + case 'show_audio': |
|
51 | + if (!$is_nano) { |
|
52 | + echo $nano->return_js($_REQUEST); |
|
53 | + } |
|
54 | + echo $nano->show_audio_file($is_nano); |
|
55 | + break; |
|
56 | + case 'delete': |
|
57 | + $return = $nano->delete_files(); |
|
58 | + if ($return == 1) { |
|
59 | + //cant' do this because the post that nano send doesnt take into account the session |
|
60 | + Display::display_confirmation_message(get_lang('FileDeleted')); |
|
61 | + } else { |
|
62 | + Display::display_confirmation_message(get_lang('FileNotFound')); |
|
63 | + } |
|
64 | + break; |
|
65 | + case 'show_form': |
|
66 | + api_protect_course_script(true); |
|
67 | + Display::display_reduced_header(); |
|
68 | + echo $nano->return_js($_REQUEST); |
|
69 | + echo $nano->return_form(); |
|
70 | + break; |
|
71 | 71 | case 'save_file': |
72 | 72 | //User access same as upload.php |
73 | 73 |
@@ -55,56 +55,56 @@ |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | switch ($action) { |
58 | - case 'chatheartbeat': |
|
59 | - $chat->heartbeat(); |
|
60 | - break; |
|
61 | - case 'closechat': |
|
62 | - $chat->close(); |
|
63 | - break; |
|
64 | - case 'sendchat': |
|
65 | - $chat->send(api_get_user_id(), $to_user_id, $message); |
|
66 | - break; |
|
67 | - case 'startchatsession': |
|
68 | - $chat->startSession(); |
|
69 | - break; |
|
70 | - case 'set_status': |
|
71 | - $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0; |
|
72 | - $chat->setUserStatus($status); |
|
73 | - break; |
|
74 | - case 'create_room': |
|
75 | - $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id); |
|
76 | - |
|
77 | - if ($room === false) { |
|
78 | - $createdRoom = VideoChat::createRoom(api_get_user_id(), $to_user_id); |
|
79 | - |
|
80 | - if ($createdRoom === false) { |
|
81 | - echo Display::return_message(get_lang('ChatRoomNotCreated'), 'error'); |
|
82 | - break; |
|
58 | + case 'chatheartbeat': |
|
59 | + $chat->heartbeat(); |
|
60 | + break; |
|
61 | + case 'closechat': |
|
62 | + $chat->close(); |
|
63 | + break; |
|
64 | + case 'sendchat': |
|
65 | + $chat->send(api_get_user_id(), $to_user_id, $message); |
|
66 | + break; |
|
67 | + case 'startchatsession': |
|
68 | + $chat->startSession(); |
|
69 | + break; |
|
70 | + case 'set_status': |
|
71 | + $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0; |
|
72 | + $chat->setUserStatus($status); |
|
73 | + break; |
|
74 | + case 'create_room': |
|
75 | + $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id); |
|
76 | + |
|
77 | + if ($room === false) { |
|
78 | + $createdRoom = VideoChat::createRoom(api_get_user_id(), $to_user_id); |
|
79 | + |
|
80 | + if ($createdRoom === false) { |
|
81 | + echo Display::return_message(get_lang('ChatRoomNotCreated'), 'error'); |
|
82 | + break; |
|
83 | + } |
|
84 | + |
|
85 | + $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id); |
|
83 | 86 | } |
84 | 87 | |
85 | - $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id); |
|
86 | - } |
|
87 | - |
|
88 | - $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}"; |
|
89 | - $videoChatLink = Display::url( |
|
90 | - Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'), |
|
91 | - $videoChatUrl |
|
92 | - ); |
|
93 | - |
|
94 | - $chat->send( |
|
95 | - api_get_user_id(), |
|
96 | - $to_user_id, |
|
97 | - $videoChatLink, |
|
98 | - false, |
|
99 | - false |
|
100 | - ); |
|
101 | - |
|
102 | - echo Display::tag('p', $videoChatLink, ['class' => 'lead']); |
|
103 | - break; |
|
104 | - case 'notify_not_support': |
|
105 | - $chat->send(api_get_user_id(), $to_user_id, get_lang('TheXUserBrowserDoesNotSupportWebRTC')); |
|
106 | - break; |
|
107 | - default: |
|
108 | - echo ''; |
|
88 | + $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}"; |
|
89 | + $videoChatLink = Display::url( |
|
90 | + Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'), |
|
91 | + $videoChatUrl |
|
92 | + ); |
|
93 | + |
|
94 | + $chat->send( |
|
95 | + api_get_user_id(), |
|
96 | + $to_user_id, |
|
97 | + $videoChatLink, |
|
98 | + false, |
|
99 | + false |
|
100 | + ); |
|
101 | + |
|
102 | + echo Display::tag('p', $videoChatLink, ['class' => 'lead']); |
|
103 | + break; |
|
104 | + case 'notify_not_support': |
|
105 | + $chat->send(api_get_user_id(), $to_user_id, get_lang('TheXUserBrowserDoesNotSupportWebRTC')); |
|
106 | + break; |
|
107 | + default: |
|
108 | + echo ''; |
|
109 | 109 | } |
110 | 110 | exit; |
@@ -300,21 +300,21 @@ |
||
300 | 300 | $name = str_replace("\x00", "", $nameUtf16); |
301 | 301 | $type = $this->_readInt1($fh); |
302 | 302 | switch ($type) { |
303 | - case OLE_PPS_TYPE_ROOT: |
|
304 | - require_once 'OLE/PPS/Root.php'; |
|
305 | - $pps = new OLE_PPS_Root(null, null, array()); |
|
306 | - $this->root = $pps; |
|
307 | - break; |
|
308 | - case OLE_PPS_TYPE_DIR: |
|
309 | - $pps = new OLE_PPS(null, null, null, null, null, |
|
310 | - null, null, null, null, array()); |
|
311 | - break; |
|
312 | - case OLE_PPS_TYPE_FILE: |
|
313 | - require_once 'OLE/PPS/File.php'; |
|
314 | - $pps = new OLE_PPS_File($name); |
|
315 | - break; |
|
316 | - default: |
|
317 | - continue; |
|
303 | + case OLE_PPS_TYPE_ROOT: |
|
304 | + require_once 'OLE/PPS/Root.php'; |
|
305 | + $pps = new OLE_PPS_Root(null, null, array()); |
|
306 | + $this->root = $pps; |
|
307 | + break; |
|
308 | + case OLE_PPS_TYPE_DIR: |
|
309 | + $pps = new OLE_PPS(null, null, null, null, null, |
|
310 | + null, null, null, null, array()); |
|
311 | + break; |
|
312 | + case OLE_PPS_TYPE_FILE: |
|
313 | + require_once 'OLE/PPS/File.php'; |
|
314 | + $pps = new OLE_PPS_File($name); |
|
315 | + break; |
|
316 | + default: |
|
317 | + continue; |
|
318 | 318 | } |
319 | 319 | fseek($fh, 1, SEEK_CUR); |
320 | 320 | $pps->Type = $type; |
@@ -167,17 +167,17 @@ |
||
167 | 167 | $outputString = $figlet->lineEcho($this->getPhrase()); |
168 | 168 | |
169 | 169 | switch ($this->_output) { |
170 | - case 'text': |
|
171 | - $this->setCaptcha($outputString); |
|
172 | - break; |
|
173 | - case 'html': |
|
174 | - $this->setCaptcha($this->_getCAPTCHAAsHTML($outputString)); |
|
175 | - break; |
|
176 | - case 'javascript': |
|
177 | - $this->setCaptcha($this->_getCAPTCHAAsJavascript($outputString)); |
|
178 | - break; |
|
179 | - default: |
|
180 | - throw new Text_CAPTCHA_Exception('Invalid output option given'); |
|
170 | + case 'text': |
|
171 | + $this->setCaptcha($outputString); |
|
172 | + break; |
|
173 | + case 'html': |
|
174 | + $this->setCaptcha($this->_getCAPTCHAAsHTML($outputString)); |
|
175 | + break; |
|
176 | + case 'javascript': |
|
177 | + $this->setCaptcha($this->_getCAPTCHAAsJavascript($outputString)); |
|
178 | + break; |
|
179 | + default: |
|
180 | + throw new Text_CAPTCHA_Exception('Invalid output option given'); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 |
@@ -140,20 +140,20 @@ |
||
140 | 140 | public function createCAPTCHA() |
141 | 141 | { |
142 | 142 | switch ($this->_severity) { |
143 | - case 1: |
|
144 | - list($equation, $phrase) = $this->_createSimpleEquation(); |
|
145 | - break; |
|
146 | - case 2: |
|
147 | - list($eq1, $sol1) = $this->_createSimpleEquation(); |
|
148 | - list($eq2, $sol2) = $this->_createSimpleEquation(); |
|
149 | - $op3 = $this->_operators[mt_rand(0, count($this->_operators) - 1)]; |
|
150 | - list(, $phrase) = $this->_solveSimpleEquation($sol1, $sol2, $op3); |
|
151 | - $equation = sprintf($op3, '(' . $eq1 . ')', '(' . $eq2 . ')'); |
|
152 | - break; |
|
153 | - default: |
|
154 | - throw new Text_CAPTCHA_Exception( |
|
155 | - 'Equation complexity of ' . $this->_severity . ' not supported' |
|
156 | - ); |
|
143 | + case 1: |
|
144 | + list($equation, $phrase) = $this->_createSimpleEquation(); |
|
145 | + break; |
|
146 | + case 2: |
|
147 | + list($eq1, $sol1) = $this->_createSimpleEquation(); |
|
148 | + list($eq2, $sol2) = $this->_createSimpleEquation(); |
|
149 | + $op3 = $this->_operators[mt_rand(0, count($this->_operators) - 1)]; |
|
150 | + list(, $phrase) = $this->_solveSimpleEquation($sol1, $sol2, $op3); |
|
151 | + $equation = sprintf($op3, '(' . $eq1 . ')', '(' . $eq2 . ')'); |
|
152 | + break; |
|
153 | + default: |
|
154 | + throw new Text_CAPTCHA_Exception( |
|
155 | + 'Equation complexity of ' . $this->_severity . ' not supported' |
|
156 | + ); |
|
157 | 157 | } |
158 | 158 | $this->setCaptcha($equation); |
159 | 159 | $this->setPhrase($phrase); |
@@ -241,17 +241,17 @@ |
||
241 | 241 | { |
242 | 242 | $this->_setOperation(); |
243 | 243 | switch ($this->_operator) { |
244 | - case '+': |
|
245 | - $this->_doAdd(); |
|
246 | - break; |
|
247 | - case '-': |
|
248 | - $this->_doSubtract(); |
|
249 | - break; |
|
250 | - default: |
|
251 | - $this->_operator = "+"; |
|
252 | - $this->_setOperation(); |
|
253 | - $this->_doAdd(); |
|
254 | - break; |
|
244 | + case '+': |
|
245 | + $this->_doAdd(); |
|
246 | + break; |
|
247 | + case '-': |
|
248 | + $this->_doSubtract(); |
|
249 | + break; |
|
250 | + default: |
|
251 | + $this->_operator = "+"; |
|
252 | + $this->_setOperation(); |
|
253 | + $this->_doAdd(); |
|
254 | + break; |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 |