Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Aiheen aloitti: Benchtech - tammikuu 23, 2012, 04:43:25 IP

Otsikko: Mod for link shortener.
Kirjoitti: Benchtech - tammikuu 23, 2012, 04:43:25 IP
I have my own link shortening website, shten.me. It has an api that can be used and I was wondering how I would go about making a mod that automatically shortens URL's put in the body of a thread. How would I do that? And could anyone do it? I am not very good with PHP at all, or mods.

Little more info: The API works likle this: Navigating to this url http://shten.me/yourls-api.php?signature=SECRETKEY&action=shorturl&format=simple&url=www.exampleurl.com shortens the www.exampleurl.com and returns it as a text value in the page.
Otsikko: Re: Mod for link shortener.
Kirjoitti: Arantor - tammikuu 23, 2012, 05:09:10 IP
I'm curious, what's the benefit of using a link shortener? Saving a small (often irrelevant) amount of space in the database, and instead able to hide any link you link in them.

Just as a heads-up, I once demonstrated a glaring security hole in an online game using link shorteners. Imagine a roleplay game where you click a link to unequip an item, then another link to sell the item back to the game. Put said links into link shorteners and send a booby-trapped PM, job done, user is screwed over. (Whereas the forum will not allow image links that contain the forum URL with any action, except the action for attachments. This bypasses that restriction.)
Otsikko: Re: Mod for link shortener.
Kirjoitti: Mick. - tammikuu 23, 2012, 05:12:07 IP
I always thought link sh0rteners are dying breed.   Whatever happened to tr.im?
Otsikko: Re: Mod for link shortener.
Kirjoitti: Benchtech - tammikuu 23, 2012, 05:13:01 IP
Lainaus käyttäjältä: Arantor - tammikuu 23, 2012, 05:09:10 IP
I'm curious, what's the benefit of using a link shortener? Saving a small (often irrelevant) amount of space in the database, and instead able to hide any link you link in them.

Just as a heads-up, I once demonstrated a glaring security hole in an online game using link shorteners. Imagine a roleplay game where you click a link to unequip an item, then another link to sell the item back to the game. Put said links into link shorteners and send a booby-trapped PM, job done, user is screwed over. (Whereas the forum will not allow image links that contain the forum URL with any action, except the action for attachments. This bypasses that restriction.)

There's no real benefit I just wondered how I'd do it, one for my own learning curve, and secondly so my service is used a little more on my own forum.
Otsikko: Re: Mod for link shortener.
Kirjoitti: Mick. - tammikuu 23, 2012, 05:14:36 IP
If you use whatever service, and they happen to go out of business, then all your short links are screwed. They will go to a 404.
Otsikko: Re: Mod for link shortener.
Kirjoitti: Benchtech - tammikuu 23, 2012, 05:17:03 IP
Lainaus käyttäjältä: bluedevil - tammikuu 23, 2012, 05:14:36 IP
If you use whatever service, and they happen to go out of business, then all your short links are screwed. They will go to a 404.

I don't need to worry about that, it's my service so I'll make sure it doesn't.
Otsikko: Re: Mod for link shortener.
Kirjoitti: Benchtech - tammikuu 23, 2012, 05:18:46 IP
Lainaus käyttäjältä: Arantor - tammikuu 23, 2012, 05:09:10 IP
I'm curious, what's the benefit of using a link shortener? Saving a small (often irrelevant) amount of space in the database, and instead able to hide any link you link in them.

Just as a heads-up, I once demonstrated a glaring security hole in an online game using link shorteners. Imagine a roleplay game where you click a link to unequip an item, then another link to sell the item back to the game. Put said links into link shorteners and send a booby-trapped PM, job done, user is screwed over. (Whereas the forum will not allow image links that contain the forum URL with any action, except the action for attachments. This bypasses that restriction.)

Arantor, I saw you helped with this mod, http://custom.simplemachines.org/mods/index.php?mod=2986, how hard would it be to do something like that with my service?
Otsikko: Re: Mod for link shortener.
Kirjoitti: Mick. - tammikuu 23, 2012, 05:22:01 IP
It should work with your forum. At the package list in admin, bottom right, click on "advanced" and type smf 2.0 and save. Then install the mod.
Otsikko: Re: Mod for link shortener.
Kirjoitti: Arantor - tammikuu 23, 2012, 05:28:34 IP
Eh, I don't remember but it wasn't a lot of help I gave (bearing in mind it's a third party service and has an established API, and Suki's a competent coder)

*shrug* Thing is, if you're capable of writing a URL shortener, I'm not sure what help you need integrating it in SMF.
Otsikko: Re: Mod for link shortener.
Kirjoitti: Benchtech - tammikuu 24, 2012, 04:21:50 AP
Lainaus käyttäjältä: Arantor - tammikuu 23, 2012, 05:28:34 IP
Eh, I don't remember but it wasn't a lot of help I gave (bearing in mind it's a third party service and has an established API, and Suki's a competent coder)

*shrug* Thing is, if you're capable of writing a URL shortener, I'm not sure what help you need integrating it in SMF.

The actual back service behind it is not coded by me, I have just made the public interface, so I'm not too good if I'm honest.
Otsikko: Re: Mod for link shortener.
Kirjoitti: Benchtech - tammikuu 24, 2012, 10:40:44 AP
Lainaus käyttäjältä: Arantor - tammikuu 23, 2012, 05:28:34 IP
Eh, I don't remember but it wasn't a lot of help I gave (bearing in mind it's a third party service and has an established API, and Suki's a competent coder)

*shrug* Thing is, if you're capable of writing a URL shortener, I'm not sure what help you need integrating it in SMF.

Got it to work! :D:D:D:D