Skip to content
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
4 changes: 3 additions & 1 deletion inc/cleantalk-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ function apbct_base_call($params = array(), $reg_flag = false)

// Misc
'auth_key' => $apbct->api_key,
'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ? 1 : apbct_js_test(TT::toString(Post::get('ct_checkjs'))),
'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::getString('ct_checkjs')), true)
? 1
: apbct_js_test(Post::getString('ct_checkjs')),

'agent' => APBCT_AGENT,
'sender_info' => $sender_info,
Expand Down
3 changes: 0 additions & 3 deletions inc/cleantalk-public-integrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -1870,19 +1870,16 @@ function ct_quform_post_validate($result, $form)
* Filter for POST
*/
$input_array = apply_filters('apbct__filter_post', $form->getValues());

$ct_temp_msg_data = ct_get_fields_any($input_array);
$sender_email = isset($ct_temp_msg_data['email']) ? $ct_temp_msg_data['email'] : '';
$sender_emails_array = isset($ct_temp_msg_data['emails_array']) ? $ct_temp_msg_data['emails_array'] : '';

$checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true);
$base_call_result = apbct_base_call(
array(
'message' => $form->getValues(),
'sender_email' => $sender_email,
'post_info' => array('comment_type' => $comment_type),
'sender_info' => array('sender_emails_array' => $sender_emails_array),
'js_on' => $checkjs,
)
);

Expand Down
2 changes: 1 addition & 1 deletion js/apbct-public-bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_ext-protection.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_ext-protection_gathering.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_full-protection.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_full-protection_gathering.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_gathering.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_int-protection.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_int-protection_gathering.min.js

Large diffs are not rendered by default.

40 changes: 34 additions & 6 deletions js/prebuild/apbct-public-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2147,9 +2147,7 @@ function ctSetCookie( cookies, value, expires ) {
// do it just once
ctSetAlternativeCookie(cookies, {forceAltCookies: true});
} else {
if (!+ctPublic.settings__data__bot_detector_enabled) {
ctNoCookieAttachHiddenFieldsToForms();
}
ctNoCookieAttachHiddenFieldsToForms();
}

// Using traditional cookies
Expand Down Expand Up @@ -2547,6 +2545,37 @@ function ctDebounceFuncExec(func, wait) {
};
}

/**
* ctNoCookieAttachHiddenFieldsToForms
*/
function ctNoCookieAttachHiddenFieldsToForms() {
if (ctPublic.data__cookies_type !== 'none') {
return;
}

let forms = ctGetPageForms();

if (forms) {
for ( let i = 0; i < forms.length; i++ ) {
if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) {
continue;
}

// ignore forms with get method @todo We need to think about this
if (document.forms[i].getAttribute('method') === null ||
document.forms[i].getAttribute('method').toLowerCase() === 'post') {
// remove old sets
let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field');
for ( let j = 0; j < fields.length; j++ ) {
fields[j].outerHTML = '';
}
// add new set
document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField());
}
}
}
}


/**
* Class for event token transport
Expand Down Expand Up @@ -4344,9 +4373,8 @@ async function apbctImportScript(scriptAbsolutePath) {
// eslint-disable-next-line camelcase,require-jsdoc
async function apbct_ready() {
apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true);
if (ctPublic.data__cookies_type === 'native') {
ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true);
}
ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true);


new ApbctShowForbidden().prepareBlockForAjaxForms();

Expand Down
40 changes: 34 additions & 6 deletions js/prebuild/apbct-public-bundle_ext-protection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2147,9 +2147,7 @@ function ctSetCookie( cookies, value, expires ) {
// do it just once
ctSetAlternativeCookie(cookies, {forceAltCookies: true});
} else {
if (!+ctPublic.settings__data__bot_detector_enabled) {
ctNoCookieAttachHiddenFieldsToForms();
}
ctNoCookieAttachHiddenFieldsToForms();
}

// Using traditional cookies
Expand Down Expand Up @@ -2547,6 +2545,37 @@ function ctDebounceFuncExec(func, wait) {
};
}

/**
* ctNoCookieAttachHiddenFieldsToForms
*/
function ctNoCookieAttachHiddenFieldsToForms() {
if (ctPublic.data__cookies_type !== 'none') {
return;
}

let forms = ctGetPageForms();

if (forms) {
for ( let i = 0; i < forms.length; i++ ) {
if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) {
continue;
}

// ignore forms with get method @todo We need to think about this
if (document.forms[i].getAttribute('method') === null ||
document.forms[i].getAttribute('method').toLowerCase() === 'post') {
// remove old sets
let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field');
for ( let j = 0; j < fields.length; j++ ) {
fields[j].outerHTML = '';
}
// add new set
document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField());
}
}
}
}


