From 0c0212740606a3cc105885b9ecf506090a1e47b7 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Fri, 10 Feb 2023 13:34:02 +0200 Subject: [PATCH] v.1.0.12 --- ip_blocking.admin.inc | 6 +++--- ip_blocking.info | 2 +- ip_blocking.module | 10 ++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ip_blocking.admin.inc b/ip_blocking.admin.inc index d5b7ca6..097de2a 100644 --- a/ip_blocking.admin.inc +++ b/ip_blocking.admin.inc @@ -164,20 +164,20 @@ function ip_blocking_settings_form() { $form = array(); $form['info'] = array( - '#markup' => '

' . t('Additional settings for module') . '

', + '#markup' => '

' . t('Additional settings') . ':

', ); $form['log_enabled'] = array( '#type' => 'checkbox', '#title' => t('Enable logging'), '#default_value' => config_get('ip_blocking.settings', 'log_enabled'), - '#description' => t('Enable logging for access attempts from blocked IPs'), + '#description' => t('Enable logging of access attempts from blocked IPs and actions of this module.'), ); $form['return_404'] = array( '#type' => 'checkbox', '#title' => t('Return code 404'), '#default_value' => config_get('ip_blocking.settings', 'return_404'), - '#description' => t('Return 404 (Not Found) status code for visitors from blocked IP instead of default 403 (Access Denied)'), + '#description' => t('Return 404 (Not Found) status code for visitors from blocked IP instead of default 403 (Access Denied).'), ); diff --git a/ip_blocking.info b/ip_blocking.info index c91c5a0..f45763e 100644 --- a/ip_blocking.info +++ b/ip_blocking.info @@ -4,4 +4,4 @@ package = Spam control backdrop = 1.x type = module configure = admin/config/people/ip-blocking -version = 1.0.11 +version = 1.0.12 diff --git a/ip_blocking.module b/ip_blocking.module index 3398294..6242304 100644 --- a/ip_blocking.module +++ b/ip_blocking.module @@ -213,7 +213,7 @@ function ip_blocking_get_action_link($ip, $message) { $action_link = ''; // If the IP is already blocked, display an unblock link or vice versa. if (ip_is_denied($ip)) { - $action_link .= t('IP blocked') . ' - '; + $action_link .= '' . t('IP @ip blocked', array('@ip' => $ip)) . ' - '; $action = 'unblock'; } else { @@ -273,7 +273,13 @@ function ip_blocking_block_ip($ip, $reason) { $uid = $user->uid; $config = config('ip_blocking.settings'); $log_enabled = $config->get('log_enabled'); - $reason_dec = 'Request: ' . urldecode($reason); + + if (backdrop_strlen($reason) > 250) { + $reason_dec = 'Request: ' . urldecode(substr($reason, 0, 250)) . ' ... '; + } + else { + $reason_dec = 'Request: ' . urldecode($reason); + } // Insert the record to DB. db_insert('blocked_ips')