@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $rs = Database::query($sql); |
211 | 211 | if (Database::num_rows($rs) > 0) { |
212 | 212 | // update |
213 | - $upd = "UPDATE $tbl_block SET active = 1 WHERE path = '$selected_path'"; |
|
213 | + $upd = "update $tbl_block SET active = 1 WHERE path = '$selected_path'"; |
|
214 | 214 | $result = Database::query($upd); |
215 | 215 | $affected_rows = Database::affected_rows($result); |
216 | 216 | } else { |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $active = 1; |
294 | 294 | } |
295 | 295 | // update active |
296 | - $upd = "UPDATE $tbl_block SET active = '$active' |
|
296 | + $upd = "update $tbl_block SET active = '$active' |
|
297 | 297 | WHERE path = '".$row['path']."'"; |
298 | 298 | Database::query($upd); |
299 | 299 | } |
@@ -496,7 +496,7 @@ |
||
496 | 496 | * @param int User id |
497 | 497 | * @param string plugin path |
498 | 498 | * @param integer $user_id |
499 | - * @return bool |
|
499 | + * @return false|string |
|
500 | 500 | */ |
501 | 501 | public static function close_user_block($user_id, $path) |
502 | 502 | { |
@@ -113,7 +113,8 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return void |
115 | 115 | */ |
116 | - public static function display_dashboard_plugin_checkboxes($plugin_path) { |
|
116 | + public static function display_dashboard_plugin_checkboxes($plugin_path) |
|
117 | + { |
|
117 | 118 | |
118 | 119 | $tbl_block = Database::get_main_table(TABLE_MAIN_BLOCK); |
119 | 120 | |
@@ -525,7 +526,8 @@ discard block |
||
525 | 526 | * get links for styles from dashboard plugins |
526 | 527 | * @return string links |
527 | 528 | */ |
528 | - public static function get_links_for_styles_from_dashboard_plugins() { |
|
529 | + public static function get_links_for_styles_from_dashboard_plugins() |
|
530 | + { |
|
529 | 531 | |
530 | 532 | return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
531 | 533 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | )) { |
66 | 66 | $table_user = Database::get_main_table(TABLE_MAIN_USER); |
67 | 67 | |
68 | - $sql = "UPDATE $table_user |
|
68 | + $sql = "update $table_user |
|
69 | 69 | SET |
70 | 70 | picture_uri = '$new_picture' |
71 | 71 | WHERE user_id = ".api_get_user_id(); |
@@ -46,10 +46,9 @@ discard block |
||
46 | 46 | - Universite Jean Monet (J Dubois / Michel Courbon) |
47 | 47 | - Michel Panckoucke for reporting and fixing a bug |
48 | 48 | - Patrick Cool: fixing security hole |
49 | - |
|
50 | - * @author Roan Embrechts |
|
51 | - * @version 3.0 |
|
52 | - * @package chamilo.auth.ldap |
|
49 | + * @author Roan Embrechts |
|
50 | + * @version 3.0 |
|
51 | + * @package chamilo.auth.ldap |
|
53 | 52 | * Note: |
54 | 53 | * If you are using a firewall, you might need to check port 389 is open in |
55 | 54 | * order for Chamilo to communicate with the LDAP server. |
@@ -207,8 +206,8 @@ discard block |
||
207 | 206 | $language = api_get_setting('platformLanguage'); |
208 | 207 | if (empty($language)) { $language = 'english'; } |
209 | 208 | $_userId = UserManager::create_user($prenom, $nom, $status, |
210 | - $email, $uname, $password, $official_code, |
|
211 | - $language, '', '', 'ldap'); |
|
209 | + $email, $uname, $password, $official_code, |
|
210 | + $language, '', '', 'ldap'); |
|
212 | 211 | |
213 | 212 | //echo "new user added to Chamilo, id = $_userId"; |
214 | 213 | |
@@ -265,7 +264,7 @@ discard block |
||
265 | 264 | // Open anonymous LDAP connection |
266 | 265 | $result = false; |
267 | 266 | $ldap_bind_res = ldap_handle_bind($ds, $result); |
268 | - // Executing the search with the $filter parametr |
|
267 | + // Executing the search with the $filter parametr |
|
269 | 268 | //error_log('Searching for '.$filter.' on LDAP server',0); |
270 | 269 | $sr = ldap_search($ds, $ldap_basedn, $filter); |
271 | 270 | $info = ldap_get_entries($ds, $sr); |
@@ -557,35 +556,35 @@ discard block |
||
557 | 556 | foreach ($UserList as $enreg_user) { |
558 | 557 | $enreg_user = (int) $enreg_user; |
559 | 558 | Database::query("INSERT IGNORE ". |
560 | - " INTO $tbl_session_rel_course_rel_user ". |
|
561 | - "(session_id,c_id,user_id) VALUES ". |
|
562 | - "('$id_session','$enreg_course','$enreg_user')"); |
|
559 | + " INTO $tbl_session_rel_course_rel_user ". |
|
560 | + "(session_id,c_id,user_id) VALUES ". |
|
561 | + "('$id_session','$enreg_course','$enreg_user')"); |
|
563 | 562 | } |
564 | 563 | $sql = "SELECT COUNT(user_id) as nbUsers ". |
565 | - " FROM $tbl_session_rel_course_rel_user ". |
|
566 | - " WHERE session_id='$id_session' ". |
|
567 | - " AND c_id='$enreg_course'"; |
|
564 | + " FROM $tbl_session_rel_course_rel_user ". |
|
565 | + " WHERE session_id='$id_session' ". |
|
566 | + " AND c_id='$enreg_course'"; |
|
568 | 567 | $rs = Database::query($sql); |
569 | 568 | list($nbr_users) = Database::fetch_array($rs); |
570 | 569 | Database::query("UPDATE $tbl_session_rel_course ". |
571 | - " SET nbr_users=$nbr_users ". |
|
572 | - " WHERE session_id='$id_session' ". |
|
573 | - " AND c_id='$enreg_course'"); |
|
570 | + " SET nbr_users=$nbr_users ". |
|
571 | + " WHERE session_id='$id_session' ". |
|
572 | + " AND c_id='$enreg_course'"); |
|
574 | 573 | } |
575 | 574 | foreach ($UserList as $enreg_user) { |
576 | 575 | $enreg_user = (int) $enreg_user; |
577 | 576 | Database::query("INSERT IGNORE INTO $tbl_session_rel_user ". |
578 | - " (session_id, user_id, registered_at) ". |
|
579 | - " VALUES('$id_session','$enreg_user', '".api_get_utc_datetime()."')"); |
|
577 | + " (session_id, user_id, registered_at) ". |
|
578 | + " VALUES('$id_session','$enreg_user', '".api_get_utc_datetime()."')"); |
|
580 | 579 | } |
581 | 580 | // We update the number of users in the session |
582 | 581 | $sql = "SELECT COUNT(user_id) as nbUsers FROM $tbl_session_rel_user ". |
583 | - " WHERE session_id='$id_session' ". |
|
584 | - " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." "; |
|
582 | + " WHERE session_id='$id_session' ". |
|
583 | + " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." "; |
|
585 | 584 | $rs = Database::query($sql); |
586 | 585 | list($nbr_users) = Database::fetch_array($rs); |
587 | 586 | Database::query("UPDATE $tbl_session SET nbr_users=$nbr_users ". |
588 | - " WHERE id='$id_session'"); |
|
587 | + " WHERE id='$id_session'"); |
|
589 | 588 | } |
590 | 589 | |
591 | 590 | function syncro_users() { |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | " AND c_id='$enreg_course'"; |
568 | 568 | $rs = Database::query($sql); |
569 | 569 | list($nbr_users) = Database::fetch_array($rs); |
570 | - Database::query("UPDATE $tbl_session_rel_course ". |
|
570 | + Database::query("update $tbl_session_rel_course ". |
|
571 | 571 | " SET nbr_users=$nbr_users ". |
572 | 572 | " WHERE session_id='$id_session' ". |
573 | 573 | " AND c_id='$enreg_course'"); |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." "; |
585 | 585 | $rs = Database::query($sql); |
586 | 586 | list($nbr_users) = Database::fetch_array($rs); |
587 | - Database::query("UPDATE $tbl_session SET nbr_users=$nbr_users ". |
|
587 | + Database::query("update $tbl_session SET nbr_users=$nbr_users ". |
|
588 | 588 | " WHERE id='$id_session'"); |
589 | 589 | } |
590 | 590 |
@@ -71,23 +71,32 @@ discard block |
||
71 | 71 | * @author Roan Embrechts (based on code from Universit� Jean Monet) |
72 | 72 | */ |
73 | 73 | |
74 | -function ldap_login($login, $password) { |
|
74 | +function ldap_login($login, $password) |
|
75 | +{ |
|
75 | 76 | //error_log('Entering ldap_login('.$login.','.$password.')',0); |
76 | 77 | $res = ldap_authentication_check($login, $password); |
77 | 78 | |
78 | 79 | // res=-1 -> the user does not exist in the ldap database |
79 | 80 | // res=1 -> invalid password (user does exist) |
80 | 81 | |
81 | - if ($res == 1) { //WRONG PASSWORD |
|
82 | + if ($res == 1) { |
|
83 | +//WRONG PASSWORD |
|
82 | 84 | //$errorMessage = "LDAP User or password incorrect, try again.<br />"; |
83 | - if (isset($log)) unset($log); if (isset($uid)) unset($uid); |
|
85 | + if (isset($log)) { |
|
86 | + unset($log); |
|
87 | + } |
|
88 | + if (isset($uid)) { |
|
89 | + unset($uid); |
|
90 | + } |
|
84 | 91 | $loginLdapSucces = false; |
85 | 92 | } |
86 | - if ($res == -1) { //WRONG USERNAME |
|
93 | + if ($res == -1) { |
|
94 | +//WRONG USERNAME |
|
87 | 95 | //$errorMessage = "LDAP User or password incorrect, try again.<br />"; |
88 | 96 | $login_ldap_success = false; |
89 | 97 | } |
90 | - if ($res == 0) { //LOGIN & PASSWORD OK - SUCCES |
|
98 | + if ($res == 0) { |
|
99 | +//LOGIN & PASSWORD OK - SUCCES |
|
91 | 100 | //$errorMessage = "Successful login w/ LDAP.<br>"; |
92 | 101 | $login_ldap_success = true; |
93 | 102 | } |
@@ -103,7 +112,8 @@ discard block |
||
103 | 112 | * @author Stefan De Wannemacker |
104 | 113 | * @author Roan Embrechts |
105 | 114 | */ |
106 | -function ldap_find_user_info($login) { |
|
115 | +function ldap_find_user_info($login) |
|
116 | +{ |
|
107 | 117 | //error_log('Entering ldap_find_user_info('.$login.')',0); |
108 | 118 | global $ldap_host, $ldap_port, $ldap_basedn, $ldap_rdn, $ldap_pass, $ldap_search_dn; |
109 | 119 | // basic sequence with LDAP is connect, bind, search, |
@@ -154,7 +164,8 @@ discard block |
||
154 | 164 | * "firstname", "name", "email", "isEmployee" |
155 | 165 | * @author Roan Embrechts |
156 | 166 | */ |
157 | -function ldap_put_user_info_locally($login, $info_array) { |
|
167 | +function ldap_put_user_info_locally($login, $info_array) |
|
168 | +{ |
|
158 | 169 | //error_log('Entering ldap_put_user_info_locally('.$login.',info_array)',0); |
159 | 170 | global $ldap_pass_placeholder; |
160 | 171 | global $submitRegistration, $submit, $uname, $email, |
@@ -242,7 +253,8 @@ discard block |
||
242 | 253 | * @param string password given by user |
243 | 254 | * @return int 0 if authentication succeeded, 1 if password was incorrect, -1 if it didn't belong to LDAP |
244 | 255 | */ |
245 | -function ldap_authentication_check($uname, $passwd) { |
|
256 | +function ldap_authentication_check($uname, $passwd) |
|
257 | +{ |
|
246 | 258 | //error_log('Entering ldap_authentication_check('.$uname.','.$passwd.')',0); |
247 | 259 | global $ldap_host, $ldap_port, $ldap_basedn, $ldap_host2, $ldap_port2, $ldap_rdn, $ldap_pass; |
248 | 260 | //error_log('Entering ldap_authentication_check('.$uname.','.$passwd.')',0); |
@@ -293,7 +305,8 @@ discard block |
||
293 | 305 | // return in case of wrong password connection error |
294 | 306 | if (@ldap_bind($ds, $dn, $passwd) === false) { |
295 | 307 | return (1); // invalid password |
296 | - } else {// connection successfull |
|
308 | + } else { |
|
309 | +// connection successfull |
|
297 | 310 | return (0); |
298 | 311 | } |
299 | 312 | } // end of check |
@@ -302,7 +315,8 @@ discard block |
||
302 | 315 | * @param resource resource LDAP connexion resource, passed by reference. |
303 | 316 | * @return void |
304 | 317 | */ |
305 | -function ldap_set_version(&$resource) { |
|
318 | +function ldap_set_version(&$resource) |
|
319 | +{ |
|
306 | 320 | //error_log('Entering ldap_set_version(&$resource)',0); |
307 | 321 | global $ldap_version; |
308 | 322 | if ($ldap_version > 2) { |
@@ -318,7 +332,8 @@ discard block |
||
318 | 332 | * @param boolean $ldap_bind |
319 | 333 | * @return boolean Status of the bind assignment. True for success, false for failure. |
320 | 334 | */ |
321 | -function ldap_handle_bind(&$ldap_handler, &$ldap_bind) { |
|
335 | +function ldap_handle_bind(&$ldap_handler, &$ldap_bind) |
|
336 | +{ |
|
322 | 337 | //error_log('Entering ldap_handle_bind(&$ldap_handler,&$ldap_bind)',0); |
323 | 338 | global $ldap_rdn, $ldap_pass, $extldap_config; |
324 | 339 | $ldap_rdn = $extldap_config['admin_dn']; |
@@ -347,7 +362,8 @@ discard block |
||
347 | 362 | * @see SortableTable#get_total_number_of_items() |
348 | 363 | * @author Mustapha Alouani |
349 | 364 | */ |
350 | -function ldap_get_users() { |
|
365 | +function ldap_get_users() |
|
366 | +{ |
|
351 | 367 | |
352 | 368 | global $ldap_basedn, $ldap_host, $ldap_port, $ldap_rdn, $ldap_pass, $ldap_search_dn, $extldap_user_correspondance; |
353 | 369 | |
@@ -394,8 +410,9 @@ discard block |
||
394 | 410 | return $info; |
395 | 411 | |
396 | 412 | } else { |
397 | - if (count($ldap_query) != 0) |
|
398 | - echo Display::return_message(get_lang('LDAPConnectionError'), 'error'); |
|
413 | + if (count($ldap_query) != 0) { |
|
414 | + echo Display::return_message(get_lang('LDAPConnectionError'), 'error'); |
|
415 | + } |
|
399 | 416 | return array(); |
400 | 417 | } |
401 | 418 | } |
@@ -405,7 +422,8 @@ discard block |
||
405 | 422 | * @see SortableTable#get_total_number_of_items() |
406 | 423 | * @author Mustapha Alouani |
407 | 424 | */ |
408 | -function ldap_get_number_of_users() { |
|
425 | +function ldap_get_number_of_users() |
|
426 | +{ |
|
409 | 427 | $info = ldap_get_users(); |
410 | 428 | if (count($info) > 0) { |
411 | 429 | return $info['count']; |
@@ -419,7 +437,8 @@ discard block |
||
419 | 437 | * @see SortableTable#get_table_data($from) |
420 | 438 | * @author Mustapha Alouani |
421 | 439 | */ |
422 | -function ldap_get_user_data($from, $number_of_items, $column, $direction) { |
|
440 | +function ldap_get_user_data($from, $number_of_items, $column, $direction) |
|
441 | +{ |
|
423 | 442 | |
424 | 443 | global $extldap_user_correspondance; |
425 | 444 | |
@@ -463,7 +482,8 @@ discard block |
||
463 | 482 | * @return string Some HTML-code with modify-buttons |
464 | 483 | * @author Mustapha Alouani |
465 | 484 | */ |
466 | -function modify_filter($user_id, $url_params, $row) { |
|
485 | +function modify_filter($user_id, $url_params, $row) |
|
486 | +{ |
|
467 | 487 | $query_string = "id[]=".$row[0]; |
468 | 488 | if (!empty($_GET['id_session'])) { |
469 | 489 | $query_string .= '&id_session='.Security::remove_XSS($_GET['id_session']); |
@@ -478,13 +498,15 @@ discard block |
||
478 | 498 | * @param string username (and uid inside LDAP) |
479 | 499 | * @author Mustapha Alouani |
480 | 500 | */ |
481 | -function ldap_add_user($login) { |
|
501 | +function ldap_add_user($login) |
|
502 | +{ |
|
482 | 503 | if ($ldap_user = extldap_authenticate($login, 'nopass', true)) { |
483 | 504 | return extldap_add_user_by_array($ldap_user); |
484 | 505 | } |
485 | 506 | } |
486 | 507 | |
487 | -function ldap_add_user_by_array($data, $update_if_exists = true) { |
|
508 | +function ldap_add_user_by_array($data, $update_if_exists = true) |
|
509 | +{ |
|
488 | 510 | |
489 | 511 | $lastname = api_convert_encoding($data['sn'][0], api_get_system_encoding(), 'UTF-8'); |
490 | 512 | $firstname = api_convert_encoding($data['cn'][0], api_get_system_encoding(), 'UTF-8'); |
@@ -533,7 +555,8 @@ discard block |
||
533 | 555 | * @param string Course code |
534 | 556 | * @return void |
535 | 557 | */ |
536 | -function ldap_add_user_to_session($UserList, $id_session) { |
|
558 | +function ldap_add_user_to_session($UserList, $id_session) |
|
559 | +{ |
|
537 | 560 | |
538 | 561 | // Database Table Definitions |
539 | 562 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
@@ -588,7 +611,8 @@ discard block |
||
588 | 611 | " WHERE id='$id_session'"); |
589 | 612 | } |
590 | 613 | |
591 | -function syncro_users() { |
|
614 | +function syncro_users() |
|
615 | +{ |
|
592 | 616 | global $ldap_basedn, $ldap_host, $ldap_port, $ldap_rdn, $ldap_pass, $ldap_search_dn; |
593 | 617 | echo "Connecting ..."; |
594 | 618 | $ldap_connect = ldap_connect($ldap_host, $ldap_port); |
@@ -1449,7 +1449,8 @@ |
||
1449 | 1449 | $value, |
1450 | 1450 | $regs |
1451 | 1451 | ) |
1452 | - ) { // possibly in <...> |
|
1452 | + ) { |
|
1453 | +// possibly in <...> |
|
1453 | 1454 | if (($kwlist = trim($regs[1])) != '') { |
1454 | 1455 | $kw = '<i kw="'.htmlspecialchars($kwlist).'">'; |
1455 | 1456 | } else { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | $sessionId = intval($sessionId); |
138 | 138 | if ($linkUrl != '') { |
139 | - $sql = "UPDATE $tblLink SET |
|
139 | + $sql = "update $tblLink SET |
|
140 | 140 | url = '$linkUrl' |
141 | 141 | WHERE id = $linkId AND c_id = $courseId AND session_id = $sessionId"; |
142 | 142 | $resLink = Database::query($sql); |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | |
352 | 352 | if ($linkId) { |
353 | 353 | // iid |
354 | - $sql = "UPDATE $tbl_categories SET id = iid WHERE iid = $linkId"; |
|
354 | + $sql = "update $tbl_categories SET id = iid WHERE iid = $linkId"; |
|
355 | 355 | Database:: query($sql); |
356 | 356 | |
357 | 357 | // add link_category visibility |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | // -> Items are no longer physically deleted, |
394 | 394 | // but the visibility is set to 2 (in item_property). |
395 | 395 | // This will make a restore function possible for the platform administrator. |
396 | - $sql = "UPDATE $tbl_link SET on_homepage='0' |
|
396 | + $sql = "update $tbl_link SET on_homepage='0' |
|
397 | 397 | WHERE c_id = $course_id AND id='".$id."'"; |
398 | 398 | Database:: query($sql); |
399 | 399 | |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | ); |
1352 | 1352 | |
1353 | 1353 | if (Database:: num_rows($result) >= 1 && ($row = Database:: fetch_array($result))) { |
1354 | - $sql = "UPDATE $tbl_link SET |
|
1354 | + $sql = "update $tbl_link SET |
|
1355 | 1355 | title = '".Database:: escape_string($title)."', |
1356 | 1356 | description = '" . Database:: escape_string($description)."' |
1357 | 1357 | WHERE c_id = $course_id AND id='".Database:: escape_string($row['id'])."'"; |
@@ -856,8 +856,8 @@ discard block |
||
856 | 856 | |
857 | 857 | /** |
858 | 858 | * @param integer $categoryId |
859 | - * @param $courseId |
|
860 | - * @param $sessionId |
|
859 | + * @param integer $courseId |
|
860 | + * @param integer $sessionId |
|
861 | 861 | * @param bool $withBaseContent |
862 | 862 | * |
863 | 863 | * @return array |
@@ -1485,6 +1485,7 @@ discard block |
||
1485 | 1485 | * This function checks if the url is a vimeo link |
1486 | 1486 | * @author Julio Montoya |
1487 | 1487 | * @version 1.0 |
1488 | + * @param string $url |
|
1488 | 1489 | */ |
1489 | 1490 | public static function isVimeoLink($url) |
1490 | 1491 | { |
@@ -1519,6 +1520,7 @@ discard block |
||
1519 | 1520 | * @author Jorge Frisancho |
1520 | 1521 | * @author Julio Montoya - Fixing code |
1521 | 1522 | * @version 1.0 |
1523 | + * @param string $url |
|
1522 | 1524 | */ |
1523 | 1525 | public static function is_youtube_link($url) |
1524 | 1526 | { |
@@ -1971,8 +1971,8 @@ |
||
1971 | 1971 | if (!empty($proxySettings) && |
1972 | 1972 | isset($proxySettings['curl_setopt_array']) |
1973 | 1973 | ) { |
1974 | - $defaults[CURLOPT_PROXY] = $proxySettings['curl_setopt_array']['CURLOPT_PROXY']; |
|
1975 | - $defaults[CURLOPT_PROXYPORT] = $proxySettings['curl_setopt_array']['CURLOPT_PROXYPORT']; |
|
1974 | + $defaults[CURLOPT_PROXY] = $proxySettings['curl_setopt_array']['CURLOPT_PROXY']; |
|
1975 | + $defaults[CURLOPT_PROXYPORT] = $proxySettings['curl_setopt_array']['CURLOPT_PROXYPORT']; |
|
1976 | 1976 | } |
1977 | 1977 | |
1978 | 1978 | // Create a new cURL resource |
@@ -3725,7 +3725,7 @@ discard block |
||
3725 | 3725 | session_id = $session_id"; |
3726 | 3726 | $rs = Database::query($sql); |
3727 | 3727 | if (Database::num_rows($rs) > 0) { |
3728 | - $sql = "UPDATE $tableItemProperty |
|
3728 | + $sql = "update $tableItemProperty |
|
3729 | 3729 | SET lastedit_type = '".str_replace('_', '', ucwords($tool))."Deleted', |
3730 | 3730 | lastedit_date = '$time', |
3731 | 3731 | lastedit_user_id = $user_id, |
@@ -3739,12 +3739,12 @@ discard block |
||
3739 | 3739 | $result = Database::query($sql); |
3740 | 3740 | $id = Database::insert_id(); |
3741 | 3741 | if ($id) { |
3742 | - $sql = "UPDATE $tableItemProperty SET id = iid WHERE iid = $id"; |
|
3742 | + $sql = "update $tableItemProperty SET id = iid WHERE iid = $id"; |
|
3743 | 3743 | Database::query($sql); |
3744 | 3744 | } |
3745 | 3745 | } |
3746 | 3746 | } else { |
3747 | - $sql = "UPDATE $tableItemProperty |
|
3747 | + $sql = "update $tableItemProperty |
|
3748 | 3748 | SET |
3749 | 3749 | lastedit_type='".str_replace('_', '', ucwords($tool))."Deleted', |
3750 | 3750 | lastedit_date='$time', |
@@ -3766,7 +3766,7 @@ discard block |
||
3766 | 3766 | session_id = $session_id"; |
3767 | 3767 | $rs = Database::query($sql); |
3768 | 3768 | if (Database::num_rows($rs) > 0) { |
3769 | - $sql = "UPDATE $tableItemProperty |
|
3769 | + $sql = "update $tableItemProperty |
|
3770 | 3770 | SET |
3771 | 3771 | lastedit_type='".str_replace('_', '', ucwords($tool))."Visible', |
3772 | 3772 | lastedit_date='$time', |
@@ -3781,12 +3781,12 @@ discard block |
||
3781 | 3781 | $result = Database::query($sql); |
3782 | 3782 | $id = Database::insert_id(); |
3783 | 3783 | if ($id) { |
3784 | - $sql = "UPDATE $tableItemProperty SET id = iid WHERE iid = $id"; |
|
3784 | + $sql = "update $tableItemProperty SET id = iid WHERE iid = $id"; |
|
3785 | 3785 | Database::query($sql); |
3786 | 3786 | } |
3787 | 3787 | } |
3788 | 3788 | } else { |
3789 | - $sql = "UPDATE $tableItemProperty |
|
3789 | + $sql = "update $tableItemProperty |
|
3790 | 3790 | SET |
3791 | 3791 | lastedit_type='".str_replace('_', '', ucwords($tool))."Visible', |
3792 | 3792 | lastedit_date='$time', |
@@ -3808,7 +3808,7 @@ discard block |
||
3808 | 3808 | session_id = $session_id"; |
3809 | 3809 | $rs = Database::query($sql); |
3810 | 3810 | if (Database::num_rows($rs) > 0) { |
3811 | - $sql = "UPDATE $tableItemProperty |
|
3811 | + $sql = "update $tableItemProperty |
|
3812 | 3812 | SET |
3813 | 3813 | lastedit_type = '".str_replace('_', '', ucwords($tool))."Invisible', |
3814 | 3814 | lastedit_date = '$time', |
@@ -3823,12 +3823,12 @@ discard block |
||
3823 | 3823 | $result = Database::query($sql); |
3824 | 3824 | $id = Database::insert_id(); |
3825 | 3825 | if ($id) { |
3826 | - $sql = "UPDATE $tableItemProperty SET id = iid WHERE iid = $id"; |
|
3826 | + $sql = "update $tableItemProperty SET id = iid WHERE iid = $id"; |
|
3827 | 3827 | Database::query($sql); |
3828 | 3828 | } |
3829 | 3829 | } |
3830 | 3830 | } else { |
3831 | - $sql = "UPDATE $tableItemProperty |
|
3831 | + $sql = "update $tableItemProperty |
|
3832 | 3832 | SET |
3833 | 3833 | lastedit_type = '".str_replace('_', '', ucwords($tool))."Invisible', |
3834 | 3834 | lastedit_date = '$time', |
@@ -3842,7 +3842,7 @@ discard block |
||
3842 | 3842 | $set_type = ", lastedit_type = '$last_edit_type' "; |
3843 | 3843 | $visibility = '1'; |
3844 | 3844 | //$filter .= $to_filter; already added |
3845 | - $sql = "UPDATE $tableItemProperty |
|
3845 | + $sql = "update $tableItemProperty |
|
3846 | 3846 | SET |
3847 | 3847 | lastedit_date = '$time', |
3848 | 3848 | lastedit_user_id = $user_id $set_type |
@@ -4775,7 +4775,7 @@ discard block |
||
4775 | 4775 | $document_id = Database::insert($table, $params); |
4776 | 4776 | if ($document_id) { |
4777 | 4777 | |
4778 | - $sql = "UPDATE $table SET id = iid WHERE iid = $document_id"; |
|
4778 | + $sql = "update $table SET id = iid WHERE iid = $document_id"; |
|
4779 | 4779 | Database::query($sql); |
4780 | 4780 | |
4781 | 4781 | api_item_property_update( |
@@ -5107,7 +5107,7 @@ discard block |
||
5107 | 5107 | if (Database::num_rows($res) > 0) { |
5108 | 5108 | // Found item for this access_url. |
5109 | 5109 | $row = Database::fetch_array($res); |
5110 | - $sql = "UPDATE $t_settings SET selected_value = '$value' |
|
5110 | + $sql = "update $t_settings SET selected_value = '$value' |
|
5111 | 5111 | WHERE id = ".$row['id']; |
5112 | 5112 | Database::query($sql); |
5113 | 5113 | } else { |
@@ -5190,7 +5190,7 @@ discard block |
||
5190 | 5190 | if (empty($access_url)) { $access_url = 1; } |
5191 | 5191 | if (isset($value)) { |
5192 | 5192 | $value = Database::escape_string($value); |
5193 | - $sql = "UPDATE $t_s SET selected_value = '$value' |
|
5193 | + $sql = "update $t_s SET selected_value = '$value' |
|
5194 | 5194 | WHERE category = '$category' AND access_url = $access_url"; |
5195 | 5195 | if (is_array($fieldtype) && count($fieldtype) > 0) { |
5196 | 5196 | $sql .= " AND ( "; |
@@ -5208,7 +5208,7 @@ discard block |
||
5208 | 5208 | $res = Database::query($sql); |
5209 | 5209 | return $res !== false; |
5210 | 5210 | } else { |
5211 | - $sql = "UPDATE $t_s SET selected_value = NULL |
|
5211 | + $sql = "update $t_s SET selected_value = NULL |
|
5212 | 5212 | WHERE category = '$category' AND access_url = $access_url"; |
5213 | 5213 | if (is_array($fieldtype) && count($fieldtype) > 0) { |
5214 | 5214 | $sql .= " AND ( "; |
@@ -5477,7 +5477,7 @@ discard block |
||
5477 | 5477 | $course_table = Database::get_main_table(TABLE_MAIN_COURSE); |
5478 | 5478 | $course_cat_table = Database::get_main_table(TABLE_MAIN_CATEGORY); |
5479 | 5479 | |
5480 | - $sql = "SELECT |
|
5480 | + $sql = "select |
|
5481 | 5481 | $course_table.category_code, |
5482 | 5482 | $course_table.visibility, |
5483 | 5483 | $course_table.code, |
@@ -7663,11 +7663,11 @@ discard block |
||
7663 | 7663 | function api_register_campus($listCampus = true) { |
7664 | 7664 | $tbl_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
7665 | 7665 | |
7666 | - $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='registered'"; |
|
7666 | + $sql = "update $tbl_settings SET selected_value='true' WHERE variable='registered'"; |
|
7667 | 7667 | Database::query($sql); |
7668 | 7668 | |
7669 | 7669 | if (!$listCampus) { |
7670 | - $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='donotlistcampus'"; |
|
7670 | + $sql = "update $tbl_settings SET selected_value='true' WHERE variable='donotlistcampus'"; |
|
7671 | 7671 | Database::query($sql); |
7672 | 7672 | } |
7673 | 7673 | } |
@@ -1266,6 +1266,7 @@ discard block |
||
1266 | 1266 | * Gets the list of courses a specific user is subscribed to |
1267 | 1267 | * @param int User ID |
1268 | 1268 | * @param boolean $fetch_session Whether to get session courses or not - NOT YET IMPLEMENTED |
1269 | + * @param integer $userid |
|
1269 | 1270 | * @return array Array of courses in the form [0]=>('code'=>xxx,'db'=>xxx,'dir'=>xxx,'status'=>d) |
1270 | 1271 | * @deprecated use CourseManager::get_courses_list_by_user_id() |
1271 | 1272 | */ |
@@ -1751,7 +1752,7 @@ discard block |
||
1751 | 1752 | |
1752 | 1753 | /** |
1753 | 1754 | * Set that we are in a page inside a gradebook |
1754 | - * @return bool |
|
1755 | + * @return boolean|null |
|
1755 | 1756 | */ |
1756 | 1757 | function api_set_in_gradebook() |
1757 | 1758 | { |
@@ -3092,7 +3093,7 @@ discard block |
||
3092 | 3093 | * on the session visibility |
3093 | 3094 | * @param bool $tutor Whether to check if the user has the tutor role |
3094 | 3095 | * @param bool $coach Whether to check if the user has the coach role |
3095 | -* @return boolean true: the user has the rights to edit, false: he does not |
|
3096 | +* @return boolean|null true: the user has the rights to edit, false: he does not |
|
3096 | 3097 | */ |
3097 | 3098 | function api_is_allowed_to_session_edit($tutor = false, $coach = false) |
3098 | 3099 | { |
@@ -3132,7 +3133,7 @@ discard block |
||
3132 | 3133 | * Checks whether the user is allowed in a specific tool for a specific action |
3133 | 3134 | * @param string $tool the tool we are checking if the user has a certain permission |
3134 | 3135 | * @param string $action the action we are checking (add, edit, delete, move, visibility) |
3135 | - * @return bool |
|
3136 | + * @return boolean|null |
|
3136 | 3137 | * @author Patrick Cool <[email protected]>, Ghent University |
3137 | 3138 | * @author Julio Montoya |
3138 | 3139 | * @version 1.0 |
@@ -5077,7 +5078,7 @@ discard block |
||
5077 | 5078 | * @param string The category if any (in most cases, this will remain null) |
5078 | 5079 | * @param int The access_url for which this parameter is valid |
5079 | 5080 | * @param string $cat |
5080 | - * @return bool|null |
|
5081 | + * @return false|null |
|
5081 | 5082 | */ |
5082 | 5083 | function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url = 1) |
5083 | 5084 | { |
@@ -5300,6 +5301,7 @@ discard block |
||
5300 | 5301 | * @param string Whether we want a simple list (display a category) or |
5301 | 5302 | * a grouped list (group by variable as in settings.php default). Values: 'list' or 'group' |
5302 | 5303 | * @param int Access URL's ID. Optional. Uses 1 by default, which is the unique URL |
5304 | + * @param string $cat |
|
5303 | 5305 | * @return array Array of database results for the current settings of the current access URL |
5304 | 5306 | */ |
5305 | 5307 | function &api_get_settings($cat = null, $ordering = 'list', $access_url = 1, $url_changeable = 0) |
@@ -6374,6 +6376,7 @@ discard block |
||
6374 | 6376 | |
6375 | 6377 | /** |
6376 | 6378 | * Returns the <script> HTML tag |
6379 | + * @param string $file |
|
6377 | 6380 | * @return string |
6378 | 6381 | */ |
6379 | 6382 | function api_get_asset($file) |
@@ -6697,7 +6700,7 @@ discard block |
||
6697 | 6700 | /** |
6698 | 6701 | * Returns an array of global configuration settings which should be ignored |
6699 | 6702 | * when printing the configuration settings screens |
6700 | - * @return array Array of strings, each identifying one of the excluded settings |
|
6703 | + * @return string[] Array of strings, each identifying one of the excluded settings |
|
6701 | 6704 | */ |
6702 | 6705 | function api_get_locked_settings() { |
6703 | 6706 | return array( |
@@ -6738,6 +6741,7 @@ discard block |
||
6738 | 6741 | * false if he isn't. If the user ID is given and is an integer, then the same |
6739 | 6742 | * ID is simply returned |
6740 | 6743 | * @param integer User ID |
6744 | + * @param integer $user_id |
|
6741 | 6745 | * @return boolean Integer User ID is logged in, or false otherwise |
6742 | 6746 | */ |
6743 | 6747 | function api_user_is_login($user_id = null) { |
@@ -7163,6 +7167,7 @@ discard block |
||
7163 | 7167 | /** |
7164 | 7168 | * Gets memory limit in bytes |
7165 | 7169 | * @param string The memory size (128M, 1G, 1000K, etc) |
7170 | + * @param string $mem |
|
7166 | 7171 | * @return int |
7167 | 7172 | * @assert (null) === false |
7168 | 7173 | * @assert ('1t') === 1099511627776 |
@@ -655,7 +655,6 @@ discard block |
||
655 | 655 | * Also, this function provides conversion between path types, in this case the input path points inside the Chamilo area too. |
656 | 656 | * |
657 | 657 | * See $_configuration['course_folder'] in the configuration.php to alter the WEB_COURSE_PATH and SYS_COURSE_PATH parameters. |
658 | - |
|
659 | 658 | * @param string $path (optional) A path which type is to be converted. Also, it may be a defined constant for a path. |
660 | 659 | * This parameter has meaning when $type parameter has one of the following values: TO_WEB, TO_SYS, TO_REL. Otherwise it is ignored. |
661 | 660 | * @return string The requested path or the converted path. |
@@ -1838,7 +1837,6 @@ discard block |
||
1838 | 1837 | |
1839 | 1838 | /** |
1840 | 1839 | * Returns the current course info array. |
1841 | - |
|
1842 | 1840 | * Now if the course_code is given, the returned array gives info about that |
1843 | 1841 | * particular course, not specially the current one. |
1844 | 1842 | * @param int $id Numeric ID of the course |
@@ -4223,7 +4221,7 @@ discard block |
||
4223 | 4221 | $countryCode = languageToCountryIsoCode($currentLanguageInfo['isocode']); |
4224 | 4222 | $url = api_get_self(); |
4225 | 4223 | if ($showAsButton) { |
4226 | - $html = '<div class="btn-group"> |
|
4224 | + $html = '<div class="btn-group"> |
|
4227 | 4225 | <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> |
4228 | 4226 | <span class="flag-icon flag-icon-'.$countryCode.'"></span> |
4229 | 4227 | '.$currentLanguageInfo['original_name'].' |
@@ -6498,7 +6496,7 @@ discard block |
||
6498 | 6496 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6499 | 6497 | $libraries = array(); |
6500 | 6498 | if ($include_jqgrid) { |
6501 | - $libraries[] = 'jqgrid'; |
|
6499 | + $libraries[] = 'jqgrid'; |
|
6502 | 6500 | } |
6503 | 6501 | return api_get_jquery_libraries_js($libraries); |
6504 | 6502 | } |
@@ -1956,7 +1956,7 @@ |
||
1956 | 1956 | $url_image = $webCourseHome.'/course-pic.png'; |
1957 | 1957 | $_course['course_image_large_source'] = $courseSys.'/course-pic.png'; |
1958 | 1958 | } else { |
1959 | - $url_image = Display::return_icon( |
|
1959 | + $url_image = Display::return_icon( |
|
1960 | 1960 | 'session_default.png', |
1961 | 1961 | null, |
1962 | 1962 | null, |
@@ -906,7 +906,8 @@ discard block |
||
906 | 906 | // becomes |
907 | 907 | // http://localhost/chamilo/courses/TEST/document/image.png |
908 | 908 | // TEST is a course directory name, so called "system course code". |
909 | - if (strpos($path, 'download.php') !== false) { // Fast detection first. |
|
909 | + if (strpos($path, 'download.php') !== false) { |
|
910 | +// Fast detection first. |
|
910 | 911 | $path = urldecode($path); |
911 | 912 | if (preg_match('/(.*)main\/document\/download.php\?doc_url=\/(.*)&cDir=\/(.*)?/', $path, $matches)) { |
912 | 913 | $sys_course_code = |
@@ -938,7 +939,8 @@ discard block |
||
938 | 939 | global $_configuration; |
939 | 940 | $web_root = api_get_path(WEB_PATH); |
940 | 941 | $ext = substr($web_path, strrpos($web_path, '.')); |
941 | - if (isset($ext[2])) { // faster version of strlen to check if len>2 |
|
942 | + if (isset($ext[2])) { |
|
943 | +// faster version of strlen to check if len>2 |
|
942 | 944 | // Check for CDN definitions |
943 | 945 | if (!empty($_configuration['cdn_enable']) && !empty($ext)) { |
944 | 946 | foreach ($_configuration['cdn'] as $host => $exts) { |
@@ -957,7 +959,8 @@ discard block |
||
957 | 959 | * @return bool Return true if CAS authentification is activated |
958 | 960 | * |
959 | 961 | */ |
960 | -function api_is_cas_activated() { |
|
962 | +function api_is_cas_activated() |
|
963 | +{ |
|
961 | 964 | return api_get_setting('cas_activate') == "true"; |
962 | 965 | } |
963 | 966 | |
@@ -965,7 +968,8 @@ discard block |
||
965 | 968 | * @return bool Return true if LDAP authentification is activated |
966 | 969 | * |
967 | 970 | */ |
968 | -function api_is_ldap_activated() { |
|
971 | +function api_is_ldap_activated() |
|
972 | +{ |
|
969 | 973 | global $extAuthSource; |
970 | 974 | return is_array($extAuthSource[LDAP_AUTH_SOURCE]); |
971 | 975 | } |
@@ -1012,7 +1016,8 @@ discard block |
||
1012 | 1016 | * Note: The built-in function filter_var($urs, FILTER_VALIDATE_URL) has a bug for some versions of PHP. |
1013 | 1017 | * @link http://bugs.php.net/51192 |
1014 | 1018 | */ |
1015 | -function api_valid_url($url, $absolute = false) { |
|
1019 | +function api_valid_url($url, $absolute = false) |
|
1020 | +{ |
|
1016 | 1021 | if ($absolute) { |
1017 | 1022 | if (preg_match(" |
1018 | 1023 | /^ # Start at the beginning of the text |
@@ -1208,7 +1213,8 @@ discard block |
||
1208 | 1213 | /** |
1209 | 1214 | * @return array with the navigator name and version |
1210 | 1215 | */ |
1211 | -function api_get_navigator() { |
|
1216 | +function api_get_navigator() |
|
1217 | +{ |
|
1212 | 1218 | $navigator = 'Unknown'; |
1213 | 1219 | $version = 0; |
1214 | 1220 | |
@@ -1327,10 +1333,12 @@ discard block |
||
1327 | 1333 | |
1328 | 1334 | $result['firstname'] = null; |
1329 | 1335 | $result['lastname'] = null; |
1330 | - if (isset($user['firstname']) && isset($user['lastname'])) { // with only lowercase |
|
1336 | + if (isset($user['firstname']) && isset($user['lastname'])) { |
|
1337 | +// with only lowercase |
|
1331 | 1338 | $result['firstname'] = $user['firstname']; |
1332 | 1339 | $result['lastname'] = $user['lastname']; |
1333 | - } elseif (isset($user['firstName']) && isset($user['lastName'])) { // with uppercase letters |
|
1340 | + } elseif (isset($user['firstName']) && isset($user['lastName'])) { |
|
1341 | +// with uppercase letters |
|
1334 | 1342 | $result['firstname'] = isset($user['firstName']) ? $user['firstName'] : null; |
1335 | 1343 | $result['lastname'] = isset($user['lastName']) ? $user['lastName'] : null; |
1336 | 1344 | } |
@@ -1489,7 +1497,8 @@ discard block |
||
1489 | 1497 | $loadOnlyVisibleExtraData = false, |
1490 | 1498 | $loadAvatars = true, |
1491 | 1499 | $updateCache = false |
1492 | -) { |
|
1500 | +) |
|
1501 | +{ |
|
1493 | 1502 | $apcVar = null; |
1494 | 1503 | $user = false; |
1495 | 1504 | $cacheAvailable = api_get_configuration_value('apc'); |
@@ -2270,7 +2279,8 @@ discard block |
||
2270 | 2279 | $session_id, |
2271 | 2280 | $courseId = null, |
2272 | 2281 | $ignore_visibility_for_admins = true |
2273 | -) { |
|
2282 | +) |
|
2283 | +{ |
|
2274 | 2284 | if (api_is_platform_admin()) { |
2275 | 2285 | if ($ignore_visibility_for_admins) { |
2276 | 2286 | return SESSION_AVAILABLE; |
@@ -2377,7 +2387,8 @@ discard block |
||
2377 | 2387 | { |
2378 | 2388 | $session_id = (int) $session_id; |
2379 | 2389 | $session_img = ''; |
2380 | - if ((int) $status_id != 5) { //check whether is not a student |
|
2390 | + if ((int) $status_id != 5) { |
|
2391 | +//check whether is not a student |
|
2381 | 2392 | if ($session_id > 0) { |
2382 | 2393 | $session_img = " ".Display::return_icon( |
2383 | 2394 | 'star.png', |
@@ -2403,7 +2414,8 @@ discard block |
||
2403 | 2414 | $and = true, |
2404 | 2415 | $with_base_content = false, |
2405 | 2416 | $session_field = 'session_id' |
2406 | -) { |
|
2417 | +) |
|
2418 | +{ |
|
2407 | 2419 | $session_id = intval($session_id); |
2408 | 2420 | |
2409 | 2421 | if (empty($session_field)) { |
@@ -2977,7 +2989,8 @@ discard block |
||
2977 | 2989 | $coach = false, |
2978 | 2990 | $session_coach = false, |
2979 | 2991 | $check_student_view = true |
2980 | -) { |
|
2992 | +) |
|
2993 | +{ |
|
2981 | 2994 | $sessionId = api_get_session_id(); |
2982 | 2995 | $is_allowed_coach_to_edit = api_is_coach(null, null, $check_student_view); |
2983 | 2996 | $session_visibility = api_get_session_visibility($sessionId); |
@@ -3279,7 +3292,8 @@ discard block |
||
3279 | 3292 | function api_not_allowed( |
3280 | 3293 | $print_headers = false, |
3281 | 3294 | $message = null |
3282 | -) { |
|
3295 | +) |
|
3296 | +{ |
|
3283 | 3297 | if (api_get_setting('sso_authentication') === 'true') { |
3284 | 3298 | global $osso; |
3285 | 3299 | if ($osso) { |
@@ -3534,7 +3548,8 @@ discard block |
||
3534 | 3548 | $user_id = null, |
3535 | 3549 | $type = null, |
3536 | 3550 | $group_id = null |
3537 | -) { |
|
3551 | +) |
|
3552 | +{ |
|
3538 | 3553 | if (!is_array($_course) || count($_course) == 0 || empty($tool) || empty($id)) { |
3539 | 3554 | return -1; |
3540 | 3555 | } |
@@ -3601,7 +3616,8 @@ discard block |
||
3601 | 3616 | $userId, |
3602 | 3617 | $groupId = 0, |
3603 | 3618 | $sessionId = 0 |
3604 | -) { |
|
3619 | +) |
|
3620 | +{ |
|
3605 | 3621 | if (empty($courseInfo)) { |
3606 | 3622 | return false; |
3607 | 3623 | } |
@@ -3676,7 +3692,8 @@ discard block |
||
3676 | 3692 | $start_visible = '', |
3677 | 3693 | $end_visible = '', |
3678 | 3694 | $session_id = 0 |
3679 | -) { |
|
3695 | +) |
|
3696 | +{ |
|
3680 | 3697 | if (empty($_course)) { |
3681 | 3698 | return false; |
3682 | 3699 | } |
@@ -4006,7 +4023,8 @@ discard block |
||
4006 | 4023 | $tool, |
4007 | 4024 | $courseId, |
4008 | 4025 | $session_id = 0 |
4009 | -) { |
|
4026 | +) |
|
4027 | +{ |
|
4010 | 4028 | $userId = intval($userId); |
4011 | 4029 | $tool = Database::escape_string($tool); |
4012 | 4030 | $session_id = intval($session_id); |
@@ -4461,18 +4479,21 @@ discard block |
||
4461 | 4479 | switch ($lang_type) { |
4462 | 4480 | case 'platform_lang': |
4463 | 4481 | $temp_lang = api_get_setting('platformLanguage'); |
4464 | - if (!empty($temp_lang)) |
|
4465 | - $return = $temp_lang; |
|
4482 | + if (!empty($temp_lang)) { |
|
4483 | + $return = $temp_lang; |
|
4484 | + } |
|
4466 | 4485 | break; |
4467 | 4486 | case 'user_profil_lang': |
4468 | 4487 | $_user = api_get_user_info(); |
4469 | 4488 | |
4470 | - if (isset($_user['language']) && !empty($_user['language'])) |
|
4471 | - $return = $_user['language']; |
|
4489 | + if (isset($_user['language']) && !empty($_user['language'])) { |
|
4490 | + $return = $_user['language']; |
|
4491 | + } |
|
4472 | 4492 | break; |
4473 | 4493 | case 'user_selected_lang': |
4474 | - if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) |
|
4475 | - $return = $_SESSION['user_language_choice']; |
|
4494 | + if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) { |
|
4495 | + $return = $_SESSION['user_language_choice']; |
|
4496 | + } |
|
4476 | 4497 | break; |
4477 | 4498 | case 'course_lang': |
4478 | 4499 | global $_course; |
@@ -4774,7 +4795,8 @@ discard block |
||
4774 | 4795 | * @author Yannick Warnier, adaptation for the Chamilo LMS, April, 2008 |
4775 | 4796 | * @author Ivan Tcholakov, a sanity check about Directory class creation has been added, September, 2009 |
4776 | 4797 | */ |
4777 | -function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = false) { |
|
4798 | +function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = false) |
|
4799 | +{ |
|
4778 | 4800 | $res = true; |
4779 | 4801 | // A sanity check. |
4780 | 4802 | if (!file_exists($dirname)) { |
@@ -4839,7 +4861,8 @@ discard block |
||
4839 | 4861 | * @param string $source |
4840 | 4862 | * @param string $dest |
4841 | 4863 | */ |
4842 | -function copyr($source, $dest, $exclude = array(), $copied_files = array()) { |
|
4864 | +function copyr($source, $dest, $exclude = array(), $copied_files = array()) |
|
4865 | +{ |
|
4843 | 4866 | if (empty($dest)) { return false; } |
4844 | 4867 | // Simple copy for a file |
4845 | 4868 | if (is_file($source)) { |
@@ -4889,7 +4912,8 @@ discard block |
||
4889 | 4912 | $course_info, |
4890 | 4913 | $document, |
4891 | 4914 | $source_course_id |
4892 | -) { |
|
4915 | +) |
|
4916 | +{ |
|
4893 | 4917 | $table = Database::get_course_table(TABLE_DOCUMENT); |
4894 | 4918 | $session_id = intval($session_id); |
4895 | 4919 | $source_course_id = intval($source_course_id); |
@@ -4970,7 +4994,8 @@ discard block |
||
4970 | 4994 | /** |
4971 | 4995 | * @param string $path |
4972 | 4996 | */ |
4973 | -function api_chmod_R($path, $filemode) { |
|
4997 | +function api_chmod_R($path, $filemode) |
|
4998 | +{ |
|
4974 | 4999 | if (!is_dir($path)) { |
4975 | 5000 | return chmod($path, $filemode); |
4976 | 5001 | } |
@@ -5057,7 +5082,8 @@ discard block |
||
5057 | 5082 | * @return |
5058 | 5083 | * The info array. |
5059 | 5084 | */ |
5060 | -function api_parse_info_file($filename) { |
|
5085 | +function api_parse_info_file($filename) |
|
5086 | +{ |
|
5061 | 5087 | $info = array(); |
5062 | 5088 | |
5063 | 5089 | if (!file_exists($filename)) { |
@@ -5146,7 +5172,8 @@ discard block |
||
5146 | 5172 | * @param mixed the status (can be either int either string) |
5147 | 5173 | * @return boolean if the status exists, else returns false |
5148 | 5174 | */ |
5149 | -function api_status_exists($status_asked) { |
|
5175 | +function api_status_exists($status_asked) |
|
5176 | +{ |
|
5150 | 5177 | global $_status_list; |
5151 | 5178 | return in_array($status_asked, $_status_list) ? true : isset($_status_list[$status_asked]); |
5152 | 5179 | } |
@@ -5159,7 +5186,8 @@ discard block |
||
5159 | 5186 | * @param mixed The status (can be either int or string) |
5160 | 5187 | * @return mixed Status ID if exists, false otherwise |
5161 | 5188 | */ |
5162 | -function api_status_key($status) { |
|
5189 | +function api_status_key($status) |
|
5190 | +{ |
|
5163 | 5191 | global $_status_list; |
5164 | 5192 | return isset($_status_list[$status]) ? $status : array_search($status, $_status_list); |
5165 | 5193 | } |
@@ -5168,7 +5196,8 @@ discard block |
||
5168 | 5196 | * Gets the status langvars list |
5169 | 5197 | * @return string[] the list of status with their translations |
5170 | 5198 | */ |
5171 | -function api_get_status_langvars() { |
|
5199 | +function api_get_status_langvars() |
|
5200 | +{ |
|
5172 | 5201 | return array( |
5173 | 5202 | COURSEMANAGER => get_lang('Teacher', ''), |
5174 | 5203 | SESSIONADMIN => get_lang('SessionsAdmin', ''), |
@@ -5184,7 +5213,8 @@ discard block |
||
5184 | 5213 | * The function that retrieves all the possible settings for a certain config setting |
5185 | 5214 | * @author Patrick Cool <[email protected]>, Ghent University |
5186 | 5215 | */ |
5187 | -function api_get_settings_options($var) { |
|
5216 | +function api_get_settings_options($var) |
|
5217 | +{ |
|
5188 | 5218 | $table_settings_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS); |
5189 | 5219 | $var = Database::escape_string($var); |
5190 | 5220 | $sql = "SELECT * FROM $table_settings_options |
@@ -5331,7 +5361,8 @@ discard block |
||
5331 | 5361 | "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url,".$row['access_url_changeable'].")"; |
5332 | 5362 | Database::query($insert); |
5333 | 5363 | } |
5334 | - } else { // Such a setting does not exist. |
|
5364 | + } else { |
|
5365 | +// Such a setting does not exist. |
|
5335 | 5366 | //error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0); |
5336 | 5367 | } |
5337 | 5368 | } |
@@ -5529,7 +5560,8 @@ discard block |
||
5529 | 5560 | $subKeyText = '', |
5530 | 5561 | $accessUrlId = 1, |
5531 | 5562 | $visibility = 0 |
5532 | -) { |
|
5563 | +) |
|
5564 | +{ |
|
5533 | 5565 | $em = Database::getManager(); |
5534 | 5566 | $settingRepo = $em->getRepository('ChamiloCoreBundle:SettingsCurrent'); |
5535 | 5567 | $accessUrlId = (int) $accessUrlId ?: 1; |
@@ -5588,7 +5620,8 @@ discard block |
||
5588 | 5620 | * @param int $cid Course id to check whether the user is allowed. |
5589 | 5621 | * @return bool |
5590 | 5622 | */ |
5591 | -function api_is_course_visible_for_user($userid = null, $cid = null) { |
|
5623 | +function api_is_course_visible_for_user($userid = null, $cid = null) |
|
5624 | +{ |
|
5592 | 5625 | if ($userid === null) { |
5593 | 5626 | $userid = api_get_user_id(); |
5594 | 5627 | } |
@@ -5675,8 +5708,7 @@ discard block |
||
5675 | 5708 | if ($row[0]['id_coach'] == $userid) { |
5676 | 5709 | $is_courseMember = true; |
5677 | 5710 | $is_courseAdmin = false; |
5678 | - } |
|
5679 | - elseif ($row[0]['session_admin_id'] == $userid) { |
|
5711 | + } elseif ($row[0]['session_admin_id'] == $userid) { |
|
5680 | 5712 | $is_courseMember = false; |
5681 | 5713 | $is_courseAdmin = false; |
5682 | 5714 | } else { |
@@ -5749,7 +5781,8 @@ discard block |
||
5749 | 5781 | * @param string $tool |
5750 | 5782 | * @return boolean true if the element is in the session, false else |
5751 | 5783 | */ |
5752 | -function api_is_element_in_the_session($tool, $element_id, $session_id = null) { |
|
5784 | +function api_is_element_in_the_session($tool, $element_id, $session_id = null) |
|
5785 | +{ |
|
5753 | 5786 | if (is_null($session_id)) { |
5754 | 5787 | $session_id = api_get_session_id(); |
5755 | 5788 | } |
@@ -5815,7 +5848,8 @@ discard block |
||
5815 | 5848 | * Fixes the $_SERVER['REQUEST_URI'] that is empty in IIS6. |
5816 | 5849 | * @author Ivan Tcholakov, 28-JUN-2006. |
5817 | 5850 | */ |
5818 | -function api_request_uri() { |
|
5851 | +function api_request_uri() |
|
5852 | +{ |
|
5819 | 5853 | if (!empty($_SERVER['REQUEST_URI'])) { |
5820 | 5854 | return $_SERVER['REQUEST_URI']; |
5821 | 5855 | } |
@@ -5832,7 +5866,8 @@ discard block |
||
5832 | 5866 | * @author Julio Montoya <[email protected]> |
5833 | 5867 | * @return int access_url_id of the current Chamilo Installation |
5834 | 5868 | */ |
5835 | -function api_get_current_access_url_id() { |
|
5869 | +function api_get_current_access_url_id() |
|
5870 | +{ |
|
5836 | 5871 | $access_url_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL); |
5837 | 5872 | $path = Database::escape_string(api_get_path(WEB_PATH)); |
5838 | 5873 | $sql = "SELECT id FROM $access_url_table WHERE url = '".$path."'"; |
@@ -5853,7 +5888,8 @@ discard block |
||
5853 | 5888 | * @author Julio Montoya <[email protected]> |
5854 | 5889 | * @return int user id |
5855 | 5890 | */ |
5856 | -function api_get_access_url_from_user($user_id) { |
|
5891 | +function api_get_access_url_from_user($user_id) |
|
5892 | +{ |
|
5857 | 5893 | $user_id = intval($user_id); |
5858 | 5894 | $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
5859 | 5895 | $table_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL); |
@@ -5971,8 +6007,7 @@ discard block |
||
5971 | 6007 | elseif (isset($_ENV['OS'])) { |
5972 | 6008 | // Sometimes $_ENV['OS'] may not be present (bugs?) |
5973 | 6009 | $os = $_ENV['OS']; |
5974 | - } |
|
5975 | - elseif (defined('PHP_OS')) { |
|
6010 | + } elseif (defined('PHP_OS')) { |
|
5976 | 6011 | // PHP_OS means on which OS PHP was compiled, this is why |
5977 | 6012 | // using PHP_OS is the last choice for detection. |
5978 | 6013 | $os = PHP_OS; |
@@ -6038,7 +6073,8 @@ discard block |
||
6038 | 6073 | $image_height, |
6039 | 6074 | $target_width, |
6040 | 6075 | $target_height |
6041 | -) { |
|
6076 | +) |
|
6077 | +{ |
|
6042 | 6078 | // Only maths is here. |
6043 | 6079 | $result = array('width' => $image_width, 'height' => $image_height); |
6044 | 6080 | if ($image_width <= 0 || $image_height <= 0) { |
@@ -6203,7 +6239,8 @@ discard block |
||
6203 | 6239 | $admin_id_to_check, |
6204 | 6240 | $my_user_id = null, |
6205 | 6241 | $allow_session_admin = false |
6206 | -) { |
|
6242 | +) |
|
6243 | +{ |
|
6207 | 6244 | if (empty($my_user_id)) { |
6208 | 6245 | $my_user_id = api_get_user_id(); |
6209 | 6246 | } |
@@ -6256,7 +6293,8 @@ discard block |
||
6256 | 6293 | * |
6257 | 6294 | * @author Julio Montoya |
6258 | 6295 | */ |
6259 | -function api_protect_global_admin_script() { |
|
6296 | +function api_protect_global_admin_script() |
|
6297 | +{ |
|
6260 | 6298 | if (!api_is_global_platform_admin()) { |
6261 | 6299 | api_not_allowed(); |
6262 | 6300 | return false; |
@@ -6490,7 +6528,8 @@ discard block |
||
6490 | 6528 | * |
6491 | 6529 | * @author Juan Carlos Raña Trabado |
6492 | 6530 | */ |
6493 | -function api_check_browscap() { |
|
6531 | +function api_check_browscap() |
|
6532 | +{ |
|
6494 | 6533 | $setting = ini_get('browscap'); |
6495 | 6534 | if ($setting) { |
6496 | 6535 | $browser = get_browser($_SERVER['HTTP_USER_AGENT'], true); |
@@ -6504,7 +6543,8 @@ discard block |
||
6504 | 6543 | /** |
6505 | 6544 | * Returns the <script> HTML tag |
6506 | 6545 | */ |
6507 | -function api_get_js($file) { |
|
6546 | +function api_get_js($file) |
|
6547 | +{ |
|
6508 | 6548 | return '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$file.'"></script>'."\n"; |
6509 | 6549 | } |
6510 | 6550 | |
@@ -6530,7 +6570,8 @@ discard block |
||
6530 | 6570 | * Returns the <link> HTML tag |
6531 | 6571 | * @param string $file |
6532 | 6572 | */ |
6533 | -function api_get_css($file, $media = 'screen') { |
|
6573 | +function api_get_css($file, $media = 'screen') |
|
6574 | +{ |
|
6534 | 6575 | return '<link href="'.$file.'" rel="stylesheet" media="'.$media.'" type="text/css" />'."\n"; |
6535 | 6576 | } |
6536 | 6577 | |
@@ -6573,7 +6614,8 @@ discard block |
||
6573 | 6614 | * @return string html tags |
6574 | 6615 | * |
6575 | 6616 | */ |
6576 | -function api_get_jquery_ui_js($include_jqgrid = false) { |
|
6617 | +function api_get_jquery_ui_js($include_jqgrid = false) |
|
6618 | +{ |
|
6577 | 6619 | $libraries = array(); |
6578 | 6620 | if ($include_jqgrid) { |
6579 | 6621 | $libraries[] = 'jqgrid'; |
@@ -6581,7 +6623,8 @@ discard block |
||
6581 | 6623 | return api_get_jquery_libraries_js($libraries); |
6582 | 6624 | } |
6583 | 6625 | |
6584 | -function api_get_jqgrid_js() { |
|
6626 | +function api_get_jqgrid_js() |
|
6627 | +{ |
|
6585 | 6628 | return api_get_jquery_libraries_js(array('jqgrid')); |
6586 | 6629 | } |
6587 | 6630 | |
@@ -6593,7 +6636,8 @@ discard block |
||
6593 | 6636 | * @return string html tags |
6594 | 6637 | * |
6595 | 6638 | */ |
6596 | -function api_get_jquery_libraries_js($libraries) { |
|
6639 | +function api_get_jquery_libraries_js($libraries) |
|
6640 | +{ |
|
6597 | 6641 | $js = ''; |
6598 | 6642 | $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/'; |
6599 | 6643 | |
@@ -6836,7 +6880,8 @@ discard block |
||
6836 | 6880 | * when printing the configuration settings screens |
6837 | 6881 | * @return array Array of strings, each identifying one of the excluded settings |
6838 | 6882 | */ |
6839 | -function api_get_locked_settings() { |
|
6883 | +function api_get_locked_settings() |
|
6884 | +{ |
|
6840 | 6885 | return array( |
6841 | 6886 | 'server_type', |
6842 | 6887 | 'permanently_remove_deleted_files', |
@@ -6877,7 +6922,8 @@ discard block |
||
6877 | 6922 | * @param integer User ID |
6878 | 6923 | * @return boolean Integer User ID is logged in, or false otherwise |
6879 | 6924 | */ |
6880 | -function api_user_is_login($user_id = null) { |
|
6925 | +function api_user_is_login($user_id = null) |
|
6926 | +{ |
|
6881 | 6927 | $user_id = empty($user_id) ? api_get_user_id() : intval($user_id); |
6882 | 6928 | return $user_id && !api_is_anonymous(); |
6883 | 6929 | } |
@@ -6903,7 +6949,9 @@ discard block |
||
6903 | 6949 | } |
6904 | 6950 | $ip = trim($ip1); |
6905 | 6951 | } |
6906 | - if (!empty($debug)) error_log('Real IP: '.$ip); |
|
6952 | + if (!empty($debug)) { |
|
6953 | + error_log('Real IP: '.$ip); |
|
6954 | + } |
|
6907 | 6955 | return $ip; |
6908 | 6956 | } |
6909 | 6957 | |
@@ -6991,7 +7039,8 @@ discard block |
||
6991 | 7039 | $courseInfo = array(), |
6992 | 7040 | $sessionId = 0, |
6993 | 7041 | $userId = 0 |
6994 | -) { |
|
7042 | +) |
|
7043 | +{ |
|
6995 | 7044 | $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo; |
6996 | 7045 | $courseId = $courseInfo['real_id']; |
6997 | 7046 | $courseCode = $courseInfo['code']; |
@@ -7788,7 +7837,8 @@ discard block |
||
7788 | 7837 | * @param bool $listCampus Whether we authorize |
7789 | 7838 | * @todo the $_settings should be reloaded here. => write api function for this and use this in global.inc.php also. |
7790 | 7839 | */ |
7791 | -function api_register_campus($listCampus = true) { |
|
7840 | +function api_register_campus($listCampus = true) |
|
7841 | +{ |
|
7792 | 7842 | $tbl_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
7793 | 7843 | |
7794 | 7844 | $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='registered'"; |
@@ -7978,7 +8028,8 @@ discard block |
||
7978 | 8028 | $data_file = array(), |
7979 | 8029 | $embedded_image = false, |
7980 | 8030 | $additionalParameters = array() |
7981 | -) { |
|
8031 | +) |
|
8032 | +{ |
|
7982 | 8033 | global $platform_email; |
7983 | 8034 | |
7984 | 8035 | $mail = new PHPMailer(); |
@@ -3292,7 +3292,9 @@ discard block |
||
3292 | 3292 | ); |
3293 | 3293 | } |
3294 | 3294 | |
3295 | - if ($debug) error_log('Start answer loop '); |
|
3295 | + if ($debug) { |
|
3296 | + error_log('Start answer loop '); |
|
3297 | + } |
|
3296 | 3298 | |
3297 | 3299 | for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
3298 | 3300 | $answer = $objAnswerTmp->selectAnswer($answerId); |
@@ -3406,7 +3408,9 @@ discard block |
||
3406 | 3408 | } |
3407 | 3409 | $totalScore += $answerWeighting; |
3408 | 3410 | |
3409 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
3411 | + if ($debug) { |
|
3412 | + error_log("studentChoice: $studentChoice"); |
|
3413 | + } |
|
3410 | 3414 | break; |
3411 | 3415 | case GLOBAL_MULTIPLE_ANSWER: |
3412 | 3416 | if ($from_database) { |
@@ -3431,7 +3435,9 @@ discard block |
||
3431 | 3435 | $real_answers[$answerId] = (bool) $studentChoice; |
3432 | 3436 | } |
3433 | 3437 | $totalScore += $answerWeighting; |
3434 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
3438 | + if ($debug) { |
|
3439 | + error_log("studentChoice: $studentChoice"); |
|
3440 | + } |
|
3435 | 3441 | break; |
3436 | 3442 | case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
3437 | 3443 | if ($from_database) { |
@@ -4245,7 +4251,9 @@ discard block |
||
4245 | 4251 | } // end switch Answertype |
4246 | 4252 | |
4247 | 4253 | if ($show_result) { |
4248 | - if ($debug) error_log('Showing questions $from '.$from); |
|
4254 | + if ($debug) { |
|
4255 | + error_log('Showing questions $from '.$from); |
|
4256 | + } |
|
4249 | 4257 | if ($from == 'exercise_result') { |
4250 | 4258 | //display answers (if not matching type, or if the answer is correct) |
4251 | 4259 | if ( |
@@ -4529,7 +4537,8 @@ discard block |
||
4529 | 4537 | $url_hotspot = $destination_items[4]; |
4530 | 4538 | } |
4531 | 4539 | } |
4532 | - } else { // the first delineation feedback |
|
4540 | + } else { |
|
4541 | +// the first delineation feedback |
|
4533 | 4542 | if ($debug > 0) { |
4534 | 4543 | error_log(__LINE__.' first', 0); |
4535 | 4544 | } |
@@ -4557,7 +4566,9 @@ discard block |
||
4557 | 4566 | } |
4558 | 4567 | } |
4559 | 4568 | } else { |
4560 | - if ($debug) error_log('Showing questions $from '.$from); |
|
4569 | + if ($debug) { |
|
4570 | + error_log('Showing questions $from '.$from); |
|
4571 | + } |
|
4561 | 4572 | |
4562 | 4573 | switch ($answerType) { |
4563 | 4574 | case UNIQUE_ANSWER: |
@@ -4874,7 +4885,8 @@ discard block |
||
4874 | 4885 | $url_hotspot = $destination_items[4]; |
4875 | 4886 | } |
4876 | 4887 | } |
4877 | - } else { // the first delineation feedback |
|
4888 | + } else { |
|
4889 | +// the first delineation feedback |
|
4878 | 4890 | if ($debug > 0) { |
4879 | 4891 | error_log(__LINE__.' first', 0); |
4880 | 4892 | } |
@@ -4919,10 +4931,14 @@ discard block |
||
4919 | 4931 | } |
4920 | 4932 | } |
4921 | 4933 | } |
4922 | - if ($debug) error_log(' ------ '); |
|
4934 | + if ($debug) { |
|
4935 | + error_log(' ------ '); |
|
4936 | + } |
|
4923 | 4937 | } // end for that loops over all answers of the current question |
4924 | 4938 | |
4925 | - if ($debug) error_log('-- end answer loop --'); |
|
4939 | + if ($debug) { |
|
4940 | + error_log('-- end answer loop --'); |
|
4941 | + } |
|
4926 | 4942 | |
4927 | 4943 | $final_answer = true; |
4928 | 4944 | |
@@ -4994,7 +5010,9 @@ discard block |
||
4994 | 5010 | // TODO Change this, because it is wrong to show the user |
4995 | 5011 | // some results that haven't been stored in the database yet |
4996 | 5012 | if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION) { |
4997 | - if ($debug) error_log('$from AND this is a hotspot kind of question '); |
|
5013 | + if ($debug) { |
|
5014 | + error_log('$from AND this is a hotspot kind of question '); |
|
5015 | + } |
|
4998 | 5016 | $my_exe_id = 0; |
4999 | 5017 | $from_database = 0; |
5000 | 5018 | if ($answerType == HOT_SPOT_DELINEATION) { |
@@ -5195,8 +5213,12 @@ discard block |
||
5195 | 5213 | // stored by exercise_results.php (using the session) |
5196 | 5214 | |
5197 | 5215 | if ($saved_results) { |
5198 | - if ($debug) error_log("Save question results $saved_results"); |
|
5199 | - if ($debug) error_log(print_r($choice, 1)); |
|
5216 | + if ($debug) { |
|
5217 | + error_log("Save question results $saved_results"); |
|
5218 | + } |
|
5219 | + if ($debug) { |
|
5220 | + error_log(print_r($choice, 1)); |
|
5221 | + } |
|
5200 | 5222 | |
5201 | 5223 | if (empty($choice)) { |
5202 | 5224 | $choice = 0; |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
364 | - * @return int |
|
364 | + * @return string |
|
365 | 365 | */ |
366 | 366 | public function selectPassPercentage() |
367 | 367 | { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * tells if questions are selected randomly, and if so returns the draws |
465 | 465 | * |
466 | 466 | * @author Olivier Brouckaert |
467 | - * @return integer - 0 if not random, otherwise the draws |
|
467 | + * @return boolean - 0 if not random, otherwise the draws |
|
468 | 468 | */ |
469 | 469 | public function isRandom() |
470 | 470 | { |
@@ -2853,9 +2853,9 @@ discard block |
||
2853 | 2853 | * @param int int lp item id |
2854 | 2854 | * @param int int lp item_view id |
2855 | 2855 | * @param array $questionList |
2856 | - * @param float $weight |
|
2856 | + * @param integer $weight |
|
2857 | 2857 | * |
2858 | - * @return int |
|
2858 | + * @return false|string |
|
2859 | 2859 | */ |
2860 | 2860 | public function save_stat_track_exercise_info( |
2861 | 2861 | $clock_expired_time = 0, |
@@ -5361,7 +5361,7 @@ discard block |
||
5361 | 5361 | * @param int $exe_id |
5362 | 5362 | * @param float $score |
5363 | 5363 | * @param float $weight |
5364 | - * @return bool |
|
5364 | + * @return false|null |
|
5365 | 5365 | */ |
5366 | 5366 | public function send_mail_notification_for_exam( |
5367 | 5367 | $type = 'end', |
@@ -5536,6 +5536,7 @@ discard block |
||
5536 | 5536 | * @param array $question_list_answers |
5537 | 5537 | * @param string $origin |
5538 | 5538 | * @param int $exe_id |
5539 | + * @param string $url_email |
|
5539 | 5540 | * @return null |
5540 | 5541 | */ |
5541 | 5542 | private function send_notification_for_open_questions( |
@@ -5626,6 +5627,7 @@ discard block |
||
5626 | 5627 | * @param array $question_list_answers |
5627 | 5628 | * @param string $origin |
5628 | 5629 | * @param int $exe_id |
5630 | + * @param string $url_email |
|
5629 | 5631 | * @return null |
5630 | 5632 | */ |
5631 | 5633 | private function send_notification_for_oral_questions( |
@@ -5776,7 +5778,7 @@ discard block |
||
5776 | 5778 | * @param int Maximum number of attempts (0 if no limit) |
5777 | 5779 | * @param int Feedback type |
5778 | 5780 | * @todo this was function was added due the import exercise via CSV |
5779 | - * @return int New exercise ID |
|
5781 | + * @return string New exercise ID |
|
5780 | 5782 | */ |
5781 | 5783 | public function createExercise( |
5782 | 5784 | $title, |
@@ -1715,10 +1715,10 @@ discard block |
||
1715 | 1715 | $this->id = Database::insert($TBL_EXERCISES, $params); |
1716 | 1716 | |
1717 | 1717 | if ($this->id) { |
1718 | - $sql = "UPDATE $TBL_EXERCISES SET id = iid WHERE iid = {$this->id} "; |
|
1718 | + $sql = "update $TBL_EXERCISES SET id = iid WHERE iid = {$this->id} "; |
|
1719 | 1719 | Database::query($sql); |
1720 | 1720 | |
1721 | - $sql = "UPDATE $TBL_EXERCISES |
|
1721 | + $sql = "update $TBL_EXERCISES |
|
1722 | 1722 | SET question_selection_type= ".intval($this->getQuestionSelectionType())." |
1723 | 1723 | WHERE id = ".$this->id." AND c_id = ".$this->course_id; |
1724 | 1724 | Database::query($sql); |
@@ -1763,7 +1763,7 @@ discard block |
||
1763 | 1763 | $question_list = $this->selectQuestionList(true); |
1764 | 1764 | if (!empty($question_list)) { |
1765 | 1765 | foreach ($question_list as $position => $questionId) { |
1766 | - $sql = "UPDATE $table SET |
|
1766 | + $sql = "update $table SET |
|
1767 | 1767 | question_order ='".intval($position)."' |
1768 | 1768 | WHERE |
1769 | 1769 | c_id = ".$this->course_id." AND |
@@ -1840,7 +1840,7 @@ discard block |
||
1840 | 1840 | public function delete() |
1841 | 1841 | { |
1842 | 1842 | $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); |
1843 | - $sql = "UPDATE $TBL_EXERCISES SET active='-1' |
|
1843 | + $sql = "update $TBL_EXERCISES SET active='-1' |
|
1844 | 1844 | WHERE c_id = ".$this->course_id." AND id = ".intval($this->id); |
1845 | 1845 | Database::query($sql); |
1846 | 1846 | |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | if (!empty($items)) { |
2611 | 2611 | foreach ($items as $item) { |
2612 | 2612 | $itemId = $item['iid']; |
2613 | - $sql = "UPDATE $table SET title = '".$this->title."' |
|
2613 | + $sql = "update $table SET title = '".$this->title."' |
|
2614 | 2614 | WHERE iid = $itemId AND c_id = $courseId "; |
2615 | 2615 | Database::query($sql); |
2616 | 2616 | } |
@@ -2665,7 +2665,7 @@ discard block |
||
2665 | 2665 | |
2666 | 2666 | $di = new ChamiloIndexer(); |
2667 | 2667 | isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
2668 | - $di->connectDb(NULL, NULL, $lang); |
|
2668 | + $di->connectDb(null, null, $lang); |
|
2669 | 2669 | $di->addChunk($ic_slide); |
2670 | 2670 | |
2671 | 2671 | //index and return search engine document id |
@@ -2779,7 +2779,7 @@ discard block |
||
2779 | 2779 | $qrow = Database::fetch_array($qres); |
2780 | 2780 | $objQuestion = Question::getInstance($qrow['type']); |
2781 | 2781 | $objQuestion = Question::read((int) $question_i); |
2782 | - $objQuestion->search_engine_edit($this->id, FALSE, TRUE); |
|
2782 | + $objQuestion->search_engine_edit($this->id, false, true); |
|
2783 | 2783 | unset($objQuestion); |
2784 | 2784 | } |
2785 | 2785 | } |
@@ -5985,7 +5985,7 @@ discard block |
||
5985 | 5985 | |
5986 | 5986 | if ($quiz_id) { |
5987 | 5987 | |
5988 | - $sql = "UPDATE $tbl_quiz SET id = iid WHERE iid = {$quiz_id} "; |
|
5988 | + $sql = "update $tbl_quiz SET id = iid WHERE iid = {$quiz_id} "; |
|
5989 | 5989 | Database::query($sql); |
5990 | 5990 | } |
5991 | 5991 | |
@@ -6651,7 +6651,7 @@ discard block |
||
6651 | 6651 | |
6652 | 6652 | if (empty($exercise_info['questions_to_check'])) { |
6653 | 6653 | if ($action == 'add') { |
6654 | - $sql = "UPDATE $track_exercises |
|
6654 | + $sql = "update $track_exercises |
|
6655 | 6655 | SET questions_to_check = '$question_id' |
6656 | 6656 | WHERE exe_id = $exe_id "; |
6657 | 6657 | Database::query($sql); |
@@ -6685,7 +6685,7 @@ discard block |
||
6685 | 6685 | } |
6686 | 6686 | } |
6687 | 6687 | $remind_list_string = Database::escape_string($remind_list_string); |
6688 | - $sql = "UPDATE $track_exercises |
|
6688 | + $sql = "update $track_exercises |
|
6689 | 6689 | SET questions_to_check = '$remind_list_string' |
6690 | 6690 | WHERE exe_id = $exe_id "; |
6691 | 6691 | Database::query($sql); |
@@ -5087,7 +5087,7 @@ discard block |
||
5087 | 5087 | |
5088 | 5088 | //Fixes multiple answer question in order to be exact |
5089 | 5089 | //if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
5090 | - /* if ($answerType == GLOBAL_MULTIPLE_ANSWER) { |
|
5090 | + /* if ($answerType == GLOBAL_MULTIPLE_ANSWER) { |
|
5091 | 5091 | $diff = @array_diff($answer_correct_array, $real_answers); |
5092 | 5092 | |
5093 | 5093 | // All good answers or nothing works like exact |
@@ -5657,7 +5657,7 @@ discard block |
||
5657 | 5657 | '#student_complete_name#' => $user_info['complete_name'], |
5658 | 5658 | '#course#' => $courseInfo['title'] |
5659 | 5659 | ]; |
5660 | - if ($origin != 'learnpath' && $sendEnd) { |
|
5660 | + if ($origin != 'learnpath' && $sendEnd) { |
|
5661 | 5661 | $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
5662 | 5662 | $variables['#url#'] = $url; |
5663 | 5663 | } |
@@ -7446,8 +7446,8 @@ discard block |
||
7446 | 7446 | } |
7447 | 7447 | |
7448 | 7448 | /** |
7449 | - * @return string |
|
7450 | - */ |
|
7449 | + * @return string |
|
7450 | + */ |
|
7451 | 7451 | public function get_formated_title() |
7452 | 7452 | { |
7453 | 7453 | if (api_get_configuration_value('save_titles_as_html')) { |
@@ -166,13 +166,19 @@ |
||
166 | 166 | |
167 | 167 | <select name="id_coach[]" class="form-control" multiple> |
168 | 168 | <option value="0">----- <?php echo get_lang("Choose") ?> -----</option> |
169 | - <option value="0" <?php if (count($arr_infos) == 0) echo 'selected="selected"'; ?>> |
|
169 | + <option value="0" <?php if (count($arr_infos) == 0) { |
|
170 | + echo 'selected="selected"'; |
|
171 | +} |
|
172 | +?>> |
|
170 | 173 | <?php echo get_lang('None') ?> |
171 | 174 | </option> |
172 | 175 | <?php |
173 | 176 | foreach ($coaches as $enreg) { |
174 | 177 | ?> |
175 | - <option value="<?php echo $enreg['user_id']; ?>" <?php if (((is_array($arr_infos) && in_array($enreg['user_id'], $arr_infos)))) echo 'selected="selected"'; ?>> |
|
178 | + <option value="<?php echo $enreg['user_id']; ?>" <?php if (((is_array($arr_infos) && in_array($enreg['user_id'], $arr_infos)))) { |
|
179 | + echo 'selected="selected"'; |
|
180 | +} |
|
181 | +?>> |
|
176 | 182 | <?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?> |
177 | 183 | </option> |
178 | 184 | <?php |
@@ -495,7 +495,7 @@ |
||
495 | 495 | } |
496 | 496 | |
497 | 497 | if ($correct) { |
498 | - $sql = "UPDATE $tbl_quiz_question |
|
498 | + $sql = "update $tbl_quiz_question |
|
499 | 499 | SET ponderation = (ponderation + $score) |
500 | 500 | WHERE c_id = $course_id AND id = ".$question_id; |
501 | 501 | Database::query($sql); |
@@ -341,7 +341,10 @@ discard block |
||
341 | 341 | $searchForm->display(); |
342 | 342 | echo '</div>'; |
343 | 343 | ?> |
344 | -<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;"> |
|
344 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) { |
|
345 | + echo '&add=true'; |
|
346 | +} |
|
347 | +?>" style="margin:0px;"> |
|
345 | 348 | <?php |
346 | 349 | echo '<legend>'.$tool_name.': '.$data['name'].'</legend>'; |
347 | 350 | |
@@ -419,7 +422,10 @@ discard block |
||
419 | 422 | ?> |
420 | 423 | <br /> |
421 | 424 | <label class="control-label"> |
422 | - <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"> |
|
425 | + <input type="checkbox" <?php if ($user_with_any_group) { |
|
426 | + echo 'checked="checked"'; |
|
427 | +} |
|
428 | +?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id"> |
|
423 | 429 | <?php echo get_lang('UsersRegisteredInAnyGroup'); ?> |
424 | 430 | </label> |
425 | 431 | </div> |