@@ -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 | } |
@@ -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> |
@@ -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'; |
@@ -758,7 +758,7 @@ |
||
758 | 758 | // $gidReset = true; |
759 | 759 | } // end else |
760 | 760 | |
761 | - // Now check for anonymous user mode |
|
761 | + // Now check for anonymous user mode |
|
762 | 762 | if (isset($use_anonymous) && $use_anonymous) { |
763 | 763 | //if anonymous mode is set, then try to set the current user as anonymous |
764 | 764 | //if he doesn't have a login yet |
@@ -523,7 +523,8 @@ discard block |
||
523 | 523 | // see configuration.php to define these |
524 | 524 | include_once($extAuthSource[$key]['login']); |
525 | 525 | /* >>>>>>>> External authentication modules <<<<<<<<< */ |
526 | - } else { // no standard Chamilo login - try external authentification |
|
526 | + } else { |
|
527 | +// no standard Chamilo login - try external authentification |
|
527 | 528 | //huh... nothing to do... we shouldn't get here |
528 | 529 | error_log( |
529 | 530 | 'Chamilo Authentication file defined in'. |
@@ -868,7 +869,8 @@ discard block |
||
868 | 869 | } |
869 | 870 | Session::write('is_platformAdmin', $is_platformAdmin); |
870 | 871 | Session::write('is_allowedCreateCourse', $is_allowedCreateCourse); |
871 | -} else { // continue with the previous values |
|
872 | +} else { |
|
873 | +// continue with the previous values |
|
872 | 874 | $_user = $_SESSION['_user']; |
873 | 875 | $is_platformAdmin = isset($_SESSION['is_platformAdmin']) ? $_SESSION['is_platformAdmin'] : false; |
874 | 876 | $is_allowedCreateCourse = isset($_SESSION['is_allowedCreateCourse']) ? $_SESSION['is_allowedCreateCourse'] : false; |
@@ -1033,7 +1035,8 @@ discard block |
||
1033 | 1035 | } |
1034 | 1036 | } |
1035 | 1037 | |
1036 | - if (empty($_SESSION['_course']) or empty($_SESSION['_cid'])) { //no previous values... |
|
1038 | + if (empty($_SESSION['_course']) or empty($_SESSION['_cid'])) { |
|
1039 | +//no previous values... |
|
1037 | 1040 | $_cid = -1; // Set default values |
1038 | 1041 | $_course = -1; |
1039 | 1042 | } else { |
@@ -1061,7 +1064,8 @@ discard block |
||
1061 | 1064 | $sql = "SELECT * FROM $group_table |
1062 | 1065 | WHERE c_id = ".$_course['real_id']." AND id = '$gidReq'"; |
1063 | 1066 | $result = Database::query($sql); |
1064 | - if (Database::num_rows($result) > 0) { // This group has recorded status related to this course |
|
1067 | + if (Database::num_rows($result) > 0) { |
|
1068 | +// This group has recorded status related to this course |
|
1065 | 1069 | $gpData = Database::fetch_array($result); |
1066 | 1070 | $_gid = $gpData ['id']; |
1067 | 1071 | Session::write('_gid', $_gid); |
@@ -1185,7 +1189,8 @@ discard block |
||
1185 | 1189 | $result = Database::query($sql); |
1186 | 1190 | |
1187 | 1191 | $cuData = null; |
1188 | - if (Database::num_rows($result) > 0) { // this user have a recorded state for this course |
|
1192 | + if (Database::num_rows($result) > 0) { |
|
1193 | +// this user have a recorded state for this course |
|
1189 | 1194 | $cuData = Database::fetch_array($result, 'ASSOC'); |
1190 | 1195 | |
1191 | 1196 | $is_courseAdmin = (bool) ($cuData['status'] == 1); |
@@ -1342,7 +1347,8 @@ discard block |
||
1342 | 1347 | } |
1343 | 1348 | } |
1344 | 1349 | } |
1345 | - } else { // keys missing => not anymore in the course - user relation |
|
1350 | + } else { |
|
1351 | +// keys missing => not anymore in the course - user relation |
|
1346 | 1352 | // course |
1347 | 1353 | $is_courseMember = false; |
1348 | 1354 | $is_courseAdmin = false; |
@@ -720,11 +720,11 @@ discard block |
||
720 | 720 | return false; |
721 | 721 | } |
722 | 722 | |
723 | - /** |
|
724 | - * @param int $itemId |
|
725 | - * @param int $fieldId |
|
726 | - * @return array |
|
727 | - */ |
|
723 | + /** |
|
724 | + * @param int $itemId |
|
725 | + * @param int $fieldId |
|
726 | + * @return array |
|
727 | + */ |
|
728 | 728 | public function getAllValuesByItemAndField($itemId, $fieldId) |
729 | 729 | { |
730 | 730 | $fieldId = intval($fieldId); |
@@ -847,7 +847,6 @@ discard block |
||
847 | 847 | /** |
848 | 848 | * Deletes all values from an item |
849 | 849 | * @param int $itemId (session id, course id, etc) |
850 | - |
|
851 | 850 | * @assert (-1,-1) == null |
852 | 851 | */ |
853 | 852 | public function deleteValuesByItem($itemId) |
@@ -73,7 +73,6 @@ |
||
73 | 73 | * Export the given HTML to PDF, using a global template |
74 | 74 | * |
75 | 75 | * @uses export/table_pdf.tpl |
76 | - |
|
77 | 76 | * @param $content |
78 | 77 | * @param bool|false $saveToFile |
79 | 78 | * @param bool|false $returnHtml |
@@ -546,8 +546,9 @@ |
||
546 | 546 | } |
547 | 547 | } else { |
548 | 548 | $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
549 | - if (file_exists($store_path)) |
|
550 | - $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
549 | + if (file_exists($store_path)) { |
|
550 | + $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
551 | + } |
|
551 | 552 | } |
552 | 553 | return $web_path; |
553 | 554 | } |
@@ -666,7 +666,7 @@ |
||
666 | 666 | $res = Database::query($sql); |
667 | 667 | $count1 = Database::fetch_object($res); |
668 | 668 | $sql = "SELECT COUNT(*) AS n FROM $user_table as u $table ". |
669 | - "WHERE LENGTH(picture_uri) > 0 $url_condition2"; |
|
669 | + "WHERE LENGTH(picture_uri) > 0 $url_condition2"; |
|
670 | 670 | $res = Database::query($sql); |
671 | 671 | $count2 = Database::fetch_object($res); |
672 | 672 | // #users without picture |