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, блеать