Browse Source

Major rework on formatting, sonar integration, cleanups

pull/5/merge
Kai Kretschmann 1 year ago
parent
commit
a79b951536

+ 4
- 0
.buildpath View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path=""/>
</buildpath>

+ 4
- 2
.htaccess View File

@@ -1,8 +1,8 @@
Options -indexes

Header always set Strict-Transport-Security "max-age=31536000"
#Header always set Strict-Transport-Security "max-age=31536000"

Header always set Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self'; font-src 'self'; report-uri https://report-uri.io/report/e7e84fa898ae6e0d0e8d70e25cd237c7;"
#Header always set Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self'; font-src 'self'; report-uri https://report-uri.io/report/e7e84fa898ae6e0d0e8d70e25cd237c7;"

<Files stats.php>
# Chart.js uses some dynamic functions.
@@ -18,3 +18,5 @@ AuthType Basic
AuthName "Restricted Area"
AuthUserFile /var/www/webuser
Require valid-user
Require ip 127.0.0.1
Require ip ::1

+ 0
- 5
.project View File

@@ -6,11 +6,6 @@
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.php.composer.core.builder.buildPathManagementBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>

+ 1
- 1
.settings/org.eclipse.php.debug.core.Debug_Process_Preferences.prefs View File

@@ -1,7 +1,7 @@
DefaultProjectBasePath=/Lggr
eclipse.preferences.version=1
org.eclipse.php.debug.core.use-project-settings=true
org.eclipse.php.debug.coredefaultPHP=PHP 7.2.0 (CLI)
org.eclipse.php.debug.coredefaultPHP=PHP 5.6.32 (CLI)
org.eclipse.php.debug.coreoutput_encoding=UTF-8
org.eclipse.php.debug.corestop_at_first_line_string=true
org.eclipse.php.debug.coretransfer_encoding=UTF-8

+ 207
- 0
.settings/org.eclipse.php.formatter.core.prefs View File

@@ -0,0 +1,207 @@
eclipse.preferences.version=1
formatterProfile=_KKRphp
indentationChar=\
insert_space_after_opening_paren_in_declare=false
insert_space_before_closing_paren_in_declare=false
insert_space_before_opening_paren_in_declare=false
org.eclipse.php.core.formatter.insert_new_line_in_function_invoke=3
org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_force_split=false
org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_indent_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_line_wrap_policy=1
org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_force_split=false
org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_indent_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_line_wrap_policy=1
org.eclipse.php.formatter.core.formatter.alignment_for_assignment_force_split=false
org.eclipse.php.formatter.core.formatter.alignment_for_assignment_indent_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_assignment_line_wrap_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_force_split=false
org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_indent_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_line_wrap_policy=1
org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_force_split=false
org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_indent_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_line_wrap_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_force_split=false
org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_indent_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_line_wrap_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_force_split=true
org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_indent_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_line_wrap_policy=3
org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_force_split=false
org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_indent_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_line_wrap_policy=1
org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_force_split=false
org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_indent_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_line_wrap_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_force_split=false
org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_indent_policy=0
org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_line_wrap_policy=1
org.eclipse.php.formatter.core.formatter.blank_lines_before_field=1
org.eclipse.php.formatter.core.formatter.blank_lines_before_member_type=1
org.eclipse.php.formatter.core.formatter.blank_lines_before_method=1
org.eclipse.php.formatter.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.php.formatter.core.formatter.brace_position_for_block=0
org.eclipse.php.formatter.core.formatter.brace_position_for_lambda_function_declaration=0
org.eclipse.php.formatter.core.formatter.brace_position_for_method_declaration=0
org.eclipse.php.formatter.core.formatter.brace_position_for_switch=0
org.eclipse.php.formatter.core.formatter.brace_position_for_type_declaration=0
org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.php.formatter.core.formatter.comment.format_block_comments=true
org.eclipse.php.formatter.core.formatter.comment.format_header=false
org.eclipse.php.formatter.core.formatter.comment.format_html=true
org.eclipse.php.formatter.core.formatter.comment.format_javadoc_comments=true
org.eclipse.php.formatter.core.formatter.comment.format_line_comments=true
org.eclipse.php.formatter.core.formatter.comment.format_source_code=true
org.eclipse.php.formatter.core.formatter.comment.indent_parameter_description=true
org.eclipse.php.formatter.core.formatter.comment.indent_root_tags=true
org.eclipse.php.formatter.core.formatter.comment.insert_new_line_before_root_tags=true
org.eclipse.php.formatter.core.formatter.comment.insert_new_line_for_parameter=true
org.eclipse.php.formatter.core.formatter.comment.line_length=9999
org.eclipse.php.formatter.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.php.formatter.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.php.formatter.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.php.formatter.core.formatter.continuation_indentation=1
org.eclipse.php.formatter.core.formatter.continuation_indentation_for_array_initializer=1
org.eclipse.php.formatter.core.formatter.disabling_tag=@formatter\:off
org.eclipse.php.formatter.core.formatter.enabling_tag=@formatter\:on
org.eclipse.php.formatter.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.php.formatter.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.php.formatter.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.php.formatter.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.php.formatter.core.formatter.indent_empty_lines=false
org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_block=true
org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_body=true
org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.php.formatter.core.formatter.indentation.size=4
org.eclipse.php.formatter.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=false
org.eclipse.php.formatter.core.formatter.insert_new_line_before_catch_in_try_statement=true
org.eclipse.php.formatter.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=true
org.eclipse.php.formatter.core.formatter.insert_new_line_before_else_in_if_statement=false
org.eclipse.php.formatter.core.formatter.insert_new_line_before_finally_in_try_statement=true
org.eclipse.php.formatter.core.formatter.insert_new_line_before_while_in_do_statement=true
org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_block=false
org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_method_body=false
org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_type_declaration=false
org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_array_creation=true
org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_field_access=false
org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_foreach=true
org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_method_invocation=false
org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_yield=true
org.eclipse.php.formatter.core.formatter.insert_space_after_assignment_operator=true
org.eclipse.php.formatter.core.formatter.insert_space_after_binary_operator=true
org.eclipse.php.formatter.core.formatter.insert_space_after_closing_brace_in_block=true
org.eclipse.php.formatter.core.formatter.insert_space_after_closing_paren_in_cast=true
org.eclipse.php.formatter.core.formatter.insert_space_after_colon_in_conditional=true
org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_field_access=false
org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_method_invocation=false
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_array_creation=false
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_echo=true
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_for_inits=true
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_global=true
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_list=true
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_declaration_parameters=true
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_invocation_arguments=true
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_constant_declarations=true
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_field_declarations=true
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_static=true
org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_superinterfaces=true
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_bracket_in_array_reference=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_array_creation=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_cast=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_catch=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_for=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_foreach=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_if=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_list=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_declaration=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_invocation=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_switch=false
org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_while=false
org.eclipse.php.formatter.core.formatter.insert_space_after_postfix_operator=false
org.eclipse.php.formatter.core.formatter.insert_space_after_prefix_operator=true
org.eclipse.php.formatter.core.formatter.insert_space_after_question_in_conditional=true
org.eclipse.php.formatter.core.formatter.insert_space_after_semicolon_in_for=true
org.eclipse.php.formatter.core.formatter.insert_space_after_unary_operator=true
org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_array_creation=true
org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_field_access=false
org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_foreach=true
org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_method_invocation=false
org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_yield=true
org.eclipse.php.formatter.core.formatter.insert_space_before_assignment_operator=true
org.eclipse.php.formatter.core.formatter.insert_space_before_binary_operator=true
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_bracket_in_array_reference=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_array_creation=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_cast=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_catch=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_for=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_foreach=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_if=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_list=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_declaration=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_invocation=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_switch=false
org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_while=false
org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_case=false
org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_conditional=true
org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_default=false
org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_field_access=false
org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_method_invocation=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_array_creation=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_echo=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_for_inits=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_global=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_list=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_declaration_parameters=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_invocation_arguments=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_constant_declarations=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_field_declarations=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_static=false
org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_superinterfaces=false
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_block=true
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_method_declaration=true
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_switch=true
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_type_declaration=true
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_bracket_in_array_reference=false
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_array_creation=false
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_catch=true
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_for=true
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_foreach=true
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_if=true
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_list=true
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_declaration=false
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_invocation=false
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_switch=true
org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_while=true
org.eclipse.php.formatter.core.formatter.insert_space_before_postfix_operator=true
org.eclipse.php.formatter.core.formatter.insert_space_before_prefix_operator=false
org.eclipse.php.formatter.core.formatter.insert_space_before_question_in_conditional=true
org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon=false
org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon_in_for=false
org.eclipse.php.formatter.core.formatter.insert_space_before_unary_operator=false
org.eclipse.php.formatter.core.formatter.insert_space_between_brackets_in_array_type_reference=false
org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_declaration=false
org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_invocation=false
org.eclipse.php.formatter.core.formatter.join_lines_in_comments=true
org.eclipse.php.formatter.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.php.formatter.core.formatter.keep_elseif_statement_on_same_line=true
org.eclipse.php.formatter.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.php.formatter.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.php.formatter.core.formatter.lineSplit=80
org.eclipse.php.formatter.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.php.formatter.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_namespace=1
org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_use_statements=0
org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_class_body=0
org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_method_body=0
org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_namespace=0
org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_use_statements=0
org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_namespaces=1
org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_use_statements=0
org.eclipse.php.formatter.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.php.formatter.core.formatter.put_empty_statement_on_new_line=false
org.eclipse.php.formatter.core.formatter.tabulation.size=4
org.eclipse.php.formatter.core.formatter.use_on_off_tags=true

