@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | //die(); |
10 | 10 | require_once '../../inc/global.inc.php'; |
11 | 11 | $path = api_get_path(SYS_LANG_PATH).'english'; |
12 | -ini_set('memory_limit','128M'); |
|
12 | +ini_set('memory_limit', '128M'); |
|
13 | 13 | /** |
14 | 14 | * Main code |
15 | 15 | */ |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $langs = scandir(api_get_path(SYS_LANG_PATH)); |
19 | 19 | foreach ($langs as $lang) { |
20 | 20 | $dir = api_get_path(SYS_LANG_PATH).$lang; |
21 | - if (is_dir($dir) && substr($lang,0,1) != '.' && !empty($lang)) { |
|
21 | + if (is_dir($dir) && substr($lang, 0, 1) != '.' && !empty($lang)) { |
|
22 | 22 | echo "$lang..."; |
23 | 23 | $ok = true; |
24 | 24 | foreach ($list as $entry) { |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | $out = array(); |
27 | 27 | if (is_file($file)) { |
28 | 28 | //$terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true)); |
29 | - @exec('php5 -l '.$file,$out); |
|
30 | - if (substr($out[0],0,2)!='No') { |
|
29 | + @exec('php5 -l '.$file, $out); |
|
30 | + if (substr($out[0], 0, 2) != 'No') { |
|
31 | 31 | echo $out[0]."\n"; |
32 | 32 | $ok = false; |
33 | 33 | } |
@@ -17,25 +17,25 @@ |
||
17 | 17 | $list = SubLanguageManager::get_lang_folder_files_list($path); |
18 | 18 | $langs = scandir(api_get_path(SYS_LANG_PATH)); |
19 | 19 | foreach ($langs as $lang) { |
20 | - $dir = api_get_path(SYS_LANG_PATH).$lang; |
|
21 | - if (is_dir($dir) && substr($lang,0,1) != '.' && !empty($lang)) { |
|
20 | + $dir = api_get_path(SYS_LANG_PATH).$lang; |
|
21 | + if (is_dir($dir) && substr($lang,0,1) != '.' && !empty($lang)) { |
|
22 | 22 | echo "$lang..."; |
23 | 23 | $ok = true; |
24 | 24 | foreach ($list as $entry) { |
25 | - $file = $dir.'/'.$entry; |
|
26 | - $out = array(); |
|
27 | - if (is_file($file)) { |
|
25 | + $file = $dir.'/'.$entry; |
|
26 | + $out = array(); |
|
27 | + if (is_file($file)) { |
|
28 | 28 | //$terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true)); |
29 | 29 | @exec('php5 -l '.$file,$out); |
30 | 30 | if (substr($out[0],0,2)!='No') { |
31 | - echo $out[0]."\n"; |
|
32 | - $ok = false; |
|
31 | + echo $out[0]."\n"; |
|
32 | + $ok = false; |
|
33 | + } |
|
33 | 34 | } |
34 | - } |
|
35 | 35 | } |
36 | 36 | if ($ok) { |
37 | - echo "OK\n"; |
|
37 | + echo "OK\n"; |
|
38 | + } |
|
38 | 39 | } |
39 | - } |
|
40 | 40 | } |
41 | 41 | echo "Done\n"; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | foreach ($terms as $row) { |
36 | 36 | if ($words_counter > 10000) { break; } |
37 | - $words = str_word_count(get_lang($row['term_name'],null,$orig_lang)); |
|
37 | + $words = str_word_count(get_lang($row['term_name'], null, $orig_lang)); |
|
38 | 38 | $words_counter += $words; |
39 | 39 | $terms_in_limit[$row['term_name']] = $i; |
40 | 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"; |
@@ -59,37 +59,37 @@ 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;} |
|
62 | + if (substr($file, 0, 1) == '.') {continue; } |
|
63 | 63 | //echo "'".substr($file,0,-8)."',<br />"; //print in a PHP array format |
64 | 64 | $vars = file($lang_dir.'/'.$orig_lang.'/'.$file); |
65 | 65 | $local_var = array(); |
66 | 66 | $file_string = '<?php'."\n"; |
67 | 67 | foreach ($vars as $line) { |
68 | 68 | $var = array(); |
69 | - $res = preg_match('/^(\$\w*)/',$line,$var); |
|
70 | - if ($res>0) { |
|
69 | + $res = preg_match('/^(\$\w*)/', $line, $var); |
|
70 | + if ($res > 0) { |
|
71 | 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 | - $terms_found[] = substr($var[1],1); //e.g. store Tools |
|
78 | - $words_found += str_word_count(get_lang($var[1],null,$orig_lang)); |
|
79 | - } elseif (in_array(substr($var[1],5),$terms_in_limit)) { |
|
77 | + $terms_found[] = substr($var[1], 1); //e.g. store Tools |
|
78 | + $words_found += str_word_count(get_lang($var[1], null, $orig_lang)); |
|
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 | - $terms_found[] = substr($var[1],5); //e.g. store langTools |
|
84 | - $words_found += str_word_count(get_lang(substr($var[1],5),null,$orig_lang)); |
|
83 | + $terms_found[] = substr($var[1], 5); //e.g. store langTools |
|
84 | + $words_found += str_word_count(get_lang(substr($var[1], 5), null, $orig_lang)); |
|
85 | 85 | } //else do not care |
86 | 86 | } |
87 | 87 | } |
88 | 88 | echo "Writing ".$arch_dir.'/langstats/'.$orig_lang.'/'.$file."<br />\n"; |
89 | - file_put_contents($arch_dir.'/langstats/'.$orig_lang.'/'.$file,$file_string); |
|
89 | + file_put_contents($arch_dir.'/langstats/'.$orig_lang.'/'.$file, $file_string); |
|
90 | 90 | $global_var += $local_var; |
91 | 91 | }; |
92 | -$terms_diff = count($global_var)-count($terms_in_limit); |
|
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 />"; |
94 | 94 | /** |
95 | 95 | * Display results |
@@ -97,5 +97,5 @@ discard block |
||
97 | 97 | |
98 | 98 | echo "Difference between filtered and found in English:<br />"; |
99 | 99 | //print_r($terms_found); |
100 | -echo "<pre>".print_r(array_diff($terms_in_limit,$terms_found),1)."</pre>"; |
|
100 | +echo "<pre>".print_r(array_diff($terms_in_limit, $terms_found), 1)."</pre>"; |
|
101 | 101 | echo "#"; |
@@ -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 />"; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | return false; //cannot use if sqlite not installed |
31 | 31 | } |
32 | 32 | if (empty($file)) { |
33 | - $file = api_get_path(SYS_ARCHIVE_PATH) . '/langstasdb'; |
|
33 | + $file = api_get_path(SYS_ARCHIVE_PATH).'/langstasdb'; |
|
34 | 34 | } |
35 | 35 | if (is_file($file) && is_writeable($file)) { |
36 | 36 | $this->db = new SQLite3($file, SQLITE3_OPEN_READWRITE); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->db = new SQLite3($file); |
40 | 40 | } catch (Exception $e) { |
41 | 41 | $this->error = 'DatabaseCreateError'; |
42 | - error_log('Exception: ' . $e->getMessage()); |
|
42 | + error_log('Exception: '.$e->getMessage()); |
|
43 | 43 | return false; |
44 | 44 | } |
45 | 45 | $err = $this->db->exec( |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $num = $row[3]; |
105 | 105 | $num++; |
106 | 106 | $res = $this->db->query( |
107 | - 'UPDATE lang_freq SET term_count = ' . $num . ' WHERE id = ' . $row[0] |
|
107 | + 'UPDATE lang_freq SET term_count = '.$num.' WHERE id = '.$row[0] |
|
108 | 108 | ); |
109 | 109 | if ($res === false) { |
110 | 110 | $this->error = 'CouldNotUpdateTerm'; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function get_popular_terms($num = 1000) |
137 | 137 | { |
138 | 138 | $res = $this->db->query( |
139 | - 'SELECT * FROM lang_freq ORDER BY term_count DESC LIMIT ' . $num |
|
139 | + 'SELECT * FROM lang_freq ORDER BY term_count DESC LIMIT '.$num |
|
140 | 140 | ); |
141 | 141 | $list = array(); |
142 | 142 | while ($row = $res->fetchArray()) { |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function get_variables_origin() |
165 | 165 | { |
166 | - $path = api_get_path(SYS_LANG_PATH) . 'english/'; |
|
166 | + $path = api_get_path(SYS_LANG_PATH).'english/'; |
|
167 | 167 | $vars = array(); |
168 | 168 | $priority = array('trad4all'); |
169 | 169 | foreach ($priority as $file) { |
170 | 170 | $list = SubLanguageManager::get_all_language_variable_in_file( |
171 | - $path . $file . '.inc.php', |
|
171 | + $path.$file.'.inc.php', |
|
172 | 172 | true |
173 | 173 | ); |
174 | 174 | foreach ($list as $var => $trad) { |
175 | - $vars[$var] = $file . '.inc.php'; |
|
175 | + $vars[$var] = $file.'.inc.php'; |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | $files = scandir($path); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | continue; |
182 | 182 | } |
183 | 183 | $list = SubLanguageManager::get_all_language_variable_in_file( |
184 | - $path . $file, |
|
184 | + $path.$file, |
|
185 | 185 | true |
186 | 186 | ); |
187 | 187 | foreach ($list as $var => $trad) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $res = preg_match_all('/get_lang\(\'(\\w*)\'\)/', $line, $myTerms); |
44 | 44 | if ($res > 0) { |
45 | 45 | foreach ($myTerms[1] as $term) { |
46 | - if (substr($term, 0, 4)=='lang') { |
|
46 | + if (substr($term, 0, 4) == 'lang') { |
|
47 | 47 | $term = substr($term, 4); |
48 | 48 | } |
49 | 49 | $usedTerms[$term] = $shortFile; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $res = preg_match_all('/\{[\'"](\\w*)[\'"]\|get_lang\}/', $line, $myTerms); |
54 | 54 | if ($res > 0) { |
55 | 55 | foreach ($myTerms[1] as $term) { |
56 | - if (substr($term, 0, 4)=='lang') { |
|
56 | + if (substr($term, 0, 4) == 'lang') { |
|
57 | 57 | $term = substr($term, 4); |
58 | 58 | } |
59 | 59 | $usedTerms[$term] = $shortFile; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // Compare defined terms VS used terms. Used terms should be smaller than |
68 | 68 | // defined terms, and this should prove the concept that there are much |
69 | 69 | // more variables than what we really use |
70 | -if (count($usedTerms)<1) { |
|
70 | +if (count($usedTerms) < 1) { |
|
71 | 71 | die("No used terms<br />\n"); |
72 | 72 | } else { |
73 | 73 | echo "The following terms were defined but never used: <br />\n<table>"; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $i = 1; |
76 | 76 | foreach ($defined_terms as $term => $file) { |
77 | 77 | // remove "lang" prefix just in case |
78 | - if (substr($term,0,4)=='lang') { $term = substr($term,4); } |
|
78 | + if (substr($term, 0, 4) == 'lang') { $term = substr($term, 4); } |
|
79 | 79 | if (!isset($usedTerms[$term])) { |
80 | 80 | echo "<tr><td>$i</td><td>$term</td></tr>\n"; |
81 | 81 | $i++; |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | $list = scandir($base_path); |
89 | 89 | $files = array(); |
90 | 90 | foreach ($list as $item) { |
91 | - if (substr($item,0,1)=='.') {continue;} |
|
92 | - $special_dirs = array(api_get_path(SYS_TEST_PATH),api_get_path(SYS_COURSE_PATH),api_get_path(SYS_LANG_PATH),api_get_path(SYS_ARCHIVE_PATH)); |
|
93 | - if (in_array($base_path.$item.'/',$special_dirs)) {continue;} |
|
91 | + if (substr($item, 0, 1) == '.') {continue; } |
|
92 | + $special_dirs = array(api_get_path(SYS_TEST_PATH), api_get_path(SYS_COURSE_PATH), api_get_path(SYS_LANG_PATH), api_get_path(SYS_ARCHIVE_PATH)); |
|
93 | + if (in_array($base_path.$item.'/', $special_dirs)) {continue; } |
|
94 | 94 | if (is_dir($base_path.$item)) { |
95 | - $files = array_merge($files,get_all_php_files($base_path.$item.'/')); |
|
95 | + $files = array_merge($files, get_all_php_files($base_path.$item.'/')); |
|
96 | 96 | } else { |
97 | 97 | //only analyse php files |
98 | - $sub = substr($item,-4); |
|
98 | + $sub = substr($item, -4); |
|
99 | 99 | if ($sub == '.php' or $sub == '.tpl') { |
100 | 100 | $files[] = $base_path.$item; |
101 | 101 | } |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | // defined terms, and this should prove the concept that there are much |
69 | 69 | // more variables than what we really use |
70 | 70 | if (count($usedTerms)<1) { |
71 | - die("No used terms<br />\n"); |
|
71 | + die("No used terms<br />\n"); |
|
72 | 72 | } else { |
73 | - echo "The following terms were defined but never used: <br />\n<table>"; |
|
73 | + echo "The following terms were defined but never used: <br />\n<table>"; |
|
74 | 74 | } |
75 | 75 | $i = 1; |
76 | 76 | foreach ($defined_terms as $term => $file) { |
77 | - // remove "lang" prefix just in case |
|
78 | - if (substr($term,0,4)=='lang') { $term = substr($term,4); } |
|
79 | - if (!isset($usedTerms[$term])) { |
|
77 | + // remove "lang" prefix just in case |
|
78 | + if (substr($term,0,4)=='lang') { $term = substr($term,4); } |
|
79 | + if (!isset($usedTerms[$term])) { |
|
80 | 80 | echo "<tr><td>$i</td><td>$term</td></tr>\n"; |
81 | 81 | $i++; |
82 | - } |
|
82 | + } |
|
83 | 83 | } |
84 | 84 | echo "</table>\n"; |
85 | 85 | |
@@ -88,17 +88,17 @@ discard block |
||
88 | 88 | $list = scandir($base_path); |
89 | 89 | $files = array(); |
90 | 90 | foreach ($list as $item) { |
91 | - if (substr($item,0,1)=='.') {continue;} |
|
91 | + if (substr($item,0,1)=='.') {continue;} |
|
92 | 92 | $special_dirs = array(api_get_path(SYS_TEST_PATH),api_get_path(SYS_COURSE_PATH),api_get_path(SYS_LANG_PATH),api_get_path(SYS_ARCHIVE_PATH)); |
93 | 93 | if (in_array($base_path.$item.'/',$special_dirs)) {continue;} |
94 | 94 | if (is_dir($base_path.$item)) { |
95 | - $files = array_merge($files,get_all_php_files($base_path.$item.'/')); |
|
95 | + $files = array_merge($files,get_all_php_files($base_path.$item.'/')); |
|
96 | 96 | } else { |
97 | 97 | //only analyse php files |
98 | 98 | $sub = substr($item,-4); |
99 | - if ($sub == '.php' or $sub == '.tpl') { |
|
99 | + if ($sub == '.php' or $sub == '.tpl') { |
|
100 | 100 | $files[] = $base_path.$item; |
101 | - } |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | $list = null; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | |
4 | -if (PHP_SAPI !='cli') { |
|
4 | +if (PHP_SAPI != 'cli') { |
|
5 | 5 | die('Run this script through the command line or comment this line in the code'); |
6 | 6 | } |
7 | 7 | |
@@ -365,11 +365,11 @@ discard block |
||
365 | 365 | $row = $this->cleanUserRow($row); |
366 | 366 | |
367 | 367 | $user_id = UserManager::get_user_id_from_original_id( |
368 | - $row['extra_' . $this->extraFieldIdNameList['user']], |
|
368 | + $row['extra_'.$this->extraFieldIdNameList['user']], |
|
369 | 369 | $this->extraFieldIdNameList['user'] |
370 | 370 | ); |
371 | - $userInfo = array(); |
|
372 | - $userInfoByOfficialCode = null; |
|
371 | + $userInfo = array(); |
|
372 | + $userInfoByOfficialCode = null; |
|
373 | 373 | |
374 | 374 | if (!empty($user_id)) { |
375 | 375 | $userInfo = api_get_user_info($user_id); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $result = UserManager::update_user( |
424 | 424 | $userInfo['user_id'], |
425 | 425 | $row['firstname'], // <<-- changed |
426 | - $row['lastname'], // <<-- changed |
|
426 | + $row['lastname'], // <<-- changed |
|
427 | 427 | $userInfo['username'], |
428 | 428 | null, //$password = null, |
429 | 429 | $row['auth_source'], |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | if ($row['action'] == 'delete') { |
559 | 559 | // Inactive one year later |
560 | - $userInfo['expiration_date'] = api_get_utc_datetime(api_strtotime(time() + 365*24*60*60)); |
|
560 | + $userInfo['expiration_date'] = api_get_utc_datetime(api_strtotime(time() + 365 * 24 * 60 * 60)); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | $password = $row['password']; // change password |
@@ -606,8 +606,8 @@ discard block |
||
606 | 606 | $result = UserManager::update_user( |
607 | 607 | $userInfo['user_id'], |
608 | 608 | $row['firstname'], // <<-- changed |
609 | - $row['lastname'], // <<-- changed |
|
610 | - $row['username'], // <<-- changed |
|
609 | + $row['lastname'], // <<-- changed |
|
610 | + $row['username'], // <<-- changed |
|
611 | 611 | $password, //$password = null, |
612 | 612 | $row['auth_source'], |
613 | 613 | $email, |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | $data = Import::csv_to_array($file); |
675 | 675 | |
676 | 676 | if (!empty($data)) { |
677 | - $this->logger->addInfo(count($data) . " records found."); |
|
677 | + $this->logger->addInfo(count($data)." records found."); |
|
678 | 678 | $eventsToCreate = array(); |
679 | 679 | $errorFound = false; |
680 | 680 | foreach ($data as $row) { |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | ); |
689 | 689 | } |
690 | 690 | |
691 | - $courseCode = null; |
|
691 | + $courseCode = null; |
|
692 | 692 | if (isset($row['coursecode'])) { |
693 | 693 | $courseCode = $row['coursecode']; |
694 | 694 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | } |
743 | 743 | |
744 | 744 | $date = $row['date']; |
745 | - $startTime = $row['time_start']; |
|
745 | + $startTime = $row['time_start']; |
|
746 | 746 | $endTime = $row['time_end']; |
747 | 747 | $title = $row['title']; |
748 | 748 | $comment = $row['comment']; |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | $row = $this->cleanCourseRow($row); |
967 | 967 | |
968 | 968 | $courseId = CourseManager::get_course_id_from_original_id( |
969 | - $row['extra_' . $this->extraFieldIdNameList['course']], |
|
969 | + $row['extra_'.$this->extraFieldIdNameList['course']], |
|
970 | 970 | $this->extraFieldIdNameList['course'] |
971 | 971 | ); |
972 | 972 | |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | $data = Import::csv_reader($file); |
1085 | 1085 | |
1086 | 1086 | if (!empty($data)) { |
1087 | - $this->logger->addInfo(count($data) . " records found."); |
|
1087 | + $this->logger->addInfo(count($data)." records found."); |
|
1088 | 1088 | foreach ($data as $row) { |
1089 | 1089 | $chamiloUserName = $row['UserName']; |
1090 | 1090 | $chamiloCourseCode = $row['CourseCode']; |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | ); |
1127 | 1127 | |
1128 | 1128 | $this->logger->addError( |
1129 | - "User '$chamiloUserName' was remove from Session: #$chamiloSessionId - Course: " . $courseInfo['code'] |
|
1129 | + "User '$chamiloUserName' was remove from Session: #$chamiloSessionId - Course: ".$courseInfo['code'] |
|
1130 | 1130 | ); |
1131 | 1131 | |
1132 | 1132 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | $data = Import::csv_reader($file); |
1144 | 1144 | |
1145 | 1145 | if (!empty($data)) { |
1146 | - $this->logger->addInfo(count($data) . " records found."); |
|
1146 | + $this->logger->addInfo(count($data)." records found."); |
|
1147 | 1147 | foreach ($data as $row) { |
1148 | 1148 | $chamiloUserName = $row['UserName']; |
1149 | 1149 | $chamiloCourseCode = $row['CourseCode']; |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | $this->logger->addError( |
1201 | - "User '$chamiloUserName' with status $type was added to session: #$chamiloSessionId - Course: " . $courseInfo['code'] |
|
1201 | + "User '$chamiloUserName' with status $type was added to session: #$chamiloSessionId - Course: ".$courseInfo['code'] |
|
1202 | 1202 | ); |
1203 | 1203 | } |
1204 | 1204 | } |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | */ |
1442 | 1442 | private function importSessions($file, $moveFile = true, &$teacherBackup = array(), &$groupBackup = array()) |
1443 | 1443 | { |
1444 | - $avoid = null; |
|
1444 | + $avoid = null; |
|
1445 | 1445 | if (isset($this->conditions['importSessions']) && |
1446 | 1446 | isset($this->conditions['importSessions']['update']) |
1447 | 1447 | ) { |
@@ -1486,7 +1486,7 @@ discard block |
||
1486 | 1486 | $data = Import::csv_reader($file); |
1487 | 1487 | |
1488 | 1488 | if (!empty($data)) { |
1489 | - $this->logger->addInfo(count($data) . " records found."); |
|
1489 | + $this->logger->addInfo(count($data)." records found."); |
|
1490 | 1490 | foreach ($data as $row) { |
1491 | 1491 | $chamiloUserName = $row['UserName']; |
1492 | 1492 | $chamiloCourseCode = $row['CourseCode']; |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | } |
1534 | 1534 | |
1535 | 1535 | $this->logger->addError( |
1536 | - "User '$chamiloUserName' with status $type was added to session: #$chamiloSessionId - Course: " . $courseInfo['code'] |
|
1536 | + "User '$chamiloUserName' with status $type was added to session: #$chamiloSessionId - Course: ".$courseInfo['code'] |
|
1537 | 1537 | ); |
1538 | 1538 | } |
1539 | 1539 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package chamilo.cron |
7 | 7 | * @author Imanol Losada <[email protected]> |
8 | 8 | */ |
9 | -require_once __DIR__ . '/../inc/global.inc.php'; |
|
9 | +require_once __DIR__.'/../inc/global.inc.php'; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Get ids of COURSEMANAGERs that are inside a course right now |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | function getTeachersInCourseIds() |
16 | 16 | { |
17 | 17 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
18 | - $joinStatement = ' JOIN ' . Database::get_main_table(TABLE_MAIN_USER) . ' ON login_user_id = user_id'; |
|
18 | + $joinStatement = ' JOIN '.Database::get_main_table(TABLE_MAIN_USER).' ON login_user_id = user_id'; |
|
19 | 19 | return Database::select( |
20 | - 'login_user_id', $table . $joinStatement, |
|
20 | + 'login_user_id', $table.$joinStatement, |
|
21 | 21 | array( |
22 | 22 | 'where' => array( |
23 | 23 | 'c_id IS NOT NULL AND status = ?' => array( |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $dataBaseCurrentHour = array_shift($utcResult); |
45 | 45 | $maximumIdleTimeInCourse = date( |
46 | 46 | 'Y-m-d H:i:s', |
47 | - strtotime($dataBaseCurrentHour . ' ' . $timeLimit) |
|
47 | + strtotime($dataBaseCurrentHour.' '.$timeLimit) |
|
48 | 48 | ); |
49 | 49 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
50 | 50 | $onLineTrackTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | array( |
70 | 70 | 'logout_course_date' => date( |
71 | 71 | 'Y-m-d H:i:s', |
72 | - strtotime($currentTeacherData['logout_course_date'] . ' ' . $extraTime) |
|
72 | + strtotime($currentTeacherData['logout_course_date'].' '.$extraTime) |
|
73 | 73 | ) |
74 | 74 | ), |
75 | 75 | array( |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | $execute = isset($_GET['execute']) ? $_GET['execute'] : null; |
11 | 11 | $courseId = isset($_GET['c_id']) ? $_GET['c_id'] : null; |
12 | -$questionId = isset($_GET['question_id']) ? $_GET['question_id'] : null; |
|
12 | +$questionId = isset($_GET['question_id']) ? $_GET['question_id'] : null; |
|
13 | 13 | |
14 | 14 | $sql2 = "SELECT * FROM $table WHERE answer LIKE '%[%]%'"; |
15 | 15 |
@@ -20,12 +20,12 @@ |
||
20 | 20 | |
21 | 21 | // current section |
22 | 22 | $this_section = SECTION_DASHBOARD; |
23 | -unset($_SESSION['this_section']);//for hmtl editor repository |
|
23 | +unset($_SESSION['this_section']); //for hmtl editor repository |
|
24 | 24 | |
25 | 25 | // get actions |
26 | 26 | $actions = array('listing', 'store_user_block', 'disable_block'); |
27 | 27 | $action = 'listing'; |
28 | -if (isset($_GET['action']) && in_array($_GET['action'],$actions)) { |
|
28 | +if (isset($_GET['action']) && in_array($_GET['action'], $actions)) { |
|
29 | 29 | $action = $_GET['action']; |
30 | 30 | } |
31 | 31 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $actions = array('listing', 'store_user_block', 'disable_block'); |
27 | 27 | $action = 'listing'; |
28 | 28 | if (isset($_GET['action']) && in_array($_GET['action'],$actions)) { |
29 | - $action = $_GET['action']; |
|
29 | + $action = $_GET['action']; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | // load styles from dashboard plugins |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $dashboard_controller = new DashboardController(); |
38 | 38 | |
39 | 39 | if (isset($_GET['path'])) { |
40 | - $path = $_GET['path']; |
|
40 | + $path = $_GET['path']; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | // distpacher actions to controller |
@@ -14,23 +14,23 @@ discard block |
||
14 | 14 | $views = array('blocks', 'list'); |
15 | 15 | |
16 | 16 | if(isset($_GET['view']) && in_array($_GET['view'], $views)){ |
17 | - $dashboard_view = $_GET['view']; |
|
17 | + $dashboard_view = $_GET['view']; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | $link_blocks_view = $link_list_view = null; |
21 | 21 | |
22 | 22 | if (isset($dashboard_view) && $dashboard_view == 'list') { |
23 | - $link_blocks_view = '<a href="'.api_get_self().'?view=blocks">'. |
|
24 | - Display::return_icon('blocks.png',get_lang('DashboardBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
23 | + $link_blocks_view = '<a href="'.api_get_self().'?view=blocks">'. |
|
24 | + Display::return_icon('blocks.png',get_lang('DashboardBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
25 | 25 | } else { |
26 | - $link_list_view = '<a href="'.api_get_self().'?view=list">'. |
|
27 | - Display::return_icon('edit.png',get_lang('EditBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
26 | + $link_list_view = '<a href="'.api_get_self().'?view=list">'. |
|
27 | + Display::return_icon('edit.png',get_lang('EditBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $configuration_link = null; |
31 | 31 | if (api_is_platform_admin()) { |
32 | - $configuration_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">' |
|
33 | - .Display::return_icon('settings.png',get_lang('ConfigureDashboardPlugin'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
32 | + $configuration_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">' |
|
33 | + .Display::return_icon('settings.png',get_lang('ConfigureDashboardPlugin'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | echo '<div class="actions">'; |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | } else { |
90 | - // block dashboard list |
|
91 | - if (isset($success)) { |
|
92 | - Display::display_confirmation_message(get_lang('BlocksHaveBeenUpdatedSuccessfully')); |
|
93 | - } |
|
94 | - $user_id = api_get_user_id(); |
|
95 | - DashboardManager::display_user_dashboard_list($user_id); |
|
90 | + // block dashboard list |
|
91 | + if (isset($success)) { |
|
92 | + Display::display_confirmation_message(get_lang('BlocksHaveBeenUpdatedSuccessfully')); |
|
93 | + } |
|
94 | + $user_id = api_get_user_id(); |
|
95 | + DashboardManager::display_user_dashboard_list($user_id); |
|
96 | 96 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | // menu actions for dashboard views |
14 | 14 | $views = array('blocks', 'list'); |
15 | 15 | |
16 | -if(isset($_GET['view']) && in_array($_GET['view'], $views)){ |
|
16 | +if (isset($_GET['view']) && in_array($_GET['view'], $views)) { |
|
17 | 17 | $dashboard_view = $_GET['view']; |
18 | 18 | } |
19 | 19 | |
@@ -21,16 +21,16 @@ discard block |
||
21 | 21 | |
22 | 22 | if (isset($dashboard_view) && $dashboard_view == 'list') { |
23 | 23 | $link_blocks_view = '<a href="'.api_get_self().'?view=blocks">'. |
24 | - Display::return_icon('blocks.png',get_lang('DashboardBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
24 | + Display::return_icon('blocks.png', get_lang('DashboardBlocks'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
25 | 25 | } else { |
26 | 26 | $link_list_view = '<a href="'.api_get_self().'?view=list">'. |
27 | - Display::return_icon('edit.png',get_lang('EditBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
27 | + Display::return_icon('edit.png', get_lang('EditBlocks'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $configuration_link = null; |
31 | 31 | if (api_is_platform_admin()) { |
32 | 32 | $configuration_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">' |
33 | - .Display::return_icon('settings.png',get_lang('ConfigureDashboardPlugin'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
33 | + .Display::return_icon('settings.png', get_lang('ConfigureDashboardPlugin'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | echo '<div class="actions">'; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | if (count($columns) > 0) { |
57 | 57 | $columns_name = array_keys($columns); |
58 | 58 | // blocks for column 1 |
59 | - if (in_array('column_1',$columns_name)) { |
|
59 | + if (in_array('column_1', $columns_name)) { |
|
60 | 60 | echo '<div id="column1" class="col-md-6">'; |
61 | 61 | foreach ($columns['column_1'] as $content) { |
62 | 62 | echo $content; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | echo '</div>'; |
69 | 69 | } |
70 | 70 | // blocks for column 2 |
71 | - if (in_array('column_2',$columns_name)) { |
|
71 | + if (in_array('column_2', $columns_name)) { |
|
72 | 72 | // blocks for column 1 |
73 | 73 | echo '<div id="column2" class="col-md-6">'; |
74 | 74 | foreach ($columns['column_2'] as $content) { |