@@ -49,7 +49,7 @@ |
||
49 | 49 | // Create the directory |
50 | 50 | $result = $this->generate_lp_folder($_course, $this->file_name); |
51 | 51 | |
52 | - // Create the directory |
|
52 | + // Create the directory |
|
53 | 53 | $this->base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
54 | 54 | ///learning_path/ppt_dirname directory |
55 | 55 | $this->created_dir = substr($result['dir'], 0, strlen($result['dir']) -1); |
@@ -310,7 +310,7 @@ |
||
310 | 310 | $myname = api_utf8_decode($myname); |
311 | 311 | |
312 | 312 | $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib,display_order, session_id, use_max_score)" . |
313 | - "VALUES ($courseId , 2,'".$myname."', '".$oOrganization->get_ref()."','','".$this->subdir."', 0, 'embedded', '".$this->manifest_encoding."', 'scorm_api.php', $dsp, $sessionId, $userMaxScore)"; |
|
313 | + "VALUES ($courseId , 2,'".$myname."', '".$oOrganization->get_ref()."','','".$this->subdir."', 0, 'embedded', '".$this->manifest_encoding."', 'scorm_api.php', $dsp, $sessionId, $userMaxScore)"; |
|
314 | 314 | if ($this->debug > 1) { error_log('New LP - In import_manifest(), inserting path: '. $sql, 0); } |
315 | 315 | |
316 | 316 | Database::query($sql); |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Automatic cleanup procedure. Cleans the archive directory of anything |
|
4 | - * older than 7 days |
|
5 | - * @package chamilo.cron |
|
6 | - * @author Yannick Warnier <[email protected]> |
|
7 | - */ |
|
3 | + * Automatic cleanup procedure. Cleans the archive directory of anything |
|
4 | + * older than 7 days |
|
5 | + * @package chamilo.cron |
|
6 | + * @author Yannick Warnier <[email protected]> |
|
7 | + */ |
|
8 | 8 | /** |
9 | - * Initialization |
|
10 | - */ |
|
9 | + * Initialization |
|
10 | + */ |
|
11 | 11 | if (php_sapi_name() != 'cli') { |
12 | 12 | exit; //do not run from browser |
13 | 13 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Course expiration reminder. |
|
5 | - * @package chamilo.cron |
|
6 | - * @author Imanol Losada <[email protected]> |
|
7 | - */ |
|
4 | + * Course expiration reminder. |
|
5 | + * @package chamilo.cron |
|
6 | + * @author Imanol Losada <[email protected]> |
|
7 | + */ |
|
8 | 8 | require_once __DIR__ . '/../inc/global.inc.php'; |
9 | 9 | |
10 | 10 | /** |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Script to find a document with a specific title or path in all courses |
|
4 | - */ |
|
3 | + * Script to find a document with a specific title or path in all courses |
|
4 | + */ |
|
5 | 5 | /** |
6 | - * Code init - comment die() call to enable |
|
7 | - */ |
|
6 | + * Code init - comment die() call to enable |
|
7 | + */ |
|
8 | 8 | die(); |
9 | 9 | require '../../inc/global.inc.php'; |
10 | 10 | if (empty($_GET['doc'])) { |
11 | - echo "To add a document name to search, add ?doc=abc to the URL"; |
|
11 | + echo "To add a document name to search, add ?doc=abc to the URL"; |
|
12 | 12 | } else { |
13 | - echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />"; |
|
13 | + echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />"; |
|
14 | 14 | } |
15 | 15 | $courses_list = CourseManager::get_courses_list(); |
16 | 16 | foreach ($courses_list as $course) { |
17 | - $title = Database::escape_string($_GET['doc']); |
|
18 | - $td = Database::get_course_table(TABLE_DOCUMENT); |
|
19 | - $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'"; |
|
20 | - $res = Database::query($sql); |
|
21 | - if (Database::num_rows($res)>0) { |
|
17 | + $title = Database::escape_string($_GET['doc']); |
|
18 | + $td = Database::get_course_table(TABLE_DOCUMENT); |
|
19 | + $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'"; |
|
20 | + $res = Database::query($sql); |
|
21 | + if (Database::num_rows($res)>0) { |
|
22 | 22 | while ($row = Database::fetch_array($res)) { |
23 | - echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />"; |
|
23 | + echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />"; |
|
24 | + } |
|
24 | 25 | } |
25 | - } |
|
26 | 26 | } |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This script gets users details of a given list of users |
|
4 | - * (given by e-mail) and prints the details in /tmp/list.txt |
|
5 | - * To enable script, prefix the first die(); with // |
|
6 | - * @package chamilo.cron.user_import |
|
7 | - */ |
|
3 | + * This script gets users details of a given list of users |
|
4 | + * (given by e-mail) and prints the details in /tmp/list.txt |
|
5 | + * To enable script, prefix the first die(); with // |
|
6 | + * @package chamilo.cron.user_import |
|
7 | + */ |
|
8 | 8 | /** |
9 | - * Initialization |
|
10 | - */ |
|
9 | + * Initialization |
|
10 | + */ |
|
11 | 11 | /* Example of input file: |
12 | 12 | [email protected] |
13 | 13 | [email protected] |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | $users = Database::get_main_table(TABLE_MAIN_USER); |
21 | 21 | $string=''; |
22 | 22 | foreach ($list as $mail) { |
23 | - $mail = trim($mail); |
|
24 | - $sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n"; |
|
25 | - $res = Database::query($sql); |
|
26 | - if ($res === false) { die(mysql_error());} |
|
27 | - if (Database::num_rows($res) == 0) { |
|
23 | + $mail = trim($mail); |
|
24 | + $sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n"; |
|
25 | + $res = Database::query($sql); |
|
26 | + if ($res === false) { die(mysql_error());} |
|
27 | + if (Database::num_rows($res) == 0) { |
|
28 | 28 | $string .= 'No encontrado;'.$row['email']; |
29 | - } else { |
|
29 | + } else { |
|
30 | 30 | $row = Database::fetch_assoc($res); |
31 | - $string .= $row['user_id'].';'.$row['email'].';'.$row['firstname'].';'.$row['lastname'].';'.$row['official_code']."\r\n"; |
|
32 | - } |
|
31 | + $string .= $row['user_id'].';'.$row['email'].';'.$row['firstname'].';'.$row['lastname'].';'.$row['official_code']."\r\n"; |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | echo $string; |
35 | 35 | file_put_contents('/tmp/list.txt',$string); |
@@ -1,25 +1,25 @@ discard block |
||
1 | 1 | <?php /* For licensing terms, see /license.txt */ |
2 | 2 | /** |
3 | - * Cron script to list used, but undefined, language variables |
|
4 | - * @package chamilo.cron |
|
5 | - */ |
|
3 | + * Cron script to list used, but undefined, language variables |
|
4 | + * @package chamilo.cron |
|
5 | + */ |
|
6 | 6 | /** |
7 | - * Includes and declarations |
|
8 | - */ |
|
7 | + * Includes and declarations |
|
8 | + */ |
|
9 | 9 | die(); |
10 | 10 | require_once '../../inc/global.inc.php'; |
11 | 11 | $path = api_get_path(SYS_LANG_PATH).'english'; |
12 | 12 | ini_set('memory_limit','128M'); |
13 | 13 | /** |
14 | - * Main code |
|
15 | - */ |
|
14 | + * Main code |
|
15 | + */ |
|
16 | 16 | $terms = array(); |
17 | 17 | $list = SubLanguageManager::get_lang_folder_files_list($path); |
18 | 18 | foreach ($list as $entry) { |
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; |
@@ -1,41 +1,41 @@ |
||
1 | 1 | <?php /* For licensing terms, see /license.txt */ |
2 | 2 | /** |
3 | - * Cron script to list unused, but defined, language variables |
|
4 | - * @package chamilo.cron.lang |
|
5 | - */ |
|
3 | + * Cron script to list unused, but defined, language variables |
|
4 | + * @package chamilo.cron.lang |
|
5 | + */ |
|
6 | 6 | /** |
7 | - * Includes and declarations |
|
8 | - */ |
|
7 | + * Includes and declarations |
|
8 | + */ |
|
9 | 9 | //die(); |
10 | 10 | require_once '../../inc/global.inc.php'; |
11 | 11 | $path = api_get_path(SYS_LANG_PATH).'english'; |
12 | 12 | ini_set('memory_limit','128M'); |
13 | 13 | /** |
14 | - * Main code |
|
15 | - */ |
|
14 | + * Main code |
|
15 | + */ |
|
16 | 16 | $terms = array(); |
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"; |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * This script generates a directory based on the English language variables |
|
5 | - * but only composed of the 10,000 (can be configured) most frequent words |
|
6 | - * used in Chamilo. This implies first using the langstats.php script, which |
|
7 | - * in turn implies configuring an additional variable in configuration.php |
|
8 | - * (see langstats.php for more info). |
|
9 | - * When running the language_builder, please make sure this parameter is |
|
10 | - * set to 0 in the configuration.php file, otherwise it will take *ages*. |
|
11 | - */ |
|
4 | + * This script generates a directory based on the English language variables |
|
5 | + * but only composed of the 10,000 (can be configured) most frequent words |
|
6 | + * used in Chamilo. This implies first using the langstats.php script, which |
|
7 | + * in turn implies configuring an additional variable in configuration.php |
|
8 | + * (see langstats.php for more info). |
|
9 | + * When running the language_builder, please make sure this parameter is |
|
10 | + * set to 0 in the configuration.php file, otherwise it will take *ages*. |
|
11 | + */ |
|
12 | 12 | /** |
13 | - * Requires |
|
14 | - */ |
|
13 | + * Requires |
|
14 | + */ |
|
15 | 15 | require_once '../../inc/global.inc.php'; |
16 | 16 | require_once 'langstats.class.php'; |
17 | 17 | global $_configuration; |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | $langstats = new langstats(); |
20 | 20 | $orig_lang = 'english'; |
21 | 21 | /** |
22 | - * Init |
|
23 | - */ |
|
22 | + * Init |
|
23 | + */ |
|
24 | 24 | $words_limit = 10000; //change this if you want more words |
25 | 25 | $terms_limit = 3000; //change this if you think you'll need more terms |
26 | 26 | $terms = $langstats->get_popular_terms($terms_limit); |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | $lang_dir = api_get_path(SYS_LANG_PATH); |
31 | 31 | $arch_dir = api_get_path(SYS_ARCHIVE_PATH); |
32 | 32 | /** |
33 | - * Code run |
|
34 | - */ |
|
33 | + * Code run |
|
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,41 +59,41 @@ 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 />"; |
94 | 94 | /** |
95 | - * Display results |
|
96 | - */ |
|
95 | + * Display results |
|
96 | + */ |
|
97 | 97 | |
98 | 98 | echo "Difference between filtered and found in English:<br />"; |
99 | 99 | //print_r($terms_found); |