2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/reporting.ajax.php: added ajax respond to delete_sla_item and
add_sla actions.
* include/functions.php: added in the function "get_report_types" new types
of items/contents for reporting.
* pandoradb.sql: added columns custom_logo, header, first_page, footer,
custom_font into the table treport. And in the table treport_content have
new columns text, external_source, treport_custom_sql_id, header_definition,
row_separator, line_separator. Added new table treport_custom_sql.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: added changes for DB that it
same to pandoradb.sql.
* images/sort_none.png, images/sort_down.png, images/sort_up.png: added the
images for order list items for reports.
* godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: made new forms to
manage the reporting, now Pandora have tabs and list of items. In the list
of items, you can order manually or automatically the items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-22 21:01:47 +02:00
|
|
|
<?php
|
|
|
|
|
2021-11-04 16:28:15 +01:00
|
|
|
// Pandora FMS- http://pandorafms.com
|
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/reporting.ajax.php: added ajax respond to delete_sla_item and
add_sla actions.
* include/functions.php: added in the function "get_report_types" new types
of items/contents for reporting.
* pandoradb.sql: added columns custom_logo, header, first_page, footer,
custom_font into the table treport. And in the table treport_content have
new columns text, external_source, treport_custom_sql_id, header_definition,
row_separator, line_separator. Added new table treport_custom_sql.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: added changes for DB that it
same to pandoradb.sql.
* images/sort_none.png, images/sort_down.png, images/sort_up.png: added the
images for order list items for reports.
* godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: made new forms to
manage the reporting, now Pandora have tabs and list of items. In the list
of items, you can order manually or automatically the items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-22 21:01:47 +02:00
|
|
|
// ==================================================
|
2020-11-27 13:52:35 +01:00
|
|
|
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/reporting.ajax.php: added ajax respond to delete_sla_item and
add_sla actions.
* include/functions.php: added in the function "get_report_types" new types
of items/contents for reporting.
* pandoradb.sql: added columns custom_logo, header, first_page, footer,
custom_font into the table treport. And in the table treport_content have
new columns text, external_source, treport_custom_sql_id, header_definition,
row_separator, line_separator. Added new table treport_custom_sql.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: added changes for DB that it
same to pandoradb.sql.
* images/sort_none.png, images/sort_down.png, images/sort_up.png: added the
images for order list items for reports.
* godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: made new forms to
manage the reporting, now Pandora have tabs and list of items. In the list
of items, you can order manually or automatically the items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-22 21:01:47 +02:00
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation; version 2
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
// Login check
|
2019-01-30 16:18:44 +01:00
|
|
|
check_login();
|
|
|
|
|
|
|
|
if (! check_acl($config['id_user'], 0, 'RW')) {
|
|
|
|
db_pandora_audit(
|
|
|
|
'ACL Violation',
|
|
|
|
'Trying to access report builder'
|
|
|
|
);
|
|
|
|
include 'general/noaccess.php';
|
|
|
|
exit;
|
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/reporting.ajax.php: added ajax respond to delete_sla_item and
add_sla actions.
* include/functions.php: added in the function "get_report_types" new types
of items/contents for reporting.
* pandoradb.sql: added columns custom_logo, header, first_page, footer,
custom_font into the table treport. And in the table treport_content have
new columns text, external_source, treport_custom_sql_id, header_definition,
row_separator, line_separator. Added new table treport_custom_sql.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: added changes for DB that it
same to pandoradb.sql.
* images/sort_none.png, images/sort_down.png, images/sort_up.png: added the
images for order list items for reports.
* godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: made new forms to
manage the reporting, now Pandora have tabs and list of items. In the list
of items, you can order manually or automatically the items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-22 21:01:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$delete_sla_item = get_parameter('delete_sla_item', 0);
|
2011-04-12 19:20:16 +02:00
|
|
|
$delete_general_item = get_parameter('delete_general_item', 0);
|
2010-04-27 17:25:32 +02:00
|
|
|
$get_custom_sql = get_parameter('get_custom_sql', 0);
|
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/reporting.ajax.php: added ajax respond to delete_sla_item and
add_sla actions.
* include/functions.php: added in the function "get_report_types" new types
of items/contents for reporting.
* pandoradb.sql: added columns custom_logo, header, first_page, footer,
custom_font into the table treport. And in the table treport_content have
new columns text, external_source, treport_custom_sql_id, header_definition,
row_separator, line_separator. Added new table treport_custom_sql.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: added changes for DB that it
same to pandoradb.sql.
* images/sort_none.png, images/sort_down.png, images/sort_up.png: added the
images for order list items for reports.
* godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: made new forms to
manage the reporting, now Pandora have tabs and list of items. In the list
of items, you can order manually or automatically the items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-22 21:01:47 +02:00
|
|
|
$add_sla = get_parameter('add_sla', 0);
|
2011-04-12 19:20:16 +02:00
|
|
|
$add_general = get_parameter('add_general', 0);
|
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/reporting.ajax.php: added ajax respond to delete_sla_item and
add_sla actions.
* include/functions.php: added in the function "get_report_types" new types
of items/contents for reporting.
* pandoradb.sql: added columns custom_logo, header, first_page, footer,
custom_font into the table treport. And in the table treport_content have
new columns text, external_source, treport_custom_sql_id, header_definition,
row_separator, line_separator. Added new table treport_custom_sql.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: added changes for DB that it
same to pandoradb.sql.
* images/sort_none.png, images/sort_down.png, images/sort_up.png: added the
images for order list items for reports.
* godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: made new forms to
manage the reporting, now Pandora have tabs and list of items. In the list
of items, you can order manually or automatically the items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-22 21:01:47 +02:00
|
|
|
$id = get_parameter('id', 0);
|
2019-01-30 16:18:44 +01:00
|
|
|
$truncate_text = get_parameter('truncate_text', 0);
|
2012-04-10 17:33:26 +02:00
|
|
|
$get_metaconsole_hash_data = get_parameter('get_metaconsole_hash_data', 0);
|
|
|
|
$get_metaconsole_server_url = get_parameter('get_metaconsole_server_url', 0);
|
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/reporting.ajax.php: added ajax respond to delete_sla_item and
add_sla actions.
* include/functions.php: added in the function "get_report_types" new types
of items/contents for reporting.
* pandoradb.sql: added columns custom_logo, header, first_page, footer,
custom_font into the table treport. And in the table treport_content have
new columns text, external_source, treport_custom_sql_id, header_definition,
row_separator, line_separator. Added new table treport_custom_sql.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: added changes for DB that it
same to pandoradb.sql.
* images/sort_none.png, images/sort_down.png, images/sort_up.png: added the
images for order list items for reports.
* godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: made new forms to
manage the reporting, now Pandora have tabs and list of items. In the list
of items, you can order manually or automatically the items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-22 21:01:47 +02:00
|
|
|
|
|
|
|
if ($delete_sla_item) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$result = db_process_sql_delete('treport_content_sla_combined', ['id' => (int) $id]);
|
|
|
|
|
|
|
|
$data['correct'] = 1;
|
|
|
|
if ($result === false) {
|
|
|
|
$data['correct'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($data);
|
|
|
|
return;
|
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/reporting.ajax.php: added ajax respond to delete_sla_item and
add_sla actions.
* include/functions.php: added in the function "get_report_types" new types
of items/contents for reporting.
* pandoradb.sql: added columns custom_logo, header, first_page, footer,
custom_font into the table treport. And in the table treport_content have
new columns text, external_source, treport_custom_sql_id, header_definition,
row_separator, line_separator. Added new table treport_custom_sql.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: added changes for DB that it
same to pandoradb.sql.
* images/sort_none.png, images/sort_down.png, images/sort_up.png: added the
images for order list items for reports.
* godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: made new forms to
manage the reporting, now Pandora have tabs and list of items. In the list
of items, you can order manually or automatically the items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-22 21:01:47 +02:00
|
|
|
}
|
|
|
|
|
2011-04-12 19:20:16 +02:00
|
|
|
if ($delete_general_item) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$result = db_process_sql_delete('treport_content_item', ['id' => (int) $id]);
|
|
|
|
|
|
|
|
$data['correct'] = 1;
|
|
|
|
if ($result === false) {
|
|
|
|
$data['correct'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($data);
|
|
|
|
return;
|
2011-04-12 19:20:16 +02:00
|
|
|
}
|
|
|
|
|
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/reporting.ajax.php: added ajax respond to delete_sla_item and
add_sla actions.
* include/functions.php: added in the function "get_report_types" new types
of items/contents for reporting.
* pandoradb.sql: added columns custom_logo, header, first_page, footer,
custom_font into the table treport. And in the table treport_content have
new columns text, external_source, treport_custom_sql_id, header_definition,
row_separator, line_separator. Added new table treport_custom_sql.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: added changes for DB that it
same to pandoradb.sql.
* images/sort_none.png, images/sort_down.png, images/sort_up.png: added the
images for order list items for reports.
* godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: made new forms to
manage the reporting, now Pandora have tabs and list of items. In the list
of items, you can order manually or automatically the items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-22 21:01:47 +02:00
|
|
|
if ($add_sla) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$id_module = get_parameter('id_module', 0);
|
|
|
|
$sla_limit = get_parameter('sla_limit', 0);
|
|
|
|
$sla_max = get_parameter('sla_max', 0);
|
|
|
|
$sla_min = get_parameter('sla_min', 0);
|
|
|
|
$server_id = (int) get_parameter('server_id', 0);
|
2019-07-02 11:50:58 +02:00
|
|
|
$id_module_failover = (int) get_parameter('id_module_failover', 0);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$id_service = (int) get_parameter('id_service');
|
|
|
|
if (empty($id_module) && !empty($id_service)) {
|
|
|
|
$id_module = $id_service;
|
|
|
|
}
|
|
|
|
|
|
|
|
$include_enterprise = enterprise_include('include/functions_metaconsole.php');
|
|
|
|
|
|
|
|
if ($include_enterprise !== ENTERPRISE_NOT_HOOK) {
|
|
|
|
$connection = metaconsole_get_connection_by_id($server_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($connection)) {
|
|
|
|
$connection = [];
|
|
|
|
$connection['server_name'] = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = db_process_sql_insert(
|
|
|
|
'treport_content_sla_combined',
|
|
|
|
[
|
2019-07-02 11:50:58 +02:00
|
|
|
'id_report_content' => $id,
|
|
|
|
'id_agent_module' => $id_module,
|
|
|
|
'id_agent_module_failover' => $id_module_failover,
|
|
|
|
'sla_max' => $sla_max,
|
|
|
|
'sla_min' => $sla_min,
|
|
|
|
'sla_limit' => $sla_limit,
|
|
|
|
'server_name' => $connection['server_name'],
|
2019-01-30 16:18:44 +01:00
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
if ($result === false) {
|
|
|
|
$data['correct'] = 0;
|
|
|
|
} else {
|
|
|
|
$data['correct'] = 1;
|
|
|
|
$data['id'] = $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($data);
|
|
|
|
return;
|
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/ajax/reporting.ajax.php: added ajax respond to delete_sla_item and
add_sla actions.
* include/functions.php: added in the function "get_report_types" new types
of items/contents for reporting.
* pandoradb.sql: added columns custom_logo, header, first_page, footer,
custom_font into the table treport. And in the table treport_content have
new columns text, external_source, treport_custom_sql_id, header_definition,
row_separator, line_separator. Added new table treport_custom_sql.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: added changes for DB that it
same to pandoradb.sql.
* images/sort_none.png, images/sort_down.png, images/sort_up.png: added the
images for order list items for reports.
* godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php: made new forms to
manage the reporting, now Pandora have tabs and list of items. In the list
of items, you can order manually or automatically the items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-22 21:01:47 +02:00
|
|
|
}
|
2010-04-27 17:25:32 +02:00
|
|
|
|
2011-04-12 19:20:16 +02:00
|
|
|
if ($add_general) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$id_module = get_parameter('id_module', 0);
|
|
|
|
$id_server = (int) get_parameter('id_server', 0);
|
|
|
|
$operation = get_parameter('operation', '');
|
2020-01-15 17:16:46 +01:00
|
|
|
$id_module_failover = (int) get_parameter('id_module_failover', 0);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$include_enterprise = enterprise_include('include/functions_metaconsole.php');
|
|
|
|
|
|
|
|
if ($include_enterprise !== ENTERPRISE_NOT_HOOK) {
|
|
|
|
$connection = metaconsole_get_connection_by_id($id_server);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($connection)) {
|
|
|
|
$connection = [];
|
|
|
|
$connection['server_name'] = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = db_process_sql_insert(
|
|
|
|
'treport_content_item',
|
|
|
|
[
|
2020-01-15 17:16:46 +01:00
|
|
|
'id_report_content' => $id,
|
|
|
|
'id_agent_module' => $id_module,
|
|
|
|
'server_name' => $connection['server_name'],
|
|
|
|
'operation' => $operation,
|
|
|
|
'id_agent_module_failover' => $id_module_failover,
|
2019-01-30 16:18:44 +01:00
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
if ($result === false) {
|
|
|
|
$data['correct'] = 0;
|
|
|
|
} else {
|
|
|
|
$data['correct'] = 1;
|
|
|
|
$data['id'] = $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($data);
|
|
|
|
return;
|
2011-04-12 19:20:16 +02:00
|
|
|
}
|
|
|
|
|
2010-04-27 17:25:32 +02:00
|
|
|
if ($get_custom_sql) {
|
2019-01-30 16:18:44 +01:00
|
|
|
switch ($config['dbtype']) {
|
|
|
|
case 'mysql':
|
|
|
|
$sql = db_get_value_filter('`sql`', 'treport_custom_sql', ['id' => $id]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'postgresql':
|
|
|
|
$sql = db_get_value_filter('"sql"', 'treport_custom_sql', ['id' => $id]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'oracle':
|
|
|
|
$sql = db_get_value_filter('sql', 'treport_custom_sql', ['id' => $id]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($sql === false) {
|
|
|
|
$data['correct'] = 0;
|
|
|
|
} else {
|
|
|
|
$data['correct'] = 1;
|
|
|
|
$data['sql'] = $sql;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($data);
|
|
|
|
return;
|
2010-04-27 17:25:32 +02:00
|
|
|
}
|
2011-03-24 11:48:59 +01:00
|
|
|
|
|
|
|
if ($truncate_text) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$text = get_parameter('text', '');
|
|
|
|
return ui_print_truncate_text($text, GENERIC_SIZE_TEXT, true, false);
|
2011-03-24 11:48:59 +01:00
|
|
|
}
|
|
|
|
|
2012-04-10 17:33:26 +02:00
|
|
|
if ($get_metaconsole_hash_data) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$server_name = get_parameter('server_name');
|
|
|
|
|
|
|
|
enterprise_include_once('include/functions_metaconsole.php');
|
|
|
|
|
|
|
|
$server = enterprise_hook('metaconsole_get_connection', [$server_name]);
|
|
|
|
|
|
|
|
// Bad data
|
|
|
|
if (empty($server)) {
|
|
|
|
echo '';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Deserialization of auth_token
|
|
|
|
$auth_serialized = json_decode($server['auth_token'], true);
|
|
|
|
|
|
|
|
$auth_token = '';
|
|
|
|
|
|
|
|
if (is_array($auth_serialized)) {
|
|
|
|
$auth_token = $auth_serialized['auth_token'];
|
|
|
|
$api_password = $auth_serialized['api_password'];
|
|
|
|
$console_user = $auth_serialized['console_user'];
|
|
|
|
$console_password = $auth_serialized['console_password'];
|
|
|
|
}
|
|
|
|
|
2019-02-15 15:55:31 +01:00
|
|
|
$url_hash = metaconsole_get_servers_url_hash($server);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
echo $url_hash;
|
|
|
|
return;
|
2012-04-10 17:33:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($get_metaconsole_server_url) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$server_name = get_parameter('server_name');
|
2012-04-10 17:33:26 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
enterprise_include_once('include/functions_metaconsole.php');
|
2012-04-10 17:33:26 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$server = enterprise_hook('metaconsole_get_connection', [$server_name]);
|
|
|
|
|
|
|
|
echo $server['server_url'];
|
|
|
|
return;
|
|
|
|
}
|