GetFQCallStack.cfm returns the fully qualified call stack at the point where it is called.
ValildCaller.cfm uses GetFQCallStack.cfm to figure out how the current template was called and throws an error if it was called directly or by a template whose filename and directory don't match the passed regular expression.
Bryan F. Hogan wrote:
Does anyone know if it is possible to make sure that a CFC is not called directly and that can only be called from a certain CFC when the CFC that shouldn't be called is in a sub-directory of the CFC that should be the only caller?
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
caller = callstack[3]; callee = callstack[2]; callingFile = GetFileFromPath(caller); callingDir = GetDirectoryFromPath(caller); valid = REFind(attributes.pathRE, callingDir) and REFind(attributes.templateRE, callingFile); �� tagcontext = CFcatch.tagcontext; tagcontext = attributes.tagcontext; contextLen = ArrayLen(tagcontext); current = ""; callStack = ArrayNew(1); for (i = contextLen; i gte 1; i = i - 1) { if (tagcontext[i].template neq current) { //the tag context can have multiple entries per template //we only want the unique entries //so we skip the repeats current = tagcontext[i].template; //for consistancy make all file paths use forward slashes ArrayAppend(callStack, Replace(current, "\", "/", "ALL")); } } if (not isDefined("attributes.tagcontext")) { //if no tag context was passed in then the first template on the callStack is //GetFQCallStack which we don't want so we get rid of it. ArrayDeleteAt(callStack, 1); } "#attributes.returnVarScope#.#attributes.returnVar#" = callStack;
