Merge branch 'develop' into ent-12695-16818-eliminar-warnings-en-console-log

This commit is contained in:
Jonathan 2024-02-13 09:42:00 +01:00
commit 7f580cc388
44 changed files with 655 additions and 77 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.775-240207 Version: 7.0NG.775-240213
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.775-240207" pandora_version="7.0NG.775-240213"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.775'; use constant AGENT_VERSION => '7.0NG.775';
use constant AGENT_BUILD => '240207'; use constant AGENT_BUILD => '240213';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.775 %define version 7.0NG.775
%define release 240207 %define release 240213
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.775 %define version 7.0NG.775
%define release 240207 %define release 240213
%define debug_package %{nil} %define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.775 %define version 7.0NG.775
%define release 240207 %define release 240213
%define debug_package %{nil} %define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.775 %define version 7.0NG.775
%define release 240207 %define release 240213
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.775 %define version 7.0NG.775
%define release 240207 %define release 240213
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.775" PI_VERSION="7.0NG.775"
PI_BUILD="240207" PI_BUILD="240213"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{240207} {240213}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.775 Build 240207") #define PANDORA_VERSION ("7.0NG.775 Build 240213")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS" VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.775(Build 240207))" VALUE "ProductVersion", "(7.0NG.775(Build 240213))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.775-240207 Version: 7.0NG.775-240213
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.775-240207" pandora_version="7.0NG.775-240213"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -40,9 +40,6 @@ CREATE TABLE IF NOT EXISTS `tmerge_queries` (
ALTER TABLE `tmerge_queries` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; ALTER TABLE `tmerge_queries` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
-- Update version for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
ALTER TABLE `tevent_sound` MODIFY COLUMN `name` text NULL; ALTER TABLE `tevent_sound` MODIFY COLUMN `name` text NULL;
ALTER TABLE `tevent_sound` MODIFY COLUMN `sound` text NULL; ALTER TABLE `tevent_sound` MODIFY COLUMN `sound` text NULL;
ALTER TABLE `treport_content` MODIFY COLUMN `use_prefix_notation` tinyint unsigned NOT NULL DEFAULT 1; ALTER TABLE `treport_content` MODIFY COLUMN `use_prefix_notation` tinyint unsigned NOT NULL DEFAULT 1;
@ -59,4 +56,11 @@ ALTER TABLE `tmensajes` ADD COLUMN `icon_notification` VARCHAR(250) NULL DEFAULT
UPDATE `tncm_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]'); UPDATE `tncm_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]');
UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]'); UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]');
-- Update version for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
SET @widget_id = NULL;
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = 'GisMap';
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,'GisMap','GisMap','Gis map','','GisMap.php');
COMMIT; COMMIT;

View File

