@@ -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 | |
@@ -324,7 +343,9 @@ discard block |
||
324 | 343 | ); |
325 | 344 | |
326 | 345 | if (empty($sessionId)) { |
327 | - if ($debug) error_log('Session not found'); |
|
346 | + if ($debug) { |
|
347 | + error_log('Session not found'); |
|
348 | + } |
|
328 | 349 | return 'Session not found'; |
329 | 350 | } |
330 | 351 | } |
@@ -405,7 +426,9 @@ discard block |
||
405 | 426 | ); |
406 | 427 | |
407 | 428 | if (empty($courseInfo)) { |
408 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
429 | + if ($debug) { |
|
430 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
431 | + } |
|
409 | 432 | return 'Course not found'; |
410 | 433 | } |
411 | 434 | $courseId = $courseInfo['real_id']; |
@@ -430,7 +453,9 @@ discard block |
||
430 | 453 | |
431 | 454 | $lp = new learnpath($courseCode, $lpId, null); |
432 | 455 | if ($lp) { |
433 | - if ($debug) error_log("LP deleted $lpId"); |
|
456 | + if ($debug) { |
|
457 | + error_log("LP deleted $lpId"); |
|
458 | + } |
|
434 | 459 | |
435 | 460 | $course_dir = $courseInfo['directory'].'/document'; |
436 | 461 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
@@ -446,7 +471,9 @@ discard block |
||
446 | 471 | if ($item) { |
447 | 472 | $documentId = $item->get_path(); |
448 | 473 | |
449 | - if ($debug) error_log("lp item id found #$itemId"); |
|
474 | + if ($debug) { |
|
475 | + error_log("lp item id found #$itemId"); |
|
476 | + } |
|
450 | 477 | |
451 | 478 | $documentInfo = DocumentManager::get_document_data_by_id( |
452 | 479 | $documentId, |
@@ -472,7 +499,9 @@ discard block |
||
472 | 499 | } |
473 | 500 | } |
474 | 501 | } else { |
475 | - if ($debug) error_log("Document not found #$itemId"); |
|
502 | + if ($debug) { |
|
503 | + error_log("Document not found #$itemId"); |
|
504 | + } |
|
476 | 505 | } |
477 | 506 | } |
478 | 507 | } |
@@ -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 -- "); |
@@ -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 |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $cidReq = $c; |
184 | 184 | } |
185 | 185 | if (empty($cidReset)) { |
186 | - if (!isset($_SESSION['_cid']) OR (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid'])) { |
|
186 | + if (!isset($_SESSION['_cid']) or (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid'])) { |
|
187 | 187 | $cidReset = $cidReq; |
188 | 188 | } |
189 | 189 | } |
@@ -1479,7 +1479,7 @@ discard block |
||
1479 | 1479 | if (isset($_cid)) { |
1480 | 1480 | $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
1481 | 1481 | $time = api_get_utc_datetime(); |
1482 | - $sql = "UPDATE $tbl_course SET last_visit = '$time' WHERE code='$_cid'"; |
|
1482 | + $sql = "update $tbl_course SET last_visit = '$time' WHERE code='$_cid'"; |
|
1483 | 1483 | Database::query($sql); |
1484 | 1484 | } |
1485 | 1485 |
@@ -544,7 +544,8 @@ discard block |
||
544 | 544 | // see configuration.php to define these |
545 | 545 | include_once($extAuthSource[$key]['login']); |
546 | 546 | /* >>>>>>>> External authentication modules <<<<<<<<< */ |
547 | - } else { // no standard Chamilo login - try external authentification |
|
547 | + } else { |
|
548 | +// no standard Chamilo login - try external authentification |
|
548 | 549 | //huh... nothing to do... we shouldn't get here |
549 | 550 | error_log( |
550 | 551 | 'Chamilo Authentication file defined in'. |
@@ -891,7 +892,8 @@ discard block |
||
891 | 892 | } |
892 | 893 | Session::write('is_platformAdmin', $is_platformAdmin); |
893 | 894 | Session::write('is_allowedCreateCourse', $is_allowedCreateCourse); |
894 | -} else { // continue with the previous values |
|
895 | +} else { |
|
896 | +// continue with the previous values |
|
895 | 897 | $_user = $_SESSION['_user']; |
896 | 898 | $is_platformAdmin = isset($_SESSION['is_platformAdmin']) ? $_SESSION['is_platformAdmin'] : false; |
897 | 899 | $is_allowedCreateCourse = isset($_SESSION['is_allowedCreateCourse']) ? $_SESSION['is_allowedCreateCourse'] : false; |
@@ -1017,7 +1019,8 @@ discard block |
||
1017 | 1019 | } |
1018 | 1020 | } |
1019 | 1021 | |
1020 | - if (empty($_SESSION['_course']) || empty($_SESSION['_cid'])) { //no previous values... |
|
1022 | + if (empty($_SESSION['_course']) || empty($_SESSION['_cid'])) { |
|
1023 | +//no previous values... |
|
1021 | 1024 | $_cid = -1; // Set default values |
1022 | 1025 | $_course = -1; |
1023 | 1026 | } else { |
@@ -1045,7 +1048,8 @@ discard block |
||
1045 | 1048 | $sql = "SELECT * FROM $group_table |
1046 | 1049 | WHERE c_id = ".$_course['real_id']." AND id = '$gidReq'"; |
1047 | 1050 | $result = Database::query($sql); |
1048 | - if (Database::num_rows($result) > 0) { // This group has recorded status related to this course |
|
1051 | + if (Database::num_rows($result) > 0) { |
|
1052 | +// This group has recorded status related to this course |
|
1049 | 1053 | $gpData = Database::fetch_array($result); |
1050 | 1054 | $_gid = $gpData ['id']; |
1051 | 1055 | Session::write('_gid', $_gid); |
@@ -1169,7 +1173,8 @@ discard block |
||
1169 | 1173 | $result = Database::query($sql); |
1170 | 1174 | |
1171 | 1175 | $cuData = null; |
1172 | - if (Database::num_rows($result) > 0) { // this user have a recorded state for this course |
|
1176 | + if (Database::num_rows($result) > 0) { |
|
1177 | +// this user have a recorded state for this course |
|
1173 | 1178 | $cuData = Database::fetch_array($result, 'ASSOC'); |
1174 | 1179 | |
1175 | 1180 | $is_courseAdmin = (bool) ($cuData['status'] == 1); |
@@ -1327,7 +1332,8 @@ discard block |
||
1327 | 1332 | } |
1328 | 1333 | } |
1329 | 1334 | } |
1330 | - } else { // keys missing => not anymore in the course - user relation |
|
1335 | + } else { |
|
1336 | +// keys missing => not anymore in the course - user relation |
|
1331 | 1337 | // course |
1332 | 1338 | $is_courseMember = false; |
1333 | 1339 | $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) |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * This function is used with $extraField->addElements() |
78 | 78 | * @param array $params array for the insertion into the *_field_values table |
79 | 79 | * @param bool $showQuery |
80 | - * @return mixed false on empty params, void otherwise |
|
80 | + * @return false|null false on empty params, void otherwise |
|
81 | 81 | * @assert (array()) === false |
82 | 82 | */ |
83 | 83 | public function saveFieldValues($params, $showQuery = false) |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * @param int $item_id Item ID (It could be a session_id, course_id or user_id) |
530 | 530 | * @param int $field_id Field ID (the ID from the *_field table) |
531 | 531 | * @param bool $transform Whether to transform the result to a human readable strings |
532 | - * @return mixed A structured array with the field_id and field_value, or false on error |
|
532 | + * @return string A structured array with the field_id and field_value, or false on error |
|
533 | 533 | * @assert (-1,-1) === false |
534 | 534 | */ |
535 | 535 | public function get_values_by_handler_and_field_id($item_id, $field_id, $transform = false) |
@@ -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 | } |
@@ -574,7 +574,7 @@ |
||
574 | 574 | * @param string $filename filename |
575 | 575 | * @param string $source_file path of the file |
576 | 576 | * @param string $course_code |
577 | - * @return mixed web path of the file if sucess, false otherwise |
|
577 | + * @return string|boolean web path of the file if sucess, false otherwise |
|
578 | 578 | */ |
579 | 579 | public function upload_watermark($filename, $source_file, $course_code = null) |
580 | 580 | { |
@@ -445,7 +445,10 @@ |
||
445 | 445 | } |
446 | 446 | } |
447 | 447 | ?> |
448 | - <input type="hidden" name="updatePath" value="<?php if (!$badUpdatePath) echo api_htmlentities($proposedUpdatePath, ENT_QUOTES); ?>" /> |
|
448 | + <input type="hidden" name="updatePath" value="<?php if (!$badUpdatePath) { |
|
449 | + echo api_htmlentities($proposedUpdatePath, ENT_QUOTES); |
|
450 | +} |
|
451 | +?>" /> |
|
449 | 452 | <input type="hidden" name="urlAppendPath" value="<?php echo api_htmlentities($urlAppendPath, ENT_QUOTES); ?>" /> |
450 | 453 | <input type="hidden" name="pathForm" value="<?php echo api_htmlentities($pathForm, ENT_QUOTES); ?>" /> |
451 | 454 | <input type="hidden" name="urlForm" value="<?php echo api_htmlentities($urlForm, ENT_QUOTES); ?>" /> |
@@ -261,7 +261,7 @@ |
||
261 | 261 | ?> |
262 | 262 | <option value="<?php echo $enreg['user_id']; ?>"><?php echo $enreg['username'].' - '.api_get_person_name($enreg['firstname'], $enreg['lastname']); ?></option> |
263 | 263 | <?php |
264 | - } |
|
264 | + } |
|
265 | 265 | unset($nosessionUsersList); |
266 | 266 | ?> |
267 | 267 | </select> |
@@ -55,7 +55,7 @@ |
||
55 | 55 | //$gradebook['name'] = $gradebook['name']; |
56 | 56 | //$gradebook_list[] = $gradebook; |
57 | 57 | } else { |
58 | - // $gradebook['name'] = $gradebook_list[$gradebook['parent_id']]['name'].' > '.$gradebook['name']; |
|
58 | + // $gradebook['name'] = $gradebook_list[$gradebook['parent_id']]['name'].' > '.$gradebook['name']; |
|
59 | 59 | //$gradebook_list[] = $gradebook; |
60 | 60 | } |
61 | 61 | } |