+ 5
- 0
.settings/org.eclipse.php.ui.prefs View File

@@ -1,2 +1,7 @@
cleanup.format.on.save=false
cleanup.organize.on.save=false
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=false
cleanup.remove_trailing_whitespaces_ignore_empty=true
eclipse.preferences.version=1
org.eclipse.php.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>

+ 4
- 5
.settings/org.eclipse.wst.common.project.facet.core.xml View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="php.core.component"/>
<fixed facet="php.component"/>
<installed facet="php.core.component" version="1"/>
<installed facet="php.component" version="7.1"/>
<installed facet="php.composer.component" version="1"/>
<fixed facet="php.core.component" />
<fixed facet="php.component" />
<installed facet="php.core.component" version="1" />
<installed facet="php.component" version="5.6" />
</faceted-project>

+ 10
- 0
.settings/org.phpsrc.eclipse.pti.tools.phpunit.prefs View File

@@ -0,0 +1,10 @@
bootstrap=
debug_print_output=true
eclipse.preferences.version=1
no_namespace_check=true
pear_library=<Internal>
php_executable=PHP 5.6.32 (CLI)
source_file_pattern_folder=\\%p\\inc
test_file_pattern_file=%fTest.%e
test_file_pattern_folder=\\%p\\tests
test_file_super_class=PHPUnit_Framework_TestCase

+ 6
- 4
admin/cron.php View File

@@ -1,7 +1,8 @@
<?php
spl_autoload_register(function ($class) {
include __DIR__ . '/../inc/' . strtolower($class) . '_class.php';
});
spl_autoload_register(
function ($class) {
include __DIR__ . '/../inc/' . strtolower($class) . '_class.php';
});
$iCount = 0;
$aPerf = array();
@@ -16,7 +17,8 @@ try {
$iCount = $l->purgeOldMessages();
$aPerf = $l->getPerf();
} catch (LggrException $e) {
}
catch (LggrException $e) {
die($e->getMessage());
} // try

+ 6
- 4
admin/cron_often.php View File

@@ -1,7 +1,8 @@
<?php
spl_autoload_register(function ($class) {
include __DIR__ . '/../inc/' . strtolower($class) . '_class.php';
});
spl_autoload_register(
function ($class) {
include __DIR__ . '/../inc/' . strtolower($class) . '_class.php';
});
$iCountServers = 0;
$aPerf = array();
@@ -17,7 +18,8 @@ try {
$iCountServers = $l->updateServers();
$aPerf = $l->getPerf();
} catch (LggrException $e) {
}
catch (LggrException $e) {
die($e->getMessage());
} // try

+ 6
- 4
admin/normalize.php View File

@@ -1,7 +1,8 @@
<?php
spl_autoload_register(function ($class) {
include __DIR__ . '/../inc/' . strtolower($class) . '_class.php';
});
spl_autoload_register(
function ($class) {
include __DIR__ . '/../inc/' . strtolower($class) . '_class.php';
});
$iCount = 0;
$a = array();
@@ -17,6 +18,7 @@ try {
$l->normalizeHosts();
$a = $l->getPerf();
} catch (LggrException $e) {
}
catch (LggrException $e) {
die($e->getMessage());
} // try

+ 4
- 3
api.php View File

@@ -1,7 +1,8 @@
<?php
spl_autoload_register(function ($class) {
include 'inc/' . strtolower($class) . '_class.php';
});
spl_autoload_register(
function ($class) {
include 'inc/' . strtolower($class) . '_class.php';
});
session_start();

+ 21
- 12
archived.php View File

