bb code fix

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
crazyd1415
Registered User
Posts: 63
Joined: Mon May 13, 2002 3:41 am

bb code fix

Post by crazyd1415 »

bb code fix for 2.04? is 2.04 even affected because I dont see some of the lines of code to replace.
JinFury
Registered User
Posts: 972
Joined: Thu May 01, 2003 6:39 pm
Location: Lala Land
Contact:

Post by JinFury »

It says its affected but the lines of code don't match..
User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34457
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Post by A_Jelly_Doughnut »

The idea is to upgrade to the latest version, then patch it.
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish
deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Location: Find-Ip-Address.org
Contact:

Fix

Post by deny »

After replacing code for phpBB 2.0.4 with BBcode fix (i've replaced whole block no matter that it does not match completly) everything seems to works fine expect one things.It is not anymore possible to post as
This url replacing does not works on my board

Is it fix or something wrong with code?


Google
User avatar
kawaja
Registered User
Posts: 17
Joined: Wed Apr 16, 2003 5:20 pm

Re: Fix

Post by kawaja »

deny wrote: It is not anymore possible to post as This url replacing does not works on my board

Is it fix or something wrong with code?


2.0.4 here with exact same problem for me, ideas anyone?
your welcome.
Drowelf
Registered User
Posts: 393
Joined: Sat Aug 02, 2003 9:49 pm
Location: USA
Contact:

Post by Drowelf »

dunno, sorry my best advice is to download 2.0.6 or .5 if u could find it
Drowelf - Bringing you AntiAdmin entertainment since 1997
User avatar
Margarita
Registered User
Posts: 183
Joined: Fri Mar 28, 2003 4:05 am

Post by Margarita »

some people have heavily moded boards .. and upgrading may not be an attractive option .... the install notes for the fix did say that it was for 2.0.4 also .... but like everyone has already said .. the code does not match. 8O

Miss Margarita has no plans to update before 2.2 is released :) ... so I'll just deactivate the HTML "a" tag for now ... or maybe even disable HTML until 2.2 is out.
User avatar
kawaja
Registered User
Posts: 17
Joined: Wed Apr 16, 2003 5:20 pm

Post by kawaja »

Margarita wrote: the install notes for the fix did say that it was for 2.0.4

psoTFX wrote: A change was made to the way bbcode url matching is achieved around phpBB 2.0.4.


around 2.0.4, perhaps not 2.0.4...i dunno.
Margarita wrote: Miss Margarita has no plans to update before 2.2 is released :) ... so I'll just deactivate the HTML "a" tag for now ... or maybe even disable HTML until 2.2 is out.


isnt this about bbcode and not html tags? i disabled "a" tags a while ago.
your welcome.
User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34457
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Post by A_Jelly_Doughnut »

Yes, this is BBCode, as well as <a>
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish
deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Location: Find-Ip-Address.org
Contact:

Call to phpBB Team for help for fixing code for phpBB 2.0.4!

Post by deny »

Again call to phpBB Team for help for fixing code for phpBB 2.0.4!!!
Below are lines and different:



Find the following section of code (use your editors search facility or simply scroll through the file):

Code: Select all

$bbcode_tpl['url4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']); 
   $bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\5', $bbcode_tpl['url4']);



Replace all of the above with:

Code: Select all

$bbcode_tpl['url4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']); 
   $bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['url4']);



This is ok!

Then they said
Find:

Code: Select all

// matches a [url]xxxx://www.phpbb.com[/url] code.. 
   $patterns[] = "#\[url\]([\w]+?://.*?[^ \"\n\r\t<]*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url1']; 

   // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix). 
   $patterns[] = "#\[url\]((www|ftp)\.([\w\-]+\.)*?[\w\-]+\.[a-z]{2,4}(:?[0-9]*?/[^ \"\n\r\t<]*)?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url2']; 

   // [url=xxxx://www.phpbb.com]phpBB[/url] code.. 
   $patterns[] = "#\[url=([\w]+?://.*?[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url3']; 

   // [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix). 
   $patterns[] = "#\[url=((www|ftp)\.([\w\-]+\.)*?[\w\-]+\.[a-z]{2,4}(:?[0-9]*?/[^ \"\n\r\t<]*)?)\](.*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url4']; 



Replace above with:

Code: Select all

// matches a [url]xxxx://www.phpbb.com[/url] code.. 
   $patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url1']; 

   // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix). 
   $patterns[] = "#\[url\]((www|ftp)\.[^ \"\n\r\t<]*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url2']; 

   // [url=xxxx://www.phpbb.com]phpBB[/url] code.. 
   $patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url3']; 

   // [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix). 
   $patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url4']; 




Here is problem because my bbcode show this line:

:

