Advertisement:

Author Topic: [url] BBcode is not parsing "file://"  (Read 27112 times)

Offline ymep

  • Newbie
  • *
  • Posts: 2
[url] BBcode is not parsing "file://"
« 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:

Code: [Select]
<a href=file:////computer_name//resource_name>\\Computer_name\resourse_name<a/>

Code: [Select]
[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


Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: [url] BBcode is not parsing "file://"
« Reply #1 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:

Code: [Select]
if (!stristr($replace, $protocol . '://'))
Replace:

Code: [Select]
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]

Offline ymep

  • Newbie
  • *
  • Posts: 2
Re: [url] BBcode is not parsing "file://"
« Reply #2 on: January 05, 2005, 10:20:23 AM »
Yes!
Its working  :D

Thanks a lot !!!

Offline jalsin

  • Newbie
  • *
  • Posts: 1
Re: [url] BBcode is not parsing "file://"
« Reply #3 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

Offline doddy

  • Newbie
  • *
  • Posts: 1
Re: [url] BBcode is not parsing "file://"
« Reply #4 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

Offline ibernet

  • Semi-Newbie
  • *
  • Posts: 21
Re: [url] BBcode is not parsing "file://"
« Reply #5 on: April 02, 2013, 08:30:24 AM »
you have a solution for version 2.x?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,055
    • Arantor on GitHub
Re: [url] BBcode is not parsing "file://"
« Reply #6 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?
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: [url] BBcode is not parsing "file://"
« Reply #7 on: April 03, 2013, 03:00:59 PM »
If you really want to do this...

Sources/Subs.php

Find (twice):
Code: [Select]
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
Replace (twice):
Code: [Select]
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.
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,055
    • Arantor on GitHub
Re: [url] BBcode is not parsing "file://"
« Reply #8 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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline ibernet

  • Semi-Newbie
  • *
  • Posts: 21
Re: [url] BBcode is not parsing "file://"
« Reply #9 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