Getting FW/1 version info - coldfusion

I have been able to get other system information, but how do I get FW/1 version info? I have tried
Application info
<cfoutput>
<p><b>Java Version:</b> #CreateObject("java", "java.lang.System").getProperty("java.version")#</p>
<p><b>ColdFusion Version:</b> #server.ColdFusion.ProductVersion#</p>
<p><b>FW/1 Version:</b> </p>
</cfoutput>
<cfdump var="#application#">

You can look it up in framework.cfc. It's in the variables scope:
#variables._FW1_VERSION#

Related

Allow theme level 'EventHandler.cfc' to raise exceptions in MURA CMS 6?

Can anyone tell me, how I can enable exception handling in the theme level EventHandler.cfc in MURA CMS 6?
I have already had to remove the error handling in the Application.cfc error method, because the default routine wasn't displaying enough error detail. But, it seems like the whole CFC framework is wrapped in a <CFTRY> block, which quite frankly is bizarre.
I would prefer a solution that does not involve using <CFCATCH> to dump the errors to a file, which is the temporary solution that I am using at the moment.
I just want Adobe ColdFusion to behave the way it does with my non MURA websites. When there is an error in a CFC, it just displays it, plain & simple.
Of course, for production, my approach is different.
UPDATE:
Just to let you know, I am using Adobe ColdFusion 11, with robust error handling turned on, so I know for fact that this issue is nothing to do with Adobe ColdFusion. It is definitely a MURA CMS issue.
Don't remove the built-in error handling. They have put that in place to protect you from information disclosure. Instead make changes to the error handling to suit your needs.
Mura comes with basically three levels of error "catching". At the theme level, at the site level and then globally. (And I have found that even though an error may be caught at a lower level like 'site' that does not prevent the same error from bubbling up and also firing the 'global' handler.)
Steve Withington created a Gist example that should help you get started. See it here. Be sure to read the comments in the code as it explains where the files live and any configuration settings necessary to invoke them.
Copying his code examples here in case that resource is taken down in the future.Credit Steve Withington
Mura Error Handling: You could use any or even both of the attached methods to help with error handling in Mura CMS. This works better than the default "We're sorry, an error has occurred. Please try again later."
muraCustomErrorFile.cfm
<!---
1) Drop this file under /config/ directory.
2) Add errortemplate=/muraWRM/config/customErrorFile.cfm to the settings.ini.cfm file.
3) Set debuggingenabled=false in the settings.ini.cfm file.
4) Reload Mura CMS
--->
<cftry>
<cfset msg = 'MURA ERROR - MESSAGE: #arguments.exception.Message# DETAIL: #arguments.exception.Detail# ' />
<cflog type="ERROR" file="MuraError" text="#msg#" />
<cfcatch></cfcatch>
</cftry>
<cfparam name="url.debug" default="false" />
<cfoutput>
<!DOCTYPE html>
<html>
<head>
<title>Site Down For Maintenance</title>
</head>
<body>
<h3>Site Down for Maintenance</h3>
<cfif url.debug>
<cfdump var="#arguments#" />
<!--- You Have Access to arguments.eventName and aguments.exception --->
<!---
<h4>Exception Message</h4>
<p>#arguments.exception.message#</p>
<h4>Exception Detail</h4>
<p>#arguments.exception.detail#</p>
<h4>TagContext[1]</h4>
<cfdump var="#arguments.exception.TagContext[1]#" />
--->
<!--- you could also dump whatever else you want to inspect --->
<!---
<cfdump var="#cgi#" label="CGI" />
<cfdump var="#request#" label="REQUEST" />
<cfdump var="#session#" label="SESSION" />
<cfdump var="#application#" label="APPLICATION" />
--->
<cfelse>
<p>This site is temporarily down for maintenance.</p>
</cfif>
</body>
</html>
</cfoutput>
muraOnGlobalError.cfm
<cfscript>
// drop this method in either the Site or Theme eventHandler.cfc
public any function onGlobalError($) {
var tagContext = '';
var local = {};
param name='url.debug' default=false;
local.ex = arguments.$.event('exception');
local.errorMessage = 'GLOBAL ERROR - MESSAGE: #local.ex.Message# DETAIL: #local.ex.Detail# ';
try {
tagContext = local.ex.TagContext[1];
} catch(any e) {};
if ( IsStruct(tagContext) ) {
local.errorMessage = local.errorMessage & '
LINE: #tagContext.LINE#
TEMPLATE: #tagContext.TEMPLATE#
RAW_TRACE: #tagContext.RAW_TRACE#';
}
WriteLog(type='ERROR', file='muraGlobalError', text='#local.errorMessage#');
if ( url.debug ) {
WriteOutput('<h2>Debug Output</h2>' & local.errorMessage);
WriteDump(var=arguments, label='ARGUMENTS', abort=1);
}
}
</cfscript>

CFGRID bind in HTML format does not work in Coldfusion 11