Code: Select all

// [url]xxxx://www.phpbb.com[/url] code.. 
   $patterns[] = "#\[url\]([a-z0-9]+?://){1}([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url1']; 

   // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix). 
   $patterns[] = "#\[url\]((www|ftp)\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\[/url\]#si"; 
   $replacements[] = $bbcode_tpl['url2']; 

   // [url=xxxx://www.phpbb.com]phpBB[/url] code.. 
   $patterns[] = "#\[url=([a-z0-9]+://)([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\](.*?)\[/url\]#si"; 
   $replacements[] = $bbcode_tpl['url3']; 

   // [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix). 
   $patterns[] = "#\[url=(([\w\-]+\.)*?[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)\](.*?)\[/url\]#si"; 
   $replacements[] = $bbcode_tpl['url4']; 

It is not exactly same.Help!!!


ANd finally they said:

Code: Select all

// matches an "xxxx://yyyy" URL at the start of a line, or after a space. 
   // xxxx can only be alpha characters. 
   // yyyy is anything up to the first space, newline, comma, double quote or < 
   $ret = preg_replace("#(^|[\n ])([\w]+?://.*?[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); 

   // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing 
   // Must contain at least 2 dots. xxxx contains either alphanum, or "-" 
   // zzzz is optional.. will contain everything up to the first space, newline, 
   // comma, double quote or <. 
   $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\-]+\.[\w\-.\~]+(?:/[^ \"\t\n\r<]*)?)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);  


Replace above with:

Code: Select all

//matches an "xxxx://yyyy" URL at the start of a line, or after a space. 
   // xxxx can only be alpha characters. 
   // yyyy is anything up to the first space, newline, comma, double quote or < 
   $ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); 

   // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing 
   // Must contain at least 2 dots. xxxx contains either alphanum, or "-" 
   // zzzz is optional.. will contain everything up to the first space, newline, 
   // comma, double quote or <. 
   $ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); 



And my bbcode show this line:

Code: Select all

   // matches an "xxxx://yyyy" URL at the start of a line, or after a space. 
   // xxxx can only be alpha characters. 
   // yyyy is anything up to the first space, newline, comma, double quote or < 
   $ret = preg_replace("#([\t\r\n ])([a-z0-9]+?){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i", '\1<a href="\2://\3" target="_blank">\2://\3</a>', $ret); 

   // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing 
   // Must contain at least 2 dots. xxxx contains either alphanum, or "-" 
   // zzzz is optional.. will contain everything up to the first space, newline, 
   // comma, double quote or <. 
   $ret = preg_replace("#([\t\r\n ])(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i", '\1<a href="http://\2.\3" target="_blank">\2.\3</a>', $ret); 

Please help for phpBB 2.0.4!!!

Thanks
User avatar
kawaja
Registered User
Posts: 17
Joined: Wed Apr 16, 2003 5:20 pm

Re: Call to phpBB Team for help for fixing code for phpBB 2.

Post by kawaja »

deny wrote: Again call to phpBB Team for help for fixing code for phpBB 2.0.4!!!

Please help for phpBB 2.0.4!!!


yeah, second, third and ... n that request. the announcement mentioned emailing psoTFX on issues with the patch which i did last night.

someone on the team seeing this thread? (uh, pretty please)
your welcome.
User avatar
kawaja
Registered User
Posts: 17
Joined: Wed Apr 16, 2003 5:20 pm

Post by kawaja »

*bump*

hope someone will respond with a solution soon.
your welcome.
deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Location: Find-Ip-Address.org
Contact:

Bump

Post by deny »

*BUMP*

It is really annoyng this kind of help.I've been send mail yesterday but i'm afraid that nobody care about responsing and writing good code for phpBB 2.0.4 !
Przemo
Registered User
Posts: 20
Joined: Fri Apr 04, 2003 11:27 pm
Contact:

Post by Przemo »

vulnerability in phpBB 2.0.6 (which also affects 2.0.4 and 2.0.5)

Is 2.0.3. safe or maybe I have to update it? I have fix previous issues.
http://przemo.org/phpBB2/ - full modified phpBB
User avatar
kawaja
Registered User
Posts: 17
Joined: Wed Apr 16, 2003 5:20 pm

Post by kawaja »

just want to be clear what works and what does not for 2.0.4.

Code: Select all

 works :

[url]www.site.com[/url]
[url]http://www.site.com[/url]
[url=www.site.com]site link[/url]

does not work :

[url=http://www.site.com]site link[/url]
the "does not work" shows nothing in message, like the text is not there...my guess is the entire string is getting (?)chomped(?) out based on an expression filter. so far, i am unable to see the problem in the code, but there must be one.
your welcome.
Locked

Return to “2.0.x Support Forum”