Firefox PHP

seeking help-broken links

Posted by hilit 
seeking help-broken links
June 17, 2005 03:24PM
hello everyone

i have a problem on my phorum. if someone leaves a link with a question mark in it, the links comes out broken.

what can i do to solve that problem?

thanx to whoever is gonna help me
Re: seeking help-broken links
June 18, 2005 05:28AM
what means broken? how does he "leave" the link? with bbcode or what?

Re: seeking help-broken links
June 18, 2005 10:09AM
well, we leave the link with copy and paste. we mark the link. then we do "copy" and then we put it on the phorum through "paste"

if the link includes a question mark or a comma "," ---then it comes out broken -- that is to say, only part of it is the link itself and the other parts leads to owhere. if u press on the broken link , you reach nowhere.

here is an example of a link that comes out broken:

[www.ynet.co.il]
another example of a broken link
June 18, 2005 10:13AM
[phorum.org]


this is a link that comes out broken
Re: seeking help-broken links
June 18, 2005 10:57AM
phorum3 doesn't automatically convert bare links at all.
you need to either put them in < > or in bbcode and you still didn't tell which way you go ;).
Btw. which exact phorum-version do you use?

hilit
Re: seeking help-broken links
June 23, 2005 03:54AM
Hi again
The phorum version is : 3.4.4

So I understand that if someone writes a bare link
(e.g [www.ynet.co.il])
the link will not be "click-able".

Our problem is that the link gos "broken", meaning that the "click-able" link stops before the "?" character so when you click on the link the browser opens incomplete URL .
I assumed that it can be overcome by modifying the lines in the read_fuctions.php
more particulary line ~ 20:
$body=preg_replace("/&lt;((http|https|ftp):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%]+?)&gt;/i", "<a href=\"$1\" target=\"_blank\">$1</a>", $body);

but with no success...
Re: seeking help-broken links
June 23, 2005 04:46AM
line ~20 is for links in < and >, again, we do not convert bare links.
if it does for you then you must be using some addon or such.

hilit
Re: seeking help-broken links
June 23, 2005 09:23AM
Hi,

I believe I found the addon, this function is in the "read_function.php" file ( comes after the "// fix for double-newlines in pre-tags") :

function body_link($body)
{
{

$regex = "/((http:\/\/|www\.|http:\/\/www\.)[-.\/\d\w]+)/i";
$replace = "<a href=\"$1\">$1</a>";
$body = preg_replace($regex, $replace, $body);
}
return $body;
}

Since I don't manage regex I tried to find suitable expression instead of the above, at php.net but with no success.

Will appreciate if you can help
hilit
Re: seeking help-broken links
June 26, 2005 02:05AM
Hi,
At last we solved this bugging problem.

For whom it may concern, the addon is:
function body_link($body)
{
{
$regex = "/((http:\/\/|www\.|http:\/\/www\.)[-&=.\/\d\w\?]+)/i";
$replace = "<a href=\"$1\">$1</a>";
$body = preg_replace($regex, $replace, $body);
}
return $body;
}
in read_functions.php file just after the "nl2br($body)" function (line~115.

And:
$body=body_link($body);
in the read.php just after the line : $body=format_body($body); (line~490).


Also, I found an nice tutorial on regex in php that helped me (I hope I is OK to post it's link here):
[weblogtoolscollection.com]

thanks for all the help.
Sorry, you do not have permission to post/reply in this forum.