Merge remote-tracking branch 'origin/develop' into ent-7168-Integrar-vista-de-warnings-en-Availability-reports

This commit is contained in:
alejandro.campos@artica.es 2021-09-24 11:40:25 +02:00
commit 9e0729574e
172 changed files with 29517 additions and 24699 deletions

View File

@ -151,7 +151,7 @@ execute_cmd "yum install -y $extra_repos" "Installing extra repositories"
execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP"
# Install percona Database
[ -f /etc/resolv.conf ] && rm -rf /etc/my.cnf
[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf
execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server"
# Console dependencies
@ -429,6 +429,7 @@ sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">

View File

@ -149,6 +149,7 @@ EOF_INDEX
sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
echo "- Setting Public URL: $PUBLICURL"
q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url)

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, AIX version
# Version 7.0NG.757, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, FreeBSD Version
# Version 7.0NG.757, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, HP-UX Version
# Version 7.0NG.757, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, GNU/Linux
# Version 7.0NG.757, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, GNU/Linux
# Version 7.0NG.757, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, Solaris Version
# Version 7.0NG.757, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.756
# Version 7.0NG.757
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.756, AIX version
# Version 7.0NG.757, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.756
# Version 7.0NG.757
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.756, HPUX Version
# Version 7.0NG.757, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756
# Version 7.0NG.757
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756
# Version 7.0NG.757
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756
# Version 7.0NG.757
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.756, Solaris version
# Version 7.0NG.757, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, AIX version
# Version 7.0NG.757, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.756-210809
Version: 7.0NG.757-210922
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -31,7 +31,7 @@ fi
if [ "$#" -ge 2 ]; then
VERSION="$2"
else
VERSION="7.0NG.756"
VERSION="7.0NG.757"
fi
# Path for the generated DMG file

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.756" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.757" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.756" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.757" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" />
<script>
<![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.756</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.756 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.756</string>
<key>CFBundleVersion</key> <string>7.0NG.757</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.757 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.757</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, GNU/Linux
# Version 7.0NG.757, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, FreeBSD Version
# Version 7.0NG.757, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, HP-UX Version
# Version 7.0NG.757, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, GNU/Linux
# Version 7.0NG.757, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, GNU/Linux
# Version 7.0NG.757, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, NetBSD Version
# Version 7.0NG.757, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.756, Solaris Version
# Version 7.0NG.757, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1014,8 +1014,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.756';
use constant AGENT_BUILD => '210809';
use constant AGENT_VERSION => '7.0NG.757';
use constant AGENT_BUILD => '210922';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.756
%define release 210809
%define version 7.0NG.757
%define release 210922
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.756
%define release 210809
%define version 7.0NG.757
%define release 210922
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.756"
PI_BUILD="210809"
PI_VERSION="7.0NG.757"
PI_BUILD="210922"
OS_NAME=`uname -s`
FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.756
# Version 7.0NG.757
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.756}
{Pandora FMS Windows Agent v7.0NG.757}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210809}
{210922}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.756 Build 210809")
#define PANDORA_VERSION ("7.0NG.757 Build 210922")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.756(Build 210809))"
VALUE "ProductVersion", "(7.0NG.757(Build 210922))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.756-210809
Version: 7.0NG.757-210922
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1,12 +1,9 @@
START TRANSACTION;
ALTER TABLE `treport_content_template` ADD COLUMN `time_in_warning_status` TINYINT(1) DEFAULT '0';
ALTER TABLE `treport_content_template` ADD COLUMN `checks_in_warning_status` TINYINT(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `time_in_warning_status` TINYINT(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `checks_in_warning_status` TINYINT(1) DEFAULT '0';
INSERT INTO treport_content (id_report, id_gs, id_agent_module, type, period, `order`, name, description, id_agent, `text`, external_source, treport_custom_sql_id, header_definition, column_separator, line_separator, time_from, time_to, style, server_name, time_in_warning_status, checks_in_warning_status) SELECT id_report, 0, id_agent_module, 'availability', period, `order`, name, description, id_agent, NULL, NULL, treport_custom_sql_id, header_definition, column_separator, line_separator, time_from, time_to, '{&quot;show_in_same_row&quot;:0,&quot;hide_notinit_agents&quot;:0,&quot;priority_mode&quot;:1,&quot;dyn_height&quot;:&quot;230&quot;}', server_name, 1, 1 FROM treport_content WHERE type = 'histogram_data';
INSERT INTO treport_content_item (id_report_content, id_agent_module, id_agent_module_failover, operation, server_name) SELECT id_rc, id_agent_module, 0, '', server_name FROM treport_content WHERE type = 'availability' AND id_agent <> 0 AND id_agent_module <> 0;
DELETE FROM treport_content WHERE type = 'histogram_data';
ALTER TABLE `tevento` MODIFY `data` TINYTEXT default NULL;
ALTER TABLE `tmetaconsole_event` MODIFY `data` TINYTEXT default NULL;
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'custom_report_front_font';
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'fontpath';
UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';
COMMIT;

View File

@ -0,0 +1,6 @@
START TRANSACTION;
ALTER TABLE `tevent_filter` ADD COLUMN `time_from` TIME NULL;
ALTER TABLE `tevent_filter` ADD COLUMN `time_to` TIME NULL;
COMMIT;

View File

@ -1030,6 +1030,7 @@ ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_timestamp_idx` (`timestamp`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_module_status_idx` (`module_status`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_criticity_idx` (`criticity`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_agent_name_idx` (`agent_name`);
ALTER TABLE `tmetaconsole_event` MODIFY `data` TINYTEXT default NULL;
-- ---------------------------------------------------------------------
-- Table `tmetaconsole_event_history`
@ -1442,13 +1443,13 @@ ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 48);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 49);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 756);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 757);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
@ -2354,6 +2355,8 @@ ALTER TABLE `tevento` ADD COLUMN `data` double(50,5) default NULL;
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
ALTER TABLE `tevento` MODIFY `data` TINYTEXT default NULL;
-- ---------------------------------------------------------------------
-- Table `tevent_extended`
-- ---------------------------------------------------------------------
@ -4079,3 +4082,5 @@ CREATE TABLE IF NOT EXISTS `talert_execution_queue` (
`utimestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';

View File

@ -23,13 +23,8 @@ ui_require_css_file('order_interpreter');
// Global errors/warnings checking.
config_check();
echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
if ($config['menu_type'] == 'classic') {
echo '<div id="header_table" class="header_table_classic">';
} else {
echo '<div id="header_table" class="header_table_collapsed">';
}
?>
<div id="header_table_inner">
<?php

View File

@ -1,17 +1,33 @@
<?php
/**
* Lateral Main Menu.
*
* @category Main Menu.
* @package Pandora FMS.
* @subpackage OpenSource.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 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.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 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; 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.
if (! isset($config['id_user'])) {
// Begin.
if (isset($config['id_user']) === false) {
include 'general/login_page.php';
exit();
}
@ -20,9 +36,9 @@ if (! isset($config['id_user'])) {
<script type="text/javascript" language="javascript">
$(document).ready(function(){
var menuType_value = "<?php echo $config['menu_type']; ?>";
var menuType_value = "<?php echo $_SESSION['menu_type']; ?>";
if (menuType_value == 'classic') {
if (menuType_value === '' || menuType_value === 'classic') {
$('ul.submenu').css('left', '214px');
}
else{
@ -34,26 +50,22 @@ $(document).ready(function(){
<?php
$autohidden_menu = 0;
if (isset($config['autohidden_menu']) && $config['autohidden_menu']) {
if (isset($config['autohidden_menu']) === true && (bool) $config['autohidden_menu'] === true) {
$autohidden_menu = 1;
}
// Menu container prepared to autohide menu
if ($config['menu_type'] == 'classic') {
echo '<div id="menu_full" class="menu_full_classic">';
} else {
echo '<div id="menu_full" class="menu_full_collapsed">';
}
// Start of full lateral menu.
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
$custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed'];
if (!defined('PANDORA_ENTERPRISE')) {
if (defined('PANDORA_ENTERPRISE') === false) {
$logo_title = get_product_name().' Opensource';
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
$custom_logo_collapsed = 'images/custom_logo/pandora_logo_green_collapsed.png';
} else {
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo) === true) {
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
}
@ -61,54 +73,48 @@ if (!defined('PANDORA_ENTERPRISE')) {
}
echo '<div class="logo_green"><a href="index.php?sec=main">';
if (isset($config['custom_logo'])) {
if ($config['menu_type'] == 'classic') {
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:block']);
} else {
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:none']);
}
if (isset($config['custom_logo']) === true) {
echo html_print_image(
$custom_logo,
true,
[
'border' => '0',
'width' => '215',
'alt' => $logo_title,
'class' => 'logo_full',
'style' => ($menuCollapsed === true) ? 'display:none' : 'display:block',
]
);
}
if (isset($config['custom_logo_collapsed'])) {
if ($config['menu_type'] == 'classic') {
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:none']);
} else {
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:block']);
}
if (isset($config['custom_logo_collapsed']) === true) {
echo html_print_image(
$custom_logo_collapsed,
true,
[
'border' => '0',
'width' => '60',
'alt' => $logo_title,
'class' => 'logo_icon',
'style' => ($menuCollapsed === true) ? 'display:block' : 'display:none',
]
);
}
echo '</a></div>';
// echo '<div class="tit bg titop">:: '.__('Operation').' ::</div>';
require 'operation/menu.php';
// Check all enterprise ACL used in godmenu items to print menu headers
if (check_acl($config['id_user'], 0, 'AW')
|| check_acl($config['id_user'], 0, 'PM')
|| check_acl($config['id_user'], 0, 'LM')
|| check_acl($config['id_user'], 0, 'UM')
|| check_acl($config['id_user'], 0, 'LW')
|| check_acl($config['id_user'], 0, 'EW')
|| check_acl($config['id_user'], 0, 'DW')
) {
// echo '<div class="tit bg3">:: '.__('Administration').' ::</div>';
}
require 'godmode/menu.php';
if ($config['menu_type'] == 'classic') {
echo '<div id="button_collapse" class="button_classic button_collapse"></div>';
} else {
echo '<div id="button_collapse" class="button_collapsed button_collapse"></div>';
}
echo sprintf('<div id="button_collapse" class="button_%s button_collapse"></div>', $menuTypeClass);
// require ("links_menu.php");
echo '</div>';
// menu_container
// Menu_container.
ui_require_jquery_file('cookie');
$config_fixed_header = false;
if (isset($config['fixed_header'])) {
if (isset($config['fixed_header']) === true) {
$config_fixed_header = $config['fixed_header'];
}
?>

View File

@ -349,7 +349,14 @@ if (isset($groups[$grupo]) || $new_agent) {
}
$table_primary_group .= '<div class="label_select_child_icons"><span id="group_preview">';
$table_primary_group .= ui_print_group_icon($grupo, true);
if ($id_agente === 0) {
$hidden = 'display: none;';
} else {
$hidden = '';
}
$table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden);
$table_primary_group .= '</span></div></div></div>';
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').'</p>';
@ -1246,6 +1253,9 @@ ui_require_jquery_file('bgiframe');
});
$("select#id_os").pandoraSelectOS ();
$('select#grupo').pandoraSelectGroupIcon ();
var checked = $("#checkbox-cascade_protection").is(":checked");
if (checked) {

View File

@ -2095,7 +2095,7 @@ if ($delete_module) {
exit;
}
// Also call base function to delete modules madafakas de los cojones.
// Also call base function to delete modules.
modules_delete_agent_module($id_borrar_modulo);
// Check for errors.

View File

@ -443,6 +443,13 @@ $data[1] = html_print_input_text_extended(
$largeClassDisabledBecauseInPolicy,
true
);
$data[1] .= ui_print_help_tip(
__(
'Please use single quotation marks when necessary. '."\n".'
If double quotation marks are needed, please escape them with a backslash (\&quot;)'
),
true
);
$table_simple->colspan['row-cmd-row-1'][1] = 3;
push_table_simple($data, 'row-cmd-row-1');
@ -577,12 +584,7 @@ $(document).ready (function () {
$('#text-ip_target').keyup(function() {
$('#text-target_ip').val($(this).val());
});
$('#text-target_ip').keyup(function() {
$('#text-ip_target').val($(this).val());
});
$('#text-community').keyup(function() {
$('#text-snmp_community').val($(this).val());
});
$('#text-snmp_community').keyup(function() {
$('#text-community').val($(this).val());
});
@ -591,61 +593,25 @@ $(document).ready (function () {
// Display or collapse the SNMP browser's v3 options
checkSNMPVersion ();
});
$('#snmp_browser_version').change(function() {
$('#snmp_version').val($(this).val());
// Display or collapse the SNMP v3 options in the main window
if ($(this).val() == "3") {
$("#simple-field_snmpv3_row1").attr("style", "");
$("#simple-field_snmpv3_row2").attr("style", "");
$("#simple-field_snmpv3_row3").attr("style", "");
$("input[name=active_snmp_v3]").val(1);
$("input[name=snmp_community]").attr("disabled", true);
}
else {
$("#simple-field_snmpv3_row1").css("display", "none");
$("#simple-field_snmpv3_row2").css("display", "none");
$("#simple-field_snmpv3_row3").css("display", "none");
$("input[name=active_snmp_v3]").val(0);
$("input[name=snmp_community]").removeAttr('disabled');
}
});
$('#snmp3_auth_user').keyup(function() {
$('#snmp3_browser_auth_user').val($(this).val());
});
$('#snmp3_browser_auth_user').keyup(function() {
$('#snmp3_auth_user').val($(this).val());
});
$('#snmp3_security_level').change(function() {
$('#snmp3_browser_security_level').val($(this).val());
});
$('#snmp3_browser_security_level').change(function() {
$('#snmp3_security_level').val($(this).val());
});
$('#snmp3_auth_method').change(function() {
$('#snmp3_browser_auth_method').val($(this).val());
});
$('#snmp3_browser_auth_method').change(function() {
$('#snmp3_auth_method').val($(this).val());
});
$('#snmp3_auth_pass').keyup(function() {
$('#snmp3_browser_auth_pass').val($(this).val());
});
$('#snmp3_browser_auth_pass').keyup(function() {
$('#snmp3_auth_pass').val($(this).val());
});
$('#snmp3_privacy_method').change(function() {
$('#snmp3_browser_privacy_method').val($(this).val());
});
$('#snmp3_browser_privacy_method').change(function() {
$('#snmp3_privacy_method').val($(this).val());
});
$('#snmp3_privacy_pass').keyup(function() {
$('#snmp3_browser_privacy_pass').val($(this).val());
});
$('#snmp3_browser_privacy_pass').keyup(function() {
$('#snmp3_privacy_pass').val($(this).val());
});
var custom_ip_target = "<?php echo $custom_ip_target; ?>";
if(custom_ip_target == ''){
$("#text-custom_ip_target").hide();

View File

@ -708,7 +708,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible left">';
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post">';
$data[3] .= '<table class="databox_color w100p">';
$data[3] .= '<table class="databox_color w100p bg_color222">';
$data[3] .= html_print_input_hidden('add_action', 1, true);
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
@ -1120,6 +1120,12 @@ function show_add_action(id_alert) {
opacity: 0.5,
background: "black"
},
open: function() {
$("#action_select, #action_select").select2({
tags: true,
dropdownParent: $("#add_action-div-" + id_alert)
});
},
width: 500,
height: 300
})
@ -1150,6 +1156,12 @@ function show_display_update_action(id_module_action, alert_id, alert_id_agent_m
opacity: 0.5,
background: "black"
},
open: function() {
$("#action_select_ajax, #action_select_ajax").select2({
tags: true,
dropdownParent: $("#update_action-div")
});
},
width: 500,
height: 300
})

View File

@ -95,6 +95,7 @@ $fields_available['id_evento'] = __('Event Id');
$fields_available['evento'] = __('Event Name');
$fields_available['id_agente'] = __('Agent ID');
$fields_available['agent_name'] = __('Agent Name');
$fields_available['direccion'] = __('Agent IP');
$fields_available['id_usuario'] = __('User');
$fields_available['id_grupo'] = __('Group');
$fields_available['estado'] = __('Status');

View File

@ -404,7 +404,8 @@ $(document).ready (function () {
"get_agent_modules_json" : 1,
"get_id_and_name" : 1,
"disabled" : 0,
"id_agent" : id_agent
"id_agent" : id_agent,
"safe_name": 1,
};
var tags_to_search = $('#tags').val();
@ -434,7 +435,7 @@ $(document).ready (function () {
jQuery.each (data, function (i, val) {
option = $("<option></option>")
.attr ("value", val["id_agente_modulo"])
.append (val["nombre"]);
.append (val["safe_name"]);
$("#target_modules").append (option);
});

View File

@ -685,7 +685,8 @@ $(document).ready (function () {
"get_agent_modules_json" : 1,
"get_distinct_name" : 1,
"indexed" : 0,
"privilege" : "AW"
"privilege" : "AW",
"safe_name": 1
};
if (this.value != '0')
@ -712,7 +713,7 @@ $(document).ready (function () {
jQuery.each (data, function (id, value) {
option = $("<option></option>")
.attr("value", value["nombre"])
.html(value["nombre"]);
.html(value["safe_name"]);
$("#module_name").append (option);
});
hideSpinner();

View File

@ -1326,12 +1326,13 @@ $(document).ready (function () {
"page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1,
"get_distinct_name" : 1,
"indexed" : 0
"indexed" : 0,
"safe_name" : 1
};
if (this.value != '0')
params['id_tipo_modulo'] = this.value;
var status_module = $('#status_module').val();
if (status_module != '-1')
params['status_module'] = status_module;
@ -1342,16 +1343,16 @@ $(document).ready (function () {
params['tags'] = tags_to_search;
}
}
showSpinner();
$("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide ();
$("#module_name").attr ("disabled", "disabled")
$("#module_name option[value!=0]").remove ();
$("#module_name option[value!=0]").remove();
jQuery.post ("ajax.php",
params,
function (data, status) {
jQuery.each (data, function (id, value) {
option = $("<option></option>").attr ("value", value["nombre"]).html (value["nombre"]);
option = $("<option></option>").attr("value", value["nombre"]).html(value["safe_name"]);
$("#module_name").append (option);
});
hideSpinner();

View File

@ -525,10 +525,8 @@ if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager'])
$menu_godmode['messages']['id'] = 'god-um_messages';
$sub = [];
if ($config['enterprise_installed']) {
$sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update Manager offline');
$sub['godmode/update_manager/update_manager&tab=offline']['id'] = 'Offline';
}
$sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update Manager offline');
$sub['godmode/update_manager/update_manager&tab=offline']['id'] = 'Offline';
$sub['godmode/update_manager/update_manager&tab=online']['text'] = __('Update Manager online');
$sub['godmode/update_manager/update_manager&tab=online']['id'] = 'Online';

View File

@ -331,9 +331,9 @@ echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters'>";
echo '<tr>';
echo "<td colspan='3'>".__('Filter group').'</td>';
echo "<td colspan='1'>".__('Filter group').'</td>';
echo '</tr><tr>';
echo "<td colspan='3'>".html_print_select_groups(
echo "<td colspan='1'>".html_print_select_groups(
$config['id_user'],
($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RW'),
true,

View File

@ -751,6 +751,7 @@ switch ($action) {
$selected_agent_group_filter = $es['agent_group_filter'];
$selected_agents_inventory_display_options = $es['agents_inventory_display_options'];
$selected_agent_os_filter = $es['agent_os_filter'];
$selected_agent_custom_fields = $es['agent_custom_fields'];
$selected_agent_custom_field_filter = $es['agent_custom_field_filter'];
$selected_agent_status_filter = $es['agent_status_filter'];
$selected_agent_module_search_filter = $es['agent_module_search_filter'];
@ -3102,14 +3103,15 @@ $class = 'databox filters';
</tr>
<?php
$server_fields = [];
if (is_metaconsole()) {
$server_fields = [];
$server_fields[0] = __('All');
$servers = metaconsole_get_servers();
foreach ($servers as $key => $server) {
$server_fields[$key] = $server['server_name'];
}
foreach ($servers as $key => $server) {
$server_fields[$key] = $server['server_name'];
}
$server_filter_markup = '
<tr id="row_agent_server_filter" class="datos">
@ -3128,10 +3130,9 @@ $class = 'databox filters';
'min-width: 180px'
).'</td></tr>';
if (is_metaconsole()) {
echo $server_filter_markup;
}
?>
echo $server_filter_markup;
}
?>
<tr id="row_agent_group_filter" class="datos">
<td class="bolder">
@ -3180,6 +3181,28 @@ $class = 'databox filters';
</tr>
<tr id="row_custom_field" class="datos">
<td class="bolder">
<?php
echo __('Agent custom field');
?>
</td>
<td >
<?php
html_print_select_from_sql(
'SELECT id_field, name FROM tagent_custom_fields',
'agent_custom_fields[]',
$selected_agent_custom_fields,
'',
__('All'),
'0',
false,
true
);
?>
</td>
</tr>
<tr id="row_custom_field_filter" class="datos">
<td class="bolder">
<?php
echo __('Agent custom field filter');
@ -5177,7 +5200,6 @@ function addSLARow() {
$("input[name=id_agent_failover]").val('');
$("input[name=id_server]").val('');
$("input[name=agent_sla]").val('');
$("input[name=agent_sla]").css("background","url('<?php echo $autocompleteImage; ?>') right center no-repeat")
$("input[name=agent_failover]").val('');
$("#id_agent_module_sla").empty();
$("#id_agent_module_sla").attr('disabled', 'true');
@ -5504,6 +5526,7 @@ function chooseType() {
$("#row_agent_server_filter").hide();
$("#row_agent_group_filter").hide();
$("#row_os").hide();
$("#row_custom_field_filter").hide();
$("#row_custom_field").hide();
$("#row_agent_status").hide();
$("#row_agent_version").hide();
@ -6056,11 +6079,26 @@ function chooseType() {
$("#row_group").show();
$("#row_os").show();
$("#row_custom_field").show();
$("#row_custom_field_filter").show();
$("#row_agent_status").show();
$("#row_agent_version").show();
$("#row_agent_remote_conf").show();
$("#row_module_free_search").show();
if ($('#agent_custom_fields :selected').length > 0) {
$('#text-agent_custom_field_filter').removeAttr('disabled');
} else {
$('#text-agent_custom_field_filter').prop('disabled', true);
}
$("#agent_custom_fields").change(function(e) {
if ($('#agent_custom_fields :selected').length > 0) {
$('#text-agent_custom_field_filter').removeAttr('disabled');
} else {
$('#text-agent_custom_field_filter').prop('disabled', true);
}
});
break;
case 'inventory':

View File

@ -2232,6 +2232,7 @@ switch ($action) {
$es['agents_inventory_display_options'] = get_parameter('agents_inventory_display_options');
$es['agent_custom_field_filter'] = get_parameter('agent_custom_field_filter');
$es['agent_os_filter'] = get_parameter('agent_os_filter');
$es['agent_custom_fields'] = get_parameter('agent_custom_fields');
$es['agent_status_filter'] = get_parameter('agent_status_filter');
$es['agent_version_filter'] = get_parameter('agent_version_filter');
$es['agent_module_search_filter'] = get_parameter('agent_module_search_filter');
@ -2878,6 +2879,7 @@ switch ($action) {
$es['agents_inventory_display_options'] = get_parameter('agents_inventory_display_options');
$es['agent_custom_field_filter'] = get_parameter('agent_custom_field_filter');
$es['agent_os_filter'] = get_parameter('agent_os_filter');
$es['agent_custom_fields'] = get_parameter('agent_custom_fields');
$es['agent_status_filter'] = get_parameter('agent_status_filter');
$es['agent_version_filter'] = get_parameter('agent_version_filter');
$es['agent_module_search_filter'] = get_parameter('agent_module_search_filter');
@ -3390,7 +3392,7 @@ $buttons['view'] = [
$buttons[$activeTab]['active'] = true;
if ($idReport != 0) {
$textReportName = $reportName;
$textReportName = (empty($reportName) === false) ? $reportName : $report['name'];
} else {
$temp = $buttons['main'];
$buttons = null;

View File

@ -219,34 +219,15 @@ if ($filemanager) {
$id_plugin = (int) get_parameter('id_plugin', 0);
// Add custom directories here
// Add custom directories here.
$fallback_directory = 'attachment/plugin';
$directory = (string) get_parameter('directory', $fallback_directory);
$directory = str_replace('\\', '/', $directory);
// A miminal security check to avoid directory traversal
if (preg_match('/\.\./', $directory)) {
$directory = $fallback_directory;
}
if (preg_match('/^\//', $directory)) {
$directory = $fallback_directory;
}
if (preg_match('/^manager/', $directory)) {
$directory = $fallback_directory;
}
$banned_directories['include'] = true;
$banned_directories['godmode'] = true;
$banned_directories['operation'] = true;
$banned_directories['reporting'] = true;
$banned_directories['general'] = true;
$banned_directories[ENTERPRISE_DIR] = true;
if (isset($banned_directories[$directory])) {
// Get directory.
$directory = (string) get_parameter('directory');
if (empty($directory) === true) {
$directory = $fallback_directory;
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
$real_directory = realpath($config['homedir'].'/'.$directory);
@ -263,12 +244,12 @@ if ($filemanager) {
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
if ($upload_file_or_zip) {
upload_file($upload_file_or_zip, $default_real_directory);
if ($upload_file_or_zip === true) {
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
}
if ($create_text_file) {
create_text_file($default_real_directory);
if ($create_text_file === true) {
create_text_file($default_real_directory, $real_directory);
}
filemanager_file_explorer(

View File

@ -47,26 +47,15 @@ if (isset($config['filemanager']['message']) === true) {
$config['filemanager']['message'] = null;
}
$directory = (string) get_parameter('directory');
if (empty($directory) === true) {
$directory = 'images';
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, 'images');
}
// Add custom directories here.
$fallback_directory = 'images';
// Banned directories.
$banned_directories['include'] = true;
$banned_directories['godmode'] = true;
$banned_directories['operation'] = true;
$banned_directories['reporting'] = true;
$banned_directories['general'] = true;
$banned_directories[ENTERPRISE_DIR] = true;
if (isset($banned_directories[$directory]) === true) {
// Get directory.
$directory = (string) get_parameter('directory');
if (empty($directory) === true) {
$directory = $fallback_directory;
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
$real_directory = realpath($config['homedir'].'/'.$directory);
@ -76,14 +65,14 @@ echo '<h4>'.__('Index of %s', $directory).'</h4>';
$upload_file_or_zip = (bool) get_parameter('upload_file_or_zip');
$create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
$default_real_directory = realpath($config['homedir'].'/');
if ($upload_file_or_zip === true) {
upload_file($upload_file_or_zip, $default_real_directory);
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
}
if ($create_text_file === true) {
create_text_file($default_real_directory);
create_text_file($default_real_directory, $real_directory);
}
filemanager_file_explorer(
@ -96,5 +85,6 @@ filemanager_file_explorer(
'',
false,
'',
false,
false
);

View File

@ -327,6 +327,12 @@ if (is_array($config) === true) {
) {
ui_print_error_message(__('Update manager online requires registration.'));
}
if ($mode === Manager::MODE_OFFLINE) {
ui_print_warning_message(
__('Applying offline patches may make your console unusable, we recommend to completely backup your files before applying any patch.')
);
}
}
$url_update_manager = $config['url_update_manager'];
@ -381,6 +387,20 @@ if (is_array($config) === true) {
}
}
$proxy = null;
if (empty($config['update_manager_proxy_server']) === false
|| empty($config['update_manager_proxy_port']) === false
|| empty($config['update_manager_proxy_user']) === false
|| empty($config['update_manager_proxy_password']) === false
) {
$proxy = [
'host' => $config['update_manager_proxy_server'],
'port' => $config['update_manager_proxy_port'],
'user' => $config['update_manager_proxy_user'],
'password' => $config['update_manager_proxy_password'],
];
}
$ui = new Manager(
((is_array($config) === true) ? $pandora_url : 'http://'.$_SERVER['SERVER_ADDR'].'/'),
((is_array($config) === true) ? ui_get_full_url('ajax.php') : ''),
@ -400,6 +420,7 @@ $ui = new Manager(
'registration_code' => $puid,
'remote_config' => $remote_config,
'propagate_updates' => $is_metaconsole,
'proxy' => $proxy,
'set_maintenance_mode' => function () {
if (function_exists('config_update_value') === true) {
config_update_value('maintenance_mode', 1);

View File

@ -666,6 +666,7 @@ class Client
$target = __('console update %d', $request['version']);
}
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.Found
curl_setopt(
$ch,
CURLOPT_PROGRESSFUNCTION,
@ -1673,7 +1674,7 @@ class Client
);
$this->updateMR(
$this->productPath.'/extras/mr/'.$mr,
$this->extract_to.'/extras/mr/'.$mr,
$this->dbhHistory,
$historical_MR
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

View File

@ -34,7 +34,7 @@
<script type="text/javascript">
if (typeof $ != "function") {
// Dynamically include jquery if not added to this page.
document.write('<script type="text/javascript" src="<?php echo $asset('resources/javascript/jquery-3.3.1.min.js'); ?>"></'+'script>');
document.write('<script type="text/javascript" src="<?php echo $asset('resources/javascript/jquery.current.js'); ?>"></'+'script>');
}
</script>
<script src="<?php $asset('resources/javascript/umc.js'); ?>" type="text/javascript"></script>

View File

@ -34,7 +34,7 @@ $product_name = get_product_name(); ?>
<script type="text/javascript">
if (typeof $ != "function") {
// Dynamically include jquery if not added to this page.
document.write('<script type="text/javascript" src="<?php echo $asset('resources/javascript/jquery-3.3.1.min.js'); ?>"></'+'script>');
document.write('<script type="text/javascript" src="<?php echo $asset('resources/javascript/jquery.current.js'); ?>"></'+'script>');
document.write('<script type="text/javascript" src="<?php echo $asset('resources/javascript/jquery-ui.min.js'); ?>"></'+'script>');
}
</script>

View File

@ -37,12 +37,10 @@ $buttons['setup'] = [
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup">'.html_print_image('images/gm_setup.png', true, ['title' => __('Options'), 'class' => 'invert_filter']).'</a>',
];
if (enterprise_installed()) {
$buttons['offline'] = [
'active' => ($tab == 'offline') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offline">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager'), 'class' => 'invert_filter']).'</a>',
];
}
$buttons['offline'] = [
'active' => ($tab == 'offline') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offline">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager'), 'class' => 'invert_filter']).'</a>',
];
$buttons['online'] = [
'active' => ($tab == 'online') ? true : false,
@ -60,6 +58,7 @@ switch ($tab) {
break;
case 'online':
default:
$title = __('Update manager » Online');
break;
}

View File

@ -30,6 +30,7 @@
global $config;
require_once __DIR__.'/../../include/functions_users.php';
require_once __DIR__.'/../../include/functions_update_manager.php';
check_login();

View File

@ -100,7 +100,7 @@ $update_profile = (bool) get_parameter('update_profile');
$id_profile = (int) get_parameter('id');
$is_management_allowed = true;
if (is_management_allowed() === false) {
if (is_metaconsole() === false && is_management_allowed() === false) {
$is_management_allowed = false;
ui_print_warning_message(
__(

View File

@ -129,7 +129,7 @@ switch ($sortField) {
break;
default:
// Not possible.
// Nothing to do.
break;
}
break;
@ -153,7 +153,7 @@ switch ($sortField) {
break;
default:
// Not possible.
// Nothing to do.
break;
}
break;
@ -177,7 +177,7 @@ switch ($sortField) {
break;
default:
// Not possible.
// Nothing to do.
break;
}
break;
@ -395,7 +395,7 @@ $table->data[0][4] = html_print_submit_button(
);
$is_management_allowed = true;
if (is_management_allowed() === false) {
if (is_metaconsole() === false && is_management_allowed() === false) {
$is_management_allowed = false;
ui_print_warning_message(
__(
@ -585,11 +585,11 @@ foreach ($info as $user_id => $user_info) {
$cont++;
// Manual pagination due the complicated process of the ACL data.
if ($cont <= $offset) {
if ($cont <= $offset && $search !== true) {
continue;
}
if ($cont > ($limit + $offset)) {
if ($cont > ($limit + $offset) && $search !== true) {
break;
}
@ -820,6 +820,9 @@ foreach ($info as $user_id => $user_info) {
$data[6] .= '';
// Delete button not in this mode.
}
} else {
$data[6] .= '';
// Delete button not in this mode.
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

View File

@ -423,7 +423,7 @@ if ($show_update_action_menu) {
);
$data .= '<form id="update_action-'.$alert['id'].'" method="post">';
$data .= '<table class="databox_color w100p">';
$data .= '<table class="databox_color w100p bg_color222">';
$data .= html_print_input_hidden(
'update_action',
1,

View File

@ -252,7 +252,9 @@ if ($save_event_filter) {
$values['filter_only_alert'] = get_parameter('filter_only_alert');
$values['id_group_filter'] = get_parameter('id_group_filter');
$values['date_from'] = get_parameter('date_from');
$values['time_from'] = get_parameter('time_from');
$values['date_to'] = get_parameter('date_to');
$values['time_to'] = get_parameter('time_to');
$values['source'] = get_parameter('source');
$values['id_extra'] = get_parameter('id_extra');
$values['user_comment'] = get_parameter('user_comment');
@ -304,13 +306,15 @@ if ($update_event_filter) {
$values['filter_only_alert'] = get_parameter('filter_only_alert');
$values['id_group_filter'] = get_parameter('id_group_filter');
$values['date_from'] = get_parameter('date_from');
$values['time_from'] = get_parameter('time_from');
$values['date_to'] = get_parameter('date_to');
$values['time_to'] = get_parameter('time_to');
$values['source'] = get_parameter('source');
$values['id_extra'] = get_parameter('id_extra');
$values['user_comment'] = get_parameter('user_comment');
$values['id_source_event'] = get_parameter('id_source_event');
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$values['server_id'] = get_parameter('server_id');
}
@ -355,7 +359,9 @@ if ($get_filter_values) {
'id_extra' => '',
'id_user_ack' => '',
'date_from' => '',
'time_from' => '',
'date_to' => '',
'time_to' => '',
'severity' => '',
'event_type' => '',
'group_rep' => 0,
@ -380,7 +386,7 @@ if ($get_filter_values) {
}
}
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$server_name = db_get_value('server_name', 'tmetaconsole_setup', 'id', $event_filter['server_id']);
if ($server_name !== false) {
$event_filter['server_name'] = $server_name;
@ -543,8 +549,12 @@ function load_form_filter() {
$("#select2-server_id-container").text(val);
if(i == 'date_from')
$("#text-date_from").val(val);
if(i == 'time_from')
$("#text-time_from").val(val);
if(i == 'date_to')
$("#text-date_to").val(val);
if(i == 'time_to')
$("#text-time_to").val(val);
if(i == 'module_search')
$('input[name=module_search]').val(val);
if(i == 'group_name')
@ -767,7 +777,9 @@ function save_new_filter() {
"filter_only_alert" : $("#filter_only_alert").val(),
"id_group_filter": $("#id_group_filter").val(),
"date_from": $("#text-date_from").val(),
"time_from": $("#text-time_from").val(),
"date_to": $("#text-date_to").val(),
"time_to": $("#text-time_to").val(),
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
@ -838,7 +850,9 @@ function save_update_filter() {
"filter_only_alert" : $("#filter_only_alert").val(),
"id_group_filter": $("#id_group_filter").val(),
"date_from": $("#text-date_from").val(),
"time_from": $("#text-time_from").val(),
"date_to": $("#text-date_to").val(),
"time_to": $("#text-time_to").val(),
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
@ -1783,9 +1797,11 @@ if ($get_list_events_agents) {
$tag_without = get_parameter('tag_without');
$filter_only_alert = get_parameter('filter_only_alert');
$date_from = get_parameter('date_from');
$time_from = get_parameter('time_from', '00:00:00');
$date_to = get_parameter('date_to');
$time_to = get_parameter('time_to', '23:59:59');
$id_user = $config['id_user'];
hd('hollllaa', true);
$returned_sql = events_sql_events_grouped_agents(
$id_agent,
$server_id,
@ -1800,7 +1816,9 @@ if ($get_list_events_agents) {
$tag_without,
$filter_only_alert,
$date_from,
$time_from,
$date_to,
$time_to,
$id_user
);

View File

@ -105,19 +105,19 @@ if ($info == 'version') {
if (empty($apiPassword) === true
|| (empty($apiPassword) === false && $api_password === $apiPassword)
&& (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true)
) {
// Allow internal direct node -> metaconsole connection
// or node -> own console connection.
$config['__internal_call'] = true;
$config['id_usuario'] = 'admin';
// Compat.
$config['id_user'] = 'admin';
$correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) {
// External access.
if (empty($apiPassword) === true || (empty($apiPassword) === false && $api_password === $apiPassword)) {
if (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true
) {
// Allow internal direct node -> metaconsole connection
// or node -> own console connection.
$config['__internal_call'] = true;
$config['id_usuario'] = 'admin';
// Compat.
$config['id_user'] = 'admin';
$correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) {
// External access.
$user_in_db = process_user_login($user, $password, true);
if ($user_in_db !== false) {
$config['id_usuario'] = $user_in_db;
@ -138,10 +138,10 @@ if (empty($apiPassword) === true
$no_login_msg = 'Incorrect user credentials';
}
} else {
$no_login_msg = 'Incorrect given API password';
$no_login_msg = 'IP '.$ipOrigin.' is not in ACL list';
}
} else {
$no_login_msg = 'IP '.$ipOrigin.' is not in ACL list';
$no_login_msg = 'Incorrect given API password';
}
if ($correctLogin) {

View File

@ -95,7 +95,7 @@ if (check_login(false) === false) {
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.current.js'></script>
</head>
<body>
<h1>Access is not granted</h1>
@ -153,7 +153,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.current.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.js"></script>

View File

@ -2336,7 +2336,7 @@ class ConsoleSupervisor
// Check if DiscoveryCronTasks is running. Warn user if not.
if ($config['cron_last_run'] == 0
|| (get_system_time() - $config['cron_last_run']) > 3600
|| (get_system_time() - $config['cron_last_run']) > SECONDS_10MINUTES
) {
$message_conf_cron = __('DiscoveryConsoleTasks is not running properly');
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
@ -2359,12 +2359,17 @@ class ConsoleSupervisor
$message_conf_cron .= __('Please, make sure process is not locked.');
}
$url = '__url__/index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist';
if (is_metaconsole() === true) {
$url = '__url__index.php?sec=extensions&sec2=enterprise/extensions/cron';
}
$this->notify(
[
'type' => 'NOTIF.CRON.CONFIGURED',
'title' => __('DiscoveryConsoleTasks is not configured.'),
'message' => __($message_conf_cron),
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist',
'url' => $url,
]
);
} else {

View File

@ -837,8 +837,11 @@ class ModuleTemplates extends HTML
$penInfo = db_get_all_rows_filter('tnetwork_profile_pen', ['id_np' => $this->id_np]);
$penList = [];
foreach ($penInfo as $pen) {
$penList[] = $pen['pen'];
// Handle if list of PEN does not exist or is empty.
if ($penInfo !== false) {
foreach ($penInfo as $pen) {
$penList[] = $pen['pen'];
}
}
$this->pen = implode(',', $penList);

View File

@ -3043,6 +3043,7 @@ class NetworkMap
$table->data = [];
$table->rowstyle['template_row'] = 'display: none;';
$table->data['template_row']['node_source'] = '';
// Inputs must be not select2, cause duplication make issues.
$table->data['template_row']['interface_source'] = html_print_select(
[],
'interface_source',
@ -3050,7 +3051,21 @@ class NetworkMap
'',
__('None'),
0,
true
true,
false,
true,
'',
false,
false,
false,
false,
false,
'',
false,
false,
false,
false,
false
);
$table->data['template_row']['interface_target'] = html_print_select(
[],
@ -3059,7 +3074,21 @@ class NetworkMap
'',
__('None'),
0,
true
true,
false,
true,
'',
false,
false,
false,
false,
false,
'',
false,
false,
false,
false,
false
);
$table->data['template_row']['node_target'] = '';
@ -3414,7 +3443,7 @@ class NetworkMap
).'" />'."\n";
$output .= '<div id="simple_map" data-id="'.$this->idMap.'" ';
$output .= 'class="border_1px_dd';
$output .= 'class="border_1px_dd" style="';
if ($this->fullSize) {
$output .= ' width:100%';

View File

@ -593,7 +593,7 @@ class Tree
$module['type'] = 'module';
$module['id'] = (int) $module['id'];
$module['name'] = io_safe_output($module['name']);
$module['name'] = $module['name'];
$module['id_module_type'] = (int) $module['id_tipo_modulo'];
$module['server_type'] = (int) $module['id_modulo'];
$module['status'] = $module['estado'];
@ -1097,7 +1097,7 @@ class Tree
protected function getThirdLevelSql()
{
// Get the server id
// Get the server id.
$serverID = $this->serverID;
$group_acl = $this->getGroupAclCondition();

View File

@ -20,8 +20,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC210809';
$pandora_version = 'v7.0NG.756';
$build_version = 'PC210922';
$pandora_version = 'v7.0NG.757';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();
@ -306,7 +306,7 @@ switch ($config['dbtype']) {
// ======================================================================
// Menu display mode.
if (isset($_SESSION['meny_type']) === true && $_SESSION['menu_type']) {
if (isset($_SESSION['meny_type']) === true && empty($_SESSION['menu_type']) === false) {
$config['menu_type'] = $_SESSION['menu_type'];
} else {
$config['menu_type'] = 'classic';

View File

@ -1585,7 +1585,7 @@ function enterprise_include($filename, $variables=[])
extract($variables);
}
include $filepath;
include_once $filepath;
return true;
}
@ -3299,8 +3299,10 @@ function extract_column($array, $column)
function get_percentile($percentile, $array)
{
global $config;
sort($array);
$index = (($percentile / 100) * count($array));
$index = (($config['percentil'] / 100) * count($array));
if (floor($index) == $index) {
$result = (($array[($index - 1)] + $array[$index]) / 2);

View File

@ -3187,6 +3187,7 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
$module_description = $module['descripcion'];
$db_status = modules_get_agentmodule_status($module_id);
$module_value = modules_get_last_value($module_id);
$last_contact = modules_get_last_contact($module_id);
modules_get_status($module_id, $db_status, $module_value, $status, $title);
$status_image = ui_print_status_image($status, $title, true);
@ -3267,6 +3268,7 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
$agent_interfaces[$interface_name]['status_module_name'] = $module_name;
$agent_interfaces[$interface_name]['ip'] = $ip_target;
$agent_interfaces[$interface_name]['mac'] = $mac;
$agent_interfaces[$interface_name]['last_contact'] = $last_contact;
if ($interface_traffic_modules !== false) {
$agent_interfaces[$interface_name]['traffic'] = [];

View File

@ -14821,6 +14821,9 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
// Graph width (optional).
$width = (!empty($other) && isset($other['data'][4]) && $other['data'][4]) ? $other['data'][4] : '';
// If recive value its from mail call.
$graph_font_size = $other['data'][5];
} else {
// Fixed parameters for _modulegraph_nh_.
$graph_seconds = $other['data'];
@ -14857,6 +14860,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
'fullscale' => false,
'return_img_base_64' => true,
'image_treshold' => $graph_threshold,
'graph_font_size' => $graph_font_size,
];
// Format MIME RFC 2045 (line break 76 chars).
@ -17337,7 +17341,7 @@ function remove_agent_from_policy($id_policy, $use_agent_name, $params)
$agent = db_get_row_filter('tmetaconsole_agent', ['id_tagente' => $id_agent, 'id_tmetaconsole_setup' => $id_node]);
}
$policy = policies_get_policy($id_policy, false, false);
$policy = policies_get_policy($id_policy);
$policy_agent = (is_metaconsole()) ? db_get_row_filter('tpolicy_agents', ['id_policy' => $id_policy, 'id_agent' => $id_agent, 'id_node' => $id_node]) : db_get_row_filter('tpolicy_agents', ['id_policy' => $id_policy, 'id_agent' => $id_agent]);

View File

@ -2243,7 +2243,7 @@ function config_process_config()
if (!isset($config['fontpath'])) {
config_update_value(
'fontpath',
'lato.ttf'
'Lato-Regular.ttf'
);
}
@ -3126,7 +3126,7 @@ function config_process_config()
}
if (!isset($config['custom_report_front_font'])) {
config_update_value('custom_report_front_font', 'lato.ttf');
config_update_value('custom_report_front_font', 'Lato-Regular.ttf');
}
if (!isset($config['custom_report_front_logo'])) {
@ -3386,7 +3386,7 @@ function config_user_set_custom_config()
}
}
if ((isset($userinfo['id_skin']) && $userinfo['id_skin'] !== 0)) {
if ((isset($userinfo['id_skin']) && (int) $userinfo['id_skin'] !== 0)) {
if ((int) $userinfo['id_skin'] === 1) {
$config['style'] = 'pandora';
}
@ -3402,12 +3402,10 @@ function config_user_set_custom_config()
if ($sec2_aux != 'godmode/groups/group_list' && $skin !== false) {
$id_user_aux = get_parameter('id');
if ($id_user_aux == $config['id_user']) {
if ((int) $skin === 1 || (int) $skin === 0) {
$config['style'] = 'pandora';
}
if ((int) $skin === 2) {
if ($config['style'] === 'pandora_black' && (int) $skin === 0 || (int) $skin === 2) {
$config['style'] = 'pandora_black';
} else if ((int) $skin === 1 || (int) $skin === 0) {
$config['style'] = 'pandora';
}
}
}

View File

@ -305,6 +305,9 @@ function events_get_column_name($field, $table_alias=false)
return __('Severity mini');
}
case 'direccion':
return __('Agent IP');
default:
return __($field);
}
@ -759,7 +762,7 @@ function events_get_all(
}
if (isset($filter['time_from'])) {
$time_from = $filter['time_from'];
$time_from = (empty($filter['time_from']) === true) ? '00:00:00' : $filter['time_from'];
}
if (isset($date_from)) {
@ -782,7 +785,7 @@ function events_get_all(
}
if (isset($filter['time_to'])) {
$time_to = $filter['time_to'];
$time_to = (empty($filter['time_to']) === true) ? '23:59:59' : $filter['time_to'];
}
if (isset($date_to)) {
@ -3581,7 +3584,12 @@ function events_page_responses($event, $childrens_ids=[])
'',
__('None'),
-1,
true
true,
false,
true,
'',
false,
'width: 70%'
);
$data[2] .= html_print_button(
__('Update'),
@ -4872,6 +4880,14 @@ function events_page_general($event)
$data[1] = '<span class="break_word">'.events_display_name($event['evento']).'</span>';
$table_general->data[] = $data;
// Show server name in metaconsole.
if (is_metaconsole() === true && $event['server_name'] !== '') {
$data = [];
$data[0] = __('Node');
$data[1] = '<span class="break_word">'.$event['server_name'].'</span>';
$table_general->data[] = $data;
}
$data = [];
$data[0] = __('Timestamp');
@ -6177,7 +6193,9 @@ function events_get_events_grouped_by_agent(
* @param array $tag_without Tag_without.
* @param boolean $filter_only_alert Filter_only_alert.
* @param string $date_from Date_from.
* @param string $time_from Time_from.
* @param string $date_to Date_to.
* @param string $time_to Time_to.
* @param boolean $id_user Id_user.
* @param boolean $server_id_search Server_id_search.
*
@ -6197,7 +6215,9 @@ function events_sql_events_grouped_agents(
$tag_without=[],
$filter_only_alert=false,
$date_from='',
$time_from='',
$date_to='',
$time_to='',
$id_user=false,
$server_id_search=false
) {
@ -6304,27 +6324,35 @@ function events_sql_events_grouped_agents(
$sql_post .= " AND id_usuario = '".$id_user_ack."'";
}
if (!isset($date_from)) {
if (isset($date_from) === false) {
$date_from = '';
}
if (!isset($date_to)) {
if (isset($time_from) === false) {
$time_from = '00:00:00';
}
if (isset($date_to) === false) {
$date_to = '';
}
if (isset($time_to) === false || empty($time_to) === true) {
$time_to = '23:59:59';
}
if (($date_from == '') && ($date_to == '')) {
if ($event_view_hr > 0) {
$unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR));
$sql_post .= ' AND (utimestamp > '.$unixtime.')';
}
} else {
if ($date_from != '') {
$udate_from = strtotime($date_from.' 00:00:00');
if (empty($date_from) === false) {
$udate_from = strtotime($date_from.' '.$time_from);
$sql_post .= ' AND (utimestamp >= '.$udate_from.')';
}
if ($date_to != '') {
$udate_to = strtotime($date_to.' 23:59:59');
if (empty($date_to) === false) {
$udate_to = strtotime($date_to.' '.$time_to);
$sql_post .= ' AND (utimestamp <= '.$udate_to.')';
}
}

View File

@ -26,7 +26,6 @@
* ============================================================================
*/
// Get global data.
// Constants.
define('MIME_UNKNOWN', 0);
@ -129,15 +128,16 @@ require_once $config['homedir'].'/vendor/autoload.php';
*
* @param boolean $upload_file_or_zip Upload file or zip.
* @param string $default_real_directory String with default directory.
* @param string $destination_directory String with destination directory.
*
* @return void
*/
function upload_file($upload_file_or_zip, $default_real_directory)
function upload_file($upload_file_or_zip, $default_real_directory, $destination_directory)
{
global $config;
$config['filemanager'] = [];
$config['filemanager']['correct_upload_file'] = 0;
$config['filemanager']['message'] = null;
$config['filemanager']['message'] = '';
check_login();
@ -165,34 +165,43 @@ function upload_file($upload_file_or_zip, $default_real_directory)
if ($upload_file === true) {
if (isset($_FILES['file']) === true && empty($_FILES['file']['name']) === false) {
$filename = $_FILES['file']['name'];
$filesize = $_FILES['file']['size'];
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
$directory = filemanager_safe_directory((string) get_parameter('directory'));
$real_directory = filemanager_safe_directory($destination_directory);
$umask = io_safe_output((string) get_parameter('umask'));
if (strpos($real_directory, $default_real_directory) !== 0) {
// Perform security check to determine whether received upload directory is part of the default path for caller uploader and user is not trying to access an external path (avoid execution of PHP files in directories that are not explicitly controlled by corresponding .htaccess).
ui_print_error_message(__('Security error'));
// Perform security check to determine whether received upload
// directory is part of the default path for caller uploader and
// user is not trying to access an external path (avoid
// execution of PHP files in directories that are not explicitly
// controlled by corresponding .htaccess).
$config['filemanager']['message'] = ui_print_error_message(__('Security error'));
} else {
// Copy file to directory and change name.
if (empty($directory) === true) {
$nombre_archivo = $real_directory.'/'.$filename;
} else {
$nombre_archivo = $default_real_directory.'/'.$directory.'/'.$filename;
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
try {
$result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
} catch (Exception $ex) {
$result = false;
}
if (! @copy($_FILES['file']['tmp_name'], $nombre_archivo)) {
$config['filemanager']['message'] = ui_print_error_message(__('Upload error'));
} else {
if ($result === true) {
// If umask is provided, set.
if (empty($umask) === false) {
chmod($nombre_archivo, $umask);
try {
chmod($nombre_archivo, $umask);
} catch (Exception $ex) {
$config['filemanager']['message'] = ui_print_error_message(__('Issue setting umask: %s', $ex->getMessage()));
}
}
// Upload performed properly.
$config['filemanager']['message'] .= ui_print_success_message(__('Upload correct'));
$config['filemanager']['correct_upload_file'] = 1;
ui_print_success_message(__('Upload correct'));
// Delete temporal file.
unlink($_FILES['file']['tmp_name']);
} else {
$config['filemanager']['message'] = ui_print_error_message(__('Upload error'));
}
}
}
@ -204,10 +213,8 @@ function upload_file($upload_file_or_zip, $default_real_directory)
&& empty($_FILES['file']['name']) === false
) {
$filename = $_FILES['file']['name'];
$filesize = $_FILES['file']['size'];
$filepath = $_FILES['file']['tmp_name'];
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
$directory = filemanager_safe_directory((string) get_parameter('directory'));
$real_directory = filemanager_safe_directory($destination_directory);
if (strpos($real_directory, $default_real_directory) !== 0) {
// Perform security check to determine whether received upload
@ -218,10 +225,10 @@ function upload_file($upload_file_or_zip, $default_real_directory)
ui_print_error_message(__('Security error'));
} else {
if (PandoraFMS\Tools\Files::unzip($filepath, $real_directory) === false) {
ui_print_error_message(__('It was impossible to uncompress your file'));
$config['filemanager']['message'] = ui_print_error_message(__('It was impossible to uncompress your file'));
} else {
unlink($_FILES['file']['tmp_name']);
ui_print_success_message(__('Upload correct'));
$config['filemanager']['message'] = ui_print_success_message(__('Upload correct'));
$config['filemanager']['correct_upload_file'] = 1;
}
}
@ -239,7 +246,7 @@ if (isset($_SERVER['CONTENT_LENGTH']) === true) {
}
function create_text_file($default_real_directory)
function create_text_file($default_real_directory, $destination_directory)
{
global $config;
@ -255,37 +262,42 @@ function create_text_file($default_real_directory)
return;
}
$filename = io_safe_output(get_parameter('name_file'));
$filename = filemanager_safe_directory((string) get_parameter('name_file'));
if (empty($filename) === false) {
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
$directory = filemanager_safe_directory((string) get_parameter('directory'));
$real_directory = filemanager_safe_directory($destination_directory);
$umask = (string) get_parameter('umask');
if (strpos($real_directory, $default_real_directory) !== 0) {
// Perform security check to determine whether received upload directory is part of the default path for caller uploader and user is not trying to access an external path (avoid execution of PHP files in directories that are not explicitly controlled by corresponding .htaccess).
// Perform security check to determine whether received upload
// directory is part of the default path for caller uploader and
// user is not trying to access an external path (avoid execution
// of PHP files in directories that are not explicitly controlled by
// corresponding .htaccess).
ui_print_error_message(__('Security error'));
} else {
if (empty($directory) === true) {
$nombre_archivo = $real_directory.'/'.$filename;
} else {
$nombre_archivo = $default_real_directory.'/'.$directory.'/'.$filename;
}
$nombre_archivo = $real_directory.'/'.$filename;
if (! @touch($nombre_archivo)) {
$config['filemanager']['message'] = ui_print_error_message(__('Error creating file'));
} else {
if ($umask !== '') {
chmod($nombre_archivo, $umask);
try {
// Create the file.
$result = touch($nombre_archivo);
if ($result === true) {
if ($umask !== '') {
chmod($nombre_archivo, $umask);
}
ui_print_success_message(__('File created correctly'));
$config['filemanager']['correct_upload_file'] = 1;
} else {
throw new Exception(__('Error creating file'));
}
ui_print_success_message(__('Upload correct'));
$config['filemanager']['correct_upload_file'] = 1;
} catch (Exception $ex) {
$config['filemanager']['message'] = ui_print_error_message($ex->getMessage());
}
}
} else {
ui_print_error_message(__('Error creating file with empty name'));
$config['filemanager']['message'] = ui_print_error_message(__('Error creating file with empty name'));
}
}
@ -295,13 +307,18 @@ $create_dir = (bool) get_parameter('create_dir');
if ($create_dir === true) {
global $config;
$homedir_filemanager = io_safe_output($config['attachment_store']).'/collection';
$sec2 = get_parameter('sec2');
if ($sec2 === 'enterprise/godmode/agentes/collections' || $sec2 === 'advanced/collections') {
$homedir_filemanager = io_safe_output($config['attachment_store']).'/collection';
} else {
$homedir_filemanager = io_safe_output($config['homedir']);
}
$config['filemanager'] = [];
$config['filemanager']['correct_create_dir'] = 0;
$config['filemanager']['message'] = null;
$directory = filemanager_safe_directory((string) get_parameter('directory', '/'));
$directory = filemanager_safe_directory((string) get_parameter('directory'));
$hash = (string) get_parameter('hash');
$testHash = md5($directory.$config['server_unique_identifier']);
@ -312,12 +329,23 @@ if ($create_dir === true) {
if (empty($dirname) === false) {
// Create directory.
@mkdir(
$homedir_filemanager.'/'.$directory.'/'.$dirname
);
$config['filemanager']['message'] = ui_print_success_message(__('Directory created'), '', true);
try {
// If directory exists, add an slash at end.
if (empty($directory) === false) {
$directory .= '/';
}
$config['filemanager']['correct_create_dir'] = 1;
$result = mkdir($homedir_filemanager.'/'.$directory.$dirname);
if ($result === true) {
$config['filemanager']['message'] = ui_print_success_message(__('Directory created'), '', true);
$config['filemanager']['correct_create_dir'] = 1;
} else {
throw new Exception(__('Something gone wrong creating directory'));
}
} catch (Exception $ex) {
$config['filemanager']['message'] = ui_print_error_message($ex->getMessage(), '', true);
}
} else {
$config['filemanager']['message'] = ui_print_error_message(__('Error creating file with empty name'), '', true);
}
@ -367,7 +395,9 @@ if ($delete_file === true) {
/**
* Recursive delete directory and empty or not directory.
*
* @param string $dir The dir to deletete
* @param string $dir The dir to deletete.
*
* @return void
*/
function filemanager_delete_directory($dir)
{
@ -397,8 +427,9 @@ function filemanager_delete_directory($dir)
* Read a directory recursibly and return a array with the files with
* the absolute path and relative
*
* @param string $dir absoute dir to scan
* @param string $relative_path Relative path to scan, by default ''
* @param string $dir Absoute dir to scan.
* @param string $relative_path Relative path to scan, by default ''.
* @param boolean $add_empty_dirs Add empty dirs.
*
* @return array The files in the dirs, empty array for empty dir of files.
*/
@ -406,14 +437,14 @@ function filemanager_read_recursive_dir($dir, $relative_path='', $add_empty_dirs
{
$return = [];
// Windows compatibility
// Windows compatibility.
$dir = str_replace('\\', '/', $dir);
$relative_path = str_replace('\\', '/', $relative_path);
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if (($entry != '.') && ($entry != '..')) {
if (is_dir($dir.$entry)) {
if (($entry !== '.') && ($entry !== '..')) {
if (is_dir($dir.$entry) === true) {
$return[] = [
'relative' => $relative_path.$entry,
'absolute' => $dir.$entry,
@ -449,14 +480,17 @@ function filemanager_read_recursive_dir($dir, $relative_path='', $add_empty_dirs
/**
* The main function to show the directories and files.
*
* @param string $real_directory The string of dir as realpath.
* @param string $relative_directory The string of dir as relative path.
* @param string $url The url to set in the forms and some links in the explorer.
* @param string $father The directory father don't navigate bottom this.
* @param boolean $editor The flag to set the edition of text files.
* @param string $url_file The url to put in the files instead the default. By default empty string and use the url of filemanager.
* @param boolean $download_button The flag to show download button, by default false.
* @param string $umask The umask as hex values to set the new files or updload.
* @param string $real_directory The string of dir as realpath.
* @param string $relative_directory The string of dir as relative path.
* @param string $url The url to set in the forms and some links in the explorer.
* @param string $father The directory father don't navigate bottom this.
* @param boolean $editor The flag to set the edition of text files.
* @param boolean $readOnly If true, only can read the files.
* @param string $url_file The url to put in the files instead the default. By default empty string and use the url of filemanager.
* @param boolean $download_button The flag to show download button, by default false.
* @param string $umask The umask as hex values to set the new files or updload.
* @param boolean $homedir_filemanager Homedir filemanager.
* @param boolean $allowCreateText If true, 'Create Text' button will be shown.
*/
function filemanager_file_explorer(
$real_directory,
@ -468,11 +502,12 @@ function filemanager_file_explorer(
$url_file='',
$download_button=false,
$umask='',
$homedir_filemanager=false
$homedir_filemanager=false,
$allowCreateText=true
) {
global $config;
// Windows compatibility
// Windows compatibility.
$real_directory = str_replace('\\', '/', $real_directory);
$relative_directory = str_replace('\\', '/', $relative_directory);
$father = str_replace('\\', '/', $father);
@ -481,10 +516,7 @@ function filemanager_file_explorer(
$homedir_filemanager = $config['homedir'];
}
$hack_metaconsole = '';
if (defined('METACONSOLE')) {
$hack_metaconsole = '../../';
}
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
?>
<script type="text/javascript">
@ -493,13 +525,13 @@ function filemanager_file_explorer(
$("#create_folder").css("display", "block");
check_opened_dialog('create_folder');
}
<?php if ($allowCreateText === true) : ?>
function show_create_text_file() {
actions_dialog('create_text_file');
$("#create_text_file").css("display", "block");
check_opened_dialog('create_text_file');
}
<?php endif ?>
function show_upload_file() {
actions_dialog('upload_file');
$("#upload_file").css("display", "block");
@ -512,12 +544,13 @@ function filemanager_file_explorer(
$('#create_folder').dialog('close');
}
}
<?php if ($allowCreateText === true) : ?>
if(check_opened !== 'create_text_file'){
if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) {
$('#create_text_file').dialog('close');
}
}
<?php endif ?>
if(check_opened !== 'upload_file'){
if (($("#upload_file").hasClass("ui-dialog-content") && $('#upload_file').dialog('isOpen')) === true) {
$('#upload_file').dialog('close');
@ -532,11 +565,11 @@ function filemanager_file_explorer(
case 'create_folder':
title_action = "<?php echo __('Create a Directory'); ?>";
break;
<?php if ($allowCreateText === true) : ?>
case 'create_text_file':
title_action = "<?php echo __('Create a Text'); ?>";
break;
<?php endif ?>
case 'upload_file':
title_action = "<?php echo __('Upload Files'); ?>";
break;
@ -567,28 +600,21 @@ function filemanager_file_explorer(
}
</script>
<?php
// List files
if (! is_dir($real_directory)) {
// List files.
if (is_dir($real_directory) === false) {
echo __('Directory %s doesn\'t exist!', $relative_directory);
return;
}
$files = filemanager_list_dir($real_directory);
if (!empty($files)) {
if (empty($files) === false) {
$table = new stdClass();
$table->width = '100%';
$table->id = 'table_filemanager';
if (!defined('METACONSOLE')) {
$table->class = 'info_table';
$table->title = '<span>'.__('Index of %s', $relative_directory).'</span>';
}
if (defined('METACONSOLE')) {
$table->class = 'databox_tactical';
$table->title = '<span>'.__('Index of %s', $relative_directory).'</span>';
}
$table->class = (is_metaconsole() === true) ? 'databox_tactical' : 'info_table';
$table->title = '<span>'.__('Index of %s', $relative_directory).'</span>';
$table->colspan = [];
$table->data = [];
$table->head = [];
@ -608,10 +634,12 @@ function filemanager_file_explorer(
$table->head[4] = __('Actions');
$prev_dir = explode('/', $relative_directory);
$count_prev_dir = count($prev_dir);
$prev_dir_str = '';
for ($i = 0; $i < (count($prev_dir) - 1); $i++) {
$prev_dir_count = count($prev_dir);
for ($i = 0; $i < ($prev_dir_count - 1); $i++) {
$prev_dir_str .= $prev_dir[$i];
if ($i < (count($prev_dir) - 2)) {
if ($i < ($prev_dir_count - 2)) {
$prev_dir_str .= '/';
}
}
@ -649,16 +677,16 @@ function filemanager_file_explorer(
break;
case MIME_UNKNOWN:
if ($fileinfo['size'] == 0) {
if ((int) $fileinfo['size'] === 0) {
if ((strstr($fileinfo['name'], '.txt') !== false) || (strstr($fileinfo['name'], '.conf') !== false) || (strstr($fileinfo['name'], '.sql') !== false) || (strstr($fileinfo['name'], '.pl') !== false)) {
$fileinfo['mime'] = MIME_TEXT;
$data[0] = html_print_image('images/mimetypes/text.png', true, ['title' => __('Text file'), 'class' => 'invert_filter']);
} else {
// unknow
// Unknown.
$data[0] = '';
}
} else {
// pdf
// Pdf.
$data[0] = '';
}
break;
@ -670,8 +698,8 @@ function filemanager_file_explorer(
if ($fileinfo['is_dir']) {
$data[1] = '<a href="'.$url.'&directory='.$relative_directory.'/'.$fileinfo['name'].'&hash2='.md5($relative_directory.'/'.$fileinfo['name'].$config['server_unique_identifier']).'">'.$fileinfo['name'].'</a>';
} else if (!empty($url_file)) {
// Set the custom url file
} else if (empty($url_file) === false) {
// Set the custom url file.
$url_file_clean = str_replace('[FILE_FULLPATH]', $fileinfo['realpath'], $url_file);
$data[1] = '<a href="'.$url_file_clean.'">'.$fileinfo['name'].'</a>';
@ -681,9 +709,9 @@ function filemanager_file_explorer(
$data[1] = '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'">'.$fileinfo['name'].'</a>';
}
// Notice that uploaded php files could be dangerous
if (pathinfo($fileinfo['realpath'], PATHINFO_EXTENSION) == 'php'
&& (is_readable($fileinfo['realpath']) || is_executable($fileinfo['realpath']))
// Notice that uploaded php files could be dangerous.
if (pathinfo($fileinfo['realpath'], PATHINFO_EXTENSION) === 'php'
&& (is_readable($fileinfo['realpath']) === true || is_executable($fileinfo['realpath']) === true)
) {
$error_message = __('This file could be executed by any user');
$error_message .= '. '.__('Make sure it can\'t perform dangerous tasks');
@ -702,12 +730,13 @@ function filemanager_file_explorer(
}
// Actions buttons
// Delete button
// Delete button.
$data[4] = '';
$data[4] .= '<span style="display: flex">';
$typefile = array_pop(explode('.', $fileinfo['name']));
if (is_writable($fileinfo['realpath'])
&& (! is_dir($fileinfo['realpath']) || count(scandir($fileinfo['realpath'])) < 3) && (!$readOnly)
if (is_writable($fileinfo['realpath']) === true
&& (is_dir($fileinfo['realpath']) === false || count(scandir($fileinfo['realpath'])) < 3)
&& ($readOnly === false)
) {
$data[4] .= '<form method="post" action="'.$url.'" style="">';
$data[4] .= '<input type="image" class="invert_filter" src="images/cross.png" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
@ -717,7 +746,7 @@ function filemanager_file_explorer(
$relative_dir = str_replace($homedir_filemanager, '', str_replace('\\', '/', dirname($fileinfo['realpath'])));
if ($relative_dir[0] == '/') {
if ($relative_dir[0] === '/') {
$relative_dir = substr($relative_dir, 1);
}
@ -727,9 +756,9 @@ function filemanager_file_explorer(
$data[4] .= html_print_input_hidden('hash2', $hash2, true);
$data[4] .= '</form>';
if (($editor) && (!$readOnly)) {
if (($typefile != 'bin') && ($typefile != 'pdf') && ($typefile != 'png') && ($typefile != 'jpg')
&& ($typefile != 'iso') && ($typefile != 'docx') && ($typefile != 'doc') && ($fileinfo['mime'] != MIME_DIR)
if (($editor) && ($readOnly === false)) {
if (($typefile !== 'bin') && ($typefile !== 'pdf') && ($typefile !== 'png') && ($typefile !== 'jpg')
&& ($typefile !== 'iso') && ($typefile !== 'docx') && ($typefile !== 'doc') && ($fileinfo['mime'] != MIME_DIR)
) {
$hash = md5($fileinfo['realpath'].$config['server_unique_identifier']);
$data[4] .= "<a style='vertical-align: top;' href='$url&edit_file=1&hash=".$hash.'&location_file='.$fileinfo['realpath']."' style='float: left;'>".html_print_image('images/edit.png', true, ['style' => 'margin-top: 2px;', 'title' => __('Edit file'), 'class' => 'invert_filter']).'</a>';
@ -740,7 +769,7 @@ function filemanager_file_explorer(
if ((!$fileinfo['is_dir']) && ($download_button)) {
$filename = base64_encode($fileinfo['name']);
$hash = md5($filename.$config['server_unique_identifier']);
$data[4] .= '<a href="include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'" style="vertical-align: 25%;">';
$data[4] .= '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'" style="vertical-align: 25%;">';
$data[4] .= html_print_image('images/file.png', true, ['class' => 'invert_filter']);
$data[4] .= '</a>';
}
@ -758,9 +787,9 @@ function filemanager_file_explorer(
);
}
if (!$readOnly) {
if (is_writable($real_directory)) {
// The buttons to make actions
if ($readOnly === false) {
if (is_writable($real_directory) === true) {
// The buttons to make actions.
$tabs_dialog = '<ul id="file_table_modal">
<li class="create_folder">
<a href="javascript: show_form_create_folder();">'.html_print_image(
@ -772,18 +801,24 @@ function filemanager_file_explorer(
]
).'<span>'.__('Create a Directory').'</span>
</a>
</li>
<li class="create_text_file">
<a href="javascript: show_create_text_file();">'.html_print_image(
'images/create_file.png',
true,
[
'title' => __('Create a Text'),
'class' => 'invert_filter',
]
).'<span>'.__('Create a Text').'</span>
</a>
</li>
</li>';
if ($allowCreateText === true) {
$tabs_dialog .= '
<li class="create_text_file">
<a href="javascript: show_create_text_file();">'.html_print_image(
'images/create_file.png',
true,
[
'title' => __('Create a Text'),
'class' => 'invert_filter',
]
).'<span>'.__('Create a Text').'</span>
</a>
</li>';
}
$tabs_dialog .= '
<li class="upload_file">
<a href="javascript: show_upload_file();">'.html_print_image(
'images/upload_file.png',
@ -794,7 +829,9 @@ function filemanager_file_explorer(
]
).'<span>'.__('Upload Files').'</span>
</a>
</li></ul>';
</li>';
$tabs_dialog .= '</ul>';
echo '<div id="create_folder" class="invisible">'.$tabs_dialog.'
<form method="post" action="'.$url.'">'.html_print_input_text('dirname', '', '', 30, 255, true).html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('create_dir', 1, true).html_print_input_hidden('hash', md5($relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true).'</form></div>';
@ -802,8 +839,10 @@ function filemanager_file_explorer(
echo '<div id="upload_file" class="invisible"> '.$tabs_dialog.'
<form method="post" action="'.$url.'" enctype="multipart/form-data">'.ui_print_help_tip(__('The zip upload in this dir, easy to upload multiple files.'), true).html_print_input_file('file', true, false).html_print_input_hidden('umask', $umask, true).html_print_checkbox('decompress', 1, false, true).__('Decompress').html_print_submit_button(__('Go'), 'go', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('upload_file_or_zip', 1, true).'</form></div>';
echo ' <div id="create_text_file" class="invisible">'.$tabs_dialog.'
<form method="post" action="'.$url.'">'.html_print_input_text('name_file', '', '', 30, 50, true).html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('umask', $umask, true).html_print_input_hidden('create_text_file', 1, true).'</form></div>';
if ($allowCreateText === true) {
echo ' <div id="create_text_file" class="invisible">'.$tabs_dialog.'
<form method="post" action="'.$url.'">'.html_print_input_text('name_file', '', '', 30, 50, true).html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('umask', $umask, true).html_print_input_hidden('create_text_file', 1, true).'</form></div>';
}
echo "<div style='width: ".$table->width.";' class='file_table_buttons'>";
@ -818,16 +857,18 @@ function filemanager_file_explorer(
);
echo '</a>';
echo "<a href='javascript: show_create_text_file();'>";
echo html_print_image(
'images/create_file.png',
true,
[
'title' => __('Create text'),
'class' => 'invert_filter',
]
);
echo '</a>';
if ($allowCreateText === true) {
echo "<a href='javascript: show_create_text_file();'>";
echo html_print_image(
'images/create_file.png',
true,
[
'title' => __('Create text'),
'class' => 'invert_filter',
]
);
echo '</a>';
}
echo "<a href='javascript: show_upload_file();'>";
echo html_print_image(
@ -855,18 +896,17 @@ function filemanager_file_explorer(
/**
* Check if a directory is writable.
*
* @param string Directory path to check.
* @param bool If set, it will try to make the directory writeable if it's not.
* @param string $filepath Directory path to check.
*
* @param bool Wheter the directory is writeable or not.
* @return boolean Wheter the directory is writeable or not.
*/
function filemanager_get_file_info($filepath)
function filemanager_get_file_info(string $filepath)
{
global $config;
$realpath = realpath($filepath);
$filepath = str_replace('\\', '/', $filepath);
// Windows compatibility
// Windows compatibility.
$info = [
'mime' => MIME_UNKNOWN,
'mime_extend' => mime_content_type($filepath),
@ -904,10 +944,9 @@ function filemanager_get_file_info($filepath)
/**
* Check if a directory is writable.
*
* @param string Directory path to check.
* @param bool If set, it will try to make the directory writeable if it's not.
* @param string $dirpath Directory path to check.
*
* @param bool Wheter the directory is writeable or not.
* @return array List with files.
*/
function filemanager_list_dir($dirpath)
{
@ -917,8 +956,8 @@ function filemanager_list_dir($dirpath)
$dirs = [];
$dir = opendir($dirpath);
while ($file = @readdir($dir)) {
// Ignore hidden files
if ($file[0] == '.') {
// Ignore hidden files.
if ($file[0] === '.') {
continue;
}
@ -953,9 +992,18 @@ function filemanager_safe_directory(
// Safe output.
$directory = io_safe_output($directory);
$forbiddenAttempting = false;
// Banned directories.
$bannedDirectory = [
'include',
'godmode',
'operation',
'reporting',
'general',
ENTERPRISE_DIR,
];
if ((bool) preg_match('/(\.){1,2}/', $directory) !== false) {
$directory = preg_replace('/(\.){1,2}/', '', (empty($safedDirectory) === true) ? $directory : $safedDirectory);
if ((bool) preg_match('/(\.){2}/', $directory) !== false) {
$directory = preg_replace('/(\.){2}/', '', (empty($safedDirectory) === true) ? $directory : $safedDirectory);
$forbiddenAttempting = true;
}
@ -964,9 +1012,15 @@ function filemanager_safe_directory(
$forbiddenAttempting = true;
}
if (in_array($directory, $bannedDirectory) === true) {
// Setted images for default (usually in file manager).
$directory = (empty($safedDirectory) === false) ? $safedDirectory : 'images';
$forbiddenAttempting = true;
}
if ($forbiddenAttempting === true) {
db_pandora_audit('File manager', 'Attempting to use a forbidden file or directory name');
}
return $directory;
}
}

View File

@ -735,7 +735,7 @@ function grafico_modulo_sparse($params)
$params['backgroundColor'] = 'white';
}
if (isset($params['only_image']) === true) {
if (isset($params['only_image']) === true && $params['vconsole'] !== true) {
$params['backgroundColor'] = 'transparent';
}
@ -829,7 +829,11 @@ function grafico_modulo_sparse($params)
$params['stacked'] = 0;
}
$font_size = $config['font_size'];
if (isset($params['graph_font_size']) === true) {
$font_size = $params['graph_font_size'];
} else {
$font_size = $config['font_size'];
}
// If is metaconsole set 10pt size value.
if (is_metaconsole()) {

View File

@ -436,6 +436,7 @@ function html_print_select_style($fields, $name, $selected='', $style='', $scrip
* @param string $size Style, size (width) of element.
* @param boolean $simple_multiple_options Discovery simple multiple inputs.
* @param boolean $required Required input.
* @param string $inverse Change All to None with inverse condition.
*
* @return string HTML code if return parameter is true.
*/
@ -462,7 +463,8 @@ function html_print_select_groups(
$include_groups=false,
$size=false,
$simple_multiple_options=false,
$required=false
$required=false,
$inverse=''
) {
$output = '';
@ -522,7 +524,11 @@ function html_print_select_groups(
if (empty($selected) === false) {
$fields = [ $selected => groups_get_name($selected) ];
} else if ($returnAllGroup === true && $multiple === false) {
$fields = [ $selected => groups_get_name(null, true) ];
if ($selected === 0 && $inverse !== '') {
$fields = [ $selected => 'None' ];
} else {
$fields = [ $selected => groups_get_name(null, true) ];
}
}
} else {
foreach ($selected as $k) {
@ -595,7 +601,9 @@ function html_print_select_groups(
</style>
<script type="text/javascript">
$(document).ready(function() {
$('select[name="<?php echo $name; ?>"]').each(
function() {
$(this).select2({
@ -625,6 +633,7 @@ function html_print_select_groups(
inclusions: '<?php echo $json_inclusions; ?>',
step: params.page || 1,
strict: "<?php echo $strict_user; ?>",
not_condition: $('#not_condition_switch').prop('checked'),
returnAllGroup: <?php echo (int) $returnAllGroup; ?>
}
@ -781,7 +790,7 @@ function html_print_select(
$required = 'required';
}
$output .= '<select '.$required.' id="'.$id.'" name="'.$name.'"'.$attributes.' '.$styleText.'>';
$output .= '<select '.$required.' onclick="'.$script.'" id="'.$id.'" name="'.$name.'"'.$attributes.' '.$styleText.'>';
if ($nothing !== false) {
if ($nothing != '' || empty($fields)) {

View File

@ -199,7 +199,7 @@ function integria_api_call($api_hostname=null, $user=null, $user_pass=null, $api
'user_pass' => $user_pass,
'pass' => $api_pass,
'op' => $operation,
'params' => html_entity_decode($params),
'params' => io_safe_output($params),
];
if ($return_type !== '') {

View File

@ -30,7 +30,7 @@
global $config;
// Set variable to store menu type (classic or collapsed).
if (!empty(get_parameter('menuType'))) {
if (is_ajax() === true && empty(get_parameter('menuType')) === false) {
$_SESSION['menu_type'] = get_parameter('menuType', 'classic');
return;
}
@ -39,11 +39,14 @@ if (!empty(get_parameter('menuType'))) {
/**
* Prints a complete menu structure.
*
* @param array Menu structure to print.
* @param array $menu Menu structure to print.
*
* @return void
*/
function menu_print_menu(&$menu)
{
global $config;
global $menuTypeClass;
static $idcounter = 0;
echo '<div class="menu">';
@ -108,7 +111,7 @@ function menu_print_menu(&$menu)
$submenu = false;
if ($config['menu_type'] == 'classic') {
if ($menuTypeClass === 'classic') {
$classes = [
'menu_icon',
'no_hidden_menu',
@ -120,12 +123,12 @@ function menu_print_menu(&$menu)
];
}
if (isset($main['sub'])) {
if (isset($main['sub']) === true) {
$classes[] = '';
$submenu = true;
}
if (!isset($main['refr'])) {
if (isset($main['refr']) === false) {
$main['refr'] = 0;
}
@ -409,23 +412,14 @@ function menu_print_menu(&$menu)
// Print out the first level.
$output .= '<li title="'.$main['text'].'" class="'.implode(' ', $classes).' '.$seleccionado.'" id="icon_'.$id.'">';
// onclick="location.href=\'index.php?sec='.$mainsec.'&amp;sec2='.$main["sec2"].($main["refr"] ? '&amp;refr='.$main["refr"] : '').'\'">';
$length = strlen(__($main['text']));
$padding_top = ( $length >= 18) ? 6 : 12;
if ($config['menu_type'] == 'classic') {
$output .= '<div id="title_menu" class="title_menu_classic">'.$main['text'].'</div>';
} else {
$output .= '<div id="title_menu" class="title_menu_collapsed">'.$main['text'].'</div>';
}
$output .= sprintf('<div id="title_menu" class="title_menu_%s">%s</div>', $menuTypeClass, $main['text']);
// Add the notification ball if defined
if (isset($main['notification'])) {
// Add the notification ball if defined.
if (isset($main['notification']) === true) {
$output .= '<div class="notification_ball">'.$main['notification'].'</div>';
}
$padding_top = 0;
$length = 0;
if ($submenu_output != '') {
// WARNING: IN ORDER TO MODIFY THE VISIBILITY OF MENU'S AND SUBMENU'S (eg. with cookies) YOU HAVE TO ADD TO THIS ELSEIF. DON'T MODIFY THE CSS.
if ($visible || in_array('selected', $classes)) {
@ -436,10 +430,7 @@ function menu_print_menu(&$menu)
$visible = false;
}
// $output .= '<ul id="subicon_'.$id.'" class="submenu'.($visible ? '' : ' invisible').'">';
$output .= '<ul id="subicon_'.$id.'" class="submenu">';
$output .= $submenu_output;
$output .= '</ul>';
$output .= sprintf('<ul id="subicon_%s" class="submenu">%s</ul>', $id, $submenu_output);
}
$config['count_main_menu']++;

View File

@ -2295,17 +2295,19 @@ function modules_get_agentmodule_data(
$search_in_history_db = db_search_in_history_db($datelimit);
switch ($module['id_tipo_modulo']) {
// generic_data_string
// Generic_data_string.
case 3:
// remote_tcp_string
// Remote_tcp_string.
case 10:
// remote_snmp_string
// Remote_snmp_string.
case 17:
// async_string
// Async_string.
case 36:
// remote_cmd_string
// Remote_cmd_string.
case 23:
// Free search is a json with value and exact modifier
// Web content string.
case 33:
// Free search is a json with value and exact modifier.
$freesearch = json_decode($freesearch, true);
$freesearch_sql = '';
if (isset($freesearch['value']) && !empty($freesearch['value'])) {

View File

@ -264,7 +264,19 @@ function show_configuration_wizard() {
background: "black"
},
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
if ($.ui && $.ui.dialog && $.ui.dialog.prototype._allowInteraction) {
var ui_dialog_interaction = $.ui.dialog.prototype._allowInteraction;
$.ui.dialog.prototype._allowInteraction = function(e) {
if ($(e.target).closest('.select2-dropdown').length) return true;
return ui_dialog_interaction.apply(this, arguments);
};
}
},
_allowInteraction: function (event) {
return !!$(event.target).is(".select2-input") || this._super(event);
}
});
default_language_displayed = $("#language").val();

View File

@ -2284,6 +2284,7 @@ function reporting_agents_inventory($report, $content)
$external_source = io_safe_input(json_decode($content['external_source'], true));
$es_agents_inventory_display_options = $external_source['agents_inventory_display_options'];
$es_agent_custom_fields = $external_source['agent_custom_fields'];
$es_custom_fields = $external_source['agent_custom_field_filter'];
$es_os_filter = $external_source['agent_os_filter'];
$es_agent_status_filter = $external_source['agent_status_filter'];
@ -2298,10 +2299,20 @@ function reporting_agents_inventory($report, $content)
$es_agents_inventory_display_options = [];
}
$custom_field_sql = '';
$search_sql = '';
if ($es_custom_fields != '') {
$search_sql .= ' AND id_os = '.$es_custom_fields;
if (!empty($es_agent_custom_fields)) {
$custom_field_sql = 'INNER JOIN tagent_custom_data tacd ON tacd.id_agent = tagente.id_agente';
if ($es_agent_custom_fields[0] != 0) {
$custom_field_sql .= ' AND tacd.id_field IN ('.implode(',', $es_agent_custom_fields).')';
}
if (!empty($es_custom_fields)) {
$custom_field_sql .= ' AND tacd.description like "%'.$es_custom_fields.'%"';
} else {
$custom_field_sql .= ' AND tacd.description <> ""';
}
}
if (in_array('0', $es_os_filter) === false) {
@ -2340,8 +2351,10 @@ function reporting_agents_inventory($report, $content)
ON tagente.id_agente = tasg.id_agent
LEFT JOIN tagente_modulo tam
ON tam.id_agente = tagente.id_agente
%s
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
%s',
$custom_field_sql,
$user_groups_to_sql,
$user_groups_to_sql,
$search_sql

View File

@ -2555,12 +2555,19 @@ function reporting_html_last_value($table, $item, $pdf=0)
'Y-m-d H:i:s',
$item['data']['utimestamp']
);
$table_data->data[1][2] = remove_right_zeros(
number_format(
$item['data']['datos'],
$config['graph_precision']
)
);
if (is_numeric($item['data']['datos']) === true) {
$dataDatos = remove_right_zeros(
number_format(
$item['data']['datos'],
$config['graph_precision']
)
);
} else {
$dataDatos = trim($item['data']['datos']);
}
$table_data->data[1][2] = $dataDatos;
switch ($item['data']['estado']) {
case AGENT_MODULE_STATUS_CRITICAL_BAD:
@ -4358,14 +4365,6 @@ function reporting_html_general($table, $item, $pdf=0)
$table1->style[2] = 'text-align: center';
$table1->style[3] = 'text-align: center';
// Begin - Order by agent.
foreach ($item['data'] as $key => $row) {
$aux[$key] = $row['agent'];
}
array_multisort($aux, SORT_ASC, $item['data']);
// End - Order by agent.
foreach ($item['data'] as $row) {
if ($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) {
$row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN);

View File

@ -665,7 +665,7 @@ function reports_get_report_types($template=false, $not_editor=false)
];
$types['sql_graph_hbar'] = [
'optgroup' => __('Graphs'),
'name' => __('SQL horizonal bar graph'),
'name' => __('SQL horizontal bar graph'),
];
}
@ -723,15 +723,15 @@ function reports_get_report_types($template=false, $not_editor=false)
$types['avg_value'] = [
'optgroup' => __('Modules'),
'name' => __('Avg. Value'),
'name' => __('Avg. value'),
];
$types['max_value'] = [
'optgroup' => __('Modules'),
'name' => __('Max. Value'),
'name' => __('Max. value'),
];
$types['min_value'] = [
'optgroup' => __('Modules'),
'name' => __('Min. Value'),
'name' => __('Min. value'),
];
$types['monitor_report'] = [
'optgroup' => __('Modules'),

View File

@ -69,9 +69,9 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
// Module name
if ($module['disabled']) {
$cellName = '<em>'.ui_print_truncate_text(io_safe_output($module['nombre']), GENERIC_SIZE_TEXT, true, true, true, '[&hellip;]', 'text-transform: uppercase;').ui_print_help_tip(__('Disabled'), true).'<em>';
$cellName = '<em>'.ui_print_truncate_text($module['nombre'], GENERIC_SIZE_TEXT, true, true, true, '[&hellip;]', 'text-transform: uppercase;').ui_print_help_tip(__('Disabled'), true).'<em>';
} else {
$cellName = ui_print_truncate_text(io_safe_output($module['nombre']), GENERIC_SIZE_TEXT, true, true, true, '[&hellip;]', 'text-transform: uppercase;');
$cellName = ui_print_truncate_text($module['nombre'], GENERIC_SIZE_TEXT, true, true, true, '[&hellip;]', 'text-transform: uppercase;');
}
$row = [];
@ -817,7 +817,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$events_graph .= graph_graphic_agentevents(
$id_agente,
'340px;margin:0',
45,
'130px',
SECONDS_1DAY,
'',
true,

View File

@ -1041,7 +1041,7 @@ function ui_format_alert_row(
$styleDisabled = '';
}
if (empty($alert)) {
if (empty($alert) === true) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
return [
'',
@ -1066,7 +1066,7 @@ function ui_format_alert_row(
}
}
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$server = db_get_row('tmetaconsole_setup', 'id', $alert['server_data']['id']);
if (metaconsole_connect($server) == NOERR) {
@ -1087,7 +1087,7 @@ function ui_format_alert_row(
$data = [];
// Validate checkbox.
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
if (check_acl($config['id_user'], $id_group, 'LW')
|| check_acl($config['id_user'], $id_group, 'LM')
) {
@ -1106,7 +1106,7 @@ function ui_format_alert_row(
}
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if (is_metaconsole()) {
if (is_metaconsole() === true && (int) $alert['server_data']['id'] !== 0) {
$node = metaconsole_get_connection_by_id($alert['server_data']['id']);
if (metaconsole_load_external_db($node) !== NOERR) {
// Restore the default connection.
@ -1121,14 +1121,14 @@ function ui_format_alert_row(
$data[$index['policy']] = '';
} else {
$img = 'images/policies_mc.png';
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
} else {
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=advanced/policymanager&amp;id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
}
}
if (is_metaconsole()) {
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
}
@ -1139,7 +1139,7 @@ function ui_format_alert_row(
$data[$index['standby']] = html_print_image('images/bell_pause.png', true, ['title' => __('Standby on')]);
}
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
// Force alert execution.
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
if ($alert['force_execution'] == 0) {
@ -1154,7 +1154,7 @@ function ui_format_alert_row(
if ($agent == 0) {
$data[$index['module_name']] .= ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[&hellip;]', '');
} else {
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$agent_name = $alert['agent_name'];
$id_agent = $alert['id_agent'];
} else {
@ -1162,7 +1162,7 @@ function ui_format_alert_row(
$id_agent = modules_get_agentmodule_agent($alert['id_agent_module']);
}
if (defined('METACONSOLE') || !can_user_access_node()) {
if (is_metaconsole() === true || !can_user_access_node()) {
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]', '');
} else {
if ($agent_style !== false) {
@ -1179,7 +1179,7 @@ function ui_format_alert_row(
$data[$index['description']] = '';
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$data[$index['template']] .= '<a class="template_details" href="'.ui_get_full_url('/', false, false, false).'/ajax.php?page=enterprise/meta/include/ajax/tree_view.ajax&action=get_template_tooltip&id_template='.$template['id'].'&server_name='.$alert['server_data']['server_name'].'">';
} else {
$data[$index['template']] .= '<a class="template_details" href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'].'">';
@ -1196,7 +1196,7 @@ function ui_format_alert_row(
$actions = alerts_get_alert_agent_module_actions($alert['id'], false, $alert['server_data']['id']);
if (!empty($actions)) {
if (empty($actions) === false) {
$actionText = '<div><ul class="action_list">';
foreach ($actions as $action) {
$actionText .= '<div class="mrgn_btn_5px" ><span class="action_name"><li>'.$action['name'];
@ -1869,7 +1869,7 @@ function ui_process_page_head($string, $bitfield)
} else {
$config['jquery'] = array_merge(
[
'jquery' => 'include/javascript/jquery-3.3.1.min.js',
'jquery' => 'include/javascript/jquery.current.js',
'pandora' => 'include/javascript/jquery.pandora.js',
'jquery-ui' => 'include/javascript/jquery-ui.min.js',
],
@ -4438,19 +4438,27 @@ function ui_print_standard_header(
true
);
// Create the header.
$output = ui_print_page_header(
$title,
$icon,
true,
$help,
$godmode,
$options,
false,
'',
GENERIC_SIZE_TEXT,
'',
$headerInformation->printHeader(true)
);
if (is_metaconsole() === true) {
$output = ui_meta_print_header(
$title,
false,
$options
);
} else {
$output = ui_print_page_header(
$title,
$icon,
true,
$help,
$godmode,
$options,
false,
'',
GENERIC_SIZE_TEXT,
'',
$headerInformation->printHeader(true)
);
}
if ($return !== true) {
echo $output;

View File

@ -55,6 +55,10 @@ if ($file === '' || $hash === '' || $hash !== md5($file_raw.$config['server_uniq
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
break;
case 'godmode/servers/plugin':
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/plugin/'.$file;
break;
case $main_collections:
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/collection/'.$file;
break;

View File

@ -118,6 +118,7 @@ function flot_area_graph(
$array_events_alerts
) {
global $config;
global $is_mobile;
// Get a unique identifier to graph.
$graph_id = uniqid('graph_');
@ -145,7 +146,7 @@ function flot_area_graph(
break;
}
if ($config['style'] === 'pandora_black' && ($params['pdf'] === false || $params['pdf'] === null )
if ($config['style'] === 'pandora_black' && ($params['pdf'] === false || $params['pdf'] === null) && (isset($is_mobile) === false || $is_mobile === false)
) {
$background_style = '#222';
$params['grid_color'] = '#fff';
@ -170,7 +171,7 @@ function flot_area_graph(
// Set some containers to legend, graph, timestamp tooltip, etc.
if ($params['show_legend']) {
$return .= '<p id="legend_'.$graph_id.'" style="text-align:left; width: '.$params['width'].'px;"></p>';
$return .= '<p id="legend_'.$graph_id.'" class="legend_background" style="text-align:left; width: '.$params['width'].'px;"></p>';
}
if (isset($params['graph_combined']) === true && $params['graph_combined']
@ -760,11 +761,23 @@ function flot_slicesbar_graph(
$graph_id = uniqid('graph_');
// Set some containers to legend, graph, timestamp tooltip, etc.
$height = ((int) $height + 15);
if (is_numeric($height) === true) {
$height = ((int) $height + 15);
}
$style = 'width:'.$width.'%;';
// Fixed height size.
$style .= 'height: 100%;';
if (empty($height) === true) {
$style .= 'height: 100%;';
} else {
if (is_numeric($height) === true) {
$style .= 'height: '.$height.'px;';
} else {
$style .= 'height: '.$height.';';
}
}
$return = "<div id='".$graph_id."' class='noresizevc graph ".$adapt_key."' style='".$style."'></div>";
$return .= "<div id='value_".$graph_id."' class='flot_container'></div>";

View File

@ -2784,7 +2784,7 @@ function donutNarrowGraph(
arc = d3.svg
.arc()
.outerRadius(radius)
.innerRadius(radius - radius / 2.5);
.innerRadius(radius - radius / 6);
svg = donutbody
.append("svg")

View File

@ -1113,6 +1113,10 @@ function load_interfaces(selected_links) {
);
$("#relations_table tbody").append(template_relation_row);
// Update input for transform in select2.
$("#interface_source_" + i).select2();
$("#interface_target_" + i).select2();
template_relation_row = null;
});
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More