Post.controller.php
Найти:
if (!isset($_POST['message']) || Util::htmltrim(Util::htmlspecialchars($_POST['message'], ENT_QUOTES)) === '')
$post_errors->addError('no_message');
elseif (!empty($modSettings['max_messageLength']) && Util::strlen($_POST['message']) > $modSettings['max_messageLength'])
$post_errors->addError(array('long_message', array($modSettings['max_messageLength'])));
1 вариант
Добавить ПОСЛЕ:
// no links if user is guest
elseif ($user_info['is_guest'] && preg_match('~https?:\/\/~siu', $_POST['message']))
{
$post_errors->addError('Guests are not allowed to post links. / Гостям запрещено оставлять ссылки.');
}
2 вариант (более строгий, чем 1 вариант)
Добавить ПОСЛЕ:
// antispam: no links if user is guest
elseif ($user_info['is_guest'] && preg_match('~https?:\/\/~siu', $_POST['message']))
{
$post_errors->addError('Guests are not allowed to post links. / Гостям запрещено оставлять ссылки.');
}
// antispam: if member is now register
elseif (!$user_info['is_guest'] && $user_info['posts'] < 5 && preg_match('~https?:\/\/~siu', $_POST['message']))
{
$post_errors->addError('Members who have less than 5 posts cannot post links. / Пользователи у которых меньше 5 сообщений не могут оставлять ссылки.');
}
// antispam: if < 50 posts - max 3 links
elseif (!$user_info['is_guest'] && $user_info['posts'] < 50 && preg_match_all('~https?:\/\/~siu', $_POST['message'], $spam_matches, PREG_SET_ORDER))
{
if (count($spam_matches) > 3) {
$post_errors->addError('you have a lot of links in the message (max - 3 links) / у вас много ссылок в сообщении (максимум - 3 ссылки)');
}
unset($spam_matches);
}
3 вариант (круче первых двух)
Добавить ПОСЛЕ:
// antispam: no links in message if user is guest
elseif ($user_info['is_guest'] && preg_match('~https?:\/\/~siu', $_POST['message']))
{
$post_errors->addError('Guests are not allowed to post links. / Гостям запрещено оставлять ссылки.');
}
// antispam: no links in subject if user is guest
elseif ($user_info['is_guest'] && preg_match('~https?:\/\/~siu', $_POST['subject']))
{
$post_errors->addError('Guests are not allowed to post links. / Гостям запрещено оставлять ссылки.');
}
// antispam: no links if user name include "xrumer"
elseif ($user_info['is_guest'] && preg_match('~XRumer~siu', $_POST['guestname']))
{
$post_errors->addError('Bad name');
}
// antispam: if member is now register
elseif (!$user_info['is_guest'] && $user_info['posts'] < 5 && preg_match('~https?:\/\/~siu', $_POST['message']))
{
$post_errors->addError('Members who have less than 5 posts cannot post links. / Пользователи у которых меньше 5 сообщений не могут оставлять ссылки.');
}
// antispam: if < 50 posts - max 3 links
elseif (!$user_info['is_guest'] && $user_info['posts'] < 50 && preg_match_all('~https?:\/\/~siu', $_POST['message'], $spam_matches, PREG_SET_ORDER))
{
if (count($spam_matches) > 3) {
$post_errors->addError('you have a lot of links in the message (max - 3 links) / у вас много ссылок в сообщении (максимум - 3 ссылки)');
}
unset($spam_matches);
}
Боты must die, блеать :trollface:
Боты начали добавлять ссылки в название темы :trollface:
@TOO: добавить запрет на создание тем, количеством более 10 за день для новых пользователей, проверяя их дату регистрации.
@TOO 2: добавить запрет на создание ответов, не более 1 подряд, для новых пользователей, проверяя их дату регистрации. В день создавать не более 50-70 ответов.
Хитрые боты: ссылки добавляют в подписи
Новая версия:
// antispam: no links in message if user is guest
elseif ($user_info['is_guest'] && preg_match('~https?:\/\/~siu', $_POST['message']))
{
$post_errors->addError('Guests are not allowed to post links. / Гостям запрещено оставлять ссылки.');
}
// antispam: no links in subject if user is guest
elseif ($user_info['is_guest'] && preg_match('~https?:\/\/~siu', $_POST['subject']))
{
$post_errors->addError('Guests are not allowed to post links. / Гостям запрещено оставлять ссылки.');
}
// antispam: no links if user name include "xrumer" or "xevil"
elseif ($user_info['is_guest'] && preg_match('~XRumer|XEvil~siu', $_POST['guestname']))
{
$post_errors->addError('Bad name');
}
// antispam: no links if guest subject include "xrumer" or "xevil"
elseif ($user_info['is_guest'] && preg_match('~XRumer|XEvil~siu', $_POST['subject']))
{
$post_errors->addError('Bad message! Antispam. Guests can not use words: XRumer, XEvil');
}
// antispam: no links if guest message include "xrumer" or "xevil"
elseif ($user_info['is_guest'] && preg_match('~XRumer|XEvil~siu', $_POST['message']))
{
$post_errors->addError('Bad message! Antispam. Guests can not use words: XRumer, XEvil');
}
// antispam: if member is now register
elseif (!$user_info['is_guest'] && $user_info['posts'] < 5 && preg_match('~https?:\/\/~siu', $_POST['message']))
{
$post_errors->addError('Members who have less than 5 posts cannot post links. / Пользователи у которых меньше 5 сообщений не могут оставлять ссылки.');
}
// antispam: if < 50 posts - max 3 links
elseif (!$user_info['is_guest'] && $user_info['posts'] < 50 && preg_match_all('~https?:\/\/~siu', $_POST['message'], $spam_matches, PREG_SET_ORDER))
{
if (count($spam_matches) > 3) {
$post_errors->addError('you have a lot of links in the message (max - 3 links) / у вас много ссылок в сообщении (максимум - 3 ссылки)');
}
unset($spam_matches);
}
Спаммеры z@ебали :rage:
Начали спамить страницу контактов :rage: