Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: ymep in Januar 05, 2005, 03:54:27 VORMITTAG

Titel: [url] BBcode is not parsing "file://"
Beitrag von: ymep in Januar 05, 2005, 03:54:27 VORMITTAG
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

Titel: Re: [url] BBcode is not parsing "file://"
Beitrag von: [Unknown] in Januar 05, 2005, 04:36:02 VORMITTAG
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]
Titel: Re: [url] BBcode is not parsing "file://"
Beitrag von: ymep in Januar 05, 2005, 10:20:23 VORMITTAG
Yes!
Its working  :D

Thanks a lot !!!
Titel: Re: [url] BBcode is not parsing "file://"
Beitrag von: jalsin in November 23, 2005, 01:13:38 NACHMITTAGS
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
Titel: Re: [url] BBcode is not parsing "file://"
Beitrag von: doddy in Januar 27, 2006, 01:04:21 NACHMITTAGS
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
Titel: Re: [url] BBcode is not parsing "file://"
Beitrag von: ibernet in April 02, 2013, 08:30:24 VORMITTAG
you have a solution for version 2.x?
Titel: Re: [url] BBcode is not parsing "file://"
Beitrag von: Arantor in April 02, 2013, 10:10:13 VORMITTAG
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?
Titel: Re: [url] BBcode is not parsing "file://"
Beitrag von: Oldiesmann in April 03, 2013, 03:00:59 NACHMITTAGS
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.
Titel: Re: [url] BBcode is not parsing "file://"
Beitrag von: Arantor in April 03, 2013, 03:02:09 NACHMITTAGS
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.
Titel: Re: [url] BBcode is not parsing "file://"
Beitrag von: ibernet in April 18, 2014, 09:56:12 VORMITTAG
Hi all,
can you help for resolve this problem?

I need make link in folder of my Intranet