 |
 |
 |
 |
Registered: 06/05/06
Posts: 709
|
|
|
 |
 |
 |
 |
|
 |
 |
 |
 |
|
Express Hosting
"We are the official hosting company of UBB.threads. Ask us about our free migration services to migrate your UBB.threads installation."
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#222326 - 02/13/09 05:33 AM
Re: URL link detection
[Re: Kayjey]
|
journeyman
|
Registered: 12/24/03
Posts: 94
Loc: Belgium
|
|
Okay... I actually didn't know anything about regex (they're REALLY Chinese for me), but after going through some documentation, I would presume the fix to be like this: In "libs" / "bbcode.inc.php" change:
$body = preg_replace('#(\n|\r|\]|^|\s|\(|<)([a-zA-Z0-9]+?)://(([a-zA-Z0-9\.\-\_\?=\#/&]|&)+)(>|<|\n|\r|$|,(\s|$)|\?(\s|$)|\)|\s|\.(\s|$))#ie', '\'$1\'.$this->handle_url(\'$2://$3\').\'$5\'', $body);
into
$body = preg_replace('#(\n|\r|\]|^|\s|\(|<)([a-zA-Z0-9]+?)://(([a-zA-Z0-9\.\-\_\?=\#/&]|&|[\+\%])+)(>|<|\n|\r|$|,(\s|$)|\?(\s|$)|\)|\s|\.(\s|$))#ie', '\'$1\'.$this->handle_url(\'$2://$3\').\'$5\'', $body);
and
$body = preg_replace('#(\n|\r|\]|^|\s|<|\()www\.(([a-zA-Z0-9\.\-\_\?&/\#=]|&)+)($|>|\)|,(\s|$)|\?(\s|$)|\)(\s|$)|\s|\.(\s|$))#ie', '\'$1\'.$this->handle_url(\'http://www.$2\',\'www.$2\').\'$4\'', $body);
into
$body = preg_replace('#(\n|\r|\]|^|\s|<|\()www\.(([a-zA-Z0-9\.\-\_\?&/\#=]|&|[\+\%])+)($|>|\)|,(\s|$)|\?(\s|$)|\)(\s|$)|\s|\.(\s|$))#ie', '\'$1\'.$this->handle_url(\'http://www.$2\',\'www.$2\').\'$4\'', $body);
basically adding "|[\+\%]" after the "amp;" to include plus and percent signs.
|
|
Top
|
|
|
|
|
 |
 |
 |
 |
|
|