mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 22:03:49 -07:00
feat: Added StopForumSpam
integration
This commit is contained in:
parent
eabf851ee6
commit
a73f6ab70e
4 changed files with 92 additions and 12 deletions
|
@ -55,6 +55,7 @@
|
||||||
"claviska/simpleimage": "^4.0",
|
"claviska/simpleimage": "^4.0",
|
||||||
"belomaxorka/captcha": "1.*",
|
"belomaxorka/captcha": "1.*",
|
||||||
"egulias/email-validator": "^4.0.1",
|
"egulias/email-validator": "^4.0.1",
|
||||||
|
"resolventa/stopforumspam-php-api": "2.0.0",
|
||||||
"filp/whoops": "^2.15",
|
"filp/whoops": "^2.15",
|
||||||
"z4kn4fein/php-semver": "^v3.0.0",
|
"z4kn4fein/php-semver": "^v3.0.0",
|
||||||
"gigablah/sphinxphp": "2.0.8",
|
"gigablah/sphinxphp": "2.0.8",
|
||||||
|
|
53
composer.lock
generated
53
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "ed0c6f72e121f5b35712c0855bc64a82",
|
"content-hash": "f6d6bb6e8a17a431f0cd91349e8ad6e0",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "arokettu/bencode",
|
"name": "arokettu/bencode",
|
||||||
|
@ -2800,6 +2800,57 @@
|
||||||
},
|
},
|
||||||
"time": "2019-03-08T08:55:37+00:00"
|
"time": "2019-03-08T08:55:37+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "resolventa/stopforumspam-php-api",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ResolventaGroup/StopForumSpam-PHP-API.git",
|
||||||
|
"reference": "58ba2beb255cb8be504163e24a66525a3e921a52"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/ResolventaGroup/StopForumSpam-PHP-API/zipball/58ba2beb255cb8be504163e24a66525a3e921a52",
|
||||||
|
"reference": "58ba2beb255cb8be504163e24a66525a3e921a52",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-curl": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"php": ">=8.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fzaninotto/faker": "^1.8",
|
||||||
|
"phpunit/phpunit": "^9"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Resolventa\\StopForumSpamApi\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Dmitry Pankin",
|
||||||
|
"email": "dpankin@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP API for StopForumSpam service. See https://www.stopforumspam.com for details.",
|
||||||
|
"keywords": [
|
||||||
|
"api",
|
||||||
|
"php",
|
||||||
|
"stopforumspam"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/ResolventaGroup/StopForumSpam-PHP-API/issues",
|
||||||
|
"source": "https://github.com/ResolventaGroup/StopForumSpam-PHP-API/tree/2.0.0"
|
||||||
|
},
|
||||||
|
"time": "2022-06-06T07:48:27+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "samdark/sitemap",
|
"name": "samdark/sitemap",
|
||||||
"version": "2.4.1",
|
"version": "2.4.1",
|
||||||
|
|
|
@ -408,6 +408,7 @@ $bb_cfg['max_last_visit_days'] = 14; // days
|
||||||
$bb_cfg['last_visit_update_intrv'] = 3600; // sec
|
$bb_cfg['last_visit_update_intrv'] = 3600; // sec
|
||||||
|
|
||||||
// Registration
|
// Registration
|
||||||
|
$bb_cfg['use_stop_forum_spam_service'] = true; // Use StopForumSpam service to prevent registering for spam users
|
||||||
$bb_cfg['invalid_logins'] = 5; // Max incorrect password submits before showing captcha
|
$bb_cfg['invalid_logins'] = 5; // Max incorrect password submits before showing captcha
|
||||||
$bb_cfg['new_user_reg_disabled'] = false; // Disable registration of new users
|
$bb_cfg['new_user_reg_disabled'] = false; // Disable registration of new users
|
||||||
$bb_cfg['unique_ip'] = false; // Disallow registration from multiple IP addresses
|
$bb_cfg['unique_ip'] = false; // Disallow registration from multiple IP addresses
|
||||||
|
|
|
@ -582,6 +582,35 @@ if ($submit && !$errors) {
|
||||||
* Создание нового профиля
|
* Создание нового профиля
|
||||||
*/
|
*/
|
||||||
if ($mode == 'register') {
|
if ($mode == 'register') {
|
||||||
|
if (!IS_ADMIN) {
|
||||||
|
$db_data['user_reg_ip'] = USER_IP;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check StopForumSpam
|
||||||
|
$spamUserDetected = false;
|
||||||
|
if ($bb_cfg['use_stop_forum_spam_service'] && !IS_ADMIN) {
|
||||||
|
$stopForumSpamApi = new \Resolventa\StopForumSpamApi\StopForumSpamApi();
|
||||||
|
$stopForumSpamApi
|
||||||
|
->checkEmail($db_data['user_email'])
|
||||||
|
->checkIp($db_data['user_reg_ip'])
|
||||||
|
->checkUsername($db_data['username']);
|
||||||
|
$response = $stopForumSpamApi->getCheckResponse();
|
||||||
|
$analyzer = new \Resolventa\StopForumSpamApi\ResponseAnalyzer(new \Resolventa\StopForumSpamApi\ResponseAnalyzerSettings());
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($analyzer->isSpammerDetected($response)) {
|
||||||
|
bb_die('');
|
||||||
|
$spamUserDetected = true;
|
||||||
|
}
|
||||||
|
} catch (\Resolventa\StopForumSpamApi\Exception\StopForumSpamApiException $e) {
|
||||||
|
bb_die('[StopForumSpamApi] Bad response: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($spamUserDetected) {
|
||||||
|
$db_data['user_active'] = 0;
|
||||||
|
$db_data['user_actkey'] = '';
|
||||||
|
} else {
|
||||||
if ($bb_cfg['reg_email_activation']) {
|
if ($bb_cfg['reg_email_activation']) {
|
||||||
$user_actkey = make_rand_str(ACTKEY_LENGTH);
|
$user_actkey = make_rand_str(ACTKEY_LENGTH);
|
||||||
$db_data['user_active'] = 0;
|
$db_data['user_active'] = 0;
|
||||||
|
@ -590,12 +619,10 @@ if ($submit && !$errors) {
|
||||||
$db_data['user_active'] = 1;
|
$db_data['user_active'] = 1;
|
||||||
$db_data['user_actkey'] = '';
|
$db_data['user_actkey'] = '';
|
||||||
}
|
}
|
||||||
$db_data['user_regdate'] = TIMENOW;
|
|
||||||
|
|
||||||
if (!IS_ADMIN) {
|
|
||||||
$db_data['user_reg_ip'] = USER_IP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$db_data['user_regdate'] = TIMENOW;
|
||||||
|
|
||||||
if (!isset($db_data['tpl_name'])) {
|
if (!isset($db_data['tpl_name'])) {
|
||||||
$db_data['tpl_name'] = (string)$bb_cfg['tpl_name'];
|
$db_data['tpl_name'] = (string)$bb_cfg['tpl_name'];
|
||||||
}
|
}
|
||||||
|
@ -618,7 +645,7 @@ if ($submit && !$errors) {
|
||||||
if (IS_ADMIN) {
|
if (IS_ADMIN) {
|
||||||
set_pr_die_append_msg($new_user_id);
|
set_pr_die_append_msg($new_user_id);
|
||||||
$message = $lang['ACCOUNT_ADDED'];
|
$message = $lang['ACCOUNT_ADDED'];
|
||||||
} else {
|
} elseif (!$spamUserDetected) {
|
||||||
if ($bb_cfg['reg_email_activation']) {
|
if ($bb_cfg['reg_email_activation']) {
|
||||||
$message = $lang['ACCOUNT_INACTIVE'];
|
$message = $lang['ACCOUNT_INACTIVE'];
|
||||||
$email_subject = sprintf($lang['EMAILER_SUBJECT']['USER_WELCOME_INACTIVE'], $bb_cfg['sitename']);
|
$email_subject = sprintf($lang['EMAILER_SUBJECT']['USER_WELCOME_INACTIVE'], $bb_cfg['sitename']);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue