2017-09-21 13:22:40 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
2020-11-27 13:52:35 +01:00
|
|
|
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
2017-09-21 13:22:40 +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.
|
2019-03-27 11:06:57 +01:00
|
|
|
require_once __DIR__.'/functions_modules.php';
|
|
|
|
require_once __DIR__.'/functions_events.php';
|
|
|
|
require_once __DIR__.'/functions_groups.php';
|
|
|
|
require_once __DIR__.'/functions_netflow.php';
|
2019-01-30 16:18:44 +01:00
|
|
|
enterprise_include_once('include/functions_metaconsole.php');
|
|
|
|
|
|
|
|
|
|
|
|
function reporting_xml_get_report($report, $filename, $return=false)
|
|
|
|
{
|
|
|
|
// ------- Removed the unused fields ------------------------------------
|
|
|
|
unset($report['header']);
|
|
|
|
unset($report['first_page']);
|
|
|
|
unset($report['footer']);
|
|
|
|
unset($report['custom_font']);
|
|
|
|
unset($report['id_template']);
|
|
|
|
unset($report['id_group_edit']);
|
|
|
|
unset($report['metaconsole']);
|
|
|
|
unset($report['private']);
|
|
|
|
unset($report['custom_logo']);
|
|
|
|
// ----------------------------------------------------------------------
|
2019-11-21 14:36:31 +01:00
|
|
|
// Remove entities.
|
|
|
|
$report = io_safe_output($report);
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$xml = null;
|
|
|
|
$xml = array2XML($report, 'report', $xml);
|
|
|
|
$xml = preg_replace('/(<[^>]+>)(<[^>]+>)(<[^>]+>)/', "$1\n$2\n$3", $xml);
|
|
|
|
$xml = preg_replace('/(<[^>]+>)(<[^>]+>)/', "$1\n$2", $xml);
|
|
|
|
|
2019-03-19 17:16:31 +01:00
|
|
|
// Return if is marked to return.
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($return) {
|
|
|
|
return $xml;
|
|
|
|
}
|
|
|
|
|
2019-03-19 17:16:31 +01:00
|
|
|
// Download if marked to download.
|
2019-04-23 12:20:12 +02:00
|
|
|
if ($filename !== false) {
|
2019-03-19 17:16:31 +01:00
|
|
|
header('Content-Type: application/xml; charset=UTF-8');
|
|
|
|
header('Content-Disposition: attachment; filename="'.$filename.'.xml"');
|
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2019-03-19 17:16:31 +01:00
|
|
|
// Clean the output buffer.
|
2019-01-30 16:18:44 +01:00
|
|
|
ob_clean();
|
|
|
|
|
|
|
|
echo $xml;
|
|
|
|
}
|