Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix. Scanner. Removed trial restrictions. #484

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 2 additions & 32 deletions inc/spbc-scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2195,21 +2180,6 @@ function spbc__get_exists_directories($paths)
return $exists_dirs;
}

function spbc_get_trial_restriction_notice()
{
global $spbc;

$html = '<h2>' . esc_html__('Just one step before remove malware', 'security-malware-firewall') . '</h2>';
$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,
'<button class="button button-primary">' . esc_html__('UPGRADE', 'security-malware-firewall') . '<i class="spbc-icon-link-ext"></i></button>',
4,
'trial_restriction_notice_upgrade_button'
);
return $html;
}

/**
* Get JSON string of accordion row actions that do not need to be confirmed.
* @return string
Expand Down
7 changes: 0 additions & 7 deletions lib/CleantalkSP/SpbctWP/LinkConstructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '',
Expand Down
6 changes: 0 additions & 6 deletions lib/CleantalkSP/SpbctWP/ListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down
14 changes: 0 additions & 14 deletions lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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;

Expand Down
Loading