Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Aiheen aloitti: flame baiter - elokuu 19, 2007, 09:15:36 AP

Otsikko: Automatically change URL to IURL when same domain
Kirjoitti: flame baiter - elokuu 19, 2007, 09:15:36 AP
Explanation here: 

http://www.simplemachines.org/community/index.php?topic=29365.msg226023#msg226023

That would be a cool mod!   ;)
Otsikko: Re: Automatically change URL to IURL when same domain
Kirjoitti: karlbenson - elokuu 19, 2007, 10:41:42 AP
It wouldn't be that hard to do.

If noone else has a go at this, I'll take a stab at it once I've finished updating my other mods.

Theres two different types of matches you could make to decide whether to use internal.  Which would you prefer?

based on matching the $scripturl variable (http://www.simplemachines.org/community/index.php)
or
domain based (but then you've got subdomain and server ip matching)

If it were me, I'd opt for option 1
Otsikko: Re: Automatically change URL to IURL when same domain
Kirjoitti: flame baiter - elokuu 19, 2007, 10:49:23 AP
Uhh, technical question. No idea.

I just want all links on www.*.mysite.*.com to be linked with UIRL instead of URL, that's all.

Or, you could do both and make an option? I don't really understand what you mean to be honest.
Otsikko: Re: Automatically change URL to IURL when same domain
Kirjoitti: karlbenson - elokuu 19, 2007, 10:57:05 AP
Basically I will have to check each link whether it is classed as internal.

It would depend on what you define 'Internal' to mean.

Do you ONLY mean links internal to your forum? eg all smf.org's forum links start with 'http://www.simplemachines.org/community/index.php'

Or do you mean absolutely ANY link hosted on your domain
eg
http://custom.simplemachines.org/mods/index.php?mod=485
(its not on the forum, its on the same domain (simplemachines.org)
and its on a subdomain (the bit before .simplemachines.org eg 'custom')
Otsikko: Re: Automatically change URL to IURL when same domain
Kirjoitti: flame baiter - elokuu 19, 2007, 10:59:47 AP
Ohh, now I see. I meant absolutely any link on my domain, yes.

"If it were me, I'd opt for option 1" - uhm, why do you think option 1 is better?

Maybe adding both and an option would be best to satisfy all needs.
Otsikko: Re: Automatically change URL to IURL when same domain
Kirjoitti: karlbenson - elokuu 19, 2007, 11:32:13 AP
Well has as luck would have it, I'm re-writing my anonym.to mod at the moment which needs to detect whether links are internal.

Detecting whether its an $script url is a SIMPLE match.

Where as match your domain or subdomain is alot more code. (it would require options because if you were using a free host or a free subdomain provider. It would detect their domain.)

Theres also the option as to whether you want to convert urls which are IP based. (again you wouldnt want it to convert them on a free or shared host)