Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: ymep on January 05, 2005, 03:54:27 AM

Title: [url] BBcode is not parsing "file://"
Post by: ymep on January 05, 2005, 03:54:27 AM
Hi Guys
I'm using smf as intranet forum
and sometimes I need that functionality to share some resources over MSNetwork or Samba
I used to phpBB. It was working correctly both with BBcode and simple html:


<a href=file:////computer_name//resource_name>\\Computer_name\resourse_name<a/>



[url=file:////computer_name//resource_name]\\Computer_name\resourse_name[/url]


it is looks like a link but if local IE user click this link hi is getting the resource
I think You know what I'm talking about...

How can I get that in SMF

Thanks,
Nikolay

Title: Re: [url] BBcode is not parsing "file://"
Post by: [Unknown] on January 05, 2005, 04:36:02 AM
We don't consider this to be working "correctly" in live (non-intranet) forums.  However, you can modify the code to make it do as you want... find this in Subs-Post.php:

if (!stristr($replace, $protocol . '://'))

Replace:

if (!stristr($replace, 'file://'))
$replace = stristr($replace, 'file://');
elseif (!stristr($replace, $protocol . '://'))


That should allow it.  Be careful, and remember that security isn't as high in these cases...

-[Unknown]
Title: Re: [url] BBcode is not parsing "file://"
Post by: ymep on January 05, 2005, 10:20:23 AM
Yes!
Its working  :D

Thanks a lot !!!
Title: Re: [url] BBcode is not parsing "file://"
Post by: jalsin on November 23, 2005, 01:13:38 PM
Hello -

I am using SMF 1.1 RC1 and attempting to link files.  I read below where I can locate "if (!stristr($replace, $protocol . '://'))" and change it to accept file:// as well.
But... I do not have that syntax in my Subs-Post.php file, therefore I am unsure what I need to do to be able to link to files.

Any suggestions would be great as I am new to PHP.

Thank you!

- joey
Title: Re: [url] BBcode is not parsing "file://"
Post by: doddy on January 27, 2006, 01:04:21 PM
Just wondering if you have magaed to fix this problem yet as I too want to be able to do this.

Any help would be appreciated!!

Cheers
Title: Re: [url] BBcode is not parsing "file://"
Post by: ibernet on April 02, 2013, 08:30:24 AM
you have a solution for version 2.x?
Title: Re: [url] BBcode is not parsing "file://"
Post by: Arantor on April 02, 2013, 10:10:13 AM
The url bbcode is expressly designed not to process file urls for security reasons, never mind that browsers have issues with it too when linking from an http resource to a file resource.

Why, exactly, do you need to do this?
Title: Re: [url] BBcode is not parsing "file://"
Post by: Oldiesmann on April 03, 2013, 03:00:59 PM
If you really want to do this...

Sources/Subs.php

Find (twice):
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)

Replace (twice):
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0 && strpos($data, \'file://\') !== 0)

Note that this will only fix it for the url tag. If you want it to auto-link file:// URLs as well, you'll have to hack the code a bit more.
Title: Re: [url] BBcode is not parsing "file://"
Post by: Arantor on April 03, 2013, 03:02:09 PM
That's not the only place in 2.0 you have to change it, there's also a place in the preparser where it validates the url tags.
Title: Re: [url] BBcode is not parsing "file://"
Post by: ibernet on April 18, 2014, 09:56:12 AM
Hi all,
can you help for resolve this problem?

I need make link in folder of my Intranet