Merge remote-tracking branch 'origin/develop' into fix/reverse-proxy

Former-commit-id: e621a700020a9da04f1a9ae50a1961638fd5ece3
This commit is contained in:
fbsanchez 2018-12-05 08:45:18 +01:00
commit 1b7f3b7251
124 changed files with 2272 additions and 1334 deletions

View File

@ -248,3 +248,10 @@ button h3 {
.sev-Maintenance {
background: #A8A8A8;
}
.sev-Minor {
background: #F099A2;
color: #333;
}
.sev-Major {
background: #C97A4A;
}

View File

@ -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_agente,
'date' : event.timestamp,
'title' : event.evento,
'module' : event.id_agentmodule,
'type' : event.event_type,
'source' : event.source,
'severity' : event.criticity_name,
'visited' : false
});
}
@ -215,7 +215,7 @@ function getNotification(pEvent){
if(pEvent['module'] != 0) even += " in the module with Id "+ pEvent['module'];
even += ".";
var url = (pEvent['agent']=="")
var url = (pEvent['agent'] == 0)
? localStorage["ip_address"]+"/index.php?sec=eventos&sec2=operation/events/events"
: localStorage["ip_address"]+"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" + pEvent['agent'];

View File

@ -1,17 +1,14 @@
console.log("hola");
var url = window.location.href;
var 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

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

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

@ -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,8 +333,10 @@ sub parse_options {
# Compress data
if (defined ($opts{'z'})) {
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

@ -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,8 +333,10 @@ sub parse_options {
# Compress data
if (defined ($opts{'z'})) {
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

@ -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,8 +333,10 @@ sub parse_options {
# Compress data
if (defined ($opts{'z'})) {
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 @@
package: pandorafms-agent-unix
Version: 7.0NG.729-181121
Version: 7.0NG.729-181205
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.729-181121"
pandora_version="7.0NG.729-181205"
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

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.729
%define release 181121
%define release 181205
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.729
%define release 181121
%define release 181205
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.729"
PI_BUILD="181121"
PI_BUILD="181205"
OS_NAME=`uname -s`
FORCE=0

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,8 +333,10 @@ sub parse_options {
# Compress data
if (defined ($opts{'z'})) {
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

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{181121}
{181205}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.729(Build 181121)")
#define PANDORA_VERSION ("7.0NG.729(Build 181205)")
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.729(Build 181121))"
VALUE "ProductVersion", "(7.0NG.729(Build 181205))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

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

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.729-181121"
pandora_version="7.0NG.729-181205"
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

@ -17,11 +17,11 @@
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

View File

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

View File

@ -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', 22);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 23);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_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', '729');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '730');
-- ---------------------------------------------------------------------
-- Table `tconfig_os`
@ -1826,3 +1826,9 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
`module_search` varchar(600) default '',
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default '';
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0';
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `group_search` int(10) unsigned default '0';

View File

@ -32,9 +32,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 +46,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

@ -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

@ -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

@ -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

@ -215,6 +215,7 @@ if ($delete_action) {
__('Could not be deleted'));
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->data = array ();

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

@ -229,15 +229,31 @@ $(document).ready (function () {
});
$("#left").click (function () {
var current_fields_size = ($('#fields_selected option').length);
var selected_fields = [];
var selected_fields_total = '';
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
field_name = $(value).html();
if (field_name != <?php echo "'".__('None')."'"; ?>) {
id_field = $(value).attr('value');
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
$("#fields_selected").find("option[value='" + id_field + "']").remove();
$("#fields_available").find("option[value='0']").remove();
}
selected_fields.push(field_name);
selected_fields_total = selected_fields.length;
});
if(selected_fields_total === current_fields_size){
display_confirm_dialog(
"<?php echo '<span style=text-transform:none;font-size:9.5pt;>'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>",
"<?php echo __('Confirm'); ?>",
"<?php echo __('Cancel'); ?>",
function () {
move_left();
$("#fields_available").find("option[value='timestamp']").remove();
$("select[name='fields_selected[]']").append($("<option></option>").val('timestamp').html('<i>' + 'Timestamp' + '</i>'));
}
);
}
else{
move_left();
}
});
$("#submit-upd_button").click(function () {
@ -247,4 +263,16 @@ $(document).ready (function () {
});
});
});
function move_left(){
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
field_name = $(value).html();
if (field_name != <?php echo "'".__('None')."'"; ?>) {
id_field = $(value).attr('value');
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
$("#fields_selected").find("option[value='" + id_field + "']").remove();
$("#fields_available").find("option[value='0']").remove();
}
});
}
</script>

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);
$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;
}
$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

@ -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');
if ($config["centralized_management"] != 1) {
enterprise_hook('massivepolicies_submenu');
}
enterprise_hook('massivesnmp_submenu');
enterprise_hook('massivesatellite_submenu');

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';
}

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

View File

