mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Merge branch 'develop' into feature/NewView
This commit is contained in:
commit
a34b16a938
@ -24,7 +24,10 @@ require_once ('include/functions_db.php');
|
|||||||
require_once ('include/auth/mysql.php');
|
require_once ('include/auth/mysql.php');
|
||||||
|
|
||||||
// Real start
|
// Real start
|
||||||
session_start ();
|
|
||||||
|
if (session_id() == '') {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
|
||||||
// Hash login process
|
// Hash login process
|
||||||
if (isset ($_GET["loginhash"])) {
|
if (isset ($_GET["loginhash"])) {
|
||||||
|
@ -84,3 +84,13 @@ ALTER TABLE `tperfil` ADD COLUMN `vconsole_management` tinyint(1) NOT NULL DEFAU
|
|||||||
UPDATE `tperfil` SET `map_view` = 1, `vconsole_view` = 1 WHERE `report_view` = 1;
|
UPDATE `tperfil` SET `map_view` = 1, `vconsole_view` = 1 WHERE `report_view` = 1;
|
||||||
UPDATE `tperfil` SET `map_edit` = 1, `vconsole_edit` = 1 WHERE `report_edit` = 1;
|
UPDATE `tperfil` SET `map_edit` = 1, `vconsole_edit` = 1 WHERE `report_edit` = 1;
|
||||||
UPDATE `tperfil` SET `map_management` = 1, `vconsole_management` = 1 WHERE `report_management` = 1;
|
UPDATE `tperfil` SET `map_management` = 1, `vconsole_management` = 1 WHERE `report_management` = 1;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `tsessions_php`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE tsessions_php (
|
||||||
|
`id_session` CHAR(52) NOT NULL,
|
||||||
|
`last_active` INTEGER NOT NULL,
|
||||||
|
`data` TEXT,
|
||||||
|
PRIMARY KEY (`id_session`)
|
||||||
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
@ -84,3 +84,12 @@ ALTER TABLE tperfil ADD COLUMN vconsole_management NUMBER(1, 0) DEFAULT 0 NOT NU
|
|||||||
UPDATE tperfil SET map_view = 1, vconsole_view = 1 WHERE report_view = 1;
|
UPDATE tperfil SET map_view = 1, vconsole_view = 1 WHERE report_view = 1;
|
||||||
UPDATE tperfil SET map_edit = 1, vconsole_edit = 1 WHERE report_edit = 1;
|
UPDATE tperfil SET map_edit = 1, vconsole_edit = 1 WHERE report_edit = 1;
|
||||||
UPDATE tperfil SET map_management = 1, vconsole_management = 1 WHERE report_management = 1;
|
UPDATE tperfil SET map_management = 1, vconsole_management = 1 WHERE report_management = 1;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table tsessions_php
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE tsessions_php (
|
||||||
|
id_session VARCHAR2(52) NOT NULL PRIMARY KEY,
|
||||||
|
last_active NUMBER(20, 0) NOT NULL,
|
||||||
|
data CLOB default ''
|
||||||
|
);
|
||||||
|
@ -82,3 +82,12 @@ ALTER TABLE "tperfil" ADD COLUMN "vconsole_management" SMALLINT NOT NULL DEFAULT
|
|||||||
UPDATE "tperfil" SET "map_view" = 1, "vconsole_view" = 1 WHERE "report_view" = 1;
|
UPDATE "tperfil" SET "map_view" = 1, "vconsole_view" = 1 WHERE "report_view" = 1;
|
||||||
UPDATE "tperfil" SET "map_edit" = 1, "vconsole_edit" = 1 WHERE "report_edit" = 1;
|
UPDATE "tperfil" SET "map_edit" = 1, "vconsole_edit" = 1 WHERE "report_edit" = 1;
|
||||||
UPDATE "tperfil" SET "map_management" = 1, "vconsole_management" = 1 WHERE "report_management" = 1;
|
UPDATE "tperfil" SET "map_management" = 1, "vconsole_management" = 1 WHERE "report_management" = 1;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table tsessions_php
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE "tsessions_php" (
|
||||||
|
"id_session" SERIAL NOT NULL PRIMARY KEY,
|
||||||
|
"last_active" INTEGER NOT NULL,
|
||||||
|
"data" TEXT default ''
|
||||||
|
);
|
||||||
|
@ -117,6 +117,13 @@ $row[] = __('Yes') . ' ' .
|
|||||||
$config_double_auth_enabled, true);
|
$config_double_auth_enabled, true);
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
|
|
||||||
|
$row_timeout = array();
|
||||||
|
$row_timeout[] = __('Session timeout (mins)')
|
||||||
|
. ui_print_help_tip(__("This is defined in minutes"), true);
|
||||||
|
if (empty($config["session_timeout"])) $config["session_timeout"] = 90;
|
||||||
|
$row_timeout[] = html_print_input_text ('session_timeout', $config["session_timeout"], '', 10, 10, true);
|
||||||
|
$table->data[] = $row_timeout;
|
||||||
|
|
||||||
echo '<form id="form_setup" method="post">';
|
echo '<form id="form_setup" method="post">';
|
||||||
html_print_input_hidden ('update_config', 1);
|
html_print_input_hidden ('update_config', 1);
|
||||||
html_print_table ($table);
|
html_print_table ($table);
|
||||||
|
@ -118,6 +118,11 @@ date_default_timezone_set("Europe/Madrid");
|
|||||||
|
|
||||||
config_process_config();
|
config_process_config();
|
||||||
|
|
||||||
|
config_prepare_session();
|
||||||
|
require_once ($config["homedir"].'/include/load_session.php');
|
||||||
|
$resultado = session_start();
|
||||||
|
|
||||||
|
|
||||||
if (!isset($config["homeurl_static"])) {
|
if (!isset($config["homeurl_static"])) {
|
||||||
$config["homeurl_static"] = $config["homeurl"];
|
$config["homeurl_static"] = $config["homeurl"];
|
||||||
}
|
}
|
||||||
|
@ -325,6 +325,8 @@ function config_update_config () {
|
|||||||
$error_update[] = __('Password');
|
$error_update[] = __('Password');
|
||||||
if (!config_update_value ('double_auth_enabled', get_parameter ('double_auth_enabled')))
|
if (!config_update_value ('double_auth_enabled', get_parameter ('double_auth_enabled')))
|
||||||
$error_update[] = __('Double authentication');
|
$error_update[] = __('Double authentication');
|
||||||
|
if (!config_update_value ('session_timeout', get_parameter ('session_timeout')))
|
||||||
|
$error_update[] = __('Session timeout');
|
||||||
/////////////
|
/////////////
|
||||||
break;
|
break;
|
||||||
case 'perf':
|
case 'perf':
|
||||||
@ -1312,6 +1314,10 @@ function config_process_config () {
|
|||||||
"");
|
"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset ($config["session_timeout"])) {
|
||||||
|
config_update_value ('session_timeout', 90);
|
||||||
|
}
|
||||||
|
|
||||||
/* Finally, check if any value was overwritten in a form */
|
/* Finally, check if any value was overwritten in a form */
|
||||||
config_update_config();
|
config_update_config();
|
||||||
}
|
}
|
||||||
@ -1525,4 +1531,21 @@ function config_user_set_custom_config() {
|
|||||||
$config['metaconsole_access'] = $userinfo["metaconsole_access"];
|
$config['metaconsole_access'] = $userinfo["metaconsole_access"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function config_prepare_session() {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
// Change the session timeout value to session_timeout minutes // 8*60*60 = 8 hours
|
||||||
|
$sessionCookieExpireTime = $config["session_timeout"] * 60;
|
||||||
|
ini_set('session.gc_maxlifetime', $sessionCookieExpireTime);
|
||||||
|
session_set_cookie_params ($sessionCookieExpireTime);
|
||||||
|
|
||||||
|
// Reset the expiration time upon page load //session_name() is default name of session PHPSESSID
|
||||||
|
|
||||||
|
if (isset($_COOKIE[session_name()]))
|
||||||
|
setcookie(session_name(), $_COOKIE[session_name()], time() + $sessionCookieExpireTime, "/");
|
||||||
|
|
||||||
|
ini_set("post_max_size",$config["max_file_size"]);
|
||||||
|
ini_set("upload_max_filesize",$config["max_file_size"]);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -2468,6 +2468,67 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
|||||||
$config['fontpath'], $config['font_size'], 1, 'bottom');
|
$config['fontpath'], $config['font_size'], 1, 'bottom');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function grafico_eventos_agente ($width = 300, $height = 200, $result = false, $meta = false, $history = false) {
|
||||||
|
global $config;
|
||||||
|
global $graphic_type;
|
||||||
|
|
||||||
|
//It was urlencoded, so we urldecode it
|
||||||
|
$url = html_entity_decode (rawurldecode ($url), ENT_QUOTES);
|
||||||
|
$data = array ();
|
||||||
|
$loop = 0;
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
$result = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$system_events = 0;
|
||||||
|
$other_events = 0;
|
||||||
|
$total = array();
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
foreach ($result as $row) {
|
||||||
|
if ($meta) {
|
||||||
|
$count[] = $row["agent_name"];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($row["id_agente"] == 0) {
|
||||||
|
$count[] = __('SYSTEM');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$count[] = agents_get_name ($row["id_agente"]) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$total = array_count_values($count);
|
||||||
|
|
||||||
|
foreach ($total as $key => $total) {
|
||||||
|
if ($meta) {
|
||||||
|
$name = $key." (".$total.")";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$name = $key." (".$total.")";
|
||||||
|
}
|
||||||
|
$data[$name] = $total;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ($other_events > 0) {
|
||||||
|
$name = __('Other')." (".$other_events.")";
|
||||||
|
$data[$name] = $other_events;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Sort the data
|
||||||
|
arsort($data);
|
||||||
|
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
|
|
||||||
|
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
||||||
|
__('Other'), '', $water_mark,
|
||||||
|
$config['fontpath'], $config['font_size'], 1, 'bottom');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a pie graph with events data in 320x200 size
|
* Print a pie graph with events data in 320x200 size
|
||||||
*
|
*
|
||||||
|
File diff suppressed because it is too large
Load Diff
89
pandora_console/include/load_session.php
Normal file
89
pandora_console/include/load_session.php
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
<?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.
|
||||||
|
|
||||||
|
|
||||||
|
function mysql_session_open ($save_path, $session_name) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mysql_session_close() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mysql_session_read ($SessionID) {
|
||||||
|
|
||||||
|
$SessionID = addslashes($SessionID);
|
||||||
|
|
||||||
|
$sql = "SELECT data FROM tsessions_php
|
||||||
|
WHERE id_session = '$SessionID'";
|
||||||
|
|
||||||
|
$session_data = db_process_sql($sql);
|
||||||
|
|
||||||
|
if (count($session_data) == 1) {
|
||||||
|
return $session_data[0]['data'];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function mysql_session_write ($SessionID, $val) {
|
||||||
|
|
||||||
|
$SessionID = addslashes($SessionID);
|
||||||
|
$val = addslashes($val);
|
||||||
|
|
||||||
|
$sql = "SELECT COUNT(*) FROM tsessions_php
|
||||||
|
WHERE id_session = '$SessionID'";
|
||||||
|
|
||||||
|
$SessionExists = db_process_sql ($sql);
|
||||||
|
|
||||||
|
$session_exists = $SessionExists[0]['COUNT(*)'];
|
||||||
|
|
||||||
|
if ($session_exists == 0) {
|
||||||
|
$now = time();
|
||||||
|
$retval_write = db_process_sql_insert ('tsessions_php', array('id_session'=>$SessionID, 'last_active'=>$now, 'data'=>$val));
|
||||||
|
} else {
|
||||||
|
$now = time();
|
||||||
|
$retval_write = db_process_sql_update ('tsessions_php', array('last_active'=>$now, 'data'=>$val), array('id_session'=>$SessionID));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $retval_write;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mysql_session_destroy ($SessionID) {
|
||||||
|
$SessionID = addslashes($SessionID);
|
||||||
|
|
||||||
|
$retval = db_process_sql ("DELETE FROM tsessions_php
|
||||||
|
WHERE id_session = '$SessionID'");
|
||||||
|
return $retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mysql_session_gc ($maxlifetime = 300) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (isset($config['session_timeout'])) {
|
||||||
|
$maxlifetime = $config['session_timeout'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$CutoffTime = time() - $maxlifetime;
|
||||||
|
|
||||||
|
$retval = db_process_sql("DELETE FROM tsessions_php
|
||||||
|
WHERE last_active < $CutoffTime");
|
||||||
|
return $retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
$resultado_handler = session_set_save_handler ('mysql_session_open', 'mysql_session_close', 'mysql_session_read', 'mysql_session_write', 'mysql_session_destroy', 'mysql_session_gc');
|
||||||
|
|
||||||
|
?>
|
@ -731,6 +731,17 @@ else {
|
|||||||
$history);
|
$history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($result)) {
|
||||||
|
|
||||||
|
$graph = '<div style="width: 350px; margin: 0 auto;">' .
|
||||||
|
grafico_eventos_agente(350, 185,
|
||||||
|
$result, $meta, $history, $tags_acls_condition,$pagination) .
|
||||||
|
'</div>';
|
||||||
|
html_print_div(array('id' => 'events_graph',
|
||||||
|
'hidden' => true, 'content' => $graph));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
//~ Checking the event tags exactly. The event query filters approximated tags to keep events
|
//~ Checking the event tags exactly. The event query filters approximated tags to keep events
|
||||||
//~ with several tags
|
//~ with several tags
|
||||||
@ -744,14 +755,7 @@ if (!empty($result)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($result)) {
|
|
||||||
$graph = '<div style="width: 350px; margin: 0 auto;">' .
|
|
||||||
grafico_eventos_grupo(350, 185,
|
|
||||||
rawurlencode ($sql_post), $meta, $history) .
|
|
||||||
'</div>';
|
|
||||||
html_print_div(array('id' => 'events_graph',
|
|
||||||
'hidden' => true, 'content' => $graph));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete rnum field generated by oracle_recode_query() function
|
// Delete rnum field generated by oracle_recode_query() function
|
||||||
if (($config['dbtype'] == 'oracle') && ($result !== false)) {
|
if (($config['dbtype'] == 'oracle') && ($result !== false)) {
|
||||||
|
@ -1935,3 +1935,12 @@ CREATE TABLE talert_snmp_action (
|
|||||||
al_field9 CLOB default '' NOT NULL,
|
al_field9 CLOB default '' NOT NULL,
|
||||||
al_field10 CLOB default '' NOT NULL
|
al_field10 CLOB default '' NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table tsessions_php
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE tsessions_php (
|
||||||
|
id_session VARCHAR2(52) NOT NULL PRIMARY KEY,
|
||||||
|
last_active NUMBER(20, 0) NOT NULL,
|
||||||
|
data CLOB default ''
|
||||||
|
);
|
||||||
|
@ -1698,3 +1698,12 @@ CREATE TABLE "talert_snmp_action" (
|
|||||||
"al_field9" TEXT default '',
|
"al_field9" TEXT default '',
|
||||||
"al_field10" TEXT default ''
|
"al_field10" TEXT default ''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table tsessions_php
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE "tsessions_php" (
|
||||||
|
"id_session" SERIAL NOT NULL PRIMARY KEY,
|
||||||
|
"last_active" INTEGER NOT NULL,
|
||||||
|
"data" TEXT default ''
|
||||||
|
);
|
||||||
|
@ -1796,3 +1796,13 @@ CREATE TABLE IF NOT EXISTS `talert_snmp_action` (
|
|||||||
`al_field10` text NOT NULL,
|
`al_field10` text NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `tsessions_php`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE tsessions_php (
|
||||||
|
`id_session` CHAR(52) NOT NULL,
|
||||||
|
`last_active` INTEGER NOT NULL,
|
||||||
|
`data` TEXT,
|
||||||
|
PRIMARY KEY (`id_session`)
|
||||||
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user