Merge branch 'develop' into 2978-Functiones-API-traps-y-control-de-acceso-de-aplicacion-externa-Fix-de-código-pisado

Conflicts:
	pandora_console/include/functions_api.php


Former-commit-id: 5a5debe1ed66000fb8569ec589c84cad8e8dfe63
This commit is contained in:
enriquecd 2019-01-11 12:04:50 +01:00
commit ae9b595edd
1679 changed files with 191371 additions and 66856 deletions

View File

@ -247,4 +247,11 @@ button h3 {
} }
.sev-Maintenance { .sev-Maintenance {
background: #A8A8A8; background: #A8A8A8;
}
.sev-Minor {
background: #F099A2;
color: #333;
}
.sev-Major {
background: #C97A4A;
} }

View File

@ -3,7 +3,7 @@ var isFetching = null;
var storedEvents = new Array(); var storedEvents = new Array();
var notVisited = {}; var notVisited = {};
$(window).load(function() { $(window).on('load', function() {
initilise(); initilise();
// Wait some ms to throw main function // Wait some ms to throw main function
var delay = setTimeout(main, 100); var delay = setTimeout(main, 100);
@ -29,11 +29,13 @@ function main() {
if (isFetching) return; if (isFetching) return;
isFetching = true; isFetching = true;
var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=csv&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"]; var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=json&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
req = new XMLHttpRequest(); req = new XMLHttpRequest();
req.onload = handleResponse; req.onload = handleResponse;
req.onerror = handleError; req.onerror = handleError;
req.open("GET", feedUrl, true); req.open("GET", feedUrl, true);
req.withCredentials = true
req.send(null); req.send(null);
} }
@ -132,25 +134,23 @@ function fetchNewEvents(A,B){
function parseReplyEvents (reply) { function parseReplyEvents (reply) {
// Split the API response // Split the API response
var e_array = reply.split("\n"); var data = JSON.parse(reply)
var e_array = JSON.parse(reply).data;
// Form a properly object // Form a properly object
var fetchedEvents=new Array(); var fetchedEvents=new Array();
for(var i=0;i<e_array.length;i++){ for(var i=0;i<e_array.length;i++){
// Avoid to parse empty lines var event=e_array[i];
if (e_array[i].length == 0) continue;
var event=e_array[i].split(";");
fetchedEvents.push({ fetchedEvents.push({
'id' : event[0], 'id' : event.id_evento,
'agent_name' : event[1], 'agent_name' : event.agent_name,
'agent' : event[2], 'agent' : event.id_agente,
'date' : event[5], 'date' : event.timestamp,
'title' : event[6], 'title' : event.evento,
'module' : event[9], 'module' : event.id_agentmodule,
'type' : event[14], 'type' : event.event_type,
'source' : event[17], 'source' : event.source,
'severity' : event[28], 'severity' : event.criticity_name,
'visited' : false 'visited' : false
}); });
} }
@ -215,7 +215,7 @@ function getNotification(pEvent){
if(pEvent['module'] != 0) even += " in the module with Id "+ pEvent['module']; if(pEvent['module'] != 0) even += " in the module with Id "+ pEvent['module'];
even += "."; even += ".";
var url = (pEvent['agent']=="") var url = (pEvent['agent'] == 0)
? localStorage["ip_address"]+"/index.php?sec=eventos&sec2=operation/events/events" ? localStorage["ip_address"]+"/index.php?sec=eventos&sec2=operation/events/events"
: localStorage["ip_address"]+"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" + pEvent['agent']; : localStorage["ip_address"]+"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" + pEvent['agent'];

View File

@ -1,17 +1,14 @@
console.log("hola");
var url = window.location.href; var url = window.location.href;
var re = /\?event=(\d+)/; var re = /\?event=(\d+)/;
console.log("hola");
if(re.exec(url)) { if(re.exec(url)) {
if(!isNaN(RegExp.$1)) { if(!isNaN(RegExp.$1)) {
var eventId = RegExp.$1; var eventId = RegExp.$1;
document.write(chrome.extension.getBackgroundPage().getNotification(eventId)); document.write(chrome.extension.getBackgroundPage().getNotification(eventId));
} }
} }
console.log("hola");
window.onload = function () { window.onload = function () {
setTimeout(function() { setTimeout(function() {
window.close(); window.close();
}, 10000); }, 10000);
} }
console.log("hola");

View File

@ -91,12 +91,12 @@ function showEvents(){
var a = document.createElement('a'); var a = document.createElement('a');
var temp_style; var temp_style;
var agent_url = (allEvents[i]["agent_name"] == 0) var agent_url = (allEvents[i]["agent"] == 0)
? localStorage["ip_address"] ? localStorage["ip_address"]
+ "/index.php?sec=eventos&sec2=operation/events/events" + "/index.php?sec=eventos&sec2=operation/events/events"
: localStorage["ip_address"] : localStorage["ip_address"]
+ "/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" + "/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="
+ allEvents[i]['agent_name']; + allEvents[i]['agent'];
a.setAttribute("href",agent_url); a.setAttribute("href",agent_url);
a.target = "_blank"; a.target = "_blank";
a.className = 'a_2_mo'; a.className = 'a_2_mo';

View File

@ -1,6 +1,6 @@
{ {
"name": "__MSG_name__", "name": "__MSG_name__",
"version": "2.0", "version": "2.1",
"manifest_version": 2, "manifest_version": 2,
"description": "Pandora FMS Event viewer Chrome extension", "description": "Pandora FMS Event viewer Chrome extension",
"homepage_url": "http://pandorafms.com", "homepage_url": "http://pandorafms.com",
@ -23,6 +23,7 @@
"tabs", "tabs",
"notifications", "notifications",
"http://*/*", "http://*/*",
"https://*/*",
"background" "background"
], ],
"default_locale": "en" "default_locale": "en"

View File

@ -16,7 +16,7 @@ else
fi fi
VERSION=$2 VERSION=$2
if [ $# == 2 ]; then if [ $# == 2 ]; then
BUILD=`date +%g%m%d` BUILD=`date +%y%m%d`
else else
BUILD=$3 BUILD=$3
fi fi

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.728 # Version 7.0NG.730
# This program is Free Software, you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -58,8 +58,17 @@ use strict;
use File::Basename; use File::Basename;
use Getopt::Std; use Getopt::Std;
use IO::Select; use IO::Select;
use IO::Compress::Zip qw(zip $ZipError); my $zlib_available = 1;
use IO::Uncompress::Unzip qw(unzip $UnzipError);
eval {
eval "use IO::Compress::Zip qw(zip);1" or die($@);
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
};
if ($@) {
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
$zlib_available = 0;
}
use Socket (qw(SOCK_STREAM AF_INET AF_INET6)); use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE = my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,7 +333,9 @@ sub parse_options {
# Compress data # Compress data
if (defined ($opts{'z'})) { if (defined ($opts{'z'})) {
$t_zip = 1; if ($zlib_available == 1) {
$t_zip = 1;
}
} }
} }
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file # Receive file
$zdata = recv_data_block ($size); $zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) { if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError"); print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n"); send_data ("ZRECV ERR\n");
return; return;
} }
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents # Read the file and compress its contents
if (! zip($file => \$data)) { if (! zip($file => \$data)) {
send_data ("QUIT\n"); send_data ("QUIT\n");
error ("Compression error: $ZipError"); error ("Compression error: $IO::Compress::Zip::ZipError");
return; return;
} }
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response."); error ("Server responded $response.");
} }
print_log ("Server responded SEND OK"); print_log ("Server responded ZSEND OK");
send_data ($data); send_data ($data);
# Wait for server response # Wait for server response

View File

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

View File

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

View File

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

View File

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

View File

@ -58,8 +58,17 @@ use strict;
use File::Basename; use File::Basename;
use Getopt::Std; use Getopt::Std;
use IO::Select; use IO::Select;
use IO::Compress::Zip qw(zip $ZipError); my $zlib_available = 1;
use IO::Uncompress::Unzip qw(unzip $UnzipError);
eval {
eval "use IO::Compress::Zip qw(zip);1" or die($@);
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
};
if ($@) {
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
$zlib_available = 0;
}
use Socket (qw(SOCK_STREAM AF_INET AF_INET6)); use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE = my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,7 +333,9 @@ sub parse_options {
# Compress data # Compress data
if (defined ($opts{'z'})) { if (defined ($opts{'z'})) {
$t_zip = 1; if ($zlib_available == 1) {
$t_zip = 1;
}
} }
} }
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file # Receive file
$zdata = recv_data_block ($size); $zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) { if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError"); print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n"); send_data ("ZRECV ERR\n");
return; return;
} }
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents # Read the file and compress its contents
if (! zip($file => \$data)) { if (! zip($file => \$data)) {
send_data ("QUIT\n"); send_data ("QUIT\n");
error ("Compression error: $ZipError"); error ("Compression error: $IO::Compress::Zip::ZipError");
return; return;
} }
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response."); error ("Server responded $response.");
} }
print_log ("Server responded SEND OK"); print_log ("Server responded ZSEND OK");
send_data ($data); send_data ($data);
# Wait for server response # Wait for server response

View File

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

View File

@ -58,8 +58,17 @@ use strict;
use File::Basename; use File::Basename;
use Getopt::Std; use Getopt::Std;
use IO::Select; use IO::Select;
use IO::Compress::Zip qw(zip $ZipError); my $zlib_available = 1;
use IO::Uncompress::Unzip qw(unzip $UnzipError);
eval {
eval "use IO::Compress::Zip qw(zip);1" or die($@);
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
};
if ($@) {
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
$zlib_available = 0;
}
use Socket (qw(SOCK_STREAM AF_INET AF_INET6)); use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE = my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,7 +333,9 @@ sub parse_options {
# Compress data # Compress data
if (defined ($opts{'z'})) { if (defined ($opts{'z'})) {
$t_zip = 1; if ($zlib_available == 1) {
$t_zip = 1;
}
} }
} }
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file # Receive file
$zdata = recv_data_block ($size); $zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) { if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError"); print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n"); send_data ("ZRECV ERR\n");
return; return;
} }
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents # Read the file and compress its contents
if (! zip($file => \$data)) { if (! zip($file => \$data)) {
send_data ("QUIT\n"); send_data ("QUIT\n");
error ("Compression error: $ZipError"); error ("Compression error: $IO::Compress::Zip::ZipError");
return; return;
} }
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response."); error ("Server responded $response.");
} }
print_log ("Server responded SEND OK"); print_log ("Server responded ZSEND OK");
send_data ($data); send_data ($data);
# Wait for server response # Wait for server response

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.728-181025 Version: 7.0NG.730-190111
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.728'; use constant AGENT_VERSION => '7.0NG.730';
use constant AGENT_BUILD => '181025'; use constant AGENT_BUILD => '190111';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -516,11 +516,18 @@ sub parse_conf_modules($) {
log_message ('setup', "Invalid regular expression in intensive condition: $line"); log_message ('setup', "Invalid regular expression in intensive condition: $line");
} }
} }
} elsif ($line =~ /^\s*module_crontab\s+(((\*|(\d+(-\d+){0,1}))\s*){5}).*$/) { } elsif ($line =~ /^\s*module_crontab\s+(.*)$/) {
my $cron_text = $1; my $cron_text = $1;
chomp ($cron_text); chomp ($cron_text);
$cron_text =~ s/\s+$//;
# Get module name if is already read.
my $module_name_message = "";
$module_name_message = " (module $module->{'name'})" if defined($module->{'name'});
if (cron_check_syntax($cron_text)) { if (cron_check_syntax($cron_text)) {
$module->{'cron'} = $cron_text; $module->{'cron'} = $cron_text;
log_message('debug', "Cron '$module->{'cron'}' configured $module_name_message.");
} else {
log_message('setup', "Incorrect cron syntax '$cron_text'. This module$module_name_message will be executed always.");
} }
} elsif ($line =~ /^\s*module_end\s*$/) { } elsif ($line =~ /^\s*module_end\s*$/) {
@ -2397,6 +2404,7 @@ sub check_module_cron {
$interval $interval
); );
my $is_first = ($module->{'cron_utimestamp'} == 0) ? 1 : 0;
$module->{'cron_utimestamp'} = $now + $time_to_next_execution; $module->{'cron_utimestamp'} = $now + $time_to_next_execution;
$module->{'cron_interval'} = $time_to_next_execution; $module->{'cron_interval'} = $time_to_next_execution;
@ -2405,7 +2413,7 @@ sub check_module_cron {
} }
# On first execution checking if cron is valid is required # On first execution checking if cron is valid is required
return 1 unless ($module->{'cron_utimestamp'} == 0); return 1 unless ($is_first);
# Check if current timestamp is a valid cron date # Check if current timestamp is a valid cron date
my $next_execution = cron_next_execution_date( my $next_execution = cron_next_execution_date(

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.728 %define version 7.0NG.730
%define release 181025 %define release 190111
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}
@ -95,7 +95,8 @@ if [ ! -e /etc/pandora/plugins ]; then
fi fi
if [ ! -e /etc/pandora/collections ]; then if [ ! -e /etc/pandora/collections ]; then
mkdir -p /etc/pandora/collections mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi fi
mkdir -p /var/spool/pandora/data_out mkdir -p /var/spool/pandora/data_out

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.728 %define version 7.0NG.730
%define release 181025 %define release 190111
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

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

View File

@ -25,12 +25,33 @@
############################################################################### ###############################################################################
use strict; use strict;
use warnings;
# Retrieve information from all filesystems # Retrieve information from all filesystems
my $all_filesystems = 0; my $all_filesystems = 0;
# Regex flag # Regex flag
my $regex_mode = 0; my $regex_mode = 0;
my $inode_mode = 0;
# Exclusion
my @exclude_fs = ();
my $cmd = undef;
sub in_array {
my ($array, $value) = @_;
if (!defined($value)) {
return 0;
}
my %params = map { $_ => 1 } @{$array};
if (exists($params{$value})) {
return 1;
}
return 0;
}
sub check_re($$){ sub check_re($$){
my $item = shift; my $item = shift;
@ -65,10 +86,24 @@ if ($#ARGV < 0) {
$all_filesystems = 1; $all_filesystems = 1;
} }
# Check if regex mode is enabled while ($#ARGV >= 0) {
if ($ARGV[0] eq "-r") { my $param = shift @ARGV;
$regex_mode = 1; if ($param eq '-r') {
shift @ARGV; $regex_mode = 1;
shift @ARGV;
}
elsif ($param eq '-i') {
$inode_mode = 1;
}
elsif ($param eq '-exclude_fs') {
my $_tmp = shift @ARGV;
chomp ($_tmp);
@exclude_fs = split /,/, $_tmp;
}
elsif ($param eq '-custom_cmd') {
$cmd = shift @ARGV;
chomp ($cmd);
}
} }
# Parse command line parameters # Parse command line parameters
@ -90,7 +125,15 @@ if ($onlyexclude) {
# Retrieve filesystem information # Retrieve filesystem information
# -P use the POSIX output format for portability # -P use the POSIX output format for portability
my @df = `df -P`;
$cmd = 'df -PT' unless defined($cmd);
if ($inode_mode > 0) {
$cmd = 'df -PTi';
}
my @df = `$cmd`;
shift (@df); shift (@df);
# No filesystems? Something went wrong. # No filesystems? Something went wrong.
@ -102,9 +145,13 @@ my %out;
# Parse filesystem usage # Parse filesystem usage
foreach my $row (@df) { foreach my $row (@df) {
my @columns = split (' ', $row); my @columns = split (' ', $row);
exit 1 if ($#columns < 4); exit 1 if ($#columns < 5);
if (check_in (\%filesystems,$columns[0]) || ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0]) )) {
$out{$columns[0]} = $columns[4] ; next if (in_array(\@exclude_fs, $columns[1]) > 0);
if (check_in (\%filesystems,$columns[0])
|| ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0])) ){
$out{$columns[0]} = $columns[5] ;
} }
} }
@ -115,7 +162,7 @@ while (my ($filesystem, $use) = each (%out)) {
# Print module output # Print module output
print "<module>\n"; print "<module>\n";
print "<name><![CDATA[" . $filesystem . "]]></name>\n"; print "<name><![CDATA[" . ($inode_mode > 0 ? 'Inodes:' : '') . $filesystem . "]]></name>\n";
print "<type><![CDATA[generic_data]]></type>\n"; print "<type><![CDATA[generic_data]]></type>\n";
print "<data><![CDATA[" . $use . "]]></data>\n"; print "<data><![CDATA[" . $use . "]]></data>\n";
print "<description><![CDATA[% of usage in this volume]]></description>\n"; print "<description><![CDATA[% of usage in this volume]]></description>\n";

View File

@ -58,8 +58,17 @@ use strict;
use File::Basename; use File::Basename;
use Getopt::Std; use Getopt::Std;
use IO::Select; use IO::Select;
use IO::Compress::Zip qw(zip $ZipError); my $zlib_available = 1;
use IO::Uncompress::Unzip qw(unzip $UnzipError);
eval {
eval "use IO::Compress::Zip qw(zip);1" or die($@);
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
};
if ($@) {
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
$zlib_available = 0;
}
use Socket (qw(SOCK_STREAM AF_INET AF_INET6)); use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE = my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,7 +333,9 @@ sub parse_options {
# Compress data # Compress data
if (defined ($opts{'z'})) { if (defined ($opts{'z'})) {
$t_zip = 1; if ($zlib_available == 1) {
$t_zip = 1;
}
} }
} }
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file # Receive file
$zdata = recv_data_block ($size); $zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) { if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError"); print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n"); send_data ("ZRECV ERR\n");
return; return;
} }
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents # Read the file and compress its contents
if (! zip($file => \$data)) { if (! zip($file => \$data)) {
send_data ("QUIT\n"); send_data ("QUIT\n");
error ("Compression error: $ZipError"); error ("Compression error: $IO::Compress::Zip::ZipError");
return; return;
} }
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response."); error ("Server responded $response.");
} }
print_log ("Server responded SEND OK"); print_log ("Server responded ZSEND OK");
send_data ($data); send_data ($data);
# Wait for server response # Wait for server response

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas # (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.728 # Version 7.0NG.730
# This program is Free Software, you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public Licence as published by the Free Software