@ -220,7 +220,6 @@ function update_button_palette_callback() {
// TODO VALIDATE DATA
switch (selectedItem) {
case 'background':
if(values['width'] < 1024 || values['height'] < 768){
alert('Min allowed size is 1024x768');
return false;
@ -235,7 +234,6 @@ function update_button_palette_callback() {
$("#background").css('width', values['width']);
$("#background").css('height', values['height']);
//$("#background").css('background', 'url(images/console/background/' + values['background'] + ')');
var image = values['background'];
$("#background_img").attr('src', "images/spinner.gif");
set_image("background", null, image);
@ -243,7 +241,6 @@ function update_button_palette_callback() {
idElement = 0;
break;
case 'box_item':
if($('input[name=width_box]').val() == ''){
alert('Undefined width');
return false;
@ -275,39 +272,29 @@ function update_button_palette_callback() {
$("#text_" + idItem).html(values['label']);
if(values['show_statistics'] == 1){
if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;');
}
else if(values['label_position'] == 'right'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;');
}
else{
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png");
}
$('#'+idItem).append($image);
}
if ((values['width'] == 0) || (values['height'] == 0)) {
@ -318,7 +305,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', '520px');
$("#image_" + idItem).css('height', '80px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
}
else {
$("#image_" + idItem).removeAttr('width');
@ -329,46 +315,33 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', values['height'] + 'px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
}
}
else{
if ((values['width'] == 0) || (values['height'] == 0)) {
if(values['image'] != '' && values['image'] != 'none'){
if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;');
}
else if(values['label_position'] == 'right'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;');
}
else{
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png");
}
$('#'+idItem).append($image);
}
if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
@ -382,15 +355,11 @@ function update_button_palette_callback() {
else{
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
}
}
else{
$("#image_" + idItem).removeAttr('width');
@ -401,7 +370,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', '70px');
$("#image_" + idItem).remove();
}
}
else {
$("#image_" + idItem).removeAttr('width');
@ -411,14 +379,9 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px');
}
}
break;
case 'static_graph':
if($('input[name=width]').val() == ''){
alert('Undefined width');
return false;
@ -435,8 +398,6 @@ function update_button_palette_callback() {
$("#text_" + idItem).html(values['label']);
if(values['show_statistics'] == 1){
if ((values['width'] == 0) || (values['height'] == 0)) {
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
@ -445,7 +406,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', '520px');
$("#image_" + idItem).css('height', '80px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
}
else {
$("#image_" + idItem).removeAttr('width');
@ -456,49 +416,34 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', values['height'] + 'px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
}
}
else{
if ((values['width'] == 0) || (values['height'] == 0)) {
if(values['image'] != '' && values['image'] != 'none'){
if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;');
}
else if(values['label_position'] == 'right'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;');
}
else{
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png");
}
$('#'+idItem).append($image);
}
if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
@ -510,15 +455,11 @@ function update_button_palette_callback() {
else{
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
}
}
else{
$("#image_" + idItem).removeAttr('width');
@ -529,7 +470,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', '70px');
$("#image_" + idItem).remove();
}
}
else {
$("#image_" + idItem).removeAttr('width');
@ -539,9 +479,7 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px');
}
}
break;
case 'percentile_bar':
case 'percentile_item':
@ -549,6 +487,7 @@ function update_button_palette_callback() {
alert('Undefined width');
return false;
}
if($('input[name=height_percentile]').val() == ''){
alert('Undefined height');
return false;
@ -556,6 +495,7 @@ function update_button_palette_callback() {
$("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif");
if (values['type_percentile'] == 'bubble') {
setPercentileBubble(idItem, values);
}
@ -801,6 +741,10 @@ function readFields() {
values['label'] = $("input[name=label]").val();
var text = tinymce.get('text-label').getContent();
values['label'] = text;
if ($("input[name=percentile_label]").val().length > 0)
values['label'] = $("input[name=percentile_label]").val();
values['line-height'] = $("#text-label_ifr").contents().find("p").css('line-height');
values['type_graph'] = $("select[name=type_graph]").val();
values['image'] = $("select[name=image]").val();
@ -2479,7 +2423,6 @@ function setPercentileCircular (id_data, values) {
width_percentile = values['width_percentile'];
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_value"});
parameter.push ({name: "id_element", value: id_data});
@ -3835,14 +3778,12 @@ function updateDB_visual(type, idElement , values, event, top, left) {
case 'clock':
case 'auto_sla_graph':
case 'donut_graph':
if ((typeof(values['mov_left']) != 'undefined') &&
(typeof(values['mov_top']) != 'undefined')) {
if ((typeof(values['absolute_left']) != 'undefined') &&
(typeof(values['absolute_top']) != 'undefined')) {
$("#" + idElement).css('top', '0px').css('top', top + 'px');
$("#" + idElement).css('left', '0px').css('left', left + 'px');
}
else if ((typeof(values['absolute_left']) != 'undefined') &&
(typeof(values['absolute_top']) != 'undefined')) {
else{
$("#" + idElement).css('top', '0px').css('top', top + 'px');
$("#" + idElement).css('left', '0px').css('left', left + 'px');
}
@ -3952,7 +3893,6 @@ function updateDB(type, idElement , values, event) {
parameter.push({name: key, value: val});
});
switch (type) {
// -- line_item --
case 'handler_start':

View File

@ -1208,21 +1208,21 @@ $(".logo_preview").click (function(e) {
switch (e.target.id) {
case 'button-custom_logo_preview':
icon_name = $("select#custom_logo option:selected").val();
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
options.grayed = true;
break;
case 'button-custom_logo_white_bg_preview':
icon_name = $("select#custom_logo_white_bg option:selected").val();
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
break;
case 'button-custom_logo_login_preview':
icon_name = $("select#custom_logo_login option:selected").val();
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_logo_login/" + icon_name;
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_logo_login/" + icon_name;
options.grayed = true;
break;
case 'button-custom_splash_login_preview':
icon_name = $("select#custom_splash_login option:selected").val();
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_splash_login/" + icon_name;
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_splash_login/" + icon_name;
options.title = "<?php echo __('Splash Preview'); ?>";
break;
case 'button-custom_docs_logo_preview':

View File

@ -175,7 +175,7 @@ if ($id_profile || $new_profile) {
$vconsole_management = (bool) $profile["vconsole_management"];
$id_audit = db_pandora_audit("User management",
"Edit profile ". $name);
"Edit profile ". io_safe_output($name));
enterprise_include_once('include/functions_audit.php');
$info = 'Name: ' . $name .

View File

@ -66,40 +66,19 @@ $id_profile = (int) get_parameter ('id');
// Profile deletion
if ($delete_profile) {
$count_users_admin_in_profile = db_get_value_sql("
SELECT COUNT(*)
FROM tusuario
WHERE is_admin = 1 AND id_user IN (
SELECT id_usuario
FROM tusuario_perfil
WHERE id_perfil = " . $id_profile . ")");
if ($count_users_admin_in_profile >= 1) {
ui_print_error_message(
__('Unsucessful delete profile. Because the profile is used by some admin users.'));
}
else {
// Delete profile
$profile = db_get_row('tperfil', 'id_perfil', $id_profile);
$sql = sprintf ('DELETE FROM tperfil WHERE id_perfil = %d', $id_profile);
$ret = db_process_sql ($sql);
$ret = profile_delete_profile_and_clean_users ($id_profile);
if ($ret === false) {
ui_print_error_message(__('There was a problem deleting the profile'));
}
else {
db_pandora_audit("Profile management",
"Delete profile ". $profile['name']);
"Delete profile ". io_safe_output($profile['name']));
ui_print_success_message(__('Successfully deleted'));
}
//Delete profile from user data
$sql = sprintf ('DELETE FROM tusuario_perfil WHERE id_perfil = %d', $id_profile);
db_process_sql ($sql);
$id_profile = 0;
}
}
// Store the variables when create or update
@ -208,7 +187,7 @@ if ($update_profile) {
"'.get_product_name().' Management":"'.$pandora_management.'"}';
db_pandora_audit("User management",
"Update profile ". $name, false, false, $info);
"Update profile ".io_safe_output($name), false, false, $info);
ui_print_success_message(__('Successfully updated'));
}
@ -255,7 +234,7 @@ if ($create_profile) {
"'.get_product_name().' Management":"'.$pandora_management.'"}';
db_pandora_audit("User management",
"Created profile ". $name, false, false, $info);
"Created profile ". io_safe_output($name), false, false, $info);
}
else {
ui_print_error_message(__('There was a problem creating this profile'));

View File

@ -32,6 +32,7 @@ $append_tab_filter = (bool)get_parameter('append_tab_filter', 0);
$create_filter_cf = (bool)get_parameter('create_filter_cf', 0);
$update_filter_cf = (bool)get_parameter('update_filter_cf', 0);
$delete_filter_cf = (bool)get_parameter('delete_filter_cf', 0);
$change_name_filter = (bool)get_parameter('change_name_filter', 0);
if ($get_custom_fields_data){
$name_custom_fields = get_parameter("name_custom_fields", 0);
@ -40,7 +41,6 @@ if ($get_custom_fields_data){
return;
}
if($build_table_custom_fields){
$order = get_parameter("order", '');
$length = get_parameter("length", 20);
@ -237,6 +237,7 @@ if($build_table_child_custom_fields){
$id_agent = get_parameter("id_agent", 0);
$id_server = get_parameter("id_server", 0);
$module_search = str_replace('amp;', '',get_parameter("module_search", ''));
$module_status = get_parameter("module_status", 0);
if(!$id_server || !$id_agent){
return false;
@ -246,6 +247,46 @@ if($build_table_child_custom_fields){
$name_where = " AND tam.nombre LIKE '%" . $module_search . "%'";
}
//filter by status module
$and_module_status = "";
if(is_array($module_status)){
if(!in_array(-1, $module_status)){
if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $module_status)){
if(count($module_status) > 0){
$and_module_status = " AND ( ";
foreach ($module_status as $key => $value) {
$and_module_status .= ($key != 0)
? " OR ("
: " (";
switch ($value) {
default:
case AGENT_STATUS_NORMAL:
$and_module_status .= " tae.estado = 0 OR tae.estado = 300 ) ";
break;
case AGENT_STATUS_CRITICAL:
$and_module_status .= " tae.estado = 1 OR tae.estado = 100 ) ";
break;
case AGENT_STATUS_WARNING:
$and_module_status .= " tae.estado = 2 OR tae.estado = 200 ) ";
break;
case AGENT_STATUS_UNKNOWN:
$and_module_status .= " tae.estado = 3 ) ";
break;
case AGENT_STATUS_NOT_INIT:
$and_module_status .= " tae.estado = 4 OR tae.estado = 5 ) ";
break;
}
}
$and_module_status .= " ) ";
}
}
else{
//not normal
$and_module_status = "AND tae.estado <> 0 AND tae.estado <> 300 ";
}
}
}
if (is_metaconsole()) {
$server = metaconsole_get_connection_by_id ($id_server);
metaconsole_connect($server);
@ -262,9 +303,10 @@ if($build_table_child_custom_fields){
INNER JOIN tagente_estado tae
ON tam.id_agente_modulo = tae.id_agente_modulo
WHERE tam.id_agente = %d
%s",
%s %s",
$id_agent,
$name_where
$name_where,
$and_module_status
);
$modules = db_get_all_rows_sql ($query);
@ -282,7 +324,7 @@ if($build_table_child_custom_fields){
$table_modules->head[5] = __('Status');
$table_modules->data = array();
$status_agent = -1;
if(isset($modules) && is_array($modules)){
foreach ($modules as $key => $value) {
$table_modules->data[$key][0] = $value['nombre'];
@ -311,9 +353,6 @@ if($build_table_child_custom_fields){
switch ($value['estado']) {
case 0:
case 300:
if($status_agent != 1 && $status_agent != 2 && $status_agent != 3){
$status_agent = 0;
}
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_normal.png',
true,
@ -324,7 +363,6 @@ if($build_table_child_custom_fields){
break;
case 1:
case 100:
$status_agent = 1;
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_critical.png',
true,
@ -335,10 +373,6 @@ if($build_table_child_custom_fields){
break;
case 2:
case 200:
if($status_agent != 1){
$status_agent = 2;
}
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_warning.png',
true,
@ -348,10 +382,6 @@ if($build_table_child_custom_fields){
);
break;
case 3:
if($status_agent != 1 && $status_agent != 2){
$status_agent = 3;
}
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_maintenance.png',
true,
@ -362,9 +392,6 @@ if($build_table_child_custom_fields){
break;
case 4:
case 5:
if($status_agent == -1 || $status_agent == 4){
$status_agent = 5;
}
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_informational.png',
true,
@ -374,10 +401,6 @@ if($build_table_child_custom_fields){
);
break;
default:
if($status_agent != 1 && $status_agent != 2 && $status_agent != 3){
$status_agent = 0;
}
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_normal.png',
true,
@ -390,6 +413,8 @@ if($build_table_child_custom_fields){
}
}
$status_agent = agents_get_status($id_agent, true);
if (is_metaconsole()) {
metaconsole_restore_db();
}
@ -435,12 +460,14 @@ if($build_table_save_filter){
$table->class = 'databox';
$array_filters = get_filters_custom_fields_view(0, true);
$table->data[0][0] = __('Filter name');
$table->data[0][1] = html_print_select(
$array_filters, 'id_name',
'', '', '', '',
true, false, true, '', false
);
$table->data[0][3] = html_print_submit_button (__('Load filter'), 'load_filter', false, 'class="sub upd"', true);
echo "<form action='' method='post'>";
@ -462,7 +489,16 @@ if($append_tab_filter){
echo "<div id='msg_error_create'></div>";
$table->data[0][0] = __('Filter name');
$table->data[0][1] = html_print_input_text('id_name', '', '', 15, 255, true);
$table->data[0][2] = html_print_submit_button (__('Create filter'), 'create_filter', false, 'class="sub upd"', true);
$table->data[0][2] = __('Group');
$table->data[0][3] = html_print_select_groups(
$config['id_user'], 'AR', true, 'group_search_cr',
0, '', '', '0', true, false,
false, '', false, '', false, false,
'id_grupo', false
);
$table->data[0][4] = html_print_submit_button (__('Create filter'), 'create_filter', false, 'class="sub upd"', true);
}
else{
echo "<div id='msg_error_update'></div>";
@ -470,12 +506,22 @@ if($append_tab_filter){
$array_filters = get_filters_custom_fields_view(0, true);
$table->data[0][0] = __('Filter name');
$table->data[0][1] = html_print_select(
$array_filters, 'id_name',
'', '', __('None'), -1,
true, false, true, '', false
$array_filters, 'id_name', '',
'filter_name_change_group(this.value)',
__('None'), -1, true, false, true,
'', false
);
$table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups(
$config['id_user'], 'AR', true, 'group_search_up',
$group, '', '', '0', true, false,
false, '', false, '', false, false,
'id_grupo', false
);
$table->data[0][2] = html_print_submit_button (__('Delete filter'), 'delete_filter', false, 'class="sub upd"', true);
$table->data[0][3] = html_print_submit_button (__('Update filter'), 'update_filter', false, 'class="sub upd"', true);
$table->data[1][2] = html_print_submit_button (__('Update filter'), 'update_filter', false, 'class="sub upd"', true);
}
html_print_table($table);
@ -491,6 +537,7 @@ if($create_filter_cf){
//initialize vars
$filters = json_decode(io_safe_output(get_parameter("filters", '')), true);
$name_filter = get_parameter("name_filter", '');
$group_search = get_parameter("group_search", 0);
//check that the name is not empty
if($name_filter == ''){
@ -529,11 +576,14 @@ if($create_filter_cf){
//insert
$values = array();
$values['name'] = $name_filter;
$values['group_search'] = $group_search;
$values['id_group'] = $filters['group'];
$values['id_custom_field'] = $filters['id_custom_fields'];
$values['id_custom_fields_data'] = json_encode($filters['id_custom_fields_data']);
$values['id_status'] = json_encode($filters['id_status']);
$values['module_search'] = $filters['module_search'];
$values['module_status'] = json_encode($filters['module_status']);
$values['recursion'] = $filters['recursion'];
$insert = db_process_sql_insert('tagent_custom_fields_filter', $values);
@ -565,6 +615,7 @@ if($update_filter_cf){
//initialize vars
$filters = json_decode(io_safe_output(get_parameter("filters", '')), true);
$id_filter = get_parameter("id_filter", '');
$group_search = get_parameter("group_search", 0);
//check selected filter
if($id_filter == -1){
@ -595,10 +646,13 @@ if($update_filter_cf){
//array values update
$values = array();
$values['id_group'] = $filters['group'];
$values['group_search'] = $group_search;
$values['id_custom_field'] = $filters['id_custom_fields'];
$values['id_custom_fields_data'] = json_encode($filters['id_custom_fields_data']);
$values['id_status'] = json_encode($filters['id_status']);
$values['module_search'] = $filters['module_search'];
$values['module_status'] = json_encode($filters['module_status']);
$values['recursion'] = $filters['recursion'];
//update
$update = db_process_sql_update('tagent_custom_fields_filter', $values, $condition);
@ -669,6 +723,16 @@ if($delete_filter_cf){
return;
}
if($change_name_filter){
$id_filter = get_parameter("id_filter", 0);
if(isset($id_filter)){
$res = get_group_filter_custom_field_view($id_filter);
echo json_encode($res);
return;
}
return json_encode(false);
}

View File

@ -472,16 +472,17 @@ if ($list_modules) {
$sort = get_parameter('sort', 'none');
$selected = 'border: 1px solid black;';
$order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC');
switch ($sortField) {
case 'type':
switch ($sort) {
case 'up':
$selectTypeUp = $selected;
$order = array('field' => 'tagente_modulo.id_modulo', 'order' => 'ASC');
$order[] = array('field' => 'tagente_modulo.id_modulo', 'order' => 'ASC');
break;
case 'down':
$selectTypeDown = $selected;
$order = array('field' => 'tagente_modulo.id_modulo', 'order' => 'DESC');
$order[] = array('field' => 'tagente_modulo.id_modulo', 'order' => 'DESC');
break;
}
break;
@ -489,11 +490,11 @@ if ($list_modules) {
switch ($sort) {
case 'up':
$selectNameUp = $selected;
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
break;
case 'down':
$selectNameDown = $selected;
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC');
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC');
break;
}
break;
@ -501,11 +502,11 @@ if ($list_modules) {
switch ($sort) {
case 'up':
$selectStatusUp = $selected;
$order = array('field' => 'tagente_estado.estado=0 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=1 DESC', 'order' => '');
$order[] = array('field' => 'tagente_estado.estado=0 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=1 DESC', 'order' => '');
break;
case 'down':
$selectStatusDown = $selected;
$order = array('field' => 'tagente_estado.estado=1 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=0 DESC', 'order' => '');
$order[] = array('field' => 'tagente_estado.estado=1 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=0 DESC', 'order' => '');
break;
}
break;
@ -513,11 +514,11 @@ if ($list_modules) {
switch ($sort) {
case 'up':
$selectLastContactUp = $selected;
$order = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC');
$order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC');
break;
case 'down':
$selectLastContactDown = $selected;
$order = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC');
$order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC');
break;
}
break;
@ -533,7 +534,7 @@ if ($list_modules) {
$selectLastContactUp = '';
$selectLastContactDown = '';
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
break;
}
@ -588,7 +589,20 @@ if ($list_modules) {
}
//Count monitors/modules
$order_sql = $order['field'] . " " . $order['order'];
// Build the order sql
$first = true;
foreach ($order as $ord) {
if ($first) {
$first = false;
}
else {
$order_sql .= ',';
}
$order_sql .= $ord['field'].' '.$ord['order'];
}
$sql_condition = "FROM tagente_modulo
$tags_join
INNER JOIN tagente_estado

View File

@ -29,7 +29,6 @@ if ($get_image_path_status){
$result['bad'] = html_print_image($img_src . '_bad.png', true, '', $only_src);
$result['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
$result['warning'] = html_print_image($img_src . '_warning.png', true, '', $only_src);
$result['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
$result['normal'] = html_print_image($img_src . '.png', true, '', $only_src);
echo json_encode($result);

View File

@ -72,18 +72,14 @@ switch($info) {
if (isInACL($ipOrigin)) {
if (empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) {
$user_in_db = process_user_login($user, $password, true);
if ($user_in_db !== false) {
$config['id_user'] = $user_in_db;
$correctLogin = true;
//XXXX
session_start();
if (session_status() === PHP_SESSION_NONE) session_start();
$_SESSION["id_usuario"] = $user;
session_write_close();
file_put_contents(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id(), $user);
}
else {
$no_login_msg = "Incorrect user credentials";
@ -186,11 +182,6 @@ if ($correctLogin) {
returnError('no_exist_operation', $returnType);
}
}
//XXXXX
if (file_exists(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id())) {
unlink(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id());
}
}
else {
// TODO: Implement a new switch in config to enable / disable

View File

@ -1,160 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 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 Lesser 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 Include/auth
*/
if (!isset ($config)) {
die ('
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pandora FMS - The Flexible Monitoring System - Console error</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=utf8">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="author" content="Artica ST">
<meta name="copyright" content="(c) Artica ST">
<meta name="robots" content="index, follow">
<link rel="icon" href="../../images/pandora.ico" type="image/ico">
<link rel="stylesheet" href="../styles/pandora.css" type="text/css">
</head>
<body>
<div id="main" style="float:left; margin-left: 100px">
<div align="center">
<div id="login_f">
<h1 id="log_f" class="error">You cannot access this file</h1>
<div>
<img src="../../images/pandora_logo.png" border="0"></a>
</div>
<div class="msg">
<span class="error"><b>ERROR:</b>
You can\'t access this file directly!</span>
</div>
</div>
</div>
</body>
</html>
');
}
$config["user_can_update_password"] = false;
$config["admin_can_add_user"] = false;
$config["admin_can_delete_user"] = false;
$config["admin_can_disable_user"] = false;
global $dev_cache; //This variable needs to be globalized because this file is called from within a function and thus local
//DON'T USE THIS IF YOU DON'T KNOW WHAT YOU'RE DOING
die ("This is a very dangerous authentication scheme. Only use for programming in case you should uncomment this line");
/**
* process_user_login accepts $login and $pass and handles it according to current authentication scheme
*
* @param string $login
* @param string $pass
*
* @return mixed False in case of error or invalid credentials, the username in case it's correct.
*/
function process_user_login ($login, $pass) {
return false; //Error
return $login; //Good
}
/**
* Checks if a user is administrator.
*
* @param string User id.
*
* @return bool True is the user is admin
*/
function is_user_admin ($user) {
return true; //User is admin
return false; //User isn't
}
/**
* Check is a user exists in the system
*
* @param string User id.
*
* @return bool True if the user exists.
*/
function is_user ($id_user) {
return true;
return false;
}
/**
* Gets the users real name
*
* @param string User id.
*
* @return string The users full name
*/
function get_user_fullname ($id_user) {
return "admin";
return "";
return false;
}
/**
* Gets the users email
*
* @param string User id.
*
* @return string The users email address
*/
function get_user_email ($id_user) {
return "test@example.com";
return "";
return false;
}
/**
* Get a list of all users in an array [username] => real name
*
* @param string Field to order by (id_usuario, nombre_real or fecha_registro)
*
* @return array An array of users
*/
function get_users ($order = "nombre_real") {
return array ("admin" => "Admini Strator");
}
/**
* Sets the last login for a user
*
* @param string User id
*/
function process_user_contact ($id_user) {
//void
}
/**
* Deletes the user
*
* @param string User id
*/
function delete_user ($id_user) {
return true;
return false;
}
//Reference the global use authorization error to last ldap error.
$config["auth_error"] = &$dev_cache["auth_error"];
?>

View File

@ -13,17 +13,8 @@
// GNU General Public License for more details.
// Global & session manageme
session_id($_REQUEST["session_id"]);
if (file_exists(session_save_path() . "/pansess_" . session_id()) ) {
$user = file_get_contents(session_save_path() . "/pansess_" . session_id());
}
session_start();
if (isset($user)) {
$_SESSION["id_usuario"] = $user;
}
session_write_close();
require_once ('config.php');
require_once ($config['homedir'] . '/include/auth/mysql.php');
@ -132,7 +123,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['height'],
$params['water_mark_url'],
$params['font'],
$params['font_size'],
$config['font_size'],
$params['legend_position'],
$params['colors'],
$params['hide_labels']
@ -151,7 +142,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['water_mark_url'],
$params['homedir'],
$params['font'],
$params['font_size'],
$config['font_size'],
$params['from_ux'],
$params['from_wux'],
$params['backgroundColor'],
@ -165,7 +156,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['height'],
$params['water_mark_url'],
$params['font'],
$params['font_size'],
$config['font_size'],
$params['backgroundColor'],
$params['tick_color'],
$params['val_min'],
@ -185,7 +176,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
'',
$params['water_mark'],
$params['font'],
$params['font_size'],
$config['font_size'],
$params['unit'],
$params['ttl'],
$params['homeurl'],
@ -211,7 +202,9 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['id_agent'],
$params['full_legend_daterray'],
$params['not_interactive'],
1
$params['ttl'],
$params['widgets'],
$params['show']
);
break;
default:
@ -222,6 +215,16 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$config['font_size'] = $aux_font_size;
?>
<script type="text/javascript">
$('document').ready(function () {
setTimeout(function () {
if (typeof window.callPhantom === 'function') {
window.callPhantom("loaded");
}
}, 10);
});
</script>
</body>
</html>

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC181121';
$build_version = 'PC181205';
$pandora_version = 'v7.0NG.729';
// Do not overwrite default timezone set if defined.
@ -176,7 +176,7 @@ date_default_timezone_set("Europe/Madrid");
//////////////////////////////////////
require_once ($config["homedir"].'/include/load_session.php');
if (session_id() == '') session_start();
if (session_status() === PHP_SESSION_NONE) session_start();
config_process_config();
config_prepare_session();

View File

@ -1787,10 +1787,7 @@ function check_login ($output = true) {
}
else {
require_once($config["homedir"].'/mobile/include/user.class.php');
if(session_id() == '') {
session_start ();
}
session_write_close ();
if (isset($_SESSION['user'])) {
$user = $_SESSION['user'];
$id_user = $user->getIdUser();
@ -3323,12 +3320,13 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
. ' "' . $session_id . '"'
. ' "' . $params['return_img_base_64'] . '"';
$result = exec($cmd);
exec($cmd, $result);
$img_content = join("\n", $result);
if($params['return_img_base_64']){
// To be used in alerts
$width_img = 500;
return $result;
return $img_content;
}
else{
// to be used in PDF files
@ -3372,7 +3370,7 @@ function get_copyright_notice () {
*/
function generate_csrf_code() {
// Start session to make this var permanent
session_start();
if (session_status() === PHP_SESSION_NONE) session_start();
$_SESSION['csrf_code'] = md5(uniqid(mt_rand(), true));
session_write_close();
return $_SESSION['csrf_code'];

View File

@ -361,11 +361,13 @@ function agents_get_agents ($filter = false, $fields = false,
break;
case AGENT_STATUS_NOT_NORMAL:
$status_sql = "(
critical_count > 0
OR warning_count > 0
OR unknown_count > 0
OR total_count = 0
normal_count <> total_count
OR total_count = notinit_count)";
//The AGENT_STATUS_NOT_NORMAL filter must show all agents that are not in normal status
/*"(
normal_count <> total_count
AND
(normal_count + notinit_count) <> total_count)";*/
break;
case AGENT_STATUS_NOT_INIT:
$status_sql = "(

View File

@ -1845,9 +1845,9 @@ function get_group_alerts($id_group, $filter = '', $options = false,
}
}
$selectText = 'talert_template_modules.*, t2.nombre AS agent_module_name, t3.alias AS agent_name, t4.name AS template_name';
$selectText = 'DISTINCT talert_template_modules.*, t2.nombre AS agent_module_name, t3.alias AS agent_name, t4.name AS template_name';
if ($count !== false) {
$selectText = 'COUNT(talert_template_modules.id) AS count';
$selectText = 'COUNT(DISTINCT talert_template_modules.id) AS count';
}
$sql = sprintf ("SELECT %s

View File

@ -30,6 +30,8 @@ include_once($config['homedir'] . "/include/functions_network_components.php");
include_once($config['homedir'] . "/include/functions_netflow.php");
include_once($config['homedir'] . "/include/functions_servers.php");
include_once($config['homedir'] . "/include/functions_planned_downtimes.php");
include_once($config['homedir'] . "/include/functions_db.php");
include_once($config['homedir'] . "/include/functions_event_responses.php");
enterprise_include_once ('include/functions_local_components.php');
enterprise_include_once ('include/functions_events.php');
enterprise_include_once ('include/functions_agents.php');
@ -1411,10 +1413,6 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3) {
return;
}
if (defined ('METACONSOLE')) {
return;
}
$values = array();
$values['name'] = $other['data'][0];
@ -1429,6 +1427,11 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3) {
$resultOrId = false;
if ($other['data'][0] != '') {
$resultOrId = db_process_sql_insert('tconfig_os', $values);
if ($resultOrId)
echo __('Success creating OS');
else
echo __('Error creating OS');
}
}
@ -1436,10 +1439,6 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3) {
function api_set_update_os($id_os, $thrash2, $other, $thrash3) {
global $config;
if (defined ('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, "AW")) {
returnError('forbidden', 'string');
return;
@ -1457,7 +1456,10 @@ function api_set_update_os($id_os, $thrash2, $other, $thrash3) {
if ($other['data'][0] != '') {
$result = db_process_sql_update('tconfig_os', $values, array('id_os' => $id_os));
if (db_process_sql_update('tconfig_os', $values, array('id_os' => $id_os)))
echo __('Success updating OS');
else
echo __('Error updating OS');
}
}
@ -8721,6 +8723,210 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2) {
returnData('string', array('type' => 'string', 'data' => __('Delete user profile.')));
}
/**
* List all user profiles.
*
* @param Reserved $thrash1
* @param Reserved $thrash2
* @param Reserved $thrash3
* @param string Return type (csv, json, string...)
*
* api.php?op=get&op2=user_profiles_info&return_type=json&apipass=1234&user=admin&pass=pandora
*/
function api_get_user_profiles_info ($thrash1, $thrash2, $thrash3, $returnType) {
global $config;
if (!check_acl($config['id_user'], 0, "PM")){
returnError('forbidden', 'string');
return;
}
$profiles = db_get_all_rows_filter(
'tperfil',
array(),
array(
"id_perfil",
"name",
"incident_view as IR",
"incident_edit as IW",
"incident_management as IM",
"agent_view as AR",
"agent_edit as AW",
"agent_disable as AD",
"alert_edit as LW",
"alert_management as LM",
"user_management as UM",
"db_management as DM",
"event_view as ER",
"event_edit as EW",
"event_management as EM",
"report_view as RR",
"report_edit as RW",
"report_management as RM",
"map_view as MR",
"map_edit as MW",
"map_management as MM",
"vconsole_view as VR",
"vconsole_edit as VW",
"vconsole_management as VM",
"pandora_management as PM"
)
);
if ($profiles === false) {
returnError('error_list_profiles', __('Error retrieving profiles'));
} else {
returnData($returnType, array('type' => 'array', 'data' => $profiles));
}
}
/**
* Create an user profile.
*
* @param Reserved $thrash1
* @param Reserved $thrash2
* @param array parameters in array: name|IR|IW|IM|AR|AW|AD|LW|LM|UM|DM|ER|EW|EM|RR|RW|RM|MR|MW|MM|VR|VW|VM|PM
* @param string Return type (csv, json, string...)
*
* api.php?op=set&op2=create_user_profile_info&return_type=json&other=API_profile%7C1%7C0%7C0%7C1%7C0%7C0%7C0%7C0%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
*/
function api_set_create_user_profile_info ($thrash1, $thrash2, $other, $returnType) {
global $config;
if (!check_acl($config['id_user'], 0, "PM")){
returnError('forbidden', 'string');
return;
}
$values = array(
'name' => (string)$other['data'][0],
'incident_view' => (bool)$other['data'][1] ? 1 : 0,
'incident_edit' => (bool)$other['data'][2] ? 1 : 0,
'incident_management' => (bool)$other['data'][3] ? 1 : 0,
'agent_view' => (bool)$other['data'][4] ? 1 : 0,
'agent_edit' => (bool)$other['data'][5] ? 1 : 0,
'agent_disable' => (bool)$other['data'][6] ? 1 : 0,
'alert_edit' => (bool)$other['data'][7] ? 1 : 0,
'alert_management' => (bool)$other['data'][8] ? 1 : 0,
'user_management' => (bool)$other['data'][9] ? 1 : 0,
'db_management' => (bool)$other['data'][10] ? 1 : 0,
'event_view' => (bool)$other['data'][11] ? 1 : 0,
'event_edit' => (bool)$other['data'][12] ? 1 : 0,
'event_management' => (bool)$other['data'][13] ? 1 : 0,
'report_view' => (bool)$other['data'][14] ? 1 : 0,
'report_edit' => (bool)$other['data'][15] ? 1 : 0,
'report_management' => (bool)$other['data'][16] ? 1 : 0,
'map_view' => (bool)$other['data'][17] ? 1 : 0,
'map_edit' => (bool)$other['data'][18] ? 1 : 0,
'map_management' => (bool)$other['data'][19] ? 1 : 0,
'vconsole_view' => (bool)$other['data'][20] ? 1 : 0,
'vconsole_edit' => (bool)$other['data'][21] ? 1 : 0,
'vconsole_management' => (bool)$other['data'][22] ? 1 : 0,
'pandora_management' => (bool)$other['data'][23] ? 1 : 0
);
$return = db_process_sql_insert('tperfil', $values);
if ($return === false) {
returnError('error_create_user_profile_info', __('Error creating user profile'));
} else {
returnData($returnType, array('type' => 'array', 'data' => 1));
}
}
/**
* Update an user profile.
*
* @param int Profile id
* @param Reserved $thrash1
* @param array parameters in array: name|IR|IW|IM|AR|AW|AD|LW|LM|UM|DM|ER|EW|EM|RR|RW|RM|MR|MW|MM|VR|VW|VM|PM
* @param string Return type (csv, json, string...)
*
* api.php?op=set&op2=update_user_profile_info&return_type=json&id=6&other=API_profile_updated%7C%7C%7C%7C1%7C1%7C1%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
*/
function api_set_update_user_profile_info ($id_profile, $thrash1, $other, $returnType) {
global $config;
if (!check_acl($config['id_user'], 0, "PM")){
returnError('forbidden', 'string');
return;
}
$profile = db_get_row ('tperfil', 'id_perfil', $id_profile);
if ($profile === false) {
returnError('id_not_found', 'string');
return;
}
$values = array(
'name' => $other['data'][0] == '' ? $profile['name'] : (string)$other['data'][0],
'incident_view' => $other['data'][1] == '' ? $profile['incident_view'] : (bool)$other['data'][1] ? 1 : 0,
'incident_edit' => $other['data'][2] == '' ? $profile['incident_edit'] : (bool)$other['data'][2] ? 1 : 0,
'incident_management' => $other['data'][3] == '' ? $profile['incident_management'] : (bool)$other['data'][3] ? 1 : 0,
'agent_view' => $other['data'][4] == '' ? $profile['agent_view'] : (bool)$other['data'][4] ? 1 : 0,
'agent_edit' => $other['data'][5] == '' ? $profile['agent_edit'] : (bool)$other['data'][5] ? 1 : 0,
'agent_disable' => $other['data'][6] == '' ? $profile['agent_disable'] : (bool)$other['data'][6] ? 1 : 0,
'alert_edit' => $other['data'][7] == '' ? $profile['alert_edit'] : (bool)$other['data'][7] ? 1 : 0,
'alert_management' => $other['data'][8] == '' ? $profile['alert_management'] : (bool)$other['data'][8] ? 1 : 0,
'user_management' => $other['data'][9] == '' ? $profile['user_management'] : (bool)$other['data'][9] ? 1 : 0,
'db_management' => $other['data'][10] == '' ? $profile['db_management'] : (bool)$other['data'][10] ? 1 : 0,
'event_view' => $other['data'][11] == '' ? $profile['event_view'] : (bool)$other['data'][11] ? 1 : 0,
'event_edit' => $other['data'][12] == '' ? $profile['event_edit'] : (bool)$other['data'][12] ? 1 : 0,
'event_management' => $other['data'][13] == '' ? $profile['event_management'] : (bool)$other['data'][13] ? 1 : 0,
'report_view' => $other['data'][14] == '' ? $profile['report_view'] : (bool)$other['data'][14] ? 1 : 0,
'report_edit' => $other['data'][15] == '' ? $profile['report_edit'] : (bool)$other['data'][15] ? 1 : 0,
'report_management' => $other['data'][16] == '' ? $profile['report_management'] : (bool)$other['data'][16] ? 1 : 0,
'map_view' => $other['data'][17] == '' ? $profile['map_view'] : (bool)$other['data'][17] ? 1 : 0,
'map_edit' => $other['data'][18] == '' ? $profile['map_edit'] : (bool)$other['data'][18] ? 1 : 0,
'map_management' => $other['data'][19] == '' ? $profile['map_management'] : (bool)$other['data'][19] ? 1 : 0,
'vconsole_view' => $other['data'][20] == '' ? $profile['vconsole_view'] : (bool)$other['data'][20] ? 1 : 0,
'vconsole_edit' => $other['data'][21] == '' ? $profile['vconsole_edit'] : (bool)$other['data'][21] ? 1 : 0,
'vconsole_management' => $other['data'][22] == '' ? $profile['vconsole_management'] : (bool)$other['data'][22] ? 1 : 0,
'pandora_management' => $other['data'][23] == '' ? $profile['pandora_management'] : (bool)$other['data'][23] ? 1 : 0
);
$return = db_process_sql_update('tperfil', $values, array('id_perfil' => $id_profile));
if ($return === false) {
returnError('error_update_user_profile_info', __('Error updating user profile'));
} else {
returnData($returnType, array('type' => 'array', 'data' => 1));
}
}
/**
* Delete an user profile.
*
* @param int Profile id
* @param Reserved $thrash1
* @param Reserved $thrash2
* @param string Return type (csv, json, string...)
*
* api.php?op=set&op2=delete_user_profile_info&return_type=json&id=7&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
*/
function api_set_delete_user_profile_info ($id_profile, $thrash1, $thrash2, $returnType) {
global $config;
if (!check_acl($config['id_user'], 0, "PM")){
returnError('forbidden', 'string');
return;
}
$profile = db_get_value ('id_perfil', 'tperfil', 'id_perfil', $id_profile);
if ($profile === false) {
returnError('id_not_found', 'string');
return;
}
$return = profile_delete_profile_and_clean_users($id_profile);
if ($return === false) {
returnError('error_delete_user_profile_info', __('Error deleting user profile'));
} else {
returnData($returnType, array('type' => 'array', 'data' => 1));
}
}
/**
* Create new incident in Pandora.
*
@ -11468,6 +11674,159 @@ function api_get_modules_id_name_by_cluster_name ($cluster_name){
}
/**
* @param $trash1
* @param $trash2
* @param mixed $trash3
* @param $returnType
* Example:
* api.php?op=get&op2=event_responses&return_type=csv&apipass=1234&user=admin&pass=pandora
*/
function api_get_event_responses($trash1, $trash2, $trash3, $returnType) {
global $config;
// Error if user cannot read event responses.
if (!check_acl($config['id_user'], 0, "PM")) {
returnError('forbidden', $returnType);
return;
}
$responses = event_responses_get_responses();
if (empty($responses)) {
returnError('no_data_to_show', $returnType);
return;
}
returnData ($returnType, array('type' => 'array', 'data' => $responses));
}
/**
* @param $id_response
* @param $trash2
* @param mixed $trash3
* @param $returnType
* Example:
* api.php?op=set&op2=delete_event_response&id=7&apipass=1234&user=admin&pass=pandora
*/
function api_set_delete_event_response($id_response, $trash1, $trash2, $returnType) {
global $config;
// Error if user cannot read event responses.
if (!check_acl($config['id_user'], 0, "PM")) {
returnError('forbidden', $returnType);
return;
}
// Check if id exists
$event_group = db_get_value('id_group', 'tevent_response','id', $id_response);
if ($event_group === false) {
returnError('id_not_found', $returnType);
return;
}
// Check user if can edit the module
if (!check_acl($config['id_user'], $event_group, "PM")) {
returnError('forbidden', $returnType);
return;
}
$result = db_process_sql_delete('tevent_response', array('id' => $id_response));
returnData ($returnType, array('type' => 'string', 'data' => $result));
}
/**
* @param $trash1
* @param $trash2
* @param mixed $other. Serialized params
* @param $returnType
* Example:
* api.php?op=set&op2=create_event_response&other=response%7Cdescription%20response%7Ctouch%7Ccommand%7C0%7C650%7C400%7C0%7Cresponse%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
*/
function api_set_create_event_response($trash1, $trash2, $other, $returnType) {
global $config;
// Error if user cannot read event responses.
if (!check_acl($config['id_user'], 0, "PM")) {
returnError('forbidden', $returnType);
return;
}
$values = array();
$values['name'] = $other['data'][0];
$values['description'] = $other['data'][1];
$values['target'] = $other['data'][2];
$values['type'] = $other['data'][3];
$values['id_group'] = $other['data'][4];
$values['modal_width'] = $other['data'][5];
$values['modal_height'] = $other['data'][6];
$values['new_window'] = $other['data'][7];
$values['params'] = $other['data'][8];
$values['server_to_exec'] = $other['data'][9];
// Error if user has not permission for the group.
if (!check_acl($config['id_user'], $values['id_group'], "PM")) {
returnError('forbidden', $returnType);
return;
}
$return = event_responses_create_response($values) ? 1 : 0;
returnData ($returnType, array('type' => 'string', 'data' => $return));
}
/**
* @param $id_response
* @param $trash2
* @param mixed $other. Serialized params
* @param $returnType
* Example:
* api.php?op=set&op2=update_event_response&id=7&other=response%7Cdescription%20response%7Ctouch%7Ccommand%7C0%7C650%7C400%7C0%7Cresponse%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
*/
function api_set_update_event_response($id_response, $trash1, $other, $returnType) {
global $config;
// Error if user cannot read event responses.
if (!check_acl($config['id_user'], 0, "PM")) {
returnError('forbidden', $returnType);
return;
}
// Check if id exists
$event_response = db_get_row('tevent_response','id', $id_response);
if ($event_response === false) {
returnError('id_not_found', $returnType);
return;
}
// Check user if can edit the module
if (!check_acl($config['id_user'], $event_response['id_group'], "PM")) {
returnError('forbidden', $returnType);
return;
}
$values = array();
$values['name'] = $other['data'][0] == '' ? $event_response['name'] : $other['data'][0];
$values['description'] = $other['data'][1] == '' ? $event_response['description'] : $other['data'][1];
$values['target'] = $other['data'][2] == '' ? $event_response['target'] : $other['data'][2];
$values['type'] = $other['data'][3] == '' ? $event_response['type'] : $other['data'][3];
$values['id_group'] = $other['data'][4] == '' ? $event_response['id_group'] : $other['data'][4];
$values['modal_width'] = $other['data'][5] == '' ? $event_response['modal_width'] : $other['data'][5];
$values['modal_height'] = $other['data'][6] == '' ? $event_response['modal_height'] : $other['data'][6];
$values['new_window'] = $other['data'][7] == '' ? $event_response['new_window'] : $other['data'][7];
$values['params'] = $other['data'][8] == '' ? $event_response['params'] : $other['data'][8];
$values['server_to_exec'] = $other['data'][9] == '' ? $event_response['server_to_exec'] : $other['data'][9];
// Error if user has not permission for the group.
if (!check_acl($config['id_user'], $values['id_group'], "PM")) {
returnError('forbidden', $returnType);
return;
}
$return = event_responses_update_response($id_response, $values) ? 1 : 0;
returnData ($returnType, array('type' => 'string', 'data' => $return));
}
function api_get_cluster_items ($cluster_id){
global $config;
@ -11512,6 +11871,140 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access =
return false;
}
function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
if($id == 'all'){
$result = db_process_sql_update('ttrap',array('status' => 1));
}
else{
$result = db_process_sql_update('ttrap',
array('status' => 1), array('id_trap' => $id));
}
if (is_error($result)) {
// TODO: Improve the error returning more info
returnError('error_update_trap', __('Error in trap update.'));
}
else {
returnData('string',
array('type' => 'string',
'data' => __('Validated traps.')));
}
}
function api_set_delete_traps ($id, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
if($id == 'all'){
$result = db_process_sql ('delete from ttrap');
}
else{
$result = db_process_sql_delete('ttrap',array('id_trap' => $id));
}
if (is_error($result)) {
// TODO: Improve the error returning more info
returnError('error_delete_trap', __('Error in trap delete.'));
}
else {
returnData('string',
array('type' => 'string',
'data' => __('Deleted traps.')));
}
}
function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT id_grupo
FROM tgrupo WHERE nombre = "'.$other['data'].'"');
$group_id = db_get_all_rows_sql($sql);
if (count($group_id) > 0 and $group_id !== false) {
$data = array('type' => 'array', 'data' => $group_id);
returnData('csv', $data, ';');
}
else {
returnError('error_group_name', 'No groups retrieved.');
}
}
function api_get_timezone($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT value
FROM tconfig WHERE token = "timezone"');
$timezone = db_get_all_rows_sql($sql);
if (count($timezone) > 0 and $timezone !== false) {
$data = array('type' => 'string', 'data' => $timezone);
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
}
else {
returnError('error_timezone', 'No timezone retrieved.');
}
}
function api_get_language($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT value
FROM tconfig WHERE token = "language"');
$language = db_get_all_rows_sql($sql);
if (count($language) > 0 and $language !== false) {
$data = array('type' => 'string', 'data' => $language);
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
}
else {
returnError('error_language', 'No language retrieved.');
}
}
function api_get_session_timeout($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT value
FROM tconfig WHERE token = "session_timeout"');
$language = db_get_all_rows_sql($sql);
if (count($language) > 0 and $language !== false) {
$data = array('type' => 'string', 'data' => $language);
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
}
else {
returnError('error_session_timeout', 'No session timeout retrieved.');
}
}

View File

@ -191,7 +191,7 @@ function get_custom_fields_data ($custom_field_name) {
}
function agent_counters_custom_fields($filters){
//filter by status
//filter by status agent
$and_status = "";
if(is_array($filters['id_status'])){
if(!in_array(-1, $filters['id_status'])){
@ -241,18 +241,101 @@ function agent_counters_custom_fields($filters){
}
}
//filter by status module
$and_module_status = "";
if(is_array($filters['module_status'])){
if(!in_array(-1, $filters['module_status'])){
if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $filters['module_status'])){
if(count($filters['module_status']) > 0){
$and_module_status = " AND ( ";
foreach ($filters['module_status'] as $key => $value) {
$and_module_status .= ($key != 0)
? " OR ("
: " (";
switch ($value) {
default:
case AGENT_STATUS_NORMAL:
$and_module_status .= " tae.estado = 0 OR tae.estado = 300 ) ";
break;
case AGENT_STATUS_CRITICAL:
$and_module_status .= " tae.estado = 1 OR tae.estado = 100 ) ";
break;
case AGENT_STATUS_WARNING:
$and_module_status .= " tae.estado = 2 OR tae.estado = 200 ) ";
break;
case AGENT_STATUS_UNKNOWN:
$and_module_status .= " tae.estado = 3 ) ";
break;
case AGENT_STATUS_NOT_INIT:
$and_module_status .= " tae.estado = 4 OR tae.estado = 5 ) ";
break;
}
}
$and_module_status .= " ) ";
}
}
else{
//not normal
$and_module_status = "AND tae.estado <> 0 AND tae.estado <> 300 ";
}
}
}
//filters module
if($filters['module_search']){
$and_module_search = 'AND nombre LIKE "%' . $filters['module_search'] . '%"';
}
$module_filter = "";
if($and_module_search != '' || $and_module_status != ''){
$module_filter = ' AND (
SELECT count(*) AS n
FROM tagente_modulo tam
INNER JOIN tagente_estado tae
ON tae.id_agente_modulo = tam.id_agente_modulo
WHERE tam.id_agente=ta.id_agente
'. $and_module_search . ' ' . $and_module_status .'
) > 0 ';
}
//filter group and check ACL groups
$groups_and = "";
if (!users_can_manage_group_all("AR")) {
if(!$filters['group']){
$id_groups = explode(", ", array_keys(users_get_groups()));
if($filters['group']){
$user_groups = array_keys(users_get_groups());
$id_groups = implode(", ", $user_groups);
$groups_and = " AND (ta.id_grupo IN ($id_groups) OR tasg.id_group IN($id_groups))";
}
}
if($filters['group']){
//recursion check acl
if($filters['recursion']){
$recursion_groups = groups_get_id_recursive($filters['group'], true);
if (!users_can_manage_group_all("AR")) {
if(isset($user_groups) && is_array($user_groups)){
$groups_intersect = array_intersect($user_groups, $recursion_groups);
if(isset($groups_intersect) && is_array($groups_intersect)){
$groups_intersect = implode(", ", $groups_intersect);
$groups_and = " AND (ta.id_grupo IN ($groups_intersect) OR tasg.id_group IN($groups_intersect))";
}
else{
return false;
}
}
else{
return false;
}
}
else{
$recursion_groups = implode(", ", $recursion_groups);
$groups_and = " AND (ta.id_grupo IN ($recursion_groups) OR tasg.id_group IN($recursion_groups))";
}
}
else{
$groups_and = " AND (ta.id_grupo =". $filters['group']." OR tasg.id_group =". $filters['group'].")";
}
}
//filter custom data
$custom_data_and = '';
@ -264,17 +347,6 @@ function agent_counters_custom_fields($filters){
//filter custom name
$custom_field_name = $filters['id_custom_fields'];
//filters module
$module_filter = "";
if($filters['module_search']){
$module_filter = ' AND (
SELECT count(*) AS n
FROM tagente_modulo
WHERE nombre LIKE "%' . $filters['module_search'] . '%"
AND id_agente=ta.id_agente
) > 0 ';
}
if(is_metaconsole()){
$metaconsole_connections = metaconsole_get_connection_names();
// For all nodes
@ -385,6 +457,7 @@ function agent_counters_custom_fields($filters){
);
foreach ($result_meta as $k => $nodo) {
if(isset($nodo) && is_array($nodo)){
foreach ($nodo as $key => $value) {
//Sum counters total
$final_result['counters_total']['t_m_normal'] += $value['m_normal'];
@ -417,6 +490,7 @@ function agent_counters_custom_fields($filters){
$array_data[$value['name_data']]['a_agents'] += $value['a_agents'];
}
}
}
$final_result['counters_name'] = $array_data;
}
@ -432,8 +506,16 @@ function agent_counters_custom_fields($filters){
}
function get_filters_custom_fields_view($id = 0, $for_select = false, $name = ""){
//filter group and check ACL groups
$groups_and = "";
if (!users_can_manage_group_all()) {
$user_groups = array_keys(users_get_groups(false, "AR", false));
$id_groups = implode(", ", $user_groups);
$groups_and = " AND (group_search IN ($id_groups)) ";
}
if($for_select){
$query = "SELECT id, `name` FROM tagent_custom_fields_filter";
$query = "SELECT id, `name` FROM tagent_custom_fields_filter WHERE 1=1" . $groups_and;
$rs = db_get_all_rows_sql($query);
if(isset($rs) && is_array($rs)){
foreach ($rs as $key => $value) {
@ -445,7 +527,7 @@ function get_filters_custom_fields_view($id = 0, $for_select = false, $name = ""
}
}
else{
$query = "SELECT * FROM tagent_custom_fields_filter WHERE 1=1";
$query = "SELECT * FROM tagent_custom_fields_filter WHERE 1=1" . $groups_and;
if($id){
$query .= " AND id = " . $id;
@ -459,4 +541,13 @@ function get_filters_custom_fields_view($id = 0, $for_select = false, $name = ""
}
return $result;
}
function get_group_filter_custom_field_view ($id){
if(isset($id)){
$res = db_get_row_filter('tagent_custom_fields_filter',array('id' => $id));
return $res;
}
return false;
}
?>

View File

@ -0,0 +1,80 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2018 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 Lesser 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 Include
* @subpackage Event Responses
*/
/**
* Get all event responses with all values that user can access
*
* @return array With all table values
*/
function event_responses_get_responses() {
global $config;
$filter = array();
// Apply a filter if user cannot see all groups
if (!users_can_manage_group_all()) {
$id_groups = array_keys(users_get_groups(false, "PM"));
$filter = array('id_group' => $id_groups);
}
return db_get_all_rows_filter('tevent_response', $filter);
}
/**
* Validate the responses data to store in database
*
* @param array (by reference) Array with values to validate and modify
*/
function event_responses_validate_data (&$values) {
if ($values['type'] != "command" || !enterprise_installed()) {
$values['server_to_exec'] = 0;
}
if ($values['new_window'] == 1) {
$values['modal_width'] = 0;
$values['modal_height'] = 0;
}
}
/**
* Create an event response
*
* @param array With all event response data
*
* @return True if successful insertion
*/
function event_responses_create_response($values) {
event_responses_validate_data($values);
return db_process_sql_insert('tevent_response', $values);
}
/**
* Update an event response
*
* @param array With all event response data
*
* @return True if successful insertion
*/
function event_responses_update_response($response_id, $values) {
event_responses_validate_data($values);
return db_process_sql_update(
'tevent_response', $values, array('id' => $response_id)
);
}
?>

View File

@ -95,7 +95,7 @@ function events_get_events ($filter = false, $fields = false) {
*
* @return mixed False in case of error or invalid values passed. Event row otherwise
*/
function events_get_event ($id, $fields = false) {
function events_get_event ($id, $fields = false, $meta = false, $history = false) {
if (empty ($id))
return false;
global $config;
@ -105,7 +105,9 @@ function events_get_event ($id, $fields = false) {
$fields[] = 'id_grupo';
}
$event = db_get_row ('tevento', 'id_evento', $id, $fields);
$table = events_get_events_table($meta, $history);
$event = db_get_row ($table, 'id_evento', $id, $fields);
if (! check_acl ($config['id_user'], $event['id_grupo'], 'ER'))
return false;
@ -851,10 +853,15 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$filter = '1 = 1';
}
$secondary_join = '';
if (!users_can_manage_group_all("ER")) {
$secondary_join = "LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent";
}
$sql = sprintf ("SELECT DISTINCT tevento.*
FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
FROM tevento %s
WHERE %s %s
ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
ORDER BY utimestamp DESC LIMIT %d", $secondary_join, $agent_condition, $filter, $limit);
$result = db_get_all_rows_sql ($sql);

View File

@ -238,7 +238,7 @@ function grafico_modulo_sparse_data(
}
}
if($array_data === false){
if($array_data === false || !isset($array_data['sum1']['data'][0][1])){
return false;
}
@ -912,7 +912,9 @@ function grafico_modulo_sparse ($params) {
else{
$return = graph_nodata_image(
$params['width'],
$params['height']
$params['height'],
'area',
__('No data to display within the selected interval')
);
}
}
@ -2456,7 +2458,9 @@ function graph_sla_slicebar (
0,
array(),
true,
$ttl
$ttl,
false,
false
);
}
@ -3188,16 +3192,14 @@ function graph_custom_sql_graph ($id, $width, $height,
* @param string homeurl
* @param bool return or echo the result
*/
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) {
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false, $widgets=false) {
global $config;
global $graphic_type;
$data = array ();
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
$interval = (int) ($period / $resolution);
//TODO interval
$interval = 24;
$date = get_system_time ();
$datelimit = $date - $period;
$periodtime = floor ($period / $interval);
@ -3258,7 +3260,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
// Draw slicebar graph
$out = flot_slicesbar_graph($data, $period, 100, 40, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date, 0, 1, $widgets);
if ($return) {
return $out;
@ -3284,13 +3286,10 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
$data = array ();
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
$interval = (int) ($period / $resolution);
$date = get_system_time ();
$interval = 24;
$date = get_system_time();
$datelimit = $date - $period;
$periodtime = floor ($period / $interval);
$time = array ();
$data = array ();
$legend = array();
$full_legend = array();
@ -3594,6 +3593,7 @@ function fullscale_data (
}
}
else{
if ($data_uncompress === false) $data_uncompress = array();
foreach ($data_uncompress as $k) {
foreach ($k["data"] as $v) {
if (isset($v["type"]) && $v["type"] == 1) { # skip unnecesary virtual data
@ -3662,7 +3662,9 @@ function fullscale_data (
$data["sum" . $series_suffix]['min'] = $min_value_min;
$data["sum" . $series_suffix]['max'] = $max_value_max;
$data["sum" . $series_suffix]['avg'] = $sum_data/$count_data;
$data["sum" . $series_suffix]['avg'] = $count_data == 0
? 0
: $sum_data/$count_data;
}
if($show_percentil && !$compare){
@ -4070,19 +4072,17 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu
}
function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') {
$image = ui_get_full_url('images/image_problem_area_small.png',
$image = ui_get_full_url('images/image_problem_area.png',
false, false, false);
// if ($text == '') {
// $text = __('No data to show');
// }
$text_div = '<div class="nodata_text" style="text-align:center; padding: 30px 0; display:block; font-size:9.5pt;">' . $text . '</div>';
$text_div = '<div class="nodata_text">' . $text . '</div>';
$image_div = $text_div . '<div class="nodata_container" style="background-position: top; width:40%;height:40%;background-size: contain;background-image: url(\'' . $image . '\');"><div></div></div>';
$image_div = '<div class="nodata_container" style="width:80%;height:80%;background-size: 80% 80%;background-image: url(\'' . $image . '\');">' .
$text_div . '</div>';
$div = '<div style="width:' . $width . 'px; height:' . $height . 'px; border: 1px dotted #ddd; background-color: white; margin: 0 auto;">' .
$div = '<div style="width:' . $width . 'px; height:' . $height . 'px; background-color: white; margin: 0 auto;">' .
$image_div . '</div>';
return $div;

View File

@ -175,6 +175,7 @@ function networkmap_process_networkmap($id = 0) {
$nodes_and_relations['nodes'] = array();
$index = 0;
foreach ($nodes as $key => $node) {
$nodes_and_relations['nodes'][$index]['id'] = $node["id"];
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
$nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0];
@ -303,6 +304,7 @@ function networkmap_process_networkmap($id = 0) {
$index = 0;
$node_center = array();
foreach ($nodes as $key => $node) {
$nodes_and_relations['nodes'][$index]['id'] = $node["id"];
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
$children_count = 0;
@ -1072,6 +1074,7 @@ function networkmap_loadfile($id = 0, $file = '',
$node_id = $items[1];
$node_x = $items[2] * 100; //200 is for show more big
$node_y = $height_map - $items[3] * 100; //200 is for show more big
$data['id'] = $node_id;
$data['text'] = '';
$data['image'] = '';
$data['width'] = 10;

View File

@ -144,6 +144,25 @@ function profile_delete_profile ($id_profile) {
return (bool)db_process_sql_delete('tperfil', array('id_perfil' => $id_profile));
}
/**
* Delete profile from database and remove from the assigned users (tusuario_perfil)
*
* @param int Profile ID
*
* @return bool Whether or not it's deleted in both tables
*/
function profile_delete_profile_and_clean_users ($id_profile) {
$profile_deletion = (bool)db_process_sql_delete('tperfil', array('id_perfil' => $id_profile));
// Delete in tusuario_perfil only if is needed
if (!(bool)db_get_value('id_perfil', 'tusuario_perfil', 'id_perfil', $id_profile)) {
return $profile_deletion;
}
return $profile_deletion &&
(bool)db_process_sql_delete('tusuario_perfil', array('id_perfil' => $id_profile));
}
/**
* Print the table to display, create and delete profiles
*

View File

@ -144,6 +144,35 @@ function reporting_make_reporting_data($report = null, $id_report,
$metaconsole_on = is_metaconsole();
$index_content = 0;
foreach ($contents as $content) {
if (!empty($content["id_agent_module"]) && !empty($content["id_agent"])
&& tags_has_user_acl_tags($config['id_user'])) {
$where_tags = tags_get_acl_tags(
$config['id_user'],
$id_groups,
'AR',
'module_condition',
'AND',
'tagente_modulo',
false,
array(),
true);
$sql_tags_join = "INNER JOIN tagente ON tagente.id_agente = t1.id_agente
INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo";
$sql = sprintf('SELECT count(*) FROM tagente_modulo t1
%s WHERE t1.delete_pending = 0 AND t1.id_agente_modulo = '. $content["id_agent_module"] .'
AND t1.id_agente = ' . $content['id_agent'] . ' %s',
$sql_tags_join, $where_tags);
$result_tags = db_get_value_sql($sql);
if (!$result_tags) {
continue;
}
}
$server_name = $content['server_name'];
// General reports with 0 period means last value
@ -218,11 +247,11 @@ function reporting_make_reporting_data($report = null, $id_report,
}
}
if(sizeof($content['id_agent']) != 1){
if(is_array($content['id_agent']) && sizeof($content['id_agent']) != 1){
$content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']);
}
if(sizeof($content['id_agent_module']) != 1){
if(is_array($content['id_agent_module']) && sizeof($content['id_agent_module']) != 1){
$content['style']['name_label'] = str_replace("_module_",sizeof($content['id_agent_module']).__(' modules'),$content['style']['name_label']);
}
@ -320,25 +349,33 @@ function reporting_make_reporting_data($report = null, $id_report,
$report['contents'][] = reporting_value(
$report,
$content,
'max',$pdf);
'max',
$pdf
);
break;
case 'avg_value':
$report['contents'][] = reporting_value(
$report,
$content,
'avg',$pdf);
'avg',
$pdf
);
break;
case 'min_value':
$report['contents'][] = reporting_value(
$report,
$content,
'min',$pdf);
'min',
$pdf
);
break;
case 'sumatory':
$report['contents'][] = reporting_value(
$report,
$content,
'sum');
'sum',
$pdf
);
break;
case 'historical_data':
$report['contents'][] = reporting_historical_data(
@ -349,25 +386,33 @@ function reporting_make_reporting_data($report = null, $id_report,
$report['contents'][] = reporting_value(
$report,
$content,
'MTTR');
'MTTR',
$pdf
);
break;
case 'MTBF':
$report['contents'][] = reporting_value(
$report,
$content,
'MTBF');
'MTBF',
$pdf
);
break;
case 'TTO':
$report['contents'][] = reporting_value(
$report,
$content,
'TTO');
'TTO',
$pdf
);
break;
case 'TTRT':
$report['contents'][] = reporting_value(
$report,
$content,
'TTRT');
'TTRT',
$pdf
);
break;
case 'agent_configuration':
$report['contents'][] = reporting_agent_configuration(
@ -618,7 +663,9 @@ function reporting_make_reporting_data($report = null, $id_report,
$content,
$type,
$force_width_chart,
$force_height_chart);
$force_height_chart,
$pdf
);
break;
case 'module_histogram_graph':
$report['contents'][] = reporting_enterprise_module_histogram_graph(
@ -3774,7 +3821,7 @@ function reporting_agent_configuration($report, $content) {
return reporting_check_structure_content($return);
}
function reporting_value($report, $content, $type,$pdf) {
function reporting_value($report, $content, $type, $pdf) {
global $config;
$return = array();
@ -6047,6 +6094,7 @@ function reporting_general($report, $content) {
$i = 0;
$index = 0;
$is_string = array();
foreach ($generals as $row) {
//Metaconsole connection
$server_name = $row ['server_name'];
@ -6336,7 +6384,17 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
}
}
else{
if ($content['id_agent_module']) {
$modules[] = $content['id_agent_module'];
} else {
// restore to metaconsole database
metaconsole_restore_db();
$module_source = db_get_all_rows_sql("SELECT id_agent_module FROM tgraph_source WHERE id_graph = " . $content['id_gs']);
foreach ($module_source as $key => $value) {
$modules[$key] = $value['id_agent_module'];
}
metaconsole_connect($server);
}
}
$id_graph = 0;
}
@ -6391,7 +6449,7 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
break;
}
if ($config['metaconsole'] && $type_report != 'automatic_graph') {
if ($config['metaconsole']) {
metaconsole_restore_db();
}
@ -7487,8 +7545,8 @@ function reporting_get_stats_alerts($data, $links = false) {
$urls['monitor_alerts'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&pure=" . $config['pure'];
$urls['monitor_alerts_fired'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&filter=fired&pure=" . $config['pure'];
} else {
$urls['monitor_alerts'] = "index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60";
$urls['monitor_alerts_fired'] = "index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60&filter=fired";
$urls['monitor_alerts'] = $config['homeurl']."index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60";
$urls['monitor_alerts_fired'] = $config['homeurl']."index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60&filter=fired";
}
}
@ -7544,19 +7602,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
// Link URLS
if ($links === false) {
$urls = array();
$urls['monitor_critical'] = "index.php?" .
$urls['monitor_critical'] = $config['homeurl']."index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure'];
$urls['monitor_warning'] = "index.php?" .
$urls['monitor_warning'] = $config['homeurl']."index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure'];
$urls['monitor_ok'] = "index.php?" .
$urls['monitor_ok'] = $config['homeurl']."index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure'];
$urls['monitor_unknown'] = "index.php?" .
$urls['monitor_unknown'] = $config['homeurl']."index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure'];
$urls['monitor_not_init'] = "index.php?" .
$urls['monitor_not_init'] = $config['homeurl']."index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure'];
}
@ -7659,8 +7717,8 @@ function reporting_get_stats_agents_monitors($data) {
}
else {
$urls = array();
$urls['total_agents'] = "index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60";
$urls['monitor_checks'] = "index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=-1";
$urls['total_agents'] = $config['homeurl']."index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60";
$urls['monitor_checks'] = $config['homeurl']."index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=-1";
}
// Agents and modules table
@ -9285,6 +9343,7 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
$module_interval = modules_get_interval ($id_agent_module);
$uncompressed_module = is_module_uncompressed ($module_name);
// Wrong module type
if (is_module_data_string ($module_name)) {
return 0;
@ -9293,6 +9352,7 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
// Incremental modules are treated differently
$module_inc = is_module_inc ($module_name);
if ($uncompressed_module) {
// Get module data
$interval_data = db_get_all_rows_sql('
SELECT * FROM tagente_datos
@ -9300,50 +9360,29 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
AND utimestamp > ' . (int) $datelimit . '
AND utimestamp < ' . (int) $date . '
ORDER BY utimestamp ASC', $search_in_history_db);
}
else
$interval_data = db_uncompress_module_data((int) $id_agent_module, (int) $datelimit, (int) $date);
if ($interval_data === false) $interval_data = array ();
// Uncompressed module data
if ($uncompressed_module) {
$min_necessary = 1;
// Compressed module data
}
else {
// Get previous data
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
if ($previous_data !== false) {
$previous_data['utimestamp'] = $datelimit;
array_unshift ($interval_data, $previous_data);
}
// Get next data
$next_data = modules_get_next_data ($id_agent_module, $date);
if ($next_data !== false) {
$next_data['utimestamp'] = $date;
array_push ($interval_data, $next_data);
}
else if (count ($interval_data) > 0) {
// Propagate the last known data to the end of the interval
$next_data = array_pop ($interval_data);
array_push ($interval_data, $next_data);
$next_data['utimestamp'] = $date;
array_push ($interval_data, $next_data);
}
$min_necessary = 2;
}
if (count ($interval_data) < $min_necessary) {
return false;
}
// Set initial conditions
$total = 0;
if (! $uncompressed_module) {
$previous_data = array_shift ($interval_data);
}
$partial_total = 0;
$count_sum = 0;
foreach ($interval_data as $data) {
$partial_total = 0;
$count_sum = 0;
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
@ -9355,18 +9394,25 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
break;
}
if ($uncompressed_module) {
$total += $data['datos'];
if (!$module_inc) {
foreach ($data['data'] as $val) {
if (is_numeric($val['datos'])) {
$partial_total += $val['datos'];
$count_sum++;
}
else if ($module_inc) {
$total += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']);
}
if ($count_sum===0) continue;
$total += $partial_total/$count_sum;
}
else {
$total += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']) / $module_interval;
$last = end($data['data']);
$total += $last['datos'];
}
$previous_data = $data;
}
return $total;
}

View File

@ -2466,18 +2466,14 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
$sla_value = sla_truncate($chart['sla_value'], $config['graph_precision']) . '%';
$checks_resume = "(" . $chart['checks_ok'] . "/" . $chart['checks_total'] . ")";
}
$table1->data[] = array(
$chart['agent'] . "<br />" . $chart['module'],
$chart['chart'],
"<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" .
$sla_value .
'</span>',
$checks_resume
);
$table1->data[0][0] = $chart['agent'] . "<br />" . $chart['module'];
$table1->data[0][1] = $chart['chart'];
$table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" . $sla_value . '</span>';
$table1->data[0][3] = $checks_resume;
}
if($item['type'] == 'availability_graph'){
//table_legend_graphs;
$table2 = new stdClass();
$table2->width = '99%';
@ -2512,15 +2508,15 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
$table2->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
$table2->size[11] = '15%';
$table2->data[0][11] = '<span>'.__('Ignore time'). '</span>';
}
$table->colspan['charts']['cell'] = 2;
$table->data['charts']['cell'] = html_print_table($table1, true);
$table->colspan['legend']['cell'] = 2;
$table->data['legend']['cell'] = html_print_table($table2, true);
if($pdf){
return html_print_table($table, true);
return html_print_table($table1, true) . '<br />' . html_print_table($table2, true);
}
}
@ -3640,7 +3636,9 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
0,
array(),
true,
$ttl
$ttl,
false,
false
);
$table->data[0][0] = $slicebar;
@ -3823,7 +3821,9 @@ function reporting_get_event_histogram_meta ($width) {
0,
$full_legend_date,
true,
1
1,
false,
false
);
$table->data[0][0] = $slicebar;

View File

@ -714,20 +714,15 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
ui_toggle($table_advanced, __('Advanced information'));
// Blank space below title, DONT remove this, this
// Breaks the layout when Flash charts are enabled :-o
//echo '<div id="id_div" style="height: 10px">&nbsp;</div>';
if ($config["agentaccess"]) {
$access_graph = '<div style="width:100%; height:130px;">';
$access_graph .= graphic_agentaccess($id_agente, 380, 120, SECONDS_1DAY, true, true);
$access_graph .= graphic_agentaccess ($id_agente, 380, 120, SECONDS_1DAY, true, true);
$access_graph .= '</div>';
ui_toggle($access_graph, __('Agent access rate (24h)'));
}
$events_graph = '<div style="margin-left: 10px;">';
$events_graph .= graph_graphic_agentevents ($id_agente, 290, 15,
SECONDS_1DAY, '', true);
$events_graph = '<div style="margin-left:10px; width:100%;">';
$events_graph .= graph_graphic_agentevents ($id_agente, 375, 45, SECONDS_1DAY, '', true, false, true);
$events_graph .= '</div><br>';
ui_toggle($events_graph, __('Events (24h)'));

View File

@ -548,7 +548,7 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small"
$link = false;
if ($link)
$output = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id_group.'">';
$output = '<a href="'.$config["homeurl"].'index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id_group.'">';
if ($config['show_group_name']) {
$output .= '<span title="'. groups_get_name($id_group, true) .'">' .

View File

@ -1205,7 +1205,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:right;height:'.$himg.'px;">'.
hbar_graph($module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
@ -1213,7 +1213,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:right;height:'.$himg.'px;">'.
vbar_graph($module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
@ -1223,7 +1223,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:left;height:'.$himg.'px;">'.
hbar_graph($module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
@ -1231,7 +1231,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:left;height:'.$himg.'px;">'.
vbar_graph($module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
@ -1240,14 +1240,14 @@ function visual_map_print_item($mode = "read", $layoutData,
if ($layoutData['type_graph'] == 'horizontal') {
$img = hbar_graph($module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
}
else {
$img = vbar_graph($module_data,
400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
}
@ -1259,7 +1259,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:right;height:'.$himg.'px;">'.
hbar_graph($module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
@ -1267,7 +1267,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:right;height:'.$himg.'px;">'.
vbar_graph($module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
@ -1277,7 +1277,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:left;height:'.$himg.'px;">'.
hbar_graph($module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
}
@ -1285,7 +1285,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:left;height:'.$himg.'px;">'.
vbar_graph($module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
}
@ -1294,14 +1294,14 @@ function visual_map_print_item($mode = "read", $layoutData,
if ($layoutData['type_graph'] == 'horizontal') {
$img = hbar_graph($module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
}
else {
$img = vbar_graph($module_data,
$width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
}
@ -1633,78 +1633,11 @@ function visual_map_print_item($mode = "read", $layoutData,
break;
case STATIC_GRAPH:
case GROUP_ITEM:
if (! defined ('METACONSOLE')) {
}
else {
// For each server defined and not disabled:
$servers = db_get_all_rows_sql ('SELECT *
FROM tmetaconsole_setup
WHERE disabled = 0');
if ($servers === false)
$servers = array();
$result = array();
$count_modules = 0;
foreach ($servers as $server) {
// If connection was good then retrieve all data server
if (metaconsole_connect($server) == NOERR)
$connection = true;
else
$connection = false;
$result_server = db_get_all_rows_sql ($sql);
if (!empty($result_server)) {
// Create HASH login info
$pwd = $server['auth_token'];
$auth_serialized = json_decode($pwd,true);
if (is_array($auth_serialized)) {
$pwd = $auth_serialized['auth_token'];
$api_password = $auth_serialized['api_password'];
$console_user = $auth_serialized['console_user'];
$console_password = $auth_serialized['console_password'];
}
$user = $config['id_user'];
$user_rot13 = str_rot13($config['id_user']);
$hashdata = $user.$pwd;
$hashdata = md5($hashdata);
$url_hash = '&' .
'loginhash=auto&' .
'loginhash_data=' . $hashdata . '&' .
'loginhash_user=' . $user_rot13;
foreach ($result_server as $result_element_key => $result_element_value) {
$result_server[$result_element_key]['server_id'] = $server['id'];
$result_server[$result_element_key]['server_name'] = $server['server_name'];
$result_server[$result_element_key]['server_url'] = $server['server_url'].'/';
$result_server[$result_element_key]['hashdata'] = $hashdata;
$result_server[$result_element_key]['user'] = $config['id_user'];
$count_modules++;
}
$result = array_merge($result, $result_server);
}
if ($connection) {
metaconsole_restore_db();
}
}
}
if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) {
$img_style_title = strip_tags($label);
if ($layoutData['type'] == STATIC_GRAPH) {
if ($layoutData['id_agente_modulo'] != 0) {
if ($layoutData['id_metaconsole'] != 0) {
//Metaconsole db connection
$connection = db_get_row_filter ('tmetaconsole_setup',
@ -1780,68 +1713,71 @@ function visual_map_print_item($mode = "read", $layoutData,
else if($layoutData['label_position']=='right'){
$imgpos = 'float:left';
}
$varsize = getimagesize($config['homedir'] . '/' . $img);
if($layoutData['show_statistics'] == 1){
if($layoutData['show_statistics'] == 1) {
if (get_parameter('action') == 'edit') {
if ($width == 0 || $height == 0) {
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:520px;height:80px;'.$imgpos.'">';
}
else{
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
}
}
else{
$agents_critical = agents_get_agents(array (
$agents_critical = agents_get_agents(
array (
'disabled' => 0,
'id_grupo' => $layoutData['id_group'],
'status' => AGENT_STATUS_CRITICAL),
array ('COUNT(*) as total'), 'AR', false);
$agents_warning = agents_get_agents(array (
'status' => AGENT_STATUS_CRITICAL
),
array ('COUNT(*) as total'),
'AR',
false
);
$agents_warning = agents_get_agents(
array (
'disabled' => 0,
'id_grupo' => $layoutData['id_group'],
'status' => AGENT_STATUS_WARNING),
array ('COUNT(*) as total'), 'AR', false);
$agents_unknown = agents_get_agents(array (
'status' => AGENT_STATUS_WARNING
),
array ('COUNT(*) as total'),
'AR',
false
);
$agents_unknown = agents_get_agents(
array (
'disabled' => 0,
'id_grupo' => $layoutData['id_group'],
'status' => AGENT_STATUS_UNKNOWN),
array ('COUNT(*) as total'), 'AR', false);
$agents_ok = agents_get_agents(array (
'status' => AGENT_STATUS_UNKNOWN
),
array ('COUNT(*) as total'),
'AR',
false
);
$agents_ok = agents_get_agents(
array (
'disabled' => 0,
'id_grupo' => $layoutData['id_group'],
'status' => AGENT_STATUS_OK),
array ('COUNT(*) as total'), 'AR', false);
'status' => AGENT_STATUS_OK
),
array ('COUNT(*) as total'),
'AR',
false
);
$total_agents = $agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total'];
$stat_agent_ok = $agents_ok[0]['total']/$total_agents*100;
$stat_agent_wa = $agents_warning[0]['total']/$total_agents*100;
$stat_agent_cr = $agents_critical[0]['total']/$total_agents*100;
$stat_agent_un = $agents_unknown[0]['total']/$total_agents*100;
if($width == 0 || $height == 0){
$dyn_width = 520;
$dyn_height = 80;
}
else{
} else {
$dyn_width = $width;
$dyn_height = $height;
}
echo '<table cellpadding="0" cellspacing="0" border="0" class="databox" style="width:'.$dyn_width.'px;height:'.$dyn_height.'px;text-align:center;';
if($layoutData['label_position'] == 'left'){
echo "float:right;";
}
@ -1850,10 +1786,8 @@ function visual_map_print_item($mode = "read", $layoutData,
}
echo '">';
echo "<tr style='height:10%;'>";
echo "<th style='text-align:center;background-color:#9d9ea0;color:black;font-weight:bold;'>" .groups_get_name($layoutData['id_group'],true) . "</th>";
echo "</tr>";
echo "<tr style='background-color:whitesmoke;height:90%;'>";
echo "<td>";
@ -1865,68 +1799,38 @@ function visual_map_print_item($mode = "read", $layoutData,
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Normal</div>";
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#9d9ea0;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_un, 2)) ."%</div>";
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Unknown</div>";
echo "</td>";
echo "</tr>";
echo "</table>";
}
}
else{
} else {
$options = array(
"class" => "image",
"id" => "image_" . $id,
"title" => $img_style_title,
"style" => $borderStyle.$imgpos
);
if ($width == 0 || $height == 0) {
if($varsize[0] > 150 || $varsize[1] > 150){
echo html_print_image($img, true,
array("class" => "image",
"id" => "image_" . $id,
"width" => "70px",
"height" => "70px",
"title" => $img_style_title,
"style" => $borderStyle.$imgpos), false,
false, false, $isExternalLink);
}
else{
echo html_print_image($img, true,
array("class" => "image",
"id" => "image_" . $id,
"title" => $img_style_title,
"style" => $borderStyle.$imgpos), false,
false, false, $isExternalLink);
$options['width'] = "70px";
$options['height'] = "70px";
}
}
else{
echo html_print_image($img, true,
array("class" => "image",
"id" => "image_" . $id,
"width" => $width,
"height" => $height,
"title" => $img_style_title,
"style" => $borderStyle.$imgpos), false,
false, false, $isExternalLink);
$options['width'] = $width;
$options['height'] = $height;
}
echo html_print_image($img, true, $options,
false, false, false, $isExternalLink);
}
}
}
}
if($layoutData['label_position']=='down'){
echo io_safe_output($text);
}
else if($layoutData['label_position']=='left' || $layoutData['label_position']=='right'){
if ($layoutData['label_position'] != 'up') {
echo io_safe_output($text);
}
if (! defined ('METACONSOLE')) {
}
else {
metaconsole_restore_db();
}
if (is_metaconsole()) metaconsole_restore_db();
break;
case PERCENTILE_BAR:
if (($layoutData['image'] == 'value') && ($value_text !== false)) {
$unit_text = db_get_sql ('SELECT unit
@ -1963,6 +1867,7 @@ function visual_map_print_item($mode = "read", $layoutData,
}
echo $img;
echo io_safe_output($text);
break;
case PERCENTILE_BUBBLE:
@ -2006,6 +1911,7 @@ function visual_map_print_item($mode = "read", $layoutData,
}
echo $img;
echo io_safe_output($text);
break;
case CIRCULAR_PROGRESS_BAR:
@ -2049,6 +1955,7 @@ function visual_map_print_item($mode = "read", $layoutData,
}
echo $img;
echo io_safe_output($text);
break;
case CIRCULAR_INTERIOR_PROGRESS_BAR:
@ -2093,6 +2000,7 @@ function visual_map_print_item($mode = "read", $layoutData,
}
echo $img;
echo io_safe_output($text);
break;
case MODULE_GRAPH:
@ -2284,9 +2192,7 @@ function visual_map_print_item($mode = "read", $layoutData,
array('id' => $layoutData['parent_item']));
echo '<script type="text/javascript">';
echo '$(document).ready (function() {
lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($parent) . '","thickness":"' . (empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"]) . '"});
});';
echo 'lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($parent) . '","thickness":"' . (empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"]) . '"});';
echo '</script>';
}
}
@ -2306,19 +2212,35 @@ function get_if_module_is_image ($id_module) {
}
function get_bars_module_data ($id_module) {
$mod_values = db_get_value_filter('datos', 'tagente_estado', array('id_agente_modulo' => $id_module));
//This charts is only serialize graphs.
//In other string show image no data to show.
$mod_values = db_get_value_filter(
'datos',
'tagente_estado',
array(
'id_agente_modulo' => $id_module
)
);
$values = false;
//avoid showing the image type modules. WUX
if(strpos($mod_values, 'data:image/png;base64') !== 0){
if (preg_match("/\r\n/", $mod_values)) {
$values = explode("\r\n", $mod_values);
}
elseif (preg_match("/\n/", $mod_values)) {
$values = explode("\n", $mod_values);
}
}
$values_to_return = array();
$index = 0;
$color_index = 0;
$total = 0;
if(!$values) return false;
foreach ($values as $val) {
$data = explode(",", $val);
$values_to_return[$data[0]] = array('g' =>$data[1]);
@ -3323,9 +3245,7 @@ function visual_map_print_user_lines($layout_data, $proportion = null) {
}
echo '<script type="text/javascript">';
echo '$(document).ready (function() {
user_lines.push(' . json_encode($line) . ');
});';
echo 'user_lines.push(' . json_encode($line) . ');';
echo '</script>';
}

View File

@ -586,7 +586,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['show_on_top_row']['html'] =
'<td align="left" style="">' . __('Always show on top') . '</td>
<td align="left" style="">' .
html_print_checkbox('show_on_top', 1, '', true) . '</td>';
html_print_checkbox('show_on_top', 1, '', true) .ui_print_help_tip (__("It allows the element to be superimposed to the rest of items of the visual console"), true) . '</td>';
$show_last_value = array('0' => __('Hide last value on boolean modules'), '1' => __('Enabled'), '2' => __('Disabled'));
$form_items['show_last_value_row'] = array();

View File

@ -13,22 +13,23 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
}
require_once('functions.php');
require_once('functions_filemanager.php');
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("config.php");
require_once ('functions.php');
require_once ('functions_filemanager.php');
global $config;
check_login ();
$auth_method = db_get_value('value', 'tconfig', 'token', 'auth');
if($auth_method != 'ad')
if($auth_method != 'ad' && $auth_method != 'ldap'){
require_once("auth/" . $auth_method . ".php");
}
$styleError = "background:url(\"../images/err.png\") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;";

View File

@ -141,7 +141,17 @@ function vbar_graph(
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
return html_print_image (
$no_data_image,
true,
array(
'width' => $width,
'height' => $height,
'title' => __('No data to show')
),
false,
true
);
}
if($ttl == 2){
@ -271,7 +281,17 @@ function hbar_graph($chart_data, $width, $height,
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
return html_print_image (
$no_data_image,
true,
array(
'width' => $width,
'height' => $height,
'title' => __('No data to show')
),
false,
true
);
}
if($ttl == 2){

View File

@ -204,7 +204,7 @@
$form
.prop('method', 'POST')
.prop('action', plot.getOptions().export.homeurl + '/include/graphs/export_data.php')
.prop('action', plot.getOptions().export.homeurl + 'include/graphs/export_data.php')
.append($dataInput, $typeInput, $separatorInput, $excelInput)
.hide()
// Firefox made me write into the DOM for this :(
@ -394,7 +394,7 @@
$form
.prop('method', 'POST')
.prop('action', plot.getOptions().export.homeurl + '/include/graphs/export_data.php')
.prop('action', plot.getOptions().export.homeurl + 'include/graphs/export_data.php')
.append($dataInput, $typeInput, $separatorInput, $excelInput)
.hide()
// Firefox made me write into the DOM for this :(

View File

@ -670,7 +670,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
}
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick,
font, font_size, separator, separator2, id_agent, full_legend, not_interactive) {
font, font_size, separator, separator2, id_agent, full_legend, not_interactive, show_date) {
values = values.split(separator2);
labels = labels.split(separator);
@ -728,6 +728,7 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
tickColor: '#fff'
},
xaxes: [ {
show:show_date,
tickFormatter: xFormatter,
color: '',
tickSize: intervaltick,
@ -1873,7 +1874,7 @@ function pandoraFlotArea( graph_id, values, legend,
}));
}
$('#menu_cancelzoom_' + graph_id).attr('src', homeurl + '/images/zoom_cross_grey.png');
$('#menu_cancelzoom_' + graph_id).attr('src', homeurl + 'images/zoom_cross_grey.png');
max_draw['max'] = ranges.yaxis.to;
max_draw['min'] = ranges.yaxis.from;
@ -2330,7 +2331,7 @@ function pandoraFlotArea( graph_id, values, legend,
legend: { show: true }
}));
$('#menu_cancelzoom_' + graph_id)
.attr('src', homeurl + '/images/zoom_cross.disabled.png');
.attr('src', homeurl + 'images/zoom_cross.disabled.png');
overview.clearSelection();
currentRanges = null;
thresholded = false;

View File

@ -691,7 +691,7 @@ function flot_slicesbar_graph (
$adapt_key = '', $stat_win = false,
$id_agent = 0, $full_legend_date = array(),
$not_interactive = 0, $ttl = 1,
$widgets = false) {
$widgets = false, $show = true) {
global $config;
@ -706,13 +706,15 @@ function flot_slicesbar_graph (
'fontpath' => $fontpath,
'round_corner' => $round_corner,
'homeurl' => $homeurl,
'watermark' => $watermark = '',
'adapt_key' => $adapt_key = '',
'stat_win' => $stat_win = false,
'id_agent' => $id_agent = 0,
'full_legend_date' => $full_legend_date = array(),
'not_interactive' => $not_interactive = 0,
'ttl' => $ttl = 1
'watermark' => $watermark,
'adapt_key' => $adapt_key,
'stat_win' => $stat_win,
'id_agent' => $id_agent,
'full_legend_date' => $full_legend_date,
'not_interactive' => $not_interactive,
'ttl' => 1,
'widgets' => $widgets,
'show' => $show
);
return generator_chart_to_pdf('slicebar', $params);
@ -839,7 +841,7 @@ function flot_slicesbar_graph (
// Javascript code
$return .= "<script type='text/javascript'>";
$return .= "//<![CDATA[\n";
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive)";
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show')";
$return .= "\n//]]>";
$return .= "</script>";

View File

@ -3,6 +3,7 @@ div.olMap {
padding: 0px!important;
margin: 0px!important;
cursor: default;
position: relative !important;
}
div.olMapViewport {

View File

@ -2721,7 +2721,7 @@ function init_graph(parameter_object) {
}
window.scale_minimap = 4.2;
window.translation = [0, 0];
window.scale = (typeof (z_dash) != "undefined") ? z_dash : 0.5;
window.scale = z_dash || 0.5;
window.node_radius = 40;
if (typeof (parameter_object.node_radius) != "undefined") {
window.node_radius = parameter_object.node_radius;
@ -3306,7 +3306,7 @@ function draw_elements_graph() {
})
.attr("startOffset", function (d) {
if (d.source.x < d.target.x) {
return "";
return "0%";
}
else {
return "85%";
@ -3356,7 +3356,7 @@ function draw_elements_graph() {
return "85%";
}
else {
return "";
return "0%";
}
})
.attr("text-anchor", function (d) {

View File

@ -651,7 +651,7 @@ function add_macro_field(macro, row_model_id) {
$macro_field.attr('class', 'macro_field');
// Get the number of fields already printed
var fields = $('.macro_field').size();
var fields = $('.macro_field').length;
// If is the first, we insert it after model row
if (fields == 0) {

View File

@ -52,7 +52,7 @@ function pandora_session_write ($session_id, $data) {
$retval_write = db_process_sql_update('tsessions_php', $values, array('id_session' => $session_id));
}
return ($retval_write !== false) ? true : false;
return $retval_write !== false;
}
function pandora_session_destroy ($session_id) {
@ -77,6 +77,8 @@ function pandora_session_gc ($max_lifetime = 300) {
return $retval;
}
$result_handler = session_set_save_handler ('pandora_session_open', 'pandora_session_close', 'pandora_session_read', 'pandora_session_write', 'pandora_session_destroy', 'pandora_session_gc');
// FIXME: SAML should work with pandora session handlers
if (db_get_value('value', 'tconfig', 'token', 'auth') != "saml") {
$result_handler = session_set_save_handler ('pandora_session_open', 'pandora_session_close', 'pandora_session_read', 'pandora_session_write', 'pandora_session_destroy', 'pandora_session_gc');
}
?>

View File

@ -205,3 +205,67 @@ div.installation_step {
color:white;
}
:focus {
outline: 0;
}
/* POPUP */
.popup-lightbox{
position: fixed;
z-index: 8888;
width: 100%;
height: 100%;
background-color: #000;
opacity: 0.6;
visibility: hidden;
}
.popup{
max-height: 450px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
background-color: #FFF;
z-index: 9999;
display: none;
}
.popup-title{
background-color: #82b92e;
padding: 10px 20px;
color: #FFF;
font-size:12pt;
text-align: center;
font-family:Sans, Arial, sans;
}
.popup-inner{
max-height: 350px;
background: #FFF;
/* overflow-y: scroll;*/
padding: 25px 35px;
font-size: 11pt;
}
.popup-button-green{
background-color: #82B92E;
border: 1px solid transparent;
color: blue;
}
.popup-button-green span{
color: #FFF !important;
}
.popup-button-green:hover{
background-color: transparent !important;
border: 1px solid #82B92E;
color: red !important;
}
.popup-button-green:hover span{
color: #82B92E !important;
}
/* POPUP -END */

View File

@ -1384,7 +1384,7 @@ table.databox {
border: 0px none #E2E2E2;
}
.databox>thead>tr>th, .databox>tbody>tr>th {
.databox>thead>tr>th, .databox>tbody>tr>th, .databox>thead>tr>th a {
padding: 9px 7px;
font-weight: normal;
color: #fff;
@ -5038,4 +5038,16 @@ ul.ui-front li a.ui-menu-item-wrapper span{
ul.ui-front li a.ui-menu-item-wrapper:hover{
text-decoration: none !important;
}
input[type=submit].ui-button-dialog{
margin: .5em 1em .5em 0 !important;
cursor: pointer !important;
background: white !important;
background-color: white !important;
color: #82b92e !important;
text-align: center !important;
border: 1px solid #82b92e !important;
height:30px !important;
width:90px !important;
}
/* --- END - JQUERY-UI --- */

View File

@ -4,8 +4,6 @@ if (system.args.length < 3 || system.args.length > 11) {
phantom.exit(1);
}
var webPage = require('webpage');
var page = webPage.create();
var url = system.args[1];
var type_graph_pdf = system.args[2];
var url_params = system.args[3];
@ -39,26 +37,32 @@ else{
"&session_id=" + session_id;
}
var page = require('webpage').create();
page.viewportSize = {
width: viewport_width,
height: viewport_height
};
page.zoomFactor = 1;
page.open(url, 'POST', post_data, function start(status) {
});
page.onLoadFinished = function (status) {
page.onCallback = function (st){
if(!base_64){
page.render(output_filename, {format: 'png'});
}
else{
} else{
var base64 = page.renderBase64('png');
//XXXX
// do not remove this console.output
console.log(base64);
}
phantom.exit();
}
};
page.open(url, 'POST', post_data, function (status) {
});

View File

@ -120,6 +120,7 @@ if (isset($config["error"])) {
// If metaconsole activated, redirect to it
if ($config['metaconsole'] == 1 && $config['enterprise_installed'] == 1) {
header ("Location: " . $config['homeurl'] . "enterprise/meta");
exit; //Always exit after sending location headers
}
if (file_exists (ENTERPRISE_DIR . "/include/functions_login.php")) {
@ -562,12 +563,13 @@ if (! isset ($config['id_user'])) {
$query_params_redirect = $_GET;
// Visual console do not want sec2
if($home_page == 'Visual console') unset($query_params_redirect["sec2"]);
$redirect_url = '?1=1';
$redirect_url = '?logged=1';
foreach ($query_params_redirect as $key => $value) {
if ($key == "login") continue;
$redirect_url .= '&'.safe_url_extraclean($key).'='.safe_url_extraclean($value);
}
header("Location: ".$config['homeurl']."index.php".$redirect_url);
exit; //Always exit after sending location headers
}
// Hash login process
elseif (isset ($_GET["loginhash"])) {
@ -810,7 +812,7 @@ if (isset ($_GET["bye"])) {
include ("general/logoff.php");
$iduser = $_SESSION["id_usuario"];
db_logoff ($iduser, $_SERVER['REMOTE_ADDR']);
// Unregister Session (compatible with 5.2 and 6.x, old code was deprecated
$_SESSION = array();
session_destroy();
header_remove("Set-Cookie");

50
pandora_console/install.php Executable file → Normal file
View File

@ -66,12 +66,41 @@
document.getElementById('tr_dbgrant').style["display"] = "none";
}
}
function popupShow(){
document.getElementsByTagName('body')[0].style["margin"] = "0";
document.getElementById('install_container').style["padding-top"] = "45px";
document.getElementById('install_container').style["margin-top"] = "0";
document.getElementById('add-lightbox').style["visibility"] = "visible";
document.getElementById('open_popup').style["display"] = "block";
document.getElementById('open_popup').style["visibility"] = "visible";
}
function popupClose(){
document.getElementById('add-lightbox').style["visibility"] = "hidden";
document.getElementById('open_popup').style["display"] = "none";
document.getElementById('open_popup').style["visibility"] = "hidden";
}
</script>
<body>
<div id='add-lightbox' onclick='popupClose();' class='popup-lightbox'></div>
<div id='open_popup' class='popup' style='visibility:hidden;display: block;'>
<div class='popup-title'>
<span id='title_popup'>Warning</span>
<a href='#' onclick='popupClose();'><img src='./images/icono_cerrar.png' alt='close' title='Close' style='float:right;'/></a>
</div>
<div id='editor_section' class='popup-inner' style='padding: 20px 40px;'>
<?php
echo "<p><strong>Attention</strong>, you are going to <strong>overwrite the data</strong> of your current installation.</p><p>This means that if you do not have a backup <strong>you will irremissibly LOSE ALL THE STORED DATA</strong>, the configuration and everything relevant to your installation.</p><p><strong>Are you sure of what you are going to do?</strong></p>";
echo "<div style='text-align:right;';>";
echo "<a id='step4popup' href='install.php?step=4'><button type='submit' class='btn_install_next'><span class='btn_install_next_text'>Yes, I'm sure I want to delete everything</span></button></a>";
echo "<a href='javascript:popupClose();'><button type='submit' class='btn_install_next popup-button-green'><span class='btn_install_next_text'>Cancel</span></button></a>";
echo "</div>";
?>
</div>
</div>
<div style='height: 10px'>
<?php
$version = '7.0NG.729';
$build = '181121';
$build = '181205';
$banner = "v$version Build $build";
error_reporting(0);
@ -608,7 +637,7 @@ function install_step3() {
echo " <td valign=top>Drop Database if exists<br>
<input class='login' type='checkbox' name='drop' value=1>
<input class='login' type='checkbox' name='drop' id='drop' value=1>
</td>";
echo "<td>Full path to HTTP publication directory<br>
@ -637,8 +666,23 @@ function install_step3() {
if (!$error) {
echo "<div style='text-align:right; width:100%;'>";
echo "<a id='step4' href='install.php?step=4'>
<button class='btn_install_next' type='submit'><span class='btn_install_next_text'>Next</span></button></a>";
<button class='btn_install_next' type='submit' id='step4button'><span class='btn_install_next_text'>Next</span></button></a>";
echo "</div>";
?>
<script type="text/javascript">
var checkDrop = document.getElementById('step4button').addEventListener("click", function(event){
if(document.getElementById("drop").checked){
popupShow();
}
else{
document.getElementsByName('step2_form')[0].submit();
}
event.preventDefault();
});
var step3_form = document.getElementsByName('step2_form')[0];
step3_form.addEventListener("submit", checkDrop, true);
</script>
<?php
}
echo "</div>";

View File

@ -1370,3 +1370,7 @@ DIV.nodata_container {
.legend_graph td.legendLabel {
font-size: 12px !important;
}
.ui-popup-hidden {
display: none;
}

View File

@ -23,9 +23,7 @@ class System {
$this->loadConfig();
$session_id = session_id();
DB::getInstance($this->getConfig('db_engine', 'mysql'));
if (empty($session_id)) {
session_start();
}
if (session_status() === PHP_SESSION_NONE) session_start();
$this->session = $_SESSION;
session_write_close();
@ -71,7 +69,7 @@ class System {
}
public function setSessionBase($name, $value) {
session_start();
if (session_status() === PHP_SESSION_NONE) session_start();
$_SESSION[$name] = $value;
session_write_close();
}
@ -79,7 +77,7 @@ class System {
public function setSession($name, $value) {
$this->session[$name] = $value;
session_start();
if (session_status() === PHP_SESSION_NONE) session_start();
$_SESSION = $this->session;
session_write_close();
}
@ -94,7 +92,7 @@ class System {
}
public function sessionDestroy() {
session_start();
if (session_status() === PHP_SESSION_NONE) session_start();
session_destroy();
}

View File

@ -25,7 +25,13 @@ require_once("include/system.class.php");
require_once("include/db.class.php");
require_once("include/user.class.php");
require_once('../include/config.php');
/* Info:
* The classes above doesn't start any session before it's properly
* configured into the file below, but it's important the classes
* exist at the time the session is started for things like
* serializing objects stored into the session.
*/
require_once '../include/config.php';
require_once('operation/home.php');
require_once('operation/tactical.php');
@ -79,7 +85,6 @@ $system = System::getInstance();
require_once($system->getConfig('homedir').'/include/constants.php');
$user = User::getInstance();
$user->saveLogin();
$default_page = 'home';

View File

@ -13,12 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
}
// Global & session management
// 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($config['homedir'] . '/include/functions.php');

View File

@ -645,7 +645,7 @@ $data[0][0] .=
__('Events (24h)') .
'</th></tr>' .
'<tr><td style="text-align:center;padding-left:20px;padding-right:20px;"><br />' .
graph_graphic_agentevents ($id_agente, 450, 40, SECONDS_1DAY, '', true, true) .
graph_graphic_agentevents ($id_agente, 100, 45, SECONDS_1DAY, '', true, true) .
'<br /></td></tr>' .
'</table>';

View File

@ -13,8 +13,8 @@
// 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");

View File

@ -13,8 +13,8 @@
// 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_agents.php");
require_once ("../../include/functions_reporting.php");

View File

@ -13,8 +13,8 @@
// 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_agents.php");
require_once ("../../include/functions_reporting.php");

View File

@ -13,13 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
session_write_close();
}
// Global & session management
// 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 ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php');
@ -30,7 +25,7 @@ require_once ($config['homedir'] . '/include/functions_custom_graphs.php');
require_once ($config['homedir'] . '/include/functions_modules.php');
require_once ($config['homedir'] . '/include/functions_agents.php');
require_once ($config['homedir'] . '/include/functions_tags.php');
enterprise_include_once('include/functions_agents.php');
enterprise_include_once ('include/functions_agents.php');
check_login();

View File

@ -13,13 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
//session_write_close();
}
// Global & session management
// 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 ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php');

View File

@ -13,12 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
//session_write_close();
}
// 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 ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php');

View File

@ -13,13 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
if (! isset($_SESSION['id_usuario'])) {
session_start();
//session_write_close();
}
// Global & session management
// 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 ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php');

View File

@ -336,6 +336,16 @@ if (is_ajax ()) {
$filter .= ' AND t1.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where ' . $sql_conditions;
}
$sql_tags_join = "";
$where_tags = "";
if (tags_has_user_acl_tags($config['id_user'])) {
$where_tags = tags_get_acl_tags($config['id_user'], $id_groups, 'AR',
'module_condition', 'AND', 'tagente_modulo', false, array(), true);
$sql_tags_join = "INNER JOIN tagente ON tagente.id_agente = t1.id_agente
INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo";
}
if (is_metaconsole()) {
$result = array();
$nameModules = array();
@ -396,9 +406,10 @@ if (is_ajax ()) {
}
//Get agent's modules
$sql = sprintf('SELECT t1.id_agente, t1.id_agente_modulo, t1.nombre
FROM tagente_modulo t1
WHERE %s
$sql = sprintf(
'SELECT t1.id_agente, t1.id_agente_modulo, t1.nombre
FROM tagente_modulo t1 %s
WHERE %s %s
AND t1.delete_pending = 0
AND t1.id_agente IN (%s)
AND (
@ -407,7 +418,7 @@ if (is_ajax ()) {
WHERE t2.delete_pending = 0
AND t1.nombre = t2.nombre
AND t2.id_agente IN (%s)) = (%d)',
$filter, implode(',', $id_agents),
$sql_tags_join, $filter, $where_tags, implode(',', $id_agents),
implode(',', $id_agents), count($id_agents));
$modules = db_get_all_rows_sql($sql);
@ -458,34 +469,27 @@ if (is_ajax ()) {
}
else {
if($idAgents[0] < 0){
if($selection_mode == 'common'){
if($selection_mode == 'common') {
$sql_agent_total = 'SELECT count(*) FROM tagente WHERE disabled=0';
$agent_total = db_get_value_sql($sql_agent_total);
$sql = "SELECT tam.nombre, tam.id_agente_modulo
FROM tagente_modulo tam
JOIN (
SELECT COUNT(*) AS num_names, nombre
FROM tagente_modulo
WHERE disabled=0
AND delete_pending=0
GROUP BY nombre
) AS tj
ON tj.num_names = $agent_total
AND tj.nombre = tam.nombre ";
}
else{
$sql = 'SELECT nombre, id_agente_modulo
FROM tagente_modulo';
$sql = sprintf ("SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
JOIN (SELECT COUNT(*) AS num_names, nombre FROM tagente_modulo
WHERE disabled=0 AND delete_pending=0 GROUP BY nombre) AS tj
ON tj.num_names = $agent_total AND tj.nombre = t1.nombre %s %s",
$sql_tags_join, (empty($where_tags)) ? "" : " WHERE 1=1 $where_tags");
} else {
$sql = sprintf('SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1 %s %s',
$sql_tags_join, (empty($where_tags)) ? "" : " WHERE 1=1 $where_tags");
}
}
else {
$sql = 'SELECT DISTINCT nombre, t1.id_agente_modulo
FROM tagente_modulo t1, tagente_estado t2
WHERE t1.id_agente_modulo = t2.id_agente_modulo AND
' . $filter . '
AND t1.delete_pending = 0
AND t1.id_agente IN (' . implode(',', $idAgents) . ')
AND t2.datos NOT LIKE "%image%"';
$sql = sprintf (
'SELECT DISTINCT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
INNER JOIN tagente_estado t2 ON t1.id_agente_modulo = t2.id_agente_modulo
%s WHERE %s AND t1.delete_pending = 0
AND t1.id_agente IN ('. implode(',', $idAgents) .')
%s %s',
$sql_tags_join, $filter, ' AND t2.datos NOT LIKE "%image%"', $where_tags);
if ($selection_mode == 'common') {
$sql .= ' AND (

View File

@ -78,10 +78,13 @@ if ($group_rep == 2) {
$table->head[1] = __('Agent');
$table->head[5] = __('More detail');
$url = html_print_sort_arrows(
array_merge($params, array('sort_field' => 'status')),
'sort'
);
//$url = html_print_sort_arrows(
// array_merge($params, array('sort_field' => 'status')),
// 'sort'
//);
$params_sort_field_status = array_merge($params, array('sort_field' => 'status'));
$url = "index.php?" . http_build_query($params_sort_field_status, '', '&amp;');
foreach ($result as $key => $res) {
@ -164,14 +167,6 @@ else {
$table->align[$i] = 'left';
$i++;
}
if ($fields == 'estado') {
$table->head[$i] = __('Status') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'status')),
'sort'
);
$table->align[$i] = 'left';
$i++;
}
if ($fields == 'id_evento') {
$table->head[$i] = __('Event ID') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'event_id')),
@ -341,6 +336,18 @@ else {
$i++;
}
}
if (in_array('estado', $show_fields)) {
$table->head[$i] = '<span style="white-space: nowrap;">'.__('Status') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'status')),
'sort'
).'</span>';
$table->align[$i] = 'left';
$table->style[$i] = 'white-space: nowrap !important; width: 1px !important;';
$i++;
}
if ($i != 0 && $allow_action) {
$table->head[$i] = __('Action');
$table->align[$i] = 'left';
@ -491,14 +498,6 @@ else {
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if ($fields == 'estado') {
$data[$i] = html_print_image ($img_st, true,
array ("class" => "image_status",
"title" => $title_st,
"id" => 'status_img_'.$event["id_evento"]));
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;';
$i++;
}
if ($fields == 'id_evento') {
$data[$i] = $event["id_evento"];
$table->cellclass[count($table->data)][$i] = $myclass;
@ -778,6 +777,15 @@ else {
}
}
if (in_array('estado', $show_fields)) {
$data[$i] = html_print_image ($img_st, true,
array ("class" => "image_status",
"title" => $title_st,
"id" => 'status_img_'.$event["id_evento"]));
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3; white-space: nowrap; width: 1px;';
$i++;
}
if ($i != 0 && $allow_action) {
//Actions
$data[$i] = '<a href="javascript:" onclick="show_event_dialog(' . $event["id_evento"] . ', '.$group_rep.');">';

View File

@ -13,18 +13,18 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
session_start ();
error_reporting(1);
// Local settings for marquee extension
$MAX_MARQUEE_EVENTS=10;
$MARQUEE_INTERVAL=90;
$MARQUEE_FONT_SIZE="32px";
$MARQUEE_SPEED=12;
$output = "";
// 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";

View File

@ -13,8 +13,8 @@
// 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/auth/mysql.php");
require_once ("../../include/functions.php");
@ -23,8 +23,6 @@ require_once ("../../include/functions_events.php");
require_once ("../../include/functions_agents.php");
require_once ('../../include/functions_groups.php');
session_write_close ();
$config["id_user"] = $_SESSION["id_usuario"];
if (! check_acl ($config["id_user"], 0, "ER") && ! check_acl ($config["id_user"], 0, "EW") && ! check_acl ($config["id_user"], 0, "EM")) {

View File

@ -13,14 +13,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Real start
session_start ();
// Load global vars
if ((! file_exists("../../include/config.php")) || (! is_readable("../../include/config.php"))) {
exit;
}
// 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');

View File

@ -12,14 +12,13 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Real start
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php");
// Set root on homedir, as defined in setup
chdir ($config["homedir"]);
session_start ();
ob_start ();
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";

View File

@ -491,7 +491,7 @@ $data[0] .= $table_ichanges;
//time autorefresh
$times = get_refresh_time_array();
$data[1] = '<span style="width:40%;float:left;">'.__('Time autorefresh').'</span>';
$data[1] = '<span style="width:40%;float:left;">'.__('Time autorefresh'). ui_print_help_tip(__('Interval of autorefresh of the elements, by default they are 30 seconds, needing to enable the autorefresh first'), true).'</span>';
$data[1] .= $jump . '<span style="width:20%;float:left;">'. html_print_select ($times, 'time_autorefresh', $user_info["time_autorefresh"], '', '', '', true,false,false).'</span>';
$table->rowclass[] = '';

View File

@ -13,14 +13,13 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Real start
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php");
// Set root on homedir, as defined in setup
chdir ($config["homedir"]);
session_start ();
ob_start ();
/* Enterprise support */
if (file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.729
%define release 181121
%define release 181205
# User and Group under which Apache is running
%define httpd_name httpd
@ -29,7 +29,7 @@ Requires: %{httpd_name} >= 2.0.0
Requires: mod_php >= 5.2.0
Requires: php-gd, php-ldap, php-snmp, php-session, php-gettext
Requires: php-mysqlnd, php-mbstring, php-zip, php-zlib, php-curl
Requires: xorg-x11-fonts-75dpi, xorg-x11-fonts-misc
Requires: xorg-x11-fonts-75dpi, xorg-x11-fonts-misc, php-pecl-zip
Requires: graphviz
Provides: %{name}-%{version}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.729
%define release 181121
%define release 181205
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2
@ -27,7 +27,8 @@ Prefix: /srv/www/htdocs
BuildRoot: %{_tmppath}/%{name}
BuildArch: noarch
AutoReq: 0
Requires: apache2, apache2-mod_php5
Requires: apache2
Requires: (apache2-mod_php5 or apache2-mod_php7)
Requires: php >= 4.3.0
Requires: php-gd, php-snmp, php-json, php-gettext
Requires: php-mysqlnd, php-ldap, php-mbstring, php

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