@@ -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. |
@@ -211,8 +210,8 @@ discard block |
||
211 | 210 | $language = api_get_setting('platformLanguage'); |
212 | 211 | if (empty($language)) { $language = 'english'; } |
213 | 212 | $_userId = UserManager::create_user($prenom, $nom, $status, |
214 | - $email, $uname, $password, $official_code, |
|
215 | - $language,'', '', 'ldap'); |
|
213 | + $email, $uname, $password, $official_code, |
|
214 | + $language,'', '', 'ldap'); |
|
216 | 215 | |
217 | 216 | //echo "new user added to Chamilo, id = $_userId"; |
218 | 217 | |
@@ -271,7 +270,7 @@ discard block |
||
271 | 270 | // Open anonymous LDAP connection |
272 | 271 | $result=false; |
273 | 272 | $ldap_bind_res = ldap_handle_bind($ds,$result); |
274 | - // Executing the search with the $filter parametr |
|
273 | + // Executing the search with the $filter parametr |
|
275 | 274 | //error_log('Searching for '.$filter.' on LDAP server',0); |
276 | 275 | $sr=ldap_search($ds,$ldap_basedn,$filter); |
277 | 276 | $info = ldap_get_entries($ds, $sr); |
@@ -304,10 +303,10 @@ discard block |
||
304 | 303 | } |
305 | 304 | } // end of check |
306 | 305 | /** |
307 | - * Set the protocol version with version from config file (enables LDAP version 3) |
|
308 | - * @param resource The LDAP connexion resource, passed by reference. |
|
309 | - * @return void |
|
310 | - */ |
|
306 | + * Set the protocol version with version from config file (enables LDAP version 3) |
|
307 | + * @param resource The LDAP connexion resource, passed by reference. |
|
308 | + * @return void |
|
309 | + */ |
|
311 | 310 | function ldap_set_version(&$resource) { |
312 | 311 | //error_log('Entering ldap_set_version(&$resource)',0); |
313 | 312 | global $ldap_version; |
@@ -320,11 +319,11 @@ discard block |
||
320 | 319 | } |
321 | 320 | } |
322 | 321 | /** |
323 | - * Handle bind (whether authenticated or not) |
|
324 | - * @param resource The LDAP handler to which we are connecting (by reference) |
|
325 | - * @param resource The LDAP bind handler we will be modifying |
|
326 | - * @return boolean Status of the bind assignment. True for success, false for failure. |
|
327 | - */ |
|
322 | + * Handle bind (whether authenticated or not) |
|
323 | + * @param resource The LDAP handler to which we are connecting (by reference) |
|
324 | + * @param resource The LDAP bind handler we will be modifying |
|
325 | + * @return boolean Status of the bind assignment. True for success, false for failure. |
|
326 | + */ |
|
328 | 327 | function ldap_handle_bind(&$ldap_handler,&$ldap_bind) { |
329 | 328 | //error_log('Entering ldap_handle_bind(&$ldap_handler,&$ldap_bind)',0); |
330 | 329 | global $ldap_rdn,$ldap_pass, $extldap_config; |
@@ -350,10 +349,10 @@ discard block |
||
350 | 349 | } |
351 | 350 | } |
352 | 351 | /** |
353 | - * Get the total number of users on the platform |
|
354 | - * @see SortableTable#get_total_number_of_items() |
|
355 | - * @author Mustapha Alouani |
|
356 | - */ |
|
352 | + * Get the total number of users on the platform |
|
353 | + * @see SortableTable#get_total_number_of_items() |
|
354 | + * @author Mustapha Alouani |
|
355 | + */ |
|
357 | 356 | function ldap_get_users() { |
358 | 357 | |
359 | 358 | global $ldap_basedn, $ldap_host, $ldap_port, $ldap_rdn, $ldap_pass, $ldap_search_dn, $extldap_user_correspondance; |
@@ -564,35 +563,35 @@ discard block |
||
564 | 563 | foreach ($UserList as $enreg_user) { |
565 | 564 | $enreg_user = (int) $enreg_user; |
566 | 565 | Database::query("INSERT IGNORE ". |
567 | - " INTO $tbl_session_rel_course_rel_user ". |
|
568 | - "(session_id,c_id,user_id) VALUES ". |
|
569 | - "('$id_session','$enreg_course','$enreg_user')"); |
|
566 | + " INTO $tbl_session_rel_course_rel_user ". |
|
567 | + "(session_id,c_id,user_id) VALUES ". |
|
568 | + "('$id_session','$enreg_course','$enreg_user')"); |
|
570 | 569 | } |
571 | 570 | $sql = "SELECT COUNT(user_id) as nbUsers ". |
572 | - " FROM $tbl_session_rel_course_rel_user " . |
|
573 | - " WHERE session_id='$id_session' ". |
|
574 | - " AND c_id='$enreg_course'"; |
|
571 | + " FROM $tbl_session_rel_course_rel_user " . |
|
572 | + " WHERE session_id='$id_session' ". |
|
573 | + " AND c_id='$enreg_course'"; |
|
575 | 574 | $rs = Database::query($sql); |
576 | 575 | list($nbr_users) = Database::fetch_array($rs); |
577 | 576 | Database::query("UPDATE $tbl_session_rel_course ". |
578 | - " SET nbr_users=$nbr_users " . |
|
579 | - " WHERE session_id='$id_session' ". |
|
580 | - " AND c_id='$enreg_course'"); |
|
577 | + " SET nbr_users=$nbr_users " . |
|
578 | + " WHERE session_id='$id_session' ". |
|
579 | + " AND c_id='$enreg_course'"); |
|
581 | 580 | } |
582 | 581 | foreach ($UserList as $enreg_user) { |
583 | 582 | $enreg_user = (int) $enreg_user; |
584 | 583 | Database::query("INSERT IGNORE INTO $tbl_session_rel_user ". |
585 | - " (session_id, user_id, registered_at) " . |
|
586 | - " VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')"); |
|
584 | + " (session_id, user_id, registered_at) " . |
|
585 | + " VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')"); |
|
587 | 586 | } |
588 | 587 | // We update the number of users in the session |
589 | 588 | $sql = "SELECT COUNT(user_id) as nbUsers FROM $tbl_session_rel_user ". |
590 | - " WHERE session_id='$id_session' ". |
|
591 | - " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." "; |
|
589 | + " WHERE session_id='$id_session' ". |
|
590 | + " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." "; |
|
592 | 591 | $rs = Database::query($sql); |
593 | 592 | list($nbr_users) = Database::fetch_array($rs); |
594 | 593 | Database::query("UPDATE $tbl_session SET nbr_users=$nbr_users ". |
595 | - " WHERE id='$id_session'"); |
|
594 | + " WHERE id='$id_session'"); |
|
596 | 595 | } |
597 | 596 | |
598 | 597 | function syncro_users() { |
@@ -17,10 +17,10 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | /** |
20 | - * Store for User objects. Interact with the database. |
|
21 | - * |
|
22 | - * @return UserStore |
|
23 | - */ |
|
20 | + * Store for User objects. Interact with the database. |
|
21 | + * |
|
22 | + * @return UserStore |
|
23 | + */ |
|
24 | 24 | public static function store() |
25 | 25 | { |
26 | 26 | static $result = false; |
@@ -17,10 +17,10 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | /** |
20 | - * Store for Admin objects. Interact with the database. |
|
21 | - * |
|
22 | - * @return AdminStore |
|
23 | - */ |
|
20 | + * Store for Admin objects. Interact with the database. |
|
21 | + * |
|
22 | + * @return AdminStore |
|
23 | + */ |
|
24 | 24 | public static function store() |
25 | 25 | { |
26 | 26 | static $result = false; |
@@ -53,10 +53,10 @@ |
||
53 | 53 | $table_header[] = array('tag', true); |
54 | 54 | $table_header[] = array('attributes', false); |
55 | 55 | foreach ($tags as $tag => & $attributes) { |
56 | - $row = array(); |
|
57 | - $row[] = '<kbd>'.$tag.'</kbd>'; |
|
58 | - $row[] = '<kbd> '.implode(', ', array_keys($attributes)).'</kbd>'; |
|
59 | - $table_data[] = $row; |
|
56 | + $row = array(); |
|
57 | + $row[] = '<kbd>'.$tag.'</kbd>'; |
|
58 | + $row[] = '<kbd> '.implode(', ', array_keys($attributes)).'</kbd>'; |
|
59 | + $table_data[] = $row; |
|
60 | 60 | } |
61 | 61 | Display::display_sortable_table($table_header, $table_data, array(), array(), array('fullpage' => intval($_GET['fullpage']))); |
62 | 62 | ?> |
@@ -41,9 +41,9 @@ |
||
41 | 41 | $form->display(); |
42 | 42 | } |
43 | 43 | } else { |
44 | - $faq_content = @(string)file_get_contents(api_get_path(SYS_APP_PATH).'home/'.$faq_file); |
|
45 | - $faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content))); |
|
46 | - echo $faq_content; |
|
44 | + $faq_content = @(string)file_get_contents(api_get_path(SYS_APP_PATH).'home/'.$faq_file); |
|
45 | + $faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content))); |
|
46 | + echo $faq_content; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | Display::display_footer(); |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | |
15 | 15 | // load templates |
16 | 16 | function reports_loadTemplates() { |
17 | - global $reports_enabled_templates, $reports_template; |
|
18 | - foreach ($reports_enabled_templates as $t) |
|
19 | - require_once 'templates/'.$t.'.reports.php'; |
|
17 | + global $reports_enabled_templates, $reports_template; |
|
18 | + foreach ($reports_enabled_templates as $t) |
|
19 | + require_once 'templates/'.$t.'.reports.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -149,18 +149,18 @@ discard block |
||
149 | 149 | */ |
150 | 150 | // return tools ID (parametre is a constant from main_api |
151 | 151 | function reports_getToolId($tool) { |
152 | - $tools = array_flip(api_get_tools_lists()); |
|
153 | - if (array_key_exists($tool, $tools)) |
|
154 | - return $tools[$tool]; |
|
155 | - else |
|
156 | - return null; |
|
152 | + $tools = array_flip(api_get_tools_lists()); |
|
153 | + if (array_key_exists($tool, $tools)) |
|
154 | + return $tools[$tool]; |
|
155 | + else |
|
156 | + return null; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // return a sql clause returning triplet of (course, $session, $uid) the |
160 | 160 | // current user is authorized to reed |
161 | 161 | function reports_getVisibilitySQL () { |
162 | - return "select cru.user_id from ".Database::get_main_table(TABLE_MAIN_COURSE_USER).' cru'; |
|
163 | - // fixme sessions |
|
162 | + return "select cru.user_id from ".Database::get_main_table(TABLE_MAIN_COURSE_USER).' cru'; |
|
163 | + // fixme sessions |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | // this function execute keys_query (SQL statement) |
@@ -134,14 +134,14 @@ |
||
134 | 134 | <select class="input_field_12em link required" name="type" id="type"> |
135 | 135 | <?php |
136 | 136 | foreach ($reports_template as $key => $value) { |
137 | - echo '<option value="'.$key.'">'.$value['description'].'</option>'; |
|
137 | + echo '<option value="'.$key.'">'.$value['description'].'</option>'; |
|
138 | 138 | } |
139 | 139 | ?> |
140 | 140 | </select><br /> |
141 | 141 | </span> |
142 | 142 | <?php |
143 | 143 | foreach ($reports_template as $key => $value) { |
144 | - echo $value['wizard']; |
|
144 | + echo $value['wizard']; |
|
145 | 145 | } |
146 | 146 | ?> |
147 | 147 | <span id="format" class="step submit_step"> |
@@ -2,62 +2,62 @@ |
||
2 | 2 | |
3 | 3 | // get fields informations |
4 | 4 | function multiquery_query($array) { |
5 | - $result = array(); |
|
6 | - $field = 0; |
|
7 | - for ($i = 0; $i <sizeof($array); $i++) { |
|
8 | - // mysql handler |
|
9 | - $result[$i]['mysql'] = mysql_query($array[$i]); |
|
10 | - |
|
11 | - if (! $result[$i]['mysql']) |
|
12 | - die("error in query $i : ".$array[$i]); |
|
13 | - |
|
14 | - // fields |
|
15 | - $result[$i]['num_fields'] = mysql_num_fields($result[$i]['mysql']); |
|
16 | - for ($j = 0; $j < $result[$i]['num_fields']; $j++) { |
|
17 | - $name = mysql_field_name($result[$i]['mysql'], $j); |
|
18 | - $result['field'][$field]['query']=$i; |
|
19 | - $result['field'][$field]['name']=$name; |
|
20 | - $result['field'][$field]['id']=$j; |
|
21 | - $result['field_assoc'][$name][$field]; |
|
22 | - $field++; |
|
23 | - } |
|
24 | - } |
|
25 | - $result['num_queries'] = sizeof($array); |
|
26 | - // rows |
|
27 | - $numberOfResult = mysql_num_rows($result[0]['mysql']); |
|
28 | - for ($i = 1; $i <$result['num_queries']; $i++) |
|
29 | - if ($numberOfResult != mysql_num_rows($result[$i]['mysql'])) |
|
30 | - die("wrong number of row: $numberOfResult vs ". |
|
31 | - mysql_num_rows($result[$i]['mysql'])." on query $i"); |
|
32 | - |
|
33 | - $result['num_rows'] = $numberOfResult; |
|
34 | - $result['num_fields'] = $field; |
|
35 | - |
|
36 | - return $result; |
|
5 | + $result = array(); |
|
6 | + $field = 0; |
|
7 | + for ($i = 0; $i <sizeof($array); $i++) { |
|
8 | + // mysql handler |
|
9 | + $result[$i]['mysql'] = mysql_query($array[$i]); |
|
10 | + |
|
11 | + if (! $result[$i]['mysql']) |
|
12 | + die("error in query $i : ".$array[$i]); |
|
13 | + |
|
14 | + // fields |
|
15 | + $result[$i]['num_fields'] = mysql_num_fields($result[$i]['mysql']); |
|
16 | + for ($j = 0; $j < $result[$i]['num_fields']; $j++) { |
|
17 | + $name = mysql_field_name($result[$i]['mysql'], $j); |
|
18 | + $result['field'][$field]['query']=$i; |
|
19 | + $result['field'][$field]['name']=$name; |
|
20 | + $result['field'][$field]['id']=$j; |
|
21 | + $result['field_assoc'][$name][$field]; |
|
22 | + $field++; |
|
23 | + } |
|
24 | + } |
|
25 | + $result['num_queries'] = sizeof($array); |
|
26 | + // rows |
|
27 | + $numberOfResult = mysql_num_rows($result[0]['mysql']); |
|
28 | + for ($i = 1; $i <$result['num_queries']; $i++) |
|
29 | + if ($numberOfResult != mysql_num_rows($result[$i]['mysql'])) |
|
30 | + die("wrong number of row: $numberOfResult vs ". |
|
31 | + mysql_num_rows($result[$i]['mysql'])." on query $i"); |
|
32 | + |
|
33 | + $result['num_rows'] = $numberOfResult; |
|
34 | + $result['num_fields'] = $field; |
|
35 | + |
|
36 | + return $result; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | function multiquery_num_rows(&$mq_h) { |
40 | - return $mq_h['num_rows']; |
|
40 | + return $mq_h['num_rows']; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | function multiquery_num_fields(&$mq_h) { |
44 | - return $mq_h['num_fields']; |
|
44 | + return $mq_h['num_fields']; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | function multiquery_field_name(&$mq_h, $id) { |
48 | - return $mq_h['field'][$id]['name']; |
|
48 | + return $mq_h['field'][$id]['name']; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | function multiquery_fetch_row(&$mq_h) { |
52 | - $result = array(); |
|
53 | - $pos = 0; |
|
54 | - for ($i = 0; $i < $mq_h['num_queries']; $i++) { |
|
55 | - $row = mysql_fetch_row($mq_h[$i]['mysql']); |
|
56 | - if (!$row) return false; // last line |
|
57 | - for ($j = 0; $j < sizeof($row); $j++) { |
|
58 | - $result[$pos] = $row[$j]; |
|
59 | - $pos++; |
|
60 | - } |
|
61 | - } |
|
62 | - return $result; |
|
52 | + $result = array(); |
|
53 | + $pos = 0; |
|
54 | + for ($i = 0; $i < $mq_h['num_queries']; $i++) { |
|
55 | + $row = mysql_fetch_row($mq_h[$i]['mysql']); |
|
56 | + if (!$row) return false; // last line |
|
57 | + for ($j = 0; $j < sizeof($row); $j++) { |
|
58 | + $result[$pos] = $row[$j]; |
|
59 | + $pos++; |
|
60 | + } |
|
61 | + } |
|
62 | + return $result; |
|
63 | 63 | } |
@@ -7,27 +7,27 @@ |
||
7 | 7 | } |
8 | 8 | |
9 | 9 | function reports_modules_quiz_init_forEachCourses($course_code, $course_id, $course_db) { |
10 | - global $reports_modules; |
|
10 | + global $reports_modules; |
|
11 | 11 | |
12 | - $reports_modules_quiz_toolid = reports_getToolId(TOOL_QUIZ); |
|
12 | + $reports_modules_quiz_toolid = reports_getToolId(TOOL_QUIZ); |
|
13 | 13 | |
14 | - array_push($reports_modules['quiz'], |
|
15 | - array('keys_query' => |
|
16 | - 'select '.$course_id.' as course_id, '. |
|
17 | - $reports_modules_quiz_toolid.' as tool_id, '. |
|
18 | - 'q.id as child_id, q.title as child_name, '. |
|
19 | - "'".$course_code."'".' as course_code from '.Database::get_course_table(TABLE_QUIZ_TEST).' q ', |
|
20 | - 'values_query_function' => 'reports_modules_quiz_quizVal')); |
|
14 | + array_push($reports_modules['quiz'], |
|
15 | + array('keys_query' => |
|
16 | + 'select '.$course_id.' as course_id, '. |
|
17 | + $reports_modules_quiz_toolid.' as tool_id, '. |
|
18 | + 'q.id as child_id, q.title as child_name, '. |
|
19 | + "'".$course_code."'".' as course_code from '.Database::get_course_table(TABLE_QUIZ_TEST).' q ', |
|
20 | + 'values_query_function' => 'reports_modules_quiz_quizVal')); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | function reports_modules_quiz_quizVal($quiz, $key_id) { |
24 | - $courseId = api_get_course_int_id($quiz['course_code']); |
|
25 | - return array('type'=> 'sql', 'sql' => |
|
26 | - 'select '.$key_id.', exe_user_id as uid, '. |
|
27 | - 'session_id, -1 as attempt, exe_result as score, '. |
|
28 | - REPORTS_PROGRESS_COMPLETED.' as progress, '. |
|
29 | - 'exe_duration as time, exe_date as ts from '. |
|
30 | - Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES). |
|
31 | - ' where c_id = ' . $courseId . |
|
32 | - ' and exe_exo_id='.$quiz['child_id']); |
|
24 | + $courseId = api_get_course_int_id($quiz['course_code']); |
|
25 | + return array('type'=> 'sql', 'sql' => |
|
26 | + 'select '.$key_id.', exe_user_id as uid, '. |
|
27 | + 'session_id, -1 as attempt, exe_result as score, '. |
|
28 | + REPORTS_PROGRESS_COMPLETED.' as progress, '. |
|
29 | + 'exe_duration as time, exe_date as ts from '. |
|
30 | + Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES). |
|
31 | + ' where c_id = ' . $courseId . |
|
32 | + ' and exe_exo_id='.$quiz['child_id']); |
|
33 | 33 | } |