@@ -7,8 +7,10 @@ require 'tpl/head.inc.php';
$l = null;
try {
$l = new Lggr($state, $config);
} catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div></div>';
}
catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' .
$e->getMessage() . '</div></div>';
require 'tpl/foot.inc.php';
@@ -22,8 +24,10 @@ try {
$searchvalue = '';
$searchvalueprog = '';
$isSearch = false;
} catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div></div>';
}
catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' .
$e->getMessage() . '</div></div>';
require 'tpl/foot.inc.php';
@@ -31,7 +35,8 @@ try {
}
if (version_compare(phpversion(), '5.4', '<')) {
echo '<div class="container"><div class="alert alert-danger" role="alert">Your PHP version ' . phpversion() . ' might be too old, expecting at least 5.4</div></div>';
echo '<div class="container"><div class="alert alert-danger" role="alert">Your PHP version ' .
phpversion() . ' might be too old, expecting at least 5.4</div></div>';
} // if
require 'tpl/nav.inc.php';
@@ -46,7 +51,8 @@ require 'tpl/nav.inc.php';
<?php
if (0 == count($aEvents)) {
echo '<div class="alert alert-danger" role="alert">' . _('empty result') . '</div>';
echo '<div class="alert alert-danger" role="alert">' . _('empty result') .
'</div>';
} // if
?>
@@ -92,22 +98,26 @@ foreach ($aEvents as $event) {
$label = '<span class="label label-success">Info</span>';
break;
default:
$label = '<span class="label label-default">' . $event->level . '</span>';
$label = '<span class="label label-default">' . $event->level .
'</span>';
} // switch
switch ($event->archived) {
case 'Y':
$archived = '<span id="arch' . $event->id . '" class="lggr-archived glyphicon glyphicon-warning-sign" aria-hidden="true" title="archived"></span>';
$archived = '<span id="arch' . $event->id .
'" class="lggr-archived glyphicon glyphicon-warning-sign" aria-hidden="true" title="archived"></span>';
break;
case 'N':
$archived = '<span id="arch' . $event->id . '" class="lggr-notarchived glyphicon glyphicon-pushpin" aria-hidden="true" title=""></span>';
$archived = '<span id="arch' . $event->id .
'" class="lggr-notarchived glyphicon glyphicon-pushpin" aria-hidden="true" title=""></span>';
break;
default:
$archived = '?';
} // switch
$host = htmlentities($event->host, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$program = htmlentities($event->program, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$program = htmlentities($event->program,
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$msg = htmlentities($event->message, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
echo <<<EOL
@@ -135,5 +145,4 @@ if (! $isSearch) {
<?php
$aPerf = $l->getPerf();
require 'tpl/foot.inc.php'
?>
require 'tpl/foot.inc.php'?>

+ 14
- 14
css/lggr.css View File

@@ -6,25 +6,25 @@ div.lggr-col-filter div.lggr-formelement {
margin-bottom: 1em;
}

@-moz-keyframes spin {
100% {
-moz-transform: rotate(360deg);
}
@
-moz-keyframes spin { 100% {
-moz-transform: rotate(360deg);
}

@-webkit-keyframes spin {
100% {
-webkit-transform: rotate(360deg);
}
}
@
-webkit-keyframes spin { 100% {
-webkit-transform: rotate(360deg);
}

@keyframes spin {
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@
keyframes spin { 100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}

}
div#liveheader h2 span.glyphicon-refresh {
-webkit-animation: spin 4s linear infinite;
-moz-animation: spin 4s linear infinite;
@@ -99,4 +99,4 @@ p.debugfooter {
float: right;
color: #999999;
font-size: 75%;
}
}

+ 1
- 1
css/lggr_print.css View File

@@ -33,4 +33,4 @@ div.col-md-1, div.col-md-2 {

div.col-md-5 {
clear: left;
}
}

+ 4
- 3
do.php View File

@@ -1,7 +1,8 @@
<?php
spl_autoload_register(function ($class) {
include 'inc/' . strtolower($class) . '_class.php';
});
spl_autoload_register(
function ($class) {
include 'inc/' . strtolower($class) . '_class.php';
});
session_start();

+ 9
- 9
icos/browserconfig.xml View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/icos/mstile-70x70.png"/>
<square150x150logo src="/icos/mstile-150x150.png"/>
<square310x310logo src="/icos/mstile-310x310.png"/>
<wide310x150logo src="/icos/mstile-310x150.png"/>
<TileColor>#ffc40d</TileColor>
</tile>
</msapplication>
<msapplication>
<tile>
<square70x70logo src="/icos/mstile-70x70.png" />
<square150x150logo src="/icos/mstile-150x150.png" />
<square310x310logo src="/icos/mstile-310x310.png" />
<wide310x150logo src="/icos/mstile-310x150.png" />
<TileColor>#ffc40d</TileColor>
</tile>
</msapplication>
</browserconfig>

+ 21
- 42
inc/abstractconfig_class.php View File

@@ -1,7 +1,6 @@
<?php
abstract class AbstractConfig
{
abstract class AbstractConfig {
protected $DBUSER;
@@ -23,103 +22,83 @@ abstract class AbstractConfig
protected $LOCALE;
final public function getDbUser()
{
final public function getDbUser() {
return $this->DBUSER;
}
final public function getDbPwd()
{
final public function getDbPwd() {
return $this->DBPWD;
}
final public function getDbName()
{
final public function getDbName() {
return $this->DBNAME;
}
final public function getUrlBootstrap()
{
final public function getUrlBootstrap() {
return $this->URLBOOTSTRAP;
}
final public function getUrlJquery()
{
final public function getUrlJquery() {
return $this->URLJQUERY;
}
final public function getUrlJqueryui()
{
final public function getUrlJqueryui() {
return $this->URLJQUERYUI;
}
final public function getUrlJAtimepicker()
{
final public function getUrlJAtimepicker() {
return $this->URLJATIMEPICKER;
}
final public function getUrlChartjs()
{
final public function getUrlChartjs() {
return $this->URLCHARTJS;
}
final public function getUrlJQCloud()
{
final public function getUrlJQCloud() {
return $this->URLJQCLOUD;
}
final public function getLocale()
{
final public function getLocale() {
return $this->LOCALE;
}
protected function setDbUser($s)
{
protected function setDbUser($s) {
$this->DBUSER = $s;
}
protected function setDbPwd($s)
{
protected function setDbPwd($s) {
$this->DBPWD = $s;
}
protected function setDbname($s)
{
protected function setDbname($s) {
$this->DBNAME = $s;
}
protected function setUrlBootstrap($s)
{
protected function setUrlBootstrap($s) {
$this->URLBOOTSTRAP = $s;
}
protected function setUrlJquery($s)
{
protected function setUrlJquery($s) {
$this->URLJQUERY = $s;
}
protected function setUrlJqueryui($s)
{
protected function setUrlJqueryui($s) {
$this->URLJQUERYUI = $s;
}
protected function setUrlJAtimepicker($s)
{
protected function setUrlJAtimepicker($s) {
$this->URLJATIMEPICKER = $s;
}
protected function setUrlChartjs($s)
{
protected function setUrlChartjs($s) {
$this->URLCHARTJS = $s;
}
protected function setUrlJQCloud($s)
{
protected function setUrlJQCloud($s) {
$this->URLJQCLOUD = $s;
}
protected function setLocale($s)
{
protected function setLocale($s) {
$this->LOCALE = $s;
}
} // class

+ 1
- 2
inc/abstractlggrcache_class.php View File

@@ -1,7 +1,6 @@
<?php
abstract class AbstractLggrCache
{
abstract class AbstractLggrCache {
abstract protected function store($key, $value);

+ 2
- 4
inc/adminconfig_class.php View File

@@ -1,10 +1,8 @@
<?php
class AdminConfig extends AbstractConfig
{
class AdminConfig extends AbstractConfig {
function __construct()
{
function __construct() {
$this->setDbUser('loggeradmin');
$this->setDbPwd('lggr');
$this->setDbName('lggrdev');

+ 4
- 5
inc/config_class.php View File

@@ -1,10 +1,8 @@
<?php
class Config extends AbstractConfig
{
class Config extends AbstractConfig {
function __construct()
{
function __construct() {
$this->setDbUser('lggr');
$this->setDbPwd('lggr');
$this->setDbName('lggr');
@@ -16,7 +14,8 @@ class Config extends AbstractConfig
$this->setUrlBootstrap('//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/');
$this->setUrlJquery('//code.jquery.com/');
$this->setUrlJqueryui('//code.jquery.com/ui/1.11.4/');
$this->setUrlJAtimepicker('//cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.4.5/');
$this->setUrlJAtimepicker(
'//cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.4.5/');
$this->setUrlChartjs('//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/');
$this->setUrlJQCloud('//cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/');

+ 88
- 85
inc/lggr_class.php View File

@@ -1,7 +1,6 @@
<?php
class Lggr
{
class Lggr {
const LASTSTAT = 5000;
@@ -19,8 +18,7 @@ class Lggr
private $aPerf = null;
function __construct(LggrState $state, AbstractConfig $config)
{
function __construct(LggrState $state, AbstractConfig $config) {
$this->config = $config;
$this->state = $state;
$this->cache = new LggrCacheFile(); // or use LggrCacheRedis instead
@@ -30,30 +28,34 @@ class Lggr
$this->checkSecurity();
}
$this->db = new mysqli('localhost', $this->config->getDbUSer(), $this->config->getDbPwd(), $this->config->getDbName());
$this->db = new mysqli('localhost', $this->config->getDbUSer(),
$this->config->getDbPwd(), $this->config->getDbName());
$this->db->set_charset('utf8');
}
// constructor
function __destruct()
{
// constructor
function __destruct() {
if (null != $this->db) {
$this->db->close();
} // if
}
// destructor
private function checkSecurity()
{
// destructor
private function checkSecurity() {
// local access allowed without login data
if ($_SERVER["REMOTE_ADDR"] === "::1") {
return;
}
if ($_SERVER["REMOTE_ADDR"] === "127.0.0.1") {
return;
}
if (! isset($_SERVER['REMOTE_USER'])) {
throw new LggrException('You must enable basic authentication');
} // if
}
// function
private function getViewName()
{
// function
private function getViewName() {
$rcView = '';
switch ($this->state->getRange()) {
case 1:
@@ -75,14 +77,14 @@ class Lggr
return $rcView;
}
function getLevels()
{
function getLevels() {
$perf = new LggrPerf();
$v = $this->getViewName();
$sql = "
SELECT level, COUNT(*) AS c
FROM (SELECT level FROM $v ORDER BY `date` DESC LIMIT " . self::LASTSTAT . ") AS sub
FROM (SELECT level FROM $v ORDER BY `date` DESC LIMIT " .
self::LASTSTAT . ") AS sub
GROUP BY level
ORDER BY c DESC
";
@@ -119,9 +121,9 @@ ORDER BY c DESC
$this->cache->store("levels$v", $a);
return $a;
}
// function
function getAllServers()
{
// function
function getAllServers() {
$perf = new LggrPerf();
$sql = "
@@ -144,9 +146,9 @@ FROM servers";
return $a;
}
// function
function getServersName($id)
{
// function
function getServersName($id) {
$perf = new LggrPerf();
$sql = "
@@ -171,16 +173,17 @@ WHERE id=$id";
return $a->name;
}
// function
function getServers()
{
// function
function getServers() {
$perf = new LggrPerf();
$v = $this->getViewName();
$sql = "
SELECT host, COUNT(*) AS c
FROM (SELECT host FROM $v ORDER BY `date` DESC LIMIT " . self::LASTSTAT . ") AS sub
SELECT host, COUNT(*) AS c
FROM (SELECT host FROM $v ORDER BY `date` DESC LIMIT " .
self::LASTSTAT . ") AS sub
GROUP BY host
ORDER BY c DESC";
@@ -216,9 +219,9 @@ ORDER BY c DESC";
$this->cache->store("servers$v", $a);
return $a;
}
// function
function getArchived($from = 0, $count = LggrState::PAGELEN)
{
// function
function getArchived($from = 0, $count = LggrState::PAGELEN) {
$iArchivedSize = $this->cache->retrieve(ARCHIVEDSIZE);
$aArchivedData = $this->cache->retrieve(ARCHIVEDSIZE . intval($from));
@@ -252,9 +255,9 @@ LIMIT $from,$count";
return $a;
}
// function
function getLatest($from = 0, $count = LggrState::PAGELEN)
{
// function
function getLatest($from = 0, $count = LggrState::PAGELEN) {
$perfSize = new LggrPerf();
$perfData = new LggrPerf();
@@ -279,9 +282,9 @@ LIMIT $from,$count";
return $a;
}
// function
function getCloud()
{
// function
function getCloud() {
$perf = new LggrPerf();
$v = $this->getViewName();
@@ -302,9 +305,9 @@ LIMIT $from,$count";
return $a;
}
// function
function getNewer($id)
{
// function
function getNewer($id) {
$perf = new LggrPerf();
$sqlData = "
@@ -321,9 +324,9 @@ LIMIT " . LggrState::PAGELEN;
return $a;
}
// function
function getEntry($id)
{
// function
function getEntry($id) {
$perf = new LggrPerf();
$sqlData = "
@@ -337,9 +340,9 @@ WHERE id=$id";
$this->aPerf[] = $perf;
return $a;
}
// function
function getFromTo($from = 0, $count = LggrState::PAGELEN)
{
// function
function getFromTo($from = 0, $count = LggrState::PAGELEN) {
$perfSize = new LggrPerf();
$perfData = new LggrPerf();
@@ -369,9 +372,9 @@ LIMIT $from,$count";
return $a;
}
// function
function getHostFromTo($from = 0, $count = LggrState::PAGELEN)
{
// function
function getHostFromTo($from = 0, $count = LggrState::PAGELEN) {
$perfSize = new LggrPerf();
$perfData = new LggrPerf();
@@ -404,9 +407,10 @@ LIMIT $from,$count";
return $a;
}
// function
function getFiltered($host = null, $level = null, $from = 0, $count = LggrState::PAGELEN)
{
// function
function getFiltered($host = null, $level = null, $from = 0,
$count = LggrState::PAGELEN) {
$perfSize = new LggrPerf();
$perfData = new LggrPerf();
@@ -445,9 +449,9 @@ LIMIT $from,$count";
return $a;
}
// function
function getText($msg = '', $prog = '', $from = 0, $count = LggrState::PAGELEN)
{
// function
function getText($msg = '', $prog = '', $from = 0, $count = LggrState::PAGELEN) {
$perf = new LggrPerf();
$v = $this->getViewName();
@@ -477,9 +481,9 @@ LIMIT $from,$count";
return $a;
}
// function
function getMessagesPerHour()
{
// function
function getMessagesPerHour() {
$perf = new LggrPerf();
$sql = "
@@ -501,9 +505,9 @@ GROUP BY h";
$this->cache->store('mph', $a);
return $a;
}
// function
function getArchivedStatistic()
{
// function
function getArchivedStatistic() {
$perf = new LggrPerf();
$sql = "
@@ -525,9 +529,9 @@ FROM Archived
$this->cache->store('archivedstats', $a);
return $a;
}
// function
function getStatistic()
{
// function
function getStatistic() {
$perf = new LggrPerf();
$sql = "
@@ -549,11 +553,11 @@ FROM newlogs
$this->cache->store('stats', $a);
return $a;
}
// function
// function
/* delete anything older than maxage hours, or 4 weeks */
function purgeOldMessages($maxage = 672)
{
function purgeOldMessages($maxage = 672) {
$perf = new LggrPerf();
$sql = "
@@ -572,9 +576,9 @@ AND archived='N'
return $this->db->affected_rows;
}
// function
function updateServers()
{
// function
function updateServers() {
$perf = new LggrPerf();
$iCount = 0;
@@ -584,7 +588,7 @@ AND archived='N'
$aServersKnownObj = $this->sendResult($sql);
$perf->stop();
$this->aPerf[] = $perf;
$aServersKnown = array();
foreach ($aServersKnownObj as $obj) {
$aServersKnown[$obj->name] = $obj->id;
@@ -628,8 +632,7 @@ AND archived='N'
return $iCount;
}
function setArchive($iID, $bIsArchived)
{
function setArchive($iID, $bIsArchived) {
$iID = intval($iID);
if ($bIsArchived) {
$sArchive = 'Y';
@@ -646,9 +649,9 @@ AND archived='N'
$this->cache->purge(ARCHIVEDSIZE);
$this->cache->purge("archivedData0");
}
// function
function normalizeHosts()
{
// function
function normalizeHosts() {
// Find any new hostnames
$sql = "
@@ -703,9 +706,9 @@ AND host='$hostName'
} // if
} // foreach
}
// function
private function getResultSize($sql)
{
// function
private function getResultSize($sql) {
$res = $this->db->query($sql);
if (false === $res) {
throw new LggrException($this->db->error);
@@ -716,9 +719,9 @@ AND host='$hostName'
} // if
$res->close();
}
// function
private function sendResult($sql)
{
// function
private function sendResult($sql) {
$a = array();
$res = $this->db->query($sql);
@@ -732,9 +735,9 @@ AND host='$hostName'
$res->close();
return $a;
}
// function
public function getPerf()
{
// function
public function getPerf() {
return $this->aPerf;
} // function
} // class

+ 19
- 20
inc/lggrcachefile_class.php View File

@@ -1,26 +1,25 @@
<?php
class LggrCacheFile extends AbstractLggrCache
{
class LggrCacheFile extends AbstractLggrCache {
const MAXAGE = 300;
// 5 minutes
// 5 minutes
private $cachepath = null;
function __construct()
{
function __construct() {
$this->cachepath = __DIR__ . '/../cache/';
}
// constructor
public function store($key, $value)
{
// constructor
public function store($key, $value) {
$fname = $this->getFilename($key);
$s = serialize($value);
file_put_contents($fname, $s);
}
// function
public function retrieve($key)
{
// function
public function retrieve($key) {
$fname = $this->getFilename($key);
if (file_exists($fname) && is_readable($fname)) {
$ts = filemtime($fname);
@@ -35,21 +34,21 @@ class LggrCacheFile extends AbstractLggrCache
return null;
} // if
}
// function
public function purge($key)
{
// function
public function purge($key) {
$fname = $this->getFilename($key);
unlink($fname);
}
// function
private function filterKey($key)
{
// function
private function filterKey($key) {
$sTmp = str_replace(' ', '-', $key);
return preg_replace('/[^A-Za-z0-9\-]/', '', $sTmp);
}
// function
private function getFilename($key)
{
// function
private function getFilename($key) {
return $this->cachepath . 'key_' . $this->filterKey($key) . '.data';
} // function
}

+ 16
- 17
inc/lggrcacheredis_class.php View File

@@ -1,10 +1,10 @@
<?php
class LggrCacheRedis extends AbstractLggrCache
{
class LggrCacheRedis extends AbstractLggrCache {
// 5 minutes
const MAXAGE = 300;
// 5 minutes
const REDISHOST = 'localhost';
const REDISDB = 0;
@@ -13,35 +13,34 @@ class LggrCacheRedis extends AbstractLggrCache
private $r = null;
function __construct()
{
function __construct() {
$this->r = new Redis();
$this->r->connect(self::REDISHOST);
$this->r->select(self::REDISDB);
}
// constructor
function __destruct()
{
// constructor
function __destruct() {
$this->r->close();
}
// destructor
public function store($key, $value)
{
// destructor
public function store($key, $value) {
$s = serialize($value);
$this->r->setex(SELF::REDISPFX . $key, self::MAXAGE, $s);
}
// function
public function retrieve($key)
{
// function
public function retrieve($key) {
$value = $this->r->get(SELF::REDISPFX . $key);
if (false === $value) {
return null;
}
return unserialize($value);
}
// function
public function purge($key)
{
// function
public function purge($key) {
$this->r->delete(SELF::REDISPFX . $key);
} // function
} // class

+ 9
- 10
inc/lggrcsv_class.php View File

@@ -1,8 +1,7 @@
<?php
/* speichern als UTF8 ohne BOM */
class LggrCsv
{
class LggrCsv {
private $lggr = null;
@@ -17,20 +16,20 @@ class LggrCsv
'message'
];
function __construct(Lggr &$oLggr)
{
function __construct(Lggr &$oLggr) {
$this->lggr = & $oLggr;
}
// constructor
private function generiereDateiname()
{
// constructor
private function generiereDateiname() {
return 'lggrarchive_' . date('Ymd') . '.csv';
}
function generiere()
{
function generiere() {
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename="' . $this->generiereDateiname() . '"');
header(
'Content-Disposition: attachment; filename="' .
$this->generiereDateiname() . '"');
$iCnt = 0;
$aEntries = $this->lggr->getArchived(0, 9999);

+ 3
- 6
inc/lggrexception_class.php View File

@@ -3,12 +3,10 @@
/**
* Project specific exception class
*/
class LggrException extends Exception
{
class LggrException extends Exception {
// Die Exception neu definieren, damit die Mitteilung nicht optional ist
public function __construct($message, $code = 0, Exception $previous = null)
{
public function __construct($message, $code = 0, Exception $previous = null) {
// etwas Code
// sicherstellen, dass alles korrekt zugewiesen wird
@@ -16,8 +14,7 @@ class LggrException extends Exception
}
// maßgeschneiderte Stringdarstellung des Objektes
public function __toString()
{
public function __toString() {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}

+ 14
- 16
inc/lggrperf_class.php View File

@@ -1,7 +1,6 @@
<?php
class LggrPerf
{
class LggrPerf {
private $tsStart = null;
@@ -11,23 +10,22 @@ class LggrPerf
private $sQuery = null;
function __construct()
{}
// constructor
public function start($sql)
{
function __construct() {}
// constructor
public function start($sql) {
$this->sQuery = $sql;
$this->tsStart = microtime(true);
}
// function
public function stop()
{
// function
public function stop() {
$this->tsEnd = microtime(true);
$this->tsLen = $this->tsEnd - $this->tsStart;
}
// function
public function getPerf()
{
// function
public function getPerf() {
$a = array();
$a['time'] = $this->tsLen;
@@ -37,8 +35,8 @@ class LggrPerf
return $a;
}
// function
private function logPerf()
{} // function
// function
private function logPerf() {} // function
}


+ 35
- 61
inc/lggrstate_class.php View File

@@ -1,7 +1,6 @@
<?php
class LggrState
{
class LggrState {
const SESSIONNAME = 'LggrState';
@@ -24,7 +23,8 @@ class LggrState
private $sLevel = null;
private $iRange = 24;
// default 24h = today, sort of
// default 24h = today, sort of
private $bFromTo = false;
private $tsFrom = null;
@@ -32,11 +32,11 @@ class LggrState
private $tsTo = null;
private $iResultSize = 0;
// result size of last query
// result size of last query
private $bPanelOpen = false;
function __construct()
{
function __construct() {
$this->bLocalCall = false;
$this->iPage = 0;
$this->bSearch = false;
@@ -53,100 +53,83 @@ class LggrState
$this->iResultSize = 0;
$this->bPanelOpen = false;
}
// constructor
public function setSearch($s)
{
// constructor
public function setSearch($s) {
if (null != $s) {
$this->bSearch = true;
$this->sSearch = $s;
}
}
public function isSearch()
{
public function isSearch() {
return $this->bSearch;
}
public function getSearch()
{
public function getSearch() {
return $this->sSearch;
}
public function setSearchProg($s)
{
public function setSearchProg($s) {
if (null != $s) {
$this->bSearch = true;
$this->sSearchProg = $s;
} // if
}
public function getSearchProg()
{
public function getSearchProg() {
return $this->sSearchProg;
}
public function setPage($i)
{
public function setPage($i) {
$this->iPage = $i;
}
public function getPage()
{
public function getPage() {
return $this->iPage;
}
public function setHostName($s)
{
public function setHostName($s) {
$this->sHostName = $s;
}
public function getHostName()
{
public function getHostName() {
return $this->sHostName;
}
public function setHostId($id)
{
public function setHostId($id) {
$this->iHost = $id;
}
public function getHostId()
{
public function getHostId() {
return $this->iHost;
}
public function isHost()
{
public function isHost() {
return 0 != $this->iHost;
}
public function setLevel($s)
{
public function setLevel($s) {
$this->sLevel = $s;
}
public function getLevel()
{
public function getLevel() {
return $this->sLevel;
}
public function isLevel()
{
public function isLevel() {
return null != $this->sLevel;
}
public function setRange($i)
{
public function setRange($i) {
$this->iRange = $i;
}
public function getRange()
{
public function getRange() {
return $this->iRange;
}
public function setFromTo($tsFrom, $tsTo)
{
public function setFromTo($tsFrom, $tsTo) {
if (null == $tsFrom && null == $tsTo) {
$this->bFromTo = false;
} else {
@@ -156,48 +139,39 @@ class LggrState
$this->tsTo = $tsTo;
}
public function isFromTo()
{
public function isFromTo() {
return $this->bFromTo;
}
public function getFrom()
{
public function getFrom() {
return $this->tsFrom;
}
public function getTo()
{
public function getTo() {
return $this->tsTo;
}
public function setResultSize($i)
{
public function setResultSize($i) {
$this->iResultSize = $i;
}
public function getResultSize()
{
public function getResultSize() {
return $this->iResultSize;
}
public function setLocalCall($b)
{
public function setLocalCall($b) {
$this->bLocalCall = $b;
}
public function isLocalCall()
{
public function isLocalCall() {
return $this->bLocalCall;
}
public function setPanelOpen($b)
{
public function setPanelOpen($b) {
$this->bPanelOpen = $b;
}
public function isPanelOpen()
{
public function isPanelOpen() {
return $this->bPanelOpen;
}
} // class

+ 9
- 0
inc/messagelevel_class.php View File

@@ -0,0 +1,9 @@
<?php
abstract class MessageLevel {
const EMERG = 'emerg';
const CRIT = 'crit';
const ERR = 'err';
const WARNING = 'warning';
const NOTICE = 'notice';
const INFO = 'info';
}

+ 9
- 7
inc/pre.inc.php View File

@@ -1,9 +1,10 @@
<?php
spl_autoload_register(function ($class) {
$class = strtolower($class);
$class = str_replace('\\', '/', $class);
include __DIR__ . '/' . $class . '_class.php';
});
spl_autoload_register(
function ($class) {
$class = strtolower($class);
$class = str_replace('\\', '/', $class);
include __DIR__ . '/' . $class . '_class.php';
});
$config = new Config();
@@ -14,8 +15,9 @@ if (isset($_SESSION[LggrState::SESSIONNAME])) {
} else {
$state = new LggrState();
}
// if
// if
// Uebersetzungen via gettext vorbereiten
/*
* Auf dem Server ausführen:

+ 93
- 49
index.php View File

@@ -11,8 +11,10 @@ try {
$aLevels = $l->getLevels();
$aServers = $l->getServers();
$aAllServers = $l->getAllServers();
} catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div></div>';
}
catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' .
$e->getMessage() . '</div></div>';
require 'tpl/foot.inc.php';
@@ -31,9 +33,12 @@ $page = $state->getPage();
try {
if ($state->isSearch()) {
$aEvents = $l->getText($state->getSearch(), $state->getSearchProg(), $page * LggrState::PAGELEN, LggrState::PAGELEN);
$searchvalue = htmlentities($state->getSearch(), ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$searchvalueprog = htmlentities($state->getSearchProg(), ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$aEvents = $l->getText($state->getSearch(), $state->getSearchProg(),
$page * LggrState::PAGELEN, LggrState::PAGELEN);
$searchvalue = htmlentities($state->getSearch(),
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$searchvalueprog = htmlentities($state->getSearchProg(),
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$isSearch = true;
$sFilter = _('Text search for');
if ('' != $state->getSearch()) {
@@ -46,10 +51,18 @@ try {
$host = $state->getHostName();
$aEvents = $l->getHostFromTo($page * LggrState::PAGELEN, LggrState::PAGELEN);
$aEvents = $l->getHostFromTo($page * LggrState::PAGELEN,
LggrState::PAGELEN);
$sFilter = _('Filter by time range between') . ' <strong>' . htmlentities($state->getFrom(), ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong> ' . _('and') . ' <strong>' . htmlentities($state->getTo(), ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong>, ';
$sFilter .= _('Filter by server') . ' <strong>' . htmlentities($state->getHostName(), ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong>';
$sFilter = _('Filter by time range between') . ' <strong>' .
htmlentities($state->getFrom(),
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong> ' .
_('and') . ' <strong>' .
htmlentities($state->getTo(),
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong>, ';
$sFilter .= _('Filter by server') . ' <strong>' .
htmlentities($state->getHostName(),
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong>';
$searchvalue = '';
$searchvalueprog = '';
$isSearch = false;
@@ -58,21 +71,31 @@ try {
$host = $state->getHostName();
$level = $state->getLevel();
$aEvents = $l->getFiltered($host, $level, $page * LggrState::PAGELEN, LggrState::PAGELEN);
$aEvents = $l->getFiltered($host, $level, $page * LggrState::PAGELEN,
LggrState::PAGELEN);
$searchvalue = '';
$searchvalueprog = '';
$isSearch = false;
$sFilter = '';
if ($state->isHost()) {
$sFilter .= _('Filter by server') . ' <strong>' . htmlentities($state->getHostName(), ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong>';
$sFilter .= _('Filter by server') . ' <strong>' .
htmlentities($state->getHostName(),
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong>';
}
if ($state->isLevel()) {
$sFilter .= _('Filter by level') . ' <strong>' . htmlentities($state->getLevel(), ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong>';
$sFilter .= _('Filter by level') . ' <strong>' .
htmlentities($state->getLevel(),
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong>';
}
} elseif ($state->isFromTo()) {
$aEvents = $l->getFromTo($page * LggrState::PAGELEN, LggrState::PAGELEN);
$sFilter = _('Filter by time range between') . ' <strong>' . htmlentities($state->getFrom(), ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong> ' . _('and') . ' <strong>' . htmlentities($state->getTo(), ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong>';
$sFilter = _('Filter by time range between') . ' <strong>' .
htmlentities($state->getFrom(),
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong> ' .
_('and') . ' <strong>' .
htmlentities($state->getTo(),
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES) . '</strong>';
$searchvalue = '';
$searchvalueprog = '';
$isSearch = false;
@@ -85,8 +108,10 @@ try {
$searchvalueprog = '';
$isSearch = false;
} // if search
} catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div></div>';
}
catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' .
$e->getMessage() . '</div></div>';
require 'tpl/foot.inc.php';
@@ -94,7 +119,8 @@ try {
}
if (version_compare(phpversion(), '5.4', '<')) {
echo '<div class="container"><div class="alert alert-danger" role="alert">Your PHP version ' . phpversion() . ' might be too old, expecting at least 5.4</div></div>';
echo '<div class="container"><div class="alert alert-danger" role="alert">Your PHP version ' .
phpversion() . ' might be too old, expecting at least 5.4</div></div>';
} // if
require 'tpl/nav.inc.php';
@@ -129,18 +155,18 @@ foreach ($aLevels as $level) {
$aLevelCount[$level->level] = $level->c;
$level->f = round($level->f);
switch ($level->level) {
case 'emerg':
case 'crit':
case 'err':
case MessageLevel::EMERG:
case MessageLevel::CRIT:
case MessageLevel::ERR:
$label = 'progress-bar-danger';
break;
case 'warning':
case MessageLevel::WARNING:
$label = 'progress-bar-warning';
break;
case 'notice':
case MessageLevel::NOTICE:
$label = 'progress-bar-primary';
break;
case 'info':
case MessageLevel::INFO:
$label = 'progress-bar-success';
break;
default:
@@ -158,20 +184,25 @@ EOL;
<p><?= _('Distribution of selected event levels.') ?></p>
<p class="lggr-level-buttons">
<?php
if (isset($aLevelCount['emerg'])) {
echo '<button class="btn btn-sm btn-danger" type="button">Emergency <span class="badge">' . $aLevelCount['emerg'] . '</span></button> ';
if (isset($aLevelCount[MessageLevel::EMERG])) {
echo '<button class="btn btn-sm btn-danger" type="button">Emergency <span class="badge">' .
$aLevelCount[MessageLevel::EMERG] . '</span></button> ';
}
if (isset($aLevelCount['crit'])) {
echo '<button class="btn btn-sm btn-danger" type="button">Critical <span class="badge">' . $aLevelCount['crit'] . '</span></button> ';
if (isset($aLevelCount[MessageLevel::CRIT])) {
echo '<button class="btn btn-sm btn-danger" type="button">Critical <span class="badge">' .
$aLevelCount[MessageLevel::CRIT] . '</span></button> ';
}
if (isset($aLevelCount['err'])) {
echo '<button class="btn btn-sm btn-danger" type="button">Error <span class="badge">' . $aLevelCount['err'] . '</span></button> ';
if (isset($aLevelCount[MessageLevel::ERR])) {
echo '<button class="btn btn-sm btn-danger" type="button">Error <span class="badge">' .
$aLevelCount[MessageLevel::ERR] . '</span></button> ';
}
if (isset($aLevelCount['err'])) {
echo '<button class="btn btn-sm btn-warning" type="button">Warning <span class="badge">' . $aLevelCount['warning'] . '</span></button> ';
if (isset($aLevelCount[MessageLevel::WARNING])) {
echo '<button class="btn btn-sm btn-warning" type="button">Warning <span class="badge">' .
$aLevelCount[MessageLevel::WARNING] . '</span></button> ';
}
if (isset($aLevelCount['notice'])) {
echo '<button class="btn btn-sm btn-primary" type="button">Notice <span class="badge">' . $aLevelCount['notice'] . '</span></button> ';
if (isset($aLevelCount[MessageLevel::NOTICE])) {
echo '<button class="btn btn-sm btn-primary" type="button">Notice <span class="badge">' .
$aLevelCount[MessageLevel::NOTICE] . '</span></button> ';
}
?>
</p>
@@ -225,41 +256,49 @@ foreach ($aAllServers as $server) {
} // foreach
ksort($aServerList);
foreach ($aServerList as $servername => $serverid) {
echo '<li role="presentation"><a role="menuitem" tabindex="-1" href="./do.php?a=host&hostid=' . $serverid . '">' . $servername . '</a></li>';
echo '<li role="presentation"><a role="menuitem" tabindex="-1" href="./do.php?a=host&hostid=' .
$serverid . '">' . $servername . '</a></li>';
} // foreach
?>
</ul>
</div>
<!-- dropdown -->
<div class="btn-group btn-group-xs lggr-formelement"
<!-- dropdown -->
<div
class="btn-group btn-group-xs lggr-formelement"
role="group" aria-label="level">
<?php
foreach ($aLevels as $level) {
if ($state->isLevel() && ($level->level == $state->getLevel())) {
echo '<button type="button" class="btn btn-primary newlog-level">' . $level->level . '</button>';
echo '<button type="button" class="btn btn-primary newlog-level">' .
$level->level . '</button>';
} else {
echo '<button type="button" class="btn btn-default newlog-level">' . $level->level . '</button>';
echo '<button type="button" class="btn btn-default newlog-level">' .
$level->level . '</button>';
}
} // foreach
?>
</div>
<div class="btn-group lggr-formelement" role="group"
aria-label="range">
<div class="btn-group lggr-formelement"
role="group" aria-label="range">
<?php
foreach ($aRanges as $rangeValue => $rangeText) {
if ($state->getRange() == $rangeValue) {
echo '<button type="button" class="btn btn-primary newlog-range" data-range="' . $rangeValue . '">' . $rangeText . '</button>';
echo '<button type="button" class="btn btn-primary newlog-range" data-range="' .
$rangeValue . '">' . $rangeText . '</button>';
} else {
echo '<button type="button" class="btn btn-default newlog-range" data-range="' . $rangeValue . '">' . $rangeText . '</button>';
echo '<button type="button" class="btn btn-default newlog-range" data-range="' .
$rangeValue . '">' . $rangeText . '</button>';
}
} // foreach
if ($state->isFromTo()) {
echo '<button type="button" class="btn btn-primary newlog-range" id="btnspecialrange">' . _('Special') . '</button>';
echo '<button type="button" class="btn btn-primary newlog-range" id="btnspecialrange">' .
_('Special') . '</button>';
} else {
echo '<button type="button" class="btn btn-default newlog-range" id="btnspecialrange">' . _('Special') . '</button>';
echo '<button type="button" class="btn btn-default newlog-range" id="btnspecialrange">' .
_('Special') . '</button>';
} // if
?>
@@ -309,7 +348,8 @@ if (null != $sFilter) {
} // if
if (0 == count($aEvents)) {
echo '<div class="alert alert-danger" role="alert">' . _('empty result') . '</div>';
echo '<div class="alert alert-danger" role="alert">' . _('empty result') .
'</div>';
} // if
?>
@@ -357,22 +397,26 @@ foreach ($aEvents as $event) {
$label = '<span class="label label-success">Info</span>';
break;
default:
$label = '<span class="label label-default">' . $event->level . '</span>';
$label = '<span class="label label-default">' . $event->level .
'</span>';
} // switch
switch ($event->archived) {
case 'Y':
$archived = '<span id="arch' . $event->id . '" class="lggr-archived glyphicon glyphicon-warning-sign" aria-hidden="true" title="archived"></span>';
$archived = '<span id="arch' . $event->id .
'" class="lggr-archived glyphicon glyphicon-warning-sign" aria-hidden="true" title="archived"></span>';
break;
case 'N':
$archived = '<span id="arch' . $event->id . '" class="lggr-notarchived glyphicon glyphicon-pushpin" aria-hidden="true" title=""></span>';
$archived = '<span id="arch' . $event->id .
'" class="lggr-notarchived glyphicon glyphicon-pushpin" aria-hidden="true" title=""></span>';
break;
default:
$archived = '?';
} // switch
$host = htmlentities($event->host, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$program = htmlentities($event->program, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$program = htmlentities($event->program,
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$msg = htmlentities($event->message, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
echo <<<EOL

+ 6
- 4
js/lggr_stat_data.php View File

@@ -1,9 +1,10 @@
<?php
header('Content-Type: text/javascript');
spl_autoload_register(function ($class) {
include '../inc/' . strtolower($class) . '_class.php';
});
spl_autoload_register(
function ($class) {
include '../inc/' . strtolower($class) . '_class.php';
});
$searchvalue = '';
@@ -40,7 +41,8 @@ try {
$aMsgPerHour = $l->getMessagesPerHour();
$aCloud = $l->getCloud();
} catch (LggrException $e) {
}
catch (LggrException $e) {
exit();
}

+ 10
- 5
live.php View File

@@ -9,8 +9,10 @@ try {
$l = new Lggr($state, $config);
$aEvents = $l->getLatest(0, LggrState::PAGELEN);
} catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div></div>';
}
catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' .
$e->getMessage() . '</div></div>';
require 'tpl/foot.inc.php';
@@ -27,7 +29,8 @@ require 'tpl/nav.inc.php';
<?php
if (0 == count($aEvents)) {
echo '<div class="alert alert-danger" role="alert">' . _('empty result') . '</div>';
echo '<div class="alert alert-danger" role="alert">' . _('empty result') .
'</div>';
} // if
?>
@@ -80,11 +83,13 @@ foreach ($aEvents as $event) {
$label = '<span class="label label-success">Info</span>';
break;
default:
$label = '<span class="label label-default">' . $event->level . '</span>';
$label = '<span class="label label-default">' . $event->level .
'</span>';
} // switch
$host = htmlentities($event->host, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$program = htmlentities($event->program, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$program = htmlentities($event->program,
ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
$msg = htmlentities($event->message, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
echo <<<EOL

+ 1
- 1
sonar-project.properties View File

@@ -2,7 +2,7 @@
sonar.projectKey=lggr
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=Lggr
sonar.projectVersion=1.0
sonar.projectVersion=1.1
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.

+ 6
- 5
stats.php View File

@@ -21,8 +21,10 @@ try {
$aArchivedStatistic = $aArchivedStatistic[0];
$aMsgPerHour = $l->getMessagesPerHour();
} catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div></div>';
}
catch (LggrException $e) {
echo '<div class="container"><div class="alert alert-danger" role="alert">' .
$e->getMessage() . '</div></div>';
require 'tpl/foot.inc.php';
@@ -76,6 +78,5 @@ require 'tpl/nav.inc.php';
<!-- container -->
<?php
$aPerf = $l->getPerf();
require 'tpl/foot.inc.php'
?>
$aPerf = $l->getPerf();
require 'tpl/foot.inc.php'?>

+ 10
- 5
tpl/foot.inc.php View File

@@ -18,9 +18,14 @@ if (isset($_COOKIE['PHPSESSID'])) {
} else {
$dbgsession = '-';
} // if
if (isset($_SERVER['REMOTE_USER'])) {
$remoteUser = $_SERVER['REMOTE_USER'];
} else {
$remoteUser = 'ANONYMOUS';
} // if
?>
<p class="debugfooter"><?= $pCount ?> <?= _('queries in') ?> <?= $pTime ?> <?= _('seconds') ?>. <?= _('Session') ?>: <?= $dbgsession ?> <?= _('by') ?> <?= htmlentities($_SERVER['REMOTE_USER']) ?></p>
<p class="debugfooter"><?=$pCount?> <?=_('queries in')?> <?=$pTime?> <?=_('seconds')?>. <?=_('Session')?>: <?=$dbgsession?> <?=_('by')?> <?=htmlentities($remoteUser)?></p>
<p>
&copy; <a href="http://lggr.io" target="_blank">lggr.io</a>
2018
@@ -30,12 +35,12 @@ if (isset($_COOKIE['PHPSESSID'])) {
<!-- /container -->

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="<?= $config->getUrlJquery() ?>jquery-1.11.3.min.js"></script>
<script src="<?= $config->getUrlJqueryui() ?>jquery-ui.min.js"></script>
<script src="<?=$config->getUrlJquery()?>jquery-1.11.3.min.js"></script>
<script src="<?=$config->getUrlJqueryui()?>jquery-ui.min.js"></script>
<script
src="<?= $config->getUrlJAtimepicker() ?>jquery-ui-timepicker-addon.min.js"></script>
src="<?=$config->getUrlJAtimepicker()?>jquery-ui-timepicker-addon.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="<?= $config->getUrlBootstrap() ?>js/bootstrap.min.js"></script>
<script src="<?=$config->getUrlBootstrap()?>js/bootstrap.min.js"></script>