Merge branch 'develop' into ent-5935-Logs-de-la-consola-refactorizacion

This commit is contained in:
alejandro-campos 2020-06-23 09:56:21 +02:00
commit cec16d01b8
43 changed files with 150 additions and 71 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.746-200619
Version: 7.0NG.746-200623
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.746-200619"
pandora_version="7.0NG.746-200623"
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

@ -55,7 +55,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.746';
use constant AGENT_BUILD => '200619';
use constant AGENT_BUILD => '200623';
# 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.746
%define release 200619
%define release 200623
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.746"
PI_BUILD="200619"
PI_BUILD="200623"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{200619}
{200623}
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.746(Build 200619)")
#define PANDORA_VERSION ("7.0NG.746(Build 200623)")
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.746(Build 200619))"
VALUE "ProductVersion", "(7.0NG.746(Build 200623))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.746-200619
Version: 7.0NG.746-200623
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.746-200619"
pandora_version="7.0NG.746-200623"
package_pear=0
package_pandora=1

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE `tmensajes` ADD COLUMN `hidden_sent` TINYINT(1) UNSIGNED DEFAULT 0;
COMMIT;

View File

@ -2314,6 +2314,7 @@ ALTER TABLE `tmensajes` ADD COLUMN `response_mode` VARCHAR(200) DEFAULT NULL;
ALTER TABLE `tmensajes` ADD COLUMN `citicity` INT(10) UNSIGNED DEFAULT '0';
ALTER TABLE `tmensajes` ADD COLUMN `id_source` BIGINT(20) UNSIGNED NOT NULL;
ALTER TABLE `tmensajes` ADD COLUMN `subtype` VARCHAR(255) DEFAULT '';
ALTER TABLE `tmensajes` ADD COLUMN `hidden_sent` TINYINT(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tmensajes` ADD CONSTRAINT `tsource_fk` FOREIGN KEY (`id_source`) REFERENCES `tnotification_source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tmensajes` DROP COLUMN `id_usuario_destino`,
ADD UNIQUE INDEX `id_mensaje` (`id_mensaje`);

View File

@ -119,7 +119,7 @@ if ($create_special_day) {
$values['description'] = (string) get_parameter('description');
$aviable_description = true;
if (preg_match('<script>', $values['description'])) {
if (preg_match('/script/i', $values['description'])) {
$aviable_description = false;
}
@ -185,7 +185,7 @@ if ($update_special_day) {
$id_group_orig = (string) get_parameter('id_group_orig');
$aviable_description = true;
if (preg_match('<script>', $description)) {
if (preg_match('/script/i', $description)) {
$aviable_description = false;
}

View File

@ -348,7 +348,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$propagate = (bool) get_parameter('propagate');
$aviable_name = true;
if (preg_match('<script>', $name)) {
if (preg_match('/script/i', $name)) {
$aviable_name = false;
}
@ -403,7 +403,7 @@ if ($update_group) {
$other = (string) get_parameter('other');
$aviable_name = true;
if (preg_match('<script>', $name)) {
if (preg_match('/script/i', $name)) {
$aviable_name = false;
}
@ -724,8 +724,8 @@ if ($tab == 'tree') {
[
'style' => '',
'class' => 'bot',
'alt' => $group['nombre'],
'title' => $group['nombre'],
'alt' => io_safe_input($group['nombre']),
'title' => io_safe_input($group['nombre']),
],
false,
false,

View File

@ -1090,7 +1090,7 @@ if ($dialogue_event_response) {
if ($add_comment) {
$aviability_comment = true;
$comment = get_parameter('comment');
if (preg_match('<script>', io_safe_output($comment))) {
if (preg_match('/script/i', io_safe_output($comment))) {
$aviability_comment = false;
$return = false;
}

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC200619';
$build_version = 'PC200623';
$pandora_version = 'v7.0NG.746';
// Do not overwrite default timezone set if defined.

View File

@ -149,8 +149,8 @@ define('COL_IGNORED', '#DDD');
define('COL_ALERTFIRED', '#F36201');
define('COL_MINOR', '#F099A2');
define('COL_MAJOR', '#C97A4A');
define('COL_INFORMATIONAL', '#E4E4E4');
define('COL_MAINTENANCE', '#4a83f3');
define('COL_INFORMATIONAL', '#4a83f3');
define('COL_MAINTENANCE', '#E4E4E4');
define('COL_GRAPH1', '#C397F2');
define('COL_GRAPH2', '#FFE66C');

View File

@ -285,7 +285,7 @@ function clippy_context_help($help=null)
$return = '';
include_once 'include/help/clippy/'.$help.'.php';
include_once $config['homedir'].'/include/help/clippy/'.$help.'.php';
ob_start();
$function = 'clippy_'.$help;

View File

@ -1448,8 +1448,8 @@ function html_print_extended_select_for_time(
}
ob_start();
// Use the no_meta parameter because this image is only in the base console
echo '<div id="'.$uniq_name.'_default" style="width:100%;display:flex;align-items: baseline;">';
// Use the no_meta parameter because this image is only in the base console.
echo '<div id="'.$uniq_name.'_default" style="width:100%;display:inline">';
html_print_select(
$fields,
$uniq_name.'_select',
@ -1464,7 +1464,7 @@ function html_print_extended_select_for_time(
$readonly,
'font-size: xx-small;'.$select_style
);
// The advanced control is only for admins
// The advanced control is only for admins.
if ($admin) {
echo ' <a href="javascript:">'.html_print_image(
'images/pencil.png',
@ -1483,7 +1483,7 @@ function html_print_extended_select_for_time(
echo '</div>';
echo '<div id="'.$uniq_name.'_manual" style="width:100%;display:flex;">';
echo '<div id="'.$uniq_name.'_manual" style="width:100%;display:inline;">';
html_print_input_text($uniq_name.'_text', $selected, '', $size, 255, false, $readonly, false, '', $class);
html_print_input_hidden($name, $selected, false, $uniq_name);
@ -1514,15 +1514,15 @@ function html_print_extended_select_for_time(
echo '</div>';
echo "<script type='text/javascript'>
$(document).ready (function () {
period_select_init('$uniq_name', $allow_zero);
period_select_events('$uniq_name');
period_select_init('".$uniq_name."', ".(($allow_zero) ? 'true' : 'null').");
period_select_events('".$uniq_name."');
});
function period_select_".$name."_update(seconds) {
$('#text-".$uniq_name."_text').val(seconds);
adjustTextUnits('".$uniq_name."');
calculateSeconds('".$uniq_name."');
$('#".$uniq_name."_manual').css('display', 'flex');
$('#".$uniq_name."_default').css('display', 'none');
$('#".$uniq_name."_manual').show();
$('#".$uniq_name."_default').hide();
}
</script>";
$returnString = ob_get_clean();

View File

@ -311,7 +311,7 @@ function messages_get_message_sent(int $message_id)
$sql = sprintf(
"SELECT id_usuario_origen, subject, mensaje, timestamp
FROM tmensajes
WHERE id_usuario_origen='%s' AND id_mensaje=%d",
WHERE id_usuario_origen='%s' AND id_mensaje=%d AND hidden_sent = 0",
$config['id_user'],
$message_id
);
@ -431,7 +431,7 @@ function messages_get_count_sent(string $user='')
$sql = sprintf(
"SELECT COUNT(*)
FROM tmensajes WHERE id_usuario_origen='%s'",
FROM tmensajes WHERE id_usuario_origen='%s' AND hidden_sent = 0",
$user
);
@ -579,6 +579,17 @@ function messages_get_overview_sent(
$order .= ' DESC';
}
$filter = [
'id_usuario_origen' => $config['id_user'],
'hidden_sent' => 0,
'order' => $order,
];
return db_get_all_rows_filter(
'tmensajes',
$filter
);
return db_get_all_rows_field_filter(
'tmensajes',
'id_usuario_origen',
@ -661,3 +672,27 @@ function messages_get_url($message_id)
// Return the message direction.
return ui_get_full_url('index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&id_message='.$message_id);
}
/**
* Deletes sent message
*
* @param integer $message_id Message id to get URL.
*
* @return boolean true when deleted, false in case of error
*/
function messages_delete_message_sent($id_message)
{
global $config;
$ret = db_process_sql_update(
'tmensajes',
['hidden_sent' => 1],
[
'id_mensaje' => $id_message,
'id_usuario_origen' => $config['id_user'],
]
);
return $ret;
}

View File

@ -2142,10 +2142,24 @@ function reporting_html_historical_data($table, $item, $pdf=0)
$table1->data = [];
foreach ($item['data'] as $data) {
if (!is_numeric($data[__('Data')])) {
$row = [
$data[__('Date')],
$data[__('Data')],
];
if (is_snapshot_data($data[__('Data')])) {
if ($config['command_snapshot']) {
$row = [
$data[__('Date')],
'<img style="width:300px" src="'.io_safe_input($data[__('Data')]).'"></a>',
];
} else {
$row = [
$data[__('Date')],
wordwrap(io_safe_input($data[__('Data')]), 60, "<br>\n", true),
];
}
} else {
$row = [
$data[__('Date')],
$data[__('Data')],
];
}
} else {
$row = [
$data[__('Date')],
@ -2191,6 +2205,8 @@ function reporting_html_historical_data($table, $item, $pdf=0)
*/
function reporting_html_database_serialized($table, $item, $pdf=0)
{
global $config;
$table1 = new stdClass();
$table1->width = '100%';
$table1->head = [
@ -2205,9 +2221,19 @@ function reporting_html_database_serialized($table, $item, $pdf=0)
$table1->data = [];
foreach ($item['data'] as $data) {
foreach ($data['data'] as $data_unserialied) {
foreach ($data['data'] as $data_unserialized) {
$row = [$data['date']];
$row = array_merge($row, $data_unserialied);
foreach ($data_unserialized as $key => $data_value) {
if (is_snapshot_data($data_unserialized[$key])) {
if ($config['command_snapshot']) {
$data_unserialized[$key] = '<img style="width:300px" src="'.io_safe_input($data_value).'"></a>';
} else {
$data_unserialized[$key] = wordwrap(io_safe_input($data_value), 60, "<br>\n", true);
}
}
}
$row = array_merge($row, $data_unserialized);
$table1->data[] = $row;
}
}

View File

@ -226,14 +226,13 @@ function flot_area_graph(
$config['custom_graph_width'],
true
);
/*
$return .= "<div id='timestamp_$graph_id'
class='timestamp_graph'
style=' font-size:".$params['font_size']."pt;
display:none; position:absolute;
background:#fff; border: solid 1px #aaa;
padding: 2px; z-index:1000;'></div>";
*/
$return .= "<div id='timestamp_$graph_id'
class='timestamp_graph'
style='font-size:".$params['font_size']."pt;
display:none; position:absolute;
background:#fff; border: solid 1px #aaa;
padding: 2px; z-index:1000;
'></div>";
$return .= "<div id='$graph_id' class='";
if ($params['type'] == 'area_simple') {

View File

@ -844,7 +844,7 @@ function post_process_select_events(name) {
function period_select_init(name, allow_zero) {
// Manual mode is hidden by default
$("#" + name + "_manual").css("display", "none");
$("#" + name + "_default").css("display", "flex");
$("#" + name + "_default").css("display", "inline");
// If the text input is empty, we put on it 5 minutes by default
if ($("#text-" + name + "_text").val() == "") {
@ -858,7 +858,7 @@ function period_select_init(name, allow_zero) {
}
} else if ($("#text-" + name + "_text").val() == 0 && allow_zero != true) {
$("#" + name + "_units option:last").prop("selected", false);
$("#" + name + "_manual").css("display", "flex");
$("#" + name + "_manual").css("display", "inline");
$("#" + name + "_default").css("display", "none");
}
}
@ -947,13 +947,13 @@ function selectFirst(name) {
*/
function toggleBoth(name) {
if ($("#" + name + "_default").css("display") == "none") {
$("#" + name + "_default").css("display", "flex");
$("#" + name + "_default").css("display", "inline");
} else {
$("#" + name + "_default").css("display", "none");
}
if ($("#" + name + "_manual").css("display") == "none") {
$("#" + name + "_manual").css("display", "flex");
$("#" + name + "_manual").css("display", "inline");
} else {
$("#" + name + "_manual").css("display", "none");
}

View File

@ -70,9 +70,8 @@ ul.wizard li > textarea {
}
.wizard .discovery_inline_input {
display: flex;
display: inline;
align-content: end;
flex: 0;
align-self: flex-start;
}

View File

@ -1174,7 +1174,7 @@ if ($searchPage) {
if (($home_url == '') || ($id_visualc == false)) {
$str = 'sec=network&sec2=operation/visual_console/index&refr=60';
} else {
$str = 'sec=network&sec2=operation/visual_console/render_view&id='.$id_visualc.'&refr=60';
$str = 'sec=network&sec2=operation/visual_console/render_view&id='.$id_visualc;
}
parse_str($str, $res);

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.746';
$build = '200619';
$build = '200623';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -158,7 +158,7 @@ if ($read_message) {
).' '.$user_name.' '.__('wrote').":\n\n".$message['mensaje'];
echo '<form id="delete_message" method="post" action="index.php?sec=message_list&amp;sec2=operation/messages/message_list&show_sent=1&amp;delete_message=1&amp;id='.$message_id.'">';
echo '<form id="delete_message" method="post" action="index.php?sec=message_list&amp;sec2=operation/messages/message_list&show_sent='.$show_sent.'&amp;delete_message=1&amp;id='.$message_id.'">';
echo '</form>';
echo '<form id="reply_message" method="post" action="index.php?sec=message_list&sec2=operation/messages/message_edit&amp;new_msg=1&amp;reply=1">';

View File

@ -78,7 +78,13 @@ if ($mark_unread) {
if ($delete_msg) {
$id = (int) get_parameter('id');
$result = messages_delete_message($id);
if ($show_sent) {
$result = messages_delete_message_sent($id);
} else {
$result = messages_delete_message($id);
}
// Delete message function will actually check the credentials.
ui_print_result_message(
$result,
@ -91,7 +97,11 @@ if ($multiple_delete) {
$ids = (array) get_parameter('delete_multiple_messages', []);
foreach ($ids as $id) {
$result = messages_delete_message($id);
if ($show_sent) {
$result = messages_delete_message_sent($id);
} else {
$result = messages_delete_message($id);
}
if ($result === false) {
break;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.746
%define release 200619
%define release 200623
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.746
%define release 200619
%define release 200623
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.746
%define release 200619
%define release 200623
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1291,6 +1291,7 @@ CREATE TABLE IF NOT EXISTS `tmensajes` (
`citicity` INT(10) UNSIGNED DEFAULT '0',
`id_source` BIGINT(20) UNSIGNED NOT NULL,
`subtype` VARCHAR(255) DEFAULT '',
`hidden_sent` TINYINT(1) UNSIGNED DEFAULT 0,
PRIMARY KEY (`id_mensaje`),
UNIQUE KEY `id_mensaje` (`id_mensaje`),
KEY `tsource_fk` (`id_source`),

View File

@ -143,11 +143,14 @@ class ImageProcessor implements \Psr\Log\LoggerAwareInterface
}
$data = $this->mpdf->imageVars[$v[1]];
$file = md5($data);
}
if (preg_match('/data:image\/(gif|jpeg|png);base64,(.*)/', $file, $v)) {
if (preg_match('~data:image/(gif|jpeg|png);base64,(.*)~', $file, $v)) {
$type = $v[1];
$data = base64_decode($v[2]);
$encoded = $v[2];
$decoded = "";
$data = base64_decode(html_entity_decode($encoded));
$file = md5($data);
}

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.746-200619
Version: 7.0NG.746-200623
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.746-200619"
pandora_version="7.0NG.746-200623"
package_cpan=0
package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.746";
my $pandora_build = "200619";
my $pandora_build = "200623";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -33,7 +33,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.746";
my $pandora_build = "200619";
my $pandora_build = "200623";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.746
%define release 200619
%define release 200623
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.746
%define release 200619
%define release 200623
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.746"
PI_BUILD="200619"
PI_BUILD="200623"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.746 PS200619";
my $version = "7.0NG.746 PS200623";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.746 PS200619";
my $version = "7.0NG.746 PS200623";
# save program name for logging
my $progname = basename($0);