/**
* Class for event token transport
Expand Down Expand Up @@ -4344,9 +4373,8 @@ async function apbctImportScript(scriptAbsolutePath) {
// eslint-disable-next-line camelcase,require-jsdoc
async function apbct_ready() {
apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true);
if (ctPublic.data__cookies_type === 'native') {
ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true);
}
ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true);


new ApbctShowForbidden().prepareBlockForAjaxForms();

Expand Down
71 changes: 34 additions & 37 deletions js/prebuild/apbct-public-bundle_ext-protection_gathering.js
Original file line number Diff line number Diff line change
Expand Up @@ -2147,9 +2147,7 @@ function ctSetCookie( cookies, value, expires ) {
// do it just once
ctSetAlternativeCookie(cookies, {forceAltCookies: true});
} else {
if (!+ctPublic.settings__data__bot_detector_enabled) {
ctNoCookieAttachHiddenFieldsToForms();
}
ctNoCookieAttachHiddenFieldsToForms();
}

// Using traditional cookies
Expand Down Expand Up @@ -2547,6 +2545,37 @@ function ctDebounceFuncExec(func, wait) {
};
}

/**
* ctNoCookieAttachHiddenFieldsToForms
*/
function ctNoCookieAttachHiddenFieldsToForms() {
if (ctPublic.data__cookies_type !== 'none') {
return;
}

let forms = ctGetPageForms();

if (forms) {
for ( let i = 0; i < forms.length; i++ ) {
if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) {
continue;
}

// ignore forms with get method @todo We need to think about this
if (document.forms[i].getAttribute('method') === null ||
document.forms[i].getAttribute('method').toLowerCase() === 'post') {
// remove old sets
let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field');
for ( let j = 0; j < fields.length; j++ ) {
fields[j].outerHTML = '';
}
// add new set
document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField());
}
}
}
}


/**
* Class for event token transport
Expand Down Expand Up @@ -4344,9 +4373,8 @@ async function apbctImportScript(scriptAbsolutePath) {
// eslint-disable-next-line camelcase,require-jsdoc
async function apbct_ready() {
apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true);
if (ctPublic.data__cookies_type === 'native') {
ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true);
}
ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true);


new ApbctShowForbidden().prepareBlockForAjaxForms();

Expand Down Expand Up @@ -6657,37 +6685,6 @@ function apbctCancelAutocomplete(element) {
}));
}

/**
* ctNoCookieAttachHiddenFieldsToForms
*/
function ctNoCookieAttachHiddenFieldsToForms() {
if (ctPublic.data__cookies_type !== 'none') {
return;
}

let forms = ctGetPageForms();

if (forms) {
for ( let i = 0; i < forms.length; i++ ) {
if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) {
continue;
}

// ignore forms with get method @todo We need to think about this
if (document.forms[i].getAttribute('method') === null ||
document.forms[i].getAttribute('method').toLowerCase() === 'post') {
// remove old sets
let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field');
for ( let j = 0; j < fields.length; j++ ) {
fields[j].outerHTML = '';
}
// add new set
document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField());
}
}
}
}

let botDetectorLogLastUpdate = 0;
let botDetectorLogEventTypesCollected = [];

Expand Down
40 changes: 34 additions & 6 deletions js/prebuild/apbct-public-bundle_full-protection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2147,9 +2147,7 @@ function ctSetCookie( cookies, value, expires ) {
// do it just once
ctSetAlternativeCookie(cookies, {forceAltCookies: true});
} else {
if (!+ctPublic.settings__data__bot_detector_enabled) {
ctNoCookieAttachHiddenFieldsToForms();
}
ctNoCookieAttachHiddenFieldsToForms();
}

// Using traditional cookies
Expand Down Expand Up @@ -2547,6 +2545,37 @@ function ctDebounceFuncExec(func, wait) {
};
}

/**
* ctNoCookieAttachHiddenFieldsToForms
*/
function ctNoCookieAttachHiddenFieldsToForms() {
if (ctPublic.data__cookies_type !== 'none') {
return;
}

let forms = ctGetPageForms();

if (forms) {
for ( let i = 0; i < forms.length; i++ ) {
if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) {
continue;
}

// ignore forms with get method @todo We need to think about this
if (document.forms[i].getAttribute('method') === null ||
document.forms[i].getAttribute('method').toLowerCase() === 'post') {
// remove old sets
let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field');
for ( let j = 0; j < fields.length; j++ ) {
fields[j].outerHTML = '';
}
// add new set
document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField());
}
}
}
}


/**
* Class for event token transport
Expand Down Expand Up @@ -4344,9 +4373,8 @@ async function apbctImportScript(scriptAbsolutePath) {
// eslint-disable-next-line camelcase,require-jsdoc
async function apbct_ready() {
apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true);
if (ctPublic.data__cookies_type === 'native') {
ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true);
}
ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true);


new ApbctShowForbidden().prepareBlockForAjaxForms();

Expand Down
Loading
Loading