';
@@ -935,7 +1095,12 @@ switch ($action) {
echo '
';
}
- html_print_submit_button(__('Create report'), 'create', false, 'class="sub next"');
+ html_print_submit_button(
+ __('Create report'),
+ 'create',
+ false,
+ 'class="sub next"'
+ );
echo '';
echo '';
echo '
';
}
@@ -959,7 +1129,7 @@ switch ($action) {
case 'main':
$reportName = '';
$idGroupReport = 0;
- // All groups
+ // All groups.
$description = '';
$resultOperationDB = null;
$report_id_user = 0;
@@ -992,12 +1162,15 @@ switch ($action) {
$reportName = get_parameter('name');
$idGroupReport = get_parameter('id_group');
$description = get_parameter('description');
- $type_access_selected = get_parameter('type_access', 'group_view');
+ $type_access_selected = get_parameter(
+ 'type_access',
+ 'group_view'
+ );
$id_group_edit_param = (int) get_parameter('id_group_edit', 0);
$report_id_user = get_parameter('report_id_user');
$non_interactive = get_parameter('non_interactive', 0);
- // Pretty font by default for pdf
+ // Pretty font by default for pdf.
$custom_font = 'FreeSans.ttf';
switch ($type_access_selected) {
@@ -1054,12 +1227,12 @@ switch ($action) {
if ($resultOperationDB !== false) {
db_pandora_audit(
'Report management',
- "Update report #$idReport"
+ 'Update report #'.$idReport
);
} else {
db_pandora_audit(
'Report management',
- "Fail try to update report #$idReport"
+ 'Fail try to update report #'.$idReport
);
}
} else {
@@ -1069,10 +1242,10 @@ switch ($action) {
$action = 'edit';
} else if ($action == 'save') {
if ($reportName != '' && $idGroupReport != '') {
- // This flag allow to differentiate between normal console and metaconsole reports.
+ // This flag allow to differentiate
+ // between normal console and metaconsole reports.
$metaconsole_report = (int) is_metaconsole();
- // Juanma (07/05/2014) New feature: Custom front page for reports.
if ($config['custom_report_front']) {
$custom_font = $config['custom_report_front_font'];
$logo = $config['custom_report_front_logo'];
@@ -1080,9 +1253,16 @@ switch ($action) {
$first_page = $config['custom_report_front_firstpage'];
$footer = $config['custom_report_front_footer'];
} else {
- $start_url = ui_get_full_url(false, false, false, false);
+ $start_url = ui_get_full_url(
+ false,
+ false,
+ false,
+ false
+ );
$first_page = '<p style="text-align: center;"> </p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"><img src="'.$start_url.'/images/pandora_report_logo.png" alt="" width="800" /></p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p>
<p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>';
- $logo = $header = $footer = null;
+ $logo = null;
+ $header = null;
+ $footer = null;
}
$idOrResult = db_process_sql_insert(
@@ -1105,9 +1285,15 @@ switch ($action) {
);
if ($idOrResult !== false) {
- db_pandora_audit('Report management', "Create report #$idOrResult");
+ db_pandora_audit(
+ 'Report management',
+ 'Create report #'.$idOrResult
+ );
} else {
- db_pandora_audit('Report management', 'Fail try to create report');
+ db_pandora_audit(
+ 'Report management',
+ 'Fail try to create report'
+ );
}
} else {
$idOrResult = false;
@@ -1121,7 +1307,7 @@ switch ($action) {
$report_id_user = $config['id_user'];
}
- $action = $resultOperationDB ? 'edit' : 'new';
+ $action = ($resultOperationDB) ? 'edit' : 'new';
}
break;
@@ -1132,9 +1318,6 @@ switch ($action) {
['id_report' => $idReport]
);
-
-
-
$reportName = $report['name'];
$idGroupReport = $report['id_group'];
$description = $report['description'];
@@ -1143,20 +1326,23 @@ switch ($action) {
case 'update':
$values = [];
$values['id_report'] = $idReport;
- // ---------------------------------------------------
- // $values['name'] = (string) get_parameter('name');
$values['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null);
$values['recursion'] = get_parameter('recursion', null);
$label = get_parameter('label', '');
- // Add macros name
+ // Add macros name.
$items_label = [];
$items_label['type'] = get_parameter('type');
$items_label['id_agent'] = get_parameter('id_agent');
- $items_label['id_agent_module'] = get_parameter('id_agent_module');
+ $items_label['id_agent_module'] = get_parameter(
+ 'id_agent_module'
+ );
$name_it = (string) get_parameter('name');
- $values['name'] = reporting_label_macro($items_label, $name_it);
+ $values['name'] = reporting_label_macro(
+ $items_label,
+ $name_it
+ );
/*
Added support for projection graphs,
@@ -1168,7 +1354,9 @@ switch ($action) {
switch ($values['type']) {
case 'projection_graph':
$values['period'] = get_parameter('period1');
- $values['top_n_value'] = get_parameter('period2');
+ $values['top_n_value'] = get_parameter(
+ 'period2'
+ );
$values['text'] = get_parameter('text');
$good_format = true;
break;
@@ -1191,16 +1379,29 @@ switch ($action) {
case 'prediction_date':
$values['period'] = get_parameter('period1');
- $values['top_n'] = get_parameter('radiobutton_max_min_avg');
- $values['top_n_value'] = get_parameter('quantity');
+ $values['top_n'] = get_parameter(
+ 'radiobutton_max_min_avg'
+ );
+ $values['top_n_value'] = get_parameter(
+ 'quantity'
+ );
$interval_max = get_parameter('max_interval');
$interval_min = get_parameter('min_interval');
// Checks intervals fields.
- if (preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_max) and preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_min)) {
+ if (preg_match(
+ '/^(\-)*[0-9]*\.?[0-9]+$/',
+ $interval_max
+ )
+ && preg_match(
+ '/^(\-)*[0-9]*\.?[0-9]+$/',
+ $interval_min
+ )
+ ) {
$good_format = true;
}
- $intervals = get_parameter('max_interval').';'.get_parameter('min_interval');
+ $intervals = get_parameter('max_interval').';';
+ $intervals .= get_parameter('min_interval');
$values['text'] = $intervals;
break;
@@ -1211,19 +1412,32 @@ switch ($action) {
case 'SLA':
case 'availability_graph':
$values['period'] = get_parameter('period');
- $values['top_n'] = get_parameter('combo_sla_sort_options', 0);
- $values['top_n_value'] = get_parameter('quantity');
+ $values['top_n'] = get_parameter(
+ 'combo_sla_sort_options',
+ 0
+ );
+ $values['top_n_value'] = get_parameter(
+ 'quantity'
+ );
$values['text'] = get_parameter('text');
- $values['show_graph'] = get_parameter('combo_graph_options');
+ $values['show_graph'] = get_parameter(
+ 'combo_graph_options'
+ );
$good_format = true;
break;
case 'agent_module':
$agents_to_report = get_parameter('id_agents2');
- $modules_to_report = get_parameter('module', '');
+ $modules_to_report = get_parameter(
+ 'module',
+ ''
+ );
- $es['module'] = get_same_modules($agents_to_report, $modules_to_report);
+ $es['module'] = get_same_modules(
+ $agents_to_report,
+ $modules_to_report
+ );
$es['id_agents'] = $agents_to_report;
$values['external_source'] = json_encode($es);
@@ -1234,7 +1448,9 @@ switch ($action) {
$values['period'] = 0;
$es['date'] = get_parameter('date');
$es['id_agents'] = get_parameter('id_agents');
- $es['inventory_modules'] = get_parameter('inventory_modules');
+ $es['inventory_modules'] = get_parameter(
+ 'inventory_modules'
+ );
$description = get_parameter('description');
$values['external_source'] = json_encode($es);
$good_format = true;
@@ -1243,7 +1459,9 @@ switch ($action) {
case 'inventory_changes':
$values['period'] = get_parameter('period');
$es['id_agents'] = get_parameter('id_agents');
- $es['inventory_modules'] = get_parameter('inventory_modules');
+ $es['inventory_modules'] = get_parameter(
+ 'inventory_modules'
+ );
$description = get_parameter('description');
$values['external_source'] = json_encode($es);
$good_format = true;
@@ -1252,38 +1470,74 @@ switch ($action) {
case 'netflow_area':
case 'netflow_data':
case 'netflow_summary':
- $values['text'] = get_parameter('netflow_filter');
- $values['description'] = get_parameter('description');
+ $values['text'] = get_parameter(
+ 'netflow_filter'
+ );
+ $values['description'] = get_parameter(
+ 'description'
+ );
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('resolution');
- $values['top_n_value'] = get_parameter('max_values');
+ $values['top_n_value'] = get_parameter(
+ 'max_values'
+ );
$good_format = true;
break;
case 'availability':
// HACK it is saved in show_graph field.
// Show interfaces instead the modules.
- $values['show_graph'] = get_parameter('checkbox_show_address_agent');
- $values['period'] = get_parameter('period');
- $values['total_time'] = get_parameter('total_time');
- $values['time_failed'] = get_parameter('time_failed');
- $values['time_in_ok_status'] = get_parameter('time_in_ok_status');
- $values['time_in_unknown_status'] = get_parameter('time_in_unknown_status');
- $values['time_of_not_initialized_module'] = get_parameter('time_of_not_initialized_module');
- $values['time_of_downtime'] = get_parameter('time_of_downtime');
- $values['total_checks'] = get_parameter('total_checks');
- $values['checks_failed'] = get_parameter('checks_failed');
- $values['checks_in_ok_status'] = get_parameter('checks_in_ok_status');
- $values['unknown_checks'] = get_parameter('unknown_checks');
- $values['agent_max_value'] = get_parameter('agent_max_value');
- $values['agent_min_value'] = get_parameter('agent_min_value');
+ $values['show_graph'] = get_parameter(
+ 'checkbox_show_address_agent'
+ );
+ $values['period'] = get_parameter(
+ 'period'
+ );
+ $values['total_time'] = get_parameter(
+ 'total_time'
+ );
+ $values['time_failed'] = get_parameter(
+ 'time_failed'
+ );
+ $values['time_in_ok_status'] = get_parameter(
+ 'time_in_ok_status'
+ );
+ $values['time_in_unknown_status'] = get_parameter(
+ 'time_in_unknown_status'
+ );
+ $values['time_of_not_initialized_module'] = get_parameter(
+ 'time_of_not_initialized_module'
+ );
+ $values['time_of_downtime'] = get_parameter(
+ 'time_of_downtime'
+ );
+ $values['total_checks'] = get_parameter(
+ 'total_checks'
+ );
+ $values['checks_failed'] = get_parameter(
+ 'checks_failed'
+ );
+ $values['checks_in_ok_status'] = get_parameter(
+ 'checks_in_ok_status'
+ );
+ $values['unknown_checks'] = get_parameter(
+ 'unknown_checks'
+ );
+ $values['agent_max_value'] = get_parameter(
+ 'agent_max_value'
+ );
+ $values['agent_min_value'] = get_parameter(
+ 'agent_min_value'
+ );
$good_format = true;
break;
case 'simple_graph':
case 'simple_baseline_graph':
// HACK it is saved in show_graph field.
- $values['show_graph'] = (int) get_parameter('time_compare_overlapped');
+ $values['show_graph'] = (int) get_parameter(
+ 'time_compare_overlapped'
+ );
$values['period'] = get_parameter('period');
$good_format = true;
break;
@@ -1292,24 +1546,37 @@ switch ($action) {
case 'max_value':
case 'avg_value':
$values['period'] = get_parameter('period');
- $values['lapse_calc'] = get_parameter('lapse_calc');
+ $values['lapse_calc'] = get_parameter(
+ 'lapse_calc'
+ );
$values['lapse'] = get_parameter('lapse');
- $values['visual_format'] = get_parameter('visual_format');
+ $values['visual_format'] = get_parameter(
+ 'visual_format'
+ );
$good_format = true;
break;
case 'nt_top_n':
$values['period'] = get_parameter('period');
- $values['top_n_value'] = get_parameter('quantity');
+ $values['top_n_value'] = get_parameter(
+ 'quantity'
+ );
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
- $values['top_n'] = get_parameter('radiobutton_max_min_avg', 0);
- $values['top_n_value'] = get_parameter('quantity');
+ $values['top_n'] = get_parameter(
+ 'radiobutton_max_min_avg',
+ 0
+ );
+ $values['top_n_value'] = get_parameter(
+ 'quantity'
+ );
$values['text'] = get_parameter('text');
- $values['show_graph'] = get_parameter('combo_graph_options');
+ $values['show_graph'] = get_parameter(
+ 'combo_graph_options'
+ );
$good_format = true;
break;
}
@@ -1319,16 +1586,27 @@ switch ($action) {
$values['id_agent_module'] = '';
if (isset($values['type'])) {
- if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent') or ($values['type'] == 'agent_configuration') or ($values['type'] == 'group_configuration')) {
+ if (($values['type'] == 'alert_report_agent')
+ || ($values['type'] == 'event_report_agent')
+ || ($values['type'] == 'agent_configuration')
+ || ($values['type'] == 'group_configuration')
+ ) {
$values['id_agent_module'] = '';
} else {
- $values['id_agent_module'] = get_parameter('id_agent_module');
+ $values['id_agent_module'] = get_parameter(
+ 'id_agent_module'
+ );
}
} else {
- $values['id_agent_module'] = get_parameter('id_agent_module');
+ $values['id_agent_module'] = get_parameter(
+ 'id_agent_module'
+ );
}
- $values['only_display_wrong'] = (int) get_parameter('checkbox_only_display_wrong', 0);
+ $values['only_display_wrong'] = (int) get_parameter(
+ 'checkbox_only_display_wrong',
+ 0
+ );
$values['monday'] = get_parameter('monday', 0);
$values['tuesday'] = get_parameter('tuesday', 0);
$values['wednesday'] = get_parameter('wednesday', 0);
@@ -1337,105 +1615,220 @@ switch ($action) {
$values['saturday'] = get_parameter('saturday', 0);
$values['sunday'] = get_parameter('sunday', 0);
$values['total_time'] = get_parameter('total_time', 0);
- $values['time_failed'] = get_parameter('time_failed', 0);
- $values['time_in_ok_status'] = get_parameter('time_in_ok_status', 0);
- $values['time_in_unknown_status'] = get_parameter('time_in_unknown_status', 0);
- $values['time_of_not_initialized_module'] = get_parameter('time_of_not_initialized_module', 0);
- $values['time_of_downtime'] = get_parameter('time_of_downtime', 0);
- $values['total_checks'] = get_parameter('total_checks', 0);
- $values['checks_failed'] = get_parameter('checks_failed', 0);
- $values['checks_in_ok_status'] = get_parameter('checks_in_ok_status', 0);
- $values['unknown_checks'] = get_parameter('unknown_checks', 0);
- $values['agent_max_value'] = get_parameter('agent_max_value', 0);
- $values['agent_min_value'] = get_parameter('agent_min_value', 0);
+ $values['time_failed'] = get_parameter(
+ 'time_failed',
+ 0
+ );
+ $values['time_in_ok_status'] = get_parameter(
+ 'time_in_ok_status',
+ 0
+ );
+ $values['time_in_unknown_status'] = get_parameter(
+ 'time_in_unknown_status',
+ 0
+ );
+ $values['time_of_not_initialized_module'] = get_parameter(
+ 'time_of_not_initialized_module',
+ 0
+ );
+ $values['time_of_downtime'] = get_parameter(
+ 'time_of_downtime',
+ 0
+ );
+ $values['total_checks'] = get_parameter(
+ 'total_checks',
+ 0
+ );
+ $values['checks_failed'] = get_parameter(
+ 'checks_failed',
+ 0
+ );
+ $values['checks_in_ok_status'] = get_parameter(
+ 'checks_in_ok_status',
+ 0
+ );
+ $values['unknown_checks'] = get_parameter(
+ 'unknown_checks',
+ 0
+ );
+ $values['agent_max_value'] = get_parameter(
+ 'agent_max_value',
+ 0
+ );
+ $values['agent_min_value'] = get_parameter(
+ 'agent_min_value',
+ 0
+ );
- switch ($config['dbtype']) {
- case 'mysql':
- case 'postgresql':
- $values['time_from'] = get_parameter('time_from');
- $values['time_to'] = get_parameter('time_to');
- break;
+ $values['time_from'] = get_parameter(
+ 'time_from'
+ );
+ $values['time_to'] = get_parameter('time_to');
- case 'oracle':
- $values['time_from'] = '#to_date(\''.get_parameter('time_from').'\',\'hh24:mi:ss\')';
- $values['time_to'] = '#to_date(\''.get_parameter('time_to').'\', \'hh24:mi:ss\')';
- break;
-
- default:
- // Default.
- break;
- }
-
- $values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
- $values['show_resume'] = get_parameter('checkbox_show_resume');
- $values['order_uptodown'] = get_parameter('radiobutton_order_uptodown');
- $values['exception_condition'] = (int) get_parameter('exception_condition', 0);
- $values['exception_condition_value'] = get_parameter('exception_condition_value');
- $values['id_module_group'] = get_parameter('combo_modulegroup');
+ $values['group_by_agent'] = get_parameter(
+ 'checkbox_row_group_by_agent'
+ );
+ $values['show_resume'] = get_parameter(
+ 'checkbox_show_resume'
+ );
+ $values['order_uptodown'] = get_parameter(
+ 'radiobutton_order_uptodown'
+ );
+ $values['exception_condition'] = (int) get_parameter(
+ 'exception_condition',
+ 0
+ );
+ $values['exception_condition_value'] = get_parameter(
+ 'exception_condition_value'
+ );
+ $values['id_module_group'] = get_parameter(
+ 'combo_modulegroup'
+ );
$values['id_group'] = get_parameter('combo_group');
$values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
- $connection = metaconsole_get_connection_by_id($server_id);
+ $connection = metaconsole_get_connection_by_id(
+ $server_id
+ );
$values['server_name'] = $connection['server_name'];
}
if ($values['server_name'] == '') {
- $values['server_name'] = get_parameter('combo_server');
+ $values['server_name'] = get_parameter(
+ 'combo_server'
+ );
}
- if ((($values['type'] == 'custom_graph') || ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
+ if ((($values['type'] == 'custom_graph')
+ || ($values['type'] == 'automatic_custom_graph'))
+ && ($values['id_gs'] == 0 || $values['id_gs'] == '')
+ ) {
$resultOperationDB = false;
break;
}
- $show_summary_group = get_parameter('show_summary_group', 0);
- $filter_event_severity = get_parameter('filter_event_severity', 0);
- $filter_event_type = get_parameter('filter_event_type', '');
- $filter_event_status = get_parameter('filter_event_status', 0);
+ $show_summary_group = get_parameter(
+ 'show_summary_group',
+ 0
+ );
+ $filter_event_severity = get_parameter(
+ 'filter_event_severity',
+ 0
+ );
+ $filter_event_type = get_parameter(
+ 'filter_event_type',
+ ''
+ );
+ $filter_event_status = get_parameter(
+ 'filter_event_status',
+ 0
+ );
- $event_graph_by_agent = get_parameter('event_graph_by_agent', 0);
- $event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
- $event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
- $event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
+ $event_graph_by_agent = get_parameter(
+ 'event_graph_by_agent',
+ 0
+ );
+ $event_graph_by_user_validator = get_parameter(
+ 'event_graph_by_user_validator',
+ 0
+ );
+ $event_graph_by_criticity = get_parameter(
+ 'event_graph_by_criticity',
+ 0
+ );
+ $event_graph_validated_vs_unvalidated = get_parameter(
+ 'event_graph_validated_vs_unvalidated',
+ 0
+ );
- $event_filter_search = get_parameter('filter_search', '');
+ $event_filter_search = get_parameter(
+ 'filter_search',
+ ''
+ );
// If metaconsole is activated.
- if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
- if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) {
- $id_gs = substr($values['id_gs'], 0, strpos($values['id_gs'], '|'));
+ if ($config['metaconsole'] == 1
+ && defined('METACONSOLE')
+ ) {
+ if (($values['type'] == 'custom_graph')
+ || ($values['type'] == 'automatic_custom_graph')
+ ) {
+ $id_gs = substr(
+ $values['id_gs'],
+ 0,
+ strpos($values['id_gs'], '|')
+ );
if ($id_gs !== false) {
- $server_name = strstr($values['id_gs'], '|');
+ $server_name = strstr(
+ $values['id_gs'],
+ '|'
+ );
$values['id_gs'] = $id_gs;
- $values['server_name'] = substr($server_name, 1, strlen($server_name));
+ $values['server_name'] = substr(
+ $server_name,
+ 1,
+ strlen($server_name)
+ );
}
}
// Get agent and server name.
- $agent_name_server = io_safe_output(get_parameter('agent'));
+ $agent_name_server = io_safe_output(
+ get_parameter('agent')
+ );
if (isset($agent_name_server)) {
- $separator_pos = strpos($agent_name_server, '(');
+ $separator_pos = strpos(
+ $agent_name_server,
+ '('
+ );
- if (($separator_pos != false) and ($separator_pos != 0)) {
- $server_name = substr($agent_name_server, $separator_pos);
- $server_name = str_replace('(', '', $server_name);
- $server_name = str_replace(')', '', $server_name);
+ if (($separator_pos != false)
+ || ($separator_pos != 0)
+ ) {
+ $server_name = substr(
+ $agent_name_server,
+ $separator_pos
+ );
+ $server_name = str_replace(
+ '(',
+ '',
+ $server_name
+ );
+ $server_name = str_replace(
+ ')',
+ '',
+ $server_name
+ );
// Will update server_name variable.
$values['server_name'] = trim($server_name);
- $agent_name = substr($agent_name_server, 0, $separator_pos);
+ $agent_name = substr(
+ $agent_name_server,
+ 0,
+ $separator_pos
+ );
}
}
}
- if (($values['type'] == 'sql') or ($values['type'] == 'sql_graph_hbar') or ($values['type'] == 'sql_graph_vbar') or ($values['type'] == 'sql_graph_pie')) {
- $values['treport_custom_sql_id'] = get_parameter('id_custom');
+ if (($values['type'] == 'sql')
+ || ($values['type'] == 'sql_graph_hbar')
+ || ($values['type'] == 'sql_graph_vbar')
+ || ($values['type'] == 'sql_graph_pie')
+ ) {
+ $values['treport_custom_sql_id'] = get_parameter(
+ 'id_custom'
+ );
if ($values['treport_custom_sql_id'] == 0) {
- $values['external_source'] = get_parameter('sql');
+ $values['external_source'] = get_parameter(
+ 'sql'
+ );
}
- $values['historical_db'] = get_parameter('historical_db_check');
+ $values['historical_db'] = get_parameter(
+ 'historical_db_check'
+ );
$values['top_n_value'] = get_parameter('max_items');
} else if ($values['type'] == 'url') {
$values['external_source'] = get_parameter('url');
@@ -1447,22 +1840,45 @@ switch ($action) {
$values['column_separator'] = get_parameter('field');
$values['line_separator'] = get_parameter('line');
+ $values['current_month'] = get_parameter('current_month');
+
$style = [];
- $style['show_in_same_row'] = get_parameter('show_in_same_row', 0);
- $style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
- $style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
- $style['priority_mode'] = get_parameter('priority_mode', REPORT_PRIORITY_MODE_OK);
- $style['dyn_height'] = get_parameter('dyn_height', 230);
+ $style['show_in_same_row'] = get_parameter(
+ 'show_in_same_row',
+ 0
+ );
+ $style['show_in_landscape'] = get_parameter(
+ 'show_in_landscape',
+ 0
+ );
+ $style['hide_notinit_agents'] = get_parameter(
+ 'hide_notinit_agents',
+ 0
+ );
+ $style['priority_mode'] = get_parameter(
+ 'priority_mode',
+ REPORT_PRIORITY_MODE_OK
+ );
+ $style['dyn_height'] = get_parameter(
+ 'dyn_height',
+ 230
+ );
switch ($values['type']) {
case 'event_report_agent':
case 'event_report_group':
case 'event_report_module':
- // Added for events items
- $style['show_summary_group'] = $show_summary_group;
- $style['filter_event_severity'] = json_encode($filter_event_severity);
- $style['filter_event_type'] = json_encode($filter_event_type);
- $style['filter_event_status'] = json_encode($filter_event_status);
+ // Added for events items.
+ $style['show_summary_group'] = $show_summary_group;
+ $style['filter_event_severity'] = json_encode(
+ $filter_event_severity
+ );
+ $style['filter_event_type'] = json_encode(
+ $filter_event_type
+ );
+ $style['filter_event_status'] = json_encode(
+ $filter_event_status
+ );
$style['event_graph_by_agent'] = $event_graph_by_agent;
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
@@ -1478,10 +1894,15 @@ switch ($action) {
break;
case 'simple_graph':
- // Warning. We are using this column to hold this value to avoid
- // the modification of the database for compatibility reasons.
- $style['percentil'] = (int) get_parameter('percentil');
- $style['fullscale'] = (int) get_parameter('fullscale');
+ // Warning. We are using this column to hold
+ // this value to avoid the modification of the
+ // database for compatibility reasons.
+ $style['percentil'] = (int) get_parameter(
+ 'percentil'
+ );
+ $style['fullscale'] = (int) get_parameter(
+ 'fullscale'
+ );
if ($label != '') {
$style['label'] = $label;
} else {
@@ -1490,7 +1911,9 @@ switch ($action) {
break;
case 'network_interfaces_report':
- $style['fullscale'] = (int) get_parameter('fullscale');
+ $style['fullscale'] = (int) get_parameter(
+ 'fullscale'
+ );
break;
case 'module_histogram_graph':
@@ -1553,11 +1976,9 @@ switch ($action) {
break;
case 'save':
-
$values = [];
$values['id_report'] = $idReport;
$values['type'] = get_parameter('type', null);
- // $values['name'] = (string) get_parameter('name');
$values['description'] = get_parameter('description');
$label = get_parameter('label', '');
@@ -1565,42 +1986,71 @@ switch ($action) {
$items_label = [];
$items_label['type'] = get_parameter('type');
$items_label['id_agent'] = get_parameter('id_agent');
- $items_label['id_agent_module'] = get_parameter('id_agent_module');
+ $items_label['id_agent_module'] = get_parameter(
+ 'id_agent_module'
+ );
$name_it = (string) get_parameter('name');
$values['recursion'] = get_parameter('recursion', null);
- $values['name'] = reporting_label_macro($items_label, $name_it);
+ $values['name'] = reporting_label_macro(
+ $items_label,
+ $name_it
+ );
- // Support for projection graph, prediction date and SLA reports
- // 'top_n_value', 'top_n' and 'text' fields will be reused for these types of report.
+ // Support for projection graph, prediction date
+ // and SLA reports 'top_n_value', 'top_n' and 'text'
+ // fields will be reused for these types of report.
switch ($values['type']) {
case 'projection_graph':
$values['period'] = get_parameter('period1');
- $values['top_n_value'] = get_parameter('period2');
+ $values['top_n_value'] = get_parameter(
+ 'period2'
+ );
$values['text'] = get_parameter('text');
$good_format = true;
break;
case 'prediction_date':
$values['period'] = get_parameter('period1');
- $values['top_n'] = get_parameter('radiobutton_max_min_avg');
- $values['top_n_value'] = get_parameter('quantity');
+ $values['top_n'] = get_parameter(
+ 'radiobutton_max_min_avg'
+ );
+ $values['top_n_value'] = get_parameter(
+ 'quantity'
+ );
$interval_max = get_parameter('max_interval');
$interval_min = get_parameter('min_interval');
- // Checks intervals fields
- if (preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_max) and preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_min)) {
+ // Checks intervals fields.
+ if (preg_match(
+ '/^(\-)*[0-9]*\.?[0-9]+$/',
+ $interval_max
+ )
+ && preg_match(
+ '/^(\-)*[0-9]*\.?[0-9]+$/',
+ $interval_min
+ )
+ ) {
$good_format = true;
}
- $intervals = get_parameter('max_interval').';'.get_parameter('min_interval');
+ $intervals = get_parameter(
+ 'max_interval'
+ ).';'.get_parameter('min_interval');
$values['text'] = $intervals;
break;
case 'SLA':
$values['period'] = get_parameter('period');
- $values['top_n'] = get_parameter('combo_sla_sort_options', 0);
- $values['top_n_value'] = get_parameter('quantity');
+ $values['top_n'] = get_parameter(
+ 'combo_sla_sort_options',
+ 0
+ );
+ $values['top_n_value'] = get_parameter(
+ 'quantity'
+ );
$values['text'] = get_parameter('text');
- $values['show_graph'] = get_parameter('combo_graph_options');
+ $values['show_graph'] = get_parameter(
+ 'combo_graph_options'
+ );
$good_format = true;
break;
@@ -1609,7 +2059,9 @@ switch ($action) {
$values['period'] = 0;
$es['date'] = get_parameter('date');
$es['id_agents'] = get_parameter('id_agents');
- $es['inventory_modules'] = get_parameter('inventory_modules');
+ $es['inventory_modules'] = get_parameter(
+ 'inventory_modules'
+ );
$values['external_source'] = json_encode($es);
$good_format = true;
break;
@@ -1632,9 +2084,15 @@ switch ($action) {
case 'agent_module':
$agents_to_report = get_parameter('id_agents2');
- $modules_to_report = get_parameter('module', '');
+ $modules_to_report = get_parameter(
+ 'module',
+ ''
+ );
- $es['module'] = get_same_modules($agents_to_report, $modules_to_report);
+ $es['module'] = get_same_modules(
+ $agents_to_report,
+ $modules_to_report
+ );
$es['id_agents'] = $agents_to_report;
$values['external_source'] = json_encode($es);
@@ -1644,7 +2102,9 @@ switch ($action) {
case 'inventory_changes':
$values['period'] = get_parameter('period');
$es['id_agents'] = get_parameter('id_agents');
- $es['inventory_modules'] = get_parameter('inventory_modules');
+ $es['inventory_modules'] = get_parameter(
+ 'inventory_modules'
+ );
$values['external_source'] = json_encode($es);
$good_format = true;
break;
@@ -1662,11 +2122,17 @@ switch ($action) {
case 'netflow_area':
case 'netflow_data':
case 'netflow_summary':
- $values['text'] = get_parameter('netflow_filter');
- $values['description'] = get_parameter('description');
+ $values['text'] = get_parameter(
+ 'netflow_filter'
+ );
+ $values['description'] = get_parameter(
+ 'description'
+ );
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('resolution');
- $values['top_n_value'] = get_parameter('max_values');
+ $values['top_n_value'] = get_parameter(
+ 'max_values'
+ );
$good_format = true;
break;
@@ -1674,14 +2140,18 @@ switch ($action) {
$values['period'] = get_parameter('period');
// HACK it is saved in show_graph field.
// Show interfaces instead the modules.
- $values['show_graph'] = get_parameter('checkbox_show_address_agent');
+ $values['show_graph'] = get_parameter(
+ 'checkbox_show_address_agent'
+ );
$good_format = true;
break;
case 'simple_graph':
case 'simple_baseline_graph':
// HACK it is saved in show_graph field.
- $values['show_graph'] = (int) get_parameter('time_compare_overlapped');
+ $values['show_graph'] = (int) get_parameter(
+ 'time_compare_overlapped'
+ );
$values['period'] = get_parameter('period');
$good_format = true;
break;
@@ -1690,24 +2160,37 @@ switch ($action) {
case 'max_value':
case 'avg_value':
$values['period'] = get_parameter('period');
- $values['lapse_calc'] = get_parameter('lapse_calc');
+ $values['lapse_calc'] = get_parameter(
+ 'lapse_calc'
+ );
$values['lapse'] = get_parameter('lapse');
- $values['visual_format'] = get_parameter('visual_format');
+ $values['visual_format'] = get_parameter(
+ 'visual_format'
+ );
$good_format = true;
break;
case 'nt_top_n':
- $values['top_n_value'] = get_parameter('quantity');
+ $values['top_n_value'] = get_parameter(
+ 'quantity'
+ );
$values['period'] = get_parameter('period');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
- $values['top_n'] = get_parameter('radiobutton_max_min_avg', 0);
- $values['top_n_value'] = get_parameter('quantity');
+ $values['top_n'] = get_parameter(
+ 'radiobutton_max_min_avg',
+ 0
+ );
+ $values['top_n_value'] = get_parameter(
+ 'quantity'
+ );
$values['text'] = get_parameter('text');
- $values['show_graph'] = get_parameter('combo_graph_options');
+ $values['show_graph'] = get_parameter(
+ 'combo_graph_options'
+ );
$good_format = true;
break;
}
@@ -1717,42 +2200,37 @@ switch ($action) {
$values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
- $connection = metaconsole_get_connection_by_id($server_id);
+ $connection = metaconsole_get_connection_by_id(
+ $server_id
+ );
$values['server_name'] = $connection['server_name'];
}
if ($values['server_name'] == '') {
- $values['server_name'] = get_parameter('combo_server');
+ $values['server_name'] = get_parameter(
+ 'combo_server'
+ );
}
$values['id_agent'] = get_parameter('id_agent');
$values['id_gs'] = get_parameter('id_custom_graph');
- if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent') or ($values['type'] == 'agent_configuration') or ($values['type'] == 'group_configuration')) {
+ if (($values['type'] == 'alert_report_agent')
+ || ($values['type'] == 'event_report_agent')
+ || ($values['type'] == 'agent_configuration')
+ || ($values['type'] == 'group_configuration')
+ ) {
$values['id_agent_module'] = '';
} else {
- $values['id_agent_module'] = get_parameter('id_agent_module');
+ $values['id_agent_module'] = get_parameter(
+ 'id_agent_module'
+ );
}
- switch ($config['dbtype']) {
- case 'mysql':
- case 'postgresql':
- $values['only_display_wrong'] = (int) get_parameter('checkbox_only_display_wrong', 0);
- break;
-
- case 'oracle':
- $only_display_wrong_tmp = get_parameter('checkbox_only_display_wrong');
- if (empty($only_display_wrong_tmp)) {
- $values['only_display_wrong'] = 0;
- } else {
- $values['only_display_wrong'] = $only_display_wrong_tmp;
- }
- break;
-
- default:
- // Default.
- break;
- }
+ $values['only_display_wrong'] = (int) get_parameter(
+ 'checkbox_only_display_wrong',
+ 0
+ );
$values['monday'] = get_parameter('monday', 0);
$values['tuesday'] = get_parameter('tuesday', 0);
@@ -1762,68 +2240,132 @@ switch ($action) {
$values['saturday'] = get_parameter('saturday', 0);
$values['sunday'] = get_parameter('sunday', 0);
$values['total_time'] = get_parameter('total_time', 0);
- $values['time_failed'] = get_parameter('time_failed', 0);
- $values['time_in_ok_status'] = get_parameter('time_in_ok_status', 0);
- $values['time_in_unknown_status'] = get_parameter('time_in_unknown_status', 0);
- $values['time_of_not_initialized_module'] = get_parameter('time_of_not_initialized_module', 0);
- $values['time_of_downtime'] = get_parameter('time_of_downtime', 0);
- $values['total_checks'] = get_parameter('total_checks', 0);
- $values['checks_failed'] = get_parameter('checks_failed', 0);
- $values['checks_in_ok_status'] = get_parameter('checks_in_ok_status', 0);
- $values['unknown_checks'] = get_parameter('unknown_checks', 0);
- $values['agent_max_value'] = get_parameter('agent_max_value', 0);
- $values['agent_min_value'] = get_parameter('agent_min_value', 0);
- switch ($config['dbtype']) {
- case 'mysql':
- case 'postgresql':
- $values['time_from'] = get_parameter('time_from');
- $values['time_to'] = get_parameter('time_to');
- break;
+ $values['time_failed'] = get_parameter(
+ 'time_failed',
+ 0
+ );
+ $values['time_in_ok_status'] = get_parameter(
+ 'time_in_ok_status',
+ 0
+ );
+ $values['time_in_unknown_status'] = get_parameter(
+ 'time_in_unknown_status',
+ 0
+ );
+ $values['time_of_not_initialized_module'] = get_parameter(
+ 'time_of_not_initialized_module',
+ 0
+ );
+ $values['time_of_downtime'] = get_parameter(
+ 'time_of_downtime',
+ 0
+ );
+ $values['total_checks'] = get_parameter(
+ 'total_checks',
+ 0
+ );
+ $values['checks_failed'] = get_parameter(
+ 'checks_failed',
+ 0
+ );
+ $values['checks_in_ok_status'] = get_parameter(
+ 'checks_in_ok_status',
+ 0
+ );
+ $values['unknown_checks'] = get_parameter(
+ 'unknown_checks',
+ 0
+ );
+ $values['agent_max_value'] = get_parameter(
+ 'agent_max_value',
+ 0
+ );
+ $values['agent_min_value'] = get_parameter(
+ 'agent_min_value',
+ 0
+ );
- case 'oracle':
- $values['time_from'] = '#to_date(\''.get_parameter('time_from').'\',\'hh24:mi:ss\')';
- $values['time_to'] = '#to_date(\''.get_parameter('time_to').'\', \'hh24:mi:ss\')';
- break;
+ $values['time_from'] = get_parameter(
+ 'time_from'
+ );
+ $values['time_to'] = get_parameter('time_to');
- default:
- // Default.
- break;
- }
-
- $values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent', 0);
- $values['show_resume'] = get_parameter('checkbox_show_resume', 0);
- $values['order_uptodown'] = get_parameter('radiobutton_order_uptodown', 0);
- $values['exception_condition'] = (int) get_parameter('radiobutton_exception_condition', 0);
- $values['exception_condition_value'] = get_parameter('exception_condition_value');
- $values['id_module_group'] = get_parameter('combo_modulegroup');
+ $values['group_by_agent'] = get_parameter(
+ 'checkbox_row_group_by_agent',
+ 0
+ );
+ $values['show_resume'] = get_parameter(
+ 'checkbox_show_resume',
+ 0
+ );
+ $values['order_uptodown'] = get_parameter(
+ 'radiobutton_order_uptodown',
+ 0
+ );
+ $values['exception_condition'] = (int) get_parameter(
+ 'radiobutton_exception_condition',
+ 0
+ );
+ $values['exception_condition_value'] = get_parameter(
+ 'exception_condition_value'
+ );
+ $values['id_module_group'] = get_parameter(
+ 'combo_modulegroup'
+ );
$values['id_group'] = get_parameter('combo_group');
- if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
+ if ((($values['type'] == 'custom_graph')
+ || ($values['type'] == 'automatic_custom_graph'))
+ && ($values['id_gs'] == 0 || $values['id_gs'] == '')
+ ) {
$resultOperationDB = false;
break;
}
- if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
- if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) {
- $id_gs = substr($values['id_gs'], 0, strpos($values['id_gs'], '|'));
+ if ($config['metaconsole'] == 1
+ && defined('METACONSOLE')
+ ) {
+ if (($values['type'] == 'custom_graph')
+ || ($values['type'] == 'automatic_custom_graph')
+ ) {
+ $id_gs = substr(
+ $values['id_gs'],
+ 0,
+ strpos($values['id_gs'], '|')
+ );
if ($id_gs !== false && $id_gs !== '') {
- $server_name = strstr($values['id_gs'], '|');
+ $server_name = strstr(
+ $values['id_gs'],
+ '|'
+ );
$values['id_gs'] = $id_gs;
- $values['server_name'] = substr($server_name, 1, strlen($server_name));
+ $values['server_name'] = substr(
+ $server_name,
+ 1,
+ strlen($server_name)
+ );
}
}
}
- if (($values['type'] == 'sql') || ($values['type'] == 'sql_graph_hbar')
- || ($values['type'] == 'sql_graph_vbar') || ($values['type'] == 'sql_graph_pie')
+ if (($values['type'] == 'sql')
+ || ($values['type'] == 'sql_graph_hbar')
+ || ($values['type'] == 'sql_graph_vbar')
+ || ($values['type'] == 'sql_graph_pie')
) {
- $values['treport_custom_sql_id'] = get_parameter('id_custom');
+ $values['treport_custom_sql_id'] = get_parameter(
+ 'id_custom'
+ );
if ($values['treport_custom_sql_id'] == 0) {
- $values['external_source'] = get_parameter('sql');
+ $values['external_source'] = get_parameter(
+ 'sql'
+ );
}
- $values['historical_db'] = get_parameter('historical_db_check');
+ $values['historical_db'] = get_parameter(
+ 'historical_db_check'
+ );
$values['top_n_value'] = get_parameter('max_items');
} else if ($values['type'] == 'url') {
$values['external_source'] = get_parameter('url');
@@ -1835,38 +2377,85 @@ switch ($action) {
$values['column_separator'] = get_parameter('field');
$values['line_separator'] = get_parameter('line');
+ $values['current_month'] = get_parameter('current_month');
+
$style = [];
- $style['show_in_same_row'] = get_parameter('show_in_same_row', 0);
- $style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
- $style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
- $style['priority_mode'] = get_parameter('priority_mode', REPORT_PRIORITY_MODE_OK);
+ $style['show_in_same_row'] = get_parameter(
+ 'show_in_same_row',
+ 0
+ );
+ $style['show_in_landscape'] = get_parameter(
+ 'show_in_landscape',
+ 0
+ );
+ $style['hide_notinit_agents'] = get_parameter(
+ 'hide_notinit_agents',
+ 0
+ );
+ $style['priority_mode'] = get_parameter(
+ 'priority_mode',
+ REPORT_PRIORITY_MODE_OK
+ );
$style['dyn_height'] = get_parameter('dyn_height', 230);
switch ($values['type']) {
case 'event_report_agent':
case 'event_report_group':
case 'event_report_module':
- $show_summary_group = get_parameter('show_summary_group', 0);
- $filter_event_severity = get_parameter('filter_event_severity', '');
- $filter_event_type = get_parameter('filter_event_type', '');
- $filter_event_status = get_parameter('filter_event_status', '');
+ $show_summary_group = get_parameter(
+ 'show_summary_group',
+ 0
+ );
+ $filter_event_severity = get_parameter(
+ 'filter_event_severity',
+ ''
+ );
+ $filter_event_type = get_parameter(
+ 'filter_event_type',
+ ''
+ );
+ $filter_event_status = get_parameter(
+ 'filter_event_status',
+ ''
+ );
- $event_graph_by_agent = get_parameter('event_graph_by_agent', 0);
- $event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
- $event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
- $event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
+ $event_graph_by_agent = get_parameter(
+ 'event_graph_by_agent',
+ 0
+ );
+ $event_graph_by_user_validator = get_parameter(
+ 'event_graph_by_user_validator',
+ 0
+ );
+ $event_graph_by_criticity = get_parameter(
+ 'event_graph_by_criticity',
+ 0
+ );
+ $event_graph_validated_vs_unvalidated = get_parameter(
+ 'event_graph_validated_vs_unvalidated',
+ 0
+ );
- $event_filter_search = get_parameter('filter_search', '');
+ $event_filter_search = get_parameter(
+ 'filter_search',
+ ''
+ );
// Added for events items.
- $style['show_summary_group'] = $show_summary_group;
- $style['filter_event_severity'] = json_encode($filter_event_severity);
- $style['filter_event_type'] = json_encode($filter_event_type);
- $style['filter_event_status'] = json_encode($filter_event_status);
+ $style['show_summary_group'] = $show_summary_group;
+ $style['filter_event_severity'] = json_encode(
+ $filter_event_severity
+ );
+ $style['filter_event_type'] = json_encode(
+ $filter_event_type
+ );
+ $style['filter_event_status'] = json_encode(
+ $filter_event_status
+ );
- $style['event_graph_by_agent'] = $event_graph_by_agent;
- $style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
- $style['event_graph_by_criticity'] = $event_graph_by_criticity;
+ $style['event_graph_by_agent'] = $event_graph_by_agent;
+ $style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
+ $style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
@@ -1888,10 +2477,15 @@ switch ($action) {
break;
case 'simple_graph':
- // Warning. We are using this column to hold this value to avoid
- // the modification of the database for compatibility reasons.
- $style['percentil'] = (int) get_parameter('percentil');
- $style['fullscale'] = (int) get_parameter('fullscale');
+ // Warning. We are using this column to hold
+ // this value to avoid the modification
+ // of the database for compatibility reasons.
+ $style['percentil'] = (int) get_parameter(
+ 'percentil'
+ );
+ $style['fullscale'] = (int) get_parameter(
+ 'fullscale'
+ );
if ($label != '') {
$style['label'] = $label;
} else {
@@ -1900,7 +2494,9 @@ switch ($action) {
break;
case 'network_interfaces_report':
- $style['fullscale'] = (int) get_parameter('fullscale');
+ $style['fullscale'] = (int) get_parameter(
+ 'fullscale'
+ );
break;
case 'module_histogram_graph':
@@ -1937,21 +2533,6 @@ switch ($action) {
$values['style'] = io_safe_input(json_encode($style));
if ($good_format) {
- switch ($config['dbtype']) {
- case 'oracle':
- if (isset($values['type'])) {
- $values[db_escape_key_identifier(
- 'type'
- )] = $values['type'];
- unset($values['type']);
- }
- break;
-
- default:
- // Default.
- break;
- }
-
$result = db_process_sql_insert(
'treport_content',
$values
@@ -1962,28 +2543,11 @@ switch ($action) {
} else {
$idItem = $result;
- switch ($config['dbtype']) {
- case 'mysql':
- $max = db_get_all_rows_sql(
- 'SELECT max(`order`) AS max
- FROM treport_content
- WHERE id_report = '.$idReport.';'
- );
- break;
-
- case 'postgresql':
- case 'oracle':
- $max = db_get_all_rows_sql(
- 'SELECT max("order") AS max
- FROM treport_content
- WHERE id_report = '.$idReport
- );
- break;
-
- default:
- // Default.
- break;
- }
+ $max = db_get_all_rows_sql(
+ 'SELECT max(`order`) AS max
+ FROM treport_content
+ WHERE id_report = '.$idReport.';'
+ );
if ($max === false) {
$max = 0;
@@ -1991,39 +2555,25 @@ switch ($action) {
$max = $max[0]['max'];
}
- switch ($config['dbtype']) {
- case 'mysql':
- db_process_sql_update(
- 'treport_content',
- ['`order`' => ($max + 1)],
- ['id_rc' => $idItem]
- );
- break;
-
- case 'postgresql':
- case 'oracle':
- db_process_sql_update(
- 'treport_content',
- ['"order"' => ($max + 1)],
- ['id_rc' => $idItem]
- );
- break;
-
- default:
- // Default.
- break;
- }
+ db_process_sql_update(
+ 'treport_content',
+ ['`order`' => ($max + 1)],
+ ['id_rc' => $idItem]
+ );
$resultOperationDB = true;
}
break;
- }
-
- // If fields dont have good format.
- else {
+ } else {
+ // If fields dont have good format.
$resultOperationDB = false;
}
+ break;
+
+ default:
+ // Default.
+ break;
}
break;
@@ -2058,20 +2608,35 @@ switch ($action) {
$report = db_get_row_filter('treport', ['id_report' => $idReport]);
$reportName = $report['name'];
- $resultOperationDB = db_process_sql_delete('treport_content_sla_combined', ['id_report_content' => $idItem]);
- $resultOperationDB2 = db_process_sql_delete('treport_content_item', ['id_report_content' => $idItem]);
+ $resultOperationDB = db_process_sql_delete(
+ 'treport_content_sla_combined',
+ ['id_report_content' => $idItem]
+ );
+ $resultOperationDB2 = db_process_sql_delete(
+ 'treport_content_item',
+ ['id_report_content' => $idItem]
+ );
if ($resultOperationDB !== false) {
- $resultOperationDB = db_process_sql_delete('treport_content', ['id_rc' => $idItem]);
+ $resultOperationDB = db_process_sql_delete(
+ 'treport_content',
+ ['id_rc' => $idItem]
+ );
}
if ($resultOperationDB2 !== false) {
- $resultOperationDB2 = db_process_sql_delete('treport_content', ['id_rc' => $idItem]);
+ $resultOperationDB2 = db_process_sql_delete(
+ 'treport_content',
+ ['id_rc' => $idItem]
+ );
}
break;
case 'order':
$resultOperationDB = null;
- $report = db_get_row_filter('treport', ['id_report' => $idReport]);
+ $report = db_get_row_filter(
+ 'treport',
+ ['id_report' => $idReport]
+ );
$reportName = $report['name'];
$idGroupReport = $report['id_group'];
@@ -2142,14 +2707,17 @@ switch ($action) {
}
$ids = db_get_all_rows_sql($sql);
- }
- // Sort functionality for metaconsole.
- else if ($config['metaconsole'] == 1) {
+ } else if ($config['metaconsole'] == 1) {
+ // Sort functionality for metaconsole.
switch ($field) {
case 'agent':
case 'module':
$sql = 'SELECT id_rc, id_agent, id_agent_module, server_name FROM treport_content WHERE %s ORDER BY server_name';
- $sql = sprintf($sql, 'id_report = '.$idReport, '%s');
+ $sql = sprintf(
+ $sql,
+ 'id_report = '.$idReport,
+ '%s'
+ );
$report_items = db_get_all_rows_sql($sql);
@@ -2159,26 +2727,35 @@ switch ($action) {
if (!empty($report_items)) {
foreach ($report_items as $report_item) {
- $connection = metaconsole_get_connection($report_item['server_name']);
+ $connection = metaconsole_get_connection(
+ $report_item['server_name']
+ );
if (metaconsole_load_external_db($connection) != NOERR) {
- // ui_print_error_message ("Error connecting to ".$server_name);.
+ continue;
}
switch ($field) {
case 'agent':
- $agents_name = agents_get_agents(['id_agente' => $report_item['id_agent']], 'nombre');
+ $agents_name = agents_get_agents(
+ ['id_agente' => $report_item['id_agent']],
+ 'nombre'
+ );
// Item without agent.
if (!$agents_name) {
$element_name = '';
} else {
- $agent_name = array_shift($agents_name);
+ $agent_name = array_shift(
+ $agents_name
+ );
$element_name = $agent_name['nombre'];
}
break;
case 'module':
- $module_name = modules_get_agentmodule_name($report_item['id_agent_module']);
+ $module_name = modules_get_agentmodule_name(
+ $report_item['id_agent_module']
+ );
// Item without module.
if (!$module_name) {
@@ -2252,50 +2829,38 @@ switch ($action) {
$ids = db_get_all_rows_sql($sql);
break;
+
+ default:
+ // Default.
+ break;
}
}
$count = 1;
$resultOperationDB = true;
foreach ($ids as $id) {
- $result = db_process_sql_update('treport_content', ['order' => $count], ['id_rc' => $id['id_rc']]);
+ $result = db_process_sql_update(
+ 'treport_content',
+ ['order' => $count],
+ ['id_rc' => $id['id_rc']]
+ );
if ($result === false) {
$resultOperationDB = false;
break;
}
- $count = ($count + 1);
+ $count++;
}
break;
default:
- switch ($config['dbtype']) {
- case 'mysql':
- $oldOrder = db_get_value_sql(
- '
- SELECT `order`
- FROM treport_content
- WHERE id_rc = '.$idItem
- );
- break;
+ $oldOrder = db_get_value_sql(
+ 'SELECT `order`
+ FROM treport_content
+ WHERE id_rc = '.$idItem
+ );
- case 'postgresql':
- case 'oracle':
- $oldOrder = db_get_value_sql(
- '
- SELECT "order"
- FROM treport_content
- WHERE id_rc = '.$idItem
- );
- break;
-
- default:
- // Default.
- break;
- }
-
- // db_get_value_filter('order', 'treport_content', array('id_rc' => $idItem));
switch ($dir) {
case 'up':
$newOrder = ($oldOrder - 1);
@@ -2310,79 +2875,22 @@ switch ($action) {
break;
}
- switch ($config['dbtype']) {
- case 'mysql':
- $resultOperationDB = db_process_sql_update(
- 'treport_content',
- ['`order`' => $oldOrder],
- [
- '`order`' => $newOrder,
- 'id_report' => $idReport,
- ]
- );
- break;
+ $resultOperationDB = db_process_sql_update(
+ 'treport_content',
+ ['`order`' => $oldOrder],
+ [
+ '`order`' => $newOrder,
+ 'id_report' => $idReport,
+ ]
+ );
- case 'postgresql':
- $resultOperationDB = db_process_sql_update(
- 'treport_content',
- ['"order"' => $oldOrder],
- [
- '"order"' => $newOrder,
- 'id_report' => $idReport,
- ]
- );
- break;
-
- case 'oracle':
- $resultOperationDB = db_process_sql_update(
- 'treport_content',
- ['"order"' => $oldOrder],
- [
- '"order"' => $newOrder,
- 'id_report' => $idReport,
- ],
- 'AND',
- false
- );
- break;
-
- default:
- // Default.
- break;
- }
if ($resultOperationDB !== false) {
- switch ($config['dbtype']) {
- case 'mysql':
- $resultOperationDB = db_process_sql_update(
- 'treport_content',
- ['`order`' => $newOrder],
- ['id_rc' => $idItem]
- );
- break;
-
- case 'postgresql':
- $resultOperationDB = db_process_sql_update(
- 'treport_content',
- ['"order"' => $newOrder],
- ['id_rc' => $idItem]
- );
- break;
-
- case 'oracle':
- $resultOperationDB = db_process_sql_update(
- 'treport_content',
- ['"order"' => $newOrder],
- ['id_rc' => $idItem],
- 'AND',
- false
- );
- break;
-
- default:
- // Default.
- break;
- }
+ $resultOperationDB = db_process_sql_update(
+ 'treport_content',
+ ['`order`' => $newOrder],
+ ['id_rc' => $idItem]
+ );
}
break;
}
@@ -2408,13 +2916,16 @@ switch ($action) {
break;
default:
- $subsection = reporting_enterprise_add_subsection_main($activeTab, $buttons);
+ $subsection = reporting_enterprise_add_subsection_main(
+ $activeTab,
+ $buttons
+ );
break;
}
// Page header for metaconsole.
- if ($enterpriseEnable and defined('METACONSOLE')) {
- // Bread crumbs
+ if ($enterpriseEnable && defined('METACONSOLE')) {
+ // Bread crumbs.
ui_meta_add_breadcrumb(
[
'link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure,
@@ -2426,12 +2937,20 @@ switch ($action) {
// Print header.
ui_meta_print_header(__('Reporting'), '', $buttons);
+ } else {
+ // Page header for normal console.
+ ui_print_page_header(
+ $subsection,
+ 'images/op_reporting.png',
+ false,
+ '',
+ false,
+ $buttons,
+ false,
+ '',
+ 60
+ );
}
- // Page header for normal console.
- else {
- ui_print_page_header($subsection, 'images/op_reporting.png', false, '', false, $buttons, false, '', 60);
- }
-
reporting_enterprise_select_main_tab($action);
}
@@ -2466,7 +2985,10 @@ $buttons = [
];
if ($enterpriseEnable) {
- $buttons = reporting_enterprise_add_Tabs($buttons, $idReport);
+ $buttons = reporting_enterprise_add_Tabs(
+ $buttons,
+ $idReport
+ );
}
$buttons['view'] = [
@@ -2491,7 +3013,7 @@ if ($idReport != 0) {
}
// Page header for metaconsole.
-if ($enterpriseEnable and defined('METACONSOLE')) {
+if ($enterpriseEnable && defined('METACONSOLE')) {
// Bread crumbs.
ui_meta_add_breadcrumb(
[
@@ -2532,7 +3054,11 @@ if ($resultOperationDB !== null) {
break;
}
- ui_print_result_message($resultOperationDB, __('Successfull action'), __('Unsuccessful action
'.$err));
+ ui_print_result_message(
+ $resultOperationDB,
+ __('Successfull action'),
+ __('Unsuccessful action
'.$err)
+ );
}
switch ($activeTab) {
diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js
index 03841a342e..bc00f703c8 100755
--- a/pandora_console/godmode/reporting/visual_console_builder.editor.js
+++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js
@@ -674,12 +674,17 @@ function update_button_palette_callback() {
return false;
}
}
- if (values["module"] == 0) {
+ var radio_value = $("input[name='radio_choice']:checked").val();
+ if (values["agent"] == "" && radio_value == "module_graph") {
+ dialog_message("#message_alert_no_agent");
+ return false;
+ }
+ if (values["module"] == 0 && radio_value == "module_graph") {
dialog_message("#message_alert_no_module");
return false;
}
- if (values["agent"] == "") {
- dialog_message("#message_alert_no_agent");
+ if (values["id_custom_graph"] == 0 && radio_value == "custom_graph") {
+ dialog_message("#message_alert_no_custom_graph");
return false;
}
if ($("input[name=width_module_graph]").val() == "") {
@@ -1425,11 +1430,12 @@ function create_button_palette_callback() {
break;
case "module_graph":
- if (values["module"] == 0) {
+ var radio_value = $("input[name='radio_choice']:checked").val();
+ if (values["module"] == 0 && radio_value == "module_graph") {
dialog_message("#message_alert_no_module");
validate = false;
}
- if (values["id_custom_graph"] == 0) {
+ if (values["id_custom_graph"] == 0 && radio_value == "module_graph") {
if (values["agent"] == "") {
dialog_message("#message_alert_no_agent");
validate = false;
@@ -1439,6 +1445,10 @@ function create_button_palette_callback() {
validate = false;
}
}
+ if (values["id_custom_graph"] == 0 && radio_value == "custom_graph") {
+ dialog_message("#message_alert_no_custom_graph");
+ validate = false;
+ }
if (
values["height_module_graph"] == "" ||
values["height_module_graph"] == 0
diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php
index 645815e6c0..e205203f9d 100644
--- a/pandora_console/godmode/servers/plugin.php
+++ b/pandora_console/godmode/servers/plugin.php
@@ -1189,13 +1189,13 @@ ui_require_javascript_file('pandora_modules');
}
}
else {
- alert('');
+ alert("");
}
}
}
var macros_click_locked_event = function (event) {
- alert('');
+ alert("");
}
if (locked) {
diff --git a/pandora_console/godmode/setup/setup_ehorus.php b/pandora_console/godmode/setup/setup_ehorus.php
index fc2ebd3d3a..5492552ce1 100644
--- a/pandora_console/godmode/setup/setup_ehorus.php
+++ b/pandora_console/godmode/setup/setup_ehorus.php
@@ -139,47 +139,49 @@ if ($config['ehorus_enabled'] && !$custom_field_exists) {
ui_print_error_message($error_message);
}
+echo "