@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | require_once dirname(__FILE__).'/../../inc/global.inc.php'; |
16 | 16 | // check if this client has been called by php_cli (command line or cron) |
17 | -if (php_sapi_name()!='cli') { |
|
17 | +if (php_sapi_name() != 'cli') { |
|
18 | 18 | echo 'You can\'t call this service through a browser'; |
19 | 19 | die(); |
20 | 20 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | exit; //do not run from browser |
15 | 15 | } |
16 | 16 | |
17 | -require_once __DIR__ . "/../inc/global.inc.php"; |
|
17 | +require_once __DIR__."/../inc/global.inc.php"; |
|
18 | 18 | |
19 | 19 | // First day of the current month to create sessions and add courses for the next month (e.g. "07") |
20 | 20 | define("OFFSET", "15"); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | $startDate = $initialDate ? $initialDate : date("Y-m-01"); |
43 | 43 | $month = getQuarterFirstMonth(getQuarter(date('m', $startDate))); |
44 | - $startDate = substr($startDate, 0, 5) . $month . '-01'; |
|
44 | + $startDate = substr($startDate, 0, 5).$month.'-01'; |
|
45 | 45 | $nextQuarterStartDate = date('Y-m-d', api_strtotime($startDate.' + 3 month')); |
46 | 46 | $endDate = date('Y-m-d', api_strtotime($nextQuarterStartDate.' - 1 minute')); |
47 | 47 | return array('startDate' => $startDate, 'endDate' => $endDate); |
@@ -145,8 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | echo "\n"; |
147 | 147 | echo $courses ? |
148 | - "Creating sessions and adding courses for the period between ".$startDate." and ".$endDate : |
|
149 | - "Every course is already in session for the period between ".$startDate." and ".$endDate; |
|
148 | + "Creating sessions and adding courses for the period between ".$startDate." and ".$endDate : "Every course is already in session for the period between ".$startDate." and ".$endDate; |
|
150 | 149 | echo "\n=====================================================================================\n\n"; |
151 | 150 | // Loop through courses creating one session per each and adding them |
152 | 151 | foreach ($courses as $course) { |
@@ -155,8 +154,8 @@ discard block |
||
155 | 154 | $year = date("Y", api_strtotime($startDate)); |
156 | 155 | $quarter = getQuarter($month); |
157 | 156 | $quarter = getQuarterRoman($quarter); |
158 | - $period = $year . '-' . $quarter; |
|
159 | - $sessionName = '[' . $period . '] ' . $course['title']; |
|
157 | + $period = $year.'-'.$quarter; |
|
158 | + $sessionName = '['.$period.'] '.$course['title']; |
|
160 | 159 | $sessionId = SessionManager::create_session( |
161 | 160 | $sessionName, |
162 | 161 | $startDate, |
@@ -175,7 +174,7 @@ discard block |
||
175 | 174 | } |
176 | 175 | |
177 | 176 | // Starts the script |
178 | -echo "Starting process..." . PHP_EOL; |
|
177 | +echo "Starting process...".PHP_EOL; |
|
179 | 178 | // Get first active administrator |
180 | 179 | $administrators = array_reverse(UserManager::get_all_administrators()); |
181 | 180 | $lastingAdministrators = count($administrators); |
@@ -196,7 +195,7 @@ discard block |
||
196 | 195 | |
197 | 196 | // Creates course sessions for the following month |
198 | 197 | $offsetDay = intval(substr($dates['endDate'], 8, 2)) - OFFSET; |
199 | -if (date("Y-m-d") >= date(substr($dates['endDate'], 0, 8) . $offsetDay)) { |
|
198 | +if (date("Y-m-d") >= date(substr($dates['endDate'], 0, 8).$offsetDay)) { |
|
200 | 199 | $dates = getQuarterFirstAndLastDates(date("Y-m-d", api_strtotime(date("Y-m-01")." + 3 month"))); |
201 | 200 | // Get courses that don't have any session the next month |
202 | 201 | $courses = CourseManager::getCoursesWithoutSession($dates['startDate'], $dates['endDate']); |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * Display |
34 | 34 | */ |
35 | -if (count($list)==0) { echo 'No terms loaded so far'; } |
|
36 | -if (count($list)>0) { |
|
35 | +if (count($list) == 0) { echo 'No terms loaded so far'; } |
|
36 | +if (count($list) > 0) { |
|
37 | 37 | $i = 1; |
38 | 38 | $j = 1; |
39 | 39 | $k = 0; |
40 | 40 | $files = array(); |
41 | 41 | $trans = array(); |
42 | 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) { |
|
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) { |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | $trans[$fixed_elem['term_name']] = $translation; |
58 | 58 | $j++; |
59 | 59 | } |
60 | - echo '<tr><td>',$i, |
|
61 | - '</td><td>',$fixed_elem['id'], |
|
62 | - '</td><td>',$fixed_elem['term_name']; |
|
60 | + echo '<tr><td>', $i, |
|
61 | + '</td><td>', $fixed_elem['id'], |
|
62 | + '</td><td>', $fixed_elem['term_name']; |
|
63 | 63 | if ($output) { |
64 | 64 | echo '</td><td>'.$variables_origin[$fixed_elem['term_name']]; |
65 | 65 | } |
66 | - echo '</td><td>',$fixed_elem['term_count'],'</td></tr>'; |
|
66 | + echo '</td><td>', $fixed_elem['term_count'], '</td></tr>'; |
|
67 | 67 | $i++; |
68 | 68 | } |
69 | 69 | echo '</table>'; |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | @mkdir('/tmp/lang'); |
72 | 72 | foreach ($files as $file => $terms) { |
73 | 73 | @touch('/tmp/lang/'.$file); |
74 | - file_put_contents('/tmp/lang/'.$file,"<?php".PHP_EOL); |
|
74 | + file_put_contents('/tmp/lang/'.$file, "<?php".PHP_EOL); |
|
75 | 75 | foreach ($terms as $term) { |
76 | - file_put_contents('/tmp/lang/'.$file,'$'.$term.' = "'.str_replace('"','\"',$trans[$term]).'";'.PHP_EOL, FILE_APPEND); |
|
76 | + file_put_contents('/tmp/lang/'.$file, '$'.$term.' = "'.str_replace('"', '\"', $trans[$term]).'";'.PHP_EOL, FILE_APPEND); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | } |
@@ -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 | foreach ($list as $entry) { |
19 | 19 | $file = $path.'/'.$entry; |
20 | 20 | if (is_file($file)) { |
21 | - $terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true)); |
|
21 | + $terms = array_merge($terms, SubLanguageManager::get_all_language_variable_in_file($file, true)); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | // get only the array keys (the language variables defined in language files) |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | $files = get_all_php_files(api_get_path(SYS_PATH)); |
32 | 32 | foreach ($files as $file) { |
33 | 33 | //echo 'Analyzing '.$file."<br />"; |
34 | - $shortfile = substr($file,$l); |
|
34 | + $shortfile = substr($file, $l); |
|
35 | 35 | $lines = file($file); |
36 | 36 | foreach ($lines as $line) { |
37 | 37 | $myterms = array(); |
38 | - $res = preg_match_all('/get_lang\(\'(\\w*)\'\)/',$line,$myterms); |
|
38 | + $res = preg_match_all('/get_lang\(\'(\\w*)\'\)/', $line, $myterms); |
|
39 | 39 | if ($res > 0) { |
40 | - foreach($myterms[1] as $term) { |
|
40 | + foreach ($myterms[1] as $term) { |
|
41 | 41 | if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) { |
42 | 42 | $undefined_terms[$term] = $shortfile; |
43 | 43 | //echo "Undefined: $term<br />"; |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | } |
46 | 46 | } |
47 | 47 | $res = 0; |
48 | - $res = preg_match_all('/\{[\'"](\\w*)[\'"]\|get_lang\}/',$line,$myterms); |
|
48 | + $res = preg_match_all('/\{[\'"](\\w*)[\'"]\|get_lang\}/', $line, $myterms); |
|
49 | 49 | if ($res > 0) { |
50 | - foreach($myterms[1] as $term) { |
|
50 | + foreach ($myterms[1] as $term) { |
|
51 | 51 | if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) { |
52 | 52 | $undefined_terms[$term] = $shortfile; |
53 | 53 | //echo "Undefined: $term<br />"; |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | flush(); |
59 | 59 | } |
60 | 60 | //$undefined_terms = array_flip($undefined_terms); |
61 | -if (count($undefined_terms)<1) { die("No missing terms<br />\n"); } else { echo "The following terms were nowhere to be found: <br />\n<table>"; } |
|
61 | +if (count($undefined_terms) < 1) { die("No missing terms<br />\n"); } else { echo "The following terms were nowhere to be found: <br />\n<table>"; } |
|
62 | 62 | foreach ($undefined_terms as $term => $file) { |
63 | 63 | echo "<tr><td>$term</td><td>in $file"; |
64 | - if (substr($file,0,7)=='plugin/') { |
|
64 | + if (substr($file, 0, 7) == 'plugin/') { |
|
65 | 65 | echo " <span style=\"color: #00ff00;\">(this one should be taken care of by the plugin's language files)</span>"; |
66 | 66 | } |
67 | 67 | echo "</td></tr>\n"; |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | $list = scandir($base_path); |
74 | 74 | $files = array(); |
75 | 75 | foreach ($list as $item) { |
76 | - if (substr($item,0,1)=='.') {continue;} |
|
77 | - $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)); |
|
78 | - if (in_array($base_path.$item.'/',$special_dirs)) {continue;} |
|
76 | + if (substr($item, 0, 1) == '.') {continue; } |
|
77 | + $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)); |
|
78 | + if (in_array($base_path.$item.'/', $special_dirs)) {continue; } |
|
79 | 79 | if (is_dir($base_path.$item)) { |
80 | - $files = array_merge($files,get_all_php_files($base_path.$item.'/')); |
|
80 | + $files = array_merge($files, get_all_php_files($base_path.$item.'/')); |
|
81 | 81 | } else { |
82 | 82 | //only analyse php files |
83 | - $sub = substr($item,-4); |
|
83 | + $sub = substr($item, -4); |
|
84 | 84 | if ($sub == '.php' or $sub == '.tpl') { |
85 | 85 | $files[] = $base_path.$item; |
86 | 86 | } |
@@ -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 | } |
@@ -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 "#"; |
@@ -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 | } |
@@ -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( |