Skip to content

Instantly share code, notes, and snippets.

@coldfumonkeh
Last active August 29, 2015 14:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save coldfumonkeh/7c427c0be79e1f0039e8 to your computer and use it in GitHub Desktop.
Save coldfumonkeh/7c427c0be79e1f0039e8 to your computer and use it in GitHub Desktop.
Server Detection Scriptlet.. (WTF is a scriptlet?)

ColdFusion Server Detection

This is a re-imagineering of a ColdFusion code block found here: https://github.com/webdevsourcerer/CF-Server-Detect

It is actually originally noted as a ColdFusion Scriptlet but we have NO frickin' idea what a ColdFusion Scriptlet is (because there is no such thing).

Credits

It's ALWAYS good etiquette to credit and thank those who gave time, skills and knowledge to advance the community and help to improve shitty code.

Thanks go out to the following people:

  • Adam Cameron
  • Ryan Guill
  • Ross McMahon
  • Matt Gifford

Usage

This code block and functions contained within are openly and freely available for use unless you are James Harvey (@webdevsourcerer). If this is you (I'm sorry) you have already had enough of the community's code. Stick with your 'scriptlet' and move on.

Useful information

<!--- Elegant --->
<cfscript>
public function getServerFlavor() {
local.cf_server = reReplaceNoCase(server.ColdFusion.ProductName, ".*(coldfusion|railo|bluedragon|lucee).*", "\1");
local.server_version = listFind("coldfusion,bluedragon", rc.cf_server) ? listFirst( server.railo.version ) : server.coldfusion.productversion;
return local;
}
</cfscript>
<!--- Elvis has left the building (or wasn't included in this CF version) --->
<cfscript>
function getServerFlavor() {
local.cf_server = reReplaceNoCase(server.ColdFusion.ProductName, ".*(coldfusion|railo|bluedragon|lucee).*", "\1");
if(listFind("coldfusion,bluedragon", rc.cf_server)) {
local.server_version = server.coldfusion.productversion;
} else {
local.server_version = listFirst( server.railo.version );
}
return local;
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment