Merge branch 'develop' into 2877_Mejora_audit_log

# Conflicts:
#	pandora_console/godmode/users/profile_list.php
This commit is contained in:
samucarc 2018-12-03 18:57:04 +01:00
commit 34986a5477
1668 changed files with 187511 additions and 64092 deletions

View File

@ -247,4 +247,11 @@ button h3 {
}
.sev-Maintenance {
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 notVisited = {};
$(window).load(function() {
$(window).on('load', function() {
initilise();
// Wait some ms to throw main function
var delay = setTimeout(main, 100);
@ -29,11 +29,13 @@ function main() {
if (isFetching) return;
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.onload = handleResponse;
req.onerror = handleError;
req.open("GET", feedUrl, true);
req.withCredentials = true
req.send(null);
}
@ -132,25 +134,23 @@ function fetchNewEvents(A,B){
function parseReplyEvents (reply) {
// 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
var fetchedEvents=new Array();
for(var i=0;i<e_array.length;i++){
// Avoid to parse empty lines
if (e_array[i].length == 0) continue;
var event=e_array[i].split(";");
var event=e_array[i];
fetchedEvents.push({
'id' : event[0],
'agent_name' : event[1],
'agent' : event[2],
'date' : event[5],
'title' : event[6],
'module' : event[9],
'type' : event[14],
'source' : event[17],
'severity' : event[28],
'id' : event.id_evento,
'agent_name' : event.agent_name,
'agent' : event.id_agent,
'date' : event.timestamp,
'title' : event.evento,
'module' : event.id_agentmodule,
'type' : event.event_type,
'source' : event.source,
'severity' : event.criticity_name,
'visited' : false
});
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.727
# Version 7.0NG.729
# 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.727-181019
Version: 7.0NG.729-181203
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1 +0,0 @@

View File

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

View File

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

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.727
%define release 181019
%define version 7.0NG.729
%define release 181203
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
@ -88,7 +88,7 @@ if [ ! -e /etc/pandora/plugins ]; then
fi
if [ ! -e /etc/pandora/collections ]; then
ln -s /usr/share/pandora_agent/collections /etc/pandora
mkdir /etc/pandora/collections
fi
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.727"
PI_BUILD="181019"
PI_VERSION="7.0NG.729"
PI_BUILD="181203"
OS_NAME=`uname -s`
FORCE=0
@ -388,8 +388,8 @@ install () {
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..."
cp -r collections $PANDORA_BASE$PANDORA_HOME
echo "Creating the collections directory in to $PANDORA_BASE$PANDORA_HOME/collections..."
mkdir -p $PANDORA_BASE$PANDORA_HOME/collections
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG

View File

@ -25,12 +25,33 @@
###############################################################################
use strict;
use warnings;
# Retrieve information from all filesystems
my $all_filesystems = 0;
# Regex flag
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($$){
my $item = shift;
@ -65,10 +86,24 @@ if ($#ARGV < 0) {
$all_filesystems = 1;
}
# Check if regex mode is enabled
if ($ARGV[0] eq "-r") {
$regex_mode = 1;
shift @ARGV;
while ($#ARGV >= 0) {
my $param = shift @ARGV;
if ($param eq '-r') {
$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
@ -90,7 +125,15 @@ if ($onlyexclude) {
# Retrieve filesystem information
# -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);
# No filesystems? Something went wrong.
@ -102,9 +145,13 @@ my %out;
# Parse filesystem usage
foreach my $row (@df) {
my @columns = split (' ', $row);
exit 1 if ($#columns < 4);
if (check_in (\%filesystems,$columns[0]) || ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0]) )) {
$out{$columns[0]} = $columns[4] ;
exit 1 if ($#columns < 5);
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>\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 "<data><![CDATA[" . $use . "]]></data>\n";
print "<description><![CDATA[% of usage in this volume]]></description>\n";

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.727
# Version 7.0NG.729
# 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

View File

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

View File

@ -227,7 +227,7 @@ int Cron::getResetValue (int position) {
* @return false if should not execute
*/
bool Cron::shouldExecuteAt (time_t date) {
return this->utimestamp < date;
return this->utimestamp <= date;
}
/**

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.727(Build 181019)")
#define PANDORA_VERSION ("7.0NG.729(Build 181203)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.727(Build 181019))"
VALUE "ProductVersion", "(7.0NG.729(Build 181203))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,10 +1,10 @@
package: pandorafms-console
Version: 7.0NG.727-181019
Version: 7.0NG.729-181203
Architecture: all
Priority: optional
Section: admin
Installed-Size: 42112
Maintainer: Artica ST <deptec@artica.es>
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
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
# GNU General Public License for more details.
pandora_version="7.0NG.727-181019"
pandora_version="7.0NG.729-181203"
package_pear=0
package_pandora=1

View File

@ -18,9 +18,8 @@ if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"
exit;
}
// Real start
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/functions.php');
require_once ('include/functions_db.php');
@ -82,7 +81,6 @@ if (isset($config['metaconsole'])) {
if ($config['metaconsole'])
define ('METACONSOLE', true);
}
session_write_close ();
if (file_exists ($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) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
}
elseif ($alert["disabled"] > 0) {
$status = STATUS_ALERT_DISABLED;

View File

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

View File

@ -16,123 +16,80 @@
function dbmanager_query ($sql, &$error, $dbconnection) {
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"]){
mysqli_free_result ($result);
}
else{
mysql_free_result ($result);
}
if (! empty ($retval))
return $retval;
//Return false, check with === or !==
return "Empty";
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;
$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, 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 () {
ui_require_css_file ('dbmanager', 'extensions/dbmanager/');
global $config;
if (!is_user_admin($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
}
/*
* Disabled at the moment.
if (!check_referer()) {
require ("general/noaccess.php");
return;
}
*/
$sql = (string) get_parameter ('sql');
ui_print_page_header (__('Database interface'), "images/gm_db.png", false, false, true);
echo '<div class="notify">';
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
@ -142,10 +99,10 @@ function dbmgr_extension_main () {
with a depth knowledge of %s internals.",
get_product_name(), get_product_name(), get_product_name());
echo '</div>';
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 "<br /><br />";
echo "<form method='post' action=''>";
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"');
echo '</div>';
echo "</form>";
// Processing SQL Code
if ($sql == '')
return;
echo "<br />";
echo "<hr />";
echo "<br />";
$dbconnection = $config['dbconnection'];
$error = '';
$result = dbmanager_query ($sql, $error, $dbconnection);
if ($result === false) {
echo '<strong>An error has occured when querying the database.</strong><br />';
echo $error;
db_pandora_audit("DB Interface Extension", "Error in SQL", false, false, $sql);
return;
}
if (! is_array ($result)) {
echo "<strong>Output: <strong>".$result;
db_pandora_audit("DB Interface Extension", "SQL", false, false, $sql);
return;
}
echo "<div style='overflow: auto;'>";
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->head = array_keys ($result[0]);
$table->data = $result;
html_print_table ($table);
echo "</div>";
}

View File

@ -48,7 +48,7 @@ function createXMLData($agent, $agentModule, $time, $data) {
$data
);
$file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . str_replace($time, " ", "_") . ".data";
$file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . strtotime($time) . ".data";
return (bool) @file_put_contents($file_name, $xml);
}
@ -115,7 +115,7 @@ function mainInsertData() {
$utimestamp = strtotime($date . " " . $time) - get_fixed_offset();
$timestamp = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp);
$result = createXMLData($agent, $agentModule, $timestamp, $data);
if ($result) {
$done++;
}

View File

@ -77,6 +77,15 @@ switch($graph) {
if (count($data_array) > 1) {
$data = $data_array[1];
}
// Redefine boolean data
switch ($data) {
case "up(1)":
$data = 1;
break;
case "down(0)":
$data = 0;
break;
}
}
}
break;

View File

@ -16,14 +16,14 @@
if (isset($_GET['get_ptr'])) {
if ($_GET['get_ptr'] == 1) {
session_start ();
session_write_close ();
$ownDir = dirname(__FILE__) . '/';
$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');
// Login check
if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null;

View File

@ -0,0 +1,22 @@
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;
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;

View File

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

View File

@ -1159,8 +1159,8 @@ ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "
-- 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 `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;
@ -1180,13 +1180,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 ('small_operation_step_datos_purge', '1000');
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', 22);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '728');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '729');
-- ---------------------------------------------------------------------
-- Table `tconfig_os`
@ -1230,6 +1230,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 autorefresh_white_list text not null default '';
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`
@ -1740,6 +1742,8 @@ CREATE TABLE IF NOT EXISTS `tlayout_template` (
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
-- ---------------------------------------------------------------------
-- Table `tlayout_template_data`
-- ---------------------------------------------------------------------
@ -1808,3 +1812,17 @@ 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_pass` varchar(255) 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 '',
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

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

View File

@ -14,6 +14,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
require_once ('../include/functions_update_manager.php');
if (isset($_SERVER['REQUEST_TIME'])) {
$time = $_SERVER['REQUEST_TIME'];
}
@ -32,9 +35,7 @@ if (!$config["MR"]) {
echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">';
if(enterprise_installed()){
enterprise_include_once("../include/functions_update_manager.php");
}
include_once ($config["homedir"]."/include/functions_update_manager.php");
$current_package = update_manager_get_current_package();
@ -48,7 +49,7 @@ else{
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config["MR"]));
echo '</a><br />';
echo '<a class="white footer">'. __('Page generated at') . ' '. date('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>';
if (isset ($config['debug'])) {

View File

@ -70,9 +70,10 @@ switch ($login_screen) {
$logo_link = 'index.php';
$logo_title = __('Refresh');
break;
$splash_title = __('Splash login');
}
$splash_title = __('Splash login');
$url = '?login=1';
//These variables come from index.php
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>';
if ($process_error_message == '' && $mail != "") {
if (!isset($process_error_message) && isset($mail)) {
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
echo '<div class="content_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 '</div>';
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>';
}
else if ($process_error_message != '') {
else if (isset($process_error_message)) {
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
echo '<div class="content_alert">';
echo '<div class="icon_message_alert">';
@ -333,7 +334,7 @@ else if ($process_error_message != '') {
echo '<p>' . $process_error_message . '</p>';
echo '</div>';
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>';
@ -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 class="content_alert">';
echo '<div class="icon_message_alert">';
@ -353,7 +354,7 @@ if ($correct_reset_pass_process != "") {
echo '<p>' . $correct_reset_pass_process . '</p>';
echo '</div>';
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>';
@ -483,8 +484,8 @@ if($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig' |
}
ui_require_css_file ('dialog');
ui_require_css_file ('jquery-ui-1.10.0.custom');
ui_require_jquery_file('jquery-ui-1.10.0.custom');
ui_require_css_file ('jquery-ui.min');
ui_require_jquery_file('jquery-ui.min');
?>
<?php

View File

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

View File

@ -210,6 +210,7 @@ if (!empty($all_data)) {
echo '<div id="activity">';
$table = new stdClass();
$table->class = "databox data";
$table->width = '100%'; //Don't specify px
$table->data = array ();
$table->size = array ();
@ -274,7 +275,12 @@ if (!empty($all_data)) {
. human_time_comparation($session['utimestamp'], 'tiny');
$data[3] = $session_ip_origen;
$description = str_replace(array(',', ', '), ', ', $session['descripcion']);
$data[4] = '<div >' . io_safe_output($description) . '</div>';
if(strlen($description)>100){
$data[4] = '<div >' . io_safe_output(substr($description, 0, 150).'...') . '</div>';
}
else{
$data[4] = '<div >' . io_safe_output($description) . '</div>';
}
array_push ($table->data, $data);
}

View File

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

View File

@ -14,8 +14,10 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// 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/functions.php");
require_once ("../include/functions_html.php");
?>
@ -33,11 +35,6 @@ require_once ("../include/functions_html.php");
$id = get_parameter ('id');
$id_user = get_parameter ('id_user');
if (! isset($_SESSION['id_usuario'])) {
session_start();
session_write_close();
}
$user_language = get_user_language ($id_user);
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

@ -233,7 +233,7 @@ foreach ($result as $row) {
$data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
. ui_print_timestamp($row["utimestamp"], true);
$data[3] = $row["ip_origen"];
$data[4] = $row["descripcion"];
$data[4] = io_safe_output($row["descripcion"]);
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$data[5] = enterprise_hook("cell1EntepriseAudit", array($row["id_sesion"]));

View File

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

View File

@ -541,7 +541,7 @@ if (!empty($interfaces_list)) {
$table->data[0][1] = '';
$table->data[0][2] = '<b>'.__('Modules').'</b>';
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;');
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
$table->data[1][1] = html_print_image('images/darrowright.png', true);
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);

View File

@ -1772,13 +1772,15 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
// =====================
if ($enable_module) {
$result = modules_change_disabled($enable_module, 0);
$modulo_nombre = db_get_row_sql("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ".$enable_module."");
$modulo_nombre = $modulo_nombre['nombre'];
if ($result === NOERR) {
enterprise_hook('config_agents_enable_module_conf', array($id_agente, $enable_module));
db_pandora_audit("Module management", 'Enable ' . $enable_module);
db_pandora_audit("Module management", 'Enable #' . $enable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
}
else {
db_pandora_audit("Module management", 'Fail to enable ' . $enable_module);
db_pandora_audit("Module management", 'Fail to enable #' . $enable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
}
ui_print_result_message ($result,
@ -1787,13 +1789,15 @@ if ($enable_module) {
if ($disable_module) {
$result = modules_change_disabled($disable_module, 1);
$modulo_nombre = db_get_row_sql("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ".$disable_module."");
$modulo_nombre = $modulo_nombre['nombre'];
if ($result === NOERR) {
enterprise_hook('config_agents_disable_module_conf', array($id_agente, $disable_module));
db_pandora_audit("Module management", 'Disable ' . $disable_module);
db_pandora_audit("Module management", 'Disable #' . $disable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
}
else {
db_pandora_audit("Module management", 'Fail to disable ' . $disable_module);
db_pandora_audit("Module management", 'Fail to disable #' . $disable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
}
ui_print_result_message ($result,
@ -1939,7 +1943,7 @@ switch ($tab) {
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){
event.preventDefault();
@ -1973,7 +1977,7 @@ switch ($tab) {
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)){
event.preventDefault();

View File

@ -481,15 +481,14 @@ if ($agents !== false) {
if($agent["id_os"] == 100){
$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{
echo "<a alt =".$agent["nombre"]." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=" . $agent["id_agente"] . "'>" .
'<span style="font-size: 7pt" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span>' .
"</a>";
}
}
echo "</strong>";
$in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime

View File

@ -139,7 +139,7 @@ if (($policy_page) || (isset($agent))) {
echo '</td>';
}
echo '<td class="datos" style="font-weight: bold; width:20%;">';
echo __("Type");
echo __("<p>Type</p>");
html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' );
html_print_input_hidden ('edit_module', 1);
echo '</td>';
@ -313,7 +313,7 @@ $selectIntervalUp = '';
$selectIntervalDown = '';
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$selected = 'border: 1px solid black;';
$selected = '';
$order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC');
@ -547,7 +547,8 @@ $table->head[7] = __('Warn');
$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->style = array ();
@ -607,7 +608,7 @@ foreach ($modules as $module) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
$table->colspan[$i - 1][0] = 10;
else
$table->colspan[$i - 1][0] = 8;
$table->colspan[$i - 1][0] = 9;
$data = array ();
}
@ -778,12 +779,13 @@ foreach ($modules as $module) {
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
// 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;">';
$data[9] .= html_print_image ('images/cross.png', true,
array ('title' => __('Delete')));
$data[9] .= '</a> ';
$data[9] .= html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
}
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">
$(document).ready (function () {
$(document).ready (function () {
$('[id^=checkbox-id_delete]').change(function(){
if($(this).parent().parent().hasClass('checkselected')){
$(this).parent().parent().removeClass('checkselected');
}
else{
$(this).parent().parent().addClass('checkselected');
}
});
});
$('[id^=checkbox-id_delete]').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-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() {
var checked = $("#checkbox-status_hierachy_mode").is(":checked");

View File

@ -34,6 +34,11 @@ if (is_ajax ()) {
// Decrypt passwords in the component.
$component['plugin_pass'] = io_output_password($component['plugin_pass']);
$component['str_warning'] = io_safe_output($component['str_warning']);
$component['str_critical'] = io_safe_output($component['str_critical']);
$component['warning_inverse'] = (bool)$component['warning_inverse'];
$component['critical_inverse'] = (bool)$component['critical_inverse'];
echo io_json_mb_encode ($component);
return;

View File

@ -13,9 +13,10 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// 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/functions.php");
require_once ("../../include/functions_db.php");
require_once ("../../include/functions_users.php");

View File

@ -57,7 +57,7 @@ else {
$sec = 'galertas';
}
if ((!$copy_action) && (!$delete_action) && (!$update_action)) {
if ((!$copy_action) && (!$delete_action)) {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header ();
@ -141,121 +141,8 @@ if ($copy_action) {
__('Could not be copied'));
}
if ($create_action) {
$name = (string) get_parameter ('name');
$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);
}
ui_print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
}
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 ($update_action || $create_action) {
alerts_ui_update_or_create_actions($update_action);
}
if ($delete_action) {
@ -328,6 +215,7 @@ if ($delete_action) {
__('Could not be deleted'));
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->data = array ();
@ -349,9 +237,13 @@ $table->align[3] = 'left';
$filter = array();
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)
$actions = array ();
@ -366,11 +258,19 @@ foreach ($actions as $action) {
$iterator++;
$data = array ();
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.
$action['name'].'</a>';
$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")) {
$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;">' .
@ -379,7 +279,7 @@ foreach ($actions as $action) {
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/cross.png", true) . '</a>';
}
array_push ($table->data, $data);
}
if (isset($data)) {

View File

@ -38,6 +38,7 @@ $pure = (int)get_parameter('pure', 0);
$update_command = (bool) get_parameter ('update_command');
$create_command = (bool) get_parameter ('create_command');
$delete_command = (bool) get_parameter ('delete_command');
$copy_command = (bool) get_parameter ('copy_command');
if (is_ajax ()) {
$get_alert_command = (bool) get_parameter ('get_alert_command');
@ -57,37 +58,13 @@ if (is_ajax ()) {
if (isset($command['description'])) {
$command['description'] = io_safe_input(str_replace("\r\n","<br>", io_safe_output($command['description'])));
}
// Get the html rows of the fields form
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
// Descriptions are stored in json
$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;
}
// Descriptions are stored in json
$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));
$fields_rows = array();
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -266,13 +243,11 @@ if (defined('METACONSOLE'))
else
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert commands'), "images/gm_alerts.png", false, "alerts_config", true);
if ($create_command) {
$name = (string) get_parameter ('name');
$command = (string) get_parameter ('command');
$description = (string) get_parameter ('description');
$id_group = (string) get_parameter ('id_group', 0);
$fields_descriptions = array();
$fields_values = array();
@ -287,7 +262,8 @@ if ($create_command) {
$values['fields_values'] = io_json_mb_encode($fields_values);
$values['fields_descriptions'] = io_json_mb_encode($fields_descriptions);
$values['description'] = $description;
$values['id_group'] = $id_group;
$name_check = db_get_value ('name', 'talert_commands', 'name', $name);
if (!$name_check) {
@ -307,9 +283,22 @@ if ($create_command) {
db_pandora_audit("Command management", "Fail try to create alert command", false, false);
}
ui_print_result_message ($result,
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
if ($name == "") {
$messageAction = __('No name specified');
}
if ($command == "") {
$messageAction = __('No command specified');
}
$messageAction = ui_print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
$messageAction);
}
@ -336,8 +325,27 @@ if ($delete_command) {
ui_print_result_message ($result,
__('Successfully 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%';
@ -345,45 +353,54 @@ $table->class = 'databox data';
$table->data = array ();
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('ID');
$table->head[2] = __('Description');
$table->head[3] = __('Delete');
$table->head['name'] = __('Name');
$table->head['id'] = __('ID');
$table->head['group'] = __('Group');
$table->head['description'] = __('Description');
$table->head['action'] = __('Actions');
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->style['name'] = 'font-weight: bold';
$table->size = array ();
$table->size[3] = '40px';
$table->size['action'] = '40px';
$table->align = array ();
$table->align[3] = 'left';
$table->align['action'] = 'left';
$commands = db_get_all_rows_in_table ('talert_commands');
if ($commands === false)
$commands = array ();
$commands = db_get_all_rows_filter(
'talert_commands',
array('id_group' => array_keys(users_get_groups(false, "LM")))
);
if ($commands === false) $commands = array ();
foreach ($commands as $command) {
$data = array ();
$data[0] = '<span style="font-size: 7.5pt">';
$data['name'] = '<span style="font-size: 7.5pt">';
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>';
else
$data[0] .= $command['name'];
$data[0] .= '</span>';
$data[1] = $command['id'];
$data[2] = str_replace("\r\n","<br>",
$data['name'] .= $command['name'];
$data['name'] .= '</span>';
$data['id'] = $command['id'];
$data['group'] = ui_print_group_icon ($command["id_group"], true);
$data['description'] = str_replace("\r\n","<br>",
io_safe_output($command['description']));
$data[3] = '';
$data['action'] = '';
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;">'.
html_print_image("images/cross.png", true) . '</a>';
$data['action'].= '</span>';
}
array_push ($table->data, $data);
}
if (isset($data)) {
if (count($table->data) > 0) {
html_print_table ($table);
}
else {

View File

@ -102,16 +102,8 @@ if ($groups_user === false) {
$groups_id = implode(',', array_keys($groups_user));
$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();
if (is_array($temp)) {
foreach ($temp as $actionElement) {
@ -186,23 +178,10 @@ if ($searchFlag) {
field3_recovery LIKE '%" . trim($fieldContent) . "%')";
if (strlen(trim($moduleName)) > 0)
$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) {
switch ($config["dbtype"]) {
case "mysql":
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;
}
$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) . "')";
}
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 . ")";
@ -212,17 +191,7 @@ if ($searchFlag) {
$where .= " AND talert_template_modules.standby = " . $standby;
}
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$id_agents = array_keys ($agents);
break;
case "oracle":
$id_agents = false;
break;
}
$id_agents = array_keys ($agents);
$total = agents_get_alerts_simple ($id_agents, false,
false, $where, false, false, false, true);
@ -645,7 +614,7 @@ foreach ($simple_alerts as $alert) {
if ($alert["times_fired"] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
}
elseif ($alert["disabled"] > 0) {
$status = STATUS_ALERT_DISABLED;
@ -704,27 +673,32 @@ foreach ($simple_alerts as $alert) {
// To manage alert is necessary LW permissions in the agent group
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;">';
if ($alert['disabled']) {
}
else {
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
$data[4] .= '</a>';
$is_cluster = (bool)get_parameter('id_cluster');
if (!$is_cluster) {
if ($alert['disabled']) {
$data[4] .= html_print_image('images/add.disabled.png',
true, array('title' => __("Add action")));
}
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_hidden ('delete_alert', 1, true);
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$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_hidden ('upd_alert', 1, true);
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
$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 ('id_alert', $alert['id'], true);
$data[4] .= '</form>';
$data[4] .= '</form>';
}
}
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {

View File

@ -126,9 +126,24 @@ if ($create_alert) {
"Fail Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'");
}
$messageAction = ui_print_result_message ($id,
__('Successfully created'), __('Could not be created'), '', true);
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
if ($id_alert_template == "") {
$messageAction = __('No template specified');
}
if ($id_agent_module == "") {
$messageAction = __('No module specified');
}
$messageAction = ui_print_result_message ($id,
__('Successfully created'), $messageAction, '', true);
if ($id !== false) {
$action_select = get_parameter('action_select');

View File

@ -112,8 +112,14 @@ if ($create_special_day) {
$values = array();
$values['id_group'] = (string) get_parameter ('id_group');
$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 == '*') {
# '0001' means every year.
$year = '0001';
@ -130,6 +136,7 @@ if ($create_special_day) {
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
if ($date_check == $date) {
$result = '';
$messageAction = __('Could not be created, it already exists');
}
else {
$result = alerts_create_alert_special_day ($date, $same_day, $values);
@ -143,10 +150,16 @@ if ($create_special_day) {
else {
db_pandora_audit("Command management", "Fail try to create special day", false, false);
}
ui_print_result_message ($result,
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
$messageAction = ui_print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
$messageAction);
}
if ($update_special_day) {
@ -158,20 +171,25 @@ if ($update_special_day) {
$description = (string) get_parameter ('description');
$id_group = (string) get_parameter ('id_group');
$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 == '*') {
# '0001' means every year.
$year = '0001';
$date = $year . '-' . $month . '-' . $day;
}
$values = array ();
$values['date'] = $date;
$values['id_group'] = $id_group;
$values['same_day'] = $same_day;
$values['description'] = $description;
if (!checkdate ($month, $day, $year)) {
$result = '';
}
@ -183,6 +201,7 @@ if ($update_special_day) {
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
if ($date_check == $date) {
$result = '';
$messageAction = __('Could not be updated, it already exists');
}
else {
$result = alerts_update_alert_special_day ($id, $values);
@ -202,9 +221,15 @@ if ($update_special_day) {
db_pandora_audit("Command management", "Fail to update special day " . $id, false, false);
}
ui_print_result_message ($result,
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be updated');
}
$messageAction = ui_print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
$messageAction);
}
if ($delete_special_day) {

View File

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

View File

@ -122,7 +122,6 @@ $table->colspan[0][1] = 2;
$table->data[1][0] = __('Group');
$groups = users_get_groups ();
$own_info = get_user_info ($config['id_user']);
// Only display group "All" if user is administrator or has "PM" privileges
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->data[2][0] = __('Command');
$table->data[2][1] = html_print_select_from_sql ('SELECT id, name
FROM talert_commands',
'id_command', $id_command, '', __('None'), 0, true);
$commands_sql = db_get_all_rows_filter(
'talert_commands',
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] .= ' ';
if (check_acl ($config['id_user'], 0, "PM")) {
$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"]; ?>');
// 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++) {
var old_value = '';
var old_recovery_value = '';

View File

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

View File

@ -428,9 +428,21 @@ if ($create_template) {
json_encode($values));
}
ui_print_result_message ($result,
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
if ($name == "") {
$messageAction = __('No template name specified');
}
$messageAction = ui_print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
$messageAction);
/* Go to previous step in case of error */
if ($result === false)
$step = $step - 1;

View File

@ -12,19 +12,17 @@
$ownDir = dirname(__FILE__) . '/';
$ownDir = str_replace("\\", "/", $ownDir);
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");
// 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 ($config["homedir"] . "/include/functions.php");
require_once ($config["homedir"] . "/include/functions_db.php");
require_once ($config["homedir"] . "/include/auth/mysql.php");
global $config;
if (! isset($_SESSION["id_usuario"])) {
session_start();
session_write_close();
}
// Login check
if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null;

View File

@ -111,7 +111,7 @@ $table->head[2] = __('Event type');
$table->head[3] = __('Event status');
$table->head[4] = __('Severity');
$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[0] = 'font-weight: bold';
$table->align = array ();
@ -178,12 +178,32 @@ echo "</div>";
?>
<script type="text/javascript">
function check_all_checkboxes() {
if ($("#checkbox-all_delete").prop("checked")) {
$(".check_delete").prop('checked', true);
}
else {
$(".check_delete").prop('checked', false);
}
}
$("input[name=all_delete]").css("margin-left", "32px");
$( document ).ready(function() {
$('[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>

View File

@ -16,6 +16,8 @@
global $config;
include_once($config['homedir'] . "/include/functions_event_responses.php");
check_login ();
if (! check_acl($config['id_user'], 0, "PM")) {
@ -25,14 +27,7 @@ if (! check_acl($config['id_user'], 0, "PM")) {
return;
}
if (!is_user_admin($config['id_user'])) {
$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');
}
$event_responses = event_responses_get_responses();
if(empty($event_responses)) {
ui_print_info_message ( array('no_close'=>true, 'message'=> __('No responses found') ) );

View File

@ -40,24 +40,9 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params');
if (enterprise_installed()) {
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;
}
$result = db_process_sql_insert('tevent_response', $values);
$values['server_to_exec'] = get_parameter('server_to_exec');
$result = event_responses_create_response($values);
if($result) {
ui_print_success_message(__('Response added succesfully'));
@ -78,26 +63,10 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params');
if (enterprise_installed()) {
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;
}
$values['server_to_exec'] = get_parameter('server_to_exec');
$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) {
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 godmode tab");
$table->head[] = __("Operation");
/*
$table->width = array();
$table->width[] = '30%';
$table->width[] = '30%';
*/
$table->width = '100%';
$table->class = 'databox data';
$table->align = array();
$table->align[] = 'left';

View File

@ -245,11 +245,12 @@ $module_types = db_get_all_rows_filter (
if ($module_types === false)
$module_types = array ();
$types = '';
$types = array();
foreach ($module_types as $type) {
$types[$type['id_tipo']] = $type['description'];
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->data = array ();
@ -274,7 +275,7 @@ $table->data['form_modules_1'][1] = html_print_select ($types, 'module_type', ''
'width:100%');
$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' .
html_print_checkbox_extended("force_type", 'type', '', '', false,
'', 'style="margin-right: 40px;"', true);
'style="margin-right: 40px;"', true, '');
$modules = array ();
if ($module_type != '') {

View File

@ -175,6 +175,7 @@ if ($update) {
}
}
$table = new stdClass();
$table->id = 'delete_table';
$table->class = 'databox filters';
$table->width = '100%';
@ -235,7 +236,7 @@ switch ($config["dbtype"]) {
if ($module_types === false)
$module_types = array ();
$types = '';
$types = array();
foreach ($module_types as $type) {
$types[$type['id_tipo']] = $type['description'];
}
@ -248,22 +249,18 @@ $snmp_versions['3'] = 'v. 3';
$table->width = '100%';
$table->data = array ();
$table->data['selection_mode'][0] = __('Selection mode');
$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>';
$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);
$table->rowclass['form_modules_1'] = 'select_modules_row';
$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] .= html_print_image('images/spinner.png', true);
$table->data['form_modules_1'][0] .= '</span>';
$types[0] = __('All');
$table->colspan['form_modules_1'][1] = 2;
$table->data['form_modules_1'][1] = html_print_select ($types,
@ -271,7 +268,7 @@ $table->data['form_modules_1'][1] = html_print_select ($types,
$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' .
html_print_checkbox_extended ("force_type", 'type', '', '', false,
'', 'style="margin-right: 40px;"', true);
'style="margin-right: 40px;"', true, '');
$modules = array ();
if ($module_type != '') {

View File

@ -120,7 +120,9 @@ if (check_acl ($config['id_user'], 0, "AW")) {
$sub2["godmode/massive/massive_operations&amp;tab=massive_users"]["text"] = __('Users operations');
}
$sub2["godmode/massive/massive_operations&amp;tab=massive_alerts"]["text"] = __('Alerts operations');
enterprise_hook('massivepolicies_submenu');
if ($config["centralized_management"] != 1) {
enterprise_hook('massivepolicies_submenu');
}
enterprise_hook('massivesnmp_submenu');
enterprise_hook('massivesatellite_submenu');

View File

@ -193,7 +193,7 @@ $table->class = 'databox data';
$table->head = array ();
$table->head[0] = __('Name');
$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[0] = 'font-weight: bold';
$table->align = array ();
@ -250,12 +250,31 @@ enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").prop('checked')) {
$(".check_delete").prop('checked', true);
}
else {
$(".check_delete").prop('checked', false);
}
}
$( document ).ready(function() {
$('[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>

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; ' .
__('Network component management'), "", false,
"network_component", true,"",true,"modulemodal");
"network_component", true,"",false,"modulemodal");
$sec = 'gmodules';
}
@ -568,8 +568,7 @@ $table->head[3] = __('Description');
$table->head[4] = __('Group');
$table->head[5] = __('Max/Min');
$table->head[6] = __('Action') .
html_print_checkbox('all_delete', 0, false, true, false,
'check_all_checkboxes();');
html_print_checkbox('all_delete', 0, false, true, false);
$table->size = array ();
$table->size[1] = '75px';
$table->size[6] = '80px';
@ -650,12 +649,30 @@ enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").prop("checked")) {
$(".check_delete").prop("checked", true);
}
else {
$(".check_delete").prop("checked", true);
}
}
$( document ).ready(function() {
$('[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>

View File

@ -125,7 +125,7 @@ $table->data[4][1] .= html_print_input_text ('max_warning', $max_warning,
'', 5, 15, true) . '</span>';
$table->data[4][1] .= '<span id="string_warning"><em>'.__('Str.').' </em>&nbsp;';
$table->data[4][1] .= html_print_input_text ('str_warning', $str_warning,
'', 5, 15, true) . '</span>';
'', 5, 64, true) . '</span>';
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true);
@ -142,7 +142,7 @@ $table->data[5][1] .= html_print_input_text ('max_critical', $max_critical,
'', 5, 15, true) . '</span>';
$table->data[5][1] .= '<span id="string_critical"><em>'.__('Str.').' </em>&nbsp;';
$table->data[5][1] .= html_print_input_text ('str_critical', $str_critical,
'', 5, 15, true) . '</span>';
'', 5, 64, true) . '</span>';
$table->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table->data[5][1] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true);

View File

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

View File

@ -119,8 +119,7 @@ $table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('Group');
$table->head[2] = __('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[0] = 'font-weight: bold';
$table->align = array ();
@ -174,12 +173,30 @@ enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").attr('checked')) {
$(".check_delete").attr('checked', true);
}
else {
$(".check_delete").attr('checked', false);
}
}
$( document ).ready(function() {
$('[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>

View File

@ -195,7 +195,8 @@ if ($add_module) {
"')");
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
$order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
$order = $order['field_order'];
foreach($id_agent_modules as $id_agent_module){
$order++;
@ -207,8 +208,13 @@ if ($add_module) {
}
if ($delete_module) {
$id_graph = get_parameter('id');
$deleteGraph = get_parameter('delete');
$order_val = db_get_value('field_order', 'tgraph_source', 'id_gs', $deleteGraph);
$result = db_process_sql_delete('tgraph_source', array('id_gs' => $deleteGraph));
db_process_sql ('UPDATE tgraph_source SET field_order=field_order-1 WHERE id_graph='.$id_graph.' AND field_order>'.$order_val);
}
if ($change_weight) {

View File

@ -168,8 +168,7 @@ if (!empty ($graphs)) {
$op_column = true;
$table->align[4] = 'left';
$table->head[4] = __('Op.') .
html_print_checkbox('all_delete', 0, false, true, false,
'check_all_checkboxes();');
html_print_checkbox('all_delete', 0, false, true, false);
$table->size[4] = '90px';
}
$table->data = array ();
@ -236,13 +235,29 @@ else {
$("input[name=all_delete]").css("margin-left", "32px");
function check_all_checkboxes() {
if ($("input[name=all_delete]").prop("checked")) {
$(".check_delete").prop("checked", true);
}
else {
$(".check_delete").prop("checked", false);
}
}
$( document ).ready(function() {
$('[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>

View File

@ -1574,7 +1574,8 @@ You can of course remove the warnings, that's why we include the source and do n
<tr id="row_historical_db_check" style="" class="datos">
<td style="font-weight:bold;">
<?php echo __('Query History Database'); ?>
<?php echo __('Query History Database')
. ui_print_help_tip(__('With the token enabled the query will affect the Historical Database, which may mean a small drop in performance.'), true); ?>
</td>
<td style="">
<?php
@ -1615,16 +1616,6 @@ You can of course remove the warnings, that's why we include the source and do n
?>
</td>
</tr>
<tr id="row_hide_notinit_agents" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Hide not init agents');?></td>
<td>
<?php
html_print_checkbox('hide_notinit_agents', 1,
$hide_notinit_agents, false, false);
?>
</td>
</tr>
<tr id="row_priority_mode" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Priority mode');?></td>

View File

@ -28,6 +28,27 @@ $( document ).ready(function() {
});
});
$('[id^=checkbox-massive_report_check]').change(function(){
if($(this).parent().parent().parent().hasClass('checkselected')){
$(this).parent().parent().parent().removeClass('checkselected');
}
else{
$(this).parent().parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-massive_report_check]').parent().parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true);
}
else{
$('[id^=checkbox-massive_report_check]').parent().parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false);
}
});
});
</script>
@ -715,9 +736,10 @@ switch ($action) {
if ($edit || $delete) {
$columnview = true;
if (!isset($table->head[$next])) {
$table->head[$next] = '<span title="Operations">' . __('Op.') . '</span>';
$table->head[$next] = '<span title="Operations">' . __('Op.') . '</span>'.
html_print_checkbox('all_delete', 0, false, true, false);
$table->size = array ();
$table->size[$next] = '80px';
//$table->size[$next] = '80px';
$table->style[$next] = 'text-align:left;';
}
@ -1847,7 +1869,7 @@ switch ($action) {
break;
}
metaconsole_restore_db_force();
metaconsole_restore_db();
$temp_sort[$report_item['id_rc']] = $element_name;

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