Merge remote-tracking branch 'origin/develop' into ent-5918-9948-correlacion-de-alertas-no-funcionan-con-logs

This commit is contained in:
fbsanchez 2020-06-23 10:17:22 +02:00
commit d4b247acae
81 changed files with 139300 additions and 104362 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.746-200603 Version: 7.0NG.746-200623
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.746" PI_VERSION="7.0NG.746"
PI_BUILD="200603" PI_BUILD="200623"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0
@ -164,7 +164,7 @@ uninstall () {
rm -f $DESTDIR/etc/logrotate.d/pandora_agent rm -f $DESTDIR/etc/logrotate.d/pandora_agent
# Remove systemd service if exists # Remove systemd service if exists
if [ $(systemctl --v | grep systemd | wc -l) != 0 ] if [ `systemctl --v 2> /dev/null | grep systemd | wc -l` != 0 ]
then then
PANDORA_AGENT_SERVICE="/etc/systemd/system/pandora_agent_daemon.service" PANDORA_AGENT_SERVICE="/etc/systemd/system/pandora_agent_daemon.service"
rm -f $PANDORA_AGENT_SERVICE rm -f $PANDORA_AGENT_SERVICE
@ -480,7 +480,7 @@ install () {
fi fi
# Create systemd service # Create systemd service
if [ $(systemctl --v | grep systemd | wc -l) != 0 ] if [ `systemctl --v 2> /dev/null | grep systemd | wc -l` != 0 ]
then then
echo "Creating systemd service for pandora_agent_daemon" echo "Creating systemd service for pandora_agent_daemon"

View File

@ -567,12 +567,12 @@ if ($enable_all == 1 || $enabled{'software'} == 1) {
#init_services #init_services
if ($enable_all == 1 || $enabled{'init_services'} == 1) { if ($enable_all == 1 || $enabled{'init_services'} == 1) {
get_servicies_init_machine ('Init_services', \%modules); get_servicies_init_machine ('Init services', \%modules);
} }
#filesystem #filesystem
if ($enable_all == 1 || $enabled{'filesystem'} == 1) { if ($enable_all == 1 || $enabled{'filesystem'} == 1) {
get_file_system('Filesystem', \%modules); get_file_system('File system', \%modules);
} }
#processes #processes

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{200603} {200623}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.746(Build 200603)") #define PANDORA_VERSION ("7.0NG.746(Build 200623)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.746-200603 Version: 7.0NG.746-200623
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -318,15 +318,15 @@ function quickShellSettings()
); );
$gotty_host = get_parameter( $gotty_host = get_parameter(
'gotty_host', 'gotty_host',
$config['gotty_host'] ''
); );
$gotty_ssh_port = get_parameter( $gotty_ssh_port = get_parameter(
'gotty_ssh_port', 'gotty_ssh_port',
$config['gotty_ssh_port'] ''
); );
$gotty_telnet_port = get_parameter( $gotty_telnet_port = get_parameter(
'gotty_telnet_port', 'gotty_telnet_port',
$config['gotty_telnet_port'] ''
); );
$gotty_user = get_parameter( $gotty_user = get_parameter(

View File

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

View File

@ -1342,13 +1342,13 @@ ALTER TABLE `tmap` MODIFY COLUMN `id_user` varchar(250) NOT NULL DEFAULT '';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 37); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 38);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '745'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '746');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields'; UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password'; DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
@ -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 `citicity` INT(10) UNSIGNED DEFAULT '0';
ALTER TABLE `tmensajes` ADD COLUMN `id_source` BIGINT(20) UNSIGNED NOT NULL; 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 `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` 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`, ALTER TABLE `tmensajes` DROP COLUMN `id_usuario_destino`,
ADD UNIQUE INDEX `id_mensaje` (`id_mensaje`); ADD UNIQUE INDEX `id_mensaje` (`id_mensaje`);

View File

@ -153,7 +153,7 @@ $table->rowclass[] = '';
$table->data[] = $tdata; $table->data[] = $tdata;
// Users. // Users.
if (users_is_admin()) { if (users_is_admin() || check_acl($config['id_user'], 0, 'UM')) {
$tdata = []; $tdata = [];
$tdata[0] = reporting_get_stats_users($data); $tdata[0] = reporting_get_stats_users($data);
$table->rowclass[] = ''; $table->rowclass[] = '';

View File

@ -43,7 +43,47 @@ if (empty($update_module_id)) {
$data = []; $data = [];
$data[0] = __('Target IP').' '.ui_print_help_icon('wmi_module_tab', true); $data[0] = __('Target IP').' '.ui_print_help_icon('wmi_module_tab', true);
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
if ($page == 'enterprise/godmode/policies/policy_modules') {
if ($ip_target != 'auto' && $ip_target != '') {
$custom_ip_target = $ip_target;
$ip_target = 'custom';
} else if ($ip_target == '') {
$ip_target = 'force_pri';
$custom_ip_target = '';
} else {
$custom_ip_target = '';
}
$target_ip_values = [];
$target_ip_values['auto'] = __('Auto');
$target_ip_values['force_pri'] = __('Force primary key');
$target_ip_values['custom'] = __('Custom');
$data[1] = html_print_select(
$target_ip_values,
'ip_target',
$ip_target,
'',
'',
'',
true,
false,
false,
'',
false,
'width:200px;'
);
$data[1] .= html_print_input_text('custom_ip_target', $custom_ip_target, '', 15, 60, true);
} else {
if ($ip_target == 'auto') {
$ip_target = agents_get_address($id_agente);
}
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
}
$data[2] = __('Namespace').ui_print_help_tip(__('Optional. WMI namespace. If unsure leave blank.'), true); $data[2] = __('Namespace').ui_print_help_tip(__('Optional. WMI namespace. If unsure leave blank.'), true);
$data[3] = html_print_input_text( $data[3] = html_print_input_text(
'tcp_send', 'tcp_send',
@ -136,3 +176,21 @@ $data[3] = html_print_input_text(
); );
push_table_simple($data, 'key_field'); push_table_simple($data, 'key_field');
?>
<script type="text/javascript">
$(document).ready (function () {
var custom_ip_target = "<?php echo $custom_ip_target; ?>";
if(custom_ip_target == ''){
$("#text-custom_ip_target").hide();
}
$('#ip_target').change(function() {
if($(this).val() == 'custom') {
$("#text-custom_ip_target").show();
}
else{
$("#text-custom_ip_target").hide();
}
});
});
</script>

View File

@ -118,6 +118,10 @@ if ($create_special_day) {
$values['id_group'] = (string) get_parameter('id_group'); $values['id_group'] = (string) get_parameter('id_group');
$values['description'] = (string) get_parameter('description'); $values['description'] = (string) get_parameter('description');
$aviable_description = true;
if (preg_match('/script/i', $values['description'])) {
$aviable_description = false;
}
$array_date = explode('-', $date); $array_date = explode('-', $date);
@ -142,8 +146,12 @@ if ($create_special_day) {
$result = ''; $result = '';
$messageAction = __('Could not be created, it already exists'); $messageAction = __('Could not be created, it already exists');
} else { } else {
$result = alerts_create_alert_special_day($date, $same_day, $values); if ($aviable_description) {
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$values['description'].'"}'; $result = alerts_create_alert_special_day($date, $same_day, $values);
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$values['description'].'"}';
} else {
$result = false;
}
} }
} }
@ -176,6 +184,11 @@ if ($update_special_day) {
$id_group = (string) get_parameter('id_group'); $id_group = (string) get_parameter('id_group');
$id_group_orig = (string) get_parameter('id_group_orig'); $id_group_orig = (string) get_parameter('id_group_orig');
$aviable_description = true;
if (preg_match('/script/i', $description)) {
$aviable_description = false;
}
$array_date = explode('-', $date); $array_date = explode('-', $date);
$year = $array_date[0]; $year = $array_date[0];
@ -206,12 +219,16 @@ if ($update_special_day) {
$result = ''; $result = '';
$messageAction = __('Could not be updated, it already exists'); $messageAction = __('Could not be updated, it already exists');
} else { } else {
if ($aviable_description !== false) {
$result = alerts_update_alert_special_day($id, $values);
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
}
}
} else {
if ($aviable_description !== false) {
$result = alerts_update_alert_special_day($id, $values); $result = alerts_update_alert_special_day($id, $values);
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}'; $info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
} }
} else {
$result = alerts_update_alert_special_day($id, $values);
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
} }
} }

View File

@ -347,24 +347,32 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$check = db_get_value('nombre', 'tgrupo', 'nombre', $name); $check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
$propagate = (bool) get_parameter('propagate'); $propagate = (bool) get_parameter('propagate');
$aviable_name = true;
if (preg_match('/script/i', $name)) {
$aviable_name = false;
}
// Check if name field is empty. // Check if name field is empty.
if ($name != '') { if ($name != '') {
if (!$check) { if (!$check) {
$values = [ if ($aviable_name === true) {
'nombre' => $name, $values = [
'icon' => empty($icon) ? '' : substr($icon, 0, -4), 'nombre' => $name,
'parent' => $id_parent, 'icon' => empty($icon) ? '' : substr($icon, 0, -4),
'disabled' => $alerts_disabled, 'parent' => $id_parent,
'custom_id' => $custom_id, 'disabled' => $alerts_disabled,
'id_skin' => $skin, 'custom_id' => $custom_id,
'description' => $description, 'id_skin' => $skin,
'contact' => $contact, 'description' => $description,
'propagate' => $propagate, 'contact' => $contact,
'other' => $other, 'propagate' => $propagate,
'password' => io_safe_input($group_pass), 'other' => $other,
]; 'password' => io_safe_input($group_pass),
];
$result = db_process_sql_insert('tgrupo', $values);
}
$result = db_process_sql_insert('tgrupo', $values);
if ($result) { if ($result) {
ui_print_success_message(__('Group successfully created')); ui_print_success_message(__('Group successfully created'));
} else { } else {
@ -394,8 +402,13 @@ if ($update_group) {
$contact = (string) get_parameter('contact'); $contact = (string) get_parameter('contact');
$other = (string) get_parameter('other'); $other = (string) get_parameter('other');
$aviable_name = true;
if (preg_match('/script/i', $name)) {
$aviable_name = false;
}
// Check if name field is empty. // Check if name field is empty.
if ($name != '') { if ($name != '' && $aviable_name === true) {
$sql = sprintf( $sql = sprintf(
'UPDATE tgrupo 'UPDATE tgrupo
SET nombre = "%s", SET nombre = "%s",
@ -711,8 +724,8 @@ if ($tab == 'tree') {
[ [
'style' => '', 'style' => '',
'class' => 'bot', 'class' => 'bot',
'alt' => $group['nombre'], 'alt' => io_safe_input($group['nombre']),
'title' => $group['nombre'], 'title' => io_safe_input($group['nombre']),
], ],
false, false,
false, false,

View File

@ -271,7 +271,7 @@ ui_print_page_header(
$help_header, $help_header,
true, true,
$onheader, $onheader,
true, false,
'massivemodal' 'massivemodal'
); );

View File

@ -471,7 +471,7 @@ foreach ($items as $item) {
if ($is_inventory_item) { if ($is_inventory_item) {
$external_source = json_decode($item['external_source'], true); $external_source = json_decode($item['external_source'], true);
$agents = $external_source['id_agents']; $agents = $external_source['id_agents'];
$modules = $external_source['inventory_modules']; $modules = io_safe_output($external_source['inventory_modules']);
$agent_name_db = []; $agent_name_db = [];
foreach ($agents as $a) { foreach ($agents as $a) {

View File

@ -767,9 +767,14 @@ switch ($action) {
) )
); );
if (count($reports)) { if (count($reports)) {
$filters = [
'search' => $search,
'id_group' => $id_group,
];
$filtersStr = http_build_query($filters, '', '&amp;');
$url = 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder'; $url = 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder';
$url .= '&'.$filtersStr;
ui_pagination($total_reports, $url, $offset, $pagination); ui_pagination($total_reports, $url, $offset, $pagination);
$table = new stdClass(); $table = new stdClass();

View File

@ -31,11 +31,10 @@ $id_tag = (int) get_parameter('id_tag', 0);
$update_tag = (int) get_parameter('update_tag', 0); $update_tag = (int) get_parameter('update_tag', 0);
$create_tag = (int) get_parameter('create_tag', 0); $create_tag = (int) get_parameter('create_tag', 0);
$name_tag = (string) get_parameter('name_tag', ''); $name_tag = (string) get_parameter('name_tag', '');
$description_tag = (string) get_parameter('description_tag', ''); $description_tag = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description_tag'))));
$description_tag = io_safe_input(strip_tags(io_safe_output($description_tag)));
$url_tag = (string) get_parameter('url_tag', ''); $url_tag = (string) get_parameter('url_tag', '');
$email_tag = (string) get_parameter('email_tag', ''); $email_tag = io_safe_input(strip_tags(io_safe_output(((string) get_parameter('email_tag')))));
$phone_tag = (string) get_parameter('phone_tag', ''); $phone_tag = io_safe_input(strip_tags(io_safe_output(((string) get_parameter('phone_tag')))));
$tab = (string) get_parameter('tab', 'list'); $tab = (string) get_parameter('tab', 'list');
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {

View File

@ -367,11 +367,11 @@ if ($search) {
$found = false; $found = false;
if (!empty($filter_search)) { if (!empty($filter_search)) {
if (preg_match('/.*'.$filter_search.'.*/', $user_info['fullname']) != 0) { if (preg_match('/.*'.strtolower($filter_search).'.*/', strtolower($user_info['fullname'])) != 0) {
$found = true; $found = true;
} }
if (preg_match('/.*'.$filter_search.'.*/', $user_info['id_user']) != 0) { if (preg_match('/.*'.strtolower($filter_search).'.*/', strtolower($user_info['id_user'])) != 0) {
$found = true; $found = true;
} }
@ -419,7 +419,7 @@ else {
$result = array_intersect($g, $own_groups); $result = array_intersect($g, $own_groups);
// Show users without profile too. // Show users without profile too.
if (!$usr['is_admin'] && !empty($result) || (!$usr['is_admin'] && db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $usr['id_user']) === false)) { if (!empty($result) || (db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $usr['id_user']) === false)) {
$info[$key] = $usr; $info[$key] = $usr;
} }

View File

@ -629,6 +629,16 @@ class DiscoveryTaskList extends HTML
$data[6] .= __('Discovery.App.Oracle'); $data[6] .= __('Discovery.App.Oracle');
break; break;
case DISCOVERY_APP_DB2:
// Discovery Applications DB2.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery Applications DB2')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.App.DB2');
break;
case DISCOVERY_DEPLOY_AGENTS: case DISCOVERY_DEPLOY_AGENTS:
// Internal deployment task. // Internal deployment task.
$no_operations = true; $no_operations = true;
@ -722,6 +732,8 @@ class DiscoveryTaskList extends HTML
if ($task['disabled'] != 2 && $task['utimestamp'] > 0 if ($task['disabled'] != 2 && $task['utimestamp'] > 0
&& $task['type'] != DISCOVERY_APP_MYSQL && $task['type'] != DISCOVERY_APP_MYSQL
&& $task['type'] != DISCOVERY_APP_ORACLE && $task['type'] != DISCOVERY_APP_ORACLE
&& $task['type'] != DISCOVERY_APP_DB2
&& $task['type'] != DISCOVERY_APP_SAP
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS && $task['type'] != DISCOVERY_CLOUD_AWS_RDS
) { ) {
if (check_acl($config['id_user'], 0, 'MR')) { if (check_acl($config['id_user'], 0, 'MR')) {
@ -879,6 +891,9 @@ class DiscoveryTaskList extends HTML
case DISCOVERY_APP_ORACLE: case DISCOVERY_APP_ORACLE:
return 'wiz=app&mode=oracle&page=0'; return 'wiz=app&mode=oracle&page=0';
case DISCOVERY_APP_DB2:
return 'wiz=app&mode=DB2&page=0';
case DISCOVERY_CLOUD_AWS: case DISCOVERY_CLOUD_AWS:
case DISCOVERY_CLOUD_AWS_EC2: case DISCOVERY_CLOUD_AWS_EC2:
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1'; return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1';

View File

@ -692,9 +692,7 @@ class HostDevices extends Wizard
if ($this->page == 1) { if ($this->page == 1) {
$title = __( $title = __(
'"%s" features', '"%s" features',
io_safe_output( $this->task['name']
$this->task['name']
)
); );
} }

View File

@ -832,7 +832,7 @@ class Wizard
$first_block_printed = true; $first_block_printed = true;
} }
$output .= '<div class="edit_discovery_info '.$row['class'].'" style="'.$row['style'].'">'; $row_output = '<div class="edit_discovery_info '.$row['class'].'" style="'.$row['style'].'">';
foreach ($row['columns'] as $column) { foreach ($row['columns'] as $column) {
$width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;'; $width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
@ -841,23 +841,36 @@ class Wizard
$extra_styles = isset($column['style']) ? $column['style'] : ''; $extra_styles = isset($column['style']) ? $column['style'] : '';
$class = isset($column['class']) ? $column['class'] : ''; $class = isset($column['class']) ? $column['class'] : '';
$output .= '<div class="'.$class.'" '; $row_output .= '<div class="'.$class.'" ';
$output .= ' style="'.$width.$padding_left.$padding_right; $row_output .= ' style="'.$width.$padding_left.$padding_right;
$output .= $extra_styles.'">'; $row_output .= $extra_styles.'">';
foreach ($column['inputs'] as $input) { foreach ($column['inputs'] as $input) {
if (is_array($input)) { if (is_array($input)) {
if ($input['arguments']['type'] != 'submit') { if ($input['arguments']['type'] != 'submit') {
$output .= $this->printBlockAsGrid($input, true); $row_output .= $this->printBlockAsGrid($input, true);
} else { } else {
$output_submit .= $this->printBlockAsGrid($input, true); $output_submit .= $this->printBlockAsGrid($input, true);
} }
} else { } else {
$output .= $input; $row_output .= $input;
} }
} }
$output .= '</div>'; $row_output .= '</div>';
}
if (isset($row['toggle'])) {
$output .= ui_print_toggle(
[
'content' => $row_output,
'name' => $row['toggle_label'],
'hidden_default' => ! (bool) $row['toggle'],
'return' => true,
]
);
} else {
$output .= $row_output;
} }
$output .= '</div>'; $output .= '</div>';

View File

@ -1088,10 +1088,18 @@ if ($dialogue_event_response) {
} }
if ($add_comment) { if ($add_comment) {
$aviability_comment = true;
$comment = get_parameter('comment'); $comment = get_parameter('comment');
if (preg_match('/script/i', io_safe_output($comment))) {
$aviability_comment = false;
$return = false;
}
$event_id = get_parameter('event_id'); $event_id = get_parameter('event_id');
$return = events_comment($event_id, $comment, 'Added comment', $meta, $history); if ($aviability_comment !== false) {
$return = events_comment($event_id, $comment, 'Added comment', $meta, $history);
}
if ($return) { if ($return) {
echo 'comment_ok'; echo 'comment_ok';

View File

@ -372,7 +372,13 @@ if (check_login()) {
$data[] = date('d F Y h:i:s A', $row['utimestamp']); $data[] = date('d F Y h:i:s A', $row['utimestamp']);
} else if (is_snapshot_data($row[$attr[0]])) { } else if (is_snapshot_data($row[$attr[0]])) {
if ($config['command_snapshot']) { if ($config['command_snapshot']) {
$data[] = "<a target='_blank' href='".io_safe_input($row[$attr[0]])."'><img style='width:300px' src='".io_safe_input($row[$attr[0]])."'></a>"; $imagetab = '<img style="width:100%" src="';
$imagetab .= io_safe_input($row[$attr[0]]);
$imagetab .= '">';
$image = '<img style="width:300px" src="';
$image .= io_safe_input($row[$attr[0]]);
$image .= '">';
$data[] = '<a style="cursor:pointer;" onclick="newTabjs(\''.base64_encode($imagetab).'\')">'.$image.'</a>';
} else { } else {
$data[] = '<span>'.wordwrap(io_safe_input($row[$attr[0]]), 60, "<br>\n", true).'</span>'; $data[] = '<span>'.wordwrap(io_safe_input($row[$attr[0]]), 60, "<br>\n", true).'</span>';
} }
@ -1099,6 +1105,7 @@ if (check_login()) {
$rowIndex++; $rowIndex++;
} }
ui_require_javascript_file('pandora.js');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */

View File

@ -261,6 +261,13 @@ if ($correctLogin) {
} }
break; break;
case 'event':
// Preventive check for users if not available write events
if (! check_acl($config['id_user'], $event['id_grupo'], 'EW')) {
return false;
}
break;
default: default:
// Ignore. // Ignore.
break; break;

View File

@ -85,7 +85,7 @@ function process_user_login($login, $pass, $api=false)
return process_user_login_local($login, $pass, $api); return process_user_login_local($login, $pass, $api);
} else { } else {
$login_remote = process_user_login_remote($login, io_safe_output($pass), $api); $login_remote = process_user_login_remote($login, io_safe_output($pass), $api);
if ($login_remote == false) { if ($login_remote == false && $config['fallback_local_auth']) {
return process_user_login_local($login, $pass, $api); return process_user_login_local($login, $pass, $api);
} else { } else {
return $login_remote; return $login_remote;
@ -258,27 +258,32 @@ function process_user_login_remote($login, $pass, $api=false)
return false; return false;
} }
if (($config['auth'] === 'ad') if (($config['auth'] === 'ad')) {
&& (isset($config['ad_advanced_config']) && $config['ad_advanced_config']) // Check if autocreate remote users is active.
) { if ($config['autocreate_remote_users'] == 1) {
$return = enterprise_hook( change_local_user_pass_ldap($login, $pass);
'prepare_permissions_groups_of_user_ad', }
[
$login,
$pass,
false,
true,
defined('METACONSOLE'),
]
);
if ($return === 'error_permissions') { if (isset($config['ad_advanced_config']) && $config['ad_advanced_config']) {
$config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator'); $return = enterprise_hook(
return false; 'prepare_permissions_groups_of_user_ad',
} else { [
if ($return === 'permissions_changed') { $login,
$config['auth_error'] = __('Your permissions have changed. Please, login again.'); $pass,
false,
true,
defined('METACONSOLE'),
]
);
if ($return === 'error_permissions') {
$config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator');
return false; return false;
} else {
if ($return === 'permissions_changed') {
$config['auth_error'] = __('Your permissions have changed. Please, login again.');
return false;
}
} }
} }
} else if ($config['auth'] === 'ldap') { } else if ($config['auth'] === 'ldap') {

View File

@ -277,7 +277,8 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
$params['ttl'], $params['ttl'],
$params['sizeForTicks'], $params['sizeForTicks'],
$params['show'], $params['show'],
$params['date_to'] $params['date_to'],
$params['server_id']
); );
break; break;

View File

@ -105,7 +105,7 @@ class CustomNetScan extends Wizard
// from 'validation' page. // from 'validation' page.
if (isset($this->page) === true && $this->page === 1) { if (isset($this->page) === true && $this->page === 1) {
$task_id = get_parameter('task', null); $task_id = get_parameter('task', null);
$taskname = get_parameter('taskname', ''); $taskname = io_safe_input(strip_tags(io_safe_output(get_parameter('taskname'))));
$comment = get_parameter('comment', ''); $comment = get_parameter('comment', '');
$server_id = get_parameter('id_recon_server', ''); $server_id = get_parameter('id_recon_server', '');
$id_group = get_parameter('id_group', ''); $id_group = get_parameter('id_group', '');

View File

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

View File

@ -149,8 +149,8 @@ define('COL_IGNORED', '#DDD');
define('COL_ALERTFIRED', '#F36201'); define('COL_ALERTFIRED', '#F36201');
define('COL_MINOR', '#F099A2'); define('COL_MINOR', '#F099A2');
define('COL_MAJOR', '#C97A4A'); define('COL_MAJOR', '#C97A4A');
define('COL_INFORMATIONAL', '#E4E4E4'); define('COL_INFORMATIONAL', '#4a83f3');
define('COL_MAINTENANCE', '#4a83f3'); define('COL_MAINTENANCE', '#E4E4E4');
define('COL_GRAPH1', '#C397F2'); define('COL_GRAPH1', '#C397F2');
define('COL_GRAPH2', '#FFE66C'); define('COL_GRAPH2', '#FFE66C');
@ -601,6 +601,7 @@ define('DISCOVERY_CLOUD_AWS_RDS', 7);
define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8); define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8);
define('DISCOVERY_DEPLOY_AGENTS', 9); define('DISCOVERY_DEPLOY_AGENTS', 9);
define('DISCOVERY_APP_SAP', 10); define('DISCOVERY_APP_SAP', 10);
define('DISCOVERY_APP_DB2', 11);
// Force task build tmp results. // Force task build tmp results.

View File

@ -477,7 +477,8 @@ function set_user_language()
/** /**
* INTERNAL (use ui_print_timestamp for output): Transform an amount of time in seconds into a human readable * INTERNAL (use ui_print_timestamp for output):
* Transform an amount of time in seconds into a human readable
* strings of minutes, hours or days. * strings of minutes, hours or days.
* *
* @param integer $seconds Seconds elapsed time * @param integer $seconds Seconds elapsed time
@ -488,17 +489,11 @@ function set_user_language()
*/ */
function human_time_description_raw($seconds, $exactly=false, $units='large') function human_time_description_raw($seconds, $exactly=false, $units='large')
{ {
switch ($units) { if (isset($units) === false || empty($units) === true) {
case 'large': $units = 'large';
$secondsString = __('seconds'); }
$daysString = __('days');
$monthsString = __('months');
$yearsString = __('years');
$minutesString = __('minutes');
$hoursString = __('hours');
$nowString = __('Now');
break;
switch ($units) {
case 'tiny': case 'tiny':
$secondsString = __('s'); $secondsString = __('s');
$daysString = __('d'); $daysString = __('d');
@ -508,6 +503,17 @@ function human_time_description_raw($seconds, $exactly=false, $units='large')
$hoursString = __('h'); $hoursString = __('h');
$nowString = __('N'); $nowString = __('N');
break; break;
default:
case 'large':
$secondsString = __('seconds');
$daysString = __('days');
$monthsString = __('months');
$yearsString = __('years');
$minutesString = __('minutes');
$hoursString = __('hours');
$nowString = __('Now');
break;
} }
if (empty($seconds)) { if (empty($seconds)) {
@ -2136,7 +2142,7 @@ function check_sql($sql)
{ {
// We remove "*" to avoid things like SELECT * FROM tusuario // We remove "*" to avoid things like SELECT * FROM tusuario
// Check that it not delete_ as "delete_pending" (this is a common field in pandora tables). // Check that it not delete_ as "delete_pending" (this is a common field in pandora tables).
if (preg_match('/\*|delete[^_]|drop|alter|modify|password|pass|insert|update/i', $sql)) { if (preg_match('/([ ]*(delete|drop|alter|modify|password|pass|insert|update)\b[ \\]+)/i', $sql)) {
return ''; return '';
} }
@ -3718,6 +3724,14 @@ function series_type_graph_array($data, $show_elements_graph)
} }
} }
if ((int) $value['min'] === PHP_INT_MAX) {
$value['min'] = 0;
}
if ((int) $value['max'] === (-PHP_INT_MAX)) {
$value['max'] = 0;
}
$data_return['legend'][$key] .= __('Min:').remove_right_zeros( $data_return['legend'][$key] .= __('Min:').remove_right_zeros(
number_format( number_format(
$value['min'], $value['min'],

View File

@ -1506,6 +1506,12 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
return; return;
} }
if ((int) $other['data'][3] == 0) {
$agent_creation_error = __('The agent could not be created, for security reasons use a group another than 0');
returnError('generic error', $agent_creation_error);
return;
}
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $other['data'][0]))); $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $other['data'][0])));
$direccion_agente = io_safe_input($other['data'][1]); $direccion_agente = io_safe_input($other['data'][1]);
$nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000))); $nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
@ -2048,31 +2054,31 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
// Filter by status // Filter by status
switch ($other['data'][2]) { switch ($other['data'][2]) {
case 'warning': case 'warning':
if ($status == 2) { if ($status == AGENT_MODULE_STATUS_WARNING || $status == AGENT_MODULE_STATUS_WARNING_ALERT) {
$result_agents[] = $agent; $result_agents[] = $agent;
} }
break; break;
case 'critical': case 'critical':
if ($status == 1) { if ($status == AGENT_MODULE_STATUS_CRITICAL_BAD || $status == AGENT_MODULE_STATUS_CRITICAL_ALERT) {
$result_agents[] = $agent; $result_agents[] = $agent;
} }
break; break;
case 'unknown': case 'unknown':
if ($status == 3) { if ($status == AGENT_MODULE_STATUS_UNKNOWN) {
$result_agents[] = $agent; $result_agents[] = $agent;
} }
break; break;
case 'normal': case 'normal':
if ($status == 0) { if ($status == AGENT_MODULE_STATUS_NORMAL || $status == AGENT_MODULE_STATUS_NORMAL_ALERT) {
$result_agents[] = $agent; $result_agents[] = $agent;
} }
break; break;
case 'alert_fired': case 'alert_fired':
if ($status == 4) { if ($status == AGENT_STATUS_ALERT_FIRED || $status == AGENT_MODULE_STATUS_WARNING_ALERT || $status == AGENT_MODULE_STATUS_CRITICAL_ALERT || $status == AGENT_MODULE_STATUS_NORMAL_ALERT) {
$result_agents[] = $agent; $result_agents[] = $agent;
} }
break; break;
@ -8790,6 +8796,11 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f
} }
} }
// Esto es extraño, hablar con Tati
/*
$filter['1'] = $filter['sql'];
unset($filter['sql']); */
if (isset($other['data'][4]) && $other['data'][4] != '') { if (isset($other['data'][4]) && $other['data'][4] != '') {
$idTemplate = db_get_value_filter('id', 'talert_templates', ['name' => $other['data'][4]]); $idTemplate = db_get_value_filter('id', 'talert_templates', ['name' => $other['data'][4]]);
if ($idTemplate !== false) { if ($idTemplate !== false) {
@ -10721,6 +10732,83 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
} }
/**
* Update an event
*
* @param string $id_event Id of the event for change.
* @param string $unused1 Without use.
* @param array $params Dictionary with field,value format with the data for update.
* @param string $unused2 Without use.
* @param string $unused3 Without use.
*
* @return void
*/
function api_set_event($id_event, $unused1, $params, $unused2, $unused3)
{
// Get the event
$event = events_get_event($id_event, false, is_metaconsole());
// If event not exists, end the execution.
if ($event === false) {
returnError(
'event_not_exists',
'Event not exists'
);
return false;
}
$paramsSerialize = [];
// Serialize the data for update
if ($params['type'] === 'array') {
// Keys that is not available to change
$invalidKeys = [
'id_evento',
'id_agente',
'id_grupo',
'timestamp',
'utimestamp',
'id_agentmodule',
'ack_utimestamp',
'data',
];
foreach ($params['data'] as $key_value) {
list($key, $value) = explode(',', $key_value, 2);
if (in_array($key, $invalidKeys) == false) {
$paramsSerialize[$key] = $value;
}
}
}
// In meta or node.
if (is_metaconsole() === true) {
$table = 'tmetaconsole_event';
} else {
$table = 'tevento';
}
// TODO. Stablish security for prevent sql injection?
// Update the row
$result = db_process_sql_update(
$table,
$paramsSerialize,
[ 'id_evento' => $id_event ]
);
// If update results failed
if (empty($result) === true || $result === false) {
returnError(
'failed_event_update',
__('Failed event update')
);
return false;
} else {
returnData('string', ['data' => 'Event updated']);
}
return;
}
/** /**
* *
* @param $trash1 * @param $trash1

View File

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

View File

@ -287,7 +287,7 @@ function config_update_config()
$error_update[] = __('Command Snapshot'); $error_update[] = __('Command Snapshot');
} }
if (!config_update_value('server_log_dir', get_parameter('server_log_dir'))) { if (!config_update_value('server_log_dir', io_safe_input(strip_tags(io_safe_output(get_parameter('server_log_dir')))))) {
$error_update[] = __('Server logs directory'); $error_update[] = __('Server logs directory');
} }
@ -354,18 +354,6 @@ function config_update_config()
if (!config_update_value('email_password', io_input_password(get_parameter('email_password')))) { if (!config_update_value('email_password', io_input_password(get_parameter('email_password')))) {
$error_update[] = __('Email password'); $error_update[] = __('Email password');
} }
if (!config_update_value('ws_bind_address', get_parameter('ws_bind_address'))) {
$error_update[] = __('WebSocket bind address');
}
if (!config_update_value('ws_port', get_parameter('ws_port'))) {
$error_update[] = __('WebSocket port');
}
if (!config_update_value('ws_proxy_url', get_parameter('ws_proxy_url'))) {
$error_update[] = __('WebSocket proxy url');
}
break; break;
case 'enterprise': case 'enterprise':
@ -1212,8 +1200,8 @@ function config_update_config()
// -------------------------------------------------- // --------------------------------------------------
// CUSTOM VALUES POST PROCESS // CUSTOM VALUES POST PROCESS
// -------------------------------------------------- // --------------------------------------------------
$custom_value = get_parameter('custom_value'); $custom_value = io_safe_input(strip_tags(io_safe_output(get_parameter('custom_value'))));
$custom_text = get_parameter('custom_text'); $custom_text = io_safe_input(strip_tags(io_safe_output(get_parameter('custom_text'))));
$custom_value_add = (bool) get_parameter('custom_value_add', 0); $custom_value_add = (bool) get_parameter('custom_value_add', 0);
$custom_value_to_delete = get_parameter('custom_value_to_delete', 0); $custom_value_to_delete = get_parameter('custom_value_to_delete', 0);
@ -1284,8 +1272,8 @@ function config_update_config()
// -------------------------------------------------- // --------------------------------------------------
// MODULE CUSTOM UNITS // MODULE CUSTOM UNITS
// -------------------------------------------------- // --------------------------------------------------
$custom_unit = get_parameter('custom_module_unit'); $custom_unit = io_safe_input(strip_tags(io_safe_output(get_parameter('custom_module_unit'))));
$custom_unit_to_delete = get_parameter('custom_module_unit_to_delete', ''); $custom_unit_to_delete = io_safe_input(strip_tags(io_safe_output(get_parameter('custom_module_unit_to_delete', ''))));
if (!empty($custom_unit)) { if (!empty($custom_unit)) {
if (!add_custom_module_unit( if (!add_custom_module_unit(
@ -1599,6 +1587,20 @@ function config_update_config()
} }
break; break;
case 'websocket_engine':
if (!config_update_value('ws_bind_address', get_parameter('ws_bind_address'))) {
$error_update[] = __('WebSocket bind address');
}
if (!config_update_value('ws_port', get_parameter('ws_port'))) {
$error_update[] = __('WebSocket port');
}
if (!config_update_value('ws_proxy_url', get_parameter('ws_proxy_url'))) {
$error_update[] = __('WebSocket proxy url');
}
break;
default: default:
// Ignore. // Ignore.
break; break;

View File

@ -633,6 +633,14 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
break; break;
case EVENT_STATUS_VALIDATED: case EVENT_STATUS_VALIDATED:
events_change_owner(
$id_evento,
$config['id_user'],
false,
is_metaconsole() ? true : false,
$history
);
$status_string = 'Validated'; $status_string = 'Validated';
break; break;
@ -1870,6 +1878,16 @@ function events_change_status(
return false; return false;
} }
if ($new_status == EVENT_STATUS_VALIDATED) {
events_change_owner(
$id_event,
$config['id_user'],
false,
$meta,
$history
);
}
events_comment( events_comment(
$id_event, $id_event,
'', '',

View File

@ -369,11 +369,21 @@ if ($delete_file) {
$config['filemanager']['message'] = ui_print_success_message(__('Deleted'), '', true); $config['filemanager']['message'] = ui_print_success_message(__('Deleted'), '', true);
if (is_dir($filename)) { if (is_dir($filename)) {
rmdir($filename); if (rmdir($filename)) {
$config['filemanager']['delete'] = 1; $config['filemanager']['delete'] = 1;
} else {
$config['filemanager']['delete'] = 0;
}
} else { } else {
unlink($filename); if (unlink($filename)) {
$config['filemanager']['delete'] = 1; $config['filemanager']['delete'] = 1;
} else {
$config['filemanager']['delete'] = 0;
}
}
if ($config['filemanager']['delete'] == 0) {
$config['filemanager']['message'] = ui_print_error_message(__('Deleted'), '', true);
} }
} }
} }
@ -743,7 +753,7 @@ function filemanager_file_explorer(
if (($editor) && (!$readOnly)) { if (($editor) && (!$readOnly)) {
if (($typefile != 'bin') && ($typefile != 'pdf') && ($typefile != 'png') && ($typefile != 'jpg') if (($typefile != 'bin') && ($typefile != 'pdf') && ($typefile != 'png') && ($typefile != 'jpg')
&& ($typefile != 'iso') && ($typefile != 'docx') && ($typefile != 'doc') && ($typefile != 'iso') && ($typefile != 'docx') && ($typefile != 'doc') && ($fileinfo['mime'] != MIME_DIR)
) { ) {
$hash = md5($fileinfo['realpath'].$config['dbpass']); $hash = md5($fileinfo['realpath'].$config['dbpass']);
$data[4] .= "<a style='vertical-align: top;' href='$url&edit_file=1&hash=".$hash.'&location_file='.$fileinfo['realpath']."' style='float: left;'>".html_print_image('images/edit.png', true, ['style' => 'margin-top: 2px;', 'title' => __('Edit file')]).'</a>'; $data[4] .= "<a style='vertical-align: top;' href='$url&edit_file=1&hash=".$hash.'&location_file='.$fileinfo['realpath']."' style='float: left;'>".html_print_image('images/edit.png', true, ['style' => 'margin-top: 2px;', 'title' => __('Edit file')]).'</a>';

View File

@ -2441,10 +2441,14 @@ function graphic_agentaccess(
} else { } else {
$options['generals']['pdf']['width'] = 350; $options['generals']['pdf']['width'] = 350;
$options['generals']['pdf']['height'] = 125; $options['generals']['pdf']['height'] = 125;
if (!empty($data_array)) {
$imgbase64 = '<img src="data:image/jpg;base64,';
$imgbase64 .= vbar_graph($data_array, $options, 2);
$imgbase64 .= '" />';
} else {
$imgbase64 .= vbar_graph($data_array, $options, 2);
}
$imgbase64 = '<img src="data:image/jpg;base64,';
$imgbase64 .= vbar_graph($data_array, $options, 2);
$imgbase64 .= '" />';
return $imgbase64; return $imgbase64;
} }
} }

View File

@ -1448,8 +1448,8 @@ function html_print_extended_select_for_time(
} }
ob_start(); ob_start();
// Use the no_meta parameter because this image is only in the base console // 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;">'; echo '<div id="'.$uniq_name.'_default" style="width:100%;display:inline">';
html_print_select( html_print_select(
$fields, $fields,
$uniq_name.'_select', $uniq_name.'_select',
@ -1464,7 +1464,7 @@ function html_print_extended_select_for_time(
$readonly, $readonly,
'font-size: xx-small;'.$select_style 'font-size: xx-small;'.$select_style
); );
// The advanced control is only for admins // The advanced control is only for admins.
if ($admin) { if ($admin) {
echo ' <a href="javascript:">'.html_print_image( echo ' <a href="javascript:">'.html_print_image(
'images/pencil.png', 'images/pencil.png',
@ -1483,7 +1483,7 @@ function html_print_extended_select_for_time(
echo '</div>'; 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_text($uniq_name.'_text', $selected, '', $size, 255, false, $readonly, false, '', $class);
html_print_input_hidden($name, $selected, false, $uniq_name); html_print_input_hidden($name, $selected, false, $uniq_name);
@ -1514,15 +1514,15 @@ function html_print_extended_select_for_time(
echo '</div>'; echo '</div>';
echo "<script type='text/javascript'> echo "<script type='text/javascript'>
$(document).ready (function () { $(document).ready (function () {
period_select_init('$uniq_name', $allow_zero); period_select_init('".$uniq_name."', ".(($allow_zero) ? 'true' : 'null').");
period_select_events('$uniq_name'); period_select_events('".$uniq_name."');
}); });
function period_select_".$name."_update(seconds) { function period_select_".$name."_update(seconds) {
$('#text-".$uniq_name."_text').val(seconds); $('#text-".$uniq_name."_text').val(seconds);
adjustTextUnits('".$uniq_name."'); adjustTextUnits('".$uniq_name."');
calculateSeconds('".$uniq_name."'); calculateSeconds('".$uniq_name."');
$('#".$uniq_name."_manual').css('display', 'flex'); $('#".$uniq_name."_manual').show();
$('#".$uniq_name."_default').css('display', 'none'); $('#".$uniq_name."_default').hide();
} }
</script>"; </script>";
$returnString = ob_get_clean(); $returnString = ob_get_clean();
@ -2123,13 +2123,6 @@ function html_print_input_number(array $settings):string
$settings['maxlength'] = 255; $settings['maxlength'] = 255;
} }
// Check Size.
if (isset($settings['size']) === false
|| $settings['size'] === 0
) {
$settings['size'] = 255;
}
foreach ($settings as $attribute => $attr_value) { foreach ($settings as $attribute => $attr_value) {
// Check valid attribute. // Check valid attribute.
if (in_array($attribute, $valid_attrs) === false) { if (in_array($attribute, $valid_attrs) === false) {

View File

@ -311,7 +311,7 @@ function messages_get_message_sent(int $message_id)
$sql = sprintf( $sql = sprintf(
"SELECT id_usuario_origen, subject, mensaje, timestamp "SELECT id_usuario_origen, subject, mensaje, timestamp
FROM tmensajes 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'], $config['id_user'],
$message_id $message_id
); );
@ -431,7 +431,7 @@ function messages_get_count_sent(string $user='')
$sql = sprintf( $sql = sprintf(
"SELECT COUNT(*) "SELECT COUNT(*)
FROM tmensajes WHERE id_usuario_origen='%s'", FROM tmensajes WHERE id_usuario_origen='%s' AND hidden_sent = 0",
$user $user
); );
@ -579,6 +579,17 @@ function messages_get_overview_sent(
$order .= ' DESC'; $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( return db_get_all_rows_field_filter(
'tmensajes', 'tmensajes',
'id_usuario_origen', 'id_usuario_origen',
@ -661,3 +672,27 @@ function messages_get_url($message_id)
// Return the message direction. // 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); 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

@ -160,7 +160,7 @@ function reporting_make_reporting_data(
$return = []; $return = [];
if (!empty($report)) { if (!empty($report)) {
$contents = $report['contents']; $contents = io_safe_output($report['contents']);
} else { } else {
$report = io_safe_output(db_get_row('treport', 'id_report', $id_report)); $report = io_safe_output(db_get_row('treport', 'id_report', $id_report));
$contents = io_safe_output( $contents = io_safe_output(
@ -2236,7 +2236,7 @@ function reporting_inventory($report, $content, $type)
$es = json_decode($content['external_source'], true); $es = json_decode($content['external_source'], true);
$id_agent = $es['id_agents']; $id_agent = $es['id_agents'];
$module_name = $es['inventory_modules']; $module_name = io_safe_input($es['inventory_modules']);
if (empty($module_name)) { if (empty($module_name)) {
$module_name = [0 => 0]; $module_name = [0 => 0];
} }
@ -6147,7 +6147,13 @@ function reporting_advanced_sla(
$time_total += $time_interval; $time_total += $time_interval;
if ($time_interval > 0) { if ($time_interval > 0) {
$total_checks++; if (isset($current_data['type']) === false
|| ((int) $current_data['type'] === 0
&& $i !== 0)
) {
$total_checks++;
}
if ((isset($current_data['datos'])) if ((isset($current_data['datos']))
&& ($current_data['datos'] !== false) && ($current_data['datos'] !== false)
) { ) {
@ -6159,7 +6165,7 @@ function reporting_advanced_sla(
$match = preg_match('/'.$max_value.'/', $current_data['datos']); $match = preg_match('/'.$max_value.'/', $current_data['datos']);
} }
// Take notice of $inverse_interval value, // Take notice of $inverse_interval value.
if ($inverse_interval == 0) { if ($inverse_interval == 0) {
$sla_check_value = $match; $sla_check_value = $match;
} else { } else {
@ -6176,19 +6182,41 @@ function reporting_advanced_sla(
// Not unknown nor not init values. // Not unknown nor not init values.
if ($sla_check_value) { if ($sla_check_value) {
$ok_checks++; if (isset($current_data['type']) === false
|| ((int) $current_data['type'] === 0
&& $i !== 0)
) {
$ok_checks++;
}
$time_in_ok += $time_interval; $time_in_ok += $time_interval;
} else { } else {
$bad_checks++; if (isset($current_data['type']) === false
|| ((int) $current_data['type'] === 0
&& $i !== 0)
) {
$bad_checks++;
}
$time_in_error += $time_interval; $time_in_error += $time_interval;
} }
} else { } else {
if ($current_data['datos'] === null) { if ($current_data['datos'] === null) {
$time_in_unknown += $time_interval; $time_in_unknown += $time_interval;
$unknown_checks++; if (isset($current_data['type']) === false
|| ((int) $current_data['type'] === 0
&& $i !== 0)
) {
$unknown_checks++;
}
} else if ($current_data['datos'] === false) { } else if ($current_data['datos'] === false) {
$time_in_not_init += $time_interval; $time_in_not_init += $time_interval;
$not_init_checks++; if (isset($current_data['type']) === false
|| ((int) $current_data['type'] === 0
&& $i !== 0)
) {
$not_init_checks++;
}
} }
} }
} }

View File

@ -2142,10 +2142,24 @@ function reporting_html_historical_data($table, $item, $pdf=0)
$table1->data = []; $table1->data = [];
foreach ($item['data'] as $data) { foreach ($item['data'] as $data) {
if (!is_numeric($data[__('Data')])) { if (!is_numeric($data[__('Data')])) {
$row = [ if (is_snapshot_data($data[__('Data')])) {
$data[__('Date')], if ($config['command_snapshot']) {
$data[__('Data')], $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 { } else {
$row = [ $row = [
$data[__('Date')], $data[__('Date')],
@ -2191,6 +2205,8 @@ function reporting_html_historical_data($table, $item, $pdf=0)
*/ */
function reporting_html_database_serialized($table, $item, $pdf=0) function reporting_html_database_serialized($table, $item, $pdf=0)
{ {
global $config;
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '100%'; $table1->width = '100%';
$table1->head = [ $table1->head = [
@ -2205,9 +2221,19 @@ function reporting_html_database_serialized($table, $item, $pdf=0)
$table1->data = []; $table1->data = [];
foreach ($item['data'] as $data) { foreach ($item['data'] as $data) {
foreach ($data['data'] as $data_unserialied) { foreach ($data['data'] as $data_unserialized) {
$row = [$data['date']]; $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; $table1->data[] = $row;
} }
} }

View File

@ -159,7 +159,7 @@ function snmp_browser_get_html_tree(
$status = (!empty($checked) && isset($checked[$level])); $status = (!empty($checked) && isset($checked[$level]));
$output .= html_print_checkbox($checkbox_name, 0, $status, true, false, '').'&nbsp;<span>'.$level.'</span>'; $output .= html_print_checkbox($checkbox_name, 0, $status, true, false, '').'&nbsp;<span>'.$level.'</span>';
if (isset($sub_level['__VALUE__'])) { if (isset($sub_level['__VALUE__'])) {
$output .= '<span class="value" style="display: none;">&nbsp;=&nbsp;'.$sub_level['__VALUE__'].'</span>'; $output .= '<span class="value" style="display: none;">&nbsp;=&nbsp;'.io_safe_input($sub_level['__VALUE__']).'</span>';
} }
$output .= '</li>'; $output .= '</li>';
@ -238,8 +238,17 @@ function snmp_browser_print_tree(
/** /**
* Build the SNMP tree for the given SNMP agent. * Build the SNMP tree for the given SNMP agent.
* *
* @param target_ip string IP of the SNMP agent. * @param string $target_ip Target_ip.
* @param community string SNMP community to use. * @param string $community Community.
* @param string $starting_oid Starting_oid.
* @param string $version Version.
* @param string $snmp3_auth_user Snmp3_auth_user.
* @param string $snmp3_security_level Snmp3_security_level.
* @param string $snmp3_auth_method Snmp3_auth_method.
* @param string $snmp3_auth_pass Snmp3_auth_pass.
* @param string $snmp3_privacy_method Snmp3_privacy_method.
* @param string $snmp3_privacy_pass Snmp3_privacy_pass.
* @param string|null $snmp3_context_engine_id Snmp3_context_engine_id.
* *
* @return array The SNMP tree. * @return array The SNMP tree.
*/ */
@ -253,7 +262,8 @@ function snmp_browser_get_tree(
$snmp3_auth_method='', $snmp3_auth_method='',
$snmp3_auth_pass='', $snmp3_auth_pass='',
$snmp3_privacy_method='', $snmp3_privacy_method='',
$snmp3_privacy_pass='' $snmp3_privacy_pass='',
$snmp3_context_engine_id=null
) { ) {
global $config; global $config;
@ -277,6 +287,7 @@ function snmp_browser_get_tree(
default: default:
$snmp_version = SNMP::VERSION_2c; $snmp_version = SNMP::VERSION_2c;
break;
} }
$snmp_session = new SNMP($snmp_version, $target_ip, $community); $snmp_session = new SNMP($snmp_version, $target_ip, $community);
@ -284,10 +295,34 @@ function snmp_browser_get_tree(
// Set security if SNMP Version is 3. // Set security if SNMP Version is 3.
if ($snmp_version == SNMP::VERSION_3) { if ($snmp_version == SNMP::VERSION_3) {
$snmp_session->setSecurity($snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_privacy_method, $snmp3_privacy_pass); $snmp_session->setSecurity(
$snmp3_security_level,
$snmp3_auth_method,
$snmp3_auth_pass,
$snmp3_privacy_method,
$snmp3_privacy_pass,
$community,
$snmp3_context_engine_id
);
} }
snmp_read_mib($config['homedir'].'/attachment/mibs'); $mibs_dir = $config['homedir'].'/attachment/mibs';
$_dir = opendir($mibs_dir);
// Future. Recomemended: Use a global config limit of MIBs loaded.
while (($mib_file = readdir($_dir)) !== false) {
if ($mib_file == '..' || $mib_file == '.') {
continue;
}
$rs = snmp_read_mib($mibs_dir.'/'.$mib_file);
if ($rs !== true) {
error_log('Failed while reading MIB file: '.$mib_file);
}
}
closedir($_dir);
$output = $snmp_session->walk($starting_oid); $output = $snmp_session->walk($starting_oid);
if ($output == false) { if ($output == false) {
$output = $snmp_session->getError(); $output = $snmp_session->getError();

View File

@ -3596,11 +3596,7 @@ function visual_map_print_visual_map(
$proportion_width = ($mapWidth / $layout['width']); $proportion_width = ($mapWidth / $layout['width']);
if ($layout['background'] != 'None.png') { if ($layout['background'] != 'None.png') {
if (is_metaconsole()) {
$backgroundImage = '/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size='.$mapWidth.'x'.$mapHeight.'&file='.$config['homeurl'].'images/console/background/'.$layout['background'];
} else {
$backgroundImage = '/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size='.$mapWidth.'x'.$mapHeight.'&file='.$config['homedir'].'/images/console/background/'.($layout['background']); $backgroundImage = '/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size='.$mapWidth.'x'.$mapHeight.'&file='.$config['homedir'].'/images/console/background/'.($layout['background']);
}
} }
} else { } else {
$mapWidth = $layout['width']; $mapWidth = $layout['width'];

View File

@ -1,227 +1,19 @@
(function ($) { (function ($) {
var options = { var options = {
export: { export: {
export_data: false, // or true export_data: false, // or true
labels_long: null, labels_long: null,
homeurl: '' homeurl: "",
} },
}; };
function init(plot) { function init(plot) {
plot.exportDataCSV = function (args) { plot.exportDataCSV = function (args) {
//amount = plot.getOptions().export.type, //amount = plot.getOptions().export.type,
//options = options || {}; //options = options || {};
// Options // Options
var type = 'csv'; var type = "csv";
type = type.toLowerCase().trim();
var graphData,
dataObject,
dataObjects = plot.getData(),
result = [];
// Throw errors
var retrieveDataOject = function (dataObjects, custom) {
var result;
if (typeof dataObjects === 'undefined')
throw new Error('Empty parameter');
// Try to retrieve the avg set (not 100% reliable, I know)
if (dataObjects.length == 1) {
result = dataObjects.shift();
}
if (dataObjects.length > 1) {
dataObjects.forEach(function (element) {
if(custom){
if (/^Avg.:/i.test(element.label)){
result = element;
}
} else {
result = element;
}
});
// If the avg set is missing, retrieve the first set
if (typeof result === 'undefined')
result = dataObjects.shift();
}
if (typeof result === 'undefined')
throw new Error('Empty result');
return result;
}
// Throw errors
var processDataObject = function (dataObject) {
var result;
if (typeof dataObject === 'undefined')
throw new Error('Empty parameter');
if (typeof dataObject.data === 'undefined'
|| !(dataObject.data instanceof Array))
throw new Error('Object malformed');
/* {
* head: [<column>,<column>,...,<column>],
* data: [
* [<data>,<data>,...,<data>],
* [<data>,<data>,...,<data>],
* ...,
* [<data>,<data>,...,<data>],
* ]
* }
*/
if (type === 'csv') {
result = {
head: ['timestap', 'date', 'value', 'label'],
data: []
};
dataObject.data.forEach(function (item, index) {
var timestap = item[0];
var d = new Date(item[0]);
var monthNames = [
"Jan", "Feb", "Mar",
"Apr", "May", "Jun",
"Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"
];
date_format = (d.getDate() <10?'0':'') + d.getDate() + " " +
monthNames[d.getMonth()] + " " +
d.getFullYear() + " " +
(d.getHours()<10?'0':'') + d.getHours() + ":" +
(d.getMinutes()<10?'0':'') + d.getMinutes() + ":" +
(d.getSeconds()<10?'0':'') + d.getSeconds();
var date = date_format;
var value = item[1];
var clean_label = plot.getOptions().export.labels_long[dataObject.label];
clean_label = clean_label.replace( new RegExp("&#x20;", "g"), " ");
result.data.push([timestap, date, value, clean_label]);
});
}
/* [
* {
* 'date': <date>,
* 'value': <value>
* }
* ],
* [
* {
* 'date': <date>,
* 'value': <value>
* }
* ],
* ...,
* [
* {
* 'date': <date>,
* 'value': <value>
* }
* ]
*/
else if (type === 'json') {
result = [];
dataObject.data.forEach(function (item, index) {
var date = '', value = item[1];
// Long labels are preferred
if (typeof labels_long[index] !== 'undefined')
date = labels_long[index];
else if (typeof labels[index] !== 'undefined')
date = labels[index];
result.push({
'date': date,
'value': value,
'label': dataObject.label
});
});
}
if (typeof result === 'undefined')
throw new Error('Empty result');
return result;
}
try {
var elements = [];
var custom_graph = $('#hidden-custom_graph').val();
if (custom_graph) {
dataObject = retrieveDataOject(dataObjects,0);
dataObjects.forEach(function (element) {
elements.push(processDataObject(element));
});
graphData = elements;
}
else {
dataObject = retrieveDataOject(dataObjects,1);
elements.push(processDataObject(dataObject));
graphData = elements;
}
// Transform the object data into a string
// cause PHP has limitations in the number
// of POST params received.
var graphDataStr = JSON.stringify(graphData);
// Build form
var $form = $('<form></form>'),
$dataInput = $('<input>'),
$typeInput = $('<input>'),
$separatorInput = $('<input>'),
$excelInput = $('<input>');
$dataInput
.prop('name', 'data')
.prop('type', 'text')
.prop('value', graphDataStr);
$typeInput
.prop('name', 'type')
.prop('type', 'text')
.prop('value', type);
$separatorInput
.prop('name', 'separator')
.prop('type', 'text')
.prop('value', ';');
$excelInput
.prop('name', 'excel_encoding')
.prop('type', 'text')
.prop('value', 0);
$form
.prop('method', 'POST')
.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 :(
.appendTo('body')
.submit();
}
catch (e) {
alert('There was an error exporting the data');
}
}
plot.exportDataJSON = function (args) {
//amount = plot.getOptions().export.type,
//options = options || {};
// Options
var type = 'json';
type = type.toLowerCase().trim(); type = type.toLowerCase().trim();
var graphData, var graphData,
@ -233,8 +25,8 @@
var retrieveDataOject = function (dataObjects) { var retrieveDataOject = function (dataObjects) {
var result; var result;
if (typeof dataObjects === 'undefined') if (typeof dataObjects === "undefined")
throw new Error('Empty parameter'); throw new Error("Empty parameter");
// Try to retrieve the avg set (not 100% reliable, I know) // Try to retrieve the avg set (not 100% reliable, I know)
if (dataObjects.length == 1) { if (dataObjects.length == 1) {
@ -242,31 +34,30 @@
} }
if (dataObjects.length > 1) { if (dataObjects.length > 1) {
dataObjects.forEach(function (element) { dataObjects.forEach(function (element) {
if (/^Avg.:/i.test(element.label)) if (/^Avg.:/i.test(element.label)) result = element;
result = element;
}); });
// If the avg set is missing, retrieve the first set // If the avg set is missing, retrieve the first set
if (typeof result === 'undefined') if (typeof result === "undefined") result = dataObjects.shift();
result = dataObjects.shift();
} }
if (typeof result === 'undefined') if (typeof result === "undefined") throw new Error("Empty result");
throw new Error('Empty result');
return result; return result;
} };
// Throw errors // Throw errors
var processDataObject = function (dataObject) { var processDataObject = function (dataObject) {
var result; var result;
if (typeof dataObject === 'undefined') if (typeof dataObject === "undefined")
throw new Error('Empty parameter'); throw new Error("Empty parameter");
if (typeof dataObject.data === 'undefined' if (
|| !(dataObject.data instanceof Array)) typeof dataObject.data === "undefined" ||
throw new Error('Object malformed'); !(dataObject.data instanceof Array)
)
throw new Error("Object malformed");
/* { /* {
* head: [<column>,<column>,...,<column>], * head: [<column>,<column>,...,<column>],
@ -278,74 +69,291 @@
* ] * ]
* } * }
*/ */
if (type === 'csv') { if (type === "csv") {
result = { result = {
head: ['date', 'value','label'], head: ["timestap", "date", "value", "label"],
data: [] data: [],
}; };
dataObject.data.forEach(function (item, index) { dataObject.data.forEach(function (item, index) {
var date = '', value = item[1]; var timestap = item[0];
// Long labels are preferred var d = new Date(item[0]);
if (typeof plot.getOptions().export.labels_long[index] !== 'undefined') var monthNames = [
date = plot.getOptions().export.labels_long[index]; "Jan",
else if (typeof labels[index] !== 'undefined') "Feb",
date = labels[index]; "Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
];
result.data.push([date, value,dataObject.label]); date_format =
(d.getDate() < 10 ? "0" : "") +
d.getDate() +
" " +
monthNames[d.getMonth()] +
" " +
d.getFullYear() +
" " +
(d.getHours() < 10 ? "0" : "") +
d.getHours() +
":" +
(d.getMinutes() < 10 ? "0" : "") +
d.getMinutes() +
":" +
(d.getSeconds() < 10 ? "0" : "") +
d.getSeconds();
var date = date_format;
var value = item[1];
var clean_label = plot.getOptions().export.labels_long[
dataObject.label
];
clean_label = clean_label.replace(new RegExp("&#x20;", "g"), " ");
result.data.push([timestap, date, value, clean_label]);
}); });
} } else if (type === "json") {
/* [ /* [
* { * {
* 'date': <date>, * 'date': <date>,
* 'value': <value> * 'value': <value>
* } * }
* ], * ],
* [ * [
* { * {
* 'date': <date>, * 'date': <date>,
* 'value': <value> * 'value': <value>
* } * }
* ], * ],
* ..., * ...,
* [ * [
* { * {
* 'date': <date>, * 'date': <date>,
* 'value': <value> * 'value': <value>
* } * }
* ] * ]
*/ */
else if (type === 'json') {
result = []; result = [];
dataObject.data.forEach(function (item, index) { dataObject.data.forEach(function (item, index) {
var date = '', value = item[1]; var date = "",
value = item[1];
// Long labels are preferred // Long labels are preferred
if (typeof labels_long[index] !== 'undefined') if (typeof labels_long[index] !== "undefined")
date = labels_long[index]; date = labels_long[index];
else if (typeof labels[index] !== 'undefined') else if (typeof labels[index] !== "undefined") date = labels[index];
date = labels[index];
result.push({ result.push({
'date': date, date: date,
'value': value, value: value,
'label': dataObject.label label: dataObject.label,
}); });
}); });
} }
if (typeof result === 'undefined') if (typeof result === "undefined") throw new Error("Empty result");
throw new Error('Empty result');
return result; return result;
} };
try { try {
var elements = []; var elements = [];
var custom_graph = $('input:hidden[name=custom_graph]').value; dataObject = retrieveDataOject(dataObjects);
if (dataObject) {
elements.push(processDataObject(dataObject));
}
dataObjects.forEach(function (element) {
elements.push(processDataObject(element));
});
graphData = elements;
// Transform the object data into a string
// cause PHP has limitations in the number
// of POST params received.
var graphDataStr = JSON.stringify(graphData);
// Build form
var $form = $("<form></form>"),
$dataInput = $("<input>"),
$typeInput = $("<input>"),
$separatorInput = $("<input>"),
$excelInput = $("<input>");
$dataInput
.prop("name", "data")
.prop("type", "text")
.prop("value", graphDataStr);
$typeInput
.prop("name", "type")
.prop("type", "text")
.prop("value", type);
$separatorInput
.prop("name", "separator")
.prop("type", "text")
.prop("value", ";");
$excelInput
.prop("name", "excel_encoding")
.prop("type", "text")
.prop("value", 0);
$form
.prop("method", "POST")
.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 :(
.appendTo("body")
.submit();
} catch (e) {
alert("There was an error exporting the data");
}
};
plot.exportDataJSON = function (args) {
//amount = plot.getOptions().export.type,
//options = options || {};
// Options
var type = "json";
type = type.toLowerCase().trim();
var graphData,
dataObject,
dataObjects = plot.getData(),
result = [];
// Throw errors
var retrieveDataOject = function (dataObjects) {
var result;
if (typeof dataObjects === "undefined")
throw new Error("Empty parameter");
// Try to retrieve the avg set (not 100% reliable, I know)
if (dataObjects.length == 1) {
result = dataObjects.shift();
}
if (dataObjects.length > 1) {
dataObjects.forEach(function (element) {
if (/^Avg.:/i.test(element.label)) result = element;
});
// If the avg set is missing, retrieve the first set
if (typeof result === "undefined") result = dataObjects.shift();
}
if (typeof result === "undefined") throw new Error("Empty result");
return result;
};
// Throw errors
var processDataObject = function (dataObject) {
var result;
if (typeof dataObject === "undefined")
throw new Error("Empty parameter");
if (
typeof dataObject.data === "undefined" ||
!(dataObject.data instanceof Array)
)
throw new Error("Object malformed");
/* {
* head: [<column>,<column>,...,<column>],
* data: [
* [<data>,<data>,...,<data>],
* [<data>,<data>,...,<data>],
* ...,
* [<data>,<data>,...,<data>],
* ]
* }
*/
if (type === "csv") {
result = {
head: ["date", "value", "label"],
data: [],
};
dataObject.data.forEach(function (item, index) {
var date = "",
value = item[1];
// Long labels are preferred
if (
typeof plot.getOptions().export.labels_long[index] !== "undefined"
)
date = plot.getOptions().export.labels_long[index];
else if (typeof labels[index] !== "undefined") date = labels[index];
result.data.push([date, value, dataObject.label]);
});
} else if (type === "json") {
/* [
* {
* 'date': <date>,
* 'value': <value>
* }
* ],
* [
* {
* 'date': <date>,
* 'value': <value>
* }
* ],
* ...,
* [
* {
* 'date': <date>,
* 'value': <value>
* }
* ]
*/
result = [];
dataObject.data.forEach(function (item, index) {
var date = "",
value = item[1];
// Long labels are preferred
if (typeof labels_long[index] !== "undefined")
date = labels_long[index];
else if (typeof labels[index] !== "undefined") date = labels[index];
result.push({
date: date,
value: value,
label: dataObject.label,
});
});
}
if (typeof result === "undefined") throw new Error("Empty result");
return result;
};
try {
var elements = [];
var custom_graph = $("input:hidden[name=custom_graph]").value;
if (custom_graph) { if (custom_graph) {
dataObject = retrieveDataOject(dataObjects); dataObject = retrieveDataOject(dataObjects);
@ -353,8 +361,7 @@
elements.push(processDataObject(element)); elements.push(processDataObject(element));
}); });
graphData = elements; graphData = elements;
} } else {
else {
dataObject = retrieveDataOject(dataObjects); dataObject = retrieveDataOject(dataObjects);
elements.push(processDataObject(dataObject)); elements.push(processDataObject(dataObject));
graphData = elements; graphData = elements;
@ -366,51 +373,53 @@
var graphDataStr = JSON.stringify(graphData); var graphDataStr = JSON.stringify(graphData);
// Build form // Build form
var $form = $('<form></form>'), var $form = $("<form></form>"),
$dataInput = $('<input>'), $dataInput = $("<input>"),
$typeInput = $('<input>'), $typeInput = $("<input>"),
$separatorInput = $('<input>'), $separatorInput = $("<input>"),
$excelInput = $('<input>'); $excelInput = $("<input>");
$dataInput $dataInput
.prop('name', 'data') .prop("name", "data")
.prop('type', 'text') .prop("type", "text")
.prop('value', graphDataStr); .prop("value", graphDataStr);
$typeInput $typeInput
.prop('name', 'type') .prop("name", "type")
.prop('type', 'text') .prop("type", "text")
.prop('value', type); .prop("value", type);
$separatorInput $separatorInput
.prop('name', 'separator') .prop("name", "separator")
.prop('type', 'text') .prop("type", "text")
.prop('value', ';'); .prop("value", ";");
$excelInput $excelInput
.prop('name', 'excel_encoding') .prop("name", "excel_encoding")
.prop('type', 'text') .prop("type", "text")
.prop('value', 0); .prop("value", 0);
$form $form
.prop('method', 'POST') .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) .append($dataInput, $typeInput, $separatorInput, $excelInput)
.hide() .hide()
// Firefox made me write into the DOM for this :( // Firefox made me write into the DOM for this :(
.appendTo('body') .appendTo("body")
.submit(); .submit();
} catch (e) {
alert("There was an error exporting the data");
} }
catch (e) { };
alert('There was an error exporting the data');
}
}
} }
$.plot.plugins.push({ $.plot.plugins.push({
init: init, init: init,
options: options, options: options,
name: 'exportdata', name: "exportdata",
version: '0.1' version: "0.1",
}); });
})(jQuery); })(jQuery);

View File

@ -3009,7 +3009,7 @@ function number_format(number, force_integer, unit, short_data, divisor) {
var decimals = 2; var decimals = 2;
if (unit == "KB") { if (unit == "KB") {
return number + unit; return Math.round(number * decimals) + unit;
} }
// Set maximum decimal precision to 99 in case short_data is not set. // Set maximum decimal precision to 99 in case short_data is not set.
@ -3038,6 +3038,12 @@ function number_format(number, force_integer, unit, short_data, divisor) {
if (divisor) { if (divisor) {
number = Math.round(number * decimals) / decimals; number = Math.round(number * decimals) / decimals;
} else {
number = Math.round(number * decimals);
}
if (isNaN(number)) {
number = 0;
} }
return number + " " + shorts[pos] + unit; return number + " " + shorts[pos] + unit;

View File

@ -226,14 +226,13 @@ function flot_area_graph(
$config['custom_graph_width'], $config['custom_graph_width'],
true true
); );
/* $return .= "<div id='timestamp_$graph_id'
$return .= "<div id='timestamp_$graph_id' class='timestamp_graph'
class='timestamp_graph' style='font-size:".$params['font_size']."pt;
style=' font-size:".$params['font_size']."pt; display:none; position:absolute;
display:none; position:absolute; background:#fff; border: solid 1px #aaa;
background:#fff; border: solid 1px #aaa; padding: 2px; z-index:1000;
padding: 2px; z-index:1000;'></div>"; '></div>";
*/
$return .= "<div id='$graph_id' class='"; $return .= "<div id='$graph_id' class='";
if ($params['type'] == 'area_simple') { if ($params['type'] == 'area_simple') {
@ -699,6 +698,7 @@ function flot_slicesbar_graph(
'show' => $show, 'show' => $show,
'return_img_base_64' => true, 'return_img_base_64' => true,
'date_to' => $date_to, 'date_to' => $date_to,
'server_id' => $server_id,
]; ];
$graph = '<img src="data:image/jpg;base64,'; $graph = '<img src="data:image/jpg;base64,';
@ -738,7 +738,7 @@ function flot_slicesbar_graph(
$maxticks = (int) 20; $maxticks = (int) 20;
if ($sizeForTicks === false) { if ($sizeForTicks === false) {
$maxticks = (int) 20; $maxticks = (int) 12;
} else if ($sizeForTicks < 300) { } else if ($sizeForTicks < 300) {
$maxticks = (int) 3; $maxticks = (int) 3;
} else if ($sizeForTicks < 600) { } else if ($sizeForTicks < 600) {
@ -808,7 +808,23 @@ function flot_slicesbar_graph(
// Javascript code. // Javascript code.
$return .= "<script type='text/javascript'>"; $return .= "<script type='text/javascript'>";
$return .= "//<![CDATA[\n"; $return .= "//<![CDATA[\n";
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$legend',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show', $datelimit, $server_id)"; $return .= "pandoraFlotSlicebar(
'$graph_id',
'$values',
'$datacolor',
'$legend',
$intervaltick,
'$fontpath',
$fontsize,
'$separator',
'$separator2',
$id_agent,
'$full_legend_date',
$not_interactive,
'$show',
$datelimit,
'$server_id'
)";
$return .= "\n//]]>"; $return .= "\n//]]>";
$return .= '</script>'; $return .= '</script>';

View File

@ -36,6 +36,12 @@ function winopeng_var(url, wid, width, height) {
status = wid; status = wid;
} }
function newTabjs(content) {
content = atob(content);
var printWindow = window.open("");
printWindow.document.body.innerHTML += "<div>" + content + "</div>";
}
function open_help(url) { function open_help(url) {
if (!navigator.onLine) { if (!navigator.onLine) {
alert( alert(
@ -838,7 +844,7 @@ function post_process_select_events(name) {
function period_select_init(name, allow_zero) { function period_select_init(name, allow_zero) {
// Manual mode is hidden by default // Manual mode is hidden by default
$("#" + name + "_manual").css("display", "none"); $("#" + 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 the text input is empty, we put on it 5 minutes by default
if ($("#text-" + name + "_text").val() == "") { if ($("#text-" + name + "_text").val() == "") {
@ -852,7 +858,7 @@ function period_select_init(name, allow_zero) {
} }
} else if ($("#text-" + name + "_text").val() == 0 && allow_zero != true) { } else if ($("#text-" + name + "_text").val() == 0 && allow_zero != true) {
$("#" + name + "_units option:last").prop("selected", false); $("#" + name + "_units option:last").prop("selected", false);
$("#" + name + "_manual").css("display", "flex"); $("#" + name + "_manual").css("display", "inline");
$("#" + name + "_default").css("display", "none"); $("#" + name + "_default").css("display", "none");
} }
} }
@ -941,13 +947,13 @@ function selectFirst(name) {
*/ */
function toggleBoth(name) { function toggleBoth(name) {
if ($("#" + name + "_default").css("display") == "none") { if ($("#" + name + "_default").css("display") == "none") {
$("#" + name + "_default").css("display", "flex"); $("#" + name + "_default").css("display", "inline");
} else { } else {
$("#" + name + "_default").css("display", "none"); $("#" + name + "_default").css("display", "none");
} }
if ($("#" + name + "_manual").css("display") == "none") { if ($("#" + name + "_manual").css("display") == "none") {
$("#" + name + "_manual").css("display", "flex"); $("#" + name + "_manual").css("display", "inline");
} else { } else {
$("#" + name + "_manual").css("display", "none"); $("#" + name + "_manual").css("display", "none");
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -104,6 +104,27 @@ class ServiceMapWidget extends Widget
*/ */
protected $gridWidth; protected $gridWidth;
/**
* Cell ID.
*
* @var integer
*/
protected $cellId;
/**
* Widget ID.
*
* @var integer
*/
protected $widgetId;
/**
* Dashboard ID.
*
* @var integer
*/
protected $dashboardId;
/** /**
* Construct. * Construct.
@ -145,6 +166,15 @@ class ServiceMapWidget extends Widget
// Grid Width. // Grid Width.
$this->gridWidth = $gridWidth; $this->gridWidth = $gridWidth;
// Cell Id.
$this->cellId = $cellId;
// Widget ID.
$this->widgetId = $widgetId;
// Dashboard ID.
$this->dashboardId = $dashboardId;
// Options. // Options.
$this->values = $this->decoders($this->getOptionsWidget()); $this->values = $this->decoders($this->getOptionsWidget());
@ -236,6 +266,14 @@ class ServiceMapWidget extends Widget
); );
} }
$inputs[] = [
'label' => \ui_print_info_message(
__('ZOOM functionality is only available when there is only one such widget in the dashboard'),
'',
true
),
];
$inputs[] = [ $inputs[] = [
'label' => __('Service'), 'label' => __('Service'),
'arguments' => [ 'arguments' => [
@ -249,8 +287,10 @@ class ServiceMapWidget extends Widget
], ],
]; ];
// Show legend. // TODO refactoriced services: Hidden legend.
$inputs[] = [ /*
// Show legend.
$inputs[] = [
'label' => __('Show legend'), 'label' => __('Show legend'),
'arguments' => [ 'arguments' => [
'name' => 'showLegend', 'name' => 'showLegend',
@ -258,7 +298,8 @@ class ServiceMapWidget extends Widget
'type' => 'switch', 'type' => 'switch',
'value' => $values['showLegend'], 'value' => $values['showLegend'],
], ],
]; ];
*/
return $inputs; return $inputs;
} }
@ -275,8 +316,7 @@ class ServiceMapWidget extends Widget
$values = parent::getPost(); $values = parent::getPost();
$values['serviceId'] = \get_parameter('serviceId', 0); $values['serviceId'] = \get_parameter('serviceId', 0);
$values['showLegend'] = \get_parameter_switch('showLegend'); // $values['showLegend'] = \get_parameter_switch('showLegend');
return $values; return $values;
} }
@ -314,10 +354,14 @@ class ServiceMapWidget extends Widget
return $output; return $output;
} }
$output .= "<div id='container_servicemap' style='position: relative; text-align: center;'>"; $containerId = 'container_servicemap_'.$this->values['serviceId'].'_'.$this->cellId;
$style = 'position: relative; text-align: center;';
$output .= "<div id='".$containerId."' style='".$style."'>";
if ($this->values['showLegend'] === 1) { // TODO refactoriced services: Hidden legend.
$output .= "<div id='container_servicemap_legend'>"; /*
if ($this->values['showLegend'] === 1) {
$output .= "<div id='container_servicemap_legend".$this->values['serviceId'].'_'.$this->cellId."'>";
$output .= '<table>'; $output .= '<table>';
$output .= "<tr class='legend_servicemap_title'><td colspan='3' style='padding-bottom: 10px; min-width: 177px;'><b>".__('Legend').'</b></td>'; $output .= "<tr class='legend_servicemap_title'><td colspan='3' style='padding-bottom: 10px; min-width: 177px;'><b>".__('Legend').'</b></td>';
$output .= "<td><img class='legend_servicemap_toggle' style='padding-bottom: 10px;' src='images/darrowup.png'></td></tr>"; $output .= "<td><img class='legend_servicemap_toggle' style='padding-bottom: 10px;' src='images/darrowup.png'></td></tr>";
@ -347,6 +391,22 @@ class ServiceMapWidget extends Widget
$output .= '</tr>'; $output .= '</tr>';
$output .= '</table>'; $output .= '</table>';
$output .= '</div>'; $output .= '</div>';
}
*/
// TODO: removed refactoriced services. Only 1 widget Zoom.
$sql = sprintf(
'SELECT COUNT(*)
FROM twidget_dashboard
WHERE id_dashboard = %s
AND id_widget = %s',
$this->dashboardId,
$this->widgetId
);
$countDashboardServices = \db_get_value_sql($sql);
$disableZoom = false;
if ($countDashboardServices > 1) {
$disableZoom = true;
} }
$output .= html_print_input_hidden( $output .= html_print_input_hidden(
@ -360,7 +420,9 @@ class ServiceMapWidget extends Widget
$this->values['serviceId'], $this->values['serviceId'],
false, false,
$size['width'], $size['width'],
$size['height'] $size['height'],
$this->cellId,
$disableZoom
); );
$output .= ob_get_clean(); $output .= ob_get_clean();
$output .= '</div>'; $output .= '</div>';

View File

@ -477,17 +477,29 @@ div#main_pure {
margin-top: 30px; margin-top: 30px;
} }
#form-config-widget .info_box,
.content-widget .info_box { .content-widget .info_box {
border-radius: 5px; border-radius: 5px;
width: 90%; width: 90%;
} }
#form-config-widget .info_box {
margin: 0 auto;
}
#form-config-widget .info_box tbody tr td,
.content-widget .info_box tbody tr td { .content-widget .info_box tbody tr td {
padding: 10px; padding: 10px;
} }
#form-config-widget .info_box tbody tr td.icon,
.content-widget .info_box tbody tr td.icon { .content-widget .info_box tbody tr td.icon {
padding-right: 10px !important; padding-right: 10px !important;
} }
#form-config-widget .info_box tbody tr td {
font-family: "lato-bolder", "Open Sans", sans-serif;
font-size: 8pt;
}
.content-widget .databox.filters > tbody > tr > td { .content-widget .databox.filters > tbody > tr > td {
padding-right: 30px; padding-right: 30px;
} }

View File

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

View File

@ -685,6 +685,11 @@ if (! isset($config['id_user'])) {
unset($query_params_redirect['sec2']); unset($query_params_redirect['sec2']);
} }
// Dashboard do not want sec2.
if ($home_page == 'Dashboard') {
unset($query_params_redirect['sec2']);
}
$redirect_url = '?logged=1'; $redirect_url = '?logged=1';
foreach ($query_params_redirect as $key => $value) { foreach ($query_params_redirect as $key => $value) {
if ($key == 'login') { if ($key == 'login') {
@ -1161,7 +1166,7 @@ if ($searchPage) {
if (($home_url == '') || ($id_visualc == false)) { if (($home_url == '') || ($id_visualc == false)) {
$str = 'sec=network&sec2=operation/visual_console/index&refr=60'; $str = 'sec=network&sec2=operation/visual_console/index&refr=60';
} else { } 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); parse_str($str, $res);

View File

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

View File

@ -1962,17 +1962,7 @@ function process_datatables_item(item) {
/* Agent ID link */ /* Agent ID link */
if (item.id_agente > 0) { if (item.id_agente > 0) {
<?php item.id_agente = '<a href="'+url_link+item.id_agente+url_link_hash+'">' + item.id_agente + '</a>';
if (in_array('agent_name', $fields)) {
?>
item.id_agente = '<a href="'+url_link+item.id_agente+url_link_hash+'">' + item.id_agente + '</a>';
<?php
} else {
?>
item.id_agente = '<a href="'+url_link+item.id_agente+url_link_hash+'">' + item.agent_name + '</a>';
<?php
}
?>
} else { } else {
item.id_agente = ''; item.id_agente = '';
} }

View File

@ -158,7 +158,7 @@ if ($read_message) {
).' '.$user_name.' '.__('wrote').":\n\n".$message['mensaje']; ).' '.$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>';
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">'; 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) { if ($delete_msg) {
$id = (int) get_parameter('id'); $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. // Delete message function will actually check the credentials.
ui_print_result_message( ui_print_result_message(
$result, $result,
@ -91,7 +97,11 @@ if ($multiple_delete) {
$ids = (array) get_parameter('delete_multiple_messages', []); $ids = (array) get_parameter('delete_multiple_messages', []);
foreach ($ids as $id) { 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) { if ($result === false) {
break; break;

View File

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

View File

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

View File

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

View File

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

View File

@ -143,11 +143,14 @@ class ImageProcessor implements \Psr\Log\LoggerAwareInterface
} }
$data = $this->mpdf->imageVars[$v[1]]; $data = $this->mpdf->imageVars[$v[1]];
$file = md5($data); $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]; $type = $v[1];
$data = base64_decode($v[2]); $encoded = $v[2];
$decoded = "";
$data = base64_decode(html_entity_decode($encoded));
$file = md5($data); $file = md5($data);
} }

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.746-200603 Version: 7.0NG.746-200623
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.746-200603" pandora_version="7.0NG.746-200623"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.746"; my $pandora_version = "7.0NG.746";
my $pandora_build = "200603"; my $pandora_build = "200623";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -399,7 +399,8 @@ sub pandora_load_config {
$pa_config->{'max_log_generation'} = 1; $pa_config->{'max_log_generation'} = 1;
# Ignore the timestamp in the XML and use the file timestamp instead # Ignore the timestamp in the XML and use the file timestamp instead
$pa_config->{'use_xml_timestamp'} = 0; # If 1 => uses timestamp from received XML #5763.
$pa_config->{'use_xml_timestamp'} = 1;
# Server restart delay in seconds # Server restart delay in seconds
$pa_config->{'restart_delay'} = 60; $pa_config->{'restart_delay'} = 60;

View File

@ -234,6 +234,7 @@ sub data_consumer ($$) {
} }
# Ignore the timestamp in the XML and use the file timestamp instead # Ignore the timestamp in the XML and use the file timestamp instead
# If 1 => uses timestamp from received XML #5763.
$xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '0' || ! defined ($xml_data->{'timestamp'})); $xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '0' || ! defined ($xml_data->{'timestamp'}));
# Double check that the file exists # Double check that the file exists

View File

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

View File

@ -40,6 +40,7 @@ use constant {
DISCOVERY_CLOUD_AZURE_COMPUTE => 8, DISCOVERY_CLOUD_AZURE_COMPUTE => 8,
DISCOVERY_DEPLOY_AGENTS => 9, DISCOVERY_DEPLOY_AGENTS => 9,
DISCOVERY_APP_SAP => 10, DISCOVERY_APP_SAP => 10,
DISCOVERY_APP_DB2 => 11,
DISCOVERY_REVIEW => 0, DISCOVERY_REVIEW => 0,
DISCOVERY_STANDARD => 1, DISCOVERY_STANDARD => 1,
DISCOVERY_RESULTS => 2, DISCOVERY_RESULTS => 2,
@ -1661,6 +1662,9 @@ sub database_scan($$$) {
# Skip database scan in Oracle tasks # Skip database scan in Oracle tasks
next if defined($self->{'type'}) && $self->{'type'} == DISCOVERY_APP_ORACLE; next if defined($self->{'type'}) && $self->{'type'} == DISCOVERY_APP_ORACLE;
# Skip database scan in DB2 tasks
next if defined($self->{'type'}) && $self->{'type'} == DISCOVERY_APP_DB2;
my $__data = $obj->scan_databases(); my $__data = $obj->scan_databases();
if (ref($__data) eq "ARRAY") { if (ref($__data) eq "ARRAY") {
@ -1705,6 +1709,8 @@ sub app_scan($) {
$type = 'MySQL'; $type = 'MySQL';
} elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE) { } elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE) {
$type = 'Oracle'; $type = 'Oracle';
} elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_DB2) {
$type = 'DB2';
} elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_SAP) { } elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_SAP) {
$type = 'SAP'; $type = 'SAP';
} else { } else {
@ -1787,7 +1793,9 @@ sub app_scan($) {
# Scan connected obj. # Scan connected obj.
if ( $self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL if ( $self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE) { || $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_DB2
) {
# Database. # Database.
$results = $self->database_scan($type, $obj, $global_percent, \@targets); $results = $self->database_scan($type, $obj, $global_percent, \@targets);
@ -1894,6 +1902,7 @@ sub scan($) {
if (defined($self->{'task_data'})) { if (defined($self->{'task_data'})) {
if ( $self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL if ( $self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE || $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_DB2
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_SAP) { || $self->{'task_data'}->{'type'} == DISCOVERY_APP_SAP) {
# Application scan. # Application scan.
$self->call('message', "Scanning application ...", 6); $self->call('message', "Scanning application ...", 6);

View File

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

View File

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

View File

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

View File

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

View File

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