Skip to content

Commit 55d2604

Browse files
Glombergalexandergullsvfcode
authored
Version 3.14.0 (#31)
* Fix. Options. CSite::GetList() usage fixed on non-variable reference cases. * Fix. Settings. Improved key validation rules. * Fix. Settings. Fixed settings tab render. * Upd. Settings. Add custom server option. (#30) * Upd. Settings. Add custom server option. * Upd. Settings. Custom server option refactoring. * Upd. Settings. Improved server option. * Fix. Settings. Complete deactivation fixed. * Fix. Common. Add topics creation details. * New. Constant. Ignore rule of 5 approved comments if "CLEANTALK__IGNORE_APPROVED_COMMENTS_COUNT_RULE" is defined * Fix. Remote Calls. Getting home url fixed. * Fix. Version. Agent version fixed. * Fix. Code. Github actions fixed. * Fix. Settings. Multisite Api-key saving fixed. * Fix. Version fixed. * Upd. Changelog updated. --------- Co-authored-by: alexandergull <alex.g@cleantalk.org> Co-authored-by: SVFCode <svfcode@mail.ru>
2 parents e1cb438 + 666dda7 commit 55d2604

File tree

14 files changed

+202
-81
lines changed

14 files changed

+202
-81
lines changed
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Notice about releases via Telegram
1+
name: Notice about releases via Matrix
22

33
on:
44
release:
@@ -9,15 +9,14 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: send telegram message on release
13-
uses: appleboy/telegram-action@master
12+
- name: Send Matrix message on release
13+
uses: Glomberg/matrix-messenger-action@master
1414
with:
15-
to: ${{ secrets.TELEGRAM_TO }}
16-
token: ${{ secrets.TELEGRAM_TOKEN }}
15+
server: ${{ secrets.MATRIX_SERVER }}
16+
to: ${{ secrets.MATRIX_NEWS_ROOM }}
17+
token: ${{ secrets.MATRIX_USER_TOKEN }}
1718
message: |
1819
${{ github.event.repository.description }} <strong>v${{github.event.release.name}}</strong> released
19-
${{github.event.release.html_url}}
20-
21-
${{ github.event.release.body }}
22-
format: html
23-
disable_web_page_preview: true
20+
<br>${{github.event.release.html_url}}
21+
<br>
22+
<br><pre>${{ github.event.release.body }}</pre>

.github/workflows/reviewNotice.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Notice about review approved via Telegram
1+
name: Notice about review approved via Matrix
22

33
on:
44
pull_request_review:
@@ -13,15 +13,14 @@ jobs:
1313
- name: Convert date format
1414
id: date
1515
run: echo "::set-output name=date::$(date -d "${{ github.event.pull_request.created_at }}" +"%Y-%m-%d")"
16-
- name: Send telegram message on review approved
17-
uses: appleboy/telegram-action@master
16+
- name: Send Matrix message on review approved
17+
uses: Glomberg/matrix-messenger-action@master
1818
with:
19-
to: ${{ secrets.TELEGRAM_PLUGINS_TO }}
20-
token: ${{ secrets.TELEGRAM_REVIEWER_TOKEN }}
19+
server: ${{ secrets.MATRIX_SERVER }}
20+
to: ${{ secrets.MATRIX_EXTERNSION_ROOM }}
21+
token: ${{ secrets.MATRIX_USER_TOKEN }}
2122
message: |
2223
💥🎉🎉🎉💥 Pull-request <a href="${{ github.event.pull_request.html_url }}"><strong>${{ github.event.pull_request.title }}</strong></a>
2324
submitted by <strong>${{ github.event.pull_request.user.login }}</strong> at <strong>${{ steps.date.outputs.date }}</strong>
2425
2526
was <strong>approved</strong> and is ready to merge <a href="${{ github.event.pull_request.html_url }}">➡️</a> !!!
26-
format: html
27-
disable_web_page_preview: true

cleantalk.antispam/default_option.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
'form_exclusions_fields__regexp' => 0,
2222
'form_exclusions_webform' => '',
2323
'complete_deactivation' => 0,
24+
'use_custom_server' => '',
2425
);

cleantalk.antispam/description.en

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
<ul>
2-
<li>* Fix. SFW. Update log on SFW pass fixed.</li>
3-
<li>* Fix. SFW update. Temp tables fixes.</li>
4-
<li>* Fix. SFW. Reduction to a number.</li>
5-
<li>* Fix. Settings. Getting Access Key message fixed.</li>
6-
<li>* New. Settings. Added option for sfw pass get param.</li>
7-
<li>* Fix. USER variable is null.</li>
8-
<li>* Fix. SFW. Writing logs fixed.</li>
9-
<li>* Fix. Frontend data. Mouse moving collecting removed.</li>
10-
<li>* New. Anti-spam. Bot detector support added.</li>
11-
<li>* Fix. Options. JS code fixed.</li>
12-
<li>* New. Options. Support different api key for multisite mode.</li>
13-
<li>* Fix. SFW. Testing block page fixed.</li>
14-
<li>* Fix. Settings. Multisite option getting fixed.</li>
2+
<li>Fix. Options. CSite::GetList() usage fixed on non-variable reference cases.</li>
3+
<li>Fix. Settings. Improved key validation rules.</li>
4+
<li>Fix. Settings. Fixed settings tab render.</li>
5+
<li>Upd. Settings. Add custom server option. (#30)</li>
6+
<li>Fix. Settings. Complete deactivation fixed.</li>
7+
<li>Fix. Common. Add topics creation details.</li>
8+
<li>New. Constant. Ignore rule of 5 approved comments if "CLEANTALK__IGNORE_APPROVED_COMMENTS_COUNT_RULE" is defined</li>
9+
<li>Fix. Remote Calls. Getting home url fixed.</li>
10+
<li>Fix. Settings. Multisite Api-key saving fixed.</li>
1511
</ul>

cleantalk.antispam/description.ru

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
<ul>
2-
<li>* Fix. SFW. Update log on SFW pass fixed.</li>
3-
<li>* Fix. SFW update. Temp tables fixes.</li>
4-
<li>* Fix. SFW. Reduction to a number.</li>
5-
<li>* Fix. Settings. Getting Access Key message fixed.</li>
6-
<li>* New. Settings. Added option for sfw pass get param.</li>
7-
<li>* Fix. USER variable is null.</li>
8-
<li>* Fix. SFW. Writing logs fixed.</li>
9-
<li>* Fix. Frontend data. Mouse moving collecting removed.</li>
10-
<li>* New. Anti-spam. Bot detector support added.</li>
11-
<li>* Fix. Options. JS code fixed.</li>
12-
<li>* New. Options. Support different api key for multisite mode.</li>
13-
<li>* Fix. SFW. Testing block page fixed.</li>
14-
<li>* Fix. Settings. Multisite option getting fixed.</li>
2+
<li>Fix. Options. CSite::GetList() usage fixed on non-variable reference cases.</li>
3+
<li>Fix. Settings. Improved key validation rules.</li>
4+
<li>Fix. Settings. Fixed settings tab render.</li>
5+
<li>Upd. Settings. Add custom server option. (#30)</li>
6+
<li>Fix. Settings. Complete deactivation fixed.</li>
7+
<li>Fix. Common. Add topics creation details.</li>
8+
<li>New. Constant. Ignore rule of 5 approved comments if "CLEANTALK__IGNORE_APPROVED_COMMENTS_COUNT_RULE" is defined</li>
9+
<li>Fix. Remote Calls. Getting home url fixed.</li>
10+
<li>Fix. Settings. Multisite Api-key saving fixed.</li>
1511
</ul>

cleantalk.antispam/include.php

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use Cleantalk\ApbctBitrix\SFW;
2424

2525
if ( ! defined( 'CLEANTALK_USER_AGENT' ) )
26-
define( 'CLEANTALK_USER_AGENT', 'bitrix-3.12.0' );
26+
define( 'CLEANTALK_USER_AGENT', 'bitrix-3.14.0' );
2727

2828
define('APBCT_TBL_FIREWALL_DATA', 'cleantalk_sfw'); // Table with firewall data.
2929
define('APBCT_TBL_FIREWALL_LOG', 'cleantalk_sfw_logs'); // Table with firewall logs.
@@ -182,7 +182,14 @@ public static function OnPageStartHandler()
182182
if( ! $USER->IsAdmin() ){
183183

184184
if ( $bot_detector ) {
185-
Asset::getInstance()->addJs('https://moderate.cleantalk.org/ct-bot-detector-wrapper.js');
185+
if (class_exists('COption')) {
186+
$use_custom_server = \COption::GetOptionString( 'cleantalk.antispam', 'use_custom_server', '' );
187+
if ($use_custom_server !== '') {
188+
Asset::getInstance()->addJs('https://moderate.' . $use_custom_server . '/ct-bot-detector-wrapper.js');
189+
} else {
190+
Asset::getInstance()->addJs('https://moderate.cleantalk.org/ct-bot-detector-wrapper.js');
191+
}
192+
}
186193
}
187194

188195
// Set cookies
@@ -771,19 +778,27 @@ static function OnBeforeMessageAddHandler(&$arFields) {
771778
array('AUTHOR_ID'=>$arFields['AUTHOR_ID'], 'APPROVED'=>'Y'),
772779
TRUE
773780
);
774-
if(intval($approved_messages) > 5) {
781+
if(intval($approved_messages) > 5 && !defined('CLEANTALK__IGNORE_APPROVED_COMMENTS_COUNT_RULE')) {
775782
return;
776783
}
777784
$aComment['sender_email'] = $USER->GetEmail();
778785
} else {
779786
$aComment['sender_email'] = isset($arFields['EMAIL']) ? $arFields['EMAIL'] : '';
780787
}
781788

782-
$aComment['type'] = 'comment';
783-
$aComment['sender_nickname'] = isset($arFields['AUTHOR_NAME']) ? $arFields['AUTHOR_NAME'] : '';
784-
$aComment['subject'] = '';
785-
$aComment['message'] = isset($arFields['POST_MESSAGE']) ? array($arFields['POST_MESSAGE']) : array();
786-
$aComment['example'] = array();
789+
if (isset($arFields['TITLE']) && isset($arFields['DESCRIPTION'])) {
790+
$aComment['type'] = 'topic_add';
791+
$aComment['sender_nickname'] = isset($arFields['LAST_POSTER_NAME']) ? $arFields['LAST_POSTER_NAME'] : '';
792+
$aComment['subject'] = isset($arFields['TITLE']) ? array($arFields['TITLE']) : '';
793+
$aComment['message'] = isset($arFields['DESCRIPTION']) ? array($arFields['DESCRIPTION']) : array();
794+
$aComment['example'] = array();
795+
} else {
796+
$aComment['type'] = 'comment';
797+
$aComment['sender_nickname'] = isset($arFields['AUTHOR_NAME']) ? $arFields['AUTHOR_NAME'] : '';
798+
$aComment['subject'] = '';
799+
$aComment['message'] = isset($arFields['POST_MESSAGE']) ? array($arFields['POST_MESSAGE']) : array();
800+
$aComment['example'] = array();
801+
}
787802

788803
if(COption::GetOptionInt('cleantalk.antispam', 'form_send_example', 0) == 1){
789804
$arTopic = CForumTopic::GetByID($arFields['TOPIC_ID']);
@@ -1263,7 +1278,17 @@ static function CheckAllBefore(&$arEntity, $bSendEmail = FALSE, $form_errors = n
12631278
}
12641279

12651280
$type = $arEntity['type'];
1266-
if($type != 'comment' && $type != 'webform' && $type != 'register' && $type != 'order' && $type != 'feedback_general_contact_form' && $type != 'private_message' && strpos($type, 'contact_form_bitrix') === false){
1281+
$allowed_types = array(
1282+
'topic_add',
1283+
'comment',
1284+
'webform',
1285+
'register',
1286+
'order',
1287+
'feedback_general_contact_form',
1288+
'private_message',
1289+
);
1290+
1291+
if(!in_array($type, $allowed_types) && strpos($type, 'contact_form_bitrix') === false){
12671292
CEventLog::Add(array(
12681293
'SEVERITY' => 'SECURITY',
12691294
'AUDIT_TYPE_ID' => 'CLEANTALK_E_INTERNAL',
@@ -1372,6 +1397,7 @@ static function CheckAllBefore(&$arEntity, $bSendEmail = FALSE, $form_errors = n
13721397
);
13731398

13741399
switch ($type) {
1400+
case 'topic_add':
13751401
case 'comment':
13761402
$timelabels_key = 'mail_error_comment';
13771403
if (is_array($arEntity['message'])) {
@@ -1382,11 +1408,10 @@ static function CheckAllBefore(&$arEntity, $bSendEmail = FALSE, $form_errors = n
13821408
}
13831409
$request_params['message'] = $arEntity['message'];
13841410
$request_params['example'] = $arEntity['example'];
1385-
$request_params['post_info']['comment_type'] = 'comment';
1411+
$request_params['post_info']['comment_type'] = $type;
13861412

13871413
$ct_request = new CleantalkRequest($request_params);
13881414
$ct_result = $ct->isAllowMessage($ct_request);
1389-
13901415
break;
13911416

13921417
case 'order':
@@ -1710,6 +1735,19 @@ static function GetCleanTalkResume($module, $id) {
17101735
*/
17111736
private static function GetWorkServer() {
17121737
global $DB;
1738+
1739+
if (class_exists('COption')) {
1740+
$use_custom_server = \COption::GetOptionString( 'cleantalk.antispam', 'use_custom_server', '' );
1741+
if ($use_custom_server !== '') {
1742+
return array(
1743+
'work_url' => 'http://moderate.' . $use_custom_server,
1744+
'server_url' => 'http://moderate.' . $use_custom_server,
1745+
'server_ttl' => 0,
1746+
'server_changed' => 0,
1747+
);
1748+
}
1749+
}
1750+
17131751
$result = $DB->Query('SELECT work_url,server_url,server_ttl,server_changed FROM cleantalk_server LIMIT 1')->Fetch();
17141752
if($result !== FALSE)
17151753
return array(
@@ -1750,7 +1788,17 @@ private static function ExceptionList($value = null)
17501788
*/
17511789
private static function SetWorkServer($work_url = 'https://moderate.cleantalk.org', $server_url = 'https://moderate.cleantalk.org', $server_ttl = 0, $server_changed = 0) {
17521790
global $DB;
1791+
17531792
$result = $DB->Query('SELECT count(*) AS count FROM cleantalk_server')->Fetch();
1793+
1794+
if (class_exists('COption')) {
1795+
$use_custom_server = \COption::GetOptionString( 'cleantalk.antispam', 'use_custom_server', '' );
1796+
if ($use_custom_server !== '') {
1797+
$work_url = 'http://moderate.' . $use_custom_server;
1798+
$server_url = 'http://moderate.' . $use_custom_server;
1799+
}
1800+
}
1801+
17541802
if($result['count'] == 0){
17551803
$arInsert = $DB->PrepareInsert(
17561804
'cleantalk_server',

cleantalk.antispam/install/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ function DoUninstall() {
150150
//Complete deactivation removes all the options
151151
if ( Option::get( 'cleantalk.antispam', 'complete_deactivation') == 1 ) {
152152
$ct_option_names = array_keys(Option::getForModule('cleantalk.antispam'));
153-
Option::delete('cleantalk.antispam',$ct_option_names);
153+
foreach ( $ct_option_names as $option_name ) {
154+
Option::delete('cleantalk.antispam', array('name' => $option_name));
155+
}
154156
}
155157

156158
if (IsModuleInstalled('blog')){
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22
$arModuleVersion = array(
3-
"VERSION" => "3.13.0",
4-
"VERSION_DATE" => "2024-10-14 10:00:00",
3+
"VERSION" => "3.14.0",
4+
"VERSION_DATE" => "2025-07-15 10:00:00",
55
);

cleantalk.antispam/lang/en/options.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,6 @@
5454
$MESS['CLEANTALK_WRONG_DEFAULT_SETTINGS'] = 'Can not load default options. Module name is incorrect.';
5555
$MESS['CLEANTALK_WRONG_CURRENT_SETTINGS'] = 'Can not load current options.';
5656
$MESS['CLEANTALK_RESET_OPTIONS_FAILED'] = 'Can not reset options to defaults.';
57-
$MESS['CLEANTALK_MULTISITE_LABEL_KEY'] = 'If you want to use specific Access Key for this website paste it here. Otherwise, leave it empty.';
57+
$MESS['CLEANTALK_MULTISITE_LABEL_KEY'] = 'If you want to use specific Access Key for this website paste it here. Otherwise, leave it empty.';
58+
$MESS['CLEANTALK_USE_CUSTOM_SERVER'] = 'Use custom server';
59+
$MESS['CLEANTALK_USE_CUSTOM_SERVER_DESCRIPTION'] = 'Use custom server for spam checking. You can enter cleantalk.ru and the plugin will use only ru servers. This option is for critical situations when it is impossible to choose the server automatically.';

cleantalk.antispam/lang/ru/options.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@
5454
$MESS['CLEANTALK_WRONG_DEFAULT_SETTINGS'] = 'Невоможно загрузить опции по умолчанию. Ошибка в имени модуля.';
5555
$MESS['CLEANTALK_WRONG_CURRENT_SETTINGS'] = 'Невоможно загрузить текущие опции.';
5656
$MESS['CLEANTALK_RESET_OPTIONS_FAILED'] = 'Невоможно сбросить опции.';
57-
$MESS['CLEANTALK_MULTISITE_LABEL_KEY'] = 'Если вы хотите использовать отдельный ключ доступа для этого сайта, вставьте его здесь. В противном случае оставьте поле пустым.';
57+
$MESS['CLEANTALK_MULTISITE_LABEL_KEY'] = 'Если вы хотите использовать отдельный ключ доступа для этого сайта, вставьте его здесь. В противном случае оставьте поле пустым.';
58+
$MESS['CLEANTALK_USE_CUSTOM_SERVER'] = 'Использовать кастомный сервер';
59+
$MESS['CLEANTALK_USE_CUSTOM_SERVER_DESCRIPTION'] = 'Использовать кастомный сервер для проверки спама. Можете ввести cleantalk.ru и плагин будет использовать только ru сервера. Опция для критических ситуаций, когда невозможен выбор сервера автоматически.';
60+
$MESS['CLEANTALK_SERVER_NOT_AVAILABLE'] = 'Указанные сервера не доступны, обратитесь в тех поддержку https://cleantalk.org/my/support/open';

0 commit comments

Comments
 (0)