From 213e257cfea8caf680c8c1c1f153b99ae0ea6239 Mon Sep 17 00:00:00 2001 From: Glomberg Date: Fri, 21 Feb 2025 11:29:00 +0300 Subject: [PATCH] Fix. Scanner. Removed trial restrictions. --- inc/spbc-scanner.php | 34 ++----------------- lib/CleantalkSP/SpbctWP/LinkConstructor.php | 7 ---- lib/CleantalkSP/SpbctWP/ListTable.php | 6 ---- .../SpbctWP/Scanner/ScannerQueue.php | 14 -------- 4 files changed, 2 insertions(+), 59 deletions(-) diff --git a/inc/spbc-scanner.php b/inc/spbc-scanner.php index 36666a929..5129f0c6f 100644 --- a/inc/spbc-scanner.php +++ b/inc/spbc-scanner.php @@ -4,7 +4,6 @@ use CleantalkSP\SpbctWP\DB; use CleantalkSP\SpbctWP\API as SpbcAPI; use CleantalkSP\SpbctWP\Helpers\CSV; -use CleantalkSP\SpbctWP\LinkConstructor; use CleantalkSP\SpbctWP\Scanner\CureLog\CureLog; use CleantalkSP\SpbctWP\Scanner\FrontendScan; use CleantalkSP\SpbctWP\Scanner\Stages\CureStage; @@ -437,16 +436,10 @@ function spbc_scanner_file_delete_handler($file_id) */ function spbc_scanner_file_delete($direct_call = false, $file_id = null) { - global $spbc; - if ( ! $direct_call) { spbc_check_ajax_referer('spbc_secret_nonce', 'security'); } - if ( $spbc->data['license_trial'] == 1 ) { - wp_send_json(['error' => spbc_get_trial_restriction_notice(), 'hide_support_link' => '1']); - } - $time_start = microtime(true); $file_id = $direct_call ? $file_id : Post::get('file_id', 'hash'); @@ -495,11 +488,7 @@ function spbc_scanner_file_approve($direct_call = false, $file_id = null) spbc_check_ajax_referer('spbc_secret_nonce', 'security'); } - global $spbc, $wpdb; - - if ( $spbc->data['license_trial'] == 1 ) { - wp_send_json(['error' => spbc_get_trial_restriction_notice(), 'hide_support_link' => '1']); - } + global $wpdb; $time_start = microtime(true); @@ -1532,16 +1521,12 @@ function spbc_scanner_file_replace($direct_call = false, $file_id = null, $_plat function spbc_scanner_file_quarantine($direct_call = false, $file_id = null) { - global $wpdb, $spbc; + global $wpdb; if ( ! $direct_call ) { spbc_check_ajax_referer('spbc_secret_nonce', 'security'); } - if ( $spbc->data['license_trial'] == 1 ) { - wp_send_json(['error' => spbc_get_trial_restriction_notice(), 'hide_support_link' => '1']); - } - $root_path = spbc_get_root_path(); $file_id = $direct_call ? $file_id @@ -2195,21 +2180,6 @@ function spbc__get_exists_directories($paths) return $exists_dirs; } -function spbc_get_trial_restriction_notice() -{ - global $spbc; - - $html = '

' . esc_html__('Just one step before remove malware', 'security-malware-firewall') . '

'; - $html .= esc_html__('Please upgrade your account to premium Security license to Cure, Approve, Remove and Quarantine viruses and malware. As well as using 1600+ viruses signatures by now.', 'security-malware-firewall'); - $html .= linkConstructor::buildRenewalLinkATag( - $spbc->user_token, - '', - 4, - 'trial_restriction_notice_upgrade_button' - ); - return $html; -} - /** * Get JSON string of accordion row actions that do not need to be confirmed. * @return string diff --git a/lib/CleantalkSP/SpbctWP/LinkConstructor.php b/lib/CleantalkSP/SpbctWP/LinkConstructor.php index 8e3d1f62f..eff1b5fe7 100644 --- a/lib/CleantalkSP/SpbctWP/LinkConstructor.php +++ b/lib/CleantalkSP/SpbctWP/LinkConstructor.php @@ -105,13 +105,6 @@ class LinkConstructor extends \CleantalkSP\Common\LinkConstructor 'utm_medium' => 'admin_bar', 'utm_content' => 'renew_admin_bar', ), - 'trial_restriction_notice_upgrade_button' => array( // the upgrade button in the trial restriction notice - 'utm_id' => '', - 'utm_term' => '', - 'utm_source' => 'admin_panel_scanner', - 'utm_medium' => 'button', - 'utm_content' => 'trial_restriction_notice_upgrade_button', - ), 'banner_link_for_treatment' => array( 'utm_id' => '', 'utm_term' => '', diff --git a/lib/CleantalkSP/SpbctWP/ListTable.php b/lib/CleantalkSP/SpbctWP/ListTable.php index 4b199602a..d4a24b4ad 100644 --- a/lib/CleantalkSP/SpbctWP/ListTable.php +++ b/lib/CleantalkSP/SpbctWP/ListTable.php @@ -724,9 +724,6 @@ public static function ajaxRowActionHandler() public static function ajaxRowActionHandlerApproveOSCronTask() { global $spbc; - if ( $spbc->data['license_trial'] == 1 ) { - wp_send_json(['error' => spbc_get_trial_restriction_notice(), 'hide_support_link' => '1']); - } $result = OSCronController::enableTask(Post::get('id', null, 'word')); if (true === $result) { $out = array( @@ -746,9 +743,6 @@ public static function ajaxRowActionHandlerApproveOSCronTask() public static function ajaxRowActionHandlerDisableOSCronTask() { global $spbc; - if ( $spbc->data['license_trial'] == 1 ) { - wp_send_json(['error' => spbc_get_trial_restriction_notice(), 'hide_support_link' => '1']); - } $result = OSCronController::disableTask(Post::get('id', null, 'word')); if (true === $result) { $out = array( diff --git a/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php b/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php index 7348a57b7..c65cc83b3 100644 --- a/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php +++ b/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php @@ -1736,10 +1736,6 @@ public function schedule_send_heuristic_suspicious_files() // phpcs:ignore PSR1. public function auto_cure_backup() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps { - global $spbc; - if ( $spbc->data['license_trial'] == 1 ) { - return array('success' => true, 'end' => 1); - } return spbc_backup__files_with_signatures(true); } @@ -1751,16 +1747,6 @@ public function auto_cure_backup() // phpcs:ignore PSR1.Methods.CamelCapsMethodN */ public function auto_cure($offset = null, $amount = null) // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps { - global $spbc; - $auto_cure_enabled = isset($spbc->settings['scanner__auto_cure']) && $spbc->settings['scanner__auto_cure'] == 1; - if ( $spbc->data['license_trial'] == 1 || !$auto_cure_enabled) { - return [ - 'processed' => 0, - 'cured' => 0, - 'end' => 1 - ]; - } - $amount = isset($amount) ? $amount : $this->amount; $offset = isset($offset) ? $offset : $this->offset;