OK, so I've spent the last couple of days researching this issue on various websites including this one and I'm still no closer to having an answer. I have seen claims that this was a bug and was fixed on Adobe's end in one of the CF11 patches and I have even seen one answer that claimed that Adobe was emailing the fix directly to individuals - though no information on how to go about getting Adobe to do that was provided on that webpage.
We just updated our intranet to Coldfusion 11 and pages that have a cfgrid using the HTML format and bind data from a cfc no longer show the cfgrid on the page. Other pages that use the Flash format with cfgrid (which apparently can't use the bind attribute with Flash) do work. These HTML cfgrid pages were working properly in Coldfusion 9 before we migrated to 11.
I have simplified the code as much as I can to eliminate other error possibilities - i.e. I've stripped out formatting and am pulling only a couple columns from the database. Here is the code I am currently working on in my dev sandbox:
<cfgrid format="html"
name="userGrid"
bind="cfc:editorFunc.getGridData({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
pagesize="20">
<cfgridcolumn name="REGION" header="Region">
<cfgridcolumn name="managmentArea" header="Management Area">
</cfgrid>
Here is the code in the cfc (the query does produce results when dumped to the page):
<cffunction name="getGridData" access="remote">
<cfargument name="page">
<cfargument name="pageSize">
<cfargument name="gridsortcolumn">
<cfargument name="gridsortdir">
<cfquery name="records" datasource="webData">
SELECT REGION, managmentArea
FROM areaDesc
ORDER BY Region ASC
</cfquery>
<cfset result = queryConvertForGrid(duplicate(records), arguments.page, arguments.pagesize)>
<cfreturn result>
</cffunction>
Has anyone had any luck getting a cfgrid like this to work in CF11? I could try a JQuery solution like JGrid, however I would prefer to figure out the existing issue with this code if possible.
Any help is much appreciated.
Add this..
<cfif not len(trim(arguments.gridsortcolumn))>
<cfset arguments.gridsortcolumn = "REGION">
<cfset arguments.gridsortdir = "desc">
</cfif>
query....
ORDER BY #arguments.gridsortcolumn# #arguments.gridsortdir#

CFWebsocket Cross Domain?

Does anyone know if the new websockets feature in CF10 can be used cross domain and cross server? And does anyone know or have some sample code to do this?
I have a simple live help chat working on my app but I want to apply it to other sites and have one central admin chat area where the support agents will interact with users cross domain.
As far as I know they do not. You can, however, use a <cfhttp> to call a file on the other site that will publish the message. Here is I accomplished this.
Create a file called socketPublisher.cfm and save it in a directory that does not require a login access a file.
socketPublisher.cfm
<cfparam name="Request.Attributes.msgType" default="newJob">
<cfparam name="Request.Attributes.channel" default="notify">
<cfparam name="Request.Attributes.Type" default="">
<cfoutput>
<cfswitch expression="#Request.Attributes.Type#">
<cfcase value="yourType">
<cfscript>
WSPublish('chat',{message: '', msgType: '#Request.Attributes.msgType#'});
</cfscript>
</cfcase>
<cfdefaultcase>
<cfscript>
WSPublish('#Request.Attributes.channel#',{message: '', msgType: '#Request.Attributes.msgType#'});
</cfscript>
</cfdefaultcase>
</cfswitch>
</cfoutput>
Then in you action page on the other site, you will need to make your http request to that file.
actionPage.cfm
<cfhttp method="Post" url="#socketURL#/_scripts/socketPublisher.cfm">
<cfhttpparam type="URL" name="msgType" value="pendingFiles">
</cfhttp>
That should do it.
There is also a know issue with CF10 WSPublish that it will change the CGI scope cause error when trying to do a redirect from an action page. I am using this as a workaround for that issue until I can find a better solution.

Cflocation bug / new feature in ColdFusion 9 - URL appending twice

When a user logs in and is redirected to a secured page, the url is getting appended twice like a list. This in turn causes a 404.
(example: http://uwf.edu/something.cfm,http://uwf.edu/something.cfm)
Currently, the site has a custom login tag which I am unable to edit as I do not have control over it. (It's just a custom cf tag that allows people to login at the university.)
I have to do additional processing after this tag to verify that they are eligible to login on this particular site. Once they have been verified, they are re-directed to another page with cflocation.
<custom login tag>
<cfinvoke component="#application.path#cfc/security" method = "constructSession" returnvariable = "status">
.. params excluded..
</cfinvoke>
<cfif status eq 1>
<cflocation url="#someurl_invalid#" addtoken="no" />
<cfelse>
<cflocation url="#someurl#" addtoken="no" />
</cfif>
The custom login tag refreshed the current page already, but I obviously do not want that and thus had used the above method to re-direct. This worked in ColdFusion 8.
I read this article: http://www.bennadel.com/blog/2050-Changes-In-CFLocation-OnRequestEnd-Behavior-In-ColdFusion-9-s-Application-cfc.htm
The article gave me some insight as to what is going on...but I am unsure how to fix the issue.
Does anyone have any solutions?
Since you don't have control over the custom tag, you'll have to work around the issue instead of fixing it.
I would recommend changing the code:
<cfif status eq 1>
<cflocation url="#ListFirst(someurl_invalid)#" addtoken="no" />
<cfelse>
<cflocation url="#ListFirst(someurl)#" addtoken="no" />
</cfif>
It's not pretty but will work whether the URLs are lists or not.

ColdFusion Send page as it process it

Is there a way in ColdFusion (or Railo for that matter) to begin sending the client the page as it processes it?
Simple: use the cfflush tag:
<cfoutput query="myQuery">
#myQuery.myData#
<cfflush>
</cfoutput>
http://www.cfquickdocs.com/cf9/?getDoc=cfflush#cfflush