View File

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

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.728(Build 181025)") #define PANDORA_VERSION ("7.0NG.730(Build 190111)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.728(Build 181025))" VALUE "ProductVersion", "(7.0NG.730(Build 190111))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,10 +1,10 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.728-181025 Version: 7.0NG.730-190111
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin
Installed-Size: 42112 Installed-Size: 42112
Maintainer: Artica ST <deptec@artica.es> Maintainer: Artica ST <deptec@artica.es>
Homepage: http://pandorafms.org/ Homepage: http://pandorafms.org/
Depends: php5.6 | php5, php5.6-snmp | php5-snmp, php5.6-gd | php5-gd, php5.6-mysql | php5-mysql, php-db, php5.6-xmlrpc | php5-xmlrpc, php-gettext, php5.6-curl | php5-curl, graphviz, dbconfig-common, php5.6-ldap | php5-ldap, mysql-client | virtual-mysql-client Depends: php | php7.2, php7.2-snmp | php-snmp, php7.2-gd | php-gd, php7.2-mysqlnd | php-mysqlnd, php-db, php7.2-xmlrpc | php-xmlrpc, php-gettext, php7.2-curl | php-curl, graphviz, dbconfig-common, php7.2-ldap | php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc, php7.2-zip | php-zip
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process. Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.

View File

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

View File

