sbenjamin

Server:SaveCFC

Jul 27th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <cffunction name="saveState" access="remote" returntype="any" returnFormat="json">
  2.     <cfargument name="name" required="yes">
  3.     <cfargument name="val" required="yes">
  4.     <cfargument name="cfctoken" required="yes">
  5.     <cfset var result = structNew()>
  6.    
  7.     <cfif jsonSecurity(arguments.cfctoken)>
  8.         <!--- if a js array or object was passed, then convert it to CF array or struct --->
  9.         <cfif isJSON(arguments.val)>
  10.             <cfset arguments.val  = deserializeJSON(arguments.val)>
  11.         </cfif>
  12.        
  13.         <cflock timeout="5" throwontimeout="No" type="EXCLUSIVE" scope="SESSION">
  14.             <cfset session.festBuilder[arguments.name] = arguments.val>
  15.         </cflock>
  16.         <cfset result["success"] = true>
  17.     <cfelse>
  18.         <cfset result["success"] = false>
  19.     </cfif>
  20.  
  21.     <cfreturn result>
  22. </cffunction>
Advertisement
Add Comment
Please, Sign In to add comment