Well, in
functions.php, there is this function for the censorship system:
PHP Code:
// #############################################################################
/**
* Replaces any instances of words censored in $vbulletin->options['censorwords'] with $vbulletin->options['censorchar']
*
* @param string Text to be censored
*
* @return string
*/
function fetch_censored_text($text)
{
global $vbulletin;
static $censorwords;
if ($vbulletin->options['enablecensor'] AND !empty($vbulletin->options['censorwords']))
{
if (empty($censorwords))
{
$vbulletin->options['censorwords'] = preg_quote($vbulletin->options['censorwords'], '#');
$censorwords = preg_split('#[ \r\n\t]+#', $vbulletin->options['censorwords'], -1, PREG_SPLIT_NO_EMPTY);
}
foreach ($censorwords AS $censorword)
{
if (substr($censorword, 0, 2) == '\\{')
{
if (substr($censorword, -2, 2) == '\\}')
{
// prevents errors from the replace if the { and } are mismatched
$censorword = substr($censorword, 2, -2);
}
// ASCII character search 0-47, 58-64, 91-96, 123-127
$nonword_chars = '\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f';
// words are delimited by ASCII characters outside of A-Z, a-z and 0-9
$text = preg_replace(
'#(?<=[' . $nonword_chars . ']|^)' . $censorword . '(?=[' . $nonword_chars . ']|$)#si',
str_repeat($vbulletin->options['censorchar'], vbstrlen($censorword)),
$text
);
}
else
{
$text = preg_replace("#$censorword#si", str_repeat($vbulletin->options['censorchar'], vbstrlen($censorword)), $text);
}
}
}
// strip any admin-specified blank ascii chars
$text = strip_blank_ascii($text, $vbulletin->options['censorchar']);
return $text;
}
I have add the following code inside the function
build_new_post of
functions_newpost.php
PHP Code:
// Censorship Warning
$iwarncens = fetch_censored_text($post['message']);
if ($iwarncens != $post['message'])
{
$dataman->error('iwarn');
}
And... when a user try to post a message with one or more words which they are in censor word list, it appears an error message (with the phrase "iwarn").
My problem is that the system appears this warning message AND it replace the characters with the censor character (*).
I don't want to replace the characters! (I need only the error message - not the appearance of which word is in the censorship's word list).
some screens:
1.
2.
What to do?
Thanks and sorry for my bad english!
-peter