@@ -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 | } |
@@ -24,7 +24,8 @@ |
||
24 | 24 | $sql = "SELECT * from $table where username='".Database::escape_string($login)."'"; |
25 | 25 | $result = Database::query($sql); |
26 | 26 | |
27 | - if (Database::num_rows($result) == 0) { //false password |
|
27 | + if (Database::num_rows($result) == 0) { |
|
28 | +//false password |
|
28 | 29 | return false; |
29 | 30 | } |
30 | 31 | $user_info = Database::fetch_assoc($result); |
@@ -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 |
@@ -5,16 +5,22 @@ discard block |
||
5 | 5 | * @author Pavel Vlasov |
6 | 6 | */ |
7 | 7 | |
8 | -if (!defined('DOKU_INC')) die(); |
|
9 | -if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/'); |
|
8 | +if (!defined('DOKU_INC')) { |
|
9 | + die(); |
|
10 | +} |
|
11 | +if (!defined('DOKU_PLUGIN')) { |
|
12 | + define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/'); |
|
13 | +} |
|
10 | 14 | require_once (DOKU_PLUGIN.'action.php'); |
11 | 15 | |
12 | -class action_plugin_jcapture extends DokuWiki_Action_Plugin { |
|
16 | +class action_plugin_jcapture extends DokuWiki_Action_Plugin |
|
17 | +{ |
|
13 | 18 | |
14 | 19 | /** |
15 | 20 | * return some info |
16 | 21 | */ |
17 | - function getInfo() { |
|
22 | + function getInfo() |
|
23 | + { |
|
18 | 24 | return array( |
19 | 25 | 'author' => 'Pavel Vlasov', |
20 | 26 | 'email' => '[email protected]', |
@@ -27,14 +33,16 @@ discard block |
||
27 | 33 | /** |
28 | 34 | * Register the eventhandlers |
29 | 35 | */ |
30 | - function register(&$controller) { |
|
36 | + function register(&$controller) |
|
37 | + { |
|
31 | 38 | $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array()); |
32 | 39 | } |
33 | 40 | |
34 | 41 | /** |
35 | 42 | * Inserts the toolbar button |
36 | 43 | */ |
37 | - function insert_button(& $event, $param) { |
|
44 | + function insert_button(& $event, $param) |
|
45 | + { |
|
38 | 46 | $event->data[] = array( |
39 | 47 | 'type' => 'JCapture', |
40 | 48 | 'title' => 'Screen capture', |
@@ -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'); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param array $links |
34 | 34 | * @param null $addparams |
35 | 35 | * @param bool $exportToPdf |
36 | - * @param null $showTeacherView |
|
36 | + * @param boolean $showTeacherView |
|
37 | 37 | * @param int $userId |
38 | 38 | * @param array $studentList |
39 | 39 | */ |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | |
919 | 919 | /** |
920 | 920 | * @param $item |
921 | - * @return mixed |
|
921 | + * @return string|null |
|
922 | 922 | */ |
923 | 923 | private function build_course_code($item) |
924 | 924 | { |
@@ -23,6 +23,9 @@ discard block |
||
23 | 23 | return chamilo_preprocess_results($results); |
24 | 24 | } |
25 | 25 | |
26 | +/** |
|
27 | + * @param string $query_string |
|
28 | + */ |
|
26 | 29 | function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) { |
27 | 30 | return xapian_query($query_string, NULL, $offset, $length, $extra); |
28 | 31 | } |
@@ -30,7 +33,7 @@ discard block |
||
30 | 33 | /** |
31 | 34 | * Wrapper for getting boolean queries |
32 | 35 | * |
33 | - * @param string $query_string The term string |
|
36 | + * @param string $term |
|
34 | 37 | */ |
35 | 38 | function chamilo_get_boolean_query($term) { |
36 | 39 | return xapian_get_boolean_query($term); |
@@ -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 | } |
@@ -18,12 +18,14 @@ discard block |
||
18 | 18 | * @param array extra Extra queries to join with. Optional |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = NULL) { |
|
21 | +function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = NULL) |
|
22 | +{ |
|
22 | 23 | list($count, $results) = xapian_query($query_string, NULL, $offset, $length, $extra); |
23 | 24 | return chamilo_preprocess_results($results); |
24 | 25 | } |
25 | 26 | |
26 | -function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) { |
|
27 | +function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) |
|
28 | +{ |
|
27 | 29 | return xapian_query($query_string, NULL, $offset, $length, $extra); |
28 | 30 | } |
29 | 31 | |
@@ -32,14 +34,16 @@ discard block |
||
32 | 34 | * |
33 | 35 | * @param string $query_string The term string |
34 | 36 | */ |
35 | -function chamilo_get_boolean_query($term) { |
|
37 | +function chamilo_get_boolean_query($term) |
|
38 | +{ |
|
36 | 39 | return xapian_get_boolean_query($term); |
37 | 40 | } |
38 | 41 | |
39 | 42 | /** |
40 | 43 | * Preprocess all results depending on the toolid |
41 | 44 | */ |
42 | -function chamilo_preprocess_results($results) { |
|
45 | +function chamilo_preprocess_results($results) |
|
46 | +{ |
|
43 | 47 | // group by toolid |
44 | 48 | $results_by_tool = array(); |
45 | 49 | if (count($results) > 0) { |
@@ -71,6 +75,7 @@ discard block |
||
71 | 75 | * @param string $op |
72 | 76 | * @return XapianQuery query joined |
73 | 77 | */ |
74 | -function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') { |
|
78 | +function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') |
|
79 | +{ |
|
75 | 80 | return xapian_join_queries($query1, $query2, $op); |
76 | 81 | } |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | * @param array extra Extra queries to join with. Optional |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = NULL) { |
|
22 | - list($count, $results) = xapian_query($query_string, NULL, $offset, $length, $extra); |
|
21 | +function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = null) { |
|
22 | + list($count, $results) = xapian_query($query_string, null, $offset, $length, $extra); |
|
23 | 23 | return chamilo_preprocess_results($results); |
24 | 24 | } |
25 | 25 | |
26 | -function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) { |
|
27 | - return xapian_query($query_string, NULL, $offset, $length, $extra); |
|
26 | +function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = null) { |
|
27 | + return xapian_query($query_string, null, $offset, $length, $extra); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -71,6 +71,6 @@ discard block |
||
71 | 71 | * @param string $op |
72 | 72 | * @return XapianQuery query joined |
73 | 73 | */ |
74 | -function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') { |
|
74 | +function chamilo_join_queries($query1, $query2 = null, $op = 'or') { |
|
75 | 75 | return xapian_join_queries($query1, $query2, $op); |
76 | 76 | } |
@@ -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 | } |
@@ -27,8 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | function validate($value, $options = null) |
29 | 29 | { |
30 | - if (is_array($value)) |
|
31 | - { |
|
30 | + if (is_array($value)) { |
|
32 | 31 | $value = implode(null, $value); |
33 | 32 | } |
34 | 33 | if ((string) $value == '') { |
@@ -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 | } |
@@ -5,7 +5,8 @@ discard block |
||
5 | 5 | * Class Rights |
6 | 6 | * @deprecated Don't use this class |
7 | 7 | */ |
8 | -class Rights { |
|
8 | +class Rights |
|
9 | +{ |
|
9 | 10 | private static $rights_cache = array(); |
10 | 11 | private static $rights = array( |
11 | 12 | 'show_tabs:reports' => |
@@ -16,32 +17,42 @@ discard block |
||
16 | 17 | |
17 | 18 | // warning the goal of this function is to enforce rights managment in Chamilo |
18 | 19 | // 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]; |
|
20 | + public static function hasRight($handler) |
|
21 | + { |
|
22 | + if (array_key_exists($handler, self::$rights_cache)) { |
|
23 | + return self::$rights_cache[$handler]; |
|
24 | + } |
|
22 | 25 | |
23 | - if (!array_key_exists($handler, self::$rights)) |
|
24 | - return true; // handler does not exists |
|
26 | + if (!array_key_exists($handler, self::$rights)) { |
|
27 | + return true; |
|
28 | + } |
|
29 | + // handler does not exists |
|
25 | 30 | |
26 | 31 | if (self::$rights[$handler]['type'] == 'sql') { |
27 | 32 | $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 |
|
33 | + if (Database::num_rows($result) > 0) { |
|
34 | + $result = true; |
|
35 | + } else { |
|
36 | + $result = false; |
|
37 | + } |
|
38 | + } else if (self::$rights[$handler]['type'] == 'const') { |
|
39 | + $result = self::$rights[$handler]['const']; |
|
40 | + } else if (self::$rights[$handler]['type'] == 'func') { |
|
41 | + $result = self::$rights[$handler]['func'](); |
|
42 | + } else { |
|
43 | + // handler type not implemented |
|
37 | 44 | return true; |
45 | + } |
|
38 | 46 | self::$rights_cache[$handler] = $result; |
39 | 47 | return $result; |
40 | 48 | } |
41 | 49 | |
42 | - public static function hasRightClosePageWithError($handler) { |
|
43 | - if (hasRight($handler) == false) |
|
44 | - die("You are not allowed here"); //FIXME |
|
50 | + public static function hasRightClosePageWithError($handler) |
|
51 | + { |
|
52 | + if (hasRight($handler) == false) { |
|
53 | + die("You are not allowed here"); |
|
54 | + } |
|
55 | + //FIXME |
|
45 | 56 | } |
46 | 57 | |
47 | 58 | } |
@@ -15,7 +15,8 @@ |
||
15 | 15 | return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default; |
16 | 16 | } |
17 | 17 | |
18 | - public static function has($key) { |
|
18 | + public static function has($key) |
|
19 | + { |
|
19 | 20 | return isset($_REQUEST[$key]); |
20 | 21 | } |
21 | 22 |
@@ -9,6 +9,9 @@ discard block |
||
9 | 9 | class Request |
10 | 10 | { |
11 | 11 | |
12 | + /** |
|
13 | + * @param string $key |
|
14 | + */ |
|
12 | 15 | public static function get($key, $default = null) |
13 | 16 | { |
14 | 17 | return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default; |
@@ -30,6 +33,10 @@ discard block |
||
30 | 33 | return $method == 'GET'; |
31 | 34 | } |
32 | 35 | |
36 | + /** |
|
37 | + * @param string $key |
|
38 | + * @param string $default |
|
39 | + */ |
|
33 | 40 | public static function post($key, $default = null) |
34 | 41 | { |
35 | 42 | return isset($_POST[$key]) ? $_POST[$key] : $default; |