@ -675,6 +675,19 @@ if (enterprise_installed()) {
} }
} }
if ($id_os === '1') {
$modules = $agent_plugin->getModules();
foreach ($modules as $key => $row) {
if (preg_match('/Syslog/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$enable_log_collector = 0;
} else {
$enable_log_collector = 1;
}
}
}
}
if ($id_os === '9') { if ($id_os === '9') {
$modules = $agent_plugin->getModules(); $modules = $agent_plugin->getModules();
foreach ($modules as $key => $row) { foreach ($modules as $key => $row) {

View File

@ -1299,8 +1299,11 @@ if ($update_agent) {
} }
$modules = $agent->getModules(); $modules = $agent->getModules();
foreach ($modules as $key => $row) { foreach ($modules as $key => $row) {
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) { if (preg_match('/PandoraAgent_log/', $row['raw']) === 1
|| ($id_os === 1 && preg_match('/Syslog/', $row['raw']) === 1)
) {
if ($enable_log_collector === 1) { if ($enable_log_collector === 1) {
if ($row['disabled'] === 1) { if ($row['disabled'] === 1) {
$agent->enableModule($row['module_name'], $row); $agent->enableModule($row['module_name'], $row);

View File

@ -319,9 +319,8 @@ if ($update_agents) {
$secondary_groups_removed $secondary_groups_removed
); );
$agents_values = agents_get_agent((int) $array_id[1]); $agents_values = db_get_row_filter('tagente', ['id_agente' => (int) $array_id[1]]);
$node->disconnect(); $node->disconnect();
if (empty($values) === false) { if (empty($values) === false) {
update_agents_in_metaconsole( update_agents_in_metaconsole(
(int) $array_id[1], (int) $array_id[1],

View File

@ -115,7 +115,7 @@ foreach ($servers as $server) {
$table->cellclass[] = [ $table->cellclass[] = [
3 => 'progress_bar', 3 => 'progress_bar',
8 => 'table_action_buttons', 9 => 'table_action_buttons',
]; ];
$data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>'; $data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>';

View File

@ -48,7 +48,7 @@ if ($idOS > 0) {
} else { } else {
$name = io_safe_input(strip_tags(trim(io_safe_output((string) get_parameter('name'))))); $name = io_safe_input(strip_tags(trim(io_safe_output((string) get_parameter('name')))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description')))); $description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0); $icon = get_parameter('icon', 'os@svg.svg');
} }
$icon_upload = get_parameter('icon_upload', null); $icon_upload = get_parameter('icon_upload', null);
@ -246,7 +246,7 @@ $iconData[] = html_print_select(
'icon', 'icon',
$icon, $icon,
'show_icon_OS();', 'show_icon_OS();',
__('None'), '',
0, 0,
true true
); );
@ -356,6 +356,8 @@ function get_list_os_icons_dir()
} }
} }
$return['os@svg.svg'] = __('None');
return $return; return $return;
} }

View File

@ -88,6 +88,14 @@ switch ($tab) {
break; break;
case 'manage_os': case 'manage_os':
$id_os = get_parameter('id_os', '');
if ($id_os !== '') {
$headerTitle = __('Edit OS');
} else {
$headerTitle = __('Create OS');
}
break;
case 'list': case 'list':
if ($action === 'edit') { if ($action === 'edit') {
$headerTitle = __('Edit OS'); $headerTitle = __('Edit OS');

View File

@ -1585,12 +1585,7 @@ $autorefresh_list_out['operation/events/events'] = 'Events';
if (isset($autorefresh_list) === false || empty($autorefresh_list) === true || empty($autorefresh_list[0]) === true) { if (isset($autorefresh_list) === false || empty($autorefresh_list) === true || empty($autorefresh_list[0]) === true) {
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$id."'"); $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$id."'");
if (isset($select[0]['autorefresh_white_list']) === true) { $autorefresh_list = json_decode(($select[0]['autorefresh_white_list'] ?? ''));
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
} else {
$autorefresh_list = 0;
}
if ($autorefresh_list === null || $autorefresh_list === 0) { if ($autorefresh_list === null || $autorefresh_list === 0) {
$autorefresh_list = []; $autorefresh_list = [];
$autorefresh_list[0] = __('None'); $autorefresh_list[0] = __('None');

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -117,12 +117,25 @@ if ($method === 'draw') {
$where_name = 'name LIKE "%'.$filter['free_search'].'%"'; $where_name = 'name LIKE "%'.$filter['free_search'].'%"';
} }
if (is_user_admin($config['id_user']) === false) {
$group_list = \users_get_groups(
$config['id_ser'],
'RR',
true
);
}
$where_group = ''; $where_group = '';
if (empty($filter['group']) === false && $filter['group'] !== '0') { if (empty($filter['group']) === false && $filter['group'] !== '0') {
$where_group = sprintf('id_group = %s', $filter['group']); $where_group = sprintf('id_group = %s', $filter['group']);
if (empty($where_name) === false) { if (empty($where_name) === false) {
$where_group = 'AND '.$where_group; $where_group = 'AND '.$where_group;
} }
} else if (empty($group_list) === false) {
$where_group = sprintf('id_group IN (%s)', implode(',', array_keys($group_list)));
if (empty($where_name) === false) {
$where_group = 'AND '.$where_group;
}
} }
$where = ''; $where = '';

View File

@ -572,7 +572,7 @@ function get_user_info($user)
* *
* @return array An array of user information * @return array An array of user information
*/ */
function get_users($order='fullname', $filter=false, $fields=false) function get_users($order='fullname', $filter=[], $fields=false)
{ {
if (is_array($order) === true) { if (is_array($order) === true) {
$filter['order'] = (string) $order['field'].' '.(string) $order['order']; $filter['order'] = (string) $order['field'].' '.(string) $order['order'];

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC240207'; $build_version = 'PC240213';
$pandora_version = 'v7.0NG.775'; $pandora_version = 'v7.0NG.775';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -82,11 +82,11 @@ function io_safe_input($value)
return $value; return $value;
} }
if (! mb_check_encoding($value, 'UTF-8')) { if (isset($value) === true && !mb_check_encoding($value, 'UTF-8')) {
$value = utf8_encode($value); $value = utf8_encode($value);
} }
$valueHtmlEncode = htmlentities($value, ENT_QUOTES, 'UTF-8', true); $valueHtmlEncode = htmlentities(($value ?? ''), ENT_QUOTES, 'UTF-8', true);
// Replace the character '\' for the equivalent html entitie // Replace the character '\' for the equivalent html entitie
$valueHtmlEncode = str_replace('\\', '&#92;', $valueHtmlEncode); $valueHtmlEncode = str_replace('\\', '&#92;', $valueHtmlEncode);

View File

@ -969,15 +969,27 @@ function ui_print_os_icon(
$options['title'] = $os_name; $options['title'] = $os_name;
} }
$output = html_print_image( if ($icon === '.png') {
'images/'.$subfolder.'/'.$icon, $output = html_print_image(
true, 'images/os@svg.svg',
$options, true,
false, $options,
$relative, false,
$no_in_meta, $relative,
true $no_in_meta,
); true
);
} else {
$output = html_print_image(
'images/'.$subfolder.'/'.$icon,
true,
$options,
false,
$relative,
$no_in_meta,
true
);
}
} }
} else { } else {
// $output = "<img src='images/os_icons/" . $icon . "' alt='" . $os_name . "' title='" . $os_name . "'>"; // $output = "<img src='images/os_icons/" . $icon . "' alt='" . $os_name . "' title='" . $os_name . "'>";

View File

@ -0,0 +1,541 @@
<?php
/**
* Widget agiss map Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2024 Artica Soluciones Tecnologicas
* 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.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
use PandoraFMS\Enterprise\Metaconsole\Node;
global $config;
/**
* URL Widgets
*/
class GisMap extends Widget
{
/**
* Name widget.
*
* @var string
*/
protected $name;
/**
* Title widget.
*
* @var string
*/
protected $title;
/**
* Page widget;
*
* @var string
*/
protected $page;
/**
* Class name widget.
*
* @var [type]
*/
protected $className;
/**
* Values options for each widget.
*
* @var [type]
*/
protected $values;
/**
* Configuration required.
*
* @var boolean
*/
protected $configurationRequired;
/**
* Error load widget.
*
* @var boolean
*/
protected $loadError;
/**
* Width.
*
* @var integer
*/
protected $width;
/**
* Heigth.
*
* @var integer
*/
protected $height;
/**
* Grid Width.
*
* @var integer
*/
protected $gridWidth;
/**
* Cell ID.
*
* @var integer
*/
protected $cellId;
/**
* Construct.
*
* @param integer $cellId Cell ID.
* @param integer $dashboardId Dashboard ID.
* @param integer $widgetId Widget ID.
* @param integer|null $width New width.
* @param integer|null $height New height.
* @param integer|null $gridWidth Grid width.
*/
public function __construct(
int $cellId,
int $dashboardId=0,
int $widgetId=0,
?int $width=0,
?int $height=0,
?int $gridWidth=0
) {
global $config;
// WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct(
$cellId,
$dashboardId,
$widgetId
);
// Width.
$this->width = $width;
// Height.
$this->height = $height;
// Grid Width.
$this->gridWidth = $gridWidth;
// Cell Id.
$this->cellId = $cellId;
// Options.
$this->values = $this->decoders($this->getOptionsWidget());
// Page.
$this->page = basename(__FILE__);
// ClassName.
$class = new \ReflectionClass($this);
$this->className = $class->getShortName();
// Title.
$this->title = __('Gis map');
// Name.
if (empty($this->name) === true) {
$this->name = 'GisMap';
}
// This forces at least a first configuration.
$this->configurationRequired = false;
if (empty($this->values['gis_map']) === true) {
$this->configurationRequired = true;
}
}
/**
* Decoders hack for retrocompability.
*
* @param array $decoder Values.
*
* @return array Returns the values with the correct key.
*/
public function decoders(array $decoder): array
{
$values = [];
// Retrieve global - common inputs.
$values = parent::decoders($decoder);
if (isset($decoder['gis_map']) === true) {
$values['gis_map'] = $decoder['gis_map'];
}
return $values;
}
/**
* Generates inputs for form (specific).
*
* @return array Of inputs.
*
* @throws Exception On error.
*/
public function getFormInputs(): array
{
global $config;
include_once $config['homedir'].'/include/functions_gis.php';
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
if ((bool) $config['activate_gis'] === true) {
$maps = gis_get_maps();
}
$array_map = [];
foreach ($maps as $map) {
if (check_acl($config['id_user'], $map['group_id'], 'MR') === false
&& check_acl($config['id_user'], $map['group_id'], 'MW') === false
&& check_acl($config['id_user'], $map['group_id'], 'MM') === false
) {
continue;
}
$array_map[$map['id_tgis_map']] = $map['map_name'];
}
// Filters.
$inputs[] = [
'class' => 'flex flex-row',
'label' => __('GIS maps'),
'arguments' => [
'type' => 'select',
'fields' => $array_map,
'name' => 'gis_map',
'return' => true,
'selected' => ($this->values['gis_map'] === null) ? 0 : $this->values['gis_map'],
],
];
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost(): array
{
// Retrieve global - common inputs.
$values = parent::getPost();
$values['gis_map'] = \get_parameter('gis_map', 0);
return $values;
}
/**
* Draw widget.
*
* @return string;
*/
public function load()
{
global $config;
include_once $config['homedir'].'/include/functions_gis.php';
include_once $config['homedir'].'/include/functions_agents.php';
\ui_require_javascript_file('openlayers.pandora', 'include/javascript/', true);
\ui_require_javascript_file('OpenLayers/OpenLayers', 'include/javascript/', true);
$map = db_get_row('tgis_map', 'id_tgis_map', $this->values['gis_map']);
$output = '';
if (check_acl($config['id_user'], $map['group_id'], 'MR') === false
&& check_acl($config['id_user'], $map['group_id'], 'MW') === false
&& check_acl($config['id_user'], $map['group_id'], 'MM') === false
) {
$output .= '<div class="container-center">';
$output .= ui_print_error_message(
__('You don\'t have access'),
'',
true
);
$output .= '</div>';
return $output;
}
$confMap = gis_get_map_conf($this->values['gis_map']);
// Default open map (used to overwrite unlicensed google map view).
$confMapDefault = get_good_con();
$confMapDefaultFull = json_decode($confMapDefault['conection_data'], true);
$confMapUrlDefault = $confMapDefaultFull['url'];
$num_baselayer = 0;
// Initialy there is no Gmap base layer.
$gmap_layer = false;
if ($confMap !== false) {
foreach ($confMap as $mapC) {
$baselayers[$num_baselayer]['typeBaseLayer'] = $mapC['connection_type'];
$baselayers[$num_baselayer]['name'] = $mapC['conection_name'];
$baselayers[$num_baselayer]['num_zoom_levels'] = $mapC['num_zoom_levels'];
$decodeJSON = json_decode($mapC['conection_data'], true);
switch ($mapC['connection_type']) {
case 'OSM':
$baselayers[$num_baselayer]['url'] = $decodeJSON['url'];
break;
case 'Gmap':
if (!isset($decodeJSON['gmap_key']) || empty($decodeJSON['gmap_key'])) {
// If there is not gmap_key, show the default view.
$baselayers[$num_baselayer]['url'] = $confMapUrlDefault;
$baselayers[$num_baselayer]['typeBaseLayer'] = 'OSM';
} else {
$baselayers[$num_baselayer]['gmap_type'] = $decodeJSON['gmap_type'];
$baselayers[$num_baselayer]['gmap_key'] = $decodeJSON['gmap_key'];
$gmap_key = $decodeJSON['gmap_key'];
// Once a Gmap base layer is found we mark it to import the API.
$gmap_layer = true;
}
break;
case 'Static_Image':
$baselayers[$num_baselayer]['url'] = $decodeJSON['url'];
$baselayers[$num_baselayer]['bb_left'] = $decodeJSON['bb_left'];
$baselayers[$num_baselayer]['bb_right'] = $decodeJSON['bb_right'];
$baselayers[$num_baselayer]['bb_bottom'] = $decodeJSON['bb_bottom'];
$baselayers[$num_baselayer]['bb_top'] = $decodeJSON['bb_top'];
$baselayers[$num_baselayer]['image_width'] = $decodeJSON['image_width'];
$baselayers[$num_baselayer]['image_height'] = $decodeJSON['image_height'];
break;
case 'WMS':
$baselayers[$num_baselayer]['url'] = $decodeJSON['url'];
$baselayers[$num_baselayer]['layers'] = $decodeJSON['layers'];
break;
default:
// Do nothing.
break;
}
$num_baselayer++;
if ($mapC['default_map_connection'] == 1) {
$numZoomLevels = $mapC['num_zoom_levels'];
}
}
}
if ($gmap_layer === true) {
if (https_is_running()) {
?>
<script type="text/javascript" src="https://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key; ?>" ></script>
<?php
} else {
?>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key; ?>" ></script>
<?php
}
}
$controls = [
'PanZoomBar',
'ScaleLine',
'Navigation',
'MousePosition',
'layerSwitcher',
];
$layers = gis_get_layers($this->values['gis_map']);
$output .= '<div id="map_'.$this->cellId.'" style="width: 100%; height: 100%" />';
gis_print_map(
'map_'.$this->cellId,
$map['zoom_level'],
$map['initial_latitude'],
$map['initial_longitude'],
$baselayers,
$controls
);
$output .= '</div>';
if (empty($layers) === false) {
foreach ($layers as $layer) {
gis_make_layer(
$layer['layer_name'],
$layer['view_layer'],
null,
$layer['id_tmap_layer']
);
// Calling agents_get_group_agents with none to obtain the names in the same case as they are in the DB.
$agentNamesByGroup = [];
if ($layer['tgrupo_id_grupo'] >= 0) {
$agentNamesByGroup = agents_get_group_agents(
$layer['tgrupo_id_grupo'],
false,
'none',
true,
true,
false
);
}
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer']);
$groupsByAgentId = gis_get_groups_layer_by_agent_id($layer['id_tmap_layer']);
$agentNamesOfGroupItems = [];
foreach ($groupsByAgentId as $agentId => $groupInfo) {
$agentNamesOfGroupItems[$agentId] = $groupInfo['agent_name'];
}
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer + $agentNamesOfGroupItems);
foreach ($agentNames as $key => $agentName) {
$idAgent = $key;
$coords = gis_get_data_last_position_agent($idAgent);
if ($coords === false) {
$coords['stored_latitude'] = $map['default_latitude'];
$coords['stored_longitude'] = $map['default_longitude'];
} else {
if ($show_history == 'y') {
$lastPosition = [
'longitude' => $coords['stored_longitude'],
'latitude' => $coords['stored_latitude'],
];
gis_add_path($layer['layer_name'], $idAgent, $lastPosition);
}
}
$status = agents_get_status($idAgent, true);
$icon = gis_get_agent_icon_map($idAgent, true, $status);
$icon_size = getimagesize($icon);
$icon_width = $icon_size[0];
$icon_height = $icon_size[1];
// Is a group item.
if (empty($groupsByAgentId[$idAgent]) === false) {
$groupId = (int) $groupsByAgentId[$idAgent]['id'];
$groupName = $groupsByAgentId[$idAgent]['name'];
gis_add_agent_point(
$layer['layer_name'],
io_safe_output($groupName),
$coords['stored_latitude'],
$coords['stored_longitude'],
$icon,
$icon_width,
$icon_height,
$idAgent,
$status,
'point_group_info',
$groupId
);
} else {
$parent = db_get_value('id_parent', 'tagente', 'id_agente', $idAgent);
gis_add_agent_point(
$layer['layer_name'],
io_safe_output($agentName),
$coords['stored_latitude'],
$coords['stored_longitude'],
$icon,
$icon_width,
$icon_height,
$idAgent,
$status,
'point_agent_info',
$parent
);
}
}
}
gis_add_parent_lines();
$timestampLastOperation = db_get_value_sql('SELECT UNIX_TIMESTAMP()');
gis_activate_select_control();
gis_activate_ajax_refresh($layers, $timestampLastOperation);
}
return $output;
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('GIS map');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'GisMap';
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 500,
'height' => 300,
];
return $size;
}
}

View File

@ -304,23 +304,7 @@ if ($layers != false) {
gis_add_parent_lines(); gis_add_parent_lines();
switch ($config['dbtype']) { $timestampLastOperation = db_get_value_sql('SELECT UNIX_TIMESTAMP()');
case 'mysql':
$timestampLastOperation = db_get_value_sql('SELECT UNIX_TIMESTAMP()');
break;
case 'postgresql':
$timestampLastOperation = db_get_value_sql(
"SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP))"
);
break;
case 'oracle':
$timestampLastOperation = db_get_value_sql(
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) FROM dual'
);
break;
}
gis_activate_select_control(); gis_activate_select_control();
gis_activate_ajax_refresh($layers, $timestampLastOperation); gis_activate_ajax_refresh($layers, $timestampLastOperation);

View File

@ -6,7 +6,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.775 %define version 7.0NG.775
%define release 240207 %define release 240213
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -6,7 +6,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.775 %define version 7.0NG.775
%define release 240207 %define release 240213
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.775 %define version 7.0NG.775
%define release 240207 %define release 240213
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -2832,7 +2832,8 @@ INSERT INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`
(44,'WuxWidget','wux_transaction','Agent WUX transaction','','wux_transaction.php'), (44,'WuxWidget','wux_transaction','Agent WUX transaction','','wux_transaction.php'),
(45,'WuxStatsWidget','wux_transaction_stats','WUX transaction stats','','wux_transaction_stats.php'), (45,'WuxStatsWidget','wux_transaction_stats','WUX transaction stats','','wux_transaction_stats.php'),
(46,'SecurityHardening','security_hardening','Security Hardening','','security_hardening.php'), (46,'SecurityHardening','security_hardening','Security Hardening','','security_hardening.php'),
(47,'ServiceLevelWidget','service_level','Service Level','','service_level.php'); (47,'ServiceLevelWidget','service_level','Service Level','','service_level.php'),
(48,'GisMap','GisMap','Gis map','','GisMap.php');
INSERT INTO `tmap` (`id`,`id_group`,`id_user`,`type`,`subtype`,`name`,`description`,`height`,`width`,`center_x`,`center_y`,`background`,`background_options`,`source_period`,`source`,`source_data`,`generation_method`,`generated`,`filter`,`id_group_map`,`refresh_time`) VALUES (1,'0','admin',0,0,'Sample&#x20;dynamic&#x20;map','This&#x20;is&#x20;a&#x20;sample&#x20;dynamic&#x20;map.',900,900,0,0,'',0,60,0,'0',6,0,'{\"dont_show_subgroups\":0,\"node_radius\":40,\"x_offs\":\"0\",\"y_offs\":\"0\",\"z_dash\":\"1\",\"node_sep\":\"0.25\",\"rank_sep\":\"0.5\",\"mindist\":\"1\",\"kval\":\"0.3\"}',0,300); INSERT INTO `tmap` (`id`,`id_group`,`id_user`,`type`,`subtype`,`name`,`description`,`height`,`width`,`center_x`,`center_y`,`background`,`background_options`,`source_period`,`source`,`source_data`,`generation_method`,`generated`,`filter`,`id_group_map`,`refresh_time`) VALUES (1,'0','admin',0,0,'Sample&#x20;dynamic&#x20;map','This&#x20;is&#x20;a&#x20;sample&#x20;dynamic&#x20;map.',900,900,0,0,'',0,60,0,'0',6,0,'{\"dont_show_subgroups\":0,\"node_radius\":40,\"x_offs\":\"0\",\"y_offs\":\"0\",\"z_dash\":\"1\",\"node_sep\":\"0.25\",\"rank_sep\":\"0.5\",\"mindist\":\"1\",\"kval\":\"0.3\"}',0,300);
INSERT INTO `treport` (`id_report`,`id_user`,`name`,`description`,`private`,`id_group`,`custom_logo`,`header`,`first_page`,`footer`,`custom_font`,`id_template`,`id_group_edit`,`metaconsole`,`non_interactive`,`hidden`,`orientation`,`cover_page_render`,`index_render`) VALUES (1,'admin','Sample&#x20;report&#x20;#1','This&#x20;is&#x20;a&#x20;sample&#x20;report,&#x20;just&#x20;to&#x20;show&#x20;you&#x20;some&#x20;general&#x20;report&#x20;items.',0,0,NULL,NULL,'&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;img&#x20;src=&quot;http://localhost/pandora_console//images/pandora_report_logo.png&quot;&#x20;alt=&quot;&quot;&#x20;width=&quot;800&quot;&#x20;/&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;xx-large;&quot;&gt;&#40;_REPORT_NAME_&#41;&lt;/span&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;large;&quot;&gt;&#40;_DATETIME_&#41;&lt;/span&gt;&lt;/p&gt;',NULL,'Lato-Regular.ttf',0,0,0,0,0,'vertical',1,1); INSERT INTO `treport` (`id_report`,`id_user`,`name`,`description`,`private`,`id_group`,`custom_logo`,`header`,`first_page`,`footer`,`custom_font`,`id_template`,`id_group_edit`,`metaconsole`,`non_interactive`,`hidden`,`orientation`,`cover_page_render`,`index_render`) VALUES (1,'admin','Sample&#x20;report&#x20;#1','This&#x20;is&#x20;a&#x20;sample&#x20;report,&#x20;just&#x20;to&#x20;show&#x20;you&#x20;some&#x20;general&#x20;report&#x20;items.',0,0,NULL,NULL,'&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;img&#x20;src=&quot;http://localhost/pandora_console//images/pandora_report_logo.png&quot;&#x20;alt=&quot;&quot;&#x20;width=&quot;800&quot;&#x20;/&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;xx-large;&quot;&gt;&#40;_REPORT_NAME_&#41;&lt;/span&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;large;&quot;&gt;&#40;_DATETIME_&#41;&lt;/span&gt;&lt;/p&gt;',NULL,'Lato-Regular.ttf',0,0,0,0,0,'vertical',1,1);

View File

@ -71,6 +71,10 @@ foreach ($widgets as $widget) {
continue; continue;
} }
if ($widget['unique_name'] === 'GisMap' && (bool) $config['activate_gis'] === false) {
continue;
}
$imageWidget = '/images/widgets/'.$widget['unique_name'].'.png'; $imageWidget = '/images/widgets/'.$widget['unique_name'].'.png';
$output .= '<div class="list-widgets">'; $output .= '<div class="list-widgets">';

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.775-240207 Version: 7.0NG.775-240213
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.775-240207" pandora_version="7.0NG.775-240213"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.775"; my $pandora_version = "7.0NG.775";
my $pandora_build = "240207"; my $pandora_build = "240213";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.775"; my $pandora_version = "7.0NG.775";
my $pandora_build = "240207"; my $pandora_build = "240213";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -7,7 +7,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.775 %define version 7.0NG.775
%define release 240207 %define release 240213
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.775 %define version 7.0NG.775
%define release 240207 %define release 240213
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.775" PI_VERSION="7.0NG.775"
PI_BUILD="240207" PI_BUILD="240213"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.775 Build 240207"; my $version = "7.0NG.775 Build 240213";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.775 Build 240207"; my $version = "7.0NG.775 Build 240213";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -5398,7 +5398,7 @@ sub cli_get_agent_status() {
############################################################################## ##############################################################################
sub cli_get_agents_id_name_by_alias() { sub cli_get_agents_id_name_by_alias() {
my $agent_alias = @ARGV[2]; my $agent_alias = safe_input(@ARGV[2]);
my $strict = @ARGV[3]; my $strict = @ARGV[3];
my @agents; my @agents;
my $where_value; my $where_value;
@ -5418,14 +5418,13 @@ sub cli_get_agents_id_name_by_alias() {
print "[ERROR] No agents retrieved.\n\n"; print "[ERROR] No agents retrieved.\n\n";
} else { } else {
if(is_metaconsole($conf) == 1) { if(is_metaconsole($conf) == 1) {
print "alias, id_agente, id_tagente, id_server, server_name\n"; print "id_agente, alias, id_tagente, id_server, server_name\n";
foreach my $agent (@agents) { foreach my $agent (@agents) {
print $agent->{'id_agente'}.", ".safe_output($agent->{'alias'}).", ".$agent->{'id_tagente'}.", ".$agent->{'id_server'}.", ".$agent->{'server_name'}."\n";
print safe_output($agent->{'alias'}).", ".$agent->{'id_agente'}.", ".$agent->{'id_tagente'}.", ".$agent->{'id_server'}.", ".$agent->{'server_name'}."\n";
} }
} else { } else {
print "alias, id_agente\n"; print "id_agente, alias\n";
foreach my $agent (@agents) { foreach my $agent (@agents) {
print $agent->{'id_agente'}.",".safe_output($agent->{'alias'})."\n"; print $agent->{'id_agente'}.",".safe_output($agent->{'alias'})."\n";