miniBB ®  
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual | miniBB Mobile
qwerty miniBB Support Forums / qwerty /   

testing urls with )

Author andreasm
Registered
#1 | Posted: 31 May 2006 11:05 
On my forums, if I enter a url and directly a ) after it, it recognizes the ) as a part of the url.

Now it test it here with your newest version:

(http://www.test.de)
Author andreasm
Registered
#2 | Posted: 31 May 2006 11:07 
Author andreasm
Registered
#3 | Posted: 31 May 2006 11:08 
Seems that this bug (?) is also there in your newest version....

How can I prevent that?
Author realitybytes
Registered
#4 | Posted: 31 May 2006 23:53 
Author Ivan
Advanced Member
#5 | Posted: 1 Jun 2006 05:41 
You can prevent it no adding brackets :)
Author andreasm
Registered
#6 | Posted: 1 Jun 2006 12:18 
You say it so easy... but the problem is, that users in my forums often write something and add an url in brackets ...

The problem is, that users don't make a blank after the url!

Example:

"bla bla bla... I read something about this and that (you can read more about it here: http://www.externalurl.de) "
Author Team
8-)
#7 | Posted: 4 Jun 2006 11:49 
andreasm
it's not a bug cause some urls can contain brakets :)
how do you want to fix it? add spaces before ) ?


if so try this, in bb_func_txt change:


$patterns=array("#(^|[ \n])(https|http|ftp)://([0-9a-zA-Z$-_.+!*'(),&=\#~]+)#i", "#(^|[ \n])ftp\.([0-9a-zA-Z$-_.+!*'(),&=~]+)#i", "#(^|[ \n])www\.([0-9a-zA-Z$-_.+!*'(),&=~\#]+)#i");
$replacements=array('\\1<a href="\\2://\\3" target="_blank" rel="nofollow">\\2://\\3</a>', '\\1<a href="ftp://ftp.\\2" target="_blank" rel="nofollow">ftp.\\2</a>', '\\1<a href="http://www.\\2" target="_blank" rel="nofollow">www.\\2</a>');


to:

$patterns=array("#(^|[ \n])(https|http|ftp)://([0-9a-zA-Z$-_.+!*'(,&=\#~]+)(\))?#i", "#(^|[ \n])ftp\.([0-9a-zA-Z$-_.+!*'*,&=~]+)(\))?#i", "#(^|[ \n])www\.([0-9a-zA-Z$-_.+!*'(,&=~\#]+)(\))?#i");
$replacements=array('\\1<a href="\\2://\\3" target="_blank" rel="nofollow">\\2://\\3</a>\\4', '\\1<a href="ftp://ftp.\\2" target="_blank" rel="nofollow">ftp.\\2</a>\\3', '\\1<a href="http://www.\\2" target="_blank" rel="nofollow">www.\\2</a>\\3');
Author Team
8-)
#8 | Posted: 4 Jun 2006 11:50 
but note that in case you will use this solution ) brakets won't be allowed in urls.
Author andreasm
Registered
#9 | Posted: 4 Jun 2006 20:07 
Oh I didn't know that urls could contain brackets... I've never seen such urls :)


Thanks for that code!
Author andreasm
Registered
#10 | Posted: 5 Jun 2006 09:13 | Edited by: andreasm 
It would be the best if that pattern would detect only ) on the last position and cut that away.

Perhaps your code does this already?

I can't read that code, it's too complicated for me :)
Author Team
8-)
#11 | Posted: 7 Jun 2006 12:48 
andreasm
the code above should do it . It won't add ) to the url string.. it will leave the ) if detected at the end of the url.
Author Paul
CEO
#12 | Posted: 8 Jun 2006 12:05 
I think, it would be a better solution, if you add ')"' at the very bottom of bb_func_txt.php where it lists:

$text=str_replace(array('."', ',"', '-"', ':"', ';"'), '"', $text);

so it should be:

$text=str_replace(array('."', ',"', '-"', ':"', ';"', ')"'), '"', $text);

it will remove bracket from URL itself, but leave it in link.

It's the only efficient solution we could arrange in the next release.

But in general, the simpliest way is to separate URLs from any syntax text parts. It's a good manner of writing - you never lose the data.
qwerty miniBB Support Forums / qwerty / testing urls with ) Top
Your Reply Click this icon to move up to the quoted message
 Short link for this topic:

 ?
You are welcome to post anonymously, by entering a nickname with no password (if the similar Username has not been taken yet), or by leaving both fields empty. If you have a forums account, you can also sign in from this page without posting a message, or sign in and post at once.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
  Worried about forum enemies?
Pre-approve postings and members with the Premoderation add-on!
Premoderation addon for miniBB