не самая критичная проблема форумов, но она существует
пользователь может зафлудить форум вводя много раз пустые теги (можно даже в поле сообщения просто ввести пустые строки)
открыть
Код: Выделить всё
includes/bbcode.php
Код: Выделить всё
function bbencode_first_pass($text, $uid)
{
Код: Выделить всё
//
// +Disable empty messages
if ( PHP_VERSION >= '5.1.0' )
{
function preg_replace_rec($pattern, $replacement, $subject)
{
$count = 0;
do {
$subject = preg_replace($pattern, $replacement, $subject, -1, $count);
} while ( $count );
return $subject;
}
} else {
function preg_replace_rec($pattern, $replacement, $subject)
{
$count = 0;
do {
$result = preg_replace($pattern, $replacement, $subject);
$count = strcmp($result, $subject);
$subject = $result;
} while ( $count );
return $subject;
}
}
function bbencode_first_pass($text, $uid)
{
$text = preg_replace_rec(
array(
'/(\r?\n\r?){3,}/',
'/\[(b|i|u|quote|code|img|url)\]\s*\[\/\1\]/',
'/\[(quote|img|url|list|color|size|youtube)[^\]]*\]\s*\[\/\1\]/',
),
array(
'\1',
'',
'',
),
$text);
// -Disable empty messages
//
Код: Выделить всё
includes/functions_post.php
Код: Выделить всё
$message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
}
Код: Выделить всё
$message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
//
// +Disable empty messages
if ( empty($message) )
{
$error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
}
// -Disable empty messages
//
}
Код: Выделить всё
privmsg.php
Код: Выделить всё
$privmsg_message = prepare_message($HTTP_POST_VARS['message'], $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
Код: Выделить всё
//
// +Disable empty messages
if ( empty($privmsg_message) )
{
$error = true;
$error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_message'];
}
// -Disable empty messages
//