@@ -1875,11 +1875,11 @@ discard block |
||
1875 | 1875 | return $this->locale; |
1876 | 1876 | } |
1877 | 1877 | |
1878 | - /** |
|
1879 | - * @param string $timezone |
|
1880 | - * |
|
1881 | - * @return User |
|
1882 | - */ |
|
1878 | + /** |
|
1879 | + * @param string $timezone |
|
1880 | + * |
|
1881 | + * @return User |
|
1882 | + */ |
|
1883 | 1883 | public function setTimezone($timezone) |
1884 | 1884 | { |
1885 | 1885 | $this->timezone = $timezone; |
@@ -2048,11 +2048,11 @@ discard block |
||
2048 | 2048 | return $this->plainPassword; |
2049 | 2049 | } |
2050 | 2050 | |
2051 | - /** |
|
2052 | - * Returns the user roles |
|
2053 | - * |
|
2054 | - * @return array The roles |
|
2055 | - */ |
|
2051 | + /** |
|
2052 | + * Returns the user roles |
|
2053 | + * |
|
2054 | + * @return array The roles |
|
2055 | + */ |
|
2056 | 2056 | public function getRoles() |
2057 | 2057 | { |
2058 | 2058 | $roles = $this->roles; |
@@ -6,19 +6,19 @@ |
||
6 | 6 | */ |
7 | 7 | class SelectTheme extends HTML_QuickForm_select |
8 | 8 | { |
9 | - /** |
|
10 | - * Class constructor |
|
11 | - */ |
|
12 | - public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) |
|
13 | - { |
|
14 | - parent::__construct($elementName, $elementLabel, $options, $attributes); |
|
15 | - // Get all languages |
|
16 | - $themes = api_get_themes(); |
|
17 | - $this->_options = array(); |
|
18 | - $this->_values = array(); |
|
19 | - $this->addOption('--',''); // no theme select |
|
20 | - for ($i=0; $i< count($themes[0]); $i++) { |
|
21 | - $this->addOption($themes[1][$i],$themes[0][$i]); |
|
22 | - } |
|
23 | - } |
|
9 | + /** |
|
10 | + * Class constructor |
|
11 | + */ |
|
12 | + public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) |
|
13 | + { |
|
14 | + parent::__construct($elementName, $elementLabel, $options, $attributes); |
|
15 | + // Get all languages |
|
16 | + $themes = api_get_themes(); |
|
17 | + $this->_options = array(); |
|
18 | + $this->_values = array(); |
|
19 | + $this->addOption('--',''); // no theme select |
|
20 | + for ($i=0; $i< count($themes[0]); $i++) { |
|
21 | + $this->addOption($themes[1][$i],$themes[0][$i]); |
|
22 | + } |
|
23 | + } |
|
24 | 24 | } |
@@ -27,22 +27,22 @@ |
||
27 | 27 | |
28 | 28 | if (!empty($_POST)) |
29 | 29 | { |
30 | - foreach ( $_POST as $key => $value ) |
|
31 | - { |
|
32 | - if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) |
|
33 | - continue; |
|
30 | + foreach ( $_POST as $key => $value ) |
|
31 | + { |
|
32 | + if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) |
|
33 | + continue; |
|
34 | 34 | |
35 | - if ( get_magic_quotes_gpc() ) |
|
36 | - $value = htmlspecialchars( stripslashes((string)$value) ); |
|
37 | - else |
|
38 | - $value = htmlspecialchars( (string)$value ); |
|
35 | + if ( get_magic_quotes_gpc() ) |
|
36 | + $value = htmlspecialchars( stripslashes((string)$value) ); |
|
37 | + else |
|
38 | + $value = htmlspecialchars( (string)$value ); |
|
39 | 39 | ?> |
40 | 40 | <tr> |
41 | 41 | <th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th> |
42 | 42 | <td><pre class="samples"><?php echo $value; ?></pre></td> |
43 | 43 | </tr> |
44 | 44 | <?php |
45 | - } |
|
45 | + } |
|
46 | 46 | } |
47 | 47 | ?> |
48 | 48 | </table> |
@@ -26,7 +26,7 @@ |
||
26 | 26 | parent::__construct('1.1', 'Valery Fremaux'); |
27 | 27 | } |
28 | 28 | |
29 | - function pix_url($pixname, $size = 16) { |
|
29 | + function pix_url($pixname, $size = 16) { |
|
30 | 30 | global $_configuration; |
31 | 31 | |
32 | 32 | if (file_exists($_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.png')){ |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * Security checks |
15 | 15 | */ |
16 | 16 | if (! isset($_SESSION['conditional_login']['uid'])) |
17 | - die("Not Authorised"); |
|
17 | + die("Not Authorised"); |
|
18 | 18 | |
19 | 19 | if (isset($_POST['password'])) { |
20 | 20 | $u = api_get_user_info($_SESSION['conditional_login']['uid']); |
@@ -27,26 +27,26 @@ discard block |
||
27 | 27 | exit(); |
28 | 28 | } |
29 | 29 | $password = $_POST['password']; |
30 | - $updated = UserManager::update_user( |
|
31 | - $u['user_id'], |
|
32 | - $u['firstname'], |
|
33 | - $u['lastname'], |
|
34 | - $u['username'], |
|
35 | - $password, |
|
36 | - $u['auth_source'], |
|
37 | - $u['email'], |
|
38 | - $u['status'], |
|
39 | - $u['official_code'], |
|
40 | - $u['phone'], |
|
41 | - $u['picture_uri'], |
|
42 | - $u['expiration_date'], |
|
43 | - $u['active'], |
|
44 | - $u['creator_id'], |
|
45 | - $u['hr_dept_id'], |
|
46 | - null, |
|
47 | - $u['language'], |
|
48 | - '' |
|
49 | - ); |
|
30 | + $updated = UserManager::update_user( |
|
31 | + $u['user_id'], |
|
32 | + $u['firstname'], |
|
33 | + $u['lastname'], |
|
34 | + $u['username'], |
|
35 | + $password, |
|
36 | + $u['auth_source'], |
|
37 | + $u['email'], |
|
38 | + $u['status'], |
|
39 | + $u['official_code'], |
|
40 | + $u['phone'], |
|
41 | + $u['picture_uri'], |
|
42 | + $u['expiration_date'], |
|
43 | + $u['active'], |
|
44 | + $u['creator_id'], |
|
45 | + $u['hr_dept_id'], |
|
46 | + null, |
|
47 | + $u['language'], |
|
48 | + '' |
|
49 | + ); |
|
50 | 50 | |
51 | 51 | if ($updated !== false) { |
52 | 52 | UserManager::update_extra_field_value($u['user_id'], 'already_logged_in', 'true'); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | <div id="changepassword-form-box" class="form-box"> |
105 | 105 | <div class="info"> <?php echo custompages_get_lang('FirstLoginChangePassword');?> </div> |
106 | 106 | <?php if (isset($error_message)) { |
107 | - echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>'; |
|
108 | - }?> |
|
107 | + echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>'; |
|
108 | + }?> |
|
109 | 109 | <form id="changepassword-form" class="form" method="post"> |
110 | 110 | <div> |
111 | 111 | <label for="password">*<?php echo custompages_get_lang('Password');?></label> |
@@ -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); |
@@ -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() { |
@@ -60,8 +60,8 @@ |
||
60 | 60 | $user['error'] = get_lang('UserNameNotAvailable'); |
61 | 61 | $errors[] = $user; |
62 | 62 | } |
63 | - } |
|
64 | - } |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | // 3. Check status. |
67 | 67 | if (isset($user['Status']) && !api_status_exists($user['Status'])) { |
@@ -22,59 +22,59 @@ |
||
22 | 22 | $output = false; |
23 | 23 | $ls = new langstats(); |
24 | 24 | if ($ls === false) { |
25 | - exit($ls->error); |
|
25 | + exit($ls->error); |
|
26 | 26 | } |
27 | 27 | $list = $ls->get_popular_terms($x_most_popular); |
28 | 28 | if ($_GET['output'] == 1) { |
29 | - $output = true; |
|
30 | - $variables_origin = $ls->get_variables_origin(); |
|
29 | + $output = true; |
|
30 | + $variables_origin = $ls->get_variables_origin(); |
|
31 | 31 | } |
32 | 32 | /** |
33 | 33 | * Display |
34 | 34 | */ |
35 | 35 | if (count($list)==0) { echo 'No terms loaded so far'; } |
36 | 36 | if (count($list)>0) { |
37 | - $i = 1; |
|
38 | - $j = 1; |
|
39 | - $k = 0; |
|
40 | - $files = array(); |
|
41 | - $trans = array(); |
|
42 | - echo 'Number of records: '.count($list).'<br />'; |
|
43 | - echo '<table><tr><th>Index</th><th>Registration order</th><th>Term</th>'.($output==1?'<th>Origin</th>':'').'<th>Count</th></tr>'; |
|
44 | - foreach($list as $elem) { |
|
37 | + $i = 1; |
|
38 | + $j = 1; |
|
39 | + $k = 0; |
|
40 | + $files = array(); |
|
41 | + $trans = array(); |
|
42 | + echo 'Number of records: '.count($list).'<br />'; |
|
43 | + echo '<table><tr><th>Index</th><th>Registration order</th><th>Term</th>'.($output==1?'<th>Origin</th>':'').'<th>Count</th></tr>'; |
|
44 | + foreach($list as $elem) { |
|
45 | 45 | if ($k > $terms_limit) { break; } |
46 | 46 | $fixed_elem = $elem; |
47 | 47 | if ($output) { |
48 | - if (empty($variables_origin[$elem['term_name']]) && !empty($variables_origin['lang'.$elem['term_name']])) { |
|
48 | + if (empty($variables_origin[$elem['term_name']]) && !empty($variables_origin['lang'.$elem['term_name']])) { |
|
49 | 49 | $fixed_elem = array('id' => $elem['id'], 'term_name' => 'lang'.$elem['term_name'], 'term_count' => $elem['term_count']); |
50 | - } |
|
51 | - if (empty($variables_origin[$fixed_elem['term_name']])) { |
|
50 | + } |
|
51 | + if (empty($variables_origin[$fixed_elem['term_name']])) { |
|
52 | 52 | continue; |
53 | - } |
|
54 | - $files[$variables_origin[$fixed_elem['term_name']]][] = $fixed_elem['term_name']; |
|
55 | - $translation = get_lang($fixed_elem['term_name']); |
|
56 | - $k += str_word_count($translation); |
|
57 | - $trans[$fixed_elem['term_name']] = $translation; |
|
58 | - $j++; |
|
53 | + } |
|
54 | + $files[$variables_origin[$fixed_elem['term_name']]][] = $fixed_elem['term_name']; |
|
55 | + $translation = get_lang($fixed_elem['term_name']); |
|
56 | + $k += str_word_count($translation); |
|
57 | + $trans[$fixed_elem['term_name']] = $translation; |
|
58 | + $j++; |
|
59 | 59 | } |
60 | 60 | echo '<tr><td>',$i, |
61 | - '</td><td>',$fixed_elem['id'], |
|
62 | - '</td><td>',$fixed_elem['term_name']; |
|
61 | + '</td><td>',$fixed_elem['id'], |
|
62 | + '</td><td>',$fixed_elem['term_name']; |
|
63 | 63 | if ($output) { |
64 | - echo '</td><td>'.$variables_origin[$fixed_elem['term_name']]; |
|
64 | + echo '</td><td>'.$variables_origin[$fixed_elem['term_name']]; |
|
65 | 65 | } |
66 | 66 | echo '</td><td>',$fixed_elem['term_count'],'</td></tr>'; |
67 | 67 | $i++; |
68 | - } |
|
69 | - echo '</table>'; |
|
70 | - if ($output) { |
|
68 | + } |
|
69 | + echo '</table>'; |
|
70 | + if ($output) { |
|
71 | 71 | @mkdir('/tmp/lang'); |
72 | 72 | foreach ($files as $file => $terms) { |
73 | - @touch('/tmp/lang/'.$file); |
|
74 | - file_put_contents('/tmp/lang/'.$file,"<?php".PHP_EOL); |
|
75 | - foreach ($terms as $term) { |
|
73 | + @touch('/tmp/lang/'.$file); |
|
74 | + file_put_contents('/tmp/lang/'.$file,"<?php".PHP_EOL); |
|
75 | + foreach ($terms as $term) { |
|
76 | 76 | file_put_contents('/tmp/lang/'.$file,'$'.$term.' = "'.str_replace('"','\"',$trans[$term]).'";'.PHP_EOL, FILE_APPEND); |
77 | - } |
|
77 | + } |
|
78 | 78 | } |
79 | - } |
|
79 | + } |
|
80 | 80 | } |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | * Code run |
34 | 34 | */ |
35 | 35 | foreach ($terms as $row) { |
36 | - if ($words_counter > 10000) { break; } |
|
37 | - $words = str_word_count(get_lang($row['term_name'],null,$orig_lang)); |
|
38 | - $words_counter += $words; |
|
39 | - $terms_in_limit[$row['term_name']] = $i; |
|
40 | - //echo "Term <b>".$row['term_name']."</b> is <b>'".get_lang($row['term_name'],null,$orig_lang)."'</b> which means $words words<br /><br />\n"; |
|
41 | - //if ($words_counter%1000 >= 0) { |
|
36 | + if ($words_counter > 10000) { break; } |
|
37 | + $words = str_word_count(get_lang($row['term_name'],null,$orig_lang)); |
|
38 | + $words_counter += $words; |
|
39 | + $terms_in_limit[$row['term_name']] = $i; |
|
40 | + //echo "Term <b>".$row['term_name']."</b> is <b>'".get_lang($row['term_name'],null,$orig_lang)."'</b> which means $words words<br /><br />\n"; |
|
41 | + //if ($words_counter%1000 >= 0) { |
|
42 | 42 | //echo "Reached $words_counter words at term $i (".$row['term_name']." used ".$row['term_count']." times)...<br />\n"; |
43 | - //} |
|
44 | - $i++; |
|
43 | + //} |
|
44 | + $i++; |
|
45 | 45 | } |
46 | 46 | //echo $words_counter.'<br />'; |
47 | 47 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | echo "Scanning English files, trying to find these terms...<br />\n"; |
51 | 51 | if (!is_dir($arch_dir.'/langstats')) { |
52 | - mkdir($arch_dir.'/langstats'); |
|
53 | - mkdir($arch_dir.'/langstats/'.$orig_lang); |
|
52 | + mkdir($arch_dir.'/langstats'); |
|
53 | + mkdir($arch_dir.'/langstats/'.$orig_lang); |
|
54 | 54 | } |
55 | 55 | $list_files = scandir($lang_dir.'/'.$orig_lang); |
56 | 56 | $j = 1; |
@@ -59,35 +59,35 @@ discard block |
||
59 | 59 | $global_var = array(); //keep the combination of all vars |
60 | 60 | $terms_in_limit = array_flip($terms_in_limit); |
61 | 61 | foreach ($list_files as $file) { |
62 | - if (substr($file,0,1) == '.') {continue;} |
|
63 | - //echo "'".substr($file,0,-8)."',<br />"; //print in a PHP array format |
|
64 | - $vars = file($lang_dir.'/'.$orig_lang.'/'.$file); |
|
65 | - $local_var = array(); |
|
66 | - $file_string = '<?php'."\n"; |
|
67 | - foreach ($vars as $line) { |
|
62 | + if (substr($file,0,1) == '.') {continue;} |
|
63 | + //echo "'".substr($file,0,-8)."',<br />"; //print in a PHP array format |
|
64 | + $vars = file($lang_dir.'/'.$orig_lang.'/'.$file); |
|
65 | + $local_var = array(); |
|
66 | + $file_string = '<?php'."\n"; |
|
67 | + foreach ($vars as $line) { |
|
68 | 68 | $var = array(); |
69 | 69 | $res = preg_match('/^(\$\w*)/',$line,$var); |
70 | 70 | if ($res>0) { |
71 | - //echo $var[1]."<br />"; |
|
71 | + //echo $var[1]."<br />"; |
|
72 | 72 | |
73 | - if (in_array(substr($var[1],1),$terms_in_limit)) { |
|
73 | + if (in_array(substr($var[1],1),$terms_in_limit)) { |
|
74 | 74 | //echo "Var ".$var[1]." was in the limit<br />"; |
75 | 75 | $local_var[$var[1]] = $line; |
76 | 76 | $file_string .= $line; |
77 | 77 | $terms_found[] = substr($var[1],1); //e.g. store Tools |
78 | 78 | $words_found += str_word_count(get_lang($var[1],null,$orig_lang)); |
79 | - } elseif (in_array(substr($var[1],5),$terms_in_limit)) { |
|
79 | + } elseif (in_array(substr($var[1],5),$terms_in_limit)) { |
|
80 | 80 | //echo "Var ".$var[1]." was in the limit<br />"; |
81 | 81 | $local_var[$var[1]] = $line; |
82 | 82 | $file_string .= $line; |
83 | 83 | $terms_found[] = substr($var[1],5); //e.g. store langTools |
84 | 84 | $words_found += str_word_count(get_lang(substr($var[1],5),null,$orig_lang)); |
85 | - } //else do not care |
|
85 | + } //else do not care |
|
86 | 86 | } |
87 | - } |
|
88 | - echo "Writing ".$arch_dir.'/langstats/'.$orig_lang.'/'.$file."<br />\n"; |
|
89 | - file_put_contents($arch_dir.'/langstats/'.$orig_lang.'/'.$file,$file_string); |
|
90 | - $global_var += $local_var; |
|
87 | + } |
|
88 | + echo "Writing ".$arch_dir.'/langstats/'.$orig_lang.'/'.$file."<br />\n"; |
|
89 | + file_put_contents($arch_dir.'/langstats/'.$orig_lang.'/'.$file,$file_string); |
|
90 | + $global_var += $local_var; |
|
91 | 91 | }; |
92 | 92 | $terms_diff = count($global_var)-count($terms_in_limit); |
93 | 93 | echo count($global_var)." terms found in English files (summing up to $words_found words). Some terms ($terms_diff in this case) might have appeared in two different files<br />"; |