2015-07-24 16:43:54 +02:00
|
|
|
<?php
|
2021-11-04 16:28:15 +01:00
|
|
|
// Pandora FMS - http://pandorafms.com
|
2015-07-24 16:43:54 +02:00
|
|
|
// ==================================================
|
2020-11-27 13:52:35 +01:00
|
|
|
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
2015-07-24 16:43:54 +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 General Public License
|
|
|
|
// as published by the Free Software Foundation for 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;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once 'include/functions_visual_map.php';
|
2017-11-21 16:59:49 +01:00
|
|
|
enterprise_include_once('include/functions_visual_map.php');
|
|
|
|
|
|
|
|
$id_visual_console = get_parameter('id_visual_console', null);
|
|
|
|
|
2020-03-26 12:29:38 +01:00
|
|
|
// Login check.
|
|
|
|
check_login();
|
2015-07-24 16:43:54 +02:00
|
|
|
|
|
|
|
// Fix: IW was the old ACL to check for report editing, now is RW
|
2019-01-30 16:18:44 +01:00
|
|
|
if (! check_acl($config['id_user'], 0, 'VR')) {
|
|
|
|
db_pandora_audit(
|
2022-01-20 10:55:23 +01:00
|
|
|
AUDIT_LOG_ACL_VIOLATION,
|
2019-01-30 16:18:44 +01:00
|
|
|
'Trying to access report builder'
|
|
|
|
);
|
|
|
|
include 'general/noaccess.php';
|
|
|
|
exit;
|
2015-07-24 16:43:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
// Fix ajax to avoid include the file, 'functions_graph.php'.
|
2015-07-24 16:43:54 +02:00
|
|
|
$ajax = true;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$render_map = (bool) get_parameter('render_map', false);
|
|
|
|
$graph_javascript = (bool) get_parameter('graph_javascript', false);
|
2021-12-21 09:33:55 +01:00
|
|
|
$force_remote_check = (bool) get_parameter('force_remote_check', false);
|
2015-07-24 16:43:54 +02:00
|
|
|
|
|
|
|
if ($render_map) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$width = (int) get_parameter('width', '400');
|
|
|
|
$height = (int) get_parameter('height', '400');
|
|
|
|
$keep_aspect_ratio = (bool) get_parameter('keep_aspect_ratio');
|
2015-07-24 16:43:54 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
visual_map_print_visual_map(
|
|
|
|
$id_visual_console,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
'',
|
|
|
|
false,
|
|
|
|
$graph_javascript,
|
|
|
|
$keep_aspect_ratio
|
|
|
|
);
|
|
|
|
return;
|
|
|
|
}
|
2021-12-21 09:33:55 +01:00
|
|
|
|
|
|
|
if ($force_remote_check) {
|
|
|
|
$id_layout = (int) get_parameter('id_layout', false);
|
|
|
|
$data = db_get_all_rows_sql(
|
|
|
|
sprintf(
|
|
|
|
'SELECT id_agent FROM tlayout_data WHERE id_layout = %d AND id_agent <> 0',
|
|
|
|
$id_layout
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (empty($data)) {
|
|
|
|
echo '0';
|
|
|
|
} else {
|
|
|
|
$ids = [];
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
$ids[] = $value['id_agent'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$sql = sprintf(
|
|
|
|
'UPDATE `tagente_modulo` SET flag = 1 WHERE `id_agente` IN (%s)',
|
|
|
|
implode(',', $ids)
|
|
|
|
);
|
|
|
|
|
|
|
|
$result = db_process_sql($sql);
|
|
|
|
if ($result) {
|
|
|
|
echo true;
|
|
|
|
} else {
|
|
|
|
echo '0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|