From ff435ce4185540aea9e18a4812c3b68304a07e5d Mon Sep 17 00:00:00 2001 From: alexandergull Date: Thu, 12 Sep 2024 14:17:47 +0500 Subject: [PATCH 1/2] Upd. SecurityLogs. Parsing action. Parsed actions simplified. --- inc/spbc-tools.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/inc/spbc-tools.php b/inc/spbc-tools.php index 681c5909a..77957a8cb 100644 --- a/inc/spbc-tools.php +++ b/inc/spbc-tools.php @@ -913,15 +913,8 @@ function spbc_parse_action_from_admin_page_uri($url, $post_id = null) $out['add_time'] = false; break; default: - preg_match_all('/\/wp-admin\/(.+\.php)\?(action=.+?)&/', $url, $matches); - $file = !empty($matches[1]) && !empty($matches[1][0]) ? $matches[1][0] : ''; - $the_action = !empty($matches[2]) && !empty($matches[2][0]) ? $matches[2][0] : ''; - $event = !empty($file) && !empty($the_action) ? $file . '...' . $the_action : 'view'; - // shortening to 16 symbols - $event = strlen($event) > 16 - ? '..' . substr($event, -14, -14) - : $event; - $out['action_event'] = $event; + // removed parsing the actions to unify parsing on the cloud + $out['action_event'] = 'view'; $out['add_time'] = false; } return $out; From ba363f3df5fc14b9117e23b2ff4850405894fd35 Mon Sep 17 00:00:00 2001 From: alexandergull Date: Thu, 12 Sep 2024 14:18:50 +0500 Subject: [PATCH 2/2] Upd. SecurityLogs. Parsing action. Checking the plugin directory before call get_plugin_data(). --- inc/spbc-tools.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inc/spbc-tools.php b/inc/spbc-tools.php index 77957a8cb..3092b4aa3 100644 --- a/inc/spbc-tools.php +++ b/inc/spbc-tools.php @@ -824,7 +824,13 @@ function spbc_parse_action_from_admin_page_uri($url, $post_id = null) $skip_request = isset($parsed_query['tab']) && $parsed_query['tab'] === 'plugin-information'; if ( isset($parsed_query['plugin']) && !$skip_request ) { if (is_callable('get_plugin_data')) { - $plugin_name = get_plugin_data(WP_PLUGIN_DIR . '/' . $parsed_query['plugin'])['Name']; + $plugin_path = WP_PLUGIN_DIR . '/' . $parsed_query['plugin']; + if (@is_dir($plugin_path) && @is_readable($plugin_path)) { + $plugin_data = get_plugin_data($plugin_path); + if (isset($plugin_data['Name'])) { + $plugin_name = $plugin_data['Name']; + } + } } if (empty($plugin_name)) { $plugin_name = explode('/', $parsed_query['plugin'])[0];