How I setup my plugin download links
Mango Blog 1.3 added the auto-installer, and I immediately stole Seb Duggan's style for displaying the download & install link:

Originally I used the RIAForge download URL for my plugins here, but I've since switched to a custom URL on this domain that redirects to the RIAForge download URL. I did this because the RIAForge URL is too long and was forced to wrap in the box, and I just didn't like the way that looked. I thought some people may be interested in how I got this working, so here you go.
I started by creating an array of structures that define my available plugins and their download links:
if (not structKeyExists(application, "_pluginForwardBot") or structKeyExists(url,"reinit")){
application._pluginForwardBot = [
{name="BurntMango",url="http://burntmango.riaforge.org/index.cfm?event=action.download"},
{name="Lightbox2",url="http://mangolightbox.riaforge.org/index.cfm?event=action.download"},
{name="LogViewer",url="http://mangologviewer.riaforge.org/index.cfm?event=action.download"},
{name="PopularPosts",url="http://mangopopular.riaforge.org/index.cfm?event=action.download"},
{name="RelatedEntries",url="http://mangorelated.riaforge.org/index.cfm?event=action.download"},
{name="SmartType",url="http://mangosmarttype.riaforge.org/index.cfm?event=action.download"},
{name="SweetTweets",url="http://sweettweets.riaforge.org/index.cfm?event=action.download"}
];
}
Next, I want to be able to go to this url: http://fusiongrokker.com/get/index.cfm?plugin=[PluginName] and be forwarded to the RIAForge download page:
This works just swell. Notice that I'm adding "&doit=true" to the URL, which you normally won't see when downloading from RIAForge. This extra URL parameter tells RIAForge to skip the page that says "Your download will begin momentarily" and just return the file.
The problem with this, however, is that RIAForge won't count the download in your stats. To get around that, I've added a background thread that will view the download page so that the download count is updated:
I've learned that you always have to assume that some users will be evil, so we also have to make sure we validate the URL parameter:
And the final product of the code looks like this:
Then, a quick URL Rewriting rule to get the nice looking URLs:
##### Plugin Forward Bot
RewriteRule ^/get/(.*)$ /_pluginForward/index.cfm?plugin=$1
All in all, not a difficult project.
Posted in My projects | No Responses Yet