@@ -69,7 +69,8 @@ |
||
| 69 | 69 | echo "</table>\n"; |
| 70 | 70 | |
| 71 | 71 | |
| 72 | -function get_all_php_files($base_path) { |
|
| 72 | +function get_all_php_files($base_path) |
|
| 73 | +{ |
|
| 73 | 74 | $list = scandir($base_path); |
| 74 | 75 | $files = array(); |
| 75 | 76 | foreach ($list as $item) { |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $file = $path.'/'.$entry; |
| 20 | 20 | if (is_file($file)) { |
| 21 | 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) |
| 25 | 25 | $defined_terms = array_flip(array_keys($terms)); |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | foreach ($files as $file) { |
| 33 | 33 | //echo 'Analyzing '.$file."<br />"; |
| 34 | 34 | $shortfile = substr($file, $l); |
| 35 | - $lines = file($file); |
|
| 35 | + $lines = file($file); |
|
| 36 | 36 | foreach ($lines as $line) { |
| 37 | - $myterms = array(); |
|
| 37 | + $myterms = array(); |
|
| 38 | 38 | $res = preg_match_all('/get_lang\(\'(\\w*)\'\)/', $line, $myterms); |
| 39 | 39 | if ($res > 0) { |
| 40 | 40 | foreach ($myterms[1] as $term) { |
| 41 | 41 | if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) { |
| 42 | - $undefined_terms[$term] = $shortfile; |
|
| 42 | + $undefined_terms[$term] = $shortfile; |
|
| 43 | 43 | //echo "Undefined: $term<br />"; |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | if ($res > 0) { |
| 50 | 50 | foreach ($myterms[1] as $term) { |
| 51 | 51 | if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) { |
| 52 | - $undefined_terms[$term] = $shortfile; |
|
| 52 | + $undefined_terms[$term] = $shortfile; |
|
| 53 | 53 | //echo "Undefined: $term<br />"; |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -73,17 +73,17 @@ 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; } |
|
| 76 | + if (substr($item, 0, 1) == '.') {continue; } |
|
| 77 | 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 | 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 | 83 | $sub = substr($item, -4); |
| 84 | - if ($sub == '.php' or $sub == '.tpl') { |
|
| 84 | + if ($sub == '.php' or $sub == '.tpl') { |
|
| 85 | 85 | $files[] = $base_path.$item; |
| 86 | - } |
|
| 86 | + } |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | $list = null; |
@@ -67,7 +67,8 @@ |
||
| 67 | 67 | return false; //cannot use if sqlite not installed |
| 68 | 68 | } |
| 69 | 69 | $err = Database::query('SELECT * FROM lang_freq'); |
| 70 | - if ($err === false) { //the database probably does not exist, create it |
|
| 70 | + if ($err === false) { |
|
| 71 | +//the database probably does not exist, create it |
|
| 71 | 72 | $err = Database::query( |
| 72 | 73 | 'CREATE TABLE lang_freq (' |
| 73 | 74 | . ' id int PRIMARY KEY AUTO_INCREMENT, ' |
@@ -2021,7 +2021,7 @@ discard block |
||
| 2021 | 2021 | ); |
| 2022 | 2022 | |
| 2023 | 2023 | $this->logger->addInfo( |
| 2024 | - "User $userId added to course ".$courseInfo['code']." with status '$status' with course category: '$userCourseCategory'" |
|
| 2024 | + "user $userId added to course ".$courseInfo['code']." with status '$status' with course category: '$userCourseCategory'" |
|
| 2025 | 2025 | ); |
| 2026 | 2026 | } |
| 2027 | 2027 | } |
@@ -2230,7 +2230,7 @@ discard block |
||
| 2230 | 2230 | ); |
| 2231 | 2231 | |
| 2232 | 2232 | foreach ($truncateTables as $table) { |
| 2233 | - $sql = "TRUNCATE $table"; |
|
| 2233 | + $sql = "truncate $table"; |
|
| 2234 | 2234 | Database::query($sql); |
| 2235 | 2235 | echo $sql.PHP_EOL; |
| 2236 | 2236 | } |
@@ -2240,7 +2240,7 @@ |
||
| 2240 | 2240 | * @param bool $moveFile |
| 2241 | 2241 | * @param array $teacherBackup |
| 2242 | 2242 | * @param array $groupBackup |
| 2243 | - * @return bool |
|
| 2243 | + * @return false|null |
|
| 2244 | 2244 | */ |
| 2245 | 2245 | private function importCareers( |
| 2246 | 2246 | $file, |
@@ -2267,7 +2267,7 @@ |
||
| 2267 | 2267 | |
| 2268 | 2268 | foreach ($data as $row) { |
| 2269 | 2269 | foreach ($row as $key => $value) { |
| 2270 | - $key = (string)trim($key); |
|
| 2270 | + $key = (string) trim($key); |
|
| 2271 | 2271 | // Remove utf8 bom |
| 2272 | 2272 | $key = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $key); |
| 2273 | 2273 | $row[$key] = $value; |
@@ -11,7 +11,8 @@ |
||
| 11 | 11 | /** |
| 12 | 12 | * Small function to list files in archive/ |
| 13 | 13 | */ |
| 14 | -function get_zip_files_in_garbage() { |
|
| 14 | +function get_zip_files_in_garbage() |
|
| 15 | +{ |
|
| 15 | 16 | $list = array(); |
| 16 | 17 | $dh = opendir(api_get_path(SYS_ARCHIVE_PATH)); |
| 17 | 18 | if ($dh === false) { |
@@ -69,7 +69,8 @@ |
||
| 69 | 69 | echo "</table>\n"; |
| 70 | 70 | |
| 71 | 71 | |
| 72 | -function get_all_php_files($base_path) { |
|
| 72 | +function get_all_php_files($base_path) |
|
| 73 | +{ |
|
| 73 | 74 | $list = scandir($base_path); |
| 74 | 75 | $files = array(); |
| 75 | 76 | foreach ($list as $item) { |
@@ -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; |
@@ -24,16 +24,16 @@ |
||
| 24 | 24 | $lang_match = $chamilo_langs[get_preferred_language($available_langs)]; |
| 25 | 25 | // recover previous value ... |
| 26 | 26 | if (isset($_SESSION['user_language_choice'])) { |
| 27 | - $lang_match = $_SESSION['user_language_choice']; |
|
| 27 | + $lang_match = $_SESSION['user_language_choice']; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // Chamilo parameter, on logout |
| 31 | 31 | if (isset($_REQUEST['language']) && !empty($_REQUEST['language']) && in_array($_REQUEST['language'], $chamilo_langs)) { |
| 32 | - $lang_match = $_REQUEST['language']; |
|
| 32 | + $lang_match = $_REQUEST['language']; |
|
| 33 | 33 | } |
| 34 | 34 | // Incoming link parameter |
| 35 | 35 | if (isset($_REQUEST['lang']) && !empty($_REQUEST['lang']) && in_array($_REQUEST['lang'], $available_langs)) { |
| 36 | - $lang_match = $chamilo_langs[$_REQUEST['lang']]; |
|
| 36 | + $lang_match = $chamilo_langs[$_REQUEST['lang']]; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $detect = api_get_setting('auto_detect_language_custom_pages'); |
@@ -87,7 +87,8 @@ |
||
| 87 | 87 | // generate the data to display |
| 88 | 88 | $sortable_data = array(); |
| 89 | 89 | foreach ($data_array as $data) { |
| 90 | - if ($data[2] != "") {//filter by course removed |
|
| 90 | + if ($data[2] != "") { |
|
| 91 | +//filter by course removed |
|
| 91 | 92 | $row = array(); |
| 92 | 93 | $row[] = $this->build_type_column($data[0]); |
| 93 | 94 | $row[] = $this->build_name_link($data[0]); |
@@ -267,7 +267,7 @@ |
||
| 267 | 267 | break; |
| 268 | 268 | case RESULT_DISABLE_SHOW_SCORE_ONLY: |
| 269 | 269 | if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_END) { |
| 270 | - $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score')); |
|
| 270 | + $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score')); |
|
| 271 | 271 | } else { |
| 272 | 272 | $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'), get_lang('Details')); |
| 273 | 273 | } |
@@ -150,7 +150,8 @@ |
||
| 150 | 150 | /** |
| 151 | 151 | * Actions in the list: edit, accept, delete, request additional information. |
| 152 | 152 | */ |
| 153 | -function modify_filter($id) { |
|
| 153 | +function modify_filter($id) |
|
| 154 | +{ |
|
| 154 | 155 | $code = CourseRequestManager::get_course_request_code($id); |
| 155 | 156 | $result = '<a href="course_request_edit.php?id='.$id.'&caller=2">'.Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'. |
| 156 | 157 | ' <a href="?accept_course_request='.$id.'">'.Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;')).'</a>'; |