@ -18,9 +18,8 @@ if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"
exit; exit;
} }
// Real start // Don't start a session before this import.
session_start(); // The session is configured and started inside the config process.
require_once ('include/config.php'); require_once ('include/config.php');
require_once ('include/functions.php'); require_once ('include/functions.php');
require_once ('include/functions_db.php'); require_once ('include/functions_db.php');
@ -82,7 +81,6 @@ if (isset($config['metaconsole'])) {
if ($config['metaconsole']) if ($config['metaconsole'])
define ('METACONSOLE', true); define ('METACONSOLE', true);
} }
session_write_close ();
if (file_exists ($page)) { if (file_exists ($page)) {
require_once ($page); require_once ($page);

View File

@ -0,0 +1,14 @@
{
"name": "Pandora FMS",
"description": "Pandora Flexible Monitoring System ",
"authors": [
{
"name": "Artica",
"email": "info@artica.es"
}
],
"require": {
"mpdf/mpdf": "^7.1",
"swiftmailer/swiftmailer": "^6.0"
}
}

442
pandora_console/composer.lock generated Normal file
View File

@ -0,0 +1,442 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "18364e5cd8c79657279985942190b4a7",
"packages": [
{
"name": "doctrine/lexer",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/lexer.git",
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Lexer\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"lexer",
"parser"
],
"time": "2014-09-09T13:34:57+00:00"
},
{
"name": "egulias/email-validator",
"version": "2.1.6",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786",
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786",
"shasum": ""
},
"require": {
"doctrine/lexer": "^1.0.1",
"php": ">= 5.5"
},
"require-dev": {
"dominicsayers/isemail": "dev-master",
"phpunit/phpunit": "^4.8.35||^5.7||^6.0",
"satooshi/php-coveralls": "^1.0.1"
},
"suggest": {
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Egulias\\EmailValidator\\": "EmailValidator"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eduardo Gulias Davis"
}
],
"description": "A library for validating emails against several RFCs",
"homepage": "https://github.com/egulias/EmailValidator",
"keywords": [
"email",
"emailvalidation",
"emailvalidator",
"validation",
"validator"
],
"time": "2018-09-25T20:47:26+00:00"
},
{
"name": "mpdf/mpdf",
"version": "v7.1.5",
"source": {
"type": "git",
"url": "https://github.com/mpdf/mpdf.git",
"reference": "2ed29c3a59fa23e77052e9d7fa7e31c707fb7502"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/2ed29c3a59fa23e77052e9d7fa7e31c707fb7502",
"reference": "2ed29c3a59fa23e77052e9d7fa7e31c707fb7502",
"shasum": ""
},
"require": {
"ext-gd": "*",
"ext-mbstring": "*",
"myclabs/deep-copy": "^1.7",
"paragonie/random_compat": "^1.4|^2.0|9.99.99",
"php": "^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0",
"psr/log": "^1.0",
"setasign/fpdi": "1.6.*"
},
"require-dev": {
"mockery/mockery": "^0.9.5",
"phpunit/phpunit": "^5.0",
"squizlabs/php_codesniffer": "^2.7.0",
"tracy/tracy": "^2.4"
},
"suggest": {
"ext-bcmath": "Needed for generation of some types of barcodes",
"ext-xml": "Needed mainly for SVG manipulation",
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-development": "7.0-dev"
}
},
"autoload": {
"psr-4": {
"Mpdf\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-only"
],
"authors": [
{
"name": "Matěj Humpál",
"role": "Developer, maintainer"
},
{
"name": "Ian Back",
"role": "Developer (retired)"
}
],
"description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support",
"homepage": "https://mpdf.github.io",
"keywords": [
"pdf",
"php",
"utf-8"
],
"time": "2018-09-19T09:58:39+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^4.1"
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
},
"files": [
"src/DeepCopy/deep_copy.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"time": "2017-10-19T19:58:43+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v9.99.99",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
"shasum": ""
},
"require": {
"php": "^7"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*",
"vimeo/psalm": "^1"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"polyfill",
"pseudorandom",
"random"
],
"time": "2018-07-02T15:55:56+00:00"
},
{
"name": "psr/log",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2016-10-10T12:19:37+00:00"
},
{
"name": "setasign/fpdi",
"version": "1.6.2",
"source": {
"type": "git",
"url": "https://github.com/Setasign/FPDI.git",
"reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6ad58897a6d97cc2d2cd2adaeda343b25a368ea",
"reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea",
"shasum": ""
},
"suggest": {
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.",
"setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.",
"setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF."
},
"type": "library",
"autoload": {
"classmap": [
"filters/",
"fpdi.php",
"fpdf_tpl.php",
"fpdi_pdf_parser.php",
"pdf_context.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jan Slabon",
"email": "jan.slabon@setasign.com",
"homepage": "https://www.setasign.com"
}
],
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
"homepage": "https://www.setasign.com/fpdi",
"keywords": [
"fpdf",
"fpdi",
"pdf"
],
"time": "2017-05-11T14:25:49+00:00"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.1.3",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4",
"reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4",
"shasum": ""
},
"require": {
"egulias/email-validator": "~2.0",
"php": ">=7.0.0"
},
"require-dev": {
"mockery/mockery": "~0.9.1",
"symfony/phpunit-bridge": "~3.3@dev"
},
"suggest": {
"ext-intl": "Needed to support internationalized email addresses",
"true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.1-dev"
}
},
"autoload": {
"files": [
"lib/swift_required.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Corbyn"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Swiftmailer, free feature-rich PHP mailer",
"homepage": "https://swiftmailer.symfony.com",
"keywords": [
"email",
"mail",
"mailer"
],
"time": "2018-09-11T07:12:52+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

View File

@ -472,7 +472,7 @@ function print_alerts_summary_modal_window($id, $alerts) {
if ($alert["times_fired"] > 0) { if ($alert["times_fired"] > 0) {
$status = STATUS_ALERT_FIRED; $status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times'); $title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
} }
elseif ($alert["disabled"] > 0) { elseif ($alert["disabled"] > 0) {
$status = STATUS_ALERT_DISABLED; $status = STATUS_ALERT_DISABLED;

View File

@ -14,52 +14,35 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
/*
function extension_db_status_extension_tables() {
return array(
'tbackup',
'tfiles_repo',
'tfiles_repo_group',
'tipam_ip',
'tipam_network',
'tuser_task',
'tuser_task_scheduled',
);
}
*/
function extension_db_status() { function extension_db_status() {
global $config; global $config;
$db_user = get_parameter('db_user', ''); $db_user = get_parameter('db_user', '');
$db_password = get_parameter('db_password', ''); $db_password = get_parameter('db_password', '');
$db_host = get_parameter('db_host', ''); $db_host = get_parameter('db_host', '');
$db_name = get_parameter('db_name', ''); $db_name = get_parameter('db_name', '');
$db_status_execute = (bool)get_parameter('db_status_execute', false); $db_status_execute = (bool)get_parameter('db_status_execute', false);
ui_print_page_header (__("DB Schema check"), ui_print_page_header (__("DB Schema check"),
"images/extensions.png", false, "", true, ""); "images/extensions.png", false, "", true, "");
if (!is_user_admin($config['id_user'])) { if (!is_user_admin($config['id_user'])) {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",
"Trying to access db status"); "Trying to access db status");
require ("general/noaccess.php"); require ("general/noaccess.php");
return; return;
} }
ui_print_info_message( ui_print_info_message(
__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.')); __('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.'));
ui_print_info_message( ui_print_info_message(
__('At the moment the checks is for MySQL/MariaDB.')); __('At the moment the checks is for MySQL/MariaDB.'));
echo "<form method='post'>"; echo "<form method='post'>";
echo "<fieldset>"; echo "<fieldset>";
echo "<legend>" . __('DB settings') . "</legend>"; echo "<legend>" . __('DB settings') . "</legend>";
$table = null; $table = new stdClass();
$table->data = array(); $table->data = array();
$row = array(); $row = array();
$row[] = __("DB User with privileges"); $row[] = __("DB User with privileges");
@ -75,175 +58,263 @@ function extension_db_status() {
$table->data[] = $row; $table->data[] = $row;
html_print_table($table); html_print_table($table);
echo "</fieldset>"; echo "</fieldset>";
echo "<div style='text-align: right;'>"; echo "<div style='text-align: right;'>";
html_print_input_hidden('db_status_execute', 1); html_print_input_hidden('db_status_execute', 1);
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"'); html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"');
echo "</div>"; echo "</div>";
echo "</form>"; echo "</form>";
if ($db_status_execute) { if ($db_status_execute) {
extension_db_status_execute_checks($db_user, $db_password, extension_db_status_execute_checks($db_user, $db_password,
$db_host, $db_name); $db_host, $db_name);
} }
} }
function extension_db_status_execute_checks($db_user, $db_password, $db_host, $db_name) { function extension_db_status_execute_checks($db_user, $db_password, $db_host, $db_name) {
global $config; global $config;
$connection_system = $config['dbconnection']; $connection_system = $config['dbconnection'];
// Avoid SQL injection // Avoid SQL injection
$db_name = io_safe_output($db_name); $db_name = io_safe_output($db_name);
$db_name = str_replace(';', ' ', $db_name); $db_name = str_replace(';', ' ', $db_name);
$db_name = explode(" ", $db_name); $db_name = explode(" ", $db_name);
$db_name = $db_name[0]; $db_name = $db_name[0];
$connection_test = mysql_connect ($db_host, $db_user, $db_password); if ($config["mysqli"] === true) {
$connection_test = mysqli_connect($db_host, $db_user, $db_password);
}
else{
$connection_test = mysql_connect($db_host, $db_user, $db_password);
}
if (!$connection_test) { if (!$connection_test) {
ui_print_error_message( ui_print_error_message(
__('Unsuccessful connected to the DB')); __('Unsuccessful connected to the DB'));
} }
else { else {
$create_db = mysql_query ("CREATE DATABASE `$db_name`"); if($config["mysqli"] === true){
$create_db = mysqli_query($connection_test, "CREATE DATABASE `$db_name`");
}else{
$create_db = mysql_query("CREATE DATABASE `$db_name`");
}
if (!$create_db) { if (!$create_db) {
ui_print_error_message( ui_print_error_message(
__('Unsuccessful created the testing DB')); __('Unsuccessful created the testing DB'));
} }
else { else {
mysql_select_db($db_name, $connection_test); if ($config["mysqli"] === true) {
mysqli_select_db($connection_test, $db_name);
}
else{
mysql_select_db($db_name, $connection_test);
}
$install_tables = extension_db_status_execute_sql_file( $install_tables = extension_db_status_execute_sql_file(
$config['homedir'] . "/pandoradb.sql", $config['homedir'] . "/pandoradb.sql",
$connection_test); $connection_test);
if (!$install_tables) { if (!$install_tables) {
ui_print_error_message( ui_print_error_message(
__('Unsuccessful installed tables into the testing DB')); __('Unsuccessful installed tables into the testing DB'));
} }
else {/* else {
if (enterprise_installed()) {
$install_tables_enterprise =
extension_db_status_execute_sql_file(
$config['homedir'] . "/enterprise/pandoradb.sql",
$connection_test);
if (!$install_tables_enterprise) {
ui_print_error_message(
__('Unsuccessful installed enterprise tables into the testing DB'));
}
}
*/
extension_db_check_tables_differences( extension_db_check_tables_differences(
$connection_test, $connection_test,
$connection_system, $connection_system,
$db_name, $db_name,
$config['dbname']); $config['dbname']);
//extension_db_check_data_differences();
} }
mysql_select_db($db_name, $connection_test); if ($config["mysqli"] === true) {
mysql_query ("DROP DATABASE IF EXISTS `$db_name`"); mysqli_select_db($connection_test, $db_name);
mysqli_query($connection_test, "DROP DATABASE IF EXISTS `$db_name`");
}
else{
mysql_select_db($db_name, $connection_test);
mysql_query("DROP DATABASE IF EXISTS `$db_name`", $connection_test);
}
} }
} }
} }
function extension_db_check_tables_differences($connection_test, function extension_db_check_tables_differences($connection_test,
$connection_system, $db_name_test, $db_name_system) { $connection_system, $db_name_test, $db_name_system) {
global $config; global $config;
// --------- Check the tables -------------------------------------- // --------- Check the tables --------------------------------------
mysql_select_db($db_name_test, $connection_test); if ($config["mysqli"] === true) {
$result = mysql_query("SHOW TABLES", $connection_test); mysqli_select_db($connection_test, $db_name_test);
$result = mysqli_query($connection_test, "SHOW TABLES");
}else{
mysql_select_db($db_name_test, $connection_test);
$result = mysql_query("SHOW TABLES", $connection_test);
}
$tables_test = array(); $tables_test = array();
while ($row = mysql_fetch_array ($result)) {
$tables_test[] = $row[0]; if ($config["mysqli"] === true) {
while ($row = mysqli_fetch_array($result)) {
$tables_test[] = $row[0];
}
mysqli_free_result($result);
mysqli_select_db($connection_test, $db_name_system);
$result = mysqli_query( $connection_test, "SHOW TABLES");
} }
mysql_free_result ($result); else{
//~ $tables_test = array_merge($tables_test, while ($row = mysql_fetch_array($result)) {
//~ extension_db_status_extension_tables()); $tables_test[] = $row[0];
}
mysql_select_db($db_name_system, $connection_test); mysql_free_result($result);
$result = mysql_query("SHOW TABLES", $connection_test);
mysql_select_db($db_name_system, $connection_test);
$result = mysql_query("SHOW TABLES", $connection_test);
}
$tables_system = array(); $tables_system = array();
while ($row = mysql_fetch_array ($result)) {
$tables_system[] = $row[0]; if ($config["mysqli"] === true) {
while ($row = mysqli_fetch_array ($result)) {
$tables_system[] = $row[0];
}
mysqli_free_result($result);
} }
mysql_free_result ($result); else{
while ($row = mysql_fetch_array ($result)) {
$tables_system[] = $row[0];
}
mysql_free_result($result);
}
$diff_tables = array_diff($tables_test, $tables_system); $diff_tables = array_diff($tables_test, $tables_system);
ui_print_result_message( ui_print_result_message(
!empty($diff_tables), !empty($diff_tables),
__('Success! %s DB contains all tables', get_product_name()), __('Success! %s DB contains all tables', get_product_name()),
__('%s DB could not retrieve all tables. The missing tables are (%s)', __('%s DB could not retrieve all tables. The missing tables are (%s)',
get_product_name(), implode(", ", $diff_tables))); get_product_name(), implode(", ", $diff_tables)));
if (!empty($diff_tables)) { if (!empty($diff_tables)) {
foreach ($diff_tables as $table) { foreach ($diff_tables as $table) {
mysql_select_db($db_name_test, $connection_test); if ($config["mysqli"] === true) {
$result = mysql_query("SHOW CREATE TABLE " . $table, $connection_test); mysqli_select_db($connection_test, $db_name_test);
$tables_test = array(); $result = mysqli_query($connection_test, "SHOW CREATE TABLE " . $table);
while ($row = mysql_fetch_array ($result)) { $tables_test = array();
ui_print_info_message( while ($row = mysql_fetch_array($result)) {
__('You can execute this SQL query for to fix.') . "<br />" . ui_print_info_message(
'<pre>' . __('You can execute this SQL query for to fix.') . "<br />" .
$row[1] . '<pre>' .
'</pre>' $row[1] .
); '</pre>'
);
}
mysqli_free_result($result);
}
else{
mysql_select_db($db_name_test, $connection_test);
$result = mysql_query("SHOW CREATE TABLE " . $table, $connection_test);
$tables_test = array();
while ($row = mysql_fetch_array($result)) {
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
$row[1] .
'</pre>'
);
}
mysql_free_result($result);
} }
mysql_free_result ($result);
} }
} }
// --------------- Check the fields ------------------------------- // --------------- Check the fields -------------------------------
$correct_fields = true; $correct_fields = true;
foreach ($tables_system as $table) { foreach ($tables_system as $table) {
if ($config["mysqli"] === true) {
mysql_select_db($db_name_test, $connection_test); mysqli_select_db($connection_test, $db_name_test);
$result = mysql_query("EXPLAIN " . $table, $connection_test); $result = mysqli_query($connection_test, "EXPLAIN " . $table);
}
else{
mysql_select_db($db_name_test, $connection_test);
$result = mysql_query("EXPLAIN " . $table, $connection_test);
}
$fields_test = array(); $fields_test = array();
if (!empty($result)) { if (!empty($result)) {
while ($row = mysql_fetch_array ($result)) { if ($config["mysqli"] === true) {
$fields_test[$row[0]] = array( while ($row = mysqli_fetch_array ($result)) {
'field ' => $row[0], $fields_test[$row[0]] = array(
'type' => $row[1], 'field ' => $row[0],
'null' => $row[2], 'type' => $row[1],
'key' => $row[3], 'null' => $row[2],
'default' => $row[4], 'key' => $row[3],
'extra' => $row[5]); 'default' => $row[4],
'extra' => $row[5]);
}
mysqli_free_result ($result);
mysqli_select_db($connection_test, $db_name_system);
}
else{
while ($row = mysql_fetch_array ($result)) {
$fields_test[$row[0]] = array(
'field ' => $row[0],
'type' => $row[1],
'null' => $row[2],
'key' => $row[3],
'default' => $row[4],
'extra' => $row[5]);
}
mysql_free_result ($result);
mysql_select_db($db_name_system, $connection_test);
} }
mysql_free_result ($result);
} }
if($config["mysqli"] === true){
$result = mysqli_query($connection_test, "EXPLAIN " . $table);
mysql_select_db($db_name_system, $connection_test); }
$result = mysql_query("EXPLAIN " . $table, $connection_test); else{
$result = mysql_query("EXPLAIN " . $table, $connection_test);
}
$fields_system = array(); $fields_system = array();
if (!empty($result)) { if (!empty($result)) {
while ($row = mysql_fetch_array ($result)) { if ($config["mysqli"] === true) {
$fields_system[$row[0]] = array( while ($row = mysqli_fetch_array ($result)) {
'field ' => $row[0], $fields_system[$row[0]] = array(
'type' => $row[1], 'field ' => $row[0],
'null' => $row[2], 'type' => $row[1],
'key' => $row[3], 'null' => $row[2],
'default' => $row[4], 'key' => $row[3],
'extra' => $row[5]); 'default' => $row[4],
'extra' => $row[5]);
}
mysqli_free_result($result);
}
else{
while ($row = mysql_fetch_array($result)) {
$fields_system[$row[0]] = array(
'field ' => $row[0],
'type' => $row[1],
'null' => $row[2],
'key' => $row[3],
'default' => $row[4],
'extra' => $row[5]);
}
mysql_free_result($result);
} }
mysql_free_result ($result);
} }
foreach ($fields_test as $name_field => $field_test) { foreach ($fields_test as $name_field => $field_test) {
if (!isset($fields_system[$name_field])) { if (!isset($fields_system[$name_field])) {
$correct_fields = false; $correct_fields = false;
ui_print_error_message( ui_print_error_message(
__('Unsuccessful the table %s has not the field %s', __('Unsuccessful the table %s has not the field %s',
$table, $name_field)); $table, $name_field));
@ -257,63 +328,59 @@ function extension_db_check_tables_differences($connection_test,
else { else {
$correct_fields = false; $correct_fields = false;
$field_system = $fields_system[$name_field]; $field_system = $fields_system[$name_field];
$diff = array_diff($field_test, $field_system); $diff = array_diff($field_test, $field_system);
if (!empty($diff)) { if (!empty($diff)) {
$info_message = ""; $info_message = "";
$error_message = ""; $error_message = "";
if($diff['type']){ if($diff['type']){
$error_message .= "Unsuccessful the field ".$name_field." in the table ".$table." must be set the type with ".$diff['type']."<br>"; $error_message .= "Unsuccessful the field ".$name_field." in the table ".$table." must be set the type with ".$diff['type']."<br>";
} }
if($diff['null']){ if($diff['null']){
$error_message .= "Unsuccessful the field $name_field in the table $table must be null: (".$diff['null'].").<br>"; $error_message .= "Unsuccessful the field $name_field in the table $table must be null: (".$diff['null'].").<br>";
} }
if($diff['default']){ if($diff['default']){
$error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.<br>"; $error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.<br>";
} }
if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){ if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){
$null_defect = " NULL"; $null_defect = " NULL";
} }
else{ else{
$null_defect = " NOT NULL"; $null_defect = " NOT NULL";
} }
if(!isset($field_test['default']) || $field_test['default'] == ""){ if(!isset($field_test['default']) || $field_test['default'] == ""){
$default_value = ""; $default_value = "";
} }
else{ else{
$default_value = " DEFAULT ".$field_test['default']; $default_value = " DEFAULT ".$field_test['default'];
} }
if($diff['type'] || $diff['null'] || $diff['default']){ if($diff['type'] || $diff['null'] || $diff['default']){
$info_message .= "ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . $default_value.";"; $info_message .= "ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . $default_value.";";
} }
if($diff['key']){ if($diff['key']){
$error_message .= "Unsuccessful the field $name_field in the table $table must be set the key as defined in the SQL file.<br>"; $error_message .= "Unsuccessful the field $name_field in the table $table must be set the key as defined in the SQL file.<br>";
$info_message .= "<br><br>Please check the SQL file for to know the kind of key needed."; $info_message .= "<br><br>Please check the SQL file for to know the kind of key needed.";
} }
if($diff['extra']){ if($diff['extra']){
$error_message .= "Unsuccessful the field $name_field in the table $table must be set as defined in the SQL file.<br>"; $error_message .= "Unsuccessful the field $name_field in the table $table must be set as defined in the SQL file.<br>";
$info_message .= "<br><br>Please check the SQL file for to know the kind of extra config needed."; $info_message .= "<br><br>Please check the SQL file for to know the kind of extra config needed.";
} }
ui_print_error_message( ui_print_error_message(__($error_message));
__($error_message));
ui_print_info_message(__($info_message));
ui_print_info_message(
__($info_message));
} }
} }
} }
} }
if ($correct_fields) { if ($correct_fields) {
ui_print_success_message( ui_print_success_message(
__('Successful all the tables have the correct fields') __('Successful all the tables have the correct fields')
@ -322,6 +389,7 @@ function extension_db_check_tables_differences($connection_test,
} }
function extension_db_status_execute_sql_file($url, $connection) { function extension_db_status_execute_sql_file($url, $connection) {
global $config;
if (file_exists($url)) { if (file_exists($url)) {
$file_content = file($url); $file_content = file($url);
$query = ""; $query = "";
@ -329,10 +397,19 @@ function extension_db_status_execute_sql_file($url, $connection) {
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) { if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
$query .= $sql_line; $query .= $sql_line;
if (preg_match("/;[\040]*\$/", $sql_line)) { if (preg_match("/;[\040]*\$/", $sql_line)) {
if (!$result = mysql_query($query, $connection)) { if ($config["mysqli"] === true) {
echo mysql_error(); //Uncomment for debug if (!$result = mysqli_query($connection, $query)) {
echo "<i><br>$query<br></i>"; echo mysqli_error(); //Uncomment for debug
return 0; echo "<i><br>$query<br></i>";
return 0;
}
}
else{
if (!$result = mysql_query($query, $connection)) {
echo mysql_error(); //Uncomment for debug
echo "<i><br>$query<br></i>";
return 0;
}
} }
$query = ""; $query = "";
} }

View File

@ -16,123 +16,80 @@
function dbmanager_query ($sql, &$error, $dbconnection) { function dbmanager_query ($sql, &$error, $dbconnection) {
global $config; global $config;
switch ($config["dbtype"]) {
case "mysql":
$retval = array();
if ($sql == '')
return false;
$sql = html_entity_decode($sql, ENT_QUOTES);
if ($config["mysqli"]) {
$result = mysqli_query ($dbconnection, $sql);
if ($result === false) {
$backtrace = debug_backtrace ();
$error = mysqli_error ($dbconnection);
return false;
}
}
else{
$result = mysql_query ($sql, $dbconnection);
if ($result === false) {
$backtrace = debug_backtrace ();
$error = mysql_error ();
return false;
}
}
if ($result === true) {
if($config["mysqli"]){
return mysqli_affected_rows ($dbconnection);
}
else{
return mysql_affected_rows ();
}
}
if($config["mysqli"]){
while ($row = mysqli_fetch_array ($result, MYSQL_ASSOC)) {
array_push ($retval, $row);
}
}
else{
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
array_push ($retval, $row);
}
}
if($config["mysqli"]){ $retval = array();
mysqli_free_result ($result);
} if ($sql == '')
else{ return false;
mysql_free_result ($result);
} $sql = html_entity_decode($sql, ENT_QUOTES);
if ($config["mysqli"]) {
if (! empty ($retval)) $result = mysqli_query ($dbconnection, $sql);
return $retval; if ($result === false) {
$backtrace = debug_backtrace ();
//Return false, check with === or !== $error = mysqli_error ($dbconnection);
return "Empty"; return false;
break; }
case "postgresql":
case "oracle":
$retval = array();
if ($sql == '')
return false;
$sql = html_entity_decode($sql, ENT_QUOTES);
$result = db_process_sql($sql, "affected_rows", '', false, $status);
//$result = mysql_query ($sql);
if ($result === false) {
$backtrace = debug_backtrace();
$error = db_get_last_error();
if (empty($error)) {
return "Empty";
}
return false;
}
if ($status == 2) {
return $result;
}
else {
return $result;
}
break;
} }
else{
$result = mysql_query ($sql, $dbconnection);
if ($result === false) {
$backtrace = debug_backtrace ();
$error = mysql_error ();
return false;
}
}
if ($result === true) {
if($config["mysqli"]){
return mysqli_affected_rows ($dbconnection);
}
else{
return mysql_affected_rows ();
}
}
if($config["mysqli"]){
while ($row = mysqli_fetch_array ($result, MYSQLI_ASSOC)) {
array_push ($retval, $row);
}
}
else{
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
array_push ($retval, $row);
}
}
if($config["mysqli"]){
mysqli_free_result ($result);
}
else{
mysql_free_result ($result);
}
if (! empty ($retval))
return $retval;
//Return false, check with === or !==
return "Empty";
} }
function dbmgr_extension_main () { function dbmgr_extension_main () {
ui_require_css_file ('dbmanager', 'extensions/dbmanager/'); ui_require_css_file ('dbmanager', 'extensions/dbmanager/');
global $config; global $config;
if (!is_user_admin($config['id_user'])) { if (!is_user_admin($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management"); db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php"); require ("general/noaccess.php");
return; return;
} }
/*
* Disabled at the moment.
if (!check_referer()) {
require ("general/noaccess.php");
return;
}
*/
$sql = (string) get_parameter ('sql'); $sql = (string) get_parameter ('sql');
ui_print_page_header (__('Database interface'), "images/gm_db.png", false, false, true); ui_print_page_header (__('Database interface'), "images/gm_db.png", false, false, true);
echo '<div class="notify">'; echo '<div class="notify">';
echo __("This is an advanced extension to interface with %s database directly from WEB console echo __("This is an advanced extension to interface with %s database directly from WEB console
using native SQL sentences. Please note that <b>you can damage</b> your %s installation using native SQL sentences. Please note that <b>you can damage</b> your %s installation
@ -142,10 +99,10 @@ function dbmgr_extension_main () {
with a depth knowledge of %s internals.", with a depth knowledge of %s internals.",
get_product_name(), get_product_name(), get_product_name()); get_product_name(), get_product_name(), get_product_name());
echo '</div>'; echo '</div>';
echo "<br />"; echo "<br />";
echo "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>"; echo "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
echo "<br /><br />"; echo "<br /><br />";
echo "<form method='post' action=''>"; echo "<form method='post' action=''>";
html_print_textarea ('sql', 5, 50, html_entity_decode($sql, ENT_QUOTES)); html_print_textarea ('sql', 5, 50, html_entity_decode($sql, ENT_QUOTES));
@ -155,45 +112,45 @@ function dbmgr_extension_main () {
html_print_submit_button (__('Execute SQL'), '', false, 'class="sub next"'); html_print_submit_button (__('Execute SQL'), '', false, 'class="sub next"');
echo '</div>'; echo '</div>';
echo "</form>"; echo "</form>";
// Processing SQL Code // Processing SQL Code
if ($sql == '') if ($sql == '')
return; return;
echo "<br />"; echo "<br />";
echo "<hr />"; echo "<hr />";
echo "<br />"; echo "<br />";
$dbconnection = $config['dbconnection']; $dbconnection = $config['dbconnection'];
$error = ''; $error = '';
$result = dbmanager_query ($sql, $error, $dbconnection); $result = dbmanager_query ($sql, $error, $dbconnection);
if ($result === false) { if ($result === false) {
echo '<strong>An error has occured when querying the database.</strong><br />'; echo '<strong>An error has occured when querying the database.</strong><br />';
echo $error; echo $error;
db_pandora_audit("DB Interface Extension", "Error in SQL", false, false, $sql); db_pandora_audit("DB Interface Extension", "Error in SQL", false, false, $sql);
return; return;
} }
if (! is_array ($result)) { if (! is_array ($result)) {
echo "<strong>Output: <strong>".$result; echo "<strong>Output: <strong>".$result;
db_pandora_audit("DB Interface Extension", "SQL", false, false, $sql); db_pandora_audit("DB Interface Extension", "SQL", false, false, $sql);
return; return;
} }
echo "<div style='overflow: auto;'>"; echo "<div style='overflow: auto;'>";
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$table->head = array_keys ($result[0]); $table->head = array_keys ($result[0]);
$table->data = $result; $table->data = $result;
html_print_table ($table); html_print_table ($table);
echo "</div>"; echo "</div>";
} }

View File

@ -61,17 +61,27 @@ function mainModuleGroups() {
$info = groupview_plain_groups($info); $info = groupview_plain_groups($info);
$counter = count($info); $counter = count($info);
$offset = get_parameter('offset', 0); $offset = get_parameter('offset', 0);
$groups_view = $is_not_paginated $agent_group_search = get_parameter('agent_group_search', '');
? $info $module_group_search = get_parameter('module_group_search', '');
: array_slice($info, $offset, $config['block_size']);
$agents_counters = array_reduce($groups_view, function($carry, $item){
$carry[$item['id']] = $item;
return $carry;
}, array());
$ids_array = array_keys($agents_counters); $info = array_filter($info, function($v, $k) use ($agent_group_search) {
return preg_match("/$agent_group_search/i", $v['name']);
}, ARRAY_FILTER_USE_BOTH);
$ids_group = implode(',', $ids_array); if (!empty($info)) {
$groups_view = $is_not_paginated
? $info
: array_slice($info, $offset, $config['block_size']);
$agents_counters = array_reduce($groups_view, function($carry, $item){
$carry[$item['id']] = $item;
return $carry;
}, array());
$ids_array = array_keys($agents_counters);
$ids_group = implode(',', $ids_array);
} else
$ids_group = -1;
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT); $condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT); $condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
@ -90,6 +100,12 @@ function mainModuleGroups() {
$array_module_group[$value['id_mg']] = $value['name']; $array_module_group[$value['id_mg']] = $value['name'];
} }
$array_module_group[0] = 'Nothing'; $array_module_group[0] = 'Nothing';
$array_module_group = array_filter($array_module_group, function($v, $k) use ($module_group_search) {
return preg_match("/$module_group_search/i", $v);
}, ARRAY_FILTER_USE_BOTH);
foreach ($agents_counters as $key => $value) { foreach ($agents_counters as $key => $value) {
$array_for_defect[$key]['gm'] = $array_module_group; $array_for_defect[$key]['gm'] = $array_module_group;
$array_for_defect[$key]['data']['name'] = $value['name']; $array_for_defect[$key]['data']['name'] = $value['name'];
@ -167,7 +183,26 @@ $sql =
ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, ''); ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, '');
if(count($array_for_defect) > 0){ echo "<table cellpadding='4' cellspacing='4' class='databox filters' width='100%' style='font-weight: bold; margin-bottom: 10px;'>
<tr>";
echo "<form method='post'
action='index.php?sec=view&sec2=extensions/module_groups'>";
echo "<td>";
echo __('Search by agent group') . '&nbsp;';
html_print_input_text ("agent_group_search", $agent_group_search);
echo "</td><td>";
echo __('Search by module group') . '&nbsp;';
html_print_input_text ("module_group_search", $module_group_search);
echo "</td><td>";
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>";
echo "</form>";
echo "<td>";
echo "</tr></table>";
if(true){
$table = new StdClass(); $table = new StdClass();
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;'; $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
$table->width = '100%'; $table->width = '100%';

View File

@ -30,7 +30,7 @@
}, },
yaxis: { yaxis: {
tickFormatter: function (value, axis) { tickFormatter: function (value, axis) {
return shortNumber(value); return shortNumber(roundToTwo(value)) ;
} }
}, },
series: { series: {
@ -178,6 +178,9 @@
return number + " " + shorts[pos]; return number + " " + shorts[pos];
} }
function roundToTwo(num) {
return +(Math.round(num + "e+2") + "e-2");
}
$('#graph').change(function() { $('#graph').change(function() {
$('form#realgraph').submit(); $('form#realgraph').submit();

View File

@ -16,14 +16,14 @@
if (isset($_GET['get_ptr'])) { if (isset($_GET['get_ptr'])) {
if ($_GET['get_ptr'] == 1) { if ($_GET['get_ptr'] == 1) {
session_start ();
session_write_close ();
$ownDir = dirname(__FILE__) . '/'; $ownDir = dirname(__FILE__) . '/';
$ownDir = str_replace("\\", "/", $ownDir); $ownDir = str_replace("\\", "/", $ownDir);
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ($ownDir.'../include/config.php'); require_once ($ownDir.'../include/config.php');
// Login check // Login check
if (!isset($_SESSION["id_usuario"])) { if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null; $config['id_user'] = null;

View File

@ -1,5 +1,22 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL default '0';
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL; ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(600) NOT NULL,
`id_group` int(10) unsigned default '0',
`id_custom_field` varchar(600) default '',
`id_custom_fields_data` varchar(600) default '',
`id_status` varchar(600) default '',
`module_search` varchar(600) default '',
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
COMMIT; COMMIT;

View File

@ -0,0 +1,11 @@
START TRANSACTION;
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `group_search` int(10) unsigned default '0';
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default '';
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0';
ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0;
COMMIT;

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical';
COMMIT;

View File

@ -54,7 +54,7 @@ $rows = db_get_all_rows_in_table('tupdate_settings');
$settings = new StdClass; $settings = new StdClass;
foreach ($rows as $row) { foreach ($rows as $row) {
$settings->$row['key'] = $row['value']; $settings->{$row['key']} = $row['value'];
} }
echo '<script type="text/javascript">'; echo '<script type="text/javascript">';

View File

@ -48,8 +48,6 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` (
`dynamic_interval` int(4) unsigned default '0', `dynamic_interval` int(4) unsigned default '0',
`dynamic_max` int(4) default '0', `dynamic_max` int(4) default '0',
`dynamic_min` int(4) default '0', `dynamic_min` int(4) default '0',
`dynamic_next` bigint(20) NOT NULL default '0',
`dynamic_two_tailed` tinyint(1) unsigned default '0',
`prediction_sample_window` int(10) default 0, `prediction_sample_window` int(10) default 0,
`prediction_samples` int(4) default 0, `prediction_samples` int(4) default 0,
`prediction_threshold` int(4) default 0, `prediction_threshold` int(4) default 0,
@ -58,6 +56,9 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` (
ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `tpolicy_modules` -- Table `tpolicy_modules`
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -125,8 +126,6 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
`dynamic_interval` int(4) unsigned default '0', `dynamic_interval` int(4) unsigned default '0',
`dynamic_max` int(4) default '0', `dynamic_max` int(4) default '0',
`dynamic_min` int(4) default '0', `dynamic_min` int(4) default '0',
`dynamic_next` bigint(20) NOT NULL default '0',
`dynamic_two_tailed` tinyint(1) unsigned default '0',
`prediction_sample_window` int(10) default 0, `prediction_sample_window` int(10) default 0,
`prediction_samples` int(4) default 0, `prediction_samples` int(4) default 0,
`prediction_threshold` int(4) default 0, `prediction_threshold` int(4) default 0,
@ -135,6 +134,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
UNIQUE (`id_policy`, `name`) UNIQUE (`id_policy`, `name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tpolicies` -- Table `tpolicies`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -181,6 +183,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` (
UNIQUE (`id_policy`, `id_agent`) UNIQUE (`id_policy`, `id_agent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0';
ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `tpolicy_groups` -- Table `tpolicy_groups`
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -292,6 +297,8 @@ CREATE TABLE IF NOT EXISTS `tagent_module_inventory` (
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tagent_module_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tpolicy_modules_inventory` -- Table `tpolicy_modules_inventory`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -310,6 +317,8 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules_inventory` (
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tpolicy_modules_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `tagente_datos_inventory` -- Table `tagente_datos_inventory`
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -341,18 +350,13 @@ CREATE TABLE IF NOT EXISTS `ttrap_custom_values` (
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` ( CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
`id` int(10) NOT NULL auto_increment primary key, `id` int(10) NOT NULL auto_increment primary key,
`server_name` text, `server_name` text default '',
`server_url` text, `server_url` text default '',
`dbuser` text, `dbuser` text default '',
`dbpass` text, `dbpass` text default '',
`dbhost` text, `dbhost` text default '',
`dbport` text, `dbport` text default '',
`dbname` text, `dbname` text default '',
`meta_dbuser` text,
`meta_dbpass` text,
`meta_dbhost` text,
`meta_dbport` text,
`meta_dbname` text,
`auth_token` text default '', `auth_token` text default '',
`id_group` int(10) unsigned NOT NULL default 0, `id_group` int(10) unsigned NOT NULL default 0,
`api_password` text NOT NULL, `api_password` text NOT NULL,
@ -362,6 +366,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
COMMENT = 'Table to store metaconsole sources' COMMENT = 'Table to store metaconsole sources'
DEFAULT CHARSET=utf8; DEFAULT CHARSET=utf8;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbuser` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbpass` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbhost` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbport` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbname` text;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tprofile_view` -- Table `tprofile_view`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -400,7 +410,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
`id_template_alert_warning` int(10) unsigned NOT NULL default 0, `id_template_alert_warning` int(10) unsigned NOT NULL default 0,
`id_template_alert_critical` int(10) unsigned NOT NULL default 0, `id_template_alert_critical` int(10) unsigned NOT NULL default 0,
`id_template_alert_unknown` int(10) unsigned NOT NULL default 0, `id_template_alert_unknown` int(10) unsigned NOT NULL default 0,
`id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0 `id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB ) ENGINE=InnoDB
COMMENT = 'Table to define services to monitor' COMMENT = 'Table to define services to monitor'
@ -548,6 +558,8 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
KEY `idx_id_event_alert` (`id_event_alert`) KEY `idx_id_event_alert` (`id_event_alert`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `tevent_alert` -- Table `tevent_alert`
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -744,14 +756,15 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`module_names` TEXT, `module_names` TEXT,
`module_free_text` TEXT, `module_free_text` TEXT,
`each_agent` tinyint(1) default 1, `each_agent` tinyint(1) default 1,
`historical_db` tinyint(1) UNSIGNED NOT NULL default 0,
`lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0',
`lapse` int(11) UNSIGNED NOT NULL default '300',
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
`hide_no_data` tinyint(1) default 0,
PRIMARY KEY(`id_rc`) PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE treport_content_template ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE treport_content_template ADD COLUMN `lapse_calc` tinyint(1) default '0';
ALTER TABLE treport_content_template ADD COLUMN `lapse` int(11) default '300';
ALTER TABLE treport_content_template ADD COLUMN `visual_format` tinyint(1) default '0';
ALTER TABLE treport_content_template ADD COLUMN `hide_no_data` tinyint(1) default '0';
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template) -- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -860,6 +873,9 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` (
-- Criticity: 5 - Minor -- Criticity: 5 - Minor
-- Criticity: 6 - Major -- Criticity: 6 - Major
ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL;
ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmetaconsole_event_history` -- Table `tmetaconsole_event_history`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -905,6 +921,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` (
-- Criticity: 5 - Minor -- Criticity: 5 - Minor
-- Criticity: 6 - Major -- Criticity: 6 - Major
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL;
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `textension_translate_string` -- Table `textension_translate_string`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -957,12 +975,10 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
`agent_version` varchar(100) default '', `agent_version` varchar(100) default '',
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00', `ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
`disabled` tinyint(2) NOT NULL default '0', `disabled` tinyint(2) NOT NULL default '0',
`remote` tinyint(1) NOT NULL default '0',
`id_parent` int(10) unsigned default '0', `id_parent` int(10) unsigned default '0',
`custom_id` varchar(255) default '', `custom_id` varchar(255) default '',
`server_name` varchar(100) default '', `server_name` varchar(100) default '',
`cascade_protection` tinyint(2) NOT NULL default '0', `cascade_protection` tinyint(2) NOT NULL default '0',
`cascade_protection_module` int(10) unsigned default '0',
`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' , `timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' ,
`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' , `icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' , `update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
@ -977,8 +993,6 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
`fired_count` bigint(20) NOT NULL default '0', `fired_count` bigint(20) NOT NULL default '0',
`update_module_count` tinyint(1) NOT NULL default '0', `update_module_count` tinyint(1) NOT NULL default '0',
`update_alert_count` tinyint(1) NOT NULL default '0', `update_alert_count` tinyint(1) NOT NULL default '0',
`transactional_agent` tinyint(1) NOT NULL default '0',
`alias` varchar(600) BINARY NOT NULL default '',
PRIMARY KEY (`id_agente`), PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)), KEY `nombre` (`nombre`(255)),
KEY `direccion` (`direccion`), KEY `direccion` (`direccion`),
@ -987,6 +1001,11 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `ttransaction` -- Table `ttransaction`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1159,8 +1178,8 @@ ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "
-- Table `talert_commands` -- Table `talert_commands`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria&#x20;IMS&#x20;Ticket'; UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria&#x20;IMS&#x20;Ticket';
UPDATE `talert_commands` SET `description` = 'This&#x20;alert&#x20;send&#x20;an&#x20;email&#x20;using&#x20;internal&#x20;Pandora&#x20;FMS&#x20;Server&#x20;SMTP&#x20;capabilities&#x20;&#40;defined&#x20;in&#x20;each&#x20;server,&#x20;using:&#x0d;&#x0a;_field1_&#x20;as&#x20;destination&#x20;email&#x20;address,&#x20;and&#x0d;&#x0a;_field2_&#x20;as&#x20;subject&#x20;for&#x20;message.&#x20;&#x0d;&#x0a;_field3_&#x20;as&#x20;text&#x20;of&#x20;message.&#x20;&#x0d;&#x0a;_field4_&#x20;as&#x20;content&#x20;type&#x20;&#40;text/plain&#x20;or&#x20;html/text&#41;.', `fields_descriptions` = '[\"Destination&#x20;address\",\"Subject\",\"Text\",\"Content&#x20;Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1; UPDATE `talert_commands` SET `description` = 'This&#x20;alert&#x20;send&#x20;an&#x20;email&#x20;using&#x20;internal&#x20;Pandora&#x20;FMS&#x20;Server&#x20;SMTP&#x20;capabilities&#x20;&#40;defined&#x20;in&#x20;each&#x20;server,&#x20;using:&#x0d;&#x0a;_field1_&#x20;as&#x20;destination&#x20;email&#x20;address,&#x20;and&#x0d;&#x0a;_field2_&#x20;as&#x20;subject&#x20;for&#x20;message.&#x20;&#x0d;&#x0a;_field3_&#x20;as&#x20;text&#x20;of&#x20;message.&#x20;&#x0d;&#x0a;_field4_&#x20;as&#x20;content&#x20;type&#x20;&#40;text/plain&#x20;or&#x20;html/text&#41;.', `fields_descriptions` = '[\"Destination&#x20;address\",\"Subject\",\"Text\",\"Content&#x20;Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1;
ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1; UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
@ -1180,13 +1199,13 @@ 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 ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); 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 ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 21); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 23);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); 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_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.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'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '728'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '730');
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tconfig_os` -- Table `tconfig_os`
@ -1230,6 +1249,8 @@ ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REF
ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0'; ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0';
alter table tusuario add autorefresh_white_list text not null default ''; alter table tusuario add autorefresh_white_list text not null default '';
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30'; ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_modulo` -- Table `tagente_modulo`
@ -1303,6 +1324,10 @@ ALTER TABLE tlayout_data ADD COLUMN `clock_animation` varchar(60) NOT NULL defau
ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time"; ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time";
ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid"; ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid";
ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0'; ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default';
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagent_custom_fields` -- Table `tagent_custom_fields`
@ -1356,26 +1381,15 @@ ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT ''; ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT '';
-- Table `tlocal_component`
-- ---------------------------------------------------------------------
ALTER TABLE tlocal_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE tlocal_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tpolicy_module` -- Table `tpolicy_module`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tpolicy_modules ADD COLUMN `ip_target`varchar(100) default ''; ALTER TABLE tpolicy_modules ADD COLUMN `ip_target`varchar(100) default '';
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT 0; ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmetaconsole_agent` -- Table `tmetaconsole_agent`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0'; ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0'; ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL default 0; ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL default 0;
@ -1540,6 +1554,8 @@ ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL defaul
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tsnmp_filter` -- Table `tsnmp_filter`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0;
SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter; SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter;
UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0; UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0;
@ -1730,7 +1746,7 @@ CREATE TABLE IF NOT EXISTS `tautoconfig_actions` (
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlayout_template` ( CREATE TABLE IF NOT EXISTS `tlayout_template` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL, `name` varchar(600) NOT NULL,
`id_group` INTEGER UNSIGNED NOT NULL, `id_group` INTEGER UNSIGNED NOT NULL,
`background` varchar(200) NOT NULL, `background` varchar(200) NOT NULL,
`height` INTEGER UNSIGNED NOT NULL default 0, `height` INTEGER UNSIGNED NOT NULL default 0,
@ -1776,11 +1792,15 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
`clock_animation` varchar(60) NOT NULL default "analogic_1", `clock_animation` varchar(60) NOT NULL default "analogic_1",
`time_format` varchar(60) NOT NULL default "time", `time_format` varchar(60) NOT NULL default "time",
`timezone` varchar(60) NOT NULL default "Europe/Madrid", `timezone` varchar(60) NOT NULL default "Europe/Madrid",
`show_last_value` tinyint(1) UNSIGNED NULL default '0',
`linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default',
`linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0,
`linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0,
`linked_layout_node_id` INT(10) NOT NULL default 0,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE tlayout_template_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tlog_graph_models` -- Table `tlog_graph_models`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1802,6 +1822,7 @@ INSERT INTO tlog_graph_models VALUES (1, 'Apache&#x20;log&#x20;model',
-- ----------------------------------------------------- -- -----------------------------------------------------
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0; ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1'; ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default ''; ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
@ -1810,3 +1831,40 @@ ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_method` varchar(25) NOT NULL def
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default ''; ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default '';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default ''; ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default '';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default ''; ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default '';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields_filter`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(600) NOT NULL,
`id_group` int(10) unsigned default '0',
`id_custom_field` varchar(600) default '',
`id_custom_fields_data` varchar(600) default '',
`id_status` varchar(600) default '',
`module_search` varchar(600) default '',
`module_status` varchar(600) default '',
`recursion` int(1) unsigned default '0',
`group_search` int(10) unsigned default '0',
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tevento`
-- ---------------------------------------------------------------------
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 `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
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -198,8 +198,12 @@ echo "<div class='modalgobutton gopandora'>
<script> <script>
$(".cerrar").click(function(){ $(".cerrar").click(function(){
$("#alert_messages").hide(); $("#alert_messages")
$( "#opacidad" ).remove(); .css('opacity', 0)
.hide();
$( "#opacidad" )
.css('opacity', 0)
.remove();
}); });
$(".gopandora").click(function(){ $(".gopandora").click(function(){

View File

@ -32,9 +32,7 @@ if (!$config["MR"]) {
echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">'; echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">';
if(enterprise_installed()){ include_once ($config["homedir"]."/include/functions_update_manager.php");
enterprise_include_once("../include/functions_update_manager.php");
}
$current_package = update_manager_get_current_package(); $current_package = update_manager_get_current_package();
@ -48,7 +46,7 @@ else{
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config["MR"])); echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config["MR"]));
echo '</a><br />'; echo '</a><br />';
echo '<a class="white footer">'. __('Page generated at') . ' '. date('F j, Y h:i a'); //Always use timestamp here echo '<a class="white footer">'. __('Page generated at') . ' '. date($config["date_format"]);
echo '</a><br /><span style="color:#eff">&reg; '.get_copyright_notice().'</span>'; echo '</a><br /><span style="color:#eff">&reg; '.get_copyright_notice().'</span>';
if (isset ($config['debug'])) { if (isset ($config['debug'])) {

View File

@ -70,9 +70,10 @@ switch ($login_screen) {
$logo_link = 'index.php'; $logo_link = 'index.php';
$logo_title = __('Refresh'); $logo_title = __('Refresh');
break; break;
$splash_title = __('Splash login');
} }
$splash_title = __('Splash login');
$url = '?login=1'; $url = '?login=1';
//These variables come from index.php //These variables come from index.php
if (!empty ($page) && !empty ($sec)) { if (!empty ($page) && !empty ($sec)) {
@ -303,7 +304,7 @@ echo '</div>';
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '') . '</div>'; echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '') . '</div>';
echo '</div>'; echo '</div>';
if ($process_error_message == '' && $mail != "") { if (!isset($process_error_message) && isset($mail)) {
echo '<div id="reset_correct" title="' . __('Password reset') . '">'; echo '<div id="reset_correct" title="' . __('Password reset') . '">';
echo '<div class="content_alert">'; echo '<div class="content_alert">';
echo '<div class="icon_message_alert">'; echo '<div class="icon_message_alert">';
@ -315,13 +316,13 @@ if ($process_error_message == '' && $mail != "") {
echo '<p>' . __('An email has been sent to your email address') . '</p>'; echo '<p>' . __('An email has been sent to your email address') . '</p>';
echo '</div>'; echo '</div>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button("Ok", 'reset_correct_button', false); html_print_submit_button("Ok", 'reset_correct_button', false);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
} }
else if ($process_error_message != '') { else if (isset($process_error_message)) {
echo '<div id="reset_correct" title="' . __('Password reset') . '">'; echo '<div id="reset_correct" title="' . __('Password reset') . '">';
echo '<div class="content_alert">'; echo '<div class="content_alert">';
echo '<div class="icon_message_alert">'; echo '<div class="icon_message_alert">';
@ -333,7 +334,7 @@ else if ($process_error_message != '') {
echo '<p>' . $process_error_message . '</p>'; echo '<p>' . $process_error_message . '</p>';
echo '</div>'; echo '</div>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button("Ok", 'reset_correct_button', false); html_print_submit_button("Ok", 'reset_correct_button', false);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
@ -341,7 +342,7 @@ else if ($process_error_message != '') {
} }
if ($correct_reset_pass_process != "") { if (isset($correct_reset_pass_process)) {
echo '<div id="final_process_correct" title="' . __('Password reset') . '">'; echo '<div id="final_process_correct" title="' . __('Password reset') . '">';
echo '<div class="content_alert">'; echo '<div class="content_alert">';
echo '<div class="icon_message_alert">'; echo '<div class="icon_message_alert">';
@ -353,7 +354,7 @@ if ($correct_reset_pass_process != "") {
echo '<p>' . $correct_reset_pass_process . '</p>'; echo '<p>' . $correct_reset_pass_process . '</p>';
echo '</div>'; echo '</div>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button("Ok", 'final_process_correct_button', false); html_print_submit_button("Ok", 'final_process_correct_button', false);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
@ -483,8 +484,8 @@ if($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig' |
} }
ui_require_css_file ('dialog'); ui_require_css_file ('dialog');
ui_require_css_file ('jquery-ui-1.10.0.custom'); ui_require_css_file ('jquery-ui.min');
ui_require_jquery_file('jquery-ui-1.10.0.custom'); ui_require_jquery_file('jquery-ui.min');
?> ?>
<?php <?php

View File

@ -92,8 +92,8 @@ echo '<div id="login_id_dialog" title="' .
if ($zone_selected == "") { if ($zone_selected == "") {
if ($config["timezone"] != "") { if ($config["timezone"] != "") {
list($zone) = explode("/", $config["timezone"]); $zone_array = explode("/", $config["timezone"]);
$zone_selected = $zone; $zone_selected = $zone_array[0];
} }
else { else {
$zone_selected = 'Europe'; $zone_selected = 'Europe';
@ -102,7 +102,7 @@ echo '<div id="login_id_dialog" title="' .
$timezones = timezone_identifiers_list(); $timezones = timezone_identifiers_list();
foreach ($timezones as $timezone) { foreach ($timezones as $timezone) {
if (strpos($timezone, $zone_selected) !== false) { if (strpos($timezone, $zone_selected) !== false) {
$timezone_country = preg_replace('/^.*\//', '', $timezone); $timezone_country = preg_replace('/^.*\//', '', $timezone);
$timezone_n[$timezone] = $timezone_country; $timezone_n[$timezone] = $timezone_country;
} }
@ -195,8 +195,9 @@ $("#language").click(function () {
{"page": "general/login_required", {"page": "general/login_required",
"change_language": change_language}, "change_language": change_language},
function (data) {} function (data) {}
); ).done(function () {
location.reload(); location.reload();
});
}); });
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////

View File

@ -335,11 +335,8 @@ $(document).ready( function() {
handsIn = 0; handsIn = 0;
handsIn2 = 0; handsIn2 = 0;
//Daniel maya 02/06/2016 Display menu with click --INI
if(!click_display){ if(!click_display){
//Daniel barbero 10/08/2016 Display menu with click --INI
if (autohidden_menu) { if (autohidden_menu) {
//Daniel barbero 10/08/2016 Display menu with click --END
$('.menu_icon').mouseenter(function() { $('.menu_icon').mouseenter(function() {
table_hover = $(this); table_hover = $(this);
handsIn = 1; handsIn = 1;
@ -359,37 +356,10 @@ $(document).ready( function() {
} }
}, 2500); }, 2500);
}); });
//Daniel barbero 10/08/2016 Display menu with click --INI
} else {
$('.menu_icon').mouseenter(function() {
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();
}).mouseleave(function() {
table_noHover = $(this);
handsIn = 0;
$("ul#sub"+table_hover[0].id).hide();
/*
setTimeout(function() {
opened = new Date().getTime() - openTime;
if(opened > 3000 && handsIn == 0) {
openTime = 4000;
$("ul#sub"+table_hover[0].id).hide();
}
}, 2500);
*/
});
} }
//Daniel barbero 10/08/2016 Display menu with click --END
}else{ }else{
$(document).ready(function() { $(document).ready(function() {
//Daniel barbero 10/08/2016 Display menu with click --INI
if (autohidden_menu) { if (autohidden_menu) {
//Daniel barbero 10/08/2016 Display menu with click --END
$('.menu_icon').on("click", function() { $('.menu_icon').on("click", function() {
if( typeof(table_hover) != 'undefined'){ if( typeof(table_hover) != 'undefined'){
$("ul#sub"+table_hover[0].id).hide(); $("ul#sub"+table_hover[0].id).hide();
@ -409,7 +379,6 @@ $(document).ready( function() {
} }
}, 5500); }, 5500);
}); });
//Daniel barbero 10/08/2016 Display menu with click --INI
} else { } else {
$('.menu_icon').on("click", function() { $('.menu_icon').on("click", function() {
if( typeof(table_hover) != 'undefined'){ if( typeof(table_hover) != 'undefined'){
@ -421,10 +390,8 @@ $(document).ready( function() {
$("ul#sub"+table_hover[0].id).show(); $("ul#sub"+table_hover[0].id).show();
}); });
} }
//Daniel barbero 10/08/2016 Display menu with click --END
}); });
} }
//Daniel maya 02/06/2016 Display menu with click --END
- $('.has_submenu').mouseenter(function() { - $('.has_submenu').mouseenter(function() {
table_hover2 = $(this); table_hover2 = $(this);

View File

@ -14,8 +14,10 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../include/config.php"); require_once ("../include/config.php");
require_once ("../include/functions.php"); require_once ("../include/functions.php");
require_once ("../include/functions_html.php"); require_once ("../include/functions_html.php");
?> ?>
@ -33,11 +35,6 @@ require_once ("../include/functions_html.php");
$id = get_parameter ('id'); $id = get_parameter ('id');
$id_user = get_parameter ('id_user'); $id_user = get_parameter ('id_user');
if (! isset($_SESSION['id_usuario'])) {
session_start();
session_write_close();
}
$user_language = get_user_language ($id_user); $user_language = get_user_language ($id_user);
if (file_exists ('../include/languages/'.$user_language.'.mo')) { if (file_exists ('../include/languages/'.$user_language.'.mo')) {

View File

@ -0,0 +1,67 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// 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; 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.
/**
* @package General
*/
global $config;
if ($config['language'] == 'es') {
$url_help = 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Instalaci%C3%B3n_y_actualizaci%C3%B3n_PHP_7';
}
else{
$url_help = 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:_PHP_7';
}
// Prints help dialog information
echo '<div id="login_help_dialog" title="PHP UPDATE REQUIRED" style="display: none;">';
echo '<div style="width:70%; font-size: 10pt; margin: 20px; float:left">';
echo "<p><b style='font-size: 10pt;'>" . __('For a correct operation of PandoraFMS, PHP must be updated to version 7.0 or higher.') . "</b></p>";
echo "<p style='font-size: 10pt;'><b>" . __('Otherwise, functionalities will be lost.') . "</b></p>";
echo "<ul>";
echo "<li style='padding:5px;'>" . __('Report download in PDF format') . "</li>";
echo "<li style='padding:5px;'>" . __('Emails Sending') . "</li>";
echo "<li style='padding:5px;'>" . __('Metaconsole Collections') . "</li>";
echo "<li style='padding:5px;'>" . '...' . "</li>";
echo "</ul>";
echo '<p><a target="blank" href="' . $url_help . '"><b>'.__('Access Help').'</b></a></p>';
echo '</div>';
echo "<div style='margin-top: 80px;'>";
echo html_print_image('images/icono_warning_mr.png', true, array("alt" => __('Warning php version'), "border" => 0));
echo "</div>";
echo '</div>';
?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("#login_help_dialog").dialog({
resizable: true,
draggable: true,
modal: true,
height: 320,
width: 550,
overlay: {
opacity: 0.5,
background: "black"
}
});
});
/* ]]> */
</script>

View File

@ -228,11 +228,11 @@ foreach ($result as $row) {
$rowPair = !$rowPair; $rowPair = !$rowPair;
$data = array(); $data = array();
$data[0] = $row["id_usuario"]; $data[0] = io_safe_output($row["id_usuario"]);
$data[1] = ui_print_session_action_icon($row["accion"], true) . $row["accion"]; $data[1] = ui_print_session_action_icon($row["accion"], true) . $row["accion"];
$data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true) $data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
. ui_print_timestamp($row["utimestamp"], true); . ui_print_timestamp($row["utimestamp"], true);
$data[3] = $row["ip_origen"]; $data[3] = io_safe_output($row["ip_origen"]);
$data[4] = io_safe_output($row["descripcion"]); $data[4] = io_safe_output($row["descripcion"]);
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {

View File

@ -484,7 +484,7 @@ $table->data[4][1] = __('Disabled') . ' ' .
$table->data[4][1] .= __('Enabled') . ' ' . $table->data[4][1] .= __('Enabled') . ' ' .
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true); html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
if (enterprise_installed()) { if (enterprise_installed()) {
$table->data[4][2] = __('Url address'); $table->data[4][2] = __('Url address') . ui_print_help_tip(__('URL address must be complete, for example: https://pandorafms.com/'), true);
$table->data[4][3] = html_print_input_text ('url_description', $table->data[4][3] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true); $url_description, '', 45, 255, true);
}else{ }else{

View File

@ -261,7 +261,7 @@ if ($snmpwalk) {
} }
if ($create_modules) { if ($create_modules) {
$modules = get_parameter("module", array()); $modules = io_safe_output(get_parameter("module", array()));
$devices = array(); $devices = array();
$processes = array(); $processes = array();

View File

@ -924,9 +924,8 @@ if ($update_agent) { // if modified some agent paramenter
enterprise_hook ('update_agent', array ($id_agente)); enterprise_hook ('update_agent', array ($id_agente));
ui_print_success_message (__('Successfully updated')); ui_print_success_message (__('Successfully updated'));
$unsafe_alias = io_safe_output($alias);
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Updated agent $unsafe_alias", false, false, $info); "Updated agent $alias", false, false, $info);
} }
} }
@ -1427,7 +1426,7 @@ if ($update_module) {
$edit_module = true; $edit_module = true;
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Fail to try update module '".io_safe_output($name)."' for agent " . io_safe_output($agent["alias"])); "Fail to try update module '$name' for agent " . $agent["alias"]);
} }
else { else {
if ($prediction_module == 3) { if ($prediction_module == 3) {
@ -1445,7 +1444,7 @@ if ($update_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente); $agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Updated module '".io_safe_output($name)."' for agent ". io_safe_output($agent["alias"]), false, false, io_json_mb_encode($values)); "Updated module '$name' for agent ".$agent["alias"], false, false, io_json_mb_encode($values));
} }
} }
@ -1586,7 +1585,7 @@ if ($create_module) {
$edit_module = true; $edit_module = true;
$moduletype = $id_module; $moduletype = $id_module;
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"])); "Fail to try added module '$name' for agent ".$agent["alias"]);
} }
else { else {
if ($prediction_module == 3) { if ($prediction_module == 3) {
@ -1604,7 +1603,7 @@ if ($create_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente); $agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"]), false, true, io_json_mb_encode($values)); "Added module '$name' for agent ".$agent["alias"], false, true, io_json_mb_encode($values));
} }
} }
@ -1727,7 +1726,7 @@ if ($delete_module) { // DELETE agent module !
$agent = db_get_row ('tagente', 'id_agente', $id_agente); $agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Deleted module '".io_safe_output($module_data["nombre"])."' for agent ".io_safe_output($agent["alias"])); "Deleted module '".$module_data["nombre"]."' for agent ".$agent["alias"]);
} }
@ -1760,11 +1759,11 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
if ($result) { if ($result) {
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"]) . " with the new id for clon " . $result); "Duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"] . " with the new id for clon " . $result);
} }
else { else {
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"])); "Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"]);
} }
} }
@ -1943,7 +1942,7 @@ switch ($tab) {
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter("id_agent_module"))); ?>'; var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter("id_agent_module"))); ?>';
if('<?php echo modules_get_agentmodule_name(get_parameter("id_agent_module")); ?>' != $('#text-name').val() && if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter("id_agent_module"))); ?>' != $('#text-name').val() &&
'<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter("id_agent_module"))); ?>' == 19){ '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter("id_agent_module"))); ?>' == 19){
event.preventDefault(); event.preventDefault();
@ -1977,7 +1976,7 @@ switch ($tab) {
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter("id_agent_module")); ?>'; var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter("id_agent_module")); ?>';
if('<?php echo modules_get_agentmodule_name(get_parameter("id_agent_module")); ?>' != $('#text-name').val() && ( if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter("id_agent_module"))); ?>' != $('#text-name').val() && (
module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){ module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){
event.preventDefault(); event.preventDefault();

View File

@ -481,15 +481,14 @@ if ($agents !== false) {
if($agent["id_os"] == 100){ if($agent["id_os"] == 100){
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']); $cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.$agent['nombre'].'</a>'; echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.$agent['alias'].'</a>';
}else{ }else{
echo "<a alt =".$agent["nombre"]." href='index.php?sec=gagente& echo "<a alt =".$agent["nombre"]." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab& sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=" . $agent["id_agente"] . "'>" . id_agente=" . $agent["id_agente"] . "'>" .
'<span style="font-size: 7pt" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span>' . '<span style="font-size: 7pt" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span>' .
"</a>"; "</a>";
} }
echo "</strong>"; echo "</strong>";
$in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime $in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime

View File

@ -313,7 +313,7 @@ $selectIntervalUp = '';
$selectIntervalDown = ''; $selectIntervalDown = '';
$sortField = get_parameter('sort_field'); $sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none'); $sort = get_parameter('sort', 'none');
$selected = 'border: 1px solid black;'; $selected = '';
$order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC'); $order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC');
@ -547,7 +547,8 @@ $table->head[7] = __('Warn');
$table->head[8] = __('Action'); $table->head[8] = __('Action');
$table->head[9] = '<span title="' . __('Delete') . '">' . __('D.') . '</span>'; $table->head[9] = '<span title="' . __('Delete') . '">' . __('Del.') . '</span>'.
html_print_checkbox('all_delete', 0, false, true, false);
$table->rowstyle = array(); $table->rowstyle = array();
$table->style = array (); $table->style = array ();
@ -778,12 +779,13 @@ foreach ($modules as $module) {
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) { if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
// Delete module // Delete module
$data[9] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
$data[9] .= '&nbsp;<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'" $data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'; onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[9] .= html_print_image ('images/cross.png', true, $data[9] .= html_print_image ('images/cross.png', true,
array ('title' => __('Delete'))); array ('title' => __('Delete')));
$data[9] .= '</a> '; $data[9] .= '</a> ';
$data[9] .= html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
} }
array_push ($table->data, $data); array_push ($table->data, $data);
@ -807,17 +809,32 @@ if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
<script type="text/javascript"> <script type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
$('[id^=checkbox-id_delete]').change(function(){ $('[id^=checkbox-id_delete]').change(function(){
if($(this).parent().parent().hasClass('checkselected')){ if($(this).parent().parent().hasClass('checkselected')){
$(this).parent().parent().removeClass('checkselected'); $(this).parent().parent().removeClass('checkselected');
} }
else{ else{
$(this).parent().parent().addClass('checkselected'); $(this).parent().parent().addClass('checkselected');
} }
}); });
});
$('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-id_delete]').parent().parent().addClass('checkselected');
$("[name^=id_delete").prop("checked", true);
}
else{
$('[id^=checkbox-id_delete]').parent().parent().removeClass('checkselected');
$("[name^=id_delete").prop("checked", false);
}
});
});
function change_mod_filter() { function change_mod_filter() {
var checked = $("#checkbox-status_hierachy_mode").is(":checked"); var checked = $("#checkbox-status_hierachy_mode").is(":checked");

View File

@ -573,18 +573,27 @@ ui_require_javascript_file ('pandora_modules');
?> ?>
<script language="javascript"> <script language="javascript">
/* <![CDATA[ */ /* <![CDATA[ */
var no_name_lang = "<?php echo __('No module name provided') ?>"; var no_name_lang =`
var no_target_lang = "<?php echo __('No target IP provided') ?>"; <?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No module name provided') ) ); ?>
var no_oid_lang = "<?php echo __('No SNMP OID provided') ?>"; `;
var no_prediction_module_lang = "<?php echo __('No module to predict') ?>"; var no_target_lang =`
var no_plugin_lang = "<?php echo __('No plug-in provided') ?>"; <?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No target IP provided') ) ); ?>
var no_execute_test_from = "<?php echo __('No server provided') ?>" `;
var no_oid_lang =`
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No SNMP OID provided') ) ); ?>
`;
var no_prediction_module_lang =`
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No module to predict') ) ); ?>
`;
var no_plugin_lang =`
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No plug-in provided') ) ); ?>
`;
var no_execute_test_from =`
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No server provided') ) ); ?>
`;
$(document).ready (function () { $(document).ready (function () {
configure_modules_form (); configure_modules_form ();
$("#module_form").submit(function() { $("#module_form").submit(function() {
if (typeof(check_remote_conf) != 'undefined') { if (typeof(check_remote_conf) != 'undefined') {

View File

@ -249,9 +249,10 @@ else {
$idModuleType = ''; $idModuleType = '';
} }
//Removed web analysis and log4x from select
$sql = sprintf ('SELECT id_tipo, descripcion $sql = sprintf ('SELECT id_tipo, descripcion
FROM ttipo_modulo FROM ttipo_modulo
WHERE categoria IN (%s) WHERE categoria IN (%s) AND id_tipo NOT IN (24, 25)
ORDER BY descripcion', ORDER BY descripcion',
implode (',', $categories)); implode (',', $categories));
@ -259,12 +260,6 @@ else {
$idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100); $idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100);
// Store the relation between id and name of the types on a hidden field // Store the relation between id and name of the types on a hidden field
$sql = sprintf ('SELECT id_tipo, nombre
FROM ttipo_modulo
WHERE categoria IN (%s)
ORDER BY descripcion',
implode (',', $categories));
$type_names = db_get_all_rows_sql($sql); $type_names = db_get_all_rows_sql($sql);
$type_names_hash = array(); $type_names_hash = array();
@ -439,7 +434,7 @@ $table_advanced->data[2][1] .= html_print_input_hidden ('moduletype', $moduletyp
$table_advanced->data[2][3] = __('Post process').' ' . ui_print_help_icon ('postprocess', true); $table_advanced->data[2][3] = __('Post process').' ' . ui_print_help_icon ('postprocess', true);
$table_advanced->data[2][4] = $table_advanced->data[2][4] =
html_print_extended_select_for_post_process('post_process', html_print_extended_select_for_post_process('post_process',
$post_process, '', '', '0', false, true, false, true, $post_process, '', '', '0', false, true, false, false,
$disabledBecauseInPolicy); $disabledBecauseInPolicy);
$table_advanced->colspan[2][4] = 3; $table_advanced->colspan[2][4] = 3;

View File

@ -13,9 +13,10 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
session_start (); // Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php"); require_once ("../../include/config.php");
require_once ("../../include/functions.php"); require_once ("../../include/functions.php");
require_once ("../../include/functions_db.php"); require_once ("../../include/functions_db.php");
require_once ("../../include/functions_users.php"); require_once ("../../include/functions_users.php");

View File

@ -57,7 +57,7 @@ else {
$sec = 'galertas'; $sec = 'galertas';
} }
if ((!$copy_action) && (!$delete_action) && (!$update_action)) { if ((!$copy_action) && (!$delete_action)) {
// Header // Header
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header (); alerts_meta_print_header ();
@ -141,135 +141,8 @@ if ($copy_action) {
__('Could not be copied')); __('Could not be copied'));
} }
if ($create_action) { if ($update_action || $create_action) {
$name = (string) get_parameter ('name'); alerts_ui_update_or_create_actions($update_action);
$id_alert_command = (int) get_parameter ('id_command');
$fields_descriptions = array();
$fields_values = array();
$info_fields = '';
$values = array();
for($i=1;$i<=$config['max_macro_fields'];$i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field'.$i.': ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
$info_fields .= ' Field'.$i.'Recovery: ' . $values['field'.$i.'_recovery'];
}
$values['id_group'] = (string) get_parameter ('group');
$values['action_threshold'] = (int) get_parameter ('action_threshold');
$name_check = db_get_value ('name', 'talert_actions', 'name', $name);
if ($name_check) {
$result = '';
}
else {
$result = alerts_create_alert_action ($name, $id_alert_command,
$values);
$info = '{"Name":"'.$name.'", "ID alert Command":"'.$id_alert_command.'", "Field information":"'.$info_fields.'", "Group":"'.$values['id_group'].'",
"Action threshold":"'.$values['action_threshold'].'"}';
}
if ($result) {
db_pandora_audit("Command management", "Create alert action #" . $result, false, false, $info);
}
else {
db_pandora_audit("Command management", "Fail try to create alert action", false, false);
}
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
if ($name == "") {
$messageAction = __('No name specified');
}
if ($id_alert_command == "") {
$messageAction = __('No command specified');
}
$messageAction = ui_print_result_message ($result,
__('Successfully created'),
$messageAction);
}
if ($update_action) {
$id = (string) get_parameter ('id');
$al_action = alerts_get_alert_action ($id);
if ($al_action !== false) {
if ($al_action['id_group'] == 0) {
if (! check_acl ($config['id_user'], 0, "PM")) {
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
}
else {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header ();
}
else {
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/gm_alerts.png", false, "alerts_config", true);
}
}
}
}
else {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header ();
}
else {
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/gm_alerts.png", false, "alerts_config", true);
}
}
$name = (string) get_parameter ('name');
$id_alert_command = (int) get_parameter ('id_command');
$group = get_parameter ('group');
$action_threshold = (int) get_parameter ('action_threshold');
$info_fields = '';
$values = array();
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field1: ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
$info_fields .= ' Field'.$i.'Recovery: ' . $values['field'.$i.'_recovery'];
}
$values['name'] = $name;
$values['id_alert_command'] = $id_alert_command;
$values['id_group'] = $group;
$values['action_threshold'] = $action_threshold;
if (!$name) {
$result = '';
}
else {
$result = alerts_update_alert_action ($id, $values);
}
if ($result) {
db_pandora_audit("Command management", "Update alert action #" . $id, false, false, json_encode($values));
}
else {
db_pandora_audit("Command management", "Fail try to update alert action #" . $id, false, false, json_encode($values));
}
ui_print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
} }
if ($delete_action) { if ($delete_action) {
@ -342,6 +215,7 @@ if ($delete_action) {
__('Could not be deleted')); __('Could not be deleted'));
} }
$table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$table->data = array (); $table->data = array ();
@ -363,9 +237,13 @@ $table->align[3] = 'left';
$filter = array(); $filter = array();
if (!is_user_admin($config['id_user'])) if (!is_user_admin($config['id_user']))
$filter['id_group'] = array_keys(users_get_groups(false, "LM")); $filter['talert_actions.id_group'] = array_keys(users_get_groups(false, "LM"));
$actions = db_get_all_rows_filter ('talert_actions', $filter); $actions = db_get_all_rows_filter (
'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id',
$filter,
'talert_actions.* , talert_commands.id_group AS command_group'
);
if ($actions === false) if ($actions === false)
$actions = array (); $actions = array ();
@ -380,11 +258,19 @@ foreach ($actions as $action) {
$iterator++; $iterator++;
$data = array (); $data = array ();
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'. $data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.
$action['name'].'</a>'; $action['name'].'</a>';
$data[1] = ui_print_group_icon ($action["id_group"], true) .'&nbsp;'; $data[1] = ui_print_group_icon ($action["id_group"], true) .'&nbsp;';
if (!alerts_validate_command_to_action($action["id_group"], $action["command_group"])) {
$data[1].= html_print_image(
"images/error.png",
true,
// FIXME: Translation.
array("title" => __("The action and the command associated with it do not have the same group. Please contact an administrator to fix it.")
));
}
if (check_acl($config['id_user'], $action["id_group"], "LM")) { if (check_acl($config['id_user'], $action["id_group"], "LM")) {
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'" $data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">' . onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">' .
@ -393,7 +279,7 @@ foreach ($actions as $action) {
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'. onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/cross.png", true) . '</a>'; html_print_image("images/cross.png", true) . '</a>';
} }
array_push ($table->data, $data); array_push ($table->data, $data);
} }
if (isset($data)) { if (isset($data)) {

View File

@ -38,6 +38,7 @@ $pure = (int)get_parameter('pure', 0);
$update_command = (bool) get_parameter ('update_command'); $update_command = (bool) get_parameter ('update_command');
$create_command = (bool) get_parameter ('create_command'); $create_command = (bool) get_parameter ('create_command');
$delete_command = (bool) get_parameter ('delete_command'); $delete_command = (bool) get_parameter ('delete_command');
$copy_command = (bool) get_parameter ('copy_command');
if (is_ajax ()) { if (is_ajax ()) {
$get_alert_command = (bool) get_parameter ('get_alert_command'); $get_alert_command = (bool) get_parameter ('get_alert_command');
@ -57,37 +58,13 @@ if (is_ajax ()) {
if (isset($command['description'])) { if (isset($command['description'])) {
$command['description'] = io_safe_input(str_replace("\r\n","<br>", io_safe_output($command['description']))); $command['description'] = io_safe_input(str_replace("\r\n","<br>", io_safe_output($command['description'])));
} }
// Descriptions are stored in json
// Get the html rows of the fields form $fields_descriptions = empty($command['fields_descriptions']) ?
switch ($config["dbtype"]) { '' : json_decode(io_safe_output($command['fields_descriptions']), true);
case "mysql": // Fields values are stored in json
case "postgresql": $fields_values = empty($command['fields_values']) ?
// Descriptions are stored in json '' : io_safe_output(json_decode($command['fields_values'], true));
$fields_descriptions = empty($command['fields_descriptions']) ?
'' : json_decode(io_safe_output($command['fields_descriptions']), true);
// Fields values are stored in json
$fields_values = empty($command['fields_values']) ?
'' : io_safe_output(json_decode($command['fields_values'], true));
break;
case "oracle":
// Descriptions are stored in json
$description_field = str_replace("\\\"","\"",$command['fields_descriptions']);
$description_field = str_replace("\\","",$description_field);
$fields_descriptions = empty($command['fields_descriptions']) ?
'' : json_decode(io_safe_output($description_field), true);
// Fields values are stored in json
$values_fields = str_replace("\\\"","\"",$command['fields_values']);
$values_fields = str_replace("\\","",$values_fields);
$fields_values = empty($command['fields_values']) ?
'' : io_safe_output(json_decode($values_fields, true));
break;
}
$fields_rows = array(); $fields_rows = array();
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -266,13 +243,11 @@ if (defined('METACONSOLE'))
else else
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert commands'), "images/gm_alerts.png", false, "alerts_config", true); ui_print_page_header (__('Alerts').' &raquo; '.__('Alert commands'), "images/gm_alerts.png", false, "alerts_config", true);
if ($create_command) { if ($create_command) {
$name = (string) get_parameter ('name'); $name = (string) get_parameter ('name');
$command = (string) get_parameter ('command'); $command = (string) get_parameter ('command');
$description = (string) get_parameter ('description'); $description = (string) get_parameter ('description');
$id_group = (string) get_parameter ('id_group', 0);
$fields_descriptions = array(); $fields_descriptions = array();
$fields_values = array(); $fields_values = array();
@ -287,7 +262,8 @@ if ($create_command) {
$values['fields_values'] = io_json_mb_encode($fields_values); $values['fields_values'] = io_json_mb_encode($fields_values);
$values['fields_descriptions'] = io_json_mb_encode($fields_descriptions); $values['fields_descriptions'] = io_json_mb_encode($fields_descriptions);
$values['description'] = $description; $values['description'] = $description;
$values['id_group'] = $id_group;
$name_check = db_get_value ('name', 'talert_commands', 'name', $name); $name_check = db_get_value ('name', 'talert_commands', 'name', $name);
if (!$name_check) { if (!$name_check) {
@ -349,8 +325,27 @@ if ($delete_command) {
ui_print_result_message ($result, ui_print_result_message ($result,
__('Successfully deleted'), __('Successfully deleted'),
__('Could not be deleted')); __('Could not be deleted'));
}
if ($copy_command) {
$id = (int) get_parameter ('id');
// Get the info from the source command
$command_to_copy = db_get_row('talert_commands', 'id', $id);
if ($command_to_copy === false) {
ui_print_error_message(__("Command with id $id does not found."));
} else {
// Prepare to insert the copy with same values
unset ($command_to_copy['id']);
$command_to_copy['name'].= __(' (copy)');
$result = db_process_sql_insert('talert_commands', $command_to_copy);
// Print the result
ui_print_result_message ($result,
__('Successfully copied'),
__('Could not be copied')
);
}
} }
$table->width = '100%'; $table->width = '100%';
@ -358,45 +353,54 @@ $table->class = 'databox data';
$table->data = array (); $table->data = array ();
$table->head = array (); $table->head = array ();
$table->head[0] = __('Name'); $table->head['name'] = __('Name');
$table->head[1] = __('ID'); $table->head['id'] = __('ID');
$table->head[2] = __('Description'); $table->head['group'] = __('Group');
$table->head[3] = __('Delete'); $table->head['description'] = __('Description');
$table->head['action'] = __('Actions');
$table->style = array (); $table->style = array ();
$table->style[0] = 'font-weight: bold'; $table->style['name'] = 'font-weight: bold';
$table->size = array (); $table->size = array ();
$table->size[3] = '40px'; $table->size['action'] = '40px';
$table->align = array (); $table->align = array ();
$table->align[3] = 'left'; $table->align['action'] = 'left';
$commands = db_get_all_rows_in_table ('talert_commands'); $commands = db_get_all_rows_filter(
if ($commands === false) 'talert_commands',
$commands = array (); array('id_group' => array_keys(users_get_groups(false, "LM")))
);
if ($commands === false) $commands = array ();
foreach ($commands as $command) { foreach ($commands as $command) {
$data = array (); $data = array ();
$data[0] = '<span style="font-size: 7.5pt">'; $data['name'] = '<span style="font-size: 7.5pt">';
if (! $command['internal']) if (! $command['internal'])
$data[0] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&id='.$command['id'].'&pure='.$pure.'">'. $data['name'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&id='.$command['id'].'&pure='.$pure.'">'.
$command['name'].'</a>'; $command['name'].'</a>';
else else
$data[0] .= $command['name']; $data['name'] .= $command['name'];
$data[0] .= '</span>'; $data['name'] .= '</span>';
$data[1] = $command['id']; $data['id'] = $command['id'];
$data[2] = str_replace("\r\n","<br>", $data['group'] = ui_print_group_icon ($command["id_group"], true);
$data['description'] = str_replace("\r\n","<br>",
io_safe_output($command['description'])); io_safe_output($command['description']));
$data[3] = ''; $data['action'] = '';
if (! $command['internal']) { if (! $command['internal']) {
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'" $data['action'] = '<span style="display: inline-flex">';
$data['action'].= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/copy.png", true) . '</a>';
$data['action'].= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'. onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/cross.png", true) . '</a>'; html_print_image("images/cross.png", true) . '</a>';
$data['action'].= '</span>';
} }
array_push ($table->data, $data); array_push ($table->data, $data);
} }
if (isset($data)) { if (count($table->data) > 0) {
html_print_table ($table); html_print_table ($table);
} }
else { else {

View File

@ -65,6 +65,8 @@ if (! $id_agente) {
$params['selectbox_id'] = 'id_agent_module'; $params['selectbox_id'] = 'id_agent_module';
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$params['metaconsole_enabled'] = false; $params['metaconsole_enabled'] = false;
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$table->data['agent'][1] = ui_print_agent_autocomplete_input($params); $table->data['agent'][1] = ui_print_agent_autocomplete_input($params);
} }
@ -137,20 +139,18 @@ if (check_acl ($config['id_user'], 0, "LM")) {
$table->data[3][1] .= ' ' . __('seconds') . ui_print_help_icon ('action_threshold', true); $table->data[3][1] .= ' ' . __('seconds') . ui_print_help_icon ('action_threshold', true);
if (!isset($step) || $step!=5) { if (!isset($step)) {
echo '<form class="add_alert_form" method="post">'; echo '<form class="add_alert_form" method="post">';
html_print_table ($table); html_print_table ($table);
} }
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
if (!isset($step) || $step!=5) { if (!isset($step)) {
if($id_cluster){ if($id_cluster){
echo "<input onclick='window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");' type=button style='float:right;margin-left:20px;' name='store' class='sub upd' value='".__('Finish and view cluster')."'>"; echo "<input onclick='window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");' type=button style='float:right;margin-left:20px;' name='store' class='sub upd' value='".__('Finish and view cluster')."'>";
} }
html_print_submit_button (__('Add alert'), 'add', false, 'class="sub wand"'); html_print_submit_button (__('Add alert'), 'add', false, 'class="sub wand"');
html_print_input_hidden ('create_alert', 1); html_print_input_hidden ('create_alert', 1);
echo '</div></form>'; echo '</div></form>';
@ -223,7 +223,7 @@ $(document).ready (function () {
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>"); $("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
} }
else { else {
$("#value", $value).append (parseInt(data)); $("#value", $value).append (data);
} }
$loading.hide (); $loading.hide ();
$value.show (); $value.show ();

View File

@ -102,16 +102,8 @@ if ($groups_user === false) {
$groups_id = implode(',', array_keys($groups_user)); $groups_id = implode(',', array_keys($groups_user));
$form_filter .= "<tr>"; $form_filter .= "<tr>";
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);");
break;
case "oracle":
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id)");
break;
}
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);");
$arrayActions = array(); $arrayActions = array();
if (is_array($temp)) { if (is_array($temp)) {
foreach ($temp as $actionElement) { foreach ($temp as $actionElement) {
@ -186,23 +178,10 @@ if ($searchFlag) {
field3_recovery LIKE '%" . trim($fieldContent) . "%')"; field3_recovery LIKE '%" . trim($fieldContent) . "%')";
if (strlen(trim($moduleName)) > 0) if (strlen(trim($moduleName)) > 0)
$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE '%" . trim($moduleName) . "%')"; $where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE '%" . trim($moduleName) . "%')";
//if ($agentID != -1)
//$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = " . $agentID . ")";
if (strlen(trim($agentName)) > 0) { if (strlen(trim($agentName)) > 0) {
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
switch ($config["dbtype"]) { FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
case "mysql": WHERE t1.alias LIKE '" . trim($agentName) . "')";
case "postgresql":
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
WHERE t1.alias LIKE '" . trim($agentName) . "')";
break;
case "oracle":
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
WHERE t1.alias LIKE '" . trim($agentName) . "')";
break;
}
} }
if ($actionID != -1 && $actionID != '') if ($actionID != -1 && $actionID != '')
$where .= " AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = " . $actionID . ")"; $where .= " AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = " . $actionID . ")";
@ -212,17 +191,7 @@ if ($searchFlag) {
$where .= " AND talert_template_modules.standby = " . $standby; $where .= " AND talert_template_modules.standby = " . $standby;
} }
switch ($config["dbtype"]) { $id_agents = array_keys ($agents);
case "mysql":
case "postgresql":
$id_agents = array_keys ($agents);
break;
case "oracle":
$id_agents = false;
break;
}
$total = agents_get_alerts_simple ($id_agents, false, $total = agents_get_alerts_simple ($id_agents, false,
false, $where, false, false, false, true); false, $where, false, false, false, true);
@ -645,7 +614,7 @@ foreach ($simple_alerts as $alert) {
if ($alert["times_fired"] > 0) { if ($alert["times_fired"] > 0) {
$status = STATUS_ALERT_FIRED; $status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times'); $title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
} }
elseif ($alert["disabled"] > 0) { elseif ($alert["disabled"] > 0) {
$status = STATUS_ALERT_DISABLED; $status = STATUS_ALERT_DISABLED;
@ -704,27 +673,32 @@ foreach ($simple_alerts as $alert) {
// To manage alert is necessary LW permissions in the agent group // To manage alert is necessary LW permissions in the agent group
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) { if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) {
$data[4] .= '&nbsp;&nbsp;<form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">'; $data[4] .= '&nbsp;&nbsp;<form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">';
if ($alert['disabled']) { $is_cluster = (bool)get_parameter('id_cluster');
if (!$is_cluster) {
} if ($alert['disabled']) {
else { $data[4] .= html_print_image('images/add.disabled.png',
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">'; true, array('title' => __("Add action")));
}
$data[4] .= '</a>'; else {
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
$data[4] .= html_print_image('images/add.png', true, array('title' => __("Add action")));
$data[4] .= '</a>';
}
} }
$data[4] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete'))); $data[4] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete')));
$data[4] .= html_print_input_hidden ('delete_alert', 1, true); $data[4] .= html_print_input_hidden ('delete_alert', 1, true);
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true); $data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[4] .= '</form>'; $data[4] .= '</form>';
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;">'; if ($is_cluster) {
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;">';
$data[4] .= html_print_input_image ('update', 'images/builder.png', 1, '', true, array('title' => __('Update'))); $data[4] .= html_print_input_image ('update', 'images/builder.png', 1, '', true, array('title' => __('Update')));
$data[4] .= html_print_input_hidden ('upd_alert', 1, true); $data[4] .= html_print_input_hidden ('upd_alert', 1, true);
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true); $data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$data[4] .= '</form>'; $data[4] .= '</form>';
}
} }
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) { if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {

View File

@ -112,8 +112,14 @@ if ($create_special_day) {
$values = array(); $values = array();
$values['id_group'] = (string) get_parameter ('id_group'); $values['id_group'] = (string) get_parameter ('id_group');
$values['description'] = (string) get_parameter ('description'); $values['description'] = (string) get_parameter ('description');
list($year, $month, $day) = explode("-", $date);
$array_date = explode("-", $date);
$year = $array_date[0];
$month = $array_date[1];
$day = $array_date[2];
if ($year == '*') { if ($year == '*') {
# '0001' means every year. # '0001' means every year.
$year = '0001'; $year = '0001';
@ -165,20 +171,25 @@ if ($update_special_day) {
$description = (string) get_parameter ('description'); $description = (string) get_parameter ('description');
$id_group = (string) get_parameter ('id_group'); $id_group = (string) get_parameter ('id_group');
$id_group_orig = (string) get_parameter ('id_group_orig'); $id_group_orig = (string) get_parameter ('id_group_orig');
list($year, $month, $day) = explode("-", $date); $array_date = explode("-", $date);
$year = $array_date[0];
$month = $array_date[1];
$day = $array_date[2];
if ($year == '*') { if ($year == '*') {
# '0001' means every year. # '0001' means every year.
$year = '0001'; $year = '0001';
$date = $year . '-' . $month . '-' . $day; $date = $year . '-' . $month . '-' . $day;
} }
$values = array (); $values = array ();
$values['date'] = $date; $values['date'] = $date;
$values['id_group'] = $id_group; $values['id_group'] = $id_group;
$values['same_day'] = $same_day; $values['same_day'] = $same_day;
$values['description'] = $description; $values['description'] = $description;
if (!checkdate ($month, $day, $year)) { if (!checkdate ($month, $day, $year)) {
$result = ''; $result = '';
} }

View File

@ -82,7 +82,7 @@ $table_details->data[] = $data;
if ($alert["times_fired"] > 0) { if ($alert["times_fired"] > 0) {
$status = STATUS_ALERT_FIRED; $status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times'); $title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
} }
elseif ($alert["disabled"] > 0) { elseif ($alert["disabled"] > 0) {
$status = STATUS_ALERT_DISABLED; $status = STATUS_ALERT_DISABLED;

View File

@ -122,7 +122,6 @@ $table->colspan[0][1] = 2;
$table->data[1][0] = __('Group'); $table->data[1][0] = __('Group');
$groups = users_get_groups ();
$own_info = get_user_info ($config['id_user']); $own_info = get_user_info ($config['id_user']);
// Only display group "All" if user is administrator or has "PM" privileges // Only display group "All" if user is administrator or has "PM" privileges
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
@ -133,9 +132,17 @@ $table->data[1][1] = html_print_select_groups(false, "LW", $display_all_group, '
$table->colspan[1][1] = 2; $table->colspan[1][1] = 2;
$table->data[2][0] = __('Command'); $table->data[2][0] = __('Command');
$table->data[2][1] = html_print_select_from_sql ('SELECT id, name $commands_sql = db_get_all_rows_filter(
FROM talert_commands', 'talert_commands',
'id_command', $id_command, '', __('None'), 0, true); array('id_group' => array_keys(users_get_groups(false, "LW"))),
array('id', 'name'),
'AND',
false,
true
);
$table->data[2][1] = html_print_select_from_sql ($commands_sql, 'id_command', $id_command,
'', __('None'), 0, true
);
$table->data[2][1] .= ' '; $table->data[2][1] .= ' ';
if (check_acl ($config['id_user'], 0, "PM")) { if (check_acl ($config['id_user'], 0, "PM")) {
$table->data[2][1] .= html_print_image ('images/add.png', true); $table->data[2][1] .= html_print_image ('images/add.png', true);
@ -282,6 +289,19 @@ $(document).ready (function () {
var max_fields = parseInt('<?php echo $config["max_macro_fields"]; ?>'); var max_fields = parseInt('<?php echo $config["max_macro_fields"]; ?>');
// Change the selected group
$("#group option").each(function(index, value) {
var current_group = $(value).val();
if (data.id_group != 0 && current_group != 0 && current_group != data.id_group) {
$(value).hide();
} else {
$(value).show();
}
});
if (data.id_group != 0 && $("#group").val() != data.id_group) {
$("#group").val(0);
}
for (i = 1; i <= max_fields; i++) { for (i = 1; i <= max_fields; i++) {
var old_value = ''; var old_value = '';
var old_recovery_value = ''; var old_recovery_value = '';

View File

@ -54,6 +54,7 @@ if ($update_command) {
$name = (string) get_parameter ('name'); $name = (string) get_parameter ('name');
$command = (string) get_parameter ('command'); $command = (string) get_parameter ('command');
$description = (string) get_parameter ('description'); $description = (string) get_parameter ('description');
$id_group = (string) get_parameter ('id_group', 0);
$fields_descriptions = array(); $fields_descriptions = array();
$fields_values = array(); $fields_values = array();
@ -71,7 +72,8 @@ if ($update_command) {
$values['name'] = $name; $values['name'] = $name;
$values['command'] = $command; $values['command'] = $command;
$values['description'] = $description; $values['description'] = $description;
$values['id_group'] = $id_group;
//Check it the new name is used in the other command. //Check it the new name is used in the other command.
$id_check = db_get_value ('id', 'talert_commands', 'name', $name); $id_check = db_get_value ('id', 'talert_commands', 'name', $name);
if (($id_check != $id) && (!empty($id_check))) { if (($id_check != $id) && (!empty($id_check))) {
@ -100,12 +102,13 @@ $command = '';
$description = ''; $description = '';
$fields_descriptions = ''; $fields_descriptions = '';
$fields_values = ''; $fields_values = '';
$id_group = 0;
if ($id) { if ($id) {
$alert = alerts_get_alert_command ($id); $alert = alerts_get_alert_command ($id);
$name = $alert['name']; $name = $alert['name'];
$command = $alert['command']; $command = $alert['command'];
$description = $alert['description']; $description = $alert['description'];
$id_group = $alert['id_group'];
$fields_descriptions = $alert['fields_descriptions']; $fields_descriptions = $alert['fields_descriptions'];
$fields_values = $alert['fields_values']; $fields_values = $alert['fields_values'];
} }
@ -123,13 +126,7 @@ $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
if ($id) { $table->head[0] = ($id) ? __('Update Command') : __('Create Command');
$table->head[0] = __('Update Command');
}
else {
$table->head[0] = __('Create Command');
}
$table->head_colspan[0] = 4; $table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center'; $table->headstyle[0] = 'text-align: center';
} }
@ -142,18 +139,25 @@ $table->size = array ();
$table->size[0] = '20%'; $table->size[0] = '20%';
$table->data = array (); $table->data = array ();
$table->colspan[0][1] = 3; $table->colspan['name'][1] = 3;
$table->data[0][0] = __('Name'); $table->data['name'][0] = __('Name');
$table->data[0][2] = html_print_input_text ('name', $name, '', 35, 255, true); $table->data['name'][2] = html_print_input_text ('name', $name, '', 35, 255, true);
$table->colspan[1][1] = 3; $table->colspan['command'][1] = 3;
$table->data[1][0] = __('Command'); $table->data['command'][0] = __('Command');
$table->data[1][0] .= ui_print_help_icon ('alert_macros', true); $table->data['command'][0] .= ui_print_help_icon ('alert_macros', true);
$table->data[1][1] = html_print_textarea ('command', 8, 30, $command, '', true); $table->data['command'][1] = html_print_textarea ('command', 8, 30, $command, '', true);
$table->colspan['group'][1] = 3;
$table->data['group'][0] = __('Group');
$table->data['group'][1] = html_print_select_groups(false, "LM",
true, 'id_group', $id_group, false,
'', 0, true);
$table->colspan['description'][1] = 3;
$table->data['description'][0] = __('Description');
$table->data['description'][1] = html_print_textarea ('description', 10, 30, $description, '', true);
$table->colspan[2][1] = 3;
$table->data[2][0] = __('Description');
$table->data[2][1] = html_print_textarea ('description', 10, 30, $description, '', true);
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {

View File

@ -12,19 +12,17 @@
$ownDir = dirname(__FILE__) . '/'; $ownDir = dirname(__FILE__) . '/';
$ownDir = str_replace("\\", "/", $ownDir); $ownDir = str_replace("\\", "/", $ownDir);
require_once($ownDir . "../include/config.php");
require_once($config["homedir"] . "/include/functions.php"); // Don't start a session before this import.
require_once($config["homedir"] . "/include/functions_db.php"); // The session is configured and started inside the config process.
require_once($config["homedir"] . "/include/auth/mysql.php"); require_once ($ownDir . "../include/config.php");
require_once ($config["homedir"] . "/include/functions.php");
require_once ($config["homedir"] . "/include/functions_db.php");
require_once ($config["homedir"] . "/include/auth/mysql.php");
global $config; global $config;
if (! isset($_SESSION["id_usuario"])) {
session_start();
session_write_close();
}
// Login check // Login check
if (!isset($_SESSION["id_usuario"])) { if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null; $config['id_user'] = null;

View File

@ -229,15 +229,31 @@ $(document).ready (function () {
}); });
$("#left").click (function () { $("#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) { jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
field_name = $(value).html(); field_name = $(value).html();
if (field_name != <?php echo "'".__('None')."'"; ?>) { selected_fields.push(field_name);
id_field = $(value).attr('value'); selected_fields_total = selected_fields.length;
$("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();
}
}); });
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 () { $("#submit-upd_button").click(function () {
@ -247,4 +263,16 @@ $(document).ready (function () {
}); });
}); });
}); });
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> </script>

View File

@ -111,7 +111,7 @@ $table->head[2] = __('Event type');
$table->head[3] = __('Event status'); $table->head[3] = __('Event status');
$table->head[4] = __('Severity'); $table->head[4] = __('Severity');
$table->head[5] = __('Action') . $table->head[5] = __('Action') .
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();'); html_print_checkbox('all_delete', 0, false, true, false);
$table->style = array (); $table->style = array ();
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->align = array (); $table->align = array ();
@ -178,12 +178,32 @@ echo "</div>";
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function check_all_checkboxes() {
if ($("#checkbox-all_delete").prop("checked")) { $("input[name=all_delete]").css("margin-left", "32px");
$(".check_delete").prop('checked', true);
} $( document ).ready(function() {
else {
$(".check_delete").prop('checked', false); $('[id^=checkbox-delete_multiple]').change(function(){
} if($(this).parent().parent().hasClass('checkselected')){
} $(this).parent().parent().removeClass('checkselected');
}
else{
$(this).parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true);
}
else{
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false);
}
});
});
</script> </script>

View File

@ -16,6 +16,8 @@
global $config; global $config;
include_once($config['homedir'] . "/include/functions_event_responses.php");
check_login (); check_login ();
if (! check_acl($config['id_user'], 0, "PM")) { if (! check_acl($config['id_user'], 0, "PM")) {
@ -25,14 +27,7 @@ if (! check_acl($config['id_user'], 0, "PM")) {
return; return;
} }
if (!is_user_admin($config['id_user'])) { $event_responses = event_responses_get_responses();
$id_groups = array_keys(users_get_groups(false, "PM"));
$event_responses = db_get_all_rows_filter('tevent_response',
array('id_group' => $id_groups));
}
else {
$event_responses = db_get_all_rows_in_table('tevent_response');
}
if(empty($event_responses)) { if(empty($event_responses)) {
ui_print_info_message ( array('no_close'=>true, 'message'=> __('No responses found') ) ); ui_print_info_message ( array('no_close'=>true, 'message'=> __('No responses found') ) );

View File

@ -16,6 +16,8 @@
global $config; global $config;
include_once($config['homedir'] . "/include/functions_event_responses.php");
check_login (); check_login ();
if (! check_acl($config['id_user'], 0, "PM")) { if (! check_acl($config['id_user'], 0, "PM")) {
@ -40,24 +42,9 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height'); $values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window'); $values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params'); $values['params'] = get_parameter('params');
if (enterprise_installed()) { $values['server_to_exec'] = get_parameter('server_to_exec');
if ($values['type'] == 'command') {
$values['server_to_exec'] = get_parameter('server_to_exec'); $result = event_responses_create_response($values);
}
else {
$values['server_to_exec'] = 0;
}
}
else {
$values['server_to_exec'] = 0;
}
if($values['new_window'] == 1) {
$values['modal_width'] = 0;
$values['modal_height'] = 0;
}
$result = db_process_sql_insert('tevent_response', $values);
if($result) { if($result) {
ui_print_success_message(__('Response added succesfully')); ui_print_success_message(__('Response added succesfully'));
@ -78,26 +65,10 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height'); $values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window'); $values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params'); $values['params'] = get_parameter('params');
if (enterprise_installed()) { $values['server_to_exec'] = get_parameter('server_to_exec');
if ($values['type'] == 'command') {
$values['server_to_exec'] = get_parameter('server_to_exec');
}
else {
$values['server_to_exec'] = 0;
}
}
else {
$values['server_to_exec'] = 0;
}
if($values['new_window'] == 1) {
$values['modal_width'] = 0;
$values['modal_height'] = 0;
}
$response_id = get_parameter('id_response',0); $response_id = get_parameter('id_response',0);
$result = db_process_sql_update('tevent_response', $values, array('id' => $response_id)); $result = event_responses_update_response($response_id, $values);
if($result) { if($result) {
ui_print_success_message(__('Response updated succesfully')); ui_print_success_message(__('Response updated succesfully'));

View File

@ -151,10 +151,13 @@ $table->head[] = __("Login Function");
$table->head[] = __("Agent operation tab"); $table->head[] = __("Agent operation tab");
$table->head[] = __("Agent godmode tab"); $table->head[] = __("Agent godmode tab");
$table->head[] = __("Operation"); $table->head[] = __("Operation");
/*
$table->width = array(); $table->width = array();
$table->width[] = '30%'; $table->width[] = '30%';
$table->width[] = '30%'; $table->width[] = '30%';
*/
$table->width = '100%';
$table->class = 'databox data';
$table->align = array(); $table->align = array();
$table->align[] = 'left'; $table->align[] = 'left';

View File

@ -48,7 +48,7 @@ if ($create_profiles) {
// If the profile doesnt exist, we create it // If the profile doesnt exist, we create it
if ($profile_data === false) { if ($profile_data === false) {
db_pandora_audit("User management", db_pandora_audit("User management",
"Added profile for user ".io_safe_output($user)); "Added profile for user ".io_safe_input($user));
$return = profile_create_user_profile ($user, $profile, $group); $return = profile_create_user_profile ($user, $profile, $group);
if ($return !== false) { if ($return !== false) {
$n_added ++; $n_added ++;

View File

@ -245,11 +245,12 @@ $module_types = db_get_all_rows_filter (
if ($module_types === false) if ($module_types === false)
$module_types = array (); $module_types = array ();
$types = ''; $types = array();
foreach ($module_types as $type) { foreach ($module_types as $type) {
$types[$type['id_tipo']] = $type['description']; $types[$type['id_tipo']] = $type['description'];
} }
$table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->data = array (); $table->data = array ();

View File

@ -175,6 +175,7 @@ if ($update) {
} }
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';
@ -235,7 +236,7 @@ switch ($config["dbtype"]) {
if ($module_types === false) if ($module_types === false)
$module_types = array (); $module_types = array ();
$types = ''; $types = array();
foreach ($module_types as $type) { foreach ($module_types as $type) {
$types[$type['id_tipo']] = $type['description']; $types[$type['id_tipo']] = $type['description'];
} }
@ -248,22 +249,18 @@ $snmp_versions['3'] = 'v. 3';
$table->width = '100%'; $table->width = '100%';
$table->data = array (); $table->data = array ();
$table->data['selection_mode'][0] = __('Selection mode'); $table->data['selection_mode'][0] = __('Selection mode');
$table->data['selection_mode'][1] = '<span style="width:110px;display:inline-block;">'.__('Select modules first ') . '</span>' . $table->data['selection_mode'][1] = '<span style="width:110px;display:inline-block;">'.__('Select modules first ') . '</span>' .
html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'<br>'; html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'<br>';
$table->data['selection_mode'][1] .= '<span style="width:110px;display:inline-block;">'.__('Select agents first ') . '</span>' . $table->data['selection_mode'][1] .= '<span style="width:110px;display:inline-block;">'.__('Select agents first ') . '</span>' .
html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true); html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
$table->rowclass['form_modules_1'] = 'select_modules_row'; $table->rowclass['form_modules_1'] = 'select_modules_row';
$table->data['form_modules_1'][0] = __('Module type'); $table->data['form_modules_1'][0] = __('Module type');
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">'; $table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
$table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true); $table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true);
$table->data['form_modules_1'][0] .= '</span>'; $table->data['form_modules_1'][0] .= '</span>';
$types[0] = __('All'); $types[0] = __('All');
$table->colspan['form_modules_1'][1] = 2; $table->colspan['form_modules_1'][1] = 2;
$table->data['form_modules_1'][1] = html_print_select ($types, $table->data['form_modules_1'][1] = html_print_select ($types,

View File

@ -32,6 +32,7 @@ enterprise_include ('godmode/massive/massive_operations.php');
$tab = (string) get_parameter ('tab', 'massive_agents'); $tab = (string) get_parameter ('tab', 'massive_agents');
$option = (string) get_parameter ('option', ''); $option = (string) get_parameter ('option', '');
$options_alerts = array( $options_alerts = array(
'add_alerts' => __('Bulk alert add'), 'add_alerts' => __('Bulk alert add'),
'delete_alerts' => __('Bulk alert delete'), 'delete_alerts' => __('Bulk alert delete'),
@ -224,6 +225,11 @@ if ((get_cfg_var("max_execution_time") != 0)
echo '</div>'; echo '</div>';
} }
if ($tab == 'massive_policies' && is_central_policies_on_node()){
ui_print_warning_message(__('This node is configured with centralized mode. All policies information is read only. Go to metaconsole to manage it.'));
return;
}
// Catch all submit operations in this view to display Wait banner // Catch all submit operations in this view to display Wait banner
$submit_action = get_parameter('go'); $submit_action = get_parameter('go');
$submit_update = get_parameter('updbutton'); $submit_update = get_parameter('updbutton');

View File

@ -193,7 +193,7 @@ $table->class = 'databox data';
$table->head = array (); $table->head = array ();
$table->head[0] = __('Name'); $table->head[0] = __('Name');
$table->head[1] = __('Action') . $table->head[1] = __('Action') .
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();'); html_print_checkbox('all_delete', 0, false, true, false);
$table->style = array (); $table->style = array ();
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->align = array (); $table->align = array ();
@ -250,12 +250,31 @@ enterprise_hook('close_meta_frame');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").prop('checked')) { $( document ).ready(function() {
$(".check_delete").prop('checked', true);
} $('[id^=checkbox-delete_multiple]').change(function(){
else { if($(this).parent().parent().hasClass('checkselected')){
$(".check_delete").prop('checked', false); $(this).parent().parent().removeClass('checkselected');
} }
} else{
$(this).parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true);
}
else{
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false);
}
});
});
</script> </script>

View File

@ -49,7 +49,7 @@ You can of course remove the warnings, that's why we include the source and do n
ui_print_page_header (__('Module management') . ' &raquo; ' . ui_print_page_header (__('Module management') . ' &raquo; ' .
__('Network component management'), "", false, __('Network component management'), "", false,
"network_component", true,"",true,"modulemodal"); "network_component", true,"",false,"modulemodal");
$sec = 'gmodules'; $sec = 'gmodules';
} }
@ -568,8 +568,7 @@ $table->head[3] = __('Description');
$table->head[4] = __('Group'); $table->head[4] = __('Group');
$table->head[5] = __('Max/Min'); $table->head[5] = __('Max/Min');
$table->head[6] = __('Action') . $table->head[6] = __('Action') .
html_print_checkbox('all_delete', 0, false, true, false, html_print_checkbox('all_delete', 0, false, true, false);
'check_all_checkboxes();');
$table->size = array (); $table->size = array ();
$table->size[1] = '75px'; $table->size[1] = '75px';
$table->size[6] = '80px'; $table->size[6] = '80px';
@ -650,12 +649,30 @@ enterprise_hook('close_meta_frame');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").prop("checked")) { $( document ).ready(function() {
$(".check_delete").prop("checked", true);
} $('[id^=checkbox-delete_multiple]').change(function(){
else { if($(this).parent().parent().hasClass('checkselected')){
$(".check_delete").prop("checked", true); $(this).parent().parent().removeClass('checkselected');
} }
} else{
$(this).parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true);
}
else{
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false);
}
});
});
</script> </script>

View File

@ -239,16 +239,33 @@ echo '</div></form>';
?> ?>
<script type="text/javascript"> <script type="text/javascript">
// If you click on the input type checkbox with id checkbox-all_delete
$('#checkbox-all_delete').click(function() { $( document ).ready(function() {
// If selected (if the checked property equals true)
if ($(this).prop('checked')) { $('[id^=checkbox-delete_multiple]').change(function(){
// Select each input that has the class .check_delete if($(this).parent().parent().hasClass('checkselected')){
$('.check_delete').prop('checked', true); $(this).parent().parent().removeClass('checkselected');
} else { }
// deselect every input that has the class .check_delete else{
$('.check_delete').prop('checked', false); $(this).parent().parent().addClass('checkselected');
} }
}); });
// If you click on the input type checkbox with id checkbox-all_delete
$('[id^=checkbox-all_delete]').change(function(){
// If selected (if the checked property equals true)
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
// Select each input that has the class .check_delete
$(".check_delete").prop("checked", true);
}
else{
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
// deselect every input that has the class .check_delete
$(".check_delete").prop("checked", false);
}
});
});
</script> </script>

View File

@ -119,8 +119,7 @@ $table->head = array ();
$table->head[0] = __('Name'); $table->head[0] = __('Name');
$table->head[1] = __('Group'); $table->head[1] = __('Group');
$table->head[2] = __('Action') . $table->head[2] = __('Action') .
html_print_checkbox('all_delete', 0, false, true, false, html_print_checkbox('all_delete', 0, false, true, false);
'check_all_checkboxes();');
$table->style = array (); $table->style = array ();
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->align = array (); $table->align = array ();
@ -174,12 +173,30 @@ enterprise_hook('close_meta_frame');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").attr('checked')) { $( document ).ready(function() {
$(".check_delete").attr('checked', true);
} $('[id^=checkbox-delete_multiple]').change(function(){
else { if($(this).parent().parent().hasClass('checkselected')){
$(".check_delete").attr('checked', false); $(this).parent().parent().removeClass('checkselected');
} }
} else{
$(this).parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true);
}
else{
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false);
}
});
});
</script> </script>

View File

@ -60,8 +60,6 @@ if ($edit_graph) {
$stacked = $graphInTgraph['stacked']; $stacked = $graphInTgraph['stacked'];
$period = $graphInTgraph['period']; $period = $graphInTgraph['period'];
$id_group = $graphInTgraph['id_group']; $id_group = $graphInTgraph['id_group'];
$width = $graphInTgraph['width'];
$height = $graphInTgraph['height'];
$check = false; $check = false;
$percentil = $graphInTgraph['percentil']; $percentil = $graphInTgraph['percentil'];
$summatory_series = $graphInTgraph['summatory_series']; $summatory_series = $graphInTgraph['summatory_series'];
@ -78,8 +76,6 @@ else {
$id_agent = 0; $id_agent = 0;
$id_module = 0; $id_module = 0;
$id_group = 0; $id_group = 0;
$width = 550;
$height = 210;
$period = SECONDS_1DAY; $period = SECONDS_1DAY;
$factor = 1; $factor = 1;
$stacked = 4; $stacked = 4;
@ -136,15 +132,6 @@ if ($stacked == CUSTOM_GRAPH_GAUGE)
$hidden = ' style="display:none;" '; $hidden = ' style="display:none;" ';
else else
$hidden = ''; $hidden = '';
echo "<tr>";
echo "<td class='datos stacked' $hidden>";
echo "<b>".__('Width')."</b></td>";
echo "<td class='datos'>";
echo "<input type='text' name='width' value='$width' $hidden size=6></td>";
echo "<td class='datos2'>";
echo "<b>".__('Height')."</b></td>";
echo "<td class='datos2'>";
echo "<input type='text' name='height' value='$height' size=6></td></tr>";
echo "<tr>"; echo "<tr>";
echo "<td class='datos'>"; echo "<td class='datos'>";

View File

@ -81,8 +81,6 @@ if ($add_graph) {
$description = get_parameter_post ("description"); $description = get_parameter_post ("description");
$module_number = get_parameter_post ("module_number"); $module_number = get_parameter_post ("module_number");
$idGroup = get_parameter_post ('graph_id_group'); $idGroup = get_parameter_post ('graph_id_group');
$width = get_parameter_post ("width");
$height = get_parameter_post ("height");
$stacked = get_parameter ("stacked", 0); $stacked = get_parameter ("stacked", 0);
$period = get_parameter_post ("period"); $period = get_parameter_post ("period");
$threshold = get_parameter('threshold'); $threshold = get_parameter('threshold');
@ -102,8 +100,6 @@ if ($add_graph) {
'name' => $name, 'name' => $name,
'description' => $description, 'description' => $description,
'period' => $period, 'period' => $period,
'width' => $width,
'height' => $height,
'private' => 0, 'private' => 0,
'id_group' => $idGroup, 'id_group' => $idGroup,
'stacked' => $stacked, 'stacked' => $stacked,
@ -134,8 +130,6 @@ if ($update_graph) {
$name = get_parameter('name'); $name = get_parameter('name');
$id_group = get_parameter('graph_id_group'); $id_group = get_parameter('graph_id_group');
$description = get_parameter('description'); $description = get_parameter('description');
$width = get_parameter('width');
$height = get_parameter('height');
$period = get_parameter('period'); $period = get_parameter('period');
$stacked = get_parameter('stacked'); $stacked = get_parameter('stacked');
$percentil = get_parameter('percentil'); $percentil = get_parameter('percentil');

View File

@ -168,8 +168,7 @@ if (!empty ($graphs)) {
$op_column = true; $op_column = true;
$table->align[4] = 'left'; $table->align[4] = 'left';
$table->head[4] = __('Op.') . $table->head[4] = __('Op.') .
html_print_checkbox('all_delete', 0, false, true, false, html_print_checkbox('all_delete', 0, false, true, false);
'check_all_checkboxes();');
$table->size[4] = '90px'; $table->size[4] = '90px';
} }
$table->data = array (); $table->data = array ();
@ -236,13 +235,29 @@ else {
$("input[name=all_delete]").css("margin-left", "32px"); $("input[name=all_delete]").css("margin-left", "32px");
function check_all_checkboxes() { $( document ).ready(function() {
if ($("input[name=all_delete]").prop("checked")) {
$(".check_delete").prop("checked", true);
}
else {
$(".check_delete").prop("checked", false);
}
}
$('[id^=checkbox-delete_multiple]').change(function(){
if($(this).parent().parent().hasClass('checkselected')){
$(this).parent().parent().removeClass('checkselected');
}
else{
$(this).parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true);
}
else{
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false);
}
});
});
</script> </script>

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