Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cfcomponent output="false">
- <cfset this.name = "Thor" />
- <cfset this.applicationTimeout = createTimeSpan(1,0,0,0) />
- <cfset this.clientManagement = false />
- <cfset this.clientStorage = "registry" />
- <cfset this.loginStorage = "session" />
- <cfset this.sessionManagement = true />
- <cfset this.sessionTimeout = createTimeSpan(0,1,0,0) />
- <cfset this.setClientCookies = true />
- <cfset this.setDomainCookies = false />
- <cfset this.scriptProtect = "all" />
- <cffunction name="onApplicationStart" returnType="boolean" output="false">
- <cfinclude template="configure.cfm">
- <cfscript>
- // config // environment-specific
- application.stuConfig = structNew();
- application.stuConfig.appName = CONFappName;
- application.stuConfig.comPath = CONFcomPath;
- application.stuConfig.dsn = CONFdsn;
- application.stuConfig.serverSlash = CONFserverSlash; // "\" for windows; "/" for unix;
- application.stuConfig.encoding = CONFencoding;
- application.stuConfig.env = CONFenv;
- application.stuConfig.version = CONFversion;
- application.stuConfig.crumbicon = CONFcrumbicon;
- application.stuConfig.szDelimFld = CONFszDelimfld; // 8 is the BACK-SPACE character.
- application.stuConfig.szDelimVal = CONFszDelimval;
- application.stuConfig.nDefaultRecsPerPage = CONFnDefaultRecsPerPage;
- application.stuConfig.szDefaultWildcardType = CONFszDefaultWildcardType;
- application.stuConfig.nMenuTotalsCacheMinutes = CONFnMenuTotalsCacheMinutes;
- application.stuConfig.stuFileTransfer = structNew();
- application.stuConfig.stuFileTransfer.confirmToGw = CONFconfirmToGw;
- // mail
- application.stuMail = structNew();
- application.stumail.user = CONFmailuser;
- application.stumail.userpwd = CONFmailuserpwd; // no security problem: this user has very little permissions
- application.stumail.feedBack = CONFmailFeedback;
- // paths // environment-specific
- application.stuPaths = structNew();
- application.stuPaths.websiteRoot = CONFwebsiteRoot;
- application.stuPaths.websiteURL = "#application.stuPaths.websiteRoot#/index.cfm";
- application.stuPaths.tempDir = CONFtempDir;
- application.stuPaths.tempDirUnc = CONFtempDirUnc;
- application.stuPaths.scancollectDir = CONFscancollectDir;
- application.stuPaths.rootPath = CONFrootpath;
- application.stuPaths.UTF8 = "#application.stuPaths.rootPath#\bin\utf8.exe";
- application.stuPaths.relPathToCbisfiletransfer = CONFrelPathToCbisfiletransfer;
- // exporting documents/attachments out of ThOR/CBIS
- application.stuImpExp = structNew();
- application.stuImpExp.pathToExportDir = CONFpathToExportDir;
- application.stuImpExp.OLAFPlaceholderEntityId = CONFOLAFPlaceholderEntityId;
- application.stuCBIS = structNew();
- application.stuCBIS.username = "";
- application.stuCBIS.pwd = "";
- application.stuCBIS.server = "";
- application.stuCBIS.altserver = "";
- application.stuCBIS.ldapport = "";
- application.stuCBIS.ldapStart = "";
- // Fake vars for cbisfiletransfer sendfile
- application.stuSendfileFakeVars = structNew();
- application.stuSendfileFakeVars.nMaxBufferSize = CONFfakenMaxBufferSize;
- application.stuSendfileFakeVars.szEnvironement = CONFfakeszEnvironement;
- application.stuSendfileFakeVars.szApprovedToGW = CONFfakeszApprovedToGW;
- // initialise objects
- application.stuObjs = structNew();
- application.stuObjs.UserManager = createObject("component", "#application.stuConfig.comPath#.UserManager").init(dsn=application.stuConfig.dsn);
- application.stuObjs.SecurityManager = createObject("component", "#application.stuConfig.comPath#.SecurityManager").init(dsn=application.stuConfig.dsn);
- application.stuObjs.Utilities = createObject("component", "#application.stuConfig.comPath#.Utilities").init(dsn=application.stuConfig.dsn);
- application.stuObjs.CFJson = createObject("component", "#application.stuConfig.comPath#.json");
- application.stuObjs.Gateway = createObject("component", "#application.stuConfig.comPath#.Gateway").init(dsn=application.stuConfig.dsn, OLAFPlaceholderEntityId=application.stuImpExp.OLAFPlaceholderEntityId, relPathToCbisfiletransfer=application.stuPaths.relPathToCbisfiletransfer);
- application.stuObjs.CFJson = createObject("component", "#application.stuConfig.comPath#.json");
- application.stuObjs.ZipUtilities = createObject("component", "#application.stuConfig.comPath#.ZipUtilities");
- </cfscript>
- <!---
- <cfdump var="#application.stuObjs.Utilities#"><cfabort>
- --->
- <cfreturn true />
- </cffunction>
- <cffunction name="onApplicationEnd" returnType="void" output="false">
- <cfargument name="applicationScope" required="true" />
- </cffunction>
- <cffunction name="onSessionStart" returnType="void" output="false">
- <cfscript>
- application.stuObjs.UserManager.initialiseUserSession();
- </cfscript>
- </cffunction>
- <cffunction name="onSessionEnd" returnType="void" output="false">
- <cfargument name="sessionScope" type="struct" required="true" />
- <cfargument name="appScope" type="struct" required="false" />
- </cffunction>
- <cffunction name="onRequestStart" returnType="boolean" output="false">
- <cfargument name="thePage" type="string" required="true" />
- <!--- TEMP. Re-init app scope on every page call. But remove this when we have all our objects set up. --->
- <cfset onApplicationStart() />
- <cfif not isdefined("session.stuUser.hasAccess") >
- <cfset onSessionStart() />
- <script language="javascript">alert("unexpected re-initialisation of session???");</script>
- </cfif>
- <!--- Test if logged in --->
- <cfinvoke component="#application.stuObjs.UserManager#" method="isUserAuthorised" />
- <!--- If user is in session, make sure the db is up, using the user's own credentials. --->
- <cfif session.stuUser.hasAccess>
- <cftry>
- <cfquery name="isDatabaseUp" datasource="#application.stuConfig.dsn#" username="#session.stuUser.Logon#" password="#session.stuUser.Password#">
- select sysdate from dual
- </cfquery>
- <cfcatch type="database">
- Database is not available. Please contact DBA!<cfabort />
- </cfcatch>
- </cftry>
- </cfif>
- <cfreturn true />
- </cffunction>
- <cffunction name="onRequestEnd" returnType="void" output="false">
- <cfargument name="thePage" type="string" required="true" />
- </cffunction>
- <cffunction name="onError" returnType="void" output="false">
- <cfargument name="exception" required="true" />
- <cfargument name="eventname" type="string" required="true" />
- <cfdump var="#arguments#" /><cfabort>
- Do something more pretty
- <!--- --->
- <cfinclude template="functions/err_req.cfm">
- <cfabort />
- </cffunction>
- </cfcomponent>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement