Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Glomberg committed Oct 14, 2024
2 parents 25cfe3b + 472f7af commit e1cb438
Show file tree
Hide file tree
Showing 18 changed files with 579 additions and 152 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/releaseNotice.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Notice about releases via Telegram

on:
release:
types: [published]

jobs:

build:
runs-on: ubuntu-latest
steps:
- name: send telegram message on release
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
${{ github.event.repository.description }} <strong>v${{github.event.release.name}}</strong> released
${{github.event.release.html_url}}
${{ github.event.release.body }}
format: html
disable_web_page_preview: true
27 changes: 27 additions & 0 deletions .github/workflows/reviewNotice.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Notice about review approved via Telegram

on:
pull_request_review:
types: [ submitted ]

jobs:

build:
if: github.event.review.state == 'approved' && toJSON(github.event.pull_request.requested_reviewers) == '[]'
runs-on: ubuntu-latest
steps:
- name: Convert date format
id: date
run: echo "::set-output name=date::$(date -d "${{ github.event.pull_request.created_at }}" +"%Y-%m-%d")"
- name: Send telegram message on review approved
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_PLUGINS_TO }}
token: ${{ secrets.TELEGRAM_REVIEWER_TOKEN }}
message: |
💥🎉🎉🎉💥 Pull-request <a href="${{ github.event.pull_request.html_url }}"><strong>${{ github.event.pull_request.title }}</strong></a>
submitted by <strong>${{ github.event.pull_request.user.login }}</strong> at <strong>${{ steps.date.outputs.date }}</strong>
was <strong>approved</strong> and is ready to merge <a href="${{ github.event.pull_request.html_url }}">➡️</a> !!!
format: html
disable_web_page_preview: true
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/*
!/cleantalk.antispam
!/cleantalk.antispam/*
!/cleantalk.antispam/*
!/.github
!/.github/*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bitrix-antispam
===============

1C Bitrix anti-spam mod. 3.12.0
1C Bitrix anti-spam mod.

Information page,
http://cleantalk.org/bitrix-antispam-module-bez-captcha
Expand Down
2 changes: 2 additions & 0 deletions cleantalk.antispam/default_option.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
'web_form' => 1,
'form_global_check' => 0,
'form_global_check_without_email' => 0,
'bot_detector' => 1,
'form_sfw' => 1,
'form_sfw_uniq_get_option' => 1,
'site_exclusions' => '',
'form_exclusions_url' => '',
'form_exclusions_url__regexp' => 0,
Expand Down
34 changes: 13 additions & 21 deletions cleantalk.antispam/description.en
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
<ul>
<li>* Fix: all functions in the class CleantalkAntispam are now static for compatibility with php 8</li>
<li>* New. Options. Use bitrix API.</li>
<li>* New. default_option.php. Default settings file.</li>
<li>* Imp. options.php. Handle fail messages.</li>
<li>* Imp. options.php. Old COption legacy removed.</li>
<li>* Fix. Uninstall. Complete deactivation now works correct.</li>
<li>* New. Install. Use default options if no options set (new install or if complete deactivation performed)</li>
<li>* Fix. After tests. Exclusion for SFW module settings that placed after uninstallation process.</li>
<li>* Fix. After review. Old PHP version compatibility in access keys comparison.</li>
<li>* Fix. SFW test. Now displays test page correct and always runs in the session.</li>
<li>* Fix. Settings page. Remove spaces in URL exclusions.</li>
<li>* Fix. Exclusions. Page with URL exclusions now do not load JS.</li>
<li>* Fix. Description wrapped by list.</li>
<li>* Fix. Getting fields any fixed.</li>
<li>* fix: fixed warning in preg_match</li>
<li>* Fix: fixed preg_match in OnBeforeResultAddHandler()</li>
<li>* fixed static functions</li>
<li>* Fix. Skip service request - iblock.vode component ajax loading.</li>
<li>* Fix. SFW. Updating process fixed.</li>
<li>* Mod: SFW send logs is fixed</li>
<li>* Upd. SFW. Implemented personal list.</li>
<li>* Fix. SFW. Update log on SFW pass fixed.</li>
<li>* Fix. SFW update. Temp tables fixes.</li>
<li>* Fix. SFW. Reduction to a number.</li>
<li>* Fix. Settings. Getting Access Key message fixed.</li>
<li>* New. Settings. Added option for sfw pass get param.</li>
<li>* Fix. USER variable is null.</li>
<li>* Fix. SFW. Writing logs fixed.</li>
<li>* Fix. Frontend data. Mouse moving collecting removed.</li>
<li>* New. Anti-spam. Bot detector support added.</li>
<li>* Fix. Options. JS code fixed.</li>
<li>* New. Options. Support different api key for multisite mode.</li>
<li>* Fix. SFW. Testing block page fixed.</li>
<li>* Fix. Settings. Multisite option getting fixed.</li>
</ul>
34 changes: 13 additions & 21 deletions cleantalk.antispam/description.ru
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
<ul>
<li>* Fix: all functions in the class CleantalkAntispam are now static for compatibility with php 8</li>
<li>* New. Options. Use bitrix API.</li>
<li>* New. default_option.php. Default settings file.</li>
<li>* Imp. options.php. Handle fail messages.</li>
<li>* Imp. options.php. Old COption legacy removed.</li>
<li>* Fix. Uninstall. Complete deactivation now works correct.</li>
<li>* New. Install. Use default options if no options set (new install or if complete deactivation performed)</li>
<li>* Fix. After tests. Exclusion for SFW module settings that placed after uninstallation process.</li>
<li>* Fix. After review. Old PHP version compatibility in access keys comparison.</li>
<li>* Fix. SFW test. Now displays test page correct and always runs in the session.</li>
<li>* Fix. Settings page. Remove spaces in URL exclusions.</li>
<li>* Fix. Exclusions. Page with URL exclusions now do not load JS.</li>
<li>* Fix. Description wrapped by list.</li>
<li>* Fix. Getting fields any fixed.</li>
<li>* fix: fixed warning in preg_match</li>
<li>* Fix: fixed preg_match in OnBeforeResultAddHandler()</li>
<li>* fixed static functions</li>
<li>* Fix. Skip service request - iblock.vode component ajax loading.</li>
<li>* Fix. SFW. Updating process fixed.</li>
<li>* Mod: SFW send logs is fixed</li>
<li>* Upd. SFW. Implemented personal list.</li>
<li>* Fix. SFW. Update log on SFW pass fixed.</li>
<li>* Fix. SFW update. Temp tables fixes.</li>
<li>* Fix. SFW. Reduction to a number.</li>
<li>* Fix. Settings. Getting Access Key message fixed.</li>
<li>* New. Settings. Added option for sfw pass get param.</li>
<li>* Fix. USER variable is null.</li>
<li>* Fix. SFW. Writing logs fixed.</li>
<li>* Fix. Frontend data. Mouse moving collecting removed.</li>
<li>* New. Anti-spam. Bot detector support added.</li>
<li>* Fix. Options. JS code fixed.</li>
<li>* New. Options. Support different api key for multisite mode.</li>
<li>* Fix. SFW. Testing block page fixed.</li>
<li>* Fix. Settings. Multisite option getting fixed.</li>
</ul>
69 changes: 16 additions & 53 deletions cleantalk.antispam/include.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require_once(dirname(__FILE__) . '/lib/autoload.php');

//Antispam classes
use Bitrix\Main\Page\Asset;
use Cleantalk\Antispam\Cleantalk;
use Cleantalk\Antispam\CleantalkRequest;
use Cleantalk\Antispam\CleantalkResponse;
Expand All @@ -19,7 +20,7 @@
use Cleantalk\ApbctBitrix\Cron;
use Cleantalk\ApbctBitrix\DB;
use Cleantalk\Common\Variables\Server;
use Cleantalk\Common\Firewall\Modules\SFW;
use Cleantalk\ApbctBitrix\SFW;

if ( ! defined( 'CLEANTALK_USER_AGENT' ) )
define( 'CLEANTALK_USER_AGENT', 'bitrix-3.12.0' );
Expand Down Expand Up @@ -162,6 +163,7 @@ public static function OnPageStartHandler()
$ct_key = COption::GetOptionString( 'cleantalk.antispam', 'key', '' );
$last_checked = COption::GetOptionInt( 'cleantalk.antispam', 'last_checked', 0 );
$show_review = COption::GetOptionInt( 'cleantalk.antispam', 'show_review', 0 );
$bot_detector = COption::GetOptionInt( 'cleantalk.antispam', 'bot_detector', 0 );
$is_sfw = COption::GetOptionInt( 'cleantalk.antispam', 'form_sfw', 0 );
$sfw_last_update = COption::GetOptionInt( 'cleantalk.antispam', 'sfw_last_update', 0);
$sfw_last_send_log = COption::GetOptionInt( 'cleantalk.antispam', 'sfw_last_send_log', 0);
Expand All @@ -179,6 +181,10 @@ public static function OnPageStartHandler()

if( ! $USER->IsAdmin() ){

if ( $bot_detector ) {
Asset::getInstance()->addJs('https://moderate.cleantalk.org/ct-bot-detector-wrapper.js');
}

// Set cookies
if( ! headers_sent() )
self::ct_cookie();
Expand Down Expand Up @@ -1032,6 +1038,8 @@ static function OnEventLogGetAuditTypesHandler(){
public static function OnEndBufferContentHandler( &$content ) {
global $USER, $APPLICATION;

if (!is_object($USER)) $USER = new CUser;

if(
! $USER->IsAdmin() &&
! defined( "ADMIN_SECTION" ) &&
Expand Down Expand Up @@ -1061,19 +1069,14 @@ static function FormAddon() {
$ct_check_values = self::SetCheckJSValues();

$js_template = "<script data-skip-moving = 'true'>
var ct_checkjs_val = '".$ct_check_values[0]."', ct_date = new Date(),
ctTimeMs = new Date().getTime(),
ctMouseEventTimerFlag = true, //Reading interval flag
ctMouseData = [],
ctMouseDataCounter = 0;
var ct_checkjs_val = '".$ct_check_values[0]."', ct_date = new Date();
function ctSetCookie(c_name, value) {
document.cookie = c_name + '=' + encodeURIComponent(value) + '; path=/';
}
ctSetCookie('ct_ps_timestamp', Math.floor(new Date().getTime()/1000));
ctSetCookie('ct_fkp_timestamp', '0');
ctSetCookie('ct_pointer_data', '0');
ctSetCookie('ct_timezone', '0');
ct_attach_event_handler(window, 'DOMContentLoaded', ct_ready);
Expand All @@ -1090,45 +1093,6 @@ function ctSetCookie(c_name, value) {
ctKeyStopStopListening();
}
/* Reading interval */
var ctMouseReadInterval = setInterval(function(){
ctMouseEventTimerFlag = true;
}, 150);
/* Writting interval */
var ctMouseWriteDataInterval = setInterval(function(){
ctSetCookie('ct_pointer_data', JSON.stringify(ctMouseData));
}, 1200);
/* Logging mouse position each 150 ms */
var ctFunctionMouseMove = function output(event){
if(ctMouseEventTimerFlag == true){
ctMouseData.push([
Math.round(event.pageY),
Math.round(event.pageX),
Math.round(new Date().getTime() - ctTimeMs)
]);
ctMouseDataCounter++;
ctMouseEventTimerFlag = false;
if(ctMouseDataCounter >= 100){
ctMouseStopData();
}
}
}
/* Stop mouse observing function */
function ctMouseStopData(){
if(typeof window.addEventListener == 'function'){
window.removeEventListener('mousemove', ctFunctionMouseMove);
}else{
window.detachEvent('onmousemove', ctFunctionMouseMove);
}
clearInterval(ctMouseReadInterval);
clearInterval(ctMouseWriteDataInterval);
}
/* Stop key listening function */
function ctKeyStopStopListening(){
if(typeof window.addEventListener == 'function'){
Expand All @@ -1141,11 +1105,9 @@ function ctKeyStopStopListening(){
}
if(typeof window.addEventListener == 'function'){
window.addEventListener('mousemove', ctFunctionMouseMove);
window.addEventListener('mousedown', ctFunctionFirstKey);
window.addEventListener('keydown', ctFunctionFirstKey);
}else{
window.attachEvent('onmousemove', ctFunctionMouseMove);
window.attachEvent('mousedown', ctFunctionFirstKey);
window.attachEvent('keydown', ctFunctionFirstKey);
}
Expand Down Expand Up @@ -1318,7 +1280,8 @@ static function CheckAllBefore(&$arEntity, $bSendEmail = FALSE, $form_errors = n
return;
}

$ct_key = COption::GetOptionString('cleantalk.antispam', 'key', '');
$ct_key_site = COption::GetOptionString('cleantalk.antispam', '_key', '', SITE_ID);
$ct_key = empty($ct_key_site) ? COption::GetOptionString('cleantalk.antispam', 'key', '') : $ct_key_site;
$ct_ws = self::GetWorkServer();

if (!isset($_COOKIE['ct_checkjs']))
Expand All @@ -1328,7 +1291,6 @@ static function CheckAllBefore(&$arEntity, $bSendEmail = FALSE, $form_errors = n
else
$checkjs = 0;

$pointer_data = (isset($_COOKIE['ct_pointer_data']) ? json_decode($_COOKIE['ct_pointer_data']) : '');
$js_timezone = (isset($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : 'none');
$first_key_timestamp = (isset($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : 0);
$page_set_timestamp = (isset($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : 0);
Expand Down Expand Up @@ -1364,7 +1326,6 @@ static function CheckAllBefore(&$arEntity, $bSendEmail = FALSE, $form_errors = n
'post_url' => $refferrer,
'USER_AGENT' => $user_agent,
'js_timezone' => $js_timezone,
'mouse_cursor_positions' => $pointer_data,
'key_press_timestamp' => $first_key_timestamp,
'page_set_timestamp' => $page_set_timestamp,
'REFFERRER_PREVIOUS' => isset($_COOKIE['ct_prev_referer']) ? $_COOKIE['ct_prev_referer'] : null,
Expand Down Expand Up @@ -1407,6 +1368,7 @@ static function CheckAllBefore(&$arEntity, $bSendEmail = FALSE, $form_errors = n
'js_on' => $checkjs,
'sender_info' => $sender_info,
'submit_time' => self::ct_cookies_test() == 1 ? time() - (int)$_COOKIE['ct_timestamp'] : null,
'event_token' => isset($_POST['ct_bot_detector_event_token']) ? $_POST['ct_bot_detector_event_token'] : null,
);

switch ($type) {
Expand Down Expand Up @@ -1688,7 +1650,7 @@ private static function ct_visibile_fields__process($visible_fields) {
* @param string Feedback type - 'Y' or 'N' only
*/
static function SendFeedback($module, $id, $feedback) {
global $DB;
global $DB, $site;
if(empty($module))
return;
if(empty($id) || intval($id) < 0)
Expand All @@ -1700,7 +1662,8 @@ static function SendFeedback($module, $id, $feedback) {
if($request_id !== FALSE){
$DB->Query('DELETE FROM cleantalk_cids WHERE module=\''. $module .'\' AND cid=' . $id);

$ct_key = COption::GetOptionString('cleantalk.antispam', 'key', '');
$ct_key_site = COption::GetOptionString('cleantalk.antispam', '_key', '', $site["LID"]);
$ct_key = empty($ct_key_site) ? COption::GetOptionString('cleantalk.antispam', 'key', '') : $ct_key_site;
$ct_ws = self::GetWorkServer();

$ct = new Cleantalk();
Expand Down
4 changes: 2 additions & 2 deletions cleantalk.antispam/install/version.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$arModuleVersion = array(
"VERSION" => "3.12.0",
"VERSION_DATE" => "2023-19-10 10:00:00"
"VERSION" => "3.13.0",
"VERSION_DATE" => "2024-10-14 10:00:00",
);
12 changes: 11 additions & 1 deletion cleantalk.antispam/lang/en/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,21 @@
$MESS['CLEANTALK_LABEL_GLOBAL_CHECK'] = 'Any forms protection';
$MESS['CLEANTALK_LABEL_GLOBAL_CHECK_WITHOUT_EMAIL'] = 'Check all POST data';
$MESS['CLEANTALK_WARNING_GLOBAL_CHECK_WITHOUT_EMAIL'] = '- Warning, conflict possibility!';
$MESS['CLEANTALK_LABEL_BOT_DETECTOR'] = 'Use Anti-Spam by CleanTalk JavaScript library';
$MESS['CLEANTALK_DESCRIPTION_BOT_DETECTOR'] = 'This option includes external Anti-Spam by CleanTalk JavaScript library to getting visitors info data';
$MESS['CLEANTALK_LABEL_SFW'] = 'Spam FireWall';
$MESS['CLEANTALK_LABEL_UNIQ_GET_OPTION'] = 'Uniq GET option';
$MESS['CLEANTALK_LABEL_UNIQ_GET_OPTION_DESC'] = 'If a visitor gets the SpamFireWall page, the plugin will put a unique GET variable in the URL to avoid issues with caching plugins.';
$MESS['CLEANTALK_LABEL_NOTIFY'] = "Like Anti-spam by CleanTalk? Help others learn about CleanTalk! <a target='_blank' href='http://marketplace.1c-bitrix.ru/solutions/cleantalk.antispam/#rating'>Leave a review at the Bitrix.Marketplace</a>";
$MESS['CLEANTALK_ENTER_KEY'] = 'Enter the access key';
$MESS['CLEANTALK_KEY_VALID'] = 'Key is valid';
$MESS['CLEANTALK_KEY_NOT_VALID'] = 'Key is not valid';
$MESS['CLEANTALK_EMAIL_REGISTRATION_WARNING'] = "Administrator's e-mail will be used for registration";
$MESS['CLEANTALK_API_KEY_GETTING_WARNING'] = sprintf(
'Please, get the Access Key from %s CleanTalk Control Panel %s and insert it in the Access Key field',
'<a href="https://cleantalk.org/my/?cp_mode=antispam" target="_blank">',
'</a>'
);
$MESS['CLEANTALK_LICENSE_AGREEMENT'] = 'License agreement';
$MESS['CLEANTALK_KEY'] = 'Access key';
$MESS['CLEANTALK_EXCLUSIONS'] = 'Exclusions';
Expand All @@ -44,4 +53,5 @@
$MESS['CLEANTALK_WRONG_REGEXP_NOTIFY'] = 'Field Exclusions is not a valid regular expression.';
$MESS['CLEANTALK_WRONG_DEFAULT_SETTINGS'] = 'Can not load default options. Module name is incorrect.';
$MESS['CLEANTALK_WRONG_CURRENT_SETTINGS'] = 'Can not load current options.';
$MESS['CLEANTALK_RESET_OPTIONS_FAILED'] = 'Can not reset options to defaults.';
$MESS['CLEANTALK_RESET_OPTIONS_FAILED'] = 'Can not reset options to defaults.';
$MESS['CLEANTALK_MULTISITE_LABEL_KEY'] = 'If you want to use specific Access Key for this website paste it here. Otherwise, leave it empty.';
Loading

0 comments on commit e1cb438

Please sign in to comment.