Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RN v2.10.01 - All Issues
Author Message
Trubador
Regular
Regular



Joined: Dec 28, 2004
Posts: 94

PostPosted: Sat May 12, 2007 1:10 pm Reply with quote

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
 
View user's profile Send private message
Trubador







PostPosted: Sun May 13, 2007 11:48 am Reply with quote

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 Smile

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
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Sun May 20, 2007 7:53 am Reply with quote

Thanks Trub! I have verified this and will fix for 2.10.02.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
montego







PostPosted: Sat Jul 07, 2007 1:29 pm Reply with quote

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.
 
Susann
Moderator



Joined: Dec 19, 2004
Posts: 3191
Location: Germany:Moderator German NukeSentinel Support

PostPosted: Wed Oct 17, 2007 4:21 pm Reply with quote

Trubador thanks ! I just run into the same problem with my site and wondered why the censor is out of order.
 
View user's profile Send private message
Trubador







PostPosted: Thu Oct 18, 2007 3:07 am Reply with quote

NP Smile

Glad I can give something back.


Montego
Sorry I didnt reply to your previous posts I've been away for a few months in a very sandy place playing with fireworks. Thanks for verifying the code.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RN v2.10.01 - All Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©