adm/style/acp_words.html заменить
Код: Выделить всё
<dd><input id="replacement" type="text" name="replacement" value="{REPLACEMENT}" maxlength="255" /></dd>
Код: Выделить всё
<dd><textarea id="replacement" name="replacement">{REPLACEMENT}</textarea></dd>
Код: Выделить всё
$word = utf8_normalize_nfc(request_var('word', '', true));
$replacement = utf8_normalize_nfc(request_var('replacement', '', true));
Код: Выделить всё
$replacement=utf8_substr($replacement, 0, 255);
Код: Выделить всё
function censor_text($text)
Код: Выделить всё
function censor_text($text, $html=false)
Код: Выделить всё
if (sizeof($censors))
{
return preg_replace($censors['match'], $censors['replace'], $text);
}
Код: Выделить всё
if (sizeof($censors))
{
if(!isset($censors['match_html']) && !isset($censors['match_nohtml']))
{
foreach($censors['replace'] as $k => $v)
{
if(preg_match('/<\w+/', $v))
{
$censors['match_html'][$k]=$censors['match'][$k];
$censors['replace_html'][$k]=htmlspecialchars_decode($v);
}
else
{
$censors['match_html'][$k]=$censors['match'][$k];
$censors['replace_html'][$k]=$censors['replace'][$k];
$censors['match_nohtml'][$k]=$censors['match'][$k];
$censors['replace_nohtml'][$k]=$censors['replace'][$k];
}
}
}
if($html && isset($censors['match_html']) && sizeof($censors['match_html']))
{
return preg_replace($censors['match_html'], $censors['replace_html'], $text);
}
else if(isset($censors['match_nohtml']) && sizeof($censors['match_nohtml']))
{
return preg_replace($censors['match_nohtml'], $censors['replace_nohtml'], $text);
}
else
{
return $text;
}
}
/*if (sizeof($censors))
{
if(!isset($censors['no_html']))
{
$censors['replace']=array_map('htmlspecialchars_decode', $censors['replace']);
$censors['no_html']=array_map('strip_tags', $censors['replace']);
}
return preg_replace($censors['match'], ($html ? $censors['replace'] : $censors['no_html']), $text);
}*/
Код: Выделить всё
// Parse the message and subject
$message = censor_text($row['post_text']);
Код: Выделить всё
// Parse the message and subject
$message = censor_text($row['post_text'], true);
Адм. раздел
Оригинал сообщения
Результат
1. Ограничение на длину текста в замене - 255 символов
2. Замена с html кодом работает только на странице списка сообщений (и только в сообщениях)
3. Т.к. функция автоцензора отключаемая (настраивается в правах), необходимо включить её (запретить отключение) для нужных групп пользователей