url bbcode hxxp: [nonactive] removal

Started by xerox8521, June 16, 2013, 12:09:35 PM

Previous topic - Next topic

xerox8521

Hi,

i have a problem with the url bbcode. I want to add a costum type of link but it always adds http:// infront which breaks the link.

it should look like [url=steam://connect/IP:Port]IP:Port[/url]

however after i click save it saves as [url=http://steam://connect/IP:Port]IP:Port[/url]

which breaks the steam://

PS: This is used for the news area on the top right corner

SwedishMarch1964

Go to http://photobucket.com

The easy way to upload your avatar. Just click the direct link.

MrPhil

In various places, such as Themes/Sources/Subs.php, the code checks for http:// and https://, and if neither is found, sticks http:// in front of what it presumes to be the URL. You can add another protocol, such as steam://, to the list of known protocols:
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;

becomes
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0 && strpos($data, \'steam://\') !==0)
$data = \'http://\' . $data;

for the [img] tag. Likewise for [iurl] and [url] tags.

There may well be some other places where the code looks for certain protocols, and not finding an expected one, shoves in http://. If the above changes don't catch all the places your steam:// is being ignored, you should do some more searching on this forum -- I know the subject has been discussed a number of times.

Rather than looking for http:// or https:// explicitly, it might be better to look for any explicit protocol ([a-zA-Z]+):// and leave it alone.

Advertisement: