@@ -237,10 +237,10 @@ |
||
237 | 237 | * @param int Internal ID used in specific tool table |
238 | 238 | */ |
239 | 239 | function delete_all_values_for_item($course_id, $tool_id, $ref_id) { |
240 | - $table_sf_values = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); |
|
241 | - $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s'; |
|
242 | - $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id); |
|
243 | - Database::query($sql); |
|
240 | + $table_sf_values = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); |
|
241 | + $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s'; |
|
242 | + $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id); |
|
243 | + Database::query($sql); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -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 | } |
@@ -11,18 +11,18 @@ |
||
11 | 11 | |
12 | 12 | class action_plugin_jcapture extends DokuWiki_Action_Plugin { |
13 | 13 | |
14 | - /** |
|
15 | - * return some info |
|
16 | - */ |
|
17 | - function getInfo() { |
|
14 | + /** |
|
15 | + * return some info |
|
16 | + */ |
|
17 | + function getInfo() { |
|
18 | 18 | return array( |
19 | - 'author' => 'Pavel Vlasov', |
|
20 | - 'email' => '[email protected]', |
|
21 | - 'name' => 'JCapture', |
|
22 | - 'desc' => 'Plugin for making screen captures.', |
|
23 | - 'url' => 'http://www.nasdanika.com/wiki/doku.php?id=products:jcapture:start', |
|
24 | - ); |
|
25 | - } |
|
19 | + 'author' => 'Pavel Vlasov', |
|
20 | + 'email' => '[email protected]', |
|
21 | + 'name' => 'JCapture', |
|
22 | + 'desc' => 'Plugin for making screen captures.', |
|
23 | + 'url' => 'http://www.nasdanika.com/wiki/doku.php?id=products:jcapture:start', |
|
24 | + ); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Register the eventhandlers |
@@ -7,15 +7,15 @@ |
||
7 | 7 | * Initialization |
8 | 8 | */ |
9 | 9 | $convert_lang_to_code = array( |
10 | - "english" => "en_US", |
|
11 | - "french" => "fr_BE", |
|
12 | - "dutch" => "nl_NL", |
|
13 | - "german" => "de_DE", |
|
14 | - "japanese" => "ja_JP", |
|
15 | - "danish" => "da_DK", |
|
10 | + "english" => "en_US", |
|
11 | + "french" => "fr_BE", |
|
12 | + "dutch" => "nl_NL", |
|
13 | + "german" => "de_DE", |
|
14 | + "japanese" => "ja_JP", |
|
15 | + "danish" => "da_DK", |
|
16 | 16 | ); |
17 | 17 | if (!empty($_SESSION['user_language_choice']) && !empty($convert_lang_to_code[$_SESSION['user_language_choice']])) { |
18 | - $code = $convert_lang_to_code[$_SESSION['user_language_choice']]; |
|
19 | - $locale = setlocale(LC_TIME, $code); |
|
18 | + $code = $convert_lang_to_code[$_SESSION['user_language_choice']]; |
|
19 | + $locale = setlocale(LC_TIME, $code); |
|
20 | 20 | } |
21 | 21 | $date = strftime('%c'); |
@@ -27,10 +27,10 @@ |
||
27 | 27 | */ |
28 | 28 | function validate($value, $options = null) |
29 | 29 | { |
30 | - if (is_array($value)) |
|
31 | - { |
|
32 | - $value = implode(null, $value); |
|
33 | - } |
|
30 | + if (is_array($value)) |
|
31 | + { |
|
32 | + $value = implode(null, $value); |
|
33 | + } |
|
34 | 34 | if ((string) $value == '') { |
35 | 35 | return false; |
36 | 36 | } |
@@ -6,42 +6,42 @@ |
||
6 | 6 | * @deprecated Don't use this class |
7 | 7 | */ |
8 | 8 | class Rights { |
9 | - private static $rights_cache = array(); |
|
10 | - private static $rights = array( |
|
11 | - 'show_tabs:reports' => |
|
12 | - array( |
|
13 | - 'type' => 'const', |
|
14 | - 'const' => 'true' ) |
|
15 | - ); |
|
9 | + private static $rights_cache = array(); |
|
10 | + private static $rights = array( |
|
11 | + 'show_tabs:reports' => |
|
12 | + array( |
|
13 | + 'type' => 'const', |
|
14 | + 'const' => 'true' ) |
|
15 | + ); |
|
16 | 16 | |
17 | - // warning the goal of this function is to enforce rights managment in Chamilo |
|
18 | - // thus default return value is always true |
|
19 | - public static function hasRight($handler) { |
|
20 | - if (array_key_exists($handler, self::$rights_cache)) |
|
21 | - return self::$rights_cache[$handler]; |
|
17 | + // warning the goal of this function is to enforce rights managment in Chamilo |
|
18 | + // thus default return value is always true |
|
19 | + public static function hasRight($handler) { |
|
20 | + if (array_key_exists($handler, self::$rights_cache)) |
|
21 | + return self::$rights_cache[$handler]; |
|
22 | 22 | |
23 | - if (!array_key_exists($handler, self::$rights)) |
|
24 | - return true; // handler does not exists |
|
23 | + if (!array_key_exists($handler, self::$rights)) |
|
24 | + return true; // handler does not exists |
|
25 | 25 | |
26 | - if (self::$rights[$handler]['type'] == 'sql') { |
|
27 | - $result = Database::query(self::$rights[$handler]['sql']); |
|
28 | - if (Database::num_rows($result) > 0) |
|
29 | - $result = true; |
|
30 | - else |
|
31 | - $result = false; |
|
32 | - } else if (self::$rights[$handler]['type'] == 'const') |
|
33 | - $result = self::$rights[$handler]['const']; |
|
34 | - else if (self::$rights[$handler]['type'] == 'func') |
|
35 | - $result = self::$rights[$handler]['func'](); |
|
36 | - else // handler type not implemented |
|
37 | - return true; |
|
38 | - self::$rights_cache[$handler] = $result; |
|
39 | - return $result; |
|
40 | - } |
|
26 | + if (self::$rights[$handler]['type'] == 'sql') { |
|
27 | + $result = Database::query(self::$rights[$handler]['sql']); |
|
28 | + if (Database::num_rows($result) > 0) |
|
29 | + $result = true; |
|
30 | + else |
|
31 | + $result = false; |
|
32 | + } else if (self::$rights[$handler]['type'] == 'const') |
|
33 | + $result = self::$rights[$handler]['const']; |
|
34 | + else if (self::$rights[$handler]['type'] == 'func') |
|
35 | + $result = self::$rights[$handler]['func'](); |
|
36 | + else // handler type not implemented |
|
37 | + return true; |
|
38 | + self::$rights_cache[$handler] = $result; |
|
39 | + return $result; |
|
40 | + } |
|
41 | 41 | |
42 | - public static function hasRightClosePageWithError($handler) { |
|
43 | - if (hasRight($handler) == false) |
|
44 | - die("You are not allowed here"); //FIXME |
|
45 | - } |
|
42 | + public static function hasRightClosePageWithError($handler) { |
|
43 | + if (hasRight($handler) == false) |
|
44 | + die("You are not allowed here"); //FIXME |
|
45 | + } |
|
46 | 46 | |
47 | 47 | } |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Export tabular data to XML-file |
|
119 | - * @param array Simple array of data to put in XML |
|
120 | - * @param string Name of file to be given to the user |
|
121 | - * @param string Name of common tag to place each line in |
|
122 | - * @param string Name of the root element. A root element should always be given. |
|
123 | - * @param string Encoding in which the data is provided |
|
124 | - */ |
|
118 | + * Export tabular data to XML-file |
|
119 | + * @param array Simple array of data to put in XML |
|
120 | + * @param string Name of file to be given to the user |
|
121 | + * @param string Name of common tag to place each line in |
|
122 | + * @param string Name of the root element. A root element should always be given. |
|
123 | + * @param string Encoding in which the data is provided |
|
124 | + */ |
|
125 | 125 | public static function arrayToXml( |
126 | 126 | $data, |
127 | 127 | $filename = 'export', |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | foreach ($data as $row) { |
201 | 201 | $string .= "\n".str_repeat("\t", $level).'<'.$row['name'].'>'; |
202 | 202 | if (is_array($row['value'])) { |
203 | - $string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n"; |
|
203 | + $string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n"; |
|
204 | 204 | $string .= str_repeat("\t", $level).'</'.$row['name'].'>'; |
205 | 205 | } else { |
206 | 206 | $string .= $row['value']; |
@@ -108,24 +108,24 @@ |
||
108 | 108 | */ |
109 | 109 | function utf8_sort($array) |
110 | 110 | { |
111 | - $old_locale = setlocale(LC_ALL, null); |
|
112 | - $code = api_get_language_isocode(); |
|
113 | - $locale_list = array($code.'.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8'); |
|
114 | - $try_sort = false; |
|
111 | + $old_locale = setlocale(LC_ALL, null); |
|
112 | + $code = api_get_language_isocode(); |
|
113 | + $locale_list = array($code.'.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8'); |
|
114 | + $try_sort = false; |
|
115 | 115 | |
116 | - foreach ($locale_list as $locale) { |
|
117 | - $my_local = setlocale(LC_COLLATE, $locale); |
|
118 | - if ($my_local) { |
|
119 | - $try_sort = true; |
|
120 | - break; |
|
121 | - } |
|
122 | - } |
|
116 | + foreach ($locale_list as $locale) { |
|
117 | + $my_local = setlocale(LC_COLLATE, $locale); |
|
118 | + if ($my_local) { |
|
119 | + $try_sort = true; |
|
120 | + break; |
|
121 | + } |
|
122 | + } |
|
123 | 123 | |
124 | - if ($try_sort) { |
|
125 | - uasort($array, 'strcoll'); |
|
126 | - } |
|
127 | - setlocale(LC_COLLATE, $old_locale); |
|
128 | - return $array; |
|
124 | + if ($try_sort) { |
|
125 | + uasort($array, 'strcoll'); |
|
126 | + } |
|
127 | + setlocale(LC_COLLATE, $old_locale); |
|
128 | + return $array; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param string $query_string The term string |
34 | 34 | */ |
35 | 35 | function chamilo_get_boolean_query($term) { |
36 | - return xapian_get_boolean_query($term); |
|
36 | + return xapian_get_boolean_query($term); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -44,22 +44,22 @@ discard block |
||
44 | 44 | $results_by_tool = array(); |
45 | 45 | if (count($results) > 0) { |
46 | 46 | |
47 | - foreach ($results as $key => $row) { |
|
48 | - $results_by_tool[$row['toolid']][] = $row; |
|
49 | - } |
|
47 | + foreach ($results as $key => $row) { |
|
48 | + $results_by_tool[$row['toolid']][] = $row; |
|
49 | + } |
|
50 | 50 | |
51 | - $processed_results = array(); |
|
52 | - foreach ($results_by_tool as $toolid => $rows) { |
|
53 | - $tool_processor_class = $toolid.'_processor'; |
|
54 | - $tool_processor_path = api_get_path(LIBRARY_PATH).'search/tool_processors/'.$tool_processor_class.'.class.php'; |
|
55 | - if (file_exists($tool_processor_path)) { |
|
56 | - require_once($tool_processor_path); |
|
57 | - $tool_processor = new $tool_processor_class($rows); |
|
58 | - $processed_results = array_merge($tool_processor->process(), $processed_results); |
|
59 | - } |
|
60 | - } |
|
51 | + $processed_results = array(); |
|
52 | + foreach ($results_by_tool as $toolid => $rows) { |
|
53 | + $tool_processor_class = $toolid.'_processor'; |
|
54 | + $tool_processor_path = api_get_path(LIBRARY_PATH).'search/tool_processors/'.$tool_processor_class.'.class.php'; |
|
55 | + if (file_exists($tool_processor_path)) { |
|
56 | + require_once($tool_processor_path); |
|
57 | + $tool_processor = new $tool_processor_class($rows); |
|
58 | + $processed_results = array_merge($tool_processor->process(), $processed_results); |
|
59 | + } |
|
60 | + } |
|
61 | 61 | |
62 | - return array(count($processed_results), $processed_results); |
|
62 | + return array(count($processed_results), $processed_results); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -72,5 +72,5 @@ discard block |
||
72 | 72 | * @return XapianQuery query joined |
73 | 73 | */ |
74 | 74 | function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') { |
75 | - return xapian_join_queries($query1, $query2, $op); |
|
75 | + return xapian_join_queries($query1, $query2, $op); |
|
76 | 76 | } |