Trubador
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/blank.gif)
Joined: Dec 28, 2004
Posts: 94
|
Posted:
Sat May 12, 2007 1:10 pm |
|
I seem to have a little problem with the Forums word censor after updating from 7.4 phpbb 2.0.14 to RN.
It works in Post preview and Topic Review when posting, but not in view topic.
I've had a little hunt around the net and cant find much on the subject or any bug reports for either Nuke or phpbb.
Is anyone else having the same problem?
Cheers Trub |
|
|
Trubador
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun May 13, 2007 11:48 am |
|
OK......
Found a fix, however its taken from the original Nuke 7.4 and found a little errrr.... discrepancy.
To fix the Forums censor not working in RN 2.10.00/01
Open modules/Forums/viewtopic.php
Find
Code: if (count($orig_word))
{
$post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
if ($user_sig != '')
{
$user_sig = str_replace('\"', '"', substr(@preg_replace('#(\> / /(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
}
$message = str_replace('\"', '"', substr(@preg_replace('#(\> / /(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
}
|
replace with
Code: if (count($orig_word))
{
$post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
if ($user_sig != '')
{
$user_sig = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
}
$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
}
|
Forums censor now works again
I would like someone to confirm the fault and fix please. Also review the code change incase I've managed to create a security hole.
Now the discrepancy.
in includes/functions.php where the Function for function obtain_word_list is.
On line 682 the preg_quote has changed from 7.4
RN
Code: $orig_word[] = '#\b(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')\b#i';
|
nuke 7.4
Code: $orig_word[] = '#\b(' . str_replace('\*', '\w*?', phpbb_preg_quote($row['word'], '#')) . ')\b#i';
|
I thought originally that this may of been the error. But have tested both codes on RN with no visable effects after the fix above. Again, i dont know if this is a script problem or not.
TTFN
Trub |
|
|
montego
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Jul 07, 2007 1:29 pm |
|
Trubador, sorry, just now getting to this finally.
In your first example given, I have made the change with the exception of I left the "@" sign on the @preg_replace. All this does is force PHP to not show any errors if there ends up being any with this function call. This is usually done to prevent exposure of absolute paths and other things. Won't harm anything.
In your second example, unless you are running an extremely old version of PHP, this is unnecessary. In fact, phpBB has removed ALL calls to this function phpbb_preg_quote throughout its code. They just have not removed the function definition itself.
Thanks again for highlighting this. The fix will be in 2.20.00 instead of a 2.10.02. |
|
|