minor changes

This commit is contained in:
alejandro.campos@artica.es 2023-09-28 13:08:33 +02:00
parent dbd418d6dc
commit 70ad1ea986
2 changed files with 3 additions and 9 deletions

View File

@ -1278,7 +1278,7 @@ $class = 'databox filters';
<td class="bolder"> <td class="bolder">
<?php <?php
echo __('Operating system version').ui_print_help_tip( echo __('Operating system version').ui_print_help_tip(
__('Case insensitive regular expression for OS version. For example: Centos.* will match with the following OS versions: Centos 6.4, Centos 7'), __('Case insensitive regular expression for OS version. For example: Centos.* will match with the following OS versions: Centos 6.4, Centos 7. Important: OS version must be registered in Operating Systems editor.'),
true true
); );
?> ?>
@ -1301,12 +1301,6 @@ $class = 'databox filters';
<td class="bolder"><?php echo __('End of life'); ?></td> <td class="bolder"><?php echo __('End of life'); ?></td>
<td colspan="6"> <td colspan="6">
<?php <?php
$end_of_life_date = (string) get_parameter(
'end_of_life_date',
date(DATE_FORMAT, $utimestamp)
);
$end_of_life_date = date(DATE_FORMAT, $result['date_from']);
$timeInputs = []; $timeInputs = [];
$timeInputs[] = html_print_div( $timeInputs[] = html_print_div(

View File

@ -3698,10 +3698,10 @@ function reporting_end_of_life($report, $content)
// Post-process returned agents to filter agents using correctly formatted fields. // Post-process returned agents to filter agents using correctly formatted fields.
foreach ($agents as $idx => $agent) { foreach ($agents as $idx => $agent) {
// Must perform this query and subsequent operations in each iteration (note this is costly) since OS version field may contain HTML entities in BD and decoding can't be fully handled with mysql methods when doing a REGEXP. // Must perform this query and subsequent operations in each iteration (note this is costly) since OS version field may contain HTML entities in BD and decoding can't be fully handled with mysql methods when doing a REGEXP.
$result_end_of_life = db_get_value_sql('SELECT end_of_support FROM tconfig_os_version WHERE "'.io_safe_output($agent['os_version']).'" REGEXP version'); $result_end_of_life = db_get_value_sql('SELECT end_of_support FROM tconfig_os_version WHERE "'.io_safe_output($agent['os_version']).'" REGEXP version AND "'.io_safe_output($agent['name']).'" REGEXP product');
$agent_eol_datetime = DateTime::createFromFormat('Y/m/d', $result_end_of_life); $agent_eol_datetime = DateTime::createFromFormat('Y/m/d', $result_end_of_life);
if ((preg_match('/'.$es_os_version.'/', $agent['os_version']) || $es_os_version === '') && $result_end_of_life !== false && $es_limit_eol_datetime >= $agent_eol_datetime) { if ((preg_match('/'.$es_os_version.'/i', $agent['os_version']) || $es_os_version === '') && $result_end_of_life !== false && ($es_limit_eol_datetime === false || $es_limit_eol_datetime >= $agent_eol_datetime)) {
// Agent matches an existing OS version. // Agent matches an existing OS version.
$agents[$idx]['end_of_life'] = $result_end_of_life; $agents[$idx]['end_of_life'] = $result_end_of_life;
} else { } else {