Skip to content

Commit d415775

Browse files
authored
Fix. SecurityLog. Fixed ip column and timeline render. (#724)
* Fix. SecurityLog. Fixed ip column and timeline render. * fix cp
1 parent 772c3f2 commit d415775

3 files changed

Lines changed: 67 additions & 18 deletions

File tree

inc/spbc-settings.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -700,14 +700,18 @@ function spbc_field_security_logs__prepare_data(&$table)
700700
$time_offset = current_time('timestamp') - time();
701701

702702
foreach ($table->rows as $row) {
703-
$ip = IP::reduceIPv6($row->auth_ip);
703+
$ip = IP::validate($row->auth_ip) === 'v6'
704+
? (IP::normalizeIPv6($row->auth_ip) ?: $row->auth_ip)
705+
: $row->auth_ip;
706+
$ip_attr = Escape::escAttr($ip);
707+
$ip_js = Escape::escJs($ip);
704708
$allow_layout = '<a href="#" onclick="return spbcSecLogsAllowIp(\''
705-
. esc_attr($ip)
706-
. '\')" class="spbcGreen tbl-row_action--allow" data-ip=' . $ip . '>'
709+
. $ip_js
710+
. '\')" class="spbcGreen tbl-row_action--allow" data-ip="' . $ip_attr . '">'
707711
. esc_html__('Allow', 'security-malware-firewall') . '</a>';
708712
$ban_layout = '<a href="#" onclick="return spbcSecLogsBanIp(\''
709-
. esc_attr($ip)
710-
. '\')" class="spbc---red tbl-row_action--ban" data-ip=' . $ip . '>'
713+
. $ip_js
714+
. '\')" class="spbc---red tbl-row_action--ban" data-ip="' . $ip_attr . '">'
711715
. esc_html__('Ban', 'security-malware-firewall') . '</a>';
712716

713717
$user_part = $row->user_login;
@@ -759,9 +763,9 @@ function spbc_field_security_logs__prepare_data(&$table)
759763
'blacklists/%s'
760764
);
761765
$ip_part = sprintf(
762-
'<a href="' . $ip_blacklist_link . '" target="_blank">%s<i class="spbc-icon-link-ext"></i></a><br>%s',
763-
$row->auth_ip,
764-
IP::reduceIPv6($row->auth_ip),
766+
'<a href="%s" target="_blank">%s<i class="spbc-icon-link-ext"></i></a><br>%s',
767+
Escape::escUrl(sprintf($ip_blacklist_link, rawurlencode($ip))),
768+
Escape::escHtml($ip),
765769
$country_part
766770
);
767771

0 commit comments

Comments
 (0)