TS3 / Steam / Application Links

Started by SniperFodder, November 19, 2010, 05:23:37 AM

Previous topic - Next topic

SniperFodder

I take that back, It does add http://. However, If a URL is prefaced with :// then it will just not add the http part. Adding protocols to the list is not ideal because there are literally hundreds of application links out there. The few I know of are steam:// and ts3server://. You can't possibly add every application out there to the list.

So instead, how about SMF does several checks/functions. First it sees if :// is prefixed to the url string. If it isn't, smf could then decide to add http:// to the beginning of the url. Otherwise as far as the anchor tag is concerned, as long as there is a <protocal name>:// prefixed to the string, it doesn't care.

Otherwise, if it's a malformed URL, it's not going to work anyways. It's up to the user himself to police his urls. If he links something and it doesn't work, it should be because he misspelled something, not because the forum software decided it needed http:// in front of it.

But that's just my 2cents.

As I understand it... SMF is moving onto 2.0 or something like that... So where should I go to suggest this for the RC?

And as for my 1.1.12 version of the software... can I use a mod (i.e. write one) so it will fix this? I perused through the manual awhile back on how to make mods for the forum... but I'm unsure if I will be able to edit source php files with one. If not, I guess I'll have to manually hard code it which is going to suck because every time I update I would have to re-do my fixes.

MrPhil

We're talking about the [url] tag? Sources/Subs.php looks specifically for http:// and https://, and adds http:// if neither is found. If you have a list of specific protocols that isn't too long, it would be feasible to add them to the list to check for. Or, you could allow any protocol [a-zA-Z0-9]+:// and add http:// only if there's nothing there. [flash], [img], and [iurl] all have similar code.

Just out of curiosity, is a web site allowed to define any protocol it wants to, or is there a finite list of permitted protocols?

QuoteHowever, If a URL is prefaced with :// then it will just not add the http part.
It sounds like you're looking at something other than the [url] tag? If you find code that simply looks for ://, why doesn't ts3server:// work? I see the following code further down in Sources/Subs.php:
// Parse any URLs.... have to get rid of the @ problems some things cause... stupid email addresses.
if (!isset($disabled['url']) && (strpos($data, '://') !== false || strpos($data, 'www.') !== false))
{

for autolinked URLs (not [url] tag).

SniperFodder

Yes, the URL Tag. I haven't tried auto linking but AFAIK it does the same. I haven't actually looked at any of the files in SMF directory. As for websites... No. They all use http:// or https:// for serving webpages. But Applications on the other hand... They can specify whatever they want as long as it uses the <name>:// format. The application links aren't meant for webservers. Your browser looks at it and says, "Hrm, This belongs to an application. Let's see if there is one listed in our library. Oh! There is! Let's pass it off to the application then!"

Or in FireFox's case if it doesn't know what application it belongs to, You can tell it when it asks.

Deaks

SniperFodder do you still need assistance if so can you refresh us with your querry as it seems to have changed abit :)
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

SniperFodder

I'm having an issue with the [url] bbcode auto-inserting http:// if it doesn't see http:// or https://. This prevents URLs prepended like ts3server:// ( ← is an application link ) from working because the URL changes into http://ts3server://.

Now, as my fellow SMF Forumers have informed me, The problem lies within the php file that handles auto-converting urls, wherever that file is. I just haven't had the inclination lately to mix around in those files to see if I can fix it. The simple thing to do would be to check if there is a ://in the beginning of the string somewhere, and if so, ignore putting http:// on the beginning of the string. If someone messed a url up, prepending http:// is NOT going to fix it....


Another thing I noticed which doesn't really matter since I'm comparing 2 different forum software, is that SMF edits the actual post to insert the http://, where as something like vBulletin just edits the finally rendered html page it sends. But whatever on that front. I can live with it editing my actual post text if I can edit the URL BBCode function in the core files.

I'd also love to know where I can suggest this fix for the new SMF Forums coming out.

Illori

this is an old mod but it may help you adding this feature to your forum although it is not part of the url tag

http://custom.simplemachines.org/mods/index.php?mod=108

SniperFodder


JimM

Any update on this?  Were you able to get things working like you wanted it to?
Jim "JimM" Moore
Former Support Specialist

SniperFodder

I apologize. This has been far from my mind over the past couple weeks. The solutions provided fit my needs for now. Thanks.

JimM

Glad to hear it.  I'll mark this topic as solved then.  If for some reason you need to unmark it, feel free to do so,
Jim "JimM" Moore
Former Support Specialist

Bobsenas

Not sure if anyone needs this, but i found a solid solution.
Adding a new BBC Tag in \Sources\Subs.php
I added this at line 1587

Quotearray(
            'tag' => 'ts3',
            'type' => 'unparsed_content',
            'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>',
            'validate' => create_function('&$tag, &$data, $disabled', '
               $data = strtr($data, array(\'<br />\' => \'\'));
               if (strpos($data, \'ts3server://\') !== 0 && strpos($data, \'ts3server://\') !== 0)
                  $data = \'ts3server://\' . $data;
            '),
         ),
         array(
            'tag' => 'ts3',
            'type' => 'unparsed_equals',
            'before' => '<a href="$1" class="bbc_link" target="_blank">',
            'after' => '</a>',
            'validate' => create_function('&$tag, &$data, $disabled', '
               if (strpos($data, \'ts3server://\') !== 0 && strpos($data, \'ts3server://\') !== 0)
                  $data = \'ts3server://\' . $data;
            '),
            'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
            'disabled_after' => ' ($1)',
         ),

Advertisement: