Skip to content

Instantly share code, notes, and snippets.

@ivanionut
Forked from coldfumonkeh/README.md
Last active August 29, 2015 14:14
Show Gist options
  • Save ivanionut/6045e848fb6f0c2a1ca6 to your computer and use it in GitHub Desktop.
Save ivanionut/6045e848fb6f0c2a1ca6 to your computer and use it in GitHub Desktop.

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