@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | $resubscriptionLimit = Resubscription::create()->get('resubscription_limit'); |
33 | 33 | |
34 | - // Initialize variables as a calendar year by default |
|
34 | + // Initialize variables as a calendar year by default |
|
35 | 35 | $limitDateFormat = 'Y-01-01'; |
36 | 36 | $limitDate = gmdate($limitDateFormat); |
37 | 37 | $resubscriptionOffset = "1 year"; |
@@ -581,7 +581,7 @@ |
||
581 | 581 | /*$sessionIdName = isset($params['session_id_name']) ? $params['session_id_name'] : null; |
582 | 582 | $sessionIdValue = isset($params['session_id_value']) ? $params['session_id_value'] : null;*/ |
583 | 583 | |
584 | - $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
|
584 | + $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
|
585 | 585 | $courseIdValue, |
586 | 586 | $courseIdName |
587 | 587 | ); |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | define('WS_ERROR_SECRET_KEY', 1); |
22 | 22 | |
23 | -function return_error($code) { |
|
23 | +function return_error($code) |
|
24 | +{ |
|
24 | 25 | $fault = null; |
25 | 26 | switch ($code) { |
26 | 27 | case WS_ERROR_SECRET_KEY: |
@@ -48,19 +49,22 @@ discard block |
||
48 | 49 | list($ip1) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
49 | 50 | $ip = trim($ip1); |
50 | 51 | } |
51 | - if ($debug) |
|
52 | - error_log("ip: $ip"); |
|
52 | + if ($debug) { |
|
53 | + error_log("ip: $ip"); |
|
54 | + } |
|
53 | 55 | // Check if a file that limits access from webservices exists and contains |
54 | 56 | // the restraining check |
55 | 57 | if (is_file('webservice-auth-ip.conf.php')) { |
56 | 58 | include 'webservice-auth-ip.conf.php'; |
57 | - if ($debug) |
|
58 | - error_log("webservice-auth-ip.conf.php file included"); |
|
59 | + if ($debug) { |
|
60 | + error_log("webservice-auth-ip.conf.php file included"); |
|
61 | + } |
|
59 | 62 | if (!empty($ws_auth_ip)) { |
60 | 63 | $check_ip = true; |
61 | 64 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
62 | - if ($debug) |
|
63 | - error_log("ip_matches: $ip_matches"); |
|
65 | + if ($debug) { |
|
66 | + error_log("ip_matches: $ip_matches"); |
|
67 | + } |
|
64 | 68 | } |
65 | 69 | } |
66 | 70 | |
@@ -76,8 +80,9 @@ discard block |
||
76 | 80 | } |
77 | 81 | $result = api_is_valid_secret_key($secret_key, $security_key); |
78 | 82 | //error_log($secret_key.'-'.$security_key); |
79 | - if ($debug) |
|
80 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
83 | + if ($debug) { |
|
84 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
85 | + } |
|
81 | 86 | return $result; |
82 | 87 | } |
83 | 88 | |
@@ -140,7 +145,9 @@ discard block |
||
140 | 145 | if (!WSHelperVerifyKey($params)) { |
141 | 146 | return return_error(WS_ERROR_SECRET_KEY); |
142 | 147 | } |
143 | - if ($debug) error_log('WSImportLP'); |
|
148 | + if ($debug) { |
|
149 | + error_log('WSImportLP'); |
|
150 | + } |
|
144 | 151 | |
145 | 152 | $courseIdName = $params['course_id_name']; |
146 | 153 | $courseIdValue = $params['course_id_value']; |
@@ -156,7 +163,9 @@ discard block |
||
156 | 163 | $courseId = $courseInfo['real_id']; |
157 | 164 | |
158 | 165 | if (empty($courseInfo)) { |
159 | - if ($debug) error_log('Course not found'); |
|
166 | + if ($debug) { |
|
167 | + error_log('Course not found'); |
|
168 | + } |
|
160 | 169 | return 'Course not found'; |
161 | 170 | } |
162 | 171 | |
@@ -169,7 +178,9 @@ discard block |
||
169 | 178 | |
170 | 179 | if (empty($sessionId)) { |
171 | 180 | |
172 | - if ($debug) error_log('Session not found'); |
|
181 | + if ($debug) { |
|
182 | + error_log('Session not found'); |
|
183 | + } |
|
173 | 184 | return 'Session not found'; |
174 | 185 | } |
175 | 186 | } |
@@ -196,7 +207,9 @@ discard block |
||
196 | 207 | $manifest = $oScorm->import_package($fileInfo, '', $courseInfo); |
197 | 208 | |
198 | 209 | if (!$manifest) { |
199 | - if ($debug) error_log('manifest.xml file not found'); |
|
210 | + if ($debug) { |
|
211 | + error_log('manifest.xml file not found'); |
|
212 | + } |
|
200 | 213 | return 'manifest.xml file not found'; |
201 | 214 | } |
202 | 215 | |
@@ -214,10 +227,14 @@ discard block |
||
214 | 227 | $oScorm->set_maker($maker, $courseId); |
215 | 228 | //$oScorm->set_jslib('scorm_api.php'); |
216 | 229 | |
217 | - if ($debug) error_log('scorm was added'); |
|
230 | + if ($debug) { |
|
231 | + error_log('scorm was added'); |
|
232 | + } |
|
218 | 233 | return 1; |
219 | 234 | } else { |
220 | - if ($debug) error_log('manifest data empty'); |
|
235 | + if ($debug) { |
|
236 | + error_log('manifest data empty'); |
|
237 | + } |
|
221 | 238 | return 'manifest data empty'; |
222 | 239 | } |
223 | 240 | } |
@@ -310,7 +327,9 @@ discard block |
||
310 | 327 | ); |
311 | 328 | |
312 | 329 | if (empty($courseInfo)) { |
313 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
330 | + if ($debug) { |
|
331 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
332 | + } |
|
314 | 333 | return 'Course not found'; |
315 | 334 | } |
316 | 335 | |
@@ -325,7 +344,9 @@ discard block |
||
325 | 344 | |
326 | 345 | if (empty($sessionId)) { |
327 | 346 | |
328 | - if ($debug) error_log('Session not found'); |
|
347 | + if ($debug) { |
|
348 | + error_log('Session not found'); |
|
349 | + } |
|
329 | 350 | return 'Session not found'; |
330 | 351 | } |
331 | 352 | } |
@@ -406,7 +427,9 @@ discard block |
||
406 | 427 | ); |
407 | 428 | |
408 | 429 | if (empty($courseInfo)) { |
409 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
430 | + if ($debug) { |
|
431 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
432 | + } |
|
410 | 433 | return 'Course not found'; |
411 | 434 | } |
412 | 435 | $courseId = $courseInfo['real_id']; |
@@ -431,7 +454,9 @@ discard block |
||
431 | 454 | |
432 | 455 | $lp = new learnpath($courseCode, $lpId, null); |
433 | 456 | if ($lp) { |
434 | - if ($debug) error_log("LP deleted $lpId"); |
|
457 | + if ($debug) { |
|
458 | + error_log("LP deleted $lpId"); |
|
459 | + } |
|
435 | 460 | |
436 | 461 | $course_dir = $courseInfo['directory'].'/document'; |
437 | 462 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
@@ -447,7 +472,9 @@ discard block |
||
447 | 472 | if ($item) { |
448 | 473 | $documentId = $item->get_path(); |
449 | 474 | |
450 | - if ($debug) error_log("lp item id found #$itemId"); |
|
475 | + if ($debug) { |
|
476 | + error_log("lp item id found #$itemId"); |
|
477 | + } |
|
451 | 478 | |
452 | 479 | $documentInfo = DocumentManager::get_document_data_by_id( |
453 | 480 | $documentId, |
@@ -473,7 +500,9 @@ discard block |
||
473 | 500 | } |
474 | 501 | } |
475 | 502 | } else { |
476 | - if ($debug) error_log("Document not found #$itemId"); |
|
503 | + if ($debug) { |
|
504 | + error_log("Document not found #$itemId"); |
|
505 | + } |
|
477 | 506 | } |
478 | 507 | } |
479 | 508 | } |
@@ -14,45 +14,45 @@ |
||
14 | 14 | */ |
15 | 15 | function import_users_from_file($filepath, $security_key) { |
16 | 16 | |
17 | - global $_configuration; |
|
18 | - |
|
19 | - $errors_returned = array( |
|
20 | - 0 => 'success', |
|
21 | - 1 => 'file import does not exist', |
|
22 | - 2 => 'no users to import', |
|
23 | - 3 => 'wrong datas in file', |
|
24 | - 4 => 'security error' |
|
25 | - ); |
|
26 | - |
|
27 | - // Check whether this script is launch by server and security key is ok. |
|
28 | - if (empty($_SERVER['REMOTE_ADDR']) || $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'] || $security_key != $_configuration['security_key']) { |
|
29 | - return $errors_returned[4]; |
|
30 | - } |
|
31 | - |
|
32 | - // Libraries |
|
33 | - require_once 'import.lib.php'; |
|
34 | - |
|
35 | - // Check is users file exists. |
|
36 | - if (!is_file($filepath)) { |
|
37 | - return $errors_returned[1]; |
|
38 | - } |
|
39 | - |
|
40 | - // Get list of users |
|
41 | - $users = parse_csv_data($filepath); |
|
42 | - if (count($users) == 0) { |
|
43 | - return $errors_returned[2]; |
|
44 | - } |
|
45 | - |
|
46 | - // Check the datas for each user |
|
47 | - $errors = validate_data($users); |
|
48 | - if (count($errors) > 0) { |
|
49 | - return $errors_returned[3]; |
|
50 | - } |
|
51 | - |
|
52 | - // Apply modifications in database |
|
53 | - save_data($users); |
|
54 | - |
|
55 | - return $errors_returned[0]; // Import successfull |
|
17 | + global $_configuration; |
|
18 | + |
|
19 | + $errors_returned = array( |
|
20 | + 0 => 'success', |
|
21 | + 1 => 'file import does not exist', |
|
22 | + 2 => 'no users to import', |
|
23 | + 3 => 'wrong datas in file', |
|
24 | + 4 => 'security error' |
|
25 | + ); |
|
26 | + |
|
27 | + // Check whether this script is launch by server and security key is ok. |
|
28 | + if (empty($_SERVER['REMOTE_ADDR']) || $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'] || $security_key != $_configuration['security_key']) { |
|
29 | + return $errors_returned[4]; |
|
30 | + } |
|
31 | + |
|
32 | + // Libraries |
|
33 | + require_once 'import.lib.php'; |
|
34 | + |
|
35 | + // Check is users file exists. |
|
36 | + if (!is_file($filepath)) { |
|
37 | + return $errors_returned[1]; |
|
38 | + } |
|
39 | + |
|
40 | + // Get list of users |
|
41 | + $users = parse_csv_data($filepath); |
|
42 | + if (count($users) == 0) { |
|
43 | + return $errors_returned[2]; |
|
44 | + } |
|
45 | + |
|
46 | + // Check the datas for each user |
|
47 | + $errors = validate_data($users); |
|
48 | + if (count($errors) > 0) { |
|
49 | + return $errors_returned[3]; |
|
50 | + } |
|
51 | + |
|
52 | + // Apply modifications in database |
|
53 | + save_data($users); |
|
54 | + |
|
55 | + return $errors_returned[0]; // Import successfull |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | $server = new soap_server(); |
@@ -12,7 +12,8 @@ |
||
12 | 12 | * @param string Security key (as found in configuration file) |
13 | 13 | * @return string Error message |
14 | 14 | */ |
15 | -function import_users_from_file($filepath, $security_key) { |
|
15 | +function import_users_from_file($filepath, $security_key) |
|
16 | +{ |
|
16 | 17 | |
17 | 18 | global $_configuration; |
18 | 19 |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | <option value = "%">--</option> |
198 | 198 | <?php |
199 | 199 | echo Display :: get_alphabet_options(); |
200 | - ?> |
|
200 | + ?> |
|
201 | 201 | </select> |
202 | 202 | </td> |
203 | 203 | <td align="center"> </td> |
@@ -207,31 +207,31 @@ discard block |
||
207 | 207 | <td align="center"> |
208 | 208 | <div id="content_source"> |
209 | 209 | <?php |
210 | - if (!($add_type=='multiple')) { |
|
210 | + if (!($add_type=='multiple')) { |
|
211 | 211 | ?> |
212 | 212 | <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" /> |
213 | 213 | <div id="ajax_list_users_single"></div> |
214 | 214 | <?php |
215 | - } else { |
|
216 | - ?> |
|
215 | + } else { |
|
216 | + ?> |
|
217 | 217 | <div id="ajax_list_multiple"> |
218 | 218 | <?php echo Display::select('session_not_in_promotion_name',$session_not_in_promotion, '',array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'session_not_in_promotion','size'=>'15px'),false); ?> |
219 | 219 | </div> |
220 | 220 | <?php |
221 | - } |
|
222 | - ?> |
|
221 | + } |
|
222 | + ?> |
|
223 | 223 | </div> |
224 | 224 | </td> |
225 | 225 | <td width="10%" valign="middle" align="center"> |
226 | 226 | <?php |
227 | - if ($ajax_search) { |
|
228 | - ?> |
|
227 | + if ($ajax_search) { |
|
228 | + ?> |
|
229 | 229 | <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('session_in_promotion'))" > |
230 | 230 | <em class="fa fa-arrow-left"></em> |
231 | 231 | </button> |
232 | 232 | <?php |
233 | - } else { |
|
234 | - ?> |
|
233 | + } else { |
|
234 | + ?> |
|
235 | 235 | <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('session_not_in_promotion'), document.getElementById('session_in_promotion'))" onclick="moveItem(document.getElementById('session_not_in_promotion'), document.getElementById('session_in_promotion'))"> |
236 | 236 | <em class="fa fa-arrow-right"></em> |
237 | 237 | </button> |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | <em class="fa fa-arrow-left"></em> |
241 | 241 | </button> |
242 | 242 | <?php |
243 | - } |
|
244 | - ?> |
|
243 | + } |
|
244 | + ?> |
|
245 | 245 | <br /><br /><br /><br /><br /><br /> |
246 | 246 | </td> |
247 | 247 | <td align="center"> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // Setting the name of the tool |
26 | 26 | $tool_name = get_lang('SubscribeSessionsToPromotions'); |
27 | 27 | $add_type = 'multiple'; |
28 | -if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){ |
|
28 | +if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') { |
|
29 | 29 | $add_type = Security::remove_XSS($_REQUEST['add_type']); |
30 | 30 | } |
31 | 31 | |
@@ -123,7 +123,10 @@ discard block |
||
123 | 123 | echo '</div>'; |
124 | 124 | ?> |
125 | 125 | |
126 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
126 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) { |
|
127 | + echo '&add=true' ; |
|
128 | +} |
|
129 | +?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
127 | 130 | <?php echo '<legend>'.$tool_name.' '.$promotion_data['name'].'</legend>'; |
128 | 131 | |
129 | 132 |
@@ -112,7 +112,7 @@ |
||
112 | 112 | <script> |
113 | 113 | $(function() { |
114 | 114 | <?php |
115 | - echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, array(), $action_links, true); |
|
115 | + echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, array(), $action_links, true); |
|
116 | 116 | ?> |
117 | 117 | }); |
118 | 118 | </script> |
@@ -505,8 +505,14 @@ |
||
505 | 505 | <p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p> |
506 | 506 | <blockquote> |
507 | 507 | <pre> |
508 | -<b>LastName</b>;<b>FirstName</b>;<b>Email</b>;UserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;<span style="color:red;"><?php if (count($list) > 0) echo implode(';', $list).';'; ?></span>Courses;ClassId; |
|
509 | -<b>xxx</b>;<b>xxx</b>;<b>xxx</b>;xxx;xxx;<?php echo implode('/', $defined_auth_sources); ?>;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;<span style="color:red;"><?php if (count($list_reponse) > 0) echo implode(';', $list_reponse).';'; ?></span>xxx1|xxx2|xxx3;1;<br /> |
|
508 | +<b>LastName</b>;<b>FirstName</b>;<b>Email</b>;UserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;<span style="color:red;"><?php if (count($list) > 0) { |
|
509 | + echo implode(';', $list).';'; |
|
510 | +} |
|
511 | +?></span>Courses;ClassId; |
|
512 | +<b>xxx</b>;<b>xxx</b>;<b>xxx</b>;xxx;xxx;<?php echo implode('/', $defined_auth_sources); ?>;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;<span style="color:red;"><?php if (count($list_reponse) > 0) { |
|
513 | + echo implode(';', $list_reponse).';'; |
|
514 | +} |
|
515 | +?></span>xxx1|xxx2|xxx3;1;<br /> |
|
510 | 516 | </pre> |
511 | 517 | </blockquote> |
512 | 518 | <p><?php echo get_lang('XMLMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p> |
@@ -345,7 +345,10 @@ discard block |
||
345 | 345 | $searchForm->display(); |
346 | 346 | echo '</div>'; |
347 | 347 | ?> |
348 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;"> |
|
348 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) { |
|
349 | + echo '&add=true' ; |
|
350 | +} |
|
351 | +?>" style="margin:0px;"> |
|
349 | 352 | <?php |
350 | 353 | echo '<legend>'.$tool_name.': '.$data['name'].'</legend>'; |
351 | 354 | |
@@ -420,7 +423,10 @@ discard block |
||
420 | 423 | ?> |
421 | 424 | <br /> |
422 | 425 | <label class="control-label"> |
423 | - <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"';?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id"> |
|
426 | + <input type="checkbox" <?php if ($user_with_any_group) { |
|
427 | + echo 'checked="checked"'; |
|
428 | +} |
|
429 | +?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id"> |
|
424 | 430 | <?php echo get_lang('UsersRegisteredInAnyGroup'); ?> |
425 | 431 | </label> |
426 | 432 | </div> |
@@ -488,7 +488,7 @@ |
||
488 | 488 | $remind_list |
489 | 489 | ); |
490 | 490 | |
491 | - // Destruction of the Question object |
|
491 | + // Destruction of the Question object |
|
492 | 492 | unset($objQuestionTmp); |
493 | 493 | if ($debug) { |
494 | 494 | error_log(" -- end question -- "); |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | } |
732 | 732 | |
733 | 733 | break; |
734 | - case 'get_user_skill_ranking': |
|
734 | + case 'get_user_skill_ranking': |
|
735 | 735 | $columns = array('photo', 'firstname', 'lastname', 'skills_acquired', 'currently_learning', 'rank'); |
736 | 736 | $result = $skill->get_user_list_skill_ranking($start, $limit, $sidx, $sord, $whereCondition); |
737 | 737 | $result = msort($result, 'skills_acquired', 'asc'); |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | |
1282 | 1282 | if (!empty($item['certif_min_score']) && !empty($item['document_id'])) { |
1283 | 1283 | $item['certificates'] = Display::return_icon('accept.png', get_lang('WithCertificate'), array(), ICON_SIZE_SMALL); |
1284 | - $item['has_certificates'] = '1'; |
|
1284 | + $item['has_certificates'] = '1'; |
|
1285 | 1285 | } else { |
1286 | 1286 | $item['certificates'] = Display::return_icon('warning.png', get_lang('NoCertificate'), array(), ICON_SIZE_SMALL); |
1287 | 1287 | $item['has_certificates'] = '0'; |