Skip to content
This repository
Browse code

SessionInvalidate, ArraySlice and GetApplicationMetadata

  • Loading branch information...
commit ed773b41692007fea177f38be30f2fa3e069ffca 1 parent d2a20de
David Boyer authored
63 cf10.cfm
... ... @@ -0,0 +1,63 @@
  1 +<cffunction name="GetApplicationMetadata" output="false" returntype="struct">
  2 + <cfset var lc = StructNew() />
  3 + <cfif IsDefined("application")>
  4 + <cfreturn application.getApplicationSettings() />
  5 + </cfif>
  6 + <cfreturn StructNew() />
  7 +</cffunction>
  8 +
  9 +<cffunction name="ArraySlice" output="false" returntype="array" description="Returns part of an array, as specified">
  10 + <cfargument name="array" type="array" required="true" />
  11 + <cfargument name="offset" type="numeric" required="true" />
  12 + <cfargument name="length" type="numeric" required="false" />
  13 + <cfset var lc = StructNew() />
  14 + <cfif Not StructKeyExists(arguments, "length")>
  15 + <cfset lc.from = arguments.offset - 1 />
  16 + <cfset arguments.length = ArrayLen(arguments.array) - lc.from />
  17 + <cfelseif arguments.offset Lt 0>
  18 + <cfset lc.from = ArrayLen(arguments.array) + arguments.offset />
  19 + <cfelse>
  20 + <cfset lc.from = arguments.offset - 1 />
  21 + </cfif>
  22 + <cfset lc.to = lc.from + arguments.length />
  23 + <!--- subList(from [inclusive], to [exclusive]), start index is 0 --->
  24 + <cfreturn arguments.array.subList(lc.from, lc.to) />
  25 +</cffunction>
  26 +
  27 +<cffunction name="SessionInvalidate" output="false" returntype="void">
  28 + <cfscript>
  29 + lc.sessionId = session.cfid & '_' & session.cftoken;
  30 +
  31 + // Fire onSessionEnd
  32 + lc.appEvents = application.getEventInvoker();
  33 + lc.args = [application, session];
  34 + lc.appEvents.onSessionEnd(lc.args);
  35 +
  36 + // Make sure that session is empty
  37 + StructClear(session);
  38 +
  39 + // Clean up the session
  40 + lc.sessionTracker = CreateObject("java", "coldfusion.runtime.SessionTracker");
  41 + lc.sessionTracker.cleanUp(application.applicationName, lc.sessionId);
  42 +
  43 +
  44 + </cfscript>
  45 +</cffunction>
  46 +
  47 +<!---
  48 +Done
  49 + ArraySlice http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSf23b27ebc7b554b647112c9713585f0e10e-8000.html
  50 +
  51 +Skipped
  52 + * The following can't be backported as we can't force arrays to be passed by reference
  53 + ArrayEach http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSf23b27ebc7b554b6-179bf6ef13585ac1b4d-8000.html
  54 + ArrayFilter http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSf23b27ebc7b554b6-179bf6ef13585ac1b4d-7fff.html
  55 +
  56 +
  57 +To do
  58 + ArrayFindAll http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSf23b27ebc7b554b6-5b4bf12a13585ace297-8000.html
  59 + ArrayFindNoCase http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WS98CF660A-0C9E-4e85-BBA1-89862B60EB4D.html
  60 + SessionInvalidate http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WS932f2e4c7c04df8f-23f56e61353e3d07d1-8000.html
  61 + SessionRotate http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WS932f2e4c7c04df8f-23f56e61353e3d07d1-7fff.html
  62 + SessionStartTime http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSf23b27ebc7b554b6-67fd180f13585b7069d-8000.html
  63 +--->
0  cf9.cfm
No changes.
10 cfbackport.cfm
... ... @@ -0,0 +1,10 @@
  1 +<cfsilent>
  2 + <cfscript>
  3 + cfbackport = StructNew();
  4 + cfbackport.major = ListFirst(server.coldfusion.productVersion);
  5 + cfbackport.minor = ListFirst(Replace(ListDeleteAt(server.coldfusion.productVersion, 1), ",", "."));
  6 + </cfscript>
  7 + <cfif cfbackport.major lt 10>
  8 + <cfinclude template="cf10.cfm" />
  9 + </cfif>
  10 +</cfsilent>
3  index.cfm
... ... @@ -0,0 +1,3 @@
  1 +<cfinclude template="cfbackport.cfm" />
  2 +
  3 +<cfdump var="#variables#" />

0 comments on commit ed773b4

Please sign in to comment.
Something went wrong with that request. Please try again.