Merge remote-tracking branch 'origin/develop' into ent-3084-Warnings_en_PHP_7
Conflicts: pandora_console/godmode/servers/manage_recontask_form.php pandora_console/include/functions_events.php Former-commit-id: 7ea5c9dcc8efe112ea64e2fcb6eef9670c9af613
|
@ -54,7 +54,8 @@ AGENT_WIN_FILE="$CODEHOME/pandora_agents/win32/pandora.cc"
|
|||
AGENT_WIN_MPI_FILE="$CODEHOME/pandora_agents/win32/installer/pandora.mpi"
|
||||
AGENT_WIN_RC_FILE="$CODEHOME/pandora_agents/win32/versioninfo.rc"
|
||||
SATELLITE_FILE="$PANDHOME_ENT/satellite_server/satellite_server.pl"
|
||||
PERL_PLUGIN_FILES="$PANDHOME_ENT/pandora_server/util/plugin/vmware-plugin.pl \
|
||||
PERL_PLUGIN_FILES="$PANDHOME_ENT/pandora_server/util/recon_script/vmware-plugin.pl \
|
||||
$PANDHOME_ENT/pandora_server/util/recon_script/pcm_client.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/NGINX/nginx_requests_queued.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Sybase/sybase_plugin.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/SNMP/dynamic_snmp.pl \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, AIX version
|
||||
# Version 7.0NG.732, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 4.0.1
|
||||
Version: 7.0
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 260
|
||||
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Maintainer: ÁRTICA ST <info@artica.es>
|
||||
Homepage: https://pandorafms.org/
|
||||
Depends: coreutils, perl, unzip
|
||||
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. It’s possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, FreeBSD Version
|
||||
# Version 7.0NG.732, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, HP-UX Version
|
||||
# Version 7.0NG.732, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, GNU/Linux
|
||||
# Version 7.0NG.732, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, GNU/Linux
|
||||
# Version 7.0NG.732, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, Solaris Version
|
||||
# Version 7.0NG.732, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.731
|
||||
# Version 7.0NG.732
|
||||
|
||||
# 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.731, AIX version
|
||||
# Version 7.0NG.732, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.731
|
||||
# Version 7.0NG.732
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.731, HPUX Version
|
||||
# Version 7.0NG.732, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package: pandorafms-agent
|
||||
Version: 4.0
|
||||
Version: 7.0
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 260
|
||||
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
|
||||
Maintainer: ÁRTICA ST <info@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: coreutils, perl
|
||||
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. It’s possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731
|
||||
# Version 7.0NG.732
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731
|
||||
# Version 7.0NG.732
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731
|
||||
# Version 7.0NG.732
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.731, Solaris version
|
||||
# Version 7.0NG.732, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, AIX version
|
||||
# Version 7.0NG.732, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.731-190225
|
||||
Version: 7.0NG.732-190312
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 260
|
||||
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
|
||||
Maintainer: ÁRTICA ST <info@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: coreutils, perl, unzip
|
||||
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. It’s possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data 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.731-190225"
|
||||
pandora_version="7.0NG.732-190312"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, GNU/Linux
|
||||
# Version 7.0NG.732, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, FreeBSD Version
|
||||
# Version 7.0NG.732, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, HP-UX Version
|
||||
# Version 7.0NG.732, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, GNU/Linux
|
||||
# Version 7.0NG.732, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, GNU/Linux
|
||||
# Version 7.0NG.732, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, NetBSD Version
|
||||
# Version 7.0NG.732, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, Solaris Version
|
||||
# Version 7.0NG.732, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -41,8 +41,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.731';
|
||||
use constant AGENT_BUILD => '190225';
|
||||
use constant AGENT_VERSION => '7.0NG.732';
|
||||
use constant AGENT_BUILD => '190312';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.731
|
||||
%define release 190225
|
||||
%define version 7.0NG.732
|
||||
%define release 190312
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.731
|
||||
%define release 190225
|
||||
%define version 7.0NG.732
|
||||
%define release 190312
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.731"
|
||||
PI_BUILD="190225"
|
||||
PI_VERSION="7.0NG.732"
|
||||
PI_BUILD="190312"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.731
|
||||
# Version 7.0NG.732
|
||||
|
||||
# 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
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.731}
|
||||
{Pandora FMS Windows Agent v7.0NG.732}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{190225}
|
||||
{190312}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.731(Build 190225)")
|
||||
#define PANDORA_VERSION ("7.0NG.732(Build 190312)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.731(Build 190225))"
|
||||
VALUE "ProductVersion", "(7.0NG.732(Build 190312))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.731-190225
|
||||
Version: 7.0NG.732-190312
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.731-190225"
|
||||
pandora_version="7.0NG.732-190312"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -149,7 +149,7 @@ if [ $package_pear -eq 1 ]
|
|||
then
|
||||
echo "Make the package \"php-xml-rpc\"."
|
||||
cd temp_package
|
||||
dh-make-pear --maintainer "Miguel de Dios <miguel.dedios@artica.es>" XML_RPC
|
||||
dh-make-pear --maintainer "ÁRTICA ST <info@artica.es>" XML_RPC
|
||||
cd php-xml-rpc-*
|
||||
dpkg-buildpackage -rfakeroot
|
||||
cd ..
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
START TRANSACTION;
|
||||
|
||||
UPDATE `twidget` SET `unique_name`='example' WHERE `class_name` LIKE 'WelcomeWidget';
|
||||
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `auth_strings` text;
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `autoconfiguration_enabled` tinyint(1) unsigned default '0';
|
||||
|
||||
|
||||
INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Discovery.Application.VMware', 'Discovery Application script to monitor VMware technologies (ESXi, VCenter, VSphere)', '/usr/share/pandora_server/util/recon_scripts/vmware-plugin.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Discovery.Cloud', 'Discovery Cloud script to monitor Cloud technologies (AWS.EC2, AWS.S3, AWS.RDS, RDS,ȊWS.EKS)', '/usr/share/pandora_server/util/recon_scripts/pcm_client.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tevent_extended` (
|
||||
`id` serial PRIMARY KEY,
|
||||
`id_evento` bigint(20) unsigned NOT NULL,
|
||||
`external_id` bigint(20) unsigned,
|
||||
`utimestamp` bigint(20) NOT NULL default '0',
|
||||
`description` text,
|
||||
FOREIGN KEY `tevent_ext_fk`(`id_evento`) REFERENCES `tevento`(`id_evento`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `tnotification_source` (
|
||||
`id` serial,
|
||||
`description` VARCHAR(255) DEFAULT NULL,
|
||||
`icon` text,
|
||||
`max_postpone_time` int(11) DEFAULT NULL,
|
||||
`enabled` int(1) DEFAULT NULL,
|
||||
`user_editable` int(1) DEFAULT NULL,
|
||||
`also_mail` int(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `tnotification_source`
|
||||
--
|
||||
INSERT INTO `tnotification_source`(`description`, `icon`, `max_postpone_time`, `enabled`, `user_editable`, `also_mail`) VALUES
|
||||
("System status", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Message", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Pending task", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Advertisement", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Official communication", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Sugerence", "icono_info_mr.png", 86400, 1, 1, 0);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tmensajes`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `url` TEXT;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `response_mode` VARCHAR(200) DEFAULT NULL;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `citicity` INT(10) UNSIGNED DEFAULT '0';
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `id_source` BIGINT(20) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `subtype` VARCHAR(255) DEFAULT '';
|
||||
ALTER TABLE `tmensajes` ADD INDEX (`id_source`);
|
||||
UPDATE `tmensajes` SET `id_source`=(SELECT `id` FROM `tnotification_source` WHERE `description` = "Message");
|
||||
ALTER TABLE `tmensajes` ADD CONSTRAINT `tsource_fk` FOREIGN KEY (`id_source`) REFERENCES `tnotification_source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnotification_user` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60) NOT NULL,
|
||||
`utimestamp_read` BIGINT(20),
|
||||
`utimestamp_erased` BIGINT(20),
|
||||
`postpone` INT,
|
||||
PRIMARY KEY (`id_mensaje`,`id_user`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnotification_group` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_mensaje`,`id_group`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnotification_source_user` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60),
|
||||
`enabled` INT(1) DEFAULT NULL,
|
||||
`also_mail` INT(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_user`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnotification_source_group` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_group`),
|
||||
INDEX (`id_group`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnotification_source_group_user`(
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
`id_user` VARCHAR(60),
|
||||
`enabled` INT(1) DEFAULT NULL,
|
||||
`also_mail` INT(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_user`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_group`) REFERENCES `tnotification_source_group`(`id_group`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES ('Generate Notification','Internal type','This command allows you to send an internal notification to any user or group.',1,'[\"Destination user\",\"Destination group\",\"Title\",\"Message\",\"Link\",\"Criticity\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
|
||||
|
||||
INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="System status"), "admin", 1, 0);
|
||||
INSERT INTO `tnotification_source_group` SELECT `id`,0 FROM `tnotification_source` WHERE `description`="Message";
|
||||
INSERT INTO `tnotification_user` (`id_mensaje`, `id_user`) SELECT `id_mensaje`, `id_usuario_destino` FROM `tmensajes` WHERE `id_usuario_destino` != '';
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Apache accesses per client and status',
|
||||
'(.*?)\ -.*1.1"\ (\d+)\ \d+',
|
||||
'host,status', 1);
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Apache time per requester and html code',
|
||||
'(.*?)\ -.*1.1"\ (\d+)\ (\d+)',
|
||||
'origin,respose,_time_', 1);
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Count output',
|
||||
'.*',
|
||||
'Coincidences', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Events replicated to metaconsole',
|
||||
'.* (.*?) .* (\d+) events replicated to metaconsole',
|
||||
'server,_events_', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Pages with warnings',
|
||||
'PHP Warning:.*in (.*?) on',
|
||||
'page', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Users login',
|
||||
'Starting Session \d+\ of user (.*)',
|
||||
'user', 0);
|
||||
|
||||
COMMIT;
|
|
@ -0,0 +1,8 @@
|
|||
START TRANSACTION;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Add column in table `tagent_custom_fields`
|
||||
-- ----------------------------------------------------------------------
|
||||
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT '';
|
||||
|
||||
COMMIT;
|
|
@ -1199,13 +1199,14 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
|||
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', 24);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 26);
|
||||
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_enterprise', '731');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '733');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
|
@ -1406,12 +1407,16 @@ ALTER TABLE twidget_dashboard MODIFY options LONGTEXT NOT NULL default "";
|
|||
ALTER TABLE trecon_task ADD `alias_as_name` int(2) unsigned default '0';
|
||||
ALTER TABLE trecon_task ADD `snmp_enabled` int(2) unsigned default '0';
|
||||
ALTER TABLE trecon_task ADD `vlan_enabled` int(2) unsigned default '0';
|
||||
ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
|
||||
ALTER TABLE trecon_task ADD `auth_strings` text;
|
||||
ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `twidget` AND Table `twidget_dashboard`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE twidget_dashboard SET id_widget = (SELECT id FROM twidget WHERE unique_name = 'graph_module_histogram') WHERE id_widget = (SELECT id FROM twidget WHERE unique_name = 'graph_availability');
|
||||
DELETE FROM twidget WHERE unique_name = 'graph_availability';
|
||||
UPDATE `twidget` SET `unique_name`='example' WHERE `class_name` LIKE 'WelcomeWidget';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tbackup` (Extension table. Modify only if exists)
|
||||
|
@ -1816,7 +1821,30 @@ CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
|||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (2, 'Apache accesses per client and status',
|
||||
'(.*?)\ -.*1.1"\ (\d+)\ \d+',
|
||||
'host,status', 1);
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (3, 'Apache time per requester and html code',
|
||||
'(.*?)\ -.*1.1"\ (\d+)\ (\d+)',
|
||||
'origin,respose,_time_', 1);
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (4, 'Count output',
|
||||
'.*',
|
||||
'Coincidences', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (5, 'Events replicated to metaconsole',
|
||||
'.* (.*?) .* (\d+) events replicated to metaconsole',
|
||||
'server,_events_', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (6, 'Pages with warnings',
|
||||
'PHP Warning:.*in (.*?) on',
|
||||
'page', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (7, 'Users login',
|
||||
'Starting Session \d+\ of user (.*)',
|
||||
'user', 0);
|
||||
-- -----------------------------------------------------
|
||||
-- Add column in table `treport`
|
||||
-- -----------------------------------------------------
|
||||
|
@ -1856,15 +1884,159 @@ ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL;
|
|||
|
||||
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tevent_extended`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tevent_extended` (
|
||||
`id` serial PRIMARY KEY,
|
||||
`id_evento` bigint(20) unsigned NOT NULL,
|
||||
`external_id` bigint(20) unsigned,
|
||||
`utimestamp` bigint(20) NOT NULL default '0',
|
||||
`description` text,
|
||||
FOREIGN KEY `tevent_ext_fk`(`id_evento`) REFERENCES `tevento`(`id_evento`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgis_map_layer_groups`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tgis_map_layer_groups` (
|
||||
`layer_id` INT NOT NULL,
|
||||
`group_id` MEDIUMINT(4) UNSIGNED NOT NULL,
|
||||
`agent_id` INT(10) UNSIGNED NOT NULL COMMENT 'Used to link the position to the group',
|
||||
PRIMARY KEY (`layer_id`, `group_id`),
|
||||
FOREIGN KEY (`layer_id`) REFERENCES `tgis_map_layer` (`id_tmap_layer`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
|
||||
CREATE TABLE `tgis_map_layer_groups` (
|
||||
`layer_id` int(11) NOT NULL,
|
||||
`group_id` mediumint(4) unsigned NOT NULL,
|
||||
`agent_id` int(10) unsigned NOT NULL COMMENT 'Used to link the position to the group',
|
||||
PRIMARY KEY (`layer_id`,`group_id`),
|
||||
KEY `group_id` (`group_id`),
|
||||
KEY `agent_id` (`agent_id`),
|
||||
CONSTRAINT `tgis_map_layer_groups_ibfk_1` FOREIGN KEY (`layer_id`) REFERENCES `tgis_map_layer` (`id_tmap_layer`) ON DELETE CASCADE,
|
||||
CONSTRAINT `tgis_map_layer_groups_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
|
||||
CONSTRAINT `tgis_map_layer_groups_ibfk_3` FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tnotification_source`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE `tnotification_source` (
|
||||
`id` serial,
|
||||
`description` VARCHAR(255) DEFAULT NULL,
|
||||
`icon` text,
|
||||
`max_postpone_time` int(11) DEFAULT NULL,
|
||||
`enabled` int(1) DEFAULT NULL,
|
||||
`user_editable` int(1) DEFAULT NULL,
|
||||
`also_mail` int(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `tnotification_source`
|
||||
--
|
||||
INSERT INTO `tnotification_source`(`description`, `icon`, `max_postpone_time`, `enabled`, `user_editable`, `also_mail`) VALUES
|
||||
("System status", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Message", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Pending task", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Advertisement", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Official communication", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Sugerence", "icono_info_mr.png", 86400, 1, 1, 0);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tmensajes`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `url` TEXT;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `response_mode` VARCHAR(200) DEFAULT NULL;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `citicity` INT(10) UNSIGNED DEFAULT '0';
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `id_source` BIGINT(20) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `subtype` VARCHAR(255) DEFAULT '';
|
||||
ALTER TABLE `tmensajes` ADD CONSTRAINT `tsource_fk` FOREIGN KEY (`id_source`) REFERENCES `tnotification_source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_user`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_user` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60) NOT NULL,
|
||||
`utimestamp_read` BIGINT(20),
|
||||
`utimestamp_erased` BIGINT(20),
|
||||
`postpone` INT,
|
||||
PRIMARY KEY (`id_mensaje`,`id_user`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_group`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_group` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_mensaje`,`id_group`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_source_user`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_source_user` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60),
|
||||
`enabled` INT(1) DEFAULT NULL,
|
||||
`also_mail` INT(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_user`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_source_group`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_source_group` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_group`),
|
||||
INDEX (`id_group`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_source_user`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_source_group_user` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
`id_user` VARCHAR(60),
|
||||
`enabled` INT(1) DEFAULT NULL,
|
||||
`also_mail` INT(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_user`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_group`) REFERENCES `tnotification_source_group`(`id_group`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Add alert command 'Generate notification'
|
||||
-- ----------------------------------------------------------------------
|
||||
INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES ('Generate Notification','Internal type','This command allows you to send an internal notification to any user or group.',1,'[\"Destination user\",\"Destination group\",\"Title\",\"Message\",\"Link\",\"Criticity\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Update message references and pre-configure notifications
|
||||
-- ----------------------------------------------------------------------
|
||||
INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="System status"), "admin", 1, 0);
|
||||
INSERT INTO `tnotification_source_group` SELECT `id`,0 FROM `tnotification_source` WHERE `description`="Message";
|
||||
INSERT INTO `tnotification_user` (`id_mensaje`, `id_user`) SELECT `id_mensaje`, `id_usuario_destino` FROM `tmensajes` WHERE `id_usuario_destino` != '';
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Add custom internal recon scripts
|
||||
-- ----------------------------------------------------------------------
|
||||
INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Discovery.Application.VMware', 'Discovery Application script to monitor VMware technologies (ESXi, VCenter, VSphere)', '/usr/share/pandora_server/util/recon_scripts/vmware-plugin.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Discovery.Cloud', 'Discovery Cloud script to monitor Cloud technologies (AWS.EC2, AWS.S3, AWS.RDS, RDS,ȊWS.EKS)', '/usr/share/pandora_server/util/recon_scripts/pcm_client.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Add column in table `tagent_custom_fields`
|
||||
-- ----------------------------------------------------------------------
|
||||
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT '';
|
||||
|
|
|
@ -15,17 +15,17 @@ global $config;
|
|||
check_login();
|
||||
ui_require_css_file('firts_task');
|
||||
?>
|
||||
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no recon task defined yet.') ]); ?>
|
||||
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no discovery tasks defined yet.') ]); ?>
|
||||
|
||||
<div class="new_task">
|
||||
<div class="image_task">
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Recon server')]); ?>
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Discovery server')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Recon Task'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Discovery Task'); ?><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
'The Recon Task definition of Pandora FMS is used to find new elements in the network.
|
||||
'Discovery Task are used to find new elements in the network.
|
||||
If it detects any item, it will add that item to the monitoring, and if that item it is already being monitored, then it will
|
||||
ignore it or will update its information.There are three types of detection: Based on <strong id="fuerte"> ICMP </strong>(pings),
|
||||
<strong id="fuerte">SNMP</strong> (detecting the topology of networks and their interfaces), and other <strong id="fuerte"> customized </strong>
|
||||
|
@ -33,8 +33,8 @@ ui_require_css_file('firts_task');
|
|||
);
|
||||
?>
|
||||
</p>
|
||||
<form action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create" method="post">
|
||||
<input type="submit" class="button_task" value="<?php echo __('Create Recon Task'); ?>" />
|
||||
<form action="index.php?sec=gservers&sec2=godmode/servers/discovery" method="post">
|
||||
<input type="submit" class="button_task" value="<?php echo __('Discover'); ?>" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 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.
|
||||
/**
|
||||
* Pandora FMS - http://pandorafms.com
|
||||
* ==================================================
|
||||
* Copyright (c) 2005-2011 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($_SERVER['REQUEST_TIME'])) {
|
||||
$time = $_SERVER['REQUEST_TIME'];
|
||||
} else {
|
||||
|
@ -26,7 +29,7 @@ if (!$config['MR']) {
|
|||
$config['MR'] = 0;
|
||||
}
|
||||
|
||||
echo '<a class="white_bold footer" target="_blank" href="'.$config['homeurl'].$license_file.'">';
|
||||
echo '<a class="footer" target="_blank" href="'.$config['homeurl'].$license_file.'">';
|
||||
|
||||
require_once $config['homedir'].'/include/functions_update_manager.php';
|
||||
|
||||
|
@ -40,9 +43,9 @@ if ($current_package == 0) {
|
|||
|
||||
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config['MR']));
|
||||
|
||||
echo '</a><br />';
|
||||
echo '<a class="white footer">'.__('Page generated at').' '.date($config['date_format']);
|
||||
echo '</a><br /><span style="color:#eff">® '.get_copyright_notice().'</span>';
|
||||
echo '</a> ';
|
||||
echo '<a class="footer">'.__('Page generated at').' '.date($config['date_format']);
|
||||
echo '</a><br /><span>® '.get_copyright_notice().'</span>';
|
||||
|
||||
if (isset($config['debug'])) {
|
||||
$cache_info = [];
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Copyright (c) 2005-2019 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
|
||||
|
@ -13,365 +12,257 @@
|
|||
// GNU General Public License for more details.
|
||||
require_once 'include/functions_messages.php';
|
||||
require_once 'include/functions_servers.php';
|
||||
require_once 'include/functions_notifications.php';
|
||||
|
||||
// Check permissions
|
||||
// Global errors/warnings checking.
|
||||
config_check();
|
||||
config_check();
|
||||
|
||||
?>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; margin-top: 0px; height: 100%" border="0">
|
||||
<tr>
|
||||
<td style="width:90%;">
|
||||
<a href="index.php?sec=main">
|
||||
<?php
|
||||
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
|
||||
|
||||
if (!defined('PANDORA_ENTERPRISE')) {
|
||||
$logo_title = get_product_name().' Opensource';
|
||||
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
|
||||
} else {
|
||||
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {
|
||||
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
|
||||
}
|
||||
<div id="header_table">
|
||||
<div id="header_table_inner">
|
||||
<?php
|
||||
// ======= Notifications Discovery ===============================================
|
||||
$notifications_numbers = notifications_get_counters();
|
||||
$header_discovery = '<div id="header_discovery">'.notifications_print_ball(
|
||||
$notifications_numbers['notifications'],
|
||||
$notifications_numbers['last_id']
|
||||
).'</div>';
|
||||
|
||||
$logo_title = get_product_name().' Enterprise';
|
||||
}
|
||||
|
||||
echo html_print_image(
|
||||
$custom_logo,
|
||||
true,
|
||||
[
|
||||
'alt' => $logo_title,
|
||||
'border' => '0',
|
||||
]
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
</td>
|
||||
<td style="min-width:200px;">
|
||||
<?php
|
||||
$table = new stdClass();
|
||||
$table->id = 'header_table';
|
||||
$table->class = 'none';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->style[0] = $table->style['clippy'] = $table->style[1] = $table->style[3] = $table->style[4] = $table->style[5] = $table->style[6] = $table->style[8] = $table->style[9] = $table->style['qr'] = 'width: 22px; text-align:center; height: 22px; padding-right: 9px;padding-left: 9px;';
|
||||
$table->style[7] = 'width: 20px; padding-right: 9px;';
|
||||
$table->style['searchbar'] = 'width: 180px; min-width: 180px;';
|
||||
$table->style[11] = 'padding-left: 10px; padding-right: 5px;width: 16px;';
|
||||
$table->width = '100%';
|
||||
$table->styleTable = 'margin: auto; margin-top: 0px;';
|
||||
$table->rowclass[0] = '';
|
||||
|
||||
$acl_head_search = true;
|
||||
if ($config['acl_enterprise'] == 1 && !users_is_admin()) {
|
||||
$acl_head_search = db_get_sql(
|
||||
"SELECT sec FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario.id_user = tusuario_perfil.id_usuario
|
||||
INNER JOIN tprofile_view ON tprofile_view.id_profile = tusuario_perfil.id_perfil
|
||||
WHERE tusuario.id_user = '".$config['id_user']."' AND (sec = '*' OR sec = 'head_search')"
|
||||
);
|
||||
// ======= Servers List ===============================================
|
||||
$servers_list = '<div id="servers_list">';
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
if ($servers['all'] != 0) {
|
||||
$servers['up'] = (int) servers_check_status();
|
||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||
if ($servers['up'] == 0) {
|
||||
// All Servers down or no servers at all.
|
||||
$servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]);
|
||||
} else if ($servers['down'] != 0) {
|
||||
// Some servers down.
|
||||
$servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]);
|
||||
} else {
|
||||
// All servers up.
|
||||
$servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]);
|
||||
}
|
||||
|
||||
if ($acl_head_search) {
|
||||
$table->data[0][11] = ui_print_help_tip(__('Blank characters are used as AND conditions'), true);
|
||||
unset($servers);
|
||||
// Since this is the header, we don't like to trickle down variables.
|
||||
$servers_check_img_link = '<a class="white" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
|
||||
$servers_check_img_link .= $servers_check_img;
|
||||
$servers_check_img_link .= '</a>';
|
||||
};
|
||||
$servers_list .= $servers_check_img_link.'</div>';
|
||||
|
||||
// Search bar
|
||||
$search_bar = '<form method="get" style="display: inline;" name="quicksearch" action="">';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
|
||||
|
||||
// ======= Alerts ===============================================
|
||||
$check_minor_release_available = false;
|
||||
$pandora_management = check_acl($config['id_user'], 0, 'PM');
|
||||
|
||||
$check_minor_release_available = db_check_minor_relase_available();
|
||||
|
||||
if ($check_minor_release_available) {
|
||||
if (users_is_admin($config['id_user'])) {
|
||||
if ($config['language'] == 'es') {
|
||||
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
|
||||
} else {
|
||||
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29">'.__('About minor release update').'</a>', 'minor release/s available');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Chat messages.
|
||||
$header_chat = "<div id='header_chat'><span id='icon_new_messages_chat' style='display: none;'>";
|
||||
$header_chat .= "<a href='index.php?sec=workspace&sec2=operation/users/webchat'>";
|
||||
$header_chat .= html_print_image('images/header_chat_gray.png', true, ['title' => __('New chat message')]);
|
||||
$header_chat .= '</a></span></div>';
|
||||
|
||||
|
||||
// Search
|
||||
$acl_head_search = true;
|
||||
if ($config['acl_enterprise'] == 1 && !users_is_admin()) {
|
||||
$acl_head_search = db_get_sql(
|
||||
"SELECT sec FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario.id_user = tusuario_perfil.id_usuario
|
||||
INNER JOIN tprofile_view ON tprofile_view.id_profile = tusuario_perfil.id_perfil
|
||||
WHERE tusuario.id_user = '".$config['id_user']."' AND (sec = '*' OR sec = 'head_search')"
|
||||
);
|
||||
}
|
||||
|
||||
if ($acl_head_search) {
|
||||
// Search bar
|
||||
$search_bar = '<form method="get" style="display: inline;" name="quicksearch" action="">';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
} else {
|
||||
if (strlen($config['search_keywords']) == 0) {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
} else {
|
||||
if (strlen($config['search_keywords']) == 0) {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
} else {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = false; </script>';
|
||||
}
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = false; </script>';
|
||||
}
|
||||
|
||||
$search_bar .= '<input type="text" id="keywords" name="keywords"';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||
} else if (strlen($config['search_keywords']) == 0) {
|
||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||
} else {
|
||||
$search_bar .= "value='".$config['search_keywords']."'";
|
||||
}
|
||||
|
||||
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
|
||||
onkeyup="javascript: fieldKeyWordEmpty = false;"
|
||||
style="margin-top:5px;" class="search_input" />';
|
||||
|
||||
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
|
||||
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
|
||||
$search_bar .= '</form>';
|
||||
|
||||
$table->data[0]['searchbar'] = $search_bar;
|
||||
}
|
||||
|
||||
// Servers check
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
$servers['up'] = (int) servers_check_status();
|
||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||
if ($servers['up'] == 0) {
|
||||
// All Servers down or no servers at all
|
||||
$servers_check_img = html_print_image('images/header_down.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]);
|
||||
} else if ($servers['down'] != 0) {
|
||||
// Some servers down
|
||||
$servers_check_img = html_print_image('images/header_warning.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]);
|
||||
$search_bar .= '<input type="text" id="keywords" name="keywords"';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||
} else if (strlen($config['search_keywords']) == 0) {
|
||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||
} else {
|
||||
// All servers up
|
||||
$servers_check_img = html_print_image('images/header_ready.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]);
|
||||
$search_bar .= "value='".$config['search_keywords']."'";
|
||||
}
|
||||
|
||||
unset($servers);
|
||||
// Since this is the header, we don't like to trickle down variables.
|
||||
$servers_link_open = '<a class="white" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
|
||||
$servers_link_close = '</a>';
|
||||
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
|
||||
onkeyup="javascript: fieldKeyWordEmpty = false;"
|
||||
style="margin-top:5px;" class="search_input" />';
|
||||
|
||||
if ($config['show_qr_code_header'] == 0) {
|
||||
$show_qr_code_header = 'display: none;';
|
||||
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
|
||||
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
|
||||
$search_bar .= '</form>';
|
||||
|
||||
$header_searchbar = '<div id="header_searchbar">'.ui_print_help_tip(__('Blank characters are used as AND conditions'), true);
|
||||
$header_searchbar .= $search_bar.'</div>';
|
||||
}
|
||||
|
||||
|
||||
// ======= Autorefresh code =============================
|
||||
$autorefresh_txt = '';
|
||||
$autorefresh_additional = '';
|
||||
|
||||
$ignored_params = [
|
||||
'agent_config' => false,
|
||||
'code' => false,
|
||||
];
|
||||
|
||||
if (!isset($_GET['sec2'])) {
|
||||
$_GET['sec2'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_GET['refr'])) {
|
||||
$_GET['refr'] = null;
|
||||
}
|
||||
|
||||
$select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '".$config['id_user']."'");
|
||||
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
|
||||
|
||||
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
|
||||
$do_refresh = true;
|
||||
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
|
||||
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_refresh) {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_gray.png', true, ['class' => 'bot', 'alt' => 'lightning', 'title' => __('Configure autorefresh')]);
|
||||
|
||||
if ($_GET['refr']) {
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">'.date('i:s', $config['refr']).'</span>)';
|
||||
}
|
||||
|
||||
$ignored_params['refr'] = '';
|
||||
$values = get_refresh_time_array();
|
||||
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
|
||||
$autorefresh_additional .= html_print_select($values, 'ref', '', '', __('Select'), '0', true, false, false);
|
||||
$autorefresh_additional .= '</span>';
|
||||
unset($values);
|
||||
|
||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
|
||||
if ($_GET['refr']) {
|
||||
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
} else {
|
||||
$autorefresh_link_open_txt = '<a>';
|
||||
}
|
||||
|
||||
$autorefresh_link_close = '</a>';
|
||||
$display_counter = 'display:block';
|
||||
} else {
|
||||
$show_qr_code_header = 'display: inline;';
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled_gray.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
$autorefresh_link_open_img = '';
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
|
||||
$display_counter = 'display:none';
|
||||
}
|
||||
} else {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled_gray.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$table->data[0]['qr'] = '<div style="'.$show_qr_code_header.'" id="qr_code_container" style="">'.'<a href="javascript: show_dialog_qrcode();">'.html_print_image(
|
||||
'images/qrcode_icon.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('QR Code of the page'),
|
||||
'title' => __('QR Code of the page'),
|
||||
]
|
||||
).'</a>'.'</div>';
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
echo "<div style='display: none;' id='qrcode_container' title='".__('QR code of the page')."'>";
|
||||
echo "<div id='qrcode_container_image'></div>";
|
||||
echo '</div>';
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function() {
|
||||
$( "#qrcode_container" ).dialog({
|
||||
autoOpen: false,
|
||||
modal: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
if ($config['tutorial_mode'] !== 'expert' && !$config['disable_help']) {
|
||||
$table->data[0]['clippy'] = '<a href="javascript: show_clippy();">'.html_print_image(
|
||||
'images/clippy_icon.png',
|
||||
true,
|
||||
[
|
||||
'id' => 'clippy',
|
||||
'class' => 'clippy',
|
||||
'alt' => __('%s assistant', get_product_name()),
|
||||
'title' => __(
|
||||
'%s assistant',
|
||||
get_product_name()
|
||||
),
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
$autorefresh_link_open_img = '';
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
|
||||
$display_counter = 'display:none';
|
||||
}
|
||||
|
||||
$header_autorefresh = '<div id="header_autorefresh">'.$autorefresh_link_open_img.$autorefresh_img.$autorefresh_link_close.'</div>';
|
||||
$header_autorefresh_counter = '<div id="header_autorefresh_counter" style="'.$display_counter.'">'.$autorefresh_link_open_txt.$autorefresh_txt.$autorefresh_link_close.$autorefresh_additional.'</div>';
|
||||
|
||||
|
||||
$table->data[0][0] = $servers_link_open.$servers_check_img.$servers_link_close;
|
||||
// Qr.
|
||||
if ($config['show_qr_code_header'] == 0) {
|
||||
$show_qr_code_header = 'display: none;';
|
||||
} else {
|
||||
$show_qr_code_header = 'display: inline;';
|
||||
}
|
||||
|
||||
$header_qr = '<div id="header_qr" style="'.$show_qr_code_header.'"><div id="qr_code_container"><a href="javascript: show_dialog_qrcode();">'.html_print_image(
|
||||
'images/qrcode_icon_gray.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('QR Code of the page'),
|
||||
'title' => __('QR Code of the page'),
|
||||
]
|
||||
).'</a></div></div>';
|
||||
|
||||
echo "<div style='display: none;' id='qrcode_container' title='".__('QR code of the page')."'>";
|
||||
echo "<div id='qrcode_container_image'></div>";
|
||||
echo '</div>';
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function() {
|
||||
$( "#qrcode_container" ).dialog({
|
||||
autoOpen: false,
|
||||
modal: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
// User.
|
||||
if (is_user_admin($config['id_user']) == 1) {
|
||||
$header_user = html_print_image('images/header_user_admin_green.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
|
||||
} else {
|
||||
$header_user = html_print_image('images/header_user_green.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
|
||||
}
|
||||
|
||||
$header_user = '<div id="header_user"><a href="index.php?sec=workspace&sec2=operation/users/user_edit">'.$header_user.'<span> ('.$config['id_user'].')</span></a></div>';
|
||||
|
||||
// Logout.
|
||||
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
|
||||
$header_logout .= html_print_image('images/header_logout_gray.png', true, ['alt' => __('Logout'), 'class' => 'bot', 'title' => __('Logout')]);
|
||||
$header_logout .= '</a></div>';
|
||||
|
||||
echo '<div class="header_left">'.$header_autorefresh, $header_autorefresh_counter, $header_qr, $header_chat.'</div>
|
||||
<div class="header_center">'.$header_searchbar, $header_discovery, $servers_list.'</div>
|
||||
<div class="header_right">'.$header_user, $header_logout.'</div>';
|
||||
?>
|
||||
</div> <!-- Closes #table_header_inner -->
|
||||
</div> <!-- Closes #table_header -->
|
||||
|
||||
|
||||
<!-- Notifications content wrapper-->
|
||||
<div id='notification-content' style='display:none;' /></div>
|
||||
|
||||
|
||||
// ======= Autorefresh code =============================
|
||||
$autorefresh_txt = '';
|
||||
$autorefresh_additional = '';
|
||||
|
||||
$ignored_params = [
|
||||
'agent_config' => false,
|
||||
'code' => false,
|
||||
];
|
||||
|
||||
if (!isset($_GET['sec2'])) {
|
||||
$_GET['sec2'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_GET['refr'])) {
|
||||
$_GET['refr'] = null;
|
||||
}
|
||||
|
||||
$select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '".$config['id_user']."'");
|
||||
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
|
||||
|
||||
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
|
||||
$do_refresh = true;
|
||||
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
|
||||
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_refresh) {
|
||||
$autorefresh_img = html_print_image('images/header_refresh.png', true, ['class' => 'bot', 'alt' => 'lightning', 'title' => __('Configure autorefresh')]);
|
||||
|
||||
if ($_GET['refr']) {
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">'.date('i:s', $config['refr']).'</span>)';
|
||||
}
|
||||
|
||||
$ignored_params['refr'] = '';
|
||||
$values = get_refresh_time_array();
|
||||
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
|
||||
$autorefresh_additional .= html_print_select($values, 'ref', '', '', __('Select'), '0', true, false, false);
|
||||
$autorefresh_additional .= '</span>';
|
||||
unset($values);
|
||||
|
||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
|
||||
if ($_GET['refr']) {
|
||||
$autorefresh_link_open_txt = '<a class="white autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
} else {
|
||||
$autorefresh_link_open_txt = '<a>';
|
||||
}
|
||||
|
||||
$autorefresh_link_close = '</a>';
|
||||
} else {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
$autorefresh_link_open_img = '';
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
}
|
||||
} else {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
$autorefresh_link_open_img = '';
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
}
|
||||
|
||||
$table->data[0][1] = $autorefresh_link_open_img.$autorefresh_img.$autorefresh_link_close;
|
||||
$table->data[0][2] = $autorefresh_link_open_txt.$autorefresh_txt.$autorefresh_link_close.$autorefresh_additional;
|
||||
// ======================================================
|
||||
$check_minor_release_available = false;
|
||||
$pandora_management = check_acl($config['id_user'], 0, 'PM');
|
||||
|
||||
$check_minor_release_available = db_check_minor_relase_available();
|
||||
|
||||
if ($check_minor_release_available) {
|
||||
if (users_is_admin($config['id_user'])) {
|
||||
if ($config['language'] == 'es') {
|
||||
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
|
||||
} else {
|
||||
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29">'.__('About minor release update').'</a>', 'minor release/s available');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div id="alert_messages" style="display: none"></div>';
|
||||
|
||||
if ($config['alert_cnt'] > 0) {
|
||||
$maintenance_link = 'javascript:';
|
||||
$maintenance_title = __('System alerts detected - Please fix as soon as possible');
|
||||
$maintenance_class = $maintenance_id = 'show_systemalert_dialog white';
|
||||
|
||||
$maintenance_link_open_txt = '<a href="'.$maintenance_link.'" title="'.$maintenance_title.'" class="'.$maintenance_class.'" id="show_systemalert_dialog">';
|
||||
$maintenance_link_open_img = '<a href="'.$maintenance_link.'" title="'.$maintenance_title.'" class="'.$maintenance_class.'">';
|
||||
$maintenance_link_close = '</a>';
|
||||
if (!$pandora_management) {
|
||||
$maintenance_img = '';
|
||||
} else {
|
||||
$maintenance_img = $maintenance_link_open_img.html_print_image(
|
||||
'images/header_yellow.png',
|
||||
true,
|
||||
[
|
||||
'title' => __(
|
||||
'You have %d warning(s)',
|
||||
$config['alert_cnt']
|
||||
),
|
||||
'id' => 'yougotalert',
|
||||
'class' => 'bot',
|
||||
]
|
||||
).$maintenance_link_close;
|
||||
}
|
||||
} else {
|
||||
if (!$pandora_management) {
|
||||
$maintenance_img = '';
|
||||
} else {
|
||||
$maintenance_img = html_print_image('images/header_ready.png', true, ['title' => __('There are not warnings'), 'id' => 'yougotalert', 'class' => 'bot']);
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[0][3] = $maintenance_img;
|
||||
|
||||
// Main help icon
|
||||
if (!$config['disable_help']) {
|
||||
$table->data[0][4] = '<a href="#" class="modalpopup" id="helpmodal">'.html_print_image(
|
||||
'images/header_help.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Main help'),
|
||||
'id' => 'helpmodal',
|
||||
'class' => 'modalpopup',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
// Logout
|
||||
$table->data[0][5] = '<a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
|
||||
$table->data[0][5] .= html_print_image('images/header_logout.png', true, ['alt' => __('Logout'), 'class' => 'bot', 'title' => __('Logout')]);
|
||||
$table->data[0][5] .= '</a>';
|
||||
|
||||
// User
|
||||
if (is_user_admin($config['id_user']) == 1) {
|
||||
$table->data[0][6] = html_print_image('images/header_user_admin.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
|
||||
} else {
|
||||
$table->data[0][6] = html_print_image('images/header_user.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
|
||||
}
|
||||
|
||||
$table->data[0][6] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit">'.$table->data[0][6].'</a>';
|
||||
|
||||
$table->data[0][7] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit" class="white_bold"> ('.$config['id_user'].')</a>';
|
||||
|
||||
// Chat messages
|
||||
$table->data[0][8] = "<span id='icon_new_messages_chat' style='display: none;'>";
|
||||
$table->data[0][8] .= "<a href='index.php?sec=workspace&sec2=operation/users/webchat'>";
|
||||
$table->data[0][8] .= html_print_image('images/header_chat.png', true, ['title' => __('New chat message')]);
|
||||
$table->data[0][8] .= '</a>';
|
||||
$table->data[0][8] .= '</span>';
|
||||
|
||||
// Messages
|
||||
$msg_cnt = messages_get_count($config['id_user']);
|
||||
if ($msg_cnt > 0) {
|
||||
echo '<div id="dialog_messages" style="display: none"></div>';
|
||||
|
||||
$table->data[0][9] = '<a href="ajax.php?page=operation/messages/message_list" title="'.__('Message overview').'" id="show_messages_dialog">';
|
||||
$table->data[0][9] .= html_print_image('images/header_email.png', true, ['title' => __('You have %d unread message(s)', $msg_cnt), 'id' => 'yougotmail', 'class' => 'bot', 'style' => 'width:24px;']);
|
||||
$table->data[0][9] .= '</a>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
unset($table);
|
||||
?>
|
||||
</td>
|
||||
<!--
|
||||
<td style="text-align:center">
|
||||
<?php
|
||||
echo "<a href='index.php?sec=main'>";
|
||||
if (isset($config['custom_logo'])) {
|
||||
echo html_print_image('images/custom_logo/'.$config['custom_logo'], true, ['height' => '60', 'width' => '139', 'alt' => 'Logo']);
|
||||
}
|
||||
|
||||
echo '</a>';
|
||||
?>
|
||||
</td>
|
||||
-->
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Old style div wrapper -->
|
||||
<div id="alert_messages" style="display: none"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
@ -381,12 +272,223 @@ config_check();
|
|||
if (isset($config['fixed_header'])) {
|
||||
$config_fixed_header = $config['fixed_header'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
function addNotifications(event) {
|
||||
var element = document.getElementById("notification-content");
|
||||
if (!element) {
|
||||
console.error('Cannot locate the notification content element.');
|
||||
return;
|
||||
}
|
||||
// If notification-content is empty, retrieve the notifications.
|
||||
if (!element.firstChild) {
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/setup/setup_notifications",
|
||||
"get_notifications_dropdown" : 1,
|
||||
},
|
||||
function (data, status) {
|
||||
// Apppend data
|
||||
element.innerHTML = data;
|
||||
// Show the content
|
||||
element.style.display = "block";
|
||||
attatch_to_image();
|
||||
},
|
||||
"html"
|
||||
);
|
||||
} else {
|
||||
// If there is some notifications retrieved, only show it.
|
||||
element.style.display = "block";
|
||||
attatch_to_image();
|
||||
}
|
||||
}
|
||||
|
||||
function attatch_to_image() {
|
||||
var notification_elem = document.getElementById("notification-wrapper");
|
||||
if (!notification_elem) return;
|
||||
var image_attached =
|
||||
document.getElementById("notification-ball-header")
|
||||
.getBoundingClientRect()
|
||||
.left
|
||||
;
|
||||
notification_elem.style.left = image_attached - 300 + "px";
|
||||
}
|
||||
|
||||
function notifications_clean_ui(action, self_id) {
|
||||
switch(action) {
|
||||
case 'item':
|
||||
// Recalculate the notification ball.
|
||||
check_new_notifications();
|
||||
break;
|
||||
case 'toast':
|
||||
// Only remove the toast element.
|
||||
document.getElementById(self_id).remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function notifications_hide() {
|
||||
var element = document.getElementById("notification-content");
|
||||
element.style.display = "none"
|
||||
}
|
||||
|
||||
function click_on_notification_toast(event) {
|
||||
var match = /notification-(.*)-id-([0-9]+)/.exec(event.target.id);
|
||||
if (!match) {
|
||||
console.error(
|
||||
"Cannot handle toast click event. Id not valid: ",
|
||||
event.target.id
|
||||
);
|
||||
return;
|
||||
}
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/setup/setup_notifications",
|
||||
"mark_notification_as_read" : 1,
|
||||
"message": match[2]
|
||||
},
|
||||
function (data, status) {
|
||||
if (!data.result) {
|
||||
console.error("Cannot redirect to URL.");
|
||||
return;
|
||||
}
|
||||
notifications_clean_ui(match[1], event.target.id);
|
||||
},
|
||||
"json"
|
||||
)
|
||||
.fail(function(xhr, textStatus, errorThrown){
|
||||
console.error(
|
||||
"Failed onclik event on toast. Error: ",
|
||||
xhr.responseText
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function print_toast(title, subtitle, severity, url, id, onclick) {
|
||||
// TODO severity.
|
||||
severity = '';
|
||||
|
||||
// Start the toast.
|
||||
var toast = document.createElement('a');
|
||||
toast.setAttribute('onclick', onclick);
|
||||
toast.setAttribute('href', url);
|
||||
toast.setAttribute('target', '_blank');
|
||||
|
||||
// Fill toast.
|
||||
var toast_div = document.createElement('div');
|
||||
toast_div.className = 'snackbar ' + severity;
|
||||
toast_div.id = id;
|
||||
var toast_title = document.createElement('h3');
|
||||
var toast_text = document.createElement('p');
|
||||
toast_title.innerHTML = title;
|
||||
toast_text.innerHTML = subtitle;
|
||||
toast_div.appendChild(toast_title);
|
||||
toast_div.appendChild(toast_text);
|
||||
toast.appendChild(toast_div);
|
||||
|
||||
// Show and program the hide event.
|
||||
toast_div.className = toast_div.className + ' show';
|
||||
setTimeout(function(){
|
||||
toast_div.className = toast_div.className.replace("show", "");
|
||||
}, 8000);
|
||||
|
||||
return toast;
|
||||
}
|
||||
|
||||
function check_new_notifications() {
|
||||
var last_id = document.getElementById('notification-ball-header')
|
||||
.getAttribute('last_id');
|
||||
if (last_id === null) {
|
||||
console.error('Cannot retrieve notifications ball last_id.');
|
||||
return;
|
||||
}
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/setup/setup_notifications",
|
||||
"check_new_notifications" : 1,
|
||||
"last_id": last_id
|
||||
},
|
||||
function (data, status) {
|
||||
// Clean the toasts wrapper at first.
|
||||
var toast_wrapper = document.getElementById(
|
||||
'notifications-toasts-wrapper'
|
||||
);
|
||||
if (toast_wrapper === null) {
|
||||
console.error('Cannot place toast notifications.');
|
||||
return;
|
||||
}
|
||||
while (toast_wrapper.firstChild) {
|
||||
toast_wrapper.removeChild(toast_wrapper.firstChild);
|
||||
}
|
||||
|
||||
// Return if no new notification.
|
||||
if(!data.has_new_notifications) return;
|
||||
|
||||
// Substitute the ball
|
||||
var new_ball = atob(data.new_ball);
|
||||
var ball_wrapper = document
|
||||
.getElementById('notification-ball-header')
|
||||
.parentElement;
|
||||
if (ball_wrapper === null) {
|
||||
console.error('Cannot update notification ball');
|
||||
return;
|
||||
}
|
||||
// Print the new ball and clean old notifications
|
||||
ball_wrapper.innerHTML = new_ball;
|
||||
var not_drop = document.getElementById('notification-content');
|
||||
while (not_drop.firstChild && not_drop) {
|
||||
not_drop.removeChild(not_drop.firstChild);
|
||||
}
|
||||
|
||||
// Add the new toasts.
|
||||
if (Array.isArray(data.new_notifications)) {
|
||||
data.new_notifications.forEach(function(ele) {
|
||||
toast_wrapper.appendChild(
|
||||
print_toast(
|
||||
ele.subject,
|
||||
ele.mensaje,
|
||||
ele.criticity,
|
||||
ele.full_url,
|
||||
'notification-toast-id-' + ele.id_mensaje,
|
||||
'click_on_notification_toast(event)'
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
.fail(function(xhr, textStatus, errorThrown){
|
||||
console.error(
|
||||
"Cannot get new notifications. Error: ",
|
||||
xhr.responseText
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Resize event
|
||||
window.addEventListener("resize", function() {
|
||||
attatch_to_image();
|
||||
});
|
||||
|
||||
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
||||
|
||||
var new_chat = <?php echo (int) $_SESSION['new_chat']; ?>;
|
||||
$(document).ready (function () {
|
||||
|
||||
// Check new notifications on a periodic way
|
||||
setInterval(check_new_notifications, 10000);
|
||||
|
||||
// Print the wrapper for notifications
|
||||
var notifications_toasts_wrapper = document.createElement('div');
|
||||
notifications_toasts_wrapper.id = 'notifications-toasts-wrapper';
|
||||
document.body.insertBefore(
|
||||
notifications_toasts_wrapper,
|
||||
document.body.firstChild
|
||||
);
|
||||
|
||||
<?php
|
||||
if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET['refr']))) {
|
||||
$do_refresh = true;
|
||||
|
@ -406,7 +508,6 @@ config_check();
|
|||
?>
|
||||
$("a.autorefresh_txt").toggle ();
|
||||
$("#combo_refr").toggle ();
|
||||
$("#combo_refr").css('padding-right', '9px');
|
||||
href = $("a.autorefresh").attr ("href");
|
||||
<?php
|
||||
if ($select[0]['time_autorefresh']) {
|
||||
|
@ -439,36 +540,16 @@ config_check();
|
|||
$("#agent_access").css("display","");
|
||||
});
|
||||
|
||||
function blinkmail(){
|
||||
$("#yougotmail").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkmail);
|
||||
}
|
||||
function blinkalert(){
|
||||
$("#yougotalert").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkalert);
|
||||
}
|
||||
function blinkpubli(){
|
||||
$(".publienterprise").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkpubli);
|
||||
}
|
||||
<?php
|
||||
if ($msg_cnt > 0) {
|
||||
?>
|
||||
blinkmail();
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if ($config['alert_cnt'] > 0) {
|
||||
?>
|
||||
blinkalert();
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
blinkpubli();
|
||||
|
||||
blinkpubli();
|
||||
|
||||
<?php
|
||||
if ($_GET['refr']) {
|
||||
?>
|
||||
$("#header_autorefresh").css('padding-right', '5px');
|
||||
var refr_time = <?php echo (int) get_parameter('refr', 0); ?>;
|
||||
var t = new Date();
|
||||
t.setTime (t.getTime () +
|
||||
|
@ -489,7 +570,6 @@ config_check();
|
|||
$("a.autorefresh").click (function () {
|
||||
$("a.autorefresh_txt").toggle ();
|
||||
$("#combo_refr").toggle ();
|
||||
$("#combo_refr").css('padding-right', '9px');
|
||||
$("select#ref").change (function () {
|
||||
href = $("a.autorefresh").attr ("href");
|
||||
$(document).attr ("location", href + this.value);
|
||||
|
|
|
@ -80,7 +80,7 @@ if (!empty($all_data)) {
|
|||
$data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
|
||||
}
|
||||
?>
|
||||
<table border="0" width="100%">
|
||||
<table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
|
||||
<td width="25%" style="padding-right: 20px;" valign="top">
|
||||
|
|
|
@ -16,16 +16,80 @@ if (! isset($config['id_user'])) {
|
|||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
$(document).ready(function(){
|
||||
var menuType_value = localStorage.getItem("menuType");
|
||||
if (menuType_value == 'classic') {
|
||||
$('#menu_full').removeClass('menu_full_collapsed').addClass('menu_full_classic');
|
||||
$('.logo_icon').css('display','none');
|
||||
$('.logo_full').css('display','block');
|
||||
$('div#title_menu').removeClass('title_menu_collapsed').addClass('title_menu_classic');
|
||||
$('div#page').removeClass('page_collapsed').addClass('page_classic');
|
||||
$('#header_table').removeClass('header_table_collapsed').addClass('header_table_classic');
|
||||
$('#button_collapse').removeClass('button_collapsed').addClass('button_classic');
|
||||
$('ul.submenu').css('left', '214px');
|
||||
$('li.menu_icon').removeClass('menu_icon_collapsed').addClass("no_hidden_menu");
|
||||
}
|
||||
else{
|
||||
if(menuType_value != 'collapsed'){
|
||||
localStorage.setItem("menuType", "collapsed");
|
||||
}
|
||||
$('#menu_full').removeClass('menu_full_classic').addClass('menu_full_collapsed');
|
||||
$('.logo_full').css('display','none');
|
||||
$('.logo_icon').css('display','block');
|
||||
$('div#title_menu').removeClass('title_menu_classic').addClass('title_menu_collapsed');
|
||||
$('div#page').removeClass('page_classic').addClass('page_collapsed');
|
||||
$('#header_table').removeClass('header_table_classic').addClass('header_table_collapsed');
|
||||
$('#button_collapse').removeClass('button_classic').addClass('button_collapsed');
|
||||
$('ul.submenu').css('left', '59px');
|
||||
$('li.menu_icon').removeClass("no_hidden_menu").addClass('menu_icon_collapsed');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Set the height of the menu.
|
||||
$(window).on('load', function (){
|
||||
$("#menu_full").height($("#container").height());
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php
|
||||
$autohidden_menu = 0;
|
||||
|
||||
if (isset($config['autohidden_menu']) && $config['autohidden_menu']) {
|
||||
$autohidden_menu = 1;
|
||||
}
|
||||
|
||||
$menu_container_id = '';
|
||||
|
||||
// Menu container prepared to autohide menu
|
||||
echo '<div id="'.$menu_container_id.'">';
|
||||
echo '<div id="menu_full">';
|
||||
|
||||
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
|
||||
$custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed'];
|
||||
|
||||
if (!defined('PANDORA_ENTERPRISE')) {
|
||||
$logo_title = get_product_name().' Opensource';
|
||||
$custom_logo = 'images/custom_logo/pandora_logo_head_green.png';
|
||||
$custom_logo_collapsed = 'images/custom_logo/pandora_logo_green_collapsed.png';
|
||||
} else {
|
||||
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {
|
||||
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
|
||||
}
|
||||
|
||||
$logo_title = get_product_name().' Enterprise';
|
||||
}
|
||||
|
||||
echo '<div class="logo_green"><a href="index.php?sec=main">';
|
||||
if (isset($config['custom_logo'])) {
|
||||
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_collapsed'])) {
|
||||
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:block']);
|
||||
}
|
||||
|
||||
echo '</a></div>';
|
||||
|
||||
// echo '<div class="tit bg titop">:: '.__('Operation').' ::</div>';
|
||||
require 'operation/menu.php';
|
||||
|
@ -45,16 +109,14 @@ if (check_acl($config['id_user'], 0, 'AW')
|
|||
|
||||
require 'godmode/menu.php';
|
||||
|
||||
echo '<div id="button_collapse" class="button_collapse"></div>';
|
||||
|
||||
|
||||
// require ("links_menu.php");
|
||||
echo '</div>';
|
||||
// menu_container
|
||||
ui_require_jquery_file('cookie');
|
||||
|
||||
$config_fixed_menu = false;
|
||||
if (isset($config['fixed_menu'])) {
|
||||
$config_fixed_menu = $config['fixed_menu'];
|
||||
}
|
||||
|
||||
$config_fixed_header = false;
|
||||
if (isset($config['fixed_header'])) {
|
||||
$config_fixed_header = $config['fixed_header'];
|
||||
|
@ -64,25 +126,35 @@ if (isset($config['fixed_header'])) {
|
|||
<script type="text/javascript" language="javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
$('#button_collapse').on('click', function() {
|
||||
|
||||
if($('#menu_full').hasClass('menu_full_classic')){
|
||||
localStorage.setItem("menuType", "collapsed");
|
||||
$('ul.submenu').css('left', '59px');
|
||||
}
|
||||
else if($('#menu_full').hasClass('menu_full_collapsed')){
|
||||
localStorage.setItem("menuType", "classic");
|
||||
$('ul.submenu').css('left', '214px');
|
||||
}
|
||||
|
||||
$('.logo_full').toggle();
|
||||
$('.logo_icon').toggle();
|
||||
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
|
||||
$('#button_collapse').toggleClass('button_classic button_collapsed');
|
||||
$('div#title_menu').toggleClass('title_menu_classic title_menu_collapsed');
|
||||
$('div#page').toggleClass('page_classic page_collapsed');
|
||||
$('#header_table').toggleClass('header_table_classic header_table_collapsed');
|
||||
$('li.menu_icon').toggleClass("no_hidden_menu menu_icon_collapsed");
|
||||
});
|
||||
|
||||
|
||||
var autohidden_menu = <?php echo $autohidden_menu; ?>;
|
||||
var fixed_menu = <?php echo json_encode((bool) $config_fixed_menu); ?>;
|
||||
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
||||
var id_user = "<?php echo $config['id_user']; ?>";
|
||||
var cookie_name = id_user + '-pandora_menu_state';
|
||||
var cookie_name_encoded = btoa(cookie_name);
|
||||
var click_display = "<?php echo $config['click_display']; ?>";
|
||||
var classic_menu = parseInt("<?php echo $config['classic_menu']; ?>");
|
||||
|
||||
if ((isNaN(classic_menu)) || (classic_menu == 0)) {
|
||||
classic_menu = false;
|
||||
}
|
||||
else {
|
||||
classic_menu = true;
|
||||
}
|
||||
|
||||
if (classic_menu) {
|
||||
autohidden_menu = 1;
|
||||
}
|
||||
|
||||
var menuState = $.cookie(cookie_name_encoded);
|
||||
if (!menuState) {
|
||||
|
@ -109,236 +181,7 @@ function close_submenus () {
|
|||
$('div.menu>ul>li.selected>ul').addClass('invisible');
|
||||
}
|
||||
|
||||
$(document).ready( function() {
|
||||
//Daniel maya 02/06/2016 Fixed menu position--INI
|
||||
if (fixed_menu) {
|
||||
$('div#menu')
|
||||
.css('position', 'fixed')
|
||||
.css('z-index', '9000')
|
||||
.css('top','80px')
|
||||
}else{
|
||||
$('div#menu')
|
||||
.css('z-index', '9000')
|
||||
}
|
||||
if (fixed_header) {
|
||||
$('div#menu')
|
||||
.css('position', 'fixed')
|
||||
.css('z-index', '9000')
|
||||
.css('top','80px')
|
||||
$('#menu_tab_frame_view').css('margin-top','20px')
|
||||
}
|
||||
//Daniel maya 02/06/2016 Fixed menu position--END
|
||||
/*
|
||||
$("img.toggle").click (function (e) {
|
||||
//In case the links gets activated, we don't want to follow link
|
||||
e.preventDefault();
|
||||
|
||||
var menuItem = $(this).parent();
|
||||
var submenu = menuItem.children("ul");
|
||||
|
||||
if (submenu.is(":visible")) {
|
||||
submenu.slideUp();
|
||||
|
||||
if (typeof menuState[menuItem.attr('id')] != 'undefined')
|
||||
delete menuState[menuItem.attr('id')];
|
||||
}
|
||||
else {
|
||||
submenu.slideDown();
|
||||
|
||||
menuState[menuItem.attr('id')] = 1;
|
||||
}
|
||||
|
||||
$.cookie(cookie_name_encoded, JSON.stringify(menuState), {expires: 7});
|
||||
});
|
||||
//Cerrar aqui los comentarios cuando esté el menu terminado
|
||||
if (fixed_menu) {
|
||||
$('div#menu')
|
||||
.css('position', 'fixed')
|
||||
.css('z-index', '9000')
|
||||
.css('left', '0')
|
||||
.css('top', $('div#head').innerHeight() + 'px')
|
||||
.css('height', '100%')
|
||||
.css('overflow', 'hidden')
|
||||
.hover(function (e) {
|
||||
if (!autohidden_menu) {
|
||||
$(this).css('overflow', 'auto').children('div').css('width', 'auto');
|
||||
}
|
||||
}, function (e) {
|
||||
if (!autohidden_menu) {
|
||||
$(this).css('overflow', 'hidden').children('div').css('width', '100%');
|
||||
}
|
||||
})
|
||||
.children('div')
|
||||
.css('margin-bottom', $('div#head').innerHeight() + 'px');
|
||||
|
||||
if (!fixed_header) {
|
||||
$(window).scroll(function () {
|
||||
if ($(this).scrollTop() <= $('div#head').innerHeight()) {
|
||||
$('div#menu').css('top', $('div#head').innerHeight() - $(this).scrollTop() + 'px' );
|
||||
} else {
|
||||
$('div#menu').css('top', '0');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function show_menu () {
|
||||
$('#menu_container').animate({"left": "+=80px"}, 200, function () {
|
||||
if (fixed_menu) {
|
||||
$('#menu_container').parent().css('overflow', 'auto');
|
||||
}
|
||||
});
|
||||
//show_menu_pretty();
|
||||
}
|
||||
|
||||
function show_menu_pretty() {
|
||||
open_submenus();
|
||||
$('div.menu ul li').css('background-position', '');
|
||||
$('ul.submenu li a, li.menu_icon a, li.links a, div.menu>ul>li>img.toggle').show();
|
||||
$('.titop').css('color', 'white');
|
||||
$('.bg3').css('color', 'white');
|
||||
$('.bg4').css('color', 'white');
|
||||
}
|
||||
|
||||
function hide_menu () {
|
||||
if (fixed_menu) {
|
||||
$('#menu_container').parent().css('overflow', 'hidden');
|
||||
}
|
||||
$('#menu_container').animate({"left": "-=80px"}, 100);
|
||||
//hide_menu_pretty();
|
||||
}
|
||||
|
||||
function hide_menu_pretty() {
|
||||
close_submenus();
|
||||
$('div.menu li').css('background-position', '85px 5px');
|
||||
$('ul.submenu li a, li.menu_icon a, li.links a, div.menu>ul>li>img.toggle').hide();
|
||||
$('.titop').css('color', $('.titop').css('background-color'));
|
||||
$('.bg3').css('color', $('.bg3').css('background-color'));
|
||||
$('.bg4').css('color', $('.bg4').css('background-color'));
|
||||
}
|
||||
*/
|
||||
if (autohidden_menu) {
|
||||
|
||||
//handlerIn, handlerOut);
|
||||
//openTime = 0;
|
||||
//handsIn = 0;
|
||||
|
||||
//$('#main').css('margin-left', '50px');
|
||||
//hide_menu_pretty();
|
||||
/*
|
||||
$('#menu').hover(function() {
|
||||
handsIn = 1;
|
||||
if (openTime == 0) {
|
||||
show_menu();
|
||||
openTime = new Date().getTime();
|
||||
}
|
||||
}).mouseleave(function() {
|
||||
handsIn = 0;
|
||||
setTimeout(function() {
|
||||
openedTime = new Date().getTime() - openTime;
|
||||
if(openedTime > 3000 && handsIn == 0) {
|
||||
hide_menu();
|
||||
openTime = 0;
|
||||
}
|
||||
}, 3500);
|
||||
});
|
||||
*/
|
||||
handsInMenu = 0;
|
||||
openTimeMenu = 0;
|
||||
if (classic_menu) {
|
||||
$('div#title_menu').show();
|
||||
handsInMenu = 1;
|
||||
openTimeMenu = new Date().getTime();
|
||||
$('#menu').css('width', '145px');
|
||||
$('#menu').css('position', 'block');
|
||||
$('div#menu').css('top', '80px');
|
||||
$('li.menu_icon').addClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '144px');
|
||||
|
||||
$('#menu').mouseleave(function() {
|
||||
handsInMenu = 0;
|
||||
setTimeout(function() {
|
||||
openedMenu = new Date().getTime() - openTimeMenu;
|
||||
if(openedMenu > 1000 && handsInMenu == 0) {
|
||||
$('#menu').css('width', '145px');
|
||||
$('#menu').css('position', 'block');
|
||||
$('li.menu_icon').addClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '144px');
|
||||
}
|
||||
}, 2500);
|
||||
});
|
||||
}
|
||||
else {
|
||||
if(!click_display){
|
||||
$('#menu').mouseenter(function() {
|
||||
$('div#title_menu').show();
|
||||
handsInMenu = 1;
|
||||
openTimeMenu = new Date().getTime();
|
||||
$('#menu').css('width', '145px');
|
||||
$('li.menu_icon').addClass( " no_hidden_menu" );
|
||||
$('li.menu_icon').find('li').addClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '144px');
|
||||
}).mouseleave(function() {
|
||||
handsInMenu = 0;
|
||||
setTimeout(function() {
|
||||
openedMenu = new Date().getTime() - openTimeMenu;
|
||||
if(openedMenu > 1000 && handsInMenu == 0) {
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('li.menu_icon').find('li').removeClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
}
|
||||
}, 2500);
|
||||
});
|
||||
}else{
|
||||
$(document).ready(function() {
|
||||
$('#menu').on("click", function() {
|
||||
$('div#title_menu').show();
|
||||
handsInMenu = 1;
|
||||
openTimeMenu = new Date().getTime();
|
||||
$('#menu').css('width', '145px');
|
||||
$('li.menu_icon').addClass( " no_hidden_menu" );
|
||||
$('li.menu_icon').find('li').addClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '144px');
|
||||
}).mouseleave(function() {
|
||||
handsInMenu = 0;
|
||||
setTimeout(function() {
|
||||
openedMenu = new Date().getTime() - openTimeMenu;
|
||||
if(openedMenu > 1000 && handsInMenu == 0) {
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('li.menu_icon').find('li').removeClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
}
|
||||
}, 5500);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('div#title_menu').hide();
|
||||
if(!click_display){
|
||||
$('#menu').mouseenter(function() {
|
||||
handsInMenu = 1;
|
||||
openTimeMenu = new Date().getTime();
|
||||
$('ul.submenu').css('left', '44px');
|
||||
}).mouseleave(function() {
|
||||
handsInMenu = 0;
|
||||
setTimeout(function() {
|
||||
openedMenu = new Date().getTime() - openTimeMenu;
|
||||
if(openedMenu > 1000 && handsInMenu == 0) {
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('li.menu_icon').find('li').removeClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '44px');
|
||||
}
|
||||
}, 2500);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
||||
|
@ -348,182 +191,199 @@ $(document).ready( function() {
|
|||
handsIn = 0;
|
||||
handsIn2 = 0;
|
||||
|
||||
if(!click_display){
|
||||
$('.menu_icon').mouseenter(function() {
|
||||
|
||||
/**
|
||||
* Positionate the submenu elements. Add a negative top.
|
||||
*
|
||||
* @param int index It is the position of li.menu_icon in the ul.
|
||||
* @param string id_submenu It is the id of first level submenu.
|
||||
* @param string id_submenu2 It is the id of second level submenu.
|
||||
* @param int item_height It is the height of a menu item (28 o 35).
|
||||
*
|
||||
* @return (int) The position (in px).
|
||||
*/
|
||||
function menu_calculate_top(index, id_submenu, id_submenu2, item_height){
|
||||
|
||||
var level1 = index;
|
||||
var level2 = $('#'+id_submenu+' ul.submenu > li').length;
|
||||
var level3 = $('#'+id_submenu2+' > li.sub_subMenu').length;
|
||||
var item_height = item_height;
|
||||
|
||||
level2--;
|
||||
if (id_submenu2 !== false) {
|
||||
// If level3 is set, the position is calculated like box is in the center.
|
||||
// wiouth considering level2 box can be moved.
|
||||
level3--;
|
||||
total = (level1 + level3);
|
||||
comp = level3;
|
||||
} else {
|
||||
total = (level1 + level2);
|
||||
comp = level2;
|
||||
}
|
||||
|
||||
// Positionate in the middle
|
||||
if (total > 12 && ((total < 18) || ((level1 - comp) <= 4))) {
|
||||
return - ( Math.floor(comp / 2) * item_height);
|
||||
}
|
||||
|
||||
// Positionate in the bottom
|
||||
if (total >= 18) {
|
||||
return (- comp * item_height);
|
||||
}
|
||||
|
||||
// return 0 by default
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the menu items to be positioned.
|
||||
*
|
||||
* @param string item It is the selector of the current element.
|
||||
*
|
||||
* @return Add the top position in a inline style.
|
||||
*/
|
||||
function get_menu_items(item){
|
||||
var item_height = parseInt(item.css('min-height'));
|
||||
var id_submenu = item.attr('id');
|
||||
var id_submenu2 = false;
|
||||
var index = item.index();
|
||||
|
||||
if(item.parent().hasClass('godmode')){
|
||||
index = index+6; // This is because the menu has divided in two parts.
|
||||
}
|
||||
var top_submenu = menu_calculate_top(index, id_submenu, id_submenu2, item_height);
|
||||
top_submenu = top_submenu+'px';
|
||||
$('#'+id_submenu+' ul.submenu').css('top', top_submenu);
|
||||
|
||||
$('.has_submenu').mouseenter(function() {
|
||||
id_submenu2 = item.attr('id');
|
||||
id_submenu2 = $('#'+id_submenu2+' ul.submenu2').attr('id');
|
||||
var top_submenu2 = menu_calculate_top(index, id_submenu, id_submenu2, item_height);
|
||||
top_submenu2 = top_submenu2+'px';
|
||||
$('#'+id_submenu2).css('top', top_submenu2);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Show and hide submenus
|
||||
*/
|
||||
if(!click_display){
|
||||
$('.menu_icon').mouseenter(function() {
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
get_menu_items(table_hover);
|
||||
if( typeof(table_noHover) != 'undefined')
|
||||
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
|
||||
$("ul#sub"+table_noHover[0].id).hide();
|
||||
}).mouseleave(function() {
|
||||
table_noHover = $(this);
|
||||
handsIn = 0;
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime;
|
||||
if(opened > 3000 && handsIn == 0) {
|
||||
openTime = 4000;
|
||||
$("ul#sub"+table_noHover[0].id).hide();
|
||||
}
|
||||
}, 2500);
|
||||
});
|
||||
}else{
|
||||
$(document).ready(function() {
|
||||
if (autohidden_menu) {
|
||||
$('.menu_icon').on("click", function() {
|
||||
if( typeof(table_hover) != 'undefined'){
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
if( typeof(table_noHover) != 'undefined')
|
||||
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
|
||||
$("ul#sub"+table_noHover[0].id).hide();
|
||||
get_menu_items(table_hover);
|
||||
}).mouseleave(function() {
|
||||
table_noHover = $(this);
|
||||
handsIn = 0;
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime;
|
||||
if(opened > 3000 && handsIn == 0) {
|
||||
openTime = 4000;
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if(opened > 5000 && handsIn == 0) {
|
||||
openTime = 6000;
|
||||
$("ul#sub"+table_noHover[0].id).hide();
|
||||
}
|
||||
}, 2500);
|
||||
}, 5500);
|
||||
});
|
||||
} else {
|
||||
$('.menu_icon').on("click", function() {
|
||||
if( typeof(table_hover) != 'undefined'){
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
get_menu_items(table_hover);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.has_submenu').mouseenter(function() {
|
||||
table_hover2 = $(this);
|
||||
handsIn2 = 1;
|
||||
openTime2 = new Date().getTime();
|
||||
$("#sub"+table_hover2[0].id).show();
|
||||
if( typeof(table_noHover2) != 'undefined')
|
||||
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id )
|
||||
$("ul#sub"+table_noHover2[0].id).hide();
|
||||
}).mouseleave(function() {
|
||||
table_noHover2 = table_hover2;
|
||||
handsIn2 = 0;
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime2;
|
||||
if(opened >= 3000 && handsIn2 == 0) {
|
||||
openTime2 = 4000;
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
}
|
||||
}, 3500);
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
if(!click_display){
|
||||
$('#container').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
}else{
|
||||
$(document).ready(function() {
|
||||
if (autohidden_menu) {
|
||||
$('.menu_icon').on("click", function() {
|
||||
if( typeof(table_hover) != 'undefined'){
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
}).mouseleave(function() {
|
||||
table_noHover = $(this);
|
||||
handsIn = 0;
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime;
|
||||
if(opened > 5000 && handsIn == 0) {
|
||||
openTime = 6000;
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
}, 5500);
|
||||
});
|
||||
} else {
|
||||
$('.menu_icon').on("click", function() {
|
||||
if( typeof(table_hover) != 'undefined'){
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
});
|
||||
}
|
||||
$('#main').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
}
|
||||
|
||||
- $('.has_submenu').mouseenter(function() {
|
||||
table_hover2 = $(this);
|
||||
handsIn2 = 1;
|
||||
openTime2 = new Date().getTime();
|
||||
$("#sub"+table_hover2[0].id).show();
|
||||
if( typeof(table_noHover2) != 'undefined')
|
||||
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id )
|
||||
$("ul#sub"+table_noHover2[0].id).hide();
|
||||
}).mouseleave(function() {
|
||||
table_noHover2 = table_hover2;
|
||||
handsIn2 = 0;
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime2;
|
||||
if(opened >= 3000 && handsIn2 == 0) {
|
||||
openTime2 = 4000;
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
}
|
||||
}, 3500);
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
if (!classic_menu) {
|
||||
//Daniel maya 02/06/2016 Display menu with click --INI
|
||||
if(!click_display){
|
||||
$('#container').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
});
|
||||
}else{
|
||||
$('#main').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
});
|
||||
}
|
||||
//Daniel maya 02/06/2016 Display menu with click --END
|
||||
}
|
||||
else {
|
||||
if(!click_display){
|
||||
$('#container').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '145px');
|
||||
$('ul.submenu').css('left', '144px');
|
||||
});
|
||||
}else{
|
||||
$('#main').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '145px');
|
||||
$('ul.submenu').css('left', '144px');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('div.menu>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
|
||||
if (classic_menu) {
|
||||
$('div.menu>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('ul.submenu').css('left', '144px');
|
||||
});
|
||||
|
||||
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('ul.submenu').css('left', '144px');
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('div.menu>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
});
|
||||
|
||||
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
});
|
||||
}
|
||||
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
<html>
|
||||
<head>
|
||||
|
||||
<style>
|
||||
|
||||
#alert_messages_na{
|
||||
-moz-border-bottom-right-radius: 5px;
|
||||
-webkit-border-bottom-left-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
z-index:2;
|
||||
position:fixed;
|
||||
width:700px;
|
||||
background:white;
|
||||
left:50%;
|
||||
top:20%;
|
||||
margin-left:-350px;
|
||||
|
||||
}
|
||||
|
||||
.modalheade{
|
||||
text-align:center;
|
||||
width:100%;
|
||||
height:37px;
|
||||
left:0px;
|
||||
background-color:#82b92e;
|
||||
}
|
||||
.modalheadertex{
|
||||
color:white;
|
||||
position:relative;
|
||||
font-family:Nunito;
|
||||
font-size:13pt;
|
||||
top:8px;
|
||||
}
|
||||
|
||||
.modalconten{
|
||||
color:black;
|
||||
background:white;
|
||||
}
|
||||
.modalcontentim{
|
||||
float:left;
|
||||
margin-left:30px;
|
||||
margin-top:30px;
|
||||
margin-bottom:30px;
|
||||
}
|
||||
.modalcontenttex{
|
||||
float:left;
|
||||
text-align:justify;
|
||||
color:black;
|
||||
font-size: 9.5pt;
|
||||
line-height:13pt;
|
||||
margin-top:40px;
|
||||
width:430px;
|
||||
margin-left:30px;
|
||||
}
|
||||
.modalwikibutto{
|
||||
cursor:pointer;
|
||||
text-align:center;
|
||||
margin-right:45px;
|
||||
float:right;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
margin-bottom:30px;
|
||||
border-radius: 3px;
|
||||
width:170px;
|
||||
height:30px;
|
||||
border: 1px solid #82b92e;
|
||||
margin-top:8%;
|
||||
background-color:#82b92e;
|
||||
}
|
||||
.modalwikibuttontex{
|
||||
color:#ffffff;
|
||||
font-family:Nunito;
|
||||
font-size:10pt;
|
||||
position:relative;
|
||||
top:6px;
|
||||
}
|
||||
|
||||
#opacity{
|
||||
background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="alert_messages_na">
|
||||
|
||||
<div class='modalheade'>
|
||||
<span class='modalheadertex'>
|
||||
<?php echo __('Database error'); ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class='modalconten'>
|
||||
<img class='modalcontentim' src='<?php echo $config['homeurl']; ?>/images/mysqlerr.png'>
|
||||
<div class='modalcontenttex'>
|
||||
<?php
|
||||
echo __('Failure to connect to Database server, please check the configuration file config.php or contact system administrator if you need assistance.');
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<a href='https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Configuration' target='_blank'>
|
||||
<div class='modalwikibutto cerrar'>
|
||||
<span class='modalwikibuttontex'> <?php echo __('Documentation'); ?></span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="opacity"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -708,6 +708,13 @@ foreach ($fields as $field) {
|
|||
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
|
||||
true
|
||||
);
|
||||
$combo = [];
|
||||
$combo = $field['combo_values'];
|
||||
$combo = explode(',', $combo);
|
||||
$combo_values = [];
|
||||
foreach ($combo as $value) {
|
||||
$combo_values[$value] = $value;
|
||||
}
|
||||
|
||||
$custom_value = db_get_value_filter(
|
||||
'description',
|
||||
|
@ -747,6 +754,28 @@ foreach ($fields as $field) {
|
|||
);
|
||||
}
|
||||
|
||||
if ($field['combo_values'] !== '') {
|
||||
$data[1] = html_print_select(
|
||||
$combo_values,
|
||||
'customvalue_'.$field['id_field'],
|
||||
$custom_value,
|
||||
'',
|
||||
__('None'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false
|
||||
);
|
||||
};
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
|
@ -757,7 +786,7 @@ if (!empty($fields)) {
|
|||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
|
||||
// The context help about the learning mode
|
||||
// The context help about the learning mode.
|
||||
if ($modo == 0) {
|
||||
echo "<span id='modules_not_learning_mode_context_help' style=''>";
|
||||
} else {
|
||||
|
|
|
@ -159,8 +159,8 @@ $module_macros = [];
|
|||
// Create agent
|
||||
if ($create_agent) {
|
||||
$mssg_warning = 0;
|
||||
$alias_safe_output = io_safe_output(get_parameter("alias",""));
|
||||
$alias = io_safe_input(trim (preg_replace('/[\/\\\|%#&$-]/', '', $alias_safe_output)));
|
||||
$alias_safe_output = io_safe_output(get_parameter('alias', ''));
|
||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$-]/', '', $alias_safe_output)));
|
||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||
$unique_ip = (int) get_parameter_post('unique_ip', 0);
|
||||
|
@ -765,8 +765,8 @@ if ($update_agent) {
|
|||
$mssg_warning = 0;
|
||||
$id_agente = (int) get_parameter_post('id_agente');
|
||||
$nombre_agente = str_replace('`', '‘', (string) get_parameter_post('agente', ''));
|
||||
$alias_safe_output = io_safe_output(get_parameter("alias",""));
|
||||
$alias = io_safe_input(trim (preg_replace('/[\/\\\|%#&$-]/', '', $alias_safe_output)));
|
||||
$alias_safe_output = io_safe_output(get_parameter('alias', ''));
|
||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$-]/', '', $alias_safe_output)));
|
||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||
$unique_ip = (int) get_parameter_post('unique_ip', 0);
|
||||
|
|
|
@ -25,13 +25,16 @@ $id_field = (int) get_parameter('id_field', 0);
|
|||
$name = (string) get_parameter('name', '');
|
||||
$display_on_front = (bool) get_parameter('display_on_front', 0);
|
||||
$is_password_type = (bool) get_parameter('is_password_type', 0);
|
||||
|
||||
// Header
|
||||
$is_combo_enable = (bool) get_parameter('is_combo_enable', 0);
|
||||
$combo_values = (string) get_parameter('combo_values', '');
|
||||
// Header.
|
||||
if ($id_field) {
|
||||
$field = db_get_row_filter('tagent_custom_fields', ['id_field' => $id_field]);
|
||||
$name = $field['name'];
|
||||
$display_on_front = $field['display_on_front'];
|
||||
$is_password_type = $field['is_password_type'];
|
||||
$combo_values = $field['combo_values'];
|
||||
$is_combo_enable = $config['is_combo_enable'];
|
||||
ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, '');
|
||||
} else {
|
||||
ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, '');
|
||||
|
@ -40,17 +43,87 @@ if ($id_field) {
|
|||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->id = 'configure_field';
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
$table->style[4] = 'font-weight: bold';
|
||||
$table->style[6] = 'font-weight: bold';
|
||||
|
||||
echo "<div id='message_set_password' title='".__('Agent Custom Fields Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;font-weight: bold;'>".__('You cannot set the Password type until you clear the combo values and click on update button.').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
echo "<div id='message_set_combo' title='".__('Agent Custom Fields Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;font-weight: bold;'>".__('You cannot unset the enable combo until you clear the combo values and click on update.').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
echo "<div id='message_no_set_password' title='".__('Agent Custom Fields Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;font-weight: bold;'>".__('If you select Enabled combo the Password type will be disabled.').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
echo "<div id='message_no_set_combo' title='".__('Agent Custom Fields Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;font-weight: bold;'>".__('If you select Passord type the Enabled combo will be disabled.').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = __('Name');
|
||||
$table->data[0][1] = html_print_input_text('name', $name, '', 35, 100, true);
|
||||
$table->data[0][1] = html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
35,
|
||||
100,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[0][2] = __('Pass type').ui_print_help_tip(__('The fields with pass type enabled will be displayed like html input type pass in html'), true);
|
||||
$table->data[0][3] = html_print_checkbox('is_password_type', 1, $is_password_type, true);
|
||||
$table->data[1][0] = __('Pass type').ui_print_help_tip(
|
||||
__('The fields with pass type enabled will be displayed like html input type pass in html'),
|
||||
true
|
||||
);
|
||||
$table->data[1][1] = html_print_checkbox_switch(
|
||||
'is_password_type',
|
||||
1,
|
||||
$is_password_type,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[0][4] = __('Display on front').ui_print_help_tip(__('The fields with display on front enabled will be displayed into the agent details'), true);
|
||||
$table->data[0][5] = html_print_checkbox('display_on_front', 1, $display_on_front, true);
|
||||
$table->data[2][0] = __('Display on front').ui_print_help_tip(
|
||||
__('The fields with display on front enabled will be displayed into the agent details'),
|
||||
true
|
||||
);
|
||||
$table->data[2][1] = html_print_checkbox_switch(
|
||||
'display_on_front',
|
||||
1,
|
||||
$display_on_front,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[3][0] = __('Enabled combo');
|
||||
$table->data[3][1] = html_print_checkbox_switch_extended(
|
||||
'is_combo_enable',
|
||||
0,
|
||||
$config['is_combo_enable'],
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$table->rowstyle[4] = 'display: none;';
|
||||
$table->data[4][0] = __('Combo values').ui_print_help_tip(
|
||||
__('Set values separated by comma'),
|
||||
true
|
||||
);
|
||||
$table->data[4][1] = html_print_input_text(
|
||||
'combo_values',
|
||||
io_safe_output($combo_values),
|
||||
'',
|
||||
35,
|
||||
200,
|
||||
true
|
||||
);
|
||||
|
||||
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
|
||||
html_print_table($table);
|
||||
|
@ -67,3 +140,67 @@ if ($id_field) {
|
|||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
?>
|
||||
|
||||
<script>
|
||||
$(document).ready (function () {
|
||||
if($('input[type=hidden][name=update_field]').val() == 1 && $('input[type=text][name=combo_values]').val() != ''){
|
||||
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
|
||||
$('#configure_field-4').show();
|
||||
$('input[type=checkbox][name=is_password_type]').change(function (e) {
|
||||
dialog_message("#message_set_password");
|
||||
$('input[type=checkbox][name=is_password_type]').prop('checked', false);
|
||||
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
|
||||
$('#configure_field-4').show();
|
||||
e.preventDefault();
|
||||
});
|
||||
$('input[type=checkbox][name=is_combo_enable]').change(function (e) {
|
||||
if($('input[type=text][name=combo_values]').val() != '' && $('input[type=checkbox][name=is_combo_enable]').prop('checked', true)){
|
||||
dialog_message("#message_set_combo");
|
||||
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
|
||||
$('#configure_field-4').show();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('input[type=checkbox][name=is_combo_enable]').change(function () {
|
||||
if( $(this).is(":checked") ){
|
||||
$('#configure_field-4').show();
|
||||
dialog_message("#message_no_set_password");
|
||||
$('#configure_field-1').hide();
|
||||
}
|
||||
else{
|
||||
$('#configure_field-4').hide();
|
||||
$('#configure_field-1').show();
|
||||
}
|
||||
});
|
||||
$('input[type=checkbox][name=is_password_type]').change(function () {
|
||||
if( $(this).is(":checked")){
|
||||
dialog_message("#message_no_set_combo");
|
||||
$('#configure_field-3').hide();
|
||||
}
|
||||
else{
|
||||
$('#configure_field-3').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function dialog_message(message_id) {
|
||||
$(message_id)
|
||||
.css("display", "inline")
|
||||
.dialog({
|
||||
modal: true,
|
||||
show: "blind",
|
||||
hide: "blind",
|
||||
width: "400px",
|
||||
buttons: {
|
||||
Close: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -26,7 +26,7 @@ if (!check_acl($config['id_user'], 0, 'PM')) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
ui_print_page_header(__('Agents custom fields manager'), 'images/custom_field.png', false, '', true, '');
|
||||
|
||||
$create_field = (bool) get_parameter('create_field');
|
||||
|
@ -36,10 +36,12 @@ $id_field = (int) get_parameter('id_field', 0);
|
|||
$name = (string) get_parameter('name', '');
|
||||
$display_on_front = (int) get_parameter('display_on_front', 0);
|
||||
$is_password_type = (int) get_parameter('is_password_type', 0);
|
||||
$combo_values = (string) get_parameter('combo_values', '');
|
||||
$combo_value_selected = (string) get_parameter('combo_value_selected', '');
|
||||
|
||||
// Create field
|
||||
// Create field.
|
||||
if ($create_field) {
|
||||
// Check if name field is empty
|
||||
// Check if name field is empty.
|
||||
if ($name == '') {
|
||||
ui_print_error_message(__('The name must not be empty'));
|
||||
} else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) {
|
||||
|
@ -51,20 +53,22 @@ if ($create_field) {
|
|||
'name' => $name,
|
||||
'display_on_front' => $display_on_front,
|
||||
'is_password_type' => $is_password_type,
|
||||
'combo_values' => $combo_values,
|
||||
]
|
||||
);
|
||||
ui_print_success_message(__('Field successfully created'));
|
||||
}
|
||||
}
|
||||
|
||||
// Update field
|
||||
// Update field.
|
||||
if ($update_field) {
|
||||
// Check if name field is empty
|
||||
// Check if name field is empty.
|
||||
if ($name != '') {
|
||||
$values = [
|
||||
'name' => $name,
|
||||
'display_on_front' => $display_on_front,
|
||||
'is_password_type' => $is_password_type,
|
||||
'combo_values' => $combo_values,
|
||||
];
|
||||
|
||||
$result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]);
|
||||
|
@ -79,7 +83,7 @@ if ($update_field) {
|
|||
}
|
||||
}
|
||||
|
||||
// Delete field
|
||||
// Delete field.
|
||||
if ($delete_field) {
|
||||
$result = db_process_sql_delete(
|
||||
'tagent_custom_fields',
|
||||
|
|
|
@ -431,7 +431,7 @@ if (modules_is_string_type($id_module_type) || $edit) {
|
|||
str_replace('"', '', $str_warning),
|
||||
'',
|
||||
10,
|
||||
255,
|
||||
1024,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
|
@ -484,7 +484,7 @@ if (modules_is_string_type($id_module_type) || $edit) {
|
|||
str_replace('"', '', $str_critical),
|
||||
'',
|
||||
10,
|
||||
255,
|
||||
1024,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
|
|
|
@ -0,0 +1,272 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 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.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AR')
|
||||
&& ! check_acl($config['id_user'], 0, 'AW')
|
||||
&& ! check_acl($config['id_user'], 0, 'AM')
|
||||
) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Agent Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$update = get_parameter('upd_button', '');
|
||||
$default = (int) get_parameter('default', 0);
|
||||
|
||||
|
||||
if ($default != 0) {
|
||||
$fields_selected = explode(',', $config['status_monitor_fields']);
|
||||
} else if ($update != '') {
|
||||
$fields_selected = (array) get_parameter('fields_selected');
|
||||
|
||||
if ($fields_selected[0] == '') {
|
||||
$fields_selected = explode(',', $config['status_monitor_fields']);
|
||||
} else {
|
||||
$status_monitor_fields = implode(',', $fields_selected);
|
||||
}
|
||||
|
||||
$values = [
|
||||
'token' => 'status_monitor_fields',
|
||||
'value' => $status_monitor_fields,
|
||||
];
|
||||
|
||||
// update 'status_monitor_fields' in tconfig table to keep the value at update.
|
||||
$result = db_process_sql_update(
|
||||
'tconfig',
|
||||
$values,
|
||||
['token' => 'status_monitor_fields']
|
||||
);
|
||||
|
||||
ui_print_result_message($result, __('Successfully updated'), __('Could not be updated'));
|
||||
|
||||
$config['status_monitor_fields'] = $status_monitor_fields;
|
||||
}
|
||||
|
||||
$fields_selected = [];
|
||||
$status_monitor_fields = '';
|
||||
$fields_selected = explode(',', $config['status_monitor_fields']);
|
||||
|
||||
$result_selected = [];
|
||||
|
||||
// show list of fields selected.
|
||||
if ($fields_selected[0] != '') {
|
||||
foreach ($fields_selected as $field_selected) {
|
||||
switch ($field_selected) {
|
||||
case 'policy':
|
||||
$result = __('Policy');
|
||||
break;
|
||||
|
||||
case 'agent':
|
||||
$result = __('Agent');
|
||||
break;
|
||||
|
||||
case 'data_type':
|
||||
$result = __('Data type');
|
||||
break;
|
||||
|
||||
case 'module_name':
|
||||
$result = __('Module name');
|
||||
break;
|
||||
|
||||
case 'server_type':
|
||||
$result = __('Server type');
|
||||
break;
|
||||
|
||||
case 'interval':
|
||||
$result = __('Interval');
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
$result = __('Status');
|
||||
break;
|
||||
|
||||
case 'graph':
|
||||
$result = __('Graph');
|
||||
break;
|
||||
|
||||
case 'warn':
|
||||
$result = __('Warn');
|
||||
break;
|
||||
|
||||
case 'data':
|
||||
$result = __('Data');
|
||||
break;
|
||||
|
||||
case 'timestamp':
|
||||
$result = __('Timestamp');
|
||||
break;
|
||||
|
||||
case 'to_critical':
|
||||
$result = __('Last status change');
|
||||
break;
|
||||
}
|
||||
|
||||
$result_selected[$field_selected] = $result;
|
||||
}
|
||||
}
|
||||
|
||||
echo '<h3>'.__('Show monitor detail fields').'</h3>';
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
|
||||
$table->size = [];
|
||||
// ~ $table->size[0] = '20%';
|
||||
$table->size[1] = '10px';
|
||||
// ~ $table->size[2] = '20%';
|
||||
$table->style[0] = 'text-align:center;';
|
||||
$table->style[2] = 'text-align:center;';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$fields_available = [];
|
||||
|
||||
$fields_available['policy'] = __('Policy');
|
||||
$fields_available['agent'] = __('Agent');
|
||||
$fields_available['data_type'] = __('Data type');
|
||||
$fields_available['module_name'] = __('Module name');
|
||||
$fields_available['server_type'] = __('Server type');
|
||||
$fields_available['interval'] = __('Interval');
|
||||
$fields_available['status'] = __('Status');
|
||||
$fields_available['graph'] = __('Graph');
|
||||
$fields_available['warn'] = __('Warn');
|
||||
$fields_available['data'] = __('Data');
|
||||
$fields_available['timestamp'] = __('Timestamp');
|
||||
$fields_available['to_critical'] = __('Last status change');
|
||||
|
||||
// remove fields already selected
|
||||
foreach ($fields_available as $key => $available) {
|
||||
foreach ($result_selected as $selected) {
|
||||
if ($selected == $available) {
|
||||
unset($fields_available[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[0][0] = '<b>'.__('Fields available').'</b>';
|
||||
$table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
|
||||
$table->data[1][1] = '<a href="javascript:">'.html_print_image(
|
||||
'images/darrowright.png',
|
||||
true,
|
||||
[
|
||||
'id' => 'right',
|
||||
'title' => __('Add fields to select'),
|
||||
]
|
||||
).'</a>';
|
||||
$table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
|
||||
'images/darrowleft.png',
|
||||
true,
|
||||
[
|
||||
'id' => 'left',
|
||||
'title' => __('Delete fields to select'),
|
||||
]
|
||||
).'</a>';
|
||||
|
||||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>'.__('Fields selected').'</b>';
|
||||
$table->data[1][2] = html_print_select(
|
||||
$result_selected,
|
||||
'fields_selected[]',
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'width: 300px'
|
||||
);
|
||||
|
||||
echo '<form id="custom_status_monitor" method="post" action="index.php?sec=view&sec2=operation/agentes/status_monitor§ion=fields&pure='.$config['pure'].'">';
|
||||
html_print_table($table);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"');
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
|
||||
$("#right").click (function () {
|
||||
jQuery.each($("select[name='fields_available[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_selected[]']").append($("<option></option>").html(field_name).attr("value", id_field));
|
||||
$("#fields_available").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_selected").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#left").click (function () {
|
||||
var current_fields_size = ($('#fields_selected option').length);
|
||||
var selected_fields = [];
|
||||
var selected_fields_total = '';
|
||||
|
||||
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
selected_fields.push(field_name);
|
||||
selected_fields_total = selected_fields.length;
|
||||
});
|
||||
|
||||
if(selected_fields_total === current_fields_size){
|
||||
display_confirm_dialog(
|
||||
"<?php echo '<span style=text-transform:none;font-size:9.5pt;>'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>",
|
||||
"<?php echo __('Confirm'); ?>",
|
||||
"<?php echo __('Cancel'); ?>",
|
||||
function () {
|
||||
move_left();
|
||||
$("#fields_available").find("option[value='timestamp']").remove();
|
||||
$("select[name='fields_selected[]']").append($("<option></option>").val('timestamp').html('<i>' + 'Timestamp' + '</i>'));
|
||||
}
|
||||
);
|
||||
}
|
||||
else{
|
||||
move_left();
|
||||
}
|
||||
});
|
||||
|
||||
$("#submit-upd_button").click(function () {
|
||||
$("#fields_selected").find("option[value='0']").remove();
|
||||
$('#fields_selected option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function move_left(){
|
||||
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
|
||||
$("#fields_selected").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_available").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -689,6 +689,13 @@ foreach ($fields as $field) {
|
|||
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
|
||||
true
|
||||
);
|
||||
$combo = [];
|
||||
$combo = $field['combo_values'];
|
||||
$combo = explode(',', $combo);
|
||||
$combo_values = [];
|
||||
foreach ($combo as $value) {
|
||||
$combo_values[$value] = $value;
|
||||
}
|
||||
|
||||
$custom_value = db_get_value_filter('description', 'tagent_custom_data', ['id_field' => $field['id_field'], 'id_agent' => $id_agente]);
|
||||
|
||||
|
@ -714,6 +721,28 @@ foreach ($fields as $field) {
|
|||
$data[1] = html_print_textarea('customvalue_'.$field['id_field'], 2, 65, $custom_value, 'style="min-height: 30px;"', true);
|
||||
}
|
||||
|
||||
if ($field['combo_values'] !== '') {
|
||||
$data[1] = html_print_select(
|
||||
$combo_values,
|
||||
'customvalue_'.$field['id_field'],
|
||||
$custom_value,
|
||||
'',
|
||||
__('No change'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false
|
||||
);
|
||||
};
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
|
|
|
@ -562,7 +562,7 @@ $table->data['edit1'][1] = '<table width="100%">';
|
|||
'',
|
||||
'',
|
||||
5,
|
||||
255,
|
||||
1024,
|
||||
true
|
||||
);
|
||||
$table->data['edit1'][1] .= '</td>';
|
||||
|
@ -631,7 +631,7 @@ $table->data['edit1'][1] = '<table width="100%">';
|
|||
'',
|
||||
'',
|
||||
5,
|
||||
255,
|
||||
1024,
|
||||
true
|
||||
);
|
||||
$table->data['edit1'][3] .= '</td>';
|
||||
|
|
|
@ -21,6 +21,21 @@ require_once 'include/functions_menu.php';
|
|||
$menu_godmode = [];
|
||||
$menu_godmode['class'] = 'godmode';
|
||||
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sub = [];
|
||||
$sub['godmode/servers/discovery']['text'] = __('Discover');
|
||||
$sub['godmode/servers/discovery']['id'] = 'Discover';
|
||||
$sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/discovery'];
|
||||
|
||||
// Add to menu.
|
||||
$menu_godmode['discover']['text'] = __('Discovery');
|
||||
$menu_godmode['discover']['sec2'] = 'godmode/servers/discovery';
|
||||
$menu_godmode['discover']['id'] = 'god-discovery';
|
||||
$menu_godmode['discover']['sub'] = $sub;
|
||||
}
|
||||
|
||||
|
||||
$sub = [];
|
||||
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'AD')) {
|
||||
$sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents');
|
||||
|
@ -200,6 +215,7 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, '
|
|||
$menu_godmode['gservers']['id'] = 'god-servers';
|
||||
|
||||
$sub = [];
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$sub['godmode/servers/modificar_server']['text'] = __('Manage servers');
|
||||
$sub['godmode/servers/modificar_server']['id'] = 'Manage servers';
|
||||
|
@ -269,6 +285,9 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
|||
$sub2['godmode/setup/setup&section=ehorus']['text'] = __('eHorus');
|
||||
$sub2['godmode/setup/setup&section=ehorus']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup&section=notifications']['text'] = __('Notifications');
|
||||
$sub2['godmode/setup/setup&section=notifications']['refr'] = 0;
|
||||
|
||||
if ($config['activate_gis']) {
|
||||
$sub2['godmode/setup/gis']['text'] = __('Map conections GIS');
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ $table->data[4][1] .= html_print_input_text(
|
|||
$str_warning,
|
||||
'',
|
||||
5,
|
||||
64,
|
||||
1024,
|
||||
true
|
||||
).'</span>';
|
||||
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
|
@ -225,7 +225,7 @@ $table->data[5][1] .= html_print_input_text(
|
|||
$str_critical,
|
||||
'',
|
||||
5,
|
||||
64,
|
||||
1024,
|
||||
true
|
||||
).'</span>';
|
||||
$table->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Server Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
ui_require_css_file('discovery');
|
||||
|
||||
ui_print_page_header(__('Discover'), '', false, '', true);
|
||||
|
||||
|
||||
/**
|
||||
* Mask class names.
|
||||
*
|
||||
* @param string $str Wiz parameter.
|
||||
*
|
||||
* @return string Classname.
|
||||
*/
|
||||
function get_wiz_class($str)
|
||||
{
|
||||
switch ($str) {
|
||||
case 'hd':
|
||||
return 'HostDevices';
|
||||
|
||||
case 'cloud':
|
||||
return 'Cloud';
|
||||
|
||||
case 'tasklist':
|
||||
return 'DiscoveryTaskList';
|
||||
|
||||
case 'app':
|
||||
return 'Applications';
|
||||
|
||||
case 'ctask':
|
||||
return 'ConsoleTasks';
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Aux. function to compare classpath names.
|
||||
*
|
||||
* @param string $a Classpath A.
|
||||
* @param string $b Classpath B.
|
||||
*
|
||||
* @return string Matching one.
|
||||
*/
|
||||
function cl_load_cmp($a, $b)
|
||||
{
|
||||
$str_a = basename($a, '.class.php');
|
||||
$str_b = basename($b, '.class.php');
|
||||
if ($str_a == $str_b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($str_a < $str_b) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CLASS LOADER.
|
||||
*/
|
||||
|
||||
// Dynamic class loader.
|
||||
$classes = glob($config['homedir'].'/godmode/wizards/*.class.php');
|
||||
if (enterprise_installed()) {
|
||||
$ent_classes = glob(
|
||||
$config['homedir'].'/enterprise/godmode/wizards/*.class.php'
|
||||
);
|
||||
if ($ent_classes === false) {
|
||||
$ent_classes = [];
|
||||
}
|
||||
|
||||
$classes = array_merge($classes, $ent_classes);
|
||||
}
|
||||
|
||||
foreach ($classes as $classpath) {
|
||||
include_once $classpath;
|
||||
}
|
||||
|
||||
// Sort output.
|
||||
uasort($classes, 'cl_load_cmp');
|
||||
|
||||
// Check user action.
|
||||
$wiz_in_use = get_parameter('wiz', null);
|
||||
$page = get_parameter('page', 0);
|
||||
|
||||
$classname_selected = get_wiz_class($wiz_in_use);
|
||||
|
||||
// Else: class not found pseudo exception.
|
||||
if ($classname_selected !== null) {
|
||||
$wiz = new $classname_selected($page);
|
||||
$result = $wiz->run();
|
||||
if (is_array($result) === true) {
|
||||
// Redirect control and messages to DiscoveryTasklist.
|
||||
$classname_selected = 'DiscoveryTaskList';
|
||||
$wiz = new $classname_selected($page);
|
||||
$result = $wiz->run($result['msg'], $result['result']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($classname_selected === null) {
|
||||
// Load classes and print selector.
|
||||
$wiz_data = [];
|
||||
foreach ($classes as $classpath) {
|
||||
$classname = basename($classpath, '.class.php');
|
||||
$obj = new $classname();
|
||||
|
||||
// DiscoveryTaskList must be first button.
|
||||
if ($classname == 'DiscoveryTaskList') {
|
||||
array_unshift($wiz_data, $obj->load());
|
||||
} else {
|
||||
$wiz_data[] = $obj->load();
|
||||
}
|
||||
}
|
||||
|
||||
Wizard::printBigButtonsList($wiz_data);
|
||||
}
|
|
@ -291,9 +291,9 @@ $table->rowclass[17] = 'recon_script';
|
|||
$table->data[0][0] = '<b>'.__('Task name').'</b>';
|
||||
$table->data[0][1] = html_print_input_text('name', $name, '', 25, 0, true);
|
||||
|
||||
// Recon server.
|
||||
$table->data[1][0] = '<b>'.__('Recon server').ui_print_help_tip(
|
||||
__('You must select a Recon Server for the Task, otherwise the Recon Task will never run'),
|
||||
// Discovery server.
|
||||
$table->data[1][0] = '<b>'.__('Discovery server').ui_print_help_tip(
|
||||
__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'),
|
||||
true
|
||||
);
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ $edit_file = get_parameter('edit_file', false);
|
|||
$update_file = get_parameter('update_file', false);
|
||||
$plugin_command = get_parameter('plugin_command', '');
|
||||
$tab = get_parameter('tab', '');
|
||||
$deploy_plugin = get_parameter('deploy_plugin', 0);
|
||||
|
||||
if ($view != '') {
|
||||
$form_id = $view;
|
||||
|
@ -192,9 +193,8 @@ if ($filemanager) {
|
|||
// If is win compatible and the compatibility must be unix
|
||||
if ($is_win_compatible !== false && $compatibility == 'unix') {
|
||||
$contentFile = str_replace("\r\n", "\n", $contentFile);
|
||||
}
|
||||
// If is unix compatible and the compatibility must be win
|
||||
else if ($is_win_compatible === false && $compatibility == 'windows') {
|
||||
} else if ($is_win_compatible === false && $compatibility == 'windows') {
|
||||
// If is unix compatible and the compatibility must be win
|
||||
$contentFile = str_replace("\n", "\r\n", $contentFile);
|
||||
}
|
||||
|
||||
|
@ -268,12 +268,16 @@ if ($filemanager) {
|
|||
// =====================================================================
|
||||
$sec = 'gservers';
|
||||
|
||||
if (($create != '') or ($view != '')) {
|
||||
if (($create != '') || ($view != '')) {
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
$management_allowed = is_management_allowed();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(__('To manage plugin you must activate centralized management'));
|
||||
}
|
||||
} else {
|
||||
if ($create != '') {
|
||||
ui_print_page_header(
|
||||
|
@ -292,6 +296,16 @@ if (($create != '') or ($view != '')) {
|
|||
true
|
||||
);
|
||||
}
|
||||
|
||||
$management_allowed = !is_central_policies_on_node();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
please manage this feature from centralized manager console (Metaconsole).'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -564,9 +578,53 @@ if (($create != '') or ($view != '')) {
|
|||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
$management_allowed = is_management_allowed();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(__('To manage plugin you must activate centralized management'));
|
||||
}
|
||||
|
||||
if (!$config['metaconsole_deploy_plugin_server'] && $management_allowed) {
|
||||
$deploy_plugin_server = true;
|
||||
|
||||
echo '<div id="deploy_messages" style="display: none">';
|
||||
echo '<span>'.__('The previous configuration of plugins has been imported from the nodes. Please check that the definitions are correct.').'</br></br>'.'<b>'.__('Note:').'</b>'.__(
|
||||
'These definitions will not be operational until you manually
|
||||
copy the files from the nodes to the atachment/plugin/ directory of the meta console.'
|
||||
).'</br></br>'.__('You can find more information at:')."<a href='https://wiki.pandorafms.com'>https://wiki.pandorafms.com</a>".'</span>';
|
||||
echo '</div>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#deploy_messages").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
title: '<?php echo __('Warning'); ?>',
|
||||
width: 528,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
config_update_value('metaconsole_deploy_plugin_server', 1);
|
||||
}
|
||||
} else {
|
||||
ui_print_page_header(__('Plug-ins registered on %s', get_product_name()), 'images/gm_servers.png', false, '', true);
|
||||
|
||||
$management_allowed = !is_central_policies_on_node();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
please manage this feature from centralized manager console (Metaconsole).'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
||||
if ($is_windows) {
|
||||
echo '<div class="notify">';
|
||||
|
@ -576,9 +634,8 @@ if (($create != '') or ($view != '')) {
|
|||
}
|
||||
|
||||
|
||||
// Update plugin
|
||||
// Update plugin.
|
||||
if (isset($_GET['update_plugin'])) {
|
||||
// if modified any parameter
|
||||
$plugin_id = get_parameter('update_plugin', 0);
|
||||
$plugin_name = get_parameter('form_name', '');
|
||||
$plugin_description = get_parameter('form_description', '');
|
||||
|
@ -709,12 +766,15 @@ if (($create != '') or ($view != '')) {
|
|||
|
||||
$result = db_process_sql_delete('tplugin', ['id' => $plugin_id]);
|
||||
|
||||
if (! $result) {
|
||||
ui_print_error_message(__('Problem deleting plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
if (!is_metaconsole()) {
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deleting plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($plugin_id != 0) {
|
||||
// Delete all the modules with this plugin
|
||||
$plugin_modules = db_get_all_rows_filter(
|
||||
|
@ -737,6 +797,153 @@ if (($create != '') or ($view != '')) {
|
|||
policies_change_delete_pending_module($policies_id['id']);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_plugins.php');
|
||||
$result = plugins_delete_plugin($plugin_id);
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deleting plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deploy_plugin) {
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_plugins.php');
|
||||
$result = plugins_deploy_plugin($deploy_plugin);
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deploying plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deployed successfully'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deploy_plugin_server) {
|
||||
$setup = db_get_all_rows_in_table('tmetaconsole_setup');
|
||||
// recorremos todos los nodos.
|
||||
foreach ($setup as $key => $value) {
|
||||
// Obtenemos los plugins de la meta.
|
||||
$all_plugin_meta = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
// Conectamos con el nodo.
|
||||
if (metaconsole_connect($value) == NOERR) {
|
||||
$values = [];
|
||||
// Obtenemos los plugin del nodo.
|
||||
$node_plugin_server = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
foreach ($node_plugin_server as $key2 => $plugin) {
|
||||
// Comprobamos si el id esta meta y nodo al mismo tiempo.
|
||||
$key_exists = array_search($plugin['id'], array_column($all_plugin_meta, 'id'));
|
||||
if ($key_exists !== false) {
|
||||
// Si el plugin tiene el mismo id pero diferentes datos.
|
||||
if ($all_plugin_meta[$key_exists] != $plugin) {
|
||||
$old_id = $plugin['id'];
|
||||
$new_id = ($plugin['id'] + (1000 * $value['id']));
|
||||
|
||||
// El plugin del nodo pasa a tener otro id y otro nombre.
|
||||
$plugin['id'] = $new_id;
|
||||
$plugin['name'] = $plugin['name'].'_'.$value['server_name'];
|
||||
$result_update = db_process_sql_update(
|
||||
'tplugin',
|
||||
[
|
||||
'id' => $new_id,
|
||||
'name' => $plugin['name'],
|
||||
],
|
||||
['id' => $old_id]
|
||||
);
|
||||
|
||||
if ($result_update) {
|
||||
db_process_sql_update(
|
||||
'tagente_modulo',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
|
||||
db_process_sql_update(
|
||||
'tnetwork_component',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
|
||||
db_process_sql_update(
|
||||
'tpolicy_modules',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
}
|
||||
|
||||
// New plugins to insert in the metaconsole.
|
||||
$values[$plugin['id']] = $plugin;
|
||||
}
|
||||
} else {
|
||||
// Exists in the node, but does not exist in the metaconsole.
|
||||
$values[$plugin['id']] = $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore to metaconsole.
|
||||
metaconsole_restore_db();
|
||||
|
||||
// Insert in metaconsole.
|
||||
if (!empty($values)) {
|
||||
foreach ($values as $key2 => $val) {
|
||||
// Insert into metaconsole.
|
||||
$result_insert = db_process_sql_insert('tplugin', $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$all_plugin_meta = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
|
||||
foreach ($setup as $key => $value) {
|
||||
if (metaconsole_connect($value) == NOERR) {
|
||||
$all_plugin_node = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
|
||||
$array_diff = array_diff(array_column($all_plugin_meta, 'id'), array_column($all_plugin_node, 'id'));
|
||||
foreach ($array_diff as $key2 => $pluginid) {
|
||||
$other = [];
|
||||
$plugin_meta = $all_plugin_meta[$key2];
|
||||
|
||||
unset($plugin_meta['id']);
|
||||
$other['name'] = urlencode($plugin_meta['name']);
|
||||
$other['description'] = urlencode($plugin_meta['description']);
|
||||
$other['max_timeout'] = $plugin_meta['max_timeout'];
|
||||
$other['max_retries'] = $plugin_meta['max_retries'];
|
||||
$other['execute'] = urlencode($plugin_meta['execute']);
|
||||
$other['net_dst_opt'] = $plugin_meta['net_dst_opt'];
|
||||
$other['net_port_opt'] = $plugin_meta['net_port_opt'];
|
||||
$other['user_opt'] = $plugin_meta['user_opt'];
|
||||
$other['pass_opt'] = $plugin_meta['pass_opt'];
|
||||
$other['plugin_type'] = $plugin_meta['plugin_type'];
|
||||
$other['macros'] = urlencode($plugin_meta['macros']);
|
||||
$other['parameters'] = urlencode($plugin_meta['parameters']);
|
||||
$other = implode('%7C', $other);
|
||||
|
||||
$auth_token = json_decode($value['auth_token']);
|
||||
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7C&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
|
||||
$file_path = realpath($plugin_meta['execute']);
|
||||
$post = '';
|
||||
if (file_exists($file_path)) {
|
||||
$post = ['file' => curl_file_create($file_path)];
|
||||
}
|
||||
|
||||
$curlObj = curl_init();
|
||||
curl_setopt($curlObj, CURLOPT_URL, $url);
|
||||
curl_setopt($curlObj, CURLOPT_POST, 1);
|
||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $post);
|
||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
||||
$api_result = curl_exec($curlObj);
|
||||
curl_close($curlObj);
|
||||
}
|
||||
}
|
||||
|
||||
// restore to metaconsole
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -753,7 +960,10 @@ if (($create != '') or ($view != '')) {
|
|||
echo '<th>'.__('Name').'</th>';
|
||||
echo '<th>'.__('Type').'</th>';
|
||||
echo '<th>'.__('Command').'</th>';
|
||||
echo "<th style='width: 90px;'>".'<span title="Operations">'.__('Op.').'</span>'.'</th>';
|
||||
if ($management_allowed) {
|
||||
echo "<th style='width: 120px;'>".'<span title="Operations">'.__('Op.').'</span>'.'</th>';
|
||||
}
|
||||
|
||||
$color = 0;
|
||||
|
||||
foreach ($rows as $row) {
|
||||
|
@ -767,7 +977,10 @@ if (($create != '') or ($view != '')) {
|
|||
|
||||
echo '<tr>';
|
||||
echo "<td class=$tdcolor>";
|
||||
echo "<b><a href='index.php?sec=$sec&sec2=godmode/servers/plugin&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>";
|
||||
if ($management_allowed) {
|
||||
echo "<b><a href='index.php?sec=$sec&sec2=godmode/servers/plugin&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>";
|
||||
}
|
||||
|
||||
echo $row['name'];
|
||||
echo '</a></b></td>';
|
||||
echo "<td class=$tdcolor>";
|
||||
|
@ -780,31 +993,38 @@ if (($create != '') or ($view != '')) {
|
|||
echo "</td><td class=$tdcolor>";
|
||||
echo $row['execute'];
|
||||
echo '</td>';
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
if ($management_allowed) {
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
|
||||
// Show it is locket
|
||||
$modules_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tagente_modulo',
|
||||
[
|
||||
'delete_pending' => 0,
|
||||
'id_plugin' => $row['id'],
|
||||
]
|
||||
);
|
||||
$components_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tnetwork_component',
|
||||
['id_plugin' => $row['id']]
|
||||
);
|
||||
if (($components_using_plugin + $modules_using_plugin) > 0) {
|
||||
echo '<a href="javascript: show_locked_dialog('.$row['id'].', \''.$row['name'].'\');">';
|
||||
html_print_image('images/lock.png');
|
||||
echo '</a>';
|
||||
// Show it is locket
|
||||
$modules_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tagente_modulo',
|
||||
[
|
||||
'delete_pending' => 0,
|
||||
'id_plugin' => $row['id'],
|
||||
]
|
||||
);
|
||||
$components_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tnetwork_component',
|
||||
['id_plugin' => $row['id']]
|
||||
);
|
||||
if (($components_using_plugin + $modules_using_plugin) > 0) {
|
||||
echo '<a href="javascript: show_locked_dialog('.$row['id'].', \''.$row['name'].'\');">';
|
||||
html_print_image('images/lock.png');
|
||||
echo '</a>';
|
||||
}
|
||||
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a> ';
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&kill_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."' onclick='javascript: if (!confirm(\"".__('All the modules that are using this plugin will be deleted').'. '.__('Are you sure?')."\")) return false;'>".html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
if (is_metaconsole()) {
|
||||
echo " <a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&deploy_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image('images/deploy.png', true, ['title' => __('Deploy'), 'width' => '21 px']).'</a> ';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a> ';
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&kill_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."' onclick='javascript: if (!confirm(\"".__('All the modules that are using this plugin will be deleted').'. '.__('Are you sure?')."\")) return false;'>".html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
|
@ -813,12 +1033,15 @@ if (($create != '') or ($view != '')) {
|
|||
ui_print_info_message(['no_close' => true, 'message' => __('There are no plugins in the system') ]);
|
||||
}
|
||||
|
||||
echo "<table width='100%'>";
|
||||
if ($management_allowed) {
|
||||
echo "<table width='100%'>";
|
||||
|
||||
echo '<tr><td align=right>';
|
||||
echo "<form name=plugin method='post' action='index.php?sec=gservers&sec2=godmode/servers/plugin&tab=$tab&create=1&pure=".$config['pure']."'>";
|
||||
echo "<input name='crtbutton' type='submit' class='sub next' value='".__('Add')."'>";
|
||||
echo '</td></tr></table>';
|
||||
echo '<tr><td align=right>';
|
||||
echo "<form name=plugin method='post' action='index.php?sec=gservers&sec2=godmode/servers/plugin&tab=$tab&create=1&pure=".$config['pure']."'>";
|
||||
echo "<input name='crtbutton' type='submit' class='sub next' value='".__('Add')."'>";
|
||||
echo '</td></tr></table>';
|
||||
echo '<div id="deploy_messages" style="display: none">';
|
||||
}
|
||||
|
||||
// The '%s' will be replaced in the javascript code of the function 'show_locked_dialog'
|
||||
echo "<div id='dialog_locked' title='".__('List of modules and components created by "%s" ')."' style='display: none; text-align: left;'>";
|
||||
|
@ -828,7 +1051,6 @@ if (($create != '') or ($view != '')) {
|
|||
}
|
||||
|
||||
ui_require_javascript_file('pandora_modules');
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -524,6 +524,18 @@ if ($config['history_db_enabled'] == 1) {
|
|||
);
|
||||
}
|
||||
|
||||
$table->data[] = [
|
||||
__('Max. days before delete old messages'),
|
||||
html_print_input_text(
|
||||
'delete_old_messages',
|
||||
$config['delete_old_messages'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
),
|
||||
];
|
||||
|
||||
$table_other = new stdClass();
|
||||
$table_other->width = '100%';
|
||||
$table_other->class = 'databox filters';
|
||||
|
@ -582,7 +594,7 @@ $table_other->data[3][1] = html_print_input_text(
|
|||
);
|
||||
|
||||
$table_other->data[5][0] = __('Use realtime statistics');
|
||||
$table_other->data[5][1] = html_print_checkbox_toogle_switch(
|
||||
$table_other->data[5][1] = html_print_checkbox_switch(
|
||||
'realtimestats',
|
||||
1,
|
||||
$config['realtimestats'],
|
||||
|
@ -604,7 +616,7 @@ $table_other->data[6][1] = html_print_input_text(
|
|||
);
|
||||
|
||||
$table_other->data[7][0] = __('Use agent access graph').ui_print_help_icon('agent_access', true);
|
||||
$table_other->data[7][1] = html_print_checkbox_toogle_switch('agentaccess', 1, $config['agentaccess'], true);
|
||||
$table_other->data[7][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true);
|
||||
|
||||
$table_other->data[8][0] = __('Max. recommended number of files in attachment directory');
|
||||
$table_other->data[8][0] .= ui_print_help_tip(
|
||||
|
@ -621,7 +633,7 @@ $table_other->data[8][1] = html_print_input_text(
|
|||
);
|
||||
|
||||
$table_other->data[9][0] = __('Delete not init modules');
|
||||
$table_other->data[9][1] = html_print_checkbox_toogle_switch('delete_notinit', 1, $config['delete_notinit'], true);
|
||||
$table_other->data[9][1] = html_print_checkbox_switch('delete_notinit', 1, $config['delete_notinit'], true);
|
||||
|
||||
$table_other->data[10][0] = __('Big Operation Step to purge old data');
|
||||
$table_other->data[10][0] .= ui_print_help_tip(
|
||||
|
|
|
@ -122,6 +122,12 @@ $buttons['ehorus'] = [
|
|||
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup§ion=ehorus">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>',
|
||||
];
|
||||
|
||||
// FIXME: Not definitive icon
|
||||
$buttons['notifications'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup§ion=notifications">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>',
|
||||
];
|
||||
|
||||
$help_header = '';
|
||||
if (enterprise_installed()) {
|
||||
$subpage = setup_enterprise_add_subsection_main($section, $buttons, $help_header);
|
||||
|
@ -159,6 +165,11 @@ switch ($section) {
|
|||
$buttons['ehorus']['active'] = true;
|
||||
$subpage = ' » '.__('eHorus');
|
||||
break;
|
||||
|
||||
case 'notifications':
|
||||
$buttons['notifications']['active'] = true;
|
||||
$subpage = ' » '.__('Notifications');
|
||||
break;
|
||||
}
|
||||
|
||||
// Header.
|
||||
|
@ -199,6 +210,10 @@ switch ($section) {
|
|||
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
|
||||
break;
|
||||
|
||||
case 'notifications':
|
||||
include_once $config['homedir'].'/godmode/setup/setup_notifications.php';
|
||||
break;
|
||||
|
||||
default:
|
||||
enterprise_hook('setup_enterprise_select_tab', [$section]);
|
||||
break;
|
||||
|
|
|
@ -43,15 +43,15 @@ if (is_ajax()) {
|
|||
if ($type_auth != 'mysql') {
|
||||
// Fallback to local authentication
|
||||
$row = [];
|
||||
$row['name'] = __('Fallback to local authentication').ui_print_help_tip(__('Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed.'), true);
|
||||
$row['control'] = html_print_checkbox_toogle_switch('fallback_local_auth', 1, $config['fallback_local_auth'], true);
|
||||
$row['name'] = __('Fallback to local authentication').ui_print_help_tip(__('Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed. Only available when \'Save password\' is enabled.'), true);
|
||||
$row['control'] = html_print_checkbox_switch('fallback_local_auth', 1, $config['fallback_local_auth'], true);
|
||||
$table->data['fallback_local_auth'] = $row;
|
||||
|
||||
if (enterprise_installed()) {
|
||||
// Autocreate remote users
|
||||
$row = [];
|
||||
$row['name'] = __('Autocreate remote users');
|
||||
$row['control'] = html_print_checkbox_toogle_switch_extended('autocreate_remote_users', 1, $config['autocreate_remote_users'], false, '', '', true).' ';
|
||||
$row['control'] = html_print_checkbox_switch_extended('autocreate_remote_users', 1, $config['autocreate_remote_users'], false, '', '', true).' ';
|
||||
$table->data['autocreate_remote_users'] = $row;
|
||||
|
||||
add_enterprise_auth_autocreate_profiles($table, $type_auth);
|
||||
|
@ -89,7 +89,7 @@ if (is_ajax()) {
|
|||
// Start TLS
|
||||
$row = [];
|
||||
$row['name'] = __('Start TLS');
|
||||
$row['control'] = html_print_checkbox_toogle_switch('ldap_start_tls', 1, $config['ldap_start_tls'], true);
|
||||
$row['control'] = html_print_checkbox_switch('ldap_start_tls', 1, $config['ldap_start_tls'], true);
|
||||
$table->data['ldap_start_tls'] = $row;
|
||||
|
||||
// Base DN
|
||||
|
@ -134,8 +134,7 @@ if (is_ajax()) {
|
|||
set_unless_defined($config['double_auth_enabled'], false);
|
||||
$row = [];
|
||||
$row['name'] = __('Double authentication').ui_print_help_tip(__('If this option is enabled, the users can use double authentication with their accounts'), true);
|
||||
$row['control'] = html_print_input_hidden('double_auth_enabled', 0);
|
||||
$row['control'] .= html_print_checkbox_toogle_switch('double_auth_enabled', 1, $config['double_auth_enabled'], true);
|
||||
$row['control'] .= html_print_checkbox_switch('double_auth_enabled', 1, $config['double_auth_enabled'], true);
|
||||
$table->data['double_auth_enabled'] = $row;
|
||||
|
||||
// Session timeout
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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-2010 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.
|
||||
// Warning: This file may be required into the metaconsole's setup
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -23,7 +28,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
|
|||
return;
|
||||
}
|
||||
|
||||
// Check custom field
|
||||
// Check custom field.
|
||||
$custom_field = db_get_value('name', 'tagent_custom_fields', 'name', $config['ehorus_custom_field']);
|
||||
$custom_field_exists = !empty($custom_field);
|
||||
$custom_field_created = null;
|
||||
|
@ -36,7 +41,7 @@ if ($config['ehorus_enabled'] && !$custom_field_exists) {
|
|||
$custom_field_exists = $custom_field_created = $result;
|
||||
}
|
||||
|
||||
// Enable table
|
||||
// Enable table.
|
||||
$table_enable = new StdClass();
|
||||
$table_enable->data = [];
|
||||
$table_enable->width = '100%';
|
||||
|
@ -45,15 +50,13 @@ $table_enable->class = 'databox filters';
|
|||
$table_enable->size['name'] = '30%';
|
||||
$table_enable->style['name'] = 'font-weight: bold';
|
||||
|
||||
// Enable eHorus
|
||||
// Enable eHorus.
|
||||
$row = [];
|
||||
$row['name'] = __('Enable eHorus');
|
||||
$row['control'] = __('Enabled').' '.html_print_radio_button('ehorus_enabled', 1, '', $config['ehorus_enabled'], true).' ';
|
||||
$row['control'] .= __('Disabled').' '.html_print_radio_button('ehorus_enabled', 0, '', $config['ehorus_enabled'], true);
|
||||
$row['button'] = html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"', true);
|
||||
$row['control'] = html_print_checkbox_switch('ehorus_enabled', 1, $config['ehorus_enabled'], true);
|
||||
$table_enable->data['ehorus_enabled'] = $row;
|
||||
|
||||
// Remote config table
|
||||
// Remote config table.
|
||||
$table_remote = new StdClass();
|
||||
$table_remote->data = [];
|
||||
$table_remote->width = '100%';
|
||||
|
@ -63,40 +66,40 @@ $table_remote->class = 'databox filters';
|
|||
$table_remote->size['name'] = '30%';
|
||||
$table_remote->style['name'] = 'font-weight: bold';
|
||||
|
||||
// User
|
||||
// User.
|
||||
$row = [];
|
||||
$row['name'] = __('User');
|
||||
$row['control'] = html_print_input_text('ehorus_user', $config['ehorus_user'], '', 30, 100, true);
|
||||
$table_remote->data['ehorus_user'] = $row;
|
||||
|
||||
// Pass
|
||||
// Pass.
|
||||
$row = [];
|
||||
$row['name'] = __('Password');
|
||||
$row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true);
|
||||
$table_remote->data['ehorus_pass'] = $row;
|
||||
|
||||
// Directory hostname
|
||||
// Directory hostname.
|
||||
$row = [];
|
||||
$row['name'] = __('API Hostname');
|
||||
$row['control'] = html_print_input_text('ehorus_hostname', $config['ehorus_hostname'], '', 30, 100, true);
|
||||
$row['control'] .= ui_print_help_tip(__('Hostname of the eHorus API').'. '.__('Without protocol and port').'. '.__('e.g., portal.ehorus.com'), true);
|
||||
$table_remote->data['ehorus_hostname'] = $row;
|
||||
|
||||
// Directory port
|
||||
// Directory port.
|
||||
$row = [];
|
||||
$row['name'] = __('API Port');
|
||||
$row['control'] = html_print_input_text('ehorus_port', $config['ehorus_port'], '', 6, 100, true);
|
||||
$row['control'] .= ui_print_help_tip(__('e.g., 18080'), true);
|
||||
$table_remote->data['ehorus_port'] = $row;
|
||||
|
||||
// Request timeout
|
||||
// Request timeout.
|
||||
$row = [];
|
||||
$row['name'] = __('Request timeout');
|
||||
$row['control'] = html_print_input_text('ehorus_req_timeout', $config['ehorus_req_timeout'], '', 3, 10, true);
|
||||
$row['control'] .= ui_print_help_tip(__('Time in seconds to set the maximum time of the requests to the eHorus API').'. '.__('0 to disable'), true);
|
||||
$table_remote->data['ehorus_req_timeout'] = $row;
|
||||
|
||||
// Test
|
||||
// Test.
|
||||
$row = [];
|
||||
$row['name'] = __('Test');
|
||||
$row['control'] = html_print_button(__('Start'), 'test-ehorus', false, '', 'class="sub next"', true);
|
||||
|
@ -106,7 +109,7 @@ $row['control'] .= '<span id="test-ehorus-failure" style="display:none;"> '
|
|||
$row['control'] .= ' <span id="test-ehorus-message" style="display:none;"></span>';
|
||||
$table_remote->data['ehorus_test'] = $row;
|
||||
|
||||
// Print
|
||||
// Print.
|
||||
echo '<div style="text-align: center; padding-bottom: 20px;">';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">';
|
||||
html_print_image('include/ehorus/images/ehorus-logo-grey.png');
|
||||
|
@ -136,13 +139,13 @@ if ($config['ehorus_enabled'] && !$custom_field_exists) {
|
|||
ui_print_error_message($error_message);
|
||||
}
|
||||
|
||||
// Form enable
|
||||
// Form enable.
|
||||
echo '<form id="form_enable" method="post">';
|
||||
html_print_input_hidden('update_config', 1);
|
||||
html_print_table($table_enable);
|
||||
echo '</form>';
|
||||
|
||||
// Form remote
|
||||
// Form remote.
|
||||
if ($config['ehorus_enabled']) {
|
||||
echo '<form id="form_remote" method="post">';
|
||||
echo '<fieldset>';
|
||||
|
@ -159,6 +162,9 @@ if ($config['ehorus_enabled']) {
|
|||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('input:checkbox[name="ehorus_enabled"]').attr('checked', false);
|
||||
$('form#form_remote').hide();
|
||||
$('form#form_enable').css('margin-bottom','20px');
|
||||
var showFields = function () {
|
||||
$('form#form_remote').show();
|
||||
}
|
||||
|
@ -166,10 +172,17 @@ if ($config['ehorus_enabled']) {
|
|||
$('form#form_remote').hide();
|
||||
}
|
||||
var handleEnable = function (event) {
|
||||
if (event.target.value == '1') showFields();
|
||||
else hideFields();
|
||||
var is_checked = $('input:checkbox[name="ehorus_enabled"]').is(':checked');
|
||||
if (event.target.value == '1' && is_checked) {
|
||||
showFields();
|
||||
$('input:checkbox[name="ehorus_enabled"]').attr('checked', false);
|
||||
}
|
||||
else {
|
||||
hideFields();
|
||||
$('input:checkbox[name="ehorus_enabled"]').attr('checked', true);
|
||||
};
|
||||
}
|
||||
$('input:radio[name="ehorus_enabled"]').change(handleEnable);
|
||||
$('input:checkbox[name="ehorus_enabled"]').change(handleEnable);
|
||||
|
||||
var handleTest = function (event) {
|
||||
var user = $('input#text-ehorus_user').val();
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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-2011 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.
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -82,17 +88,17 @@ $sources['sql'] = __('Database');
|
|||
$table->data[9][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
|
||||
|
||||
$table->data[10][0] = __('Automatic check for updates');
|
||||
$table->data[10][1] = html_print_checkbox_toogle_switch('autoupdate', 1, $config['autoupdate'], true);
|
||||
$table->data[10][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
|
||||
|
||||
echo "<div id='dialog' title='".__('Enforce https Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
$table->data[11][0] = __('Enforce https');
|
||||
$table->data[11][1] = html_print_checkbox_toogle_switch_extended('https', 1, $config['https'], false, '', '', true);
|
||||
$table->data[11][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
|
||||
|
||||
$table->data[12][0] = __('Use cert of SSL');
|
||||
$table->data[12][1] = html_print_checkbox_toogle_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
|
||||
$table->data[12][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
|
||||
|
||||
$table->rowstyle[13] = 'display: none;';
|
||||
$table->data[13][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true);
|
||||
|
@ -114,7 +120,7 @@ $table->data[16][0] = __('API password').ui_print_help_tip(__('Please be careful
|
|||
$table->data[16][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
|
||||
|
||||
$table->data[17][0] = __('Enable GIS features');
|
||||
$table->data[17][1] = html_print_checkbox_toogle_switch('activate_gis', 1, $config['activate_gis'], true);
|
||||
$table->data[17][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
|
||||
|
||||
$table->data[19][0] = __('Enable Netflow');
|
||||
$rbt_disabled = false;
|
||||
|
@ -123,7 +129,7 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
|||
$table->data[19][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true);
|
||||
}
|
||||
|
||||
$table->data[19][1] = html_print_checkbox_toogle_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
|
||||
$table->data[19][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
|
||||
|
||||
|
||||
$zone_name = [
|
||||
|
@ -202,15 +208,15 @@ $table->data[28][1] = html_print_input_text('public_url', $config['public_url'],
|
|||
|
||||
$table->data[29][0] = __('Referer security');
|
||||
$table->data[29][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true);
|
||||
$table->data[29][1] = html_print_checkbox_toogle_switch('referer_security', 1, $config['referer_security'], true);
|
||||
$table->data[29][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
|
||||
|
||||
$table->data[30][0] = __('Event storm protection');
|
||||
$table->data[30][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true);
|
||||
$table->data[30][1] = html_print_checkbox_toogle_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
|
||||
$table->data[30][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
|
||||
|
||||
|
||||
$table->data[31][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true);
|
||||
$table->data[31][1] = html_print_checkbox_toogle_switch('command_snapshot', 1, $config['command_snapshot'], true);
|
||||
$table->data[31][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
|
||||
|
||||
$table->data[32][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true);
|
||||
$table->data[32][1] = html_print_input_text(
|
||||
|
@ -250,7 +256,7 @@ $table->data['tutorial_mode'][1] = html_print_select(
|
|||
|
||||
$config['past_planned_downtimes'] = isset($config['past_planned_downtimes']) ? $config['past_planned_downtimes'] : 1;
|
||||
$table->data[34][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
|
||||
$table->data[34][1] = html_print_checkbox_toogle_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
|
||||
$table->data[34][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
|
||||
|
||||
$table->data[35][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true);
|
||||
$table->data[35][1] = html_print_input_text(
|
||||
|
@ -263,18 +269,16 @@ $table->data[35][1] = html_print_input_text(
|
|||
);
|
||||
|
||||
$table->data[36][0] = __('Include agents manually disabled');
|
||||
$table->data[36][1] = html_print_checkbox_toogle_switch('include_agents', 1, $config['include_agents'], true);
|
||||
$table->data[36][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
|
||||
|
||||
$table->data[37][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true);
|
||||
$table->data[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
|
||||
|
||||
$table->data[38][0] = __('Set alias as name by default in agent creation');
|
||||
$table->data[38][1] = __('Yes').' '.html_print_radio_button('alias_as_name', 1, '', $config['alias_as_name'], true).' ';
|
||||
$table->data[38][1] .= __('No').' '.html_print_radio_button('alias_as_name', 0, '', $config['alias_as_name'], true);
|
||||
$table->data[38][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
|
||||
|
||||
$table->data[39][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true);
|
||||
$table->data[39][1] = __('Yes').' '.html_print_radio_button('unique_ip', 1, '', $config['unique_ip'], true).' ';
|
||||
$table->data[39][1] .= __('No').' '.html_print_radio_button('unique_ip', 0, '', $config['unique_ip'], true);
|
||||
$table->data[39][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
|
||||
|
||||
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">';
|
||||
|
||||
|
@ -339,9 +343,9 @@ $(document).ready (function () {
|
|||
$("#timezone").attr("hidden", false);
|
||||
});
|
||||
|
||||
if ($("input[name=use_cert]").is(':checked')) {
|
||||
$('#setup_general-13').show();
|
||||
}
|
||||
if ($("input[name=use_cert]").is(':checked')) {
|
||||
$('#setup_general-13').show();
|
||||
}
|
||||
|
||||
$("input[name=use_cert]").change(function () {
|
||||
if( $(this).is(":checked") )
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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-2011 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.
|
||||
global $config;
|
||||
|
||||
require_once 'include/functions_ui.php';
|
||||
|
@ -55,21 +62,19 @@ $table->data[5][0] = '<b>'.__('Maximum chart resolution').'</b>'.ui_print_help_t
|
|||
$table->data[5][1] = html_print_input_text('netflow_max_resolution', $config['netflow_max_resolution'], false, 50, 200, true);
|
||||
|
||||
$table->data[6][0] = '<b>'.__('Disable custom live view filters').'</b>'.ui_print_help_tip(__('Disable the definition of custom filters in the live view. Only existing filters can be used.'), true);
|
||||
$table->data[6][1] = __('Yes').' '.html_print_radio_button('netflow_disable_custom_lvfilters', 1, '', $config['netflow_disable_custom_lvfilters'], true).' ';
|
||||
$table->data[6][1] .= __('No').' '.html_print_radio_button('netflow_disable_custom_lvfilters', 0, '', $config['netflow_disable_custom_lvfilters'], true);
|
||||
$table->data[6][1] = html_print_checkbox_switch('netflow_disable_custom_lvfilters', 1, $config['netflow_disable_custom_lvfilters'], true);
|
||||
$table->data[7][0] = '<b>'.__('Netflow max lifetime').'</b>'.ui_print_help_tip(__('Sets the maximum lifetime for netflow data in days.'), true);
|
||||
$table->data[7][1] = html_print_input_text('netflow_max_lifetime', $config['netflow_max_lifetime'], false, 50, 200, true);
|
||||
|
||||
$table->data[8][0] = '<b>'.__('Name resolution for IP address').'</b>'.ui_print_help_tip(__('Resolve the IP addresses to get their hostnames.'), true);
|
||||
$onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;";
|
||||
$table->data[8][1] = __('Yes').' '.html_print_radio_button_extended('netflow_get_ip_hostname', 1, '', $config['netflow_get_ip_hostname'], false, $onclick, '', true).' ';
|
||||
$table->data[8][1] .= __('No').' '.html_print_radio_button('netflow_get_ip_hostname', 0, '', $config['netflow_get_ip_hostname'], true);
|
||||
$table->data[8][1] = html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true);
|
||||
|
||||
echo '<form id="netflow_setup" method="post">';
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
// Update button
|
||||
// Update button.
|
||||
echo '<div class="action-buttons" style="width:100%;">';
|
||||
html_print_input_hidden('update_config', 1);
|
||||
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"');
|
||||
|
|
|
@ -0,0 +1,413 @@
|
|||
<?php
|
||||
/**
|
||||
* Library. Notification system auxiliary functions.
|
||||
*
|
||||
* @category UI file
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_notifications.php';
|
||||
|
||||
check_login();
|
||||
|
||||
// AJAX actions.
|
||||
$source = get_parameter('source', '');
|
||||
$users = get_parameter('users', '');
|
||||
$elements = get_parameter('elements', []);
|
||||
$is_users = $users === 'users';
|
||||
if (get_parameter('get_selection_two_ways_form', 0)) {
|
||||
$info_selec = ($is_users === true) ? notifications_get_user_source_not_configured($source) : notifications_get_group_source_not_configured($source);
|
||||
|
||||
echo notifications_print_two_ways_select(
|
||||
$info_selec,
|
||||
$users,
|
||||
$source
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('add_source_to_database', 0)) {
|
||||
$res = ($is_users) ? notifications_add_users_to_source($source, $elements) : notifications_add_group_to_source($source, $elements);
|
||||
$result = ['result' => $res];
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('remove_source_on_database', 0)) {
|
||||
$res = ($is_users) ? notifications_remove_users_from_source($source, $elements) : notifications_remove_group_from_source($source, $elements);
|
||||
$result = ['result' => $res];
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('update_config', 0)) {
|
||||
$element = (string) get_parameter('element', '');
|
||||
$value = (int) get_parameter('value', 0);
|
||||
|
||||
// Update the label value.
|
||||
ob_clean();
|
||||
$res = false;
|
||||
switch ($element) {
|
||||
// All users has other action.
|
||||
case 'all_users':
|
||||
$res = ($value) ? notifications_add_group_to_source($source, [0]) : notifications_remove_group_from_source($source, [0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
$res = (bool) db_process_sql_update(
|
||||
'tnotification_source',
|
||||
[$element => $value],
|
||||
['id' => $source]
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
echo json_encode(['result' => $res]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('check_new_notifications', 0)) {
|
||||
$last_id_ui = (int) get_parameter('last_id', 0);
|
||||
$counters = notifications_get_counters();
|
||||
if ((int) $last_id_ui === (int) $counters['last_id']) {
|
||||
echo json_encode(['has_new_notifications' => false]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (messages_get_count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$messages = messages_get_overview(
|
||||
'timestamp',
|
||||
'ASC',
|
||||
false,
|
||||
true,
|
||||
0,
|
||||
['id_mensaje' => '>'.$last_id_ui]
|
||||
);
|
||||
if ($messages === false) {
|
||||
$messages = [];
|
||||
}
|
||||
|
||||
// If there is new messages, get the info.
|
||||
echo json_encode(
|
||||
[
|
||||
'has_new_notifications' => true,
|
||||
'new_ball' => base64_encode(
|
||||
notifications_print_ball(
|
||||
$counters['notifications'],
|
||||
$counters['last_id']
|
||||
)
|
||||
),
|
||||
'new_notifications' => array_map(
|
||||
function ($elem) {
|
||||
$elem['full_url'] = messages_get_url($elem['id_mensaje']);
|
||||
return $elem;
|
||||
},
|
||||
$messages
|
||||
),
|
||||
]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('mark_notification_as_read', 0)) {
|
||||
$message = (int) get_parameter('message', 0);
|
||||
messages_process_read($message);
|
||||
// TODO check read.
|
||||
$url = messages_get_url($message);
|
||||
// Return false if cannot get the URL.
|
||||
if ($url === false) {
|
||||
echo json_encode(['result' => false]);
|
||||
return;
|
||||
}
|
||||
|
||||
// If there is new messages, get the info.
|
||||
echo json_encode(
|
||||
[
|
||||
'result' => true,
|
||||
'url' => $url,
|
||||
]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('get_notifications_dropdown', 0)) {
|
||||
echo notifications_print_dropdown();
|
||||
return;
|
||||
}
|
||||
|
||||
// Notification table. It is just a wrapper.
|
||||
$table_content = new StdClass();
|
||||
$table_content->data = [];
|
||||
$table_content->width = '100%';
|
||||
$table_content->id = 'notifications-wrapper';
|
||||
$table_content->class = 'databox filters';
|
||||
$table_content->size['name'] = '30%';
|
||||
|
||||
// Print each source configuration.
|
||||
$table_content->data = array_map(
|
||||
function ($source) {
|
||||
return notifications_print_global_source_configuration($source);
|
||||
},
|
||||
notifications_get_all_sources()
|
||||
);
|
||||
|
||||
html_print_table($table_content);
|
||||
|
||||
?>
|
||||
<script>
|
||||
// Get index of two ways element dialog.
|
||||
function notifications_two_ways_element_get_dialog (id, source_id) {
|
||||
return 'global_config_notifications_dialog_add-' + id + '-' + source_id;
|
||||
}
|
||||
|
||||
// Get index of two ways element form.
|
||||
function notifications_two_ways_element_get_sufix (id, source_id) {
|
||||
return 'multi-' + id + '-' + source_id;
|
||||
}
|
||||
|
||||
// Open a dialog with selector of source elements.
|
||||
function add_source_dialog(users, source_id) {
|
||||
// Display the dialog
|
||||
var dialog_id = notifications_two_ways_element_get_dialog(users, source_id);
|
||||
// Clean id element.
|
||||
var previous_dialog = document.getElementById(dialog_id);
|
||||
if (previous_dialog !== null) previous_dialog.remove();
|
||||
// Create or recreate the content.
|
||||
var not_dialog = document.createElement('div');
|
||||
not_dialog.setAttribute(
|
||||
'class',
|
||||
'global_config_notifications_dialog_add_wrapper'
|
||||
);
|
||||
not_dialog.setAttribute('id', dialog_id);
|
||||
document.body.appendChild(not_dialog);
|
||||
$("#" + dialog_id).dialog({
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
dialogClass: "global_config_notifications_dialog_add_full",
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
closeOnEscape: true,
|
||||
modal: true
|
||||
});
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/setup/setup_notifications",
|
||||
"get_selection_two_ways_form" : 1,
|
||||
"users" : users,
|
||||
"source" : source_id
|
||||
},
|
||||
function (data, status) {
|
||||
not_dialog.innerHTML = data
|
||||
},
|
||||
"html"
|
||||
);
|
||||
}
|
||||
|
||||
// Move from selected and not selected source elements.
|
||||
function notifications_modify_two_ways_element (id, source_id, operation) {
|
||||
var index_sufix = notifications_two_ways_element_get_sufix (id, source_id);
|
||||
var start_id = operation === 'add' ? 'all-' : 'selected-';
|
||||
var end_id = operation !== 'add' ? 'all-' : 'selected-';
|
||||
var select = document.getElementById(
|
||||
start_id + index_sufix
|
||||
);
|
||||
var select_end = document.getElementById(
|
||||
end_id + index_sufix
|
||||
);
|
||||
for (var i = select.options.length - 1; i >= 0; i--) {
|
||||
if(select.options[i].selected){
|
||||
select_end.appendChild(select.options[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add elements to database and close dialog
|
||||
function notifications_add_source_element_to_database(id, source_id) {
|
||||
var index = 'selected-' +
|
||||
notifications_two_ways_element_get_sufix (id, source_id);
|
||||
var select = document.getElementById(index);
|
||||
var selected = [];
|
||||
for (var i = select.options.length - 1; i >= 0; i--) {
|
||||
selected.push(select.options[i].value);
|
||||
}
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/setup/setup_notifications",
|
||||
"add_source_to_database" : 1,
|
||||
"users" : id,
|
||||
"source" : source_id,
|
||||
"elements": selected
|
||||
},
|
||||
function (data, status) {
|
||||
if (data.result) {
|
||||
// Append to other element
|
||||
var out_select = document.getElementById(
|
||||
notifications_two_ways_element_get_sufix(id, source_id)
|
||||
);
|
||||
for (var i = select.options.length - 1; i >= 0; i--) {
|
||||
out_select.appendChild(select.options[i]);
|
||||
}
|
||||
// Close the dialog
|
||||
$("#" + notifications_two_ways_element_get_dialog(
|
||||
id,
|
||||
source_id
|
||||
))
|
||||
.dialog("close");
|
||||
} else {
|
||||
console.log("Cannot update element.");
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
// Add elements to database and remove it form main select
|
||||
function remove_source_elements(id, source_id) {
|
||||
var index = notifications_two_ways_element_get_sufix(id, source_id);
|
||||
var select = document.getElementById(index);
|
||||
var selected = [];
|
||||
var selected_index = [];
|
||||
for (var i = select.options.length - 1; i >= 0; i--) {
|
||||
if(select.options[i].selected){
|
||||
selected.push(select.options[i].value);
|
||||
selected_index.push(i);
|
||||
}
|
||||
}
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/setup/setup_notifications",
|
||||
"remove_source_on_database" : 1,
|
||||
"users" : id,
|
||||
"source" : source_id,
|
||||
"elements": selected
|
||||
},
|
||||
function (data, status) {
|
||||
if (data.result) {
|
||||
// Append to other element
|
||||
for (var i = 0; i < selected_index.length; i++) {
|
||||
select.remove(selected_index[i]);
|
||||
}
|
||||
} else {
|
||||
console.log("Cannot delete elements.");
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
function notifications_handle_change_element(event) {
|
||||
event.preventDefault();
|
||||
var match = /nt-([0-9]+)-(.*)/.exec(event.target.id);
|
||||
if (!match) {
|
||||
console.error(
|
||||
"Cannot handle change element. Id not valid: ", event.target.id
|
||||
);
|
||||
return;
|
||||
}
|
||||
var action = {source: match[1], bit: match[2]};
|
||||
var element = document.getElementById(event.target.id);
|
||||
if (element === null) {
|
||||
console.error(
|
||||
"Cannot get element. Id: ", event.target.id
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
var value;
|
||||
switch (action.bit) {
|
||||
case 'enabled':
|
||||
case 'also_mail':
|
||||
case 'user_editable':
|
||||
case 'all_users':
|
||||
value = element.checked ? 1 : 0;
|
||||
break;
|
||||
case 'max_postpone_time':
|
||||
value = element.value;
|
||||
break;
|
||||
default:
|
||||
console.error("Unregonized action", action.bit, '.');
|
||||
return;
|
||||
|
||||
}
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/setup/setup_notifications",
|
||||
"update_config" : 1,
|
||||
"source" : match[1],
|
||||
"element" : match[2],
|
||||
"value": value
|
||||
},
|
||||
function (data, status) {
|
||||
if (!data.result) {
|
||||
console.error("Error changing configuration in database.");
|
||||
} else {
|
||||
switch (action.bit) {
|
||||
case 'enabled':
|
||||
case 'also_mail':
|
||||
case 'user_editable':
|
||||
case 'all_users':
|
||||
element.checked = !element.checked;
|
||||
break;
|
||||
case 'max_postpone_time':
|
||||
value = element.value;
|
||||
break;
|
||||
default:
|
||||
console.error(
|
||||
"Unregonized action (insert on db)", action.bit, '.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
.done(function(m){})
|
||||
.fail(function(xhr, textStatus, errorThrown){
|
||||
console.error(
|
||||
"Cannot change configuration in database. Server error.",
|
||||
xhr.responseText
|
||||
);
|
||||
});
|
||||
}
|
||||
(function(){
|
||||
// Add listener to all componentes marked
|
||||
var all_clickables = document.getElementsByClassName('elem-clickable');
|
||||
for (var i = 0; i < all_clickables.length; i++) {
|
||||
all_clickables[i].addEventListener(
|
||||
'click', notifications_handle_change_element, false
|
||||
);
|
||||
}
|
||||
var all_changes = document.getElementsByClassName('elem-changeable');
|
||||
for (var i = 0; i < all_changes.length; i++) {
|
||||
all_changes[i].addEventListener(
|
||||
'change', notifications_handle_change_element, false
|
||||
);
|
||||
}
|
||||
})();
|
||||
</script>
|
|
@ -751,7 +751,7 @@ if ($create_alert || $update_alert) {
|
|||
|
||||
// echo '<tr><td class="datos"><b>' . __('Alert filters') . ui_print_help_icon("snmp_alert_filters", true) . '</b></td></tr>';
|
||||
// OID
|
||||
echo '<tr id="tr-oid">'.'<td class="datos2">'.__('Enterprise String').ui_print_help_tip (__('Matches substrings. End the string with $ for exact matches.'), true).'</td>'.'<td class="datos2">';
|
||||
echo '<tr id="tr-oid">'.'<td class="datos2">'.__('Enterprise String').ui_print_help_tip(__('Matches substrings. End the string with $ for exact matches.'), true).'</td>'.'<td class="datos2">';
|
||||
html_print_input_text('oid', $oid, '', 50, 255);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
|
|
@ -0,0 +1,591 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to schedule tasks on Pandora FMS Console
|
||||
*
|
||||
* @category Wizard
|
||||
* @package Pandora FMS
|
||||
* @subpackage Host&Devices
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
require_once __DIR__.'/Wizard.main.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_reports.php';
|
||||
require_once $config['homedir'].'/include/functions_cron.php';
|
||||
enterprise_include('include/functions_tasklist.php');
|
||||
|
||||
/**
|
||||
* Defined as wizard to guide user to explore running tasks.
|
||||
*/
|
||||
class DiscoveryTaskList extends Wizard
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param integer $page Start page, by default 0.
|
||||
* @param string $msg Custom default mesage.
|
||||
* @param string $icon Custom icon.
|
||||
* @param string $label Custom label.
|
||||
*
|
||||
* @return class HostDevices
|
||||
*/
|
||||
public function __construct(
|
||||
int $page=0,
|
||||
string $msg='Default message. Not set.',
|
||||
string $icon='images/wizard/tasklist.png',
|
||||
string $label='Task list'
|
||||
) {
|
||||
$this->setBreadcrum([]);
|
||||
|
||||
$this->task = [];
|
||||
$this->msg = $msg;
|
||||
$this->icon = $icon;
|
||||
$this->label = __($label);
|
||||
$this->page = $page;
|
||||
$this->url = ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements run method.
|
||||
*
|
||||
* @param string $message Redirected input.
|
||||
* @param boolean $status Redirected input.
|
||||
*
|
||||
* @return mixed Returns null if wizard is ongoing. Result if done.
|
||||
*/
|
||||
public function run($message='', $status=null)
|
||||
{
|
||||
global $config;
|
||||
// Load styles.
|
||||
parent::run();
|
||||
|
||||
$this->prepareBreadcrum(
|
||||
[
|
||||
[
|
||||
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery',
|
||||
'label' => 'Discovery',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->printHeader();
|
||||
|
||||
// Show redirected messages from discovery.php.
|
||||
if ($status === 0) {
|
||||
ui_print_success_message($message);
|
||||
} else if ($status !== null) {
|
||||
ui_print_error_message($message);
|
||||
}
|
||||
|
||||
$force_run = (bool) get_parameter('force_run');
|
||||
if ($force_run === true) {
|
||||
return $this->forceConsoleTask();
|
||||
}
|
||||
|
||||
$delete_console_task = (bool) get_parameter('delete_console_task');
|
||||
if ($delete_console_task === true) {
|
||||
return $this->deleteConsoleTask();
|
||||
}
|
||||
|
||||
$delete = (bool) get_parameter('delete', false);
|
||||
if ($delete === true) {
|
||||
return $this->deleteTask();
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
// This check only applies to enterprise users.
|
||||
enterprise_hook('tasklist_checkrunning');
|
||||
|
||||
$ret = $this->showListConsoleTask();
|
||||
} else {
|
||||
$ret = false;
|
||||
}
|
||||
|
||||
$ret2 = $this->showList();
|
||||
|
||||
if ($ret === false && $ret2 === false) {
|
||||
include_once $config['homedir'].'/general/firts_task/recon_view.php';
|
||||
} else {
|
||||
$form = [
|
||||
'form' => [
|
||||
'method' => 'POST',
|
||||
'action' => ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery'
|
||||
),
|
||||
],
|
||||
'inputs' => [
|
||||
[
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => __('Go back'),
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub cancel"',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$this->printForm($form);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements load method.
|
||||
*
|
||||
* @return mixed Skeleton for button.
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
return [
|
||||
'icon' => $this->icon,
|
||||
'label' => $this->label,
|
||||
'url' => $this->url,
|
||||
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a recon task.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteTask()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$task = get_parameter('task', null);
|
||||
|
||||
if ($task !== null) {
|
||||
$result = db_process_sql_delete(
|
||||
'trecon_task',
|
||||
['id_rt' => $task]
|
||||
);
|
||||
|
||||
if ($result == 1) {
|
||||
return [
|
||||
'result' => 0,
|
||||
'msg' => __('Task successfully deleted'),
|
||||
'id' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// Trick to avoid double execution.
|
||||
header('Location: '.$this->url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Force console task.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function forceConsoleTask()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$id_console_task = (int) get_parameter('id_console_task');
|
||||
|
||||
if ($id_console_task !== null) {
|
||||
enterprise_include('cron_task_run', $id_console_task, true);
|
||||
// Trick to avoid double execution.
|
||||
header('Location: '.$this->url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a Console task.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteConsoleTask()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$id_console_task = (int) get_parameter('id_console_task');
|
||||
|
||||
if ($id_console_task !== null) {
|
||||
$result = db_process_sql_delete(
|
||||
'tuser_task_scheduled',
|
||||
['id' => $id_console_task]
|
||||
);
|
||||
|
||||
if ($result == 1) {
|
||||
return [
|
||||
'result' => 0,
|
||||
'msg' => __('Console Task successfully deleted'),
|
||||
'id' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// Trick to avoid double execution.
|
||||
header('Location: '.$this->url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show complete list of running tasks.
|
||||
*
|
||||
* @return boolean Success or not.
|
||||
*/
|
||||
public function showList()
|
||||
{
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get all discovery servers.
|
||||
$servers = db_get_all_rows_sql('SELECT * FROM tserver WHERE server_type = 3');
|
||||
if ($servers === false) {
|
||||
$servers = [];
|
||||
ui_print_error_message(__('Discovery Server is disabled'));
|
||||
$check = db_get_all_rows_sql('SELECT * FROM trecon_task');
|
||||
return (bool) $check;
|
||||
} else {
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
include_once $config['homedir'].'/include/functions_servers.php';
|
||||
include_once $config['homedir'].'/include/functions_network_profiles.php';
|
||||
|
||||
$modules_server = 0;
|
||||
$total_modules = 0;
|
||||
$total_modules_data = 0;
|
||||
|
||||
// --------------------------------
|
||||
// FORCE A RECON TASK
|
||||
// --------------------------------
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (isset($_GET['force'])) {
|
||||
$id = (int) get_parameter_get('force', 0);
|
||||
servers_force_recon_task($id);
|
||||
header(
|
||||
'Location: '.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$recon_tasks = db_get_all_rows_sql('SELECT * FROM trecon_task');
|
||||
$user_groups = implode(',', array_keys(users_get_groups()));
|
||||
|
||||
// Show network tasks for Recon Server.
|
||||
if ($recon_tasks === false) {
|
||||
$recon_tasks = [];
|
||||
}
|
||||
|
||||
$table = new StdClass();
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->align = [];
|
||||
$table->headstyle = [];
|
||||
for ($i = 0; $i < 9; $i++) {
|
||||
$table->headstyle[$i] = 'text-align: left;';
|
||||
}
|
||||
|
||||
$table->head[0] = __('Force');
|
||||
$table->align[0] = 'left';
|
||||
|
||||
$table->head[1] = __('Task name');
|
||||
$table->align[1] = 'left';
|
||||
|
||||
$table->head[2] = __('Server name');
|
||||
$table->align[2] = 'left';
|
||||
|
||||
$table->head[3] = __('Interval');
|
||||
$table->align[3] = 'left';
|
||||
|
||||
$table->head[4] = __('Network');
|
||||
$table->align[4] = 'left';
|
||||
|
||||
$table->head[5] = __('Status');
|
||||
$table->align[5] = 'left';
|
||||
|
||||
$table->head[6] = __('Task type');
|
||||
$table->align[6] = 'left';
|
||||
|
||||
$table->head[7] = __('Progress');
|
||||
$table->align[7] = 'left';
|
||||
|
||||
$table->head[8] = __('Updated at');
|
||||
$table->align[8] = 'left';
|
||||
|
||||
$table->head[9] = __('Operations');
|
||||
$table->align[9] = 'left';
|
||||
|
||||
foreach ($recon_tasks as $task) {
|
||||
$data = [];
|
||||
$server_name = servers_get_name($task['id_recon_server']);
|
||||
|
||||
// By default.
|
||||
$subnet = $task['subnet'];
|
||||
|
||||
// Exceptions: IPAM.
|
||||
$ipam = false;
|
||||
if ($task['id_recon_script'] != null) {
|
||||
$recon_script_name = db_get_value('name', 'trecon_script', 'id_recon_script', $task['id_recon_script']);
|
||||
if (io_safe_output($recon_script_name) == 'IPAM Recon'
|
||||
&& enterprise_installed()
|
||||
) {
|
||||
$subnet_obj = json_decode($task['macros'], true);
|
||||
$subnet = $subnet_obj['1']['value'];
|
||||
$tipam_task_id = db_get_value('id', 'tipam_network', 'id_recon_task', $task['id_rt']);
|
||||
$ipam = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($task['disabled'] == 0 && $server_name !== '') {
|
||||
$data[0] = '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
|
||||
).'">';
|
||||
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
|
||||
$data[0] .= '</a>';
|
||||
} else if ($task['disabled'] == 2) {
|
||||
$data[0] = ui_print_help_tip(
|
||||
__('This task has not been completely defined, please edit it'),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = '<b>'.$task['name'].'</b>';
|
||||
|
||||
$data[2] = $server_name;
|
||||
|
||||
if ($task['interval_sweep'] > 0) {
|
||||
$data[3] = human_time_description_raw(
|
||||
$task['interval_sweep']
|
||||
);
|
||||
} else {
|
||||
$data[3] = __('Manual');
|
||||
}
|
||||
|
||||
if ($task['id_recon_script'] == 0 || $ipam === true) {
|
||||
$data[4] = $subnet;
|
||||
} else {
|
||||
$data[4] = '-';
|
||||
}
|
||||
|
||||
if ($task['status'] <= 0) {
|
||||
$data[5] = __('Done');
|
||||
} else {
|
||||
$data[5] = __('Pending');
|
||||
}
|
||||
|
||||
if ($task['id_recon_script'] == 0) {
|
||||
// Discovery NetScan.
|
||||
$data[6] = html_print_image(
|
||||
'images/network.png',
|
||||
true,
|
||||
['title' => __('Discovery NetScan')]
|
||||
).' ';
|
||||
$data[6] .= network_profiles_get_name(
|
||||
$task['id_network_profile']
|
||||
);
|
||||
} else {
|
||||
// APP recon task.
|
||||
$data[6] = html_print_image(
|
||||
'images/plugin.png',
|
||||
true
|
||||
).' ';
|
||||
$data[6] .= $recon_script_name;
|
||||
}
|
||||
|
||||
if ($task['status'] <= 0 || $task['status'] > 100) {
|
||||
$data[7] = '-';
|
||||
} else {
|
||||
$data[7] = progress_bar(
|
||||
$task['status'],
|
||||
100,
|
||||
20,
|
||||
__('Progress').':'.$task['status'].'%',
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
if ($task['utimestamp'] > 0) {
|
||||
$data[8] = ui_print_timestamp(
|
||||
$task['utimestamp'],
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$data[8] = __('Not executed yet');
|
||||
}
|
||||
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$task['id_group'],
|
||||
'PM'
|
||||
)
|
||||
) {
|
||||
if ($ipam === true) {
|
||||
$data[9] = '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
|
||||
$tipam_task_id
|
||||
)
|
||||
).'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true
|
||||
).'</a>';
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
|
||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true
|
||||
).'</a>';
|
||||
} else {
|
||||
// Check if is a H&D, Cloud or Application or IPAM.
|
||||
$data[9] = '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
||||
$this->getTargetWiz($task),
|
||||
$task['id_rt']
|
||||
)
|
||||
).'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true
|
||||
).'</a>';
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
|
||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true
|
||||
).'</a>';
|
||||
}
|
||||
} else {
|
||||
$data[9] = '';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
echo '<h2>'.__('Server tasks').'</h2>';
|
||||
if (empty($table->data)) {
|
||||
echo '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no discovery tasks assigned').'</div>';
|
||||
return false;
|
||||
} else {
|
||||
html_print_table($table);
|
||||
}
|
||||
|
||||
unset($table);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show complete list of running tasks.
|
||||
*
|
||||
* @return boolean Success or not.
|
||||
*/
|
||||
public function showListConsoleTask()
|
||||
{
|
||||
return enterprise_hook('tasklist_showListConsoleTask', [$this]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return target url sub-string to edit target task.
|
||||
*
|
||||
* @param array $task With all data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTargetWiz($task)
|
||||
{
|
||||
// TODO: Do not use description. Use recon_script ID instead.
|
||||
switch ($task['description']) {
|
||||
case 'Discovery.Application.VMware':
|
||||
return 'wiz=app&mode=vmware&page=0';
|
||||
|
||||
case CLOUDWIZARD_AWS_DESCRIPTION:
|
||||
return 'wiz=cloud&mode=amazonws&page=1';
|
||||
|
||||
case 'console_task':
|
||||
return 'wiz=ctask';
|
||||
|
||||
default:
|
||||
return 'wiz=hd&mode=netscan';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,835 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to schedule tasks on Pandora FMS Console
|
||||
*
|
||||
* @category Wizard
|
||||
* @package Pandora FMS
|
||||
* @subpackage Host&Devices
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
require_once __DIR__.'/Wizard.main.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
enterprise_include('include/class/CSVImportAgents.class.php');
|
||||
enterprise_include_once('include/functions_hostdevices.php');
|
||||
|
||||
/**
|
||||
* Wizard section Host&devices.
|
||||
* Provides classic recon task creation.
|
||||
* In enterprise environments, provides also CSV agent import features.
|
||||
*/
|
||||
class HostDevices extends Wizard
|
||||
{
|
||||
|
||||
/**
|
||||
* Number of pages to control breadcrum.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $maxPagesNetScan = 2;
|
||||
|
||||
/**
|
||||
* Labels for breadcrum.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $pageLabelsNetScan = [
|
||||
'NetScan definition',
|
||||
'NetScan features',
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Stores all needed parameters to create a recon task.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $task;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param integer $page Start page, by default 0.
|
||||
* @param string $msg Mensajito.
|
||||
* @param string $icon Mensajito.
|
||||
* @param string $label Mensajito.
|
||||
*
|
||||
* @return class HostDevices
|
||||
*/
|
||||
public function __construct(
|
||||
int $page=0,
|
||||
string $msg='Default message. Not set.',
|
||||
string $icon='images/wizard/hostdevices.png',
|
||||
string $label='Host & Devices'
|
||||
) {
|
||||
$this->setBreadcrum([]);
|
||||
|
||||
$this->task = [];
|
||||
$this->msg = $msg;
|
||||
$this->icon = $icon;
|
||||
$this->label = $label;
|
||||
$this->page = $page;
|
||||
$this->url = ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run wizard manager.
|
||||
*
|
||||
* @return mixed Returns null if wizard is ongoing. Result if done.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Load styles.
|
||||
parent::run();
|
||||
|
||||
$mode = get_parameter('mode', null);
|
||||
|
||||
if ($mode === null) {
|
||||
$buttons = [];
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=netscan',
|
||||
'icon' => 'images/wizard/netscan.png',
|
||||
'label' => __('Net Scan'),
|
||||
];
|
||||
if (enterprise_installed()) {
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=importcsv',
|
||||
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
|
||||
'label' => __('Import CSV'),
|
||||
];
|
||||
}
|
||||
|
||||
$this->prepareBreadcrum(
|
||||
[
|
||||
[
|
||||
'link' => ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery'
|
||||
),
|
||||
'label' => __('Discovery'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->printHeader();
|
||||
|
||||
$this->printBigButtonsList($buttons);
|
||||
return;
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
if ($mode == 'importcsv') {
|
||||
$csv_importer = new CSVImportAgents($this->page, $this->breadcrum);
|
||||
return $csv_importer->runCSV();
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'netscan') {
|
||||
return $this->runNetScan();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// Extra methods.
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves and validates information given by user in NetScan wizard.
|
||||
*
|
||||
* @return boolean Data OK or not.
|
||||
*/
|
||||
public function parseNetScan()
|
||||
{
|
||||
if ($this->page == 0) {
|
||||
// Check if we're updating a task.
|
||||
$task_id = get_parameter('task', null);
|
||||
|
||||
if (isset($task_id) === true) {
|
||||
// We're updating this task.
|
||||
$task = db_get_row(
|
||||
'trecon_task',
|
||||
'id_rt',
|
||||
$task_id
|
||||
);
|
||||
|
||||
if ($task !== false) {
|
||||
$this->task = $task;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Validate response from page 0. No, not a bug, we're always 1 page
|
||||
// from 'validation' page.
|
||||
if ($this->page == 1) {
|
||||
$task_id = get_parameter('task', null);
|
||||
$taskname = get_parameter('taskname', '');
|
||||
$comment = get_parameter('comment', '');
|
||||
$server_id = get_parameter('id_recon_server', '');
|
||||
$network = get_parameter('network', '');
|
||||
$id_group = get_parameter('id_group', '');
|
||||
$interval = get_parameter('interval', 0);
|
||||
|
||||
if (isset($task_id) === true) {
|
||||
// We're updating this task.
|
||||
$task = db_get_row(
|
||||
'trecon_task',
|
||||
'id_rt',
|
||||
$task_id
|
||||
);
|
||||
|
||||
if ($task !== false) {
|
||||
$this->task = $task;
|
||||
}
|
||||
} else if (isset($taskname) === true
|
||||
&& isset($network) === true
|
||||
) {
|
||||
// Avoid double creation.
|
||||
$task = db_get_row_filter(
|
||||
'trecon_task',
|
||||
[
|
||||
'name' => $taskname,
|
||||
'subnet' => $network,
|
||||
]
|
||||
);
|
||||
|
||||
if ($task !== false) {
|
||||
$this->task = $task;
|
||||
$this->msg = __('This network scan task has been already defined. Please edit it or create a new one.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($task_id !== null
|
||||
&& $taskname == null
|
||||
&& $server_id == null
|
||||
&& $id_group == null
|
||||
&& $server == null
|
||||
&& $datacenter == ''
|
||||
&& $user == ''
|
||||
&& $pass == ''
|
||||
&& $encrypt == null
|
||||
&& $interval == 0
|
||||
) {
|
||||
// Default values, no data received.
|
||||
// User is accesing directly to this page.
|
||||
if (users_is_admin() !== true && check_acl(
|
||||
$config['id_usuario'],
|
||||
$this->task['id_group'],
|
||||
'PM'
|
||||
) !== true
|
||||
) {
|
||||
$this->msg = __('You have no access to edit this task.');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (isset($this->task['id_rt']) === false) {
|
||||
// Disabled 2 Implies wizard non finished.
|
||||
$this->task['disabled'] = 2;
|
||||
}
|
||||
|
||||
if ($taskname == '') {
|
||||
$this->msg = __('You must provide a task name.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($server_id == '') {
|
||||
$this->msg = __('You must select a Discovery Server.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($network == '') {
|
||||
// XXX: Could be improved validating provided network.
|
||||
$this->msg = __('You must provide a valid network.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($id_group == '') {
|
||||
$this->msg = __('You must select a valid group.');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Assign fields.
|
||||
$this->task['name'] = $taskname;
|
||||
$this->task['description'] = $comment;
|
||||
$this->task['subnet'] = $network;
|
||||
$this->task['id_recon_server'] = $server_id;
|
||||
$this->task['id_group'] = $id_group;
|
||||
$this->task['interval_sweep'] = $interval;
|
||||
|
||||
if (isset($this->task['id_rt']) === false) {
|
||||
// Create.
|
||||
$this->task['id_rt'] = db_process_sql_insert(
|
||||
'trecon_task',
|
||||
$this->task
|
||||
);
|
||||
} else {
|
||||
// Update.
|
||||
db_process_sql_update(
|
||||
'trecon_task',
|
||||
$this->task,
|
||||
['id_rt' => $this->task['id_rt']]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Validate response from page 1.
|
||||
if ($this->page == 2) {
|
||||
$id_rt = get_parameter('task', -1);
|
||||
|
||||
$task = db_get_row(
|
||||
'trecon_task',
|
||||
'id_rt',
|
||||
$id_rt
|
||||
);
|
||||
|
||||
if ($task !== false) {
|
||||
$this->task = $task;
|
||||
} else {
|
||||
$this->msg = __('Failed to find network scan task.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$id_network_profile = get_parameter('id_network_profile', null);
|
||||
$autoconf_enabled = get_parameter_switch(
|
||||
'autoconfiguration_enabled'
|
||||
);
|
||||
$snmp_enabled = get_parameter_switch('snmp_enabled');
|
||||
$os_detect = get_parameter_switch('os_detect');
|
||||
$parent_detection = get_parameter_switch('parent_detection');
|
||||
$parent_recursion = get_parameter_switch('parent_recursion');
|
||||
$vlan_enabled = get_parameter_switch('vlan_enabled');
|
||||
$wmi_enabled = get_parameter_switch('wmi_enabled');
|
||||
$resolve_names = get_parameter_switch('resolve_names');
|
||||
$snmp_version = get_parameter('snmp_version', null);
|
||||
$community = get_parameter('community', null);
|
||||
$snmp_context = get_parameter('snmp_context', null);
|
||||
$snmp_auth_user = get_parameter('snmp_auth_user', null);
|
||||
$snmp_auth_pass = get_parameter('snmp_auth_pass', null);
|
||||
$snmp_privacy_method = get_parameter('snmp_privacy_method', null);
|
||||
$snmp_privacy_pass = get_parameter('snmp_privacy_pass', null);
|
||||
$snmp_auth_method = get_parameter('snmp_auth_method', null);
|
||||
$snmp_security_level = get_parameter('snmp_security_level', null);
|
||||
$auth_strings = get_parameter('auth_strings', null);
|
||||
|
||||
if ($snmp_version == 3) {
|
||||
$this->task['snmp_community'] = $snmp_context;
|
||||
} else {
|
||||
$this->task['snmp_community'] = $community;
|
||||
}
|
||||
|
||||
$this->task['autoconfiguration_enabled'] = $autoconf_enabled;
|
||||
$this->task['id_network_profile'] = $id_network_profile;
|
||||
$this->task['snmp_enabled'] = $snmp_enabled;
|
||||
$this->task['os_detect'] = $os_detect;
|
||||
$this->task['parent_detection'] = $parent_detection;
|
||||
$this->task['parent_recursion'] = $parent_recursion;
|
||||
$this->task['vlan_enabled'] = $vlan_enabled;
|
||||
$this->task['wmi_enabled'] = $wmi_enabled;
|
||||
$this->task['resolve_names'] = $resolve_names;
|
||||
$this->task['snmp_version'] = $snmp_version;
|
||||
$this->task['snmp_auth_user'] = $snmp_auth_user;
|
||||
$this->task['snmp_auth_pass'] = $snmp_auth_pass;
|
||||
$this->task['snmp_privacy_method'] = $snmp_privacy_method;
|
||||
$this->task['snmp_privacy_pass'] = $snmp_privacy_pass;
|
||||
$this->task['snmp_auth_method'] = $snmp_auth_method;
|
||||
$this->task['snmp_security_level'] = $snmp_security_level;
|
||||
$this->task['auth_strings'] = $auth_strings;
|
||||
|
||||
if ($this->task['disabled'] == 2) {
|
||||
// Wizard finished.
|
||||
$this->task['disabled'] = 0;
|
||||
}
|
||||
|
||||
// Update.
|
||||
$res = db_process_sql_update(
|
||||
'trecon_task',
|
||||
$this->task,
|
||||
['id_rt' => $this->task['id_rt']]
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->page == 3) {
|
||||
// Wizard ended. Load data and return control to Discovery.
|
||||
$id_rt = get_parameter('task', -1);
|
||||
|
||||
$task = db_get_row(
|
||||
'trecon_task',
|
||||
'id_rt',
|
||||
$id_rt
|
||||
);
|
||||
|
||||
if ($task !== false) {
|
||||
$this->task = $task;
|
||||
} else {
|
||||
$this->msg = __('Failed to find network scan task.');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function runNetScan()
|
||||
{
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Agent Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->parseNetScan() === false) {
|
||||
// Error.
|
||||
ui_print_error_message(
|
||||
$this->msg
|
||||
);
|
||||
|
||||
$form = [
|
||||
'form' => [
|
||||
'method' => 'POST',
|
||||
'action' => $this->url.'&mode=netscan&page='.($this->page - 1).'&task='.$this->task['id_rt'],
|
||||
],
|
||||
'inputs' => [
|
||||
[
|
||||
'arguments' => [
|
||||
'type' => 'hidden',
|
||||
'name' => 'task',
|
||||
'value' => $this->task['id_rt'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => __('Go back'),
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub cancel"',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Check ACL. If user is not able to manage target task,
|
||||
// redirect him to main page.
|
||||
if (users_is_admin() !== true && check_acl(
|
||||
$config['id_usuario'],
|
||||
$this->task['id_group'],
|
||||
'PM'
|
||||
) !== true
|
||||
) {
|
||||
$form['form']['action'] = $this->url.'&mode=netscan&page='.($this->page - 1);
|
||||
}
|
||||
|
||||
$this->printForm($form);
|
||||
return null;
|
||||
}
|
||||
|
||||
$task_url = '';
|
||||
if (isset($this->task['id_rt'])) {
|
||||
$task_url = '&task='.$this->task['id_rt'];
|
||||
}
|
||||
|
||||
$breadcrum[] = [
|
||||
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd',
|
||||
'label' => __($this->label),
|
||||
];
|
||||
for ($i = 0; $i < $this->maxPagesNetScan; $i++) {
|
||||
$breadcrum[] = [
|
||||
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan&page='.$i.$task_url,
|
||||
'label' => $this->pageLabelsNetScan[$i],
|
||||
'selected' => (($i == $this->page) ? 1 : 0),
|
||||
];
|
||||
}
|
||||
|
||||
if ($this->page < $this->maxPagesNetScan) {
|
||||
// Avoid to print header out of wizard.
|
||||
$this->prepareBreadcrum($breadcrum);
|
||||
$this->printHeader();
|
||||
}
|
||||
|
||||
if (isset($this->page) === true
|
||||
&& $this->page != 0
|
||||
&& isset($this->task['id_rt']) === false
|
||||
) {
|
||||
// Error.
|
||||
ui_print_error_message(
|
||||
__('Internal error, please re-run this wizard.')
|
||||
);
|
||||
|
||||
$form = [
|
||||
'form' => [
|
||||
'method' => 'POST',
|
||||
'action' => $this->url.'&mode=netscan&page=0',
|
||||
],
|
||||
'inputs' => [
|
||||
[
|
||||
'arguments' => [
|
||||
'type' => 'hidden',
|
||||
'name' => 'page',
|
||||
'value' => 0,
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => __('Go back'),
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub cancel"',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$this->printForm($form);
|
||||
return null;
|
||||
}
|
||||
|
||||
// -------------------------------.
|
||||
// Page 0. wizard starts HERE.
|
||||
// -------------------------------.
|
||||
if (isset($this->page) === true || $this->page == 0) {
|
||||
if (isset($this->page) === false
|
||||
|| $this->page == 0
|
||||
) {
|
||||
$form = [];
|
||||
|
||||
// Input task name.
|
||||
$form['inputs'][] = [
|
||||
'label' => '<b>'.__('Task name').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'taskname',
|
||||
'value' => $this->task['name'],
|
||||
'type' => 'text',
|
||||
'size' => 25,
|
||||
],
|
||||
];
|
||||
|
||||
if (isset($this->task['id_rt']) === true) {
|
||||
// Propagate id.
|
||||
$form['inputs'][] = [
|
||||
'arguments' => [
|
||||
'name' => 'task',
|
||||
'value' => $this->task['id_rt'],
|
||||
'type' => 'hidden',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
// Input task name.
|
||||
$form['inputs'][] = [
|
||||
'label' => '<b>'.__('Comment').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'comment',
|
||||
'value' => $this->task['description'],
|
||||
'type' => 'text',
|
||||
'size' => 25,
|
||||
],
|
||||
];
|
||||
|
||||
// Input Discovery Server.
|
||||
$form['inputs'][] = [
|
||||
'label' => '<b>'.__('Discovery server').'</b>'.ui_print_help_tip(
|
||||
__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'type' => 'select_from_sql',
|
||||
'sql' => sprintf(
|
||||
'SELECT id_server, name
|
||||
FROM tserver
|
||||
WHERE server_type = %d
|
||||
ORDER BY name',
|
||||
SERVER_TYPE_DISCOVERY
|
||||
),
|
||||
'name' => 'id_recon_server',
|
||||
'selected' => $this->task['id_recon_server'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
// Input Network.
|
||||
$form['inputs'][] = [
|
||||
|
||||
'label' => '<b>'.__('Network').'</b>'.ui_print_help_tip(
|
||||
__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'name' => 'network',
|
||||
'value' => $this->task['subnet'],
|
||||
'type' => 'text',
|
||||
'size' => 25,
|
||||
],
|
||||
];
|
||||
|
||||
// Input Group.
|
||||
$form['inputs'][] = [
|
||||
'label' => '<b>'.__('Group').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'id_group',
|
||||
'returnAllGroup' => false,
|
||||
'privilege' => 'PM',
|
||||
'type' => 'select_groups',
|
||||
'selected' => $this->task['id_group'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
// Interval and schedules.
|
||||
$interv_manual = 0;
|
||||
if ((int) $this->task['interval_sweep'] == 0) {
|
||||
$interv_manual = 1;
|
||||
}
|
||||
|
||||
// Schedule.
|
||||
$form['inputs'][] = [
|
||||
'label' => '<b>'.__('Interval').'</b>'.ui_print_help_tip(
|
||||
__('Manual interval means that it will be executed only On-demand'),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'type' => 'select',
|
||||
'selected' => $interv_manual,
|
||||
'fields' => [
|
||||
0 => __('Defined'),
|
||||
1 => __('Manual'),
|
||||
],
|
||||
'name' => 'interval_manual_defined',
|
||||
'return' => true,
|
||||
],
|
||||
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
|
||||
'interval',
|
||||
$this->task['interval_sweep'],
|
||||
'',
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
).ui_print_help_tip(
|
||||
__('The minimum recomended interval for Recon Task is 5 minutes'),
|
||||
true
|
||||
).'</span>',
|
||||
];
|
||||
|
||||
$str = __('Next');
|
||||
|
||||
if (isset($this->task['id_rt']) === true) {
|
||||
$str = __('Update and continue');
|
||||
}
|
||||
|
||||
// Submit button.
|
||||
$form['inputs'][] = [
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => $str,
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub next"',
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
$task_url = '';
|
||||
if (isset($this->task['id_rt'])) {
|
||||
$task_url = '&task='.$this->task['id_rt'];
|
||||
}
|
||||
|
||||
$form['form'] = [
|
||||
'method' => 'POST',
|
||||
'action' => $this->url.'&mode=netscan&page='.($this->page + 1).$task_url,
|
||||
];
|
||||
|
||||
// Default.
|
||||
$interval = 600;
|
||||
$unit = 60;
|
||||
if (isset($this->task['interval_sweep']) === true) {
|
||||
$interval = $this->task['interval_sweep'];
|
||||
$unit = $this->getTimeUnit($interval);
|
||||
}
|
||||
|
||||
$form['js'] = '
|
||||
$("select#interval_manual_defined").change(function() {
|
||||
if ($("#interval_manual_defined").val() == 1) {
|
||||
$("#interval_manual_container").hide();
|
||||
$("#text-interval_text").val(0);
|
||||
$("#hidden-interval").val(0);
|
||||
}
|
||||
else {
|
||||
$("#interval_manual_container").show();
|
||||
$("#text-interval_text").val(10);
|
||||
$("#hidden-interval").val('.$interval.');
|
||||
$("#interval_units").val('.$unit.');
|
||||
}
|
||||
}).change();';
|
||||
|
||||
// XXX: Could be improved validating inputs before continue (JS)
|
||||
// Print NetScan page 0.
|
||||
$this->printForm($form);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->page == 1) {
|
||||
// Page 1.
|
||||
$form = [];
|
||||
// Hidden, id_rt.
|
||||
$form['inputs'][] = [
|
||||
'arguments' => [
|
||||
'name' => 'task',
|
||||
'value' => $this->task['id_rt'],
|
||||
'type' => 'hidden',
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
// Hidden, page.
|
||||
$form['inputs'][] = [
|
||||
'arguments' => [
|
||||
'name' => 'page',
|
||||
'value' => ($this->page + 1),
|
||||
'type' => 'hidden',
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
$form['inputs'][] = [
|
||||
'extra' => '<p>Please, configure task <b>'.io_safe_output($this->task['name']).'</b></p>',
|
||||
];
|
||||
|
||||
// Input: Module template.
|
||||
$form['inputs'][] = [
|
||||
'label' => __('Module template'),
|
||||
'arguments' => [
|
||||
'name' => 'id_network_profile',
|
||||
'type' => 'select_from_sql',
|
||||
'sql' => 'SELECT id_np, name
|
||||
FROM tnetwork_profile
|
||||
ORDER BY name',
|
||||
'return' => true,
|
||||
'selected' => $this->task['id_network_profile'],
|
||||
'nothing_value' => 0,
|
||||
'nothing' => __('None'),
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
// Input: Enable auto configuration.
|
||||
$form['inputs'][] = [
|
||||
'label' => __('Apply autoconfiguration rules').ui_print_help_tip(
|
||||
__(
|
||||
'System is able to auto configure detected host & devices by applying your defined configuration rules.'
|
||||
),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'name' => 'autoconfiguration_enabled',
|
||||
'type' => 'switch',
|
||||
'return' => true,
|
||||
'value' => (isset($this->task['autoconfiguration_enabled'])) ? $this->task['autoconfiguration_enabled'] : 0,
|
||||
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
// Feature configuration.
|
||||
$extra = enterprise_hook('hd_showextrainputs', [$this]);
|
||||
if (is_array($extra) === true) {
|
||||
$form['inputs'] = array_merge(
|
||||
$form['inputs'],
|
||||
$extra['inputs']
|
||||
);
|
||||
$form['js'] = $extra['js'];
|
||||
}
|
||||
}
|
||||
|
||||
// Submit button.
|
||||
$form['inputs'][] = [
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => __('Finish'),
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub next"',
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
$form['form'] = [
|
||||
'method' => 'POST',
|
||||
'action' => $this->url.'&mode=netscan&page='.($this->page + 1).'&task='.$this->task['id_rt'],
|
||||
];
|
||||
|
||||
$this->printForm($form);
|
||||
}
|
||||
|
||||
if ($this->page == 2) {
|
||||
if ($this->task['id_rt']) {
|
||||
// 0 - Is OK.
|
||||
$this->result = 0;
|
||||
$this->msg = __('Task configured.');
|
||||
} else {
|
||||
// 1 - Is NOT OK.
|
||||
$this->result = 1;
|
||||
$this->msg = __('Wizard failed. Cannot configure task.');
|
||||
}
|
||||
|
||||
return [
|
||||
'result' => $this->result,
|
||||
'id' => $this->task['id_rt'],
|
||||
'msg' => $this->msg,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,708 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to schedule tasks on Pandora FMS Console
|
||||
*
|
||||
* @category Wizard
|
||||
* @package Pandora FMS
|
||||
* @subpackage Wizard skel
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
|
||||
|
||||
/**
|
||||
* Global Wizard generic class. Needs to be inherited.
|
||||
*
|
||||
* Used in Hostdevices class, Applications class and others, is the core of
|
||||
* Discovery proyect.
|
||||
*/
|
||||
class Wizard
|
||||
{
|
||||
|
||||
/**
|
||||
* Breadcrum
|
||||
*
|
||||
* @var array.
|
||||
*/
|
||||
public $breadcrum;
|
||||
|
||||
/**
|
||||
* Current page
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $page;
|
||||
|
||||
/**
|
||||
* Target icon to be shown in discovery wizard list.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $icon;
|
||||
|
||||
/**
|
||||
* Target label to be shown in discovery wizard list.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $label;
|
||||
|
||||
/**
|
||||
* This wizard's url.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* Result of wizard execution (0 - ok, 1 - not ok).
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $result;
|
||||
|
||||
/**
|
||||
* Message to be delivered to user.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $msg;
|
||||
|
||||
|
||||
/**
|
||||
* Setter for breadcrum
|
||||
*
|
||||
* @param array $str Breadcrum.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setBreadcrum(array $str)
|
||||
{
|
||||
$this->breadcrum = $str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getter for breadcrum
|
||||
*
|
||||
* @return array Breadcrum.
|
||||
*/
|
||||
public function getBreadcrum()
|
||||
{
|
||||
return $this->breadcrum;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add an element to breadcrum array.
|
||||
*
|
||||
* @param string $breads Elements to add to breadcrum.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function addBreadcrum($breads)
|
||||
{
|
||||
if (empty($breads)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->breadcrum = array_merge($this->breadcrum, $breads);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setter for label
|
||||
*
|
||||
* @param string $str Label.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLabel(string $str)
|
||||
{
|
||||
$this->label = $str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getter for label
|
||||
*
|
||||
* @return array Breadcrum.
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return units associated to target interval (in seconds).
|
||||
*
|
||||
* @param integer $interval Target interval.
|
||||
*
|
||||
* @return integer Unit.
|
||||
*/
|
||||
public function getTimeUnit($interval)
|
||||
{
|
||||
$units = [
|
||||
1,
|
||||
60,
|
||||
3600,
|
||||
86400,
|
||||
604800,
|
||||
2592000,
|
||||
31104000,
|
||||
];
|
||||
|
||||
$size = count($units);
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
if ($interval < $units[$i]) {
|
||||
if (($i - 1) < 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return $units[($i - 1)];
|
||||
}
|
||||
}
|
||||
|
||||
return $units[-1];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builder for breadcrum
|
||||
*
|
||||
* @param array $urls Array of urls to be stored in breadcrum.
|
||||
* @param boolean $add True if breadcrum should be added instead of
|
||||
* overwrite it.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareBreadcrum(array $urls, bool $add=false)
|
||||
{
|
||||
$bc = [];
|
||||
$i = 0;
|
||||
foreach ($urls as $url) {
|
||||
if ($url['selected'] == 1) {
|
||||
$class = 'selected';
|
||||
} else {
|
||||
$class = '';
|
||||
}
|
||||
|
||||
$bc[$i] = '<a href="'.$url['link'].'" class="text_color">';
|
||||
$bc[$i] .= '<div class="arrow_box '.$class.'">'.$url['label'];
|
||||
$bc[$i++] .= '</div></a>';
|
||||
}
|
||||
|
||||
if ($add === true) {
|
||||
$this->addBreadcrum($bc);
|
||||
} else {
|
||||
$this->setBreadcrum($bc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To be overwritten.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
ui_require_css_file('wizard');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if environment is ready,
|
||||
* returns array
|
||||
* icon: icon to be displayed
|
||||
* label: label to be displayed
|
||||
*
|
||||
* @return array With data.
|
||||
**/
|
||||
public function load()
|
||||
{
|
||||
return [
|
||||
'icon' => $this->icon,
|
||||
'label' => $this->label,
|
||||
'url' => $this->url,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print breadcrum to follow flow.
|
||||
*
|
||||
* @return string Breadcrum HTML code.
|
||||
*/
|
||||
public function printBreadcrum()
|
||||
{
|
||||
return '<h1 class="wizard">'.implode('', $this->breadcrum).'</h1>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints a header for current wizard.
|
||||
*
|
||||
* @param boolean $return Return HTML or print it.
|
||||
*
|
||||
* @return string HTML code for header.
|
||||
*/
|
||||
public function printHeader(bool $return=false)
|
||||
{
|
||||
$output = $this->printBreadcrum();
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print input using functions html lib.
|
||||
*
|
||||
* @param array $data Input definition.
|
||||
*
|
||||
* @return string HTML code for desired input.
|
||||
*/
|
||||
public function printInput($data)
|
||||
{
|
||||
if (is_array($data) === false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
switch ($data['type']) {
|
||||
case 'text':
|
||||
return html_print_input_text(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['alt']) === true) ? $data['alt'] : ''),
|
||||
((isset($data['size']) === true) ? $data['size'] : 50),
|
||||
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
|
||||
((isset($data['return']) === true) ? $data['return'] : true),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['required']) === true) ? $data['required'] : false),
|
||||
((isset($data['function']) === true) ? $data['function'] : ''),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['onChange']) === true) ? $data['onChange'] : ''),
|
||||
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
|
||||
);
|
||||
|
||||
case 'image':
|
||||
return html_print_input_image(
|
||||
$data['name'],
|
||||
$data['src'],
|
||||
$data['value'],
|
||||
((isset($data['style']) === true) ? $data['style'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['options']) === true) ? $data['options'] : false)
|
||||
);
|
||||
|
||||
case 'text_extended':
|
||||
return html_print_input_text_extended(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
$data['id'],
|
||||
$data['alt'],
|
||||
$data['size'],
|
||||
$data['maxlength'],
|
||||
$data['disabled'],
|
||||
$data['script'],
|
||||
$data['attributes'],
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['password']) === true) ? $data['password'] : false),
|
||||
((isset($data['function']) === true) ? $data['function'] : '')
|
||||
);
|
||||
|
||||
case 'password':
|
||||
return html_print_input_password(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['alt']) === true) ? $data['alt'] : ''),
|
||||
((isset($data['size']) === true) ? $data['size'] : 50),
|
||||
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['required']) === true) ? $data['required'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : '')
|
||||
);
|
||||
|
||||
case 'text':
|
||||
return html_print_input_text(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['alt']) === true) ? $data['alt'] : ''),
|
||||
((isset($data['size']) === true) ? $data['size'] : 50),
|
||||
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['required']) === true) ? $data['required'] : false),
|
||||
((isset($data['function']) === true) ? $data['function'] : ''),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['onChange']) === true) ? $data['onChange'] : ''),
|
||||
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
|
||||
);
|
||||
|
||||
case 'image':
|
||||
return html_print_input_image(
|
||||
$data['name'],
|
||||
$data['src'],
|
||||
$data['value'],
|
||||
((isset($data['style']) === true) ? $data['style'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['options']) === true) ? $data['options'] : false)
|
||||
);
|
||||
|
||||
case 'hidden':
|
||||
return html_print_input_hidden(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : false)
|
||||
);
|
||||
|
||||
case 'hidden_extended':
|
||||
return html_print_input_hidden_extended(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
$data['id'],
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : false)
|
||||
);
|
||||
|
||||
case 'color':
|
||||
return html_print_input_color(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['class']) === true) ? $data['class'] : false),
|
||||
((isset($data['return']) === true) ? $data['return'] : false)
|
||||
);
|
||||
|
||||
case 'file':
|
||||
return html_print_input_file(
|
||||
$data['name'],
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['options']) === true) ? $data['options'] : false)
|
||||
);
|
||||
|
||||
case 'select':
|
||||
return html_print_select(
|
||||
$data['fields'],
|
||||
$data['name'],
|
||||
((isset($data['selected']) === true) ? $data['selected'] : ''),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
|
||||
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['multiple']) === true) ? $data['multiple'] : false),
|
||||
((isset($data['sort']) === true) ? $data['sort'] : true),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['style']) === true) ? $data['style'] : false),
|
||||
((isset($data['option_style']) === true) ? $data['option_style'] : false),
|
||||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['modal']) === true) ? $data['modal'] : false),
|
||||
((isset($data['message']) === true) ? $data['message'] : ''),
|
||||
((isset($data['select_all']) === true) ? $data['select_all'] : false)
|
||||
);
|
||||
|
||||
case 'select_from_sql':
|
||||
return html_print_select_from_sql(
|
||||
$data['sql'],
|
||||
$data['name'],
|
||||
((isset($data['selected']) === true) ? $data['selected'] : ''),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
|
||||
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : '0'),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['multiple']) === true) ? $data['multiple'] : false),
|
||||
((isset($data['sort']) === true) ? $data['sort'] : true),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['style']) === true) ? $data['style'] : false),
|
||||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT)
|
||||
);
|
||||
|
||||
case 'select_groups':
|
||||
return html_print_select_groups(
|
||||
((isset($data['id_user']) === true) ? $data['id_user'] : false),
|
||||
((isset($data['privilege']) === true) ? $data['privilege'] : 'AR'),
|
||||
((isset($data['returnAllGroup']) === true) ? $data['returnAllGroup'] : true),
|
||||
$data['name'],
|
||||
((isset($data['selected']) === true) ? $data['selected'] : ''),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
|
||||
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['multiple']) === true) ? $data['multiple'] : false),
|
||||
((isset($data['sort']) === true) ? $data['sort'] : true),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['style']) === true) ? $data['style'] : false),
|
||||
((isset($data['option_style']) === true) ? $data['option_style'] : false),
|
||||
((isset($data['id_group']) === true) ? $data['id_group'] : false),
|
||||
((isset($data['keys_field']) === true) ? $data['keys_field'] : 'id_grupo'),
|
||||
((isset($data['strict_user']) === true) ? $data['strict_user'] : false),
|
||||
((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false),
|
||||
((isset($data['include_groups']) === true) ? $data['include_groups'] : false)
|
||||
);
|
||||
|
||||
case 'submit':
|
||||
return '<div class="action-buttons" style="width: 100%">'.html_print_submit_button(
|
||||
((isset($data['label']) === true) ? $data['label'] : 'OK'),
|
||||
((isset($data['name']) === true) ? $data['name'] : ''),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false)
|
||||
).'</div>';
|
||||
|
||||
case 'checkbox':
|
||||
return html_print_checkbox(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['checked']) === true) ? $data['checked'] : false),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['disabled_hidden']) === true) ? $data['disabled_hidden'] : false)
|
||||
);
|
||||
|
||||
case 'switch':
|
||||
return html_print_switch($data);
|
||||
|
||||
case 'interval':
|
||||
return html_print_extended_select_for_time(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
|
||||
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
|
||||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['style']) === true) ? $data['selected'] : false),
|
||||
((isset($data['unique']) === true) ? $data['unique'] : false)
|
||||
);
|
||||
|
||||
case 'textarea':
|
||||
return html_print_textarea(
|
||||
$data['name'],
|
||||
$data['rows'],
|
||||
$data['columns'],
|
||||
((isset($data['value']) === true) ? $data['value'] : ''),
|
||||
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : '')
|
||||
);
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints a go back button redirecting to main page.
|
||||
*
|
||||
* @param string $url Optional target url.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function printGoBackButton($url=null)
|
||||
{
|
||||
if (isset($url) === false) {
|
||||
$url = ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery'
|
||||
);
|
||||
}
|
||||
|
||||
$form = [
|
||||
'form' => [
|
||||
'method' => 'POST',
|
||||
'action' => $url,
|
||||
],
|
||||
'inputs' => [
|
||||
[
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => __('Go back'),
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub cancel"',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$this->printForm($form);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print a block of inputs.
|
||||
*
|
||||
* @param array $input Definition of target block to be printed.
|
||||
* @param boolean $return Return as string or direct output.
|
||||
*
|
||||
* @return string HTML content.
|
||||
*/
|
||||
public function printBlock(array $input, bool $return=false)
|
||||
{
|
||||
$output = '';
|
||||
if ($input['hidden'] == 1) {
|
||||
$class = ' class="hidden"';
|
||||
} else {
|
||||
$class = '';
|
||||
}
|
||||
|
||||
if (is_array($input['block_content']) === true) {
|
||||
// Print independent block of inputs.
|
||||
$output .= '<li id="'.$input['block_id'].'" '.$class.'>';
|
||||
$output .= '<ul class="wizard">';
|
||||
foreach ($input['block_content'] as $input) {
|
||||
$output .= $this->printBlock($input, $return);
|
||||
}
|
||||
|
||||
$output .= '</ul></li>';
|
||||
} else {
|
||||
if ($input['arguments']['type'] != 'hidden') {
|
||||
$output .= '<li id="'.$input['id'].'" '.$class.'>';
|
||||
$output .= '<label>'.$input['label'].'</label>';
|
||||
$output .= $this->printInput($input['arguments']);
|
||||
// Allow dynamic content.
|
||||
$output .= $input['extra'];
|
||||
$output .= '</li>';
|
||||
} else {
|
||||
$output .= $this->printInput($input['arguments']);
|
||||
// Allow dynamic content.
|
||||
$output .= $input['extra'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print a form.
|
||||
*
|
||||
* @param array $data Definition of target form to be printed.
|
||||
* @param boolean $return Return as string or direct output.
|
||||
*
|
||||
* @return string HTML code.
|
||||
*/
|
||||
public function printForm(array $data, bool $return=false)
|
||||
{
|
||||
$form = $data['form'];
|
||||
$inputs = $data['inputs'];
|
||||
$js = $data['js'];
|
||||
$cb_function = $data['cb_function'];
|
||||
$cb_args = $data['cb_args'];
|
||||
|
||||
$output_head = '<form enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head .= '" '.$form['extra'].'>';
|
||||
|
||||
if ($return === false) {
|
||||
echo $output_head;
|
||||
}
|
||||
|
||||
try {
|
||||
if (isset($cb_function) === true) {
|
||||
call_user_func_array(
|
||||
$cb_function,
|
||||
(isset($cb_args) === true) ? $cb_args : []
|
||||
);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
error_log('Error executing wizard callback: ', $e->getMessage());
|
||||
}
|
||||
|
||||
$output = '<ul class="wizard">';
|
||||
|
||||
foreach ($inputs as $input) {
|
||||
$output .= $this->printBlock($input, true);
|
||||
}
|
||||
|
||||
$output .= '</ul>';
|
||||
$output .= '</form>';
|
||||
$output .= '<script>'.$js.'</script>';
|
||||
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
return $output_head.$output;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print a big button element (huge image, big text and link).
|
||||
*
|
||||
* @param array $data Element data (link, image...).
|
||||
*
|
||||
* @return void Only prints the element.
|
||||
*/
|
||||
public static function printBigButtonElement($data)
|
||||
{
|
||||
if (isset($data['url']) === false) {
|
||||
$data['url'] = '#';
|
||||
}
|
||||
|
||||
?>
|
||||
<li class="discovery">
|
||||
<a href="<?php echo $data['url']; ?>">
|
||||
<div class="data_container">
|
||||
<?php html_print_image($data['icon']); ?>
|
||||
<br><label id="text_wizard">
|
||||
<?php echo io_safe_output($data['label']); ?>
|
||||
</label>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print a list of big buttons elements.
|
||||
*
|
||||
* @param array $list_data Array of data for printBigButtonElement.
|
||||
*
|
||||
* @return void Print the full list.
|
||||
*/
|
||||
public static function printBigButtonsList($list_data)
|
||||
{
|
||||
echo '<ul>';
|
||||
array_map('self::printBigButtonElement', $list_data);
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
global $config;
|
||||
require $config['homedir'].'/godmode/wizards/Wizard.interface.php';
|
||||
|
||||
$obj = new HostDevices();
|
||||
|
||||
$obj->load();
|
After Width: | Height: | Size: 664 B |
After Width: | Height: | Size: 294 B |
After Width: | Height: | Size: 516 B |
After Width: | Height: | Size: 510 B |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 311 B |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 813 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 342 B |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 381 B |
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 281 B |
After Width: | Height: | Size: 283 B |
After Width: | Height: | Size: 285 B |
After Width: | Height: | Size: 755 B |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 881 B |
After Width: | Height: | Size: 322 B |
After Width: | Height: | Size: 611 B |
After Width: | Height: | Size: 305 B |