| [5] | 1 | <cfsetting enablecfoutputonly="true" showdebugoutput="false"> |
|---|
| 2 | |
|---|
| 3 | <cfset request.mashed.mode = "galleon" /> |
|---|
| 4 | |
|---|
| 5 | <!--- |
|---|
| 6 | Name : Application.cfm |
|---|
| 7 | Author : Raymond Camden |
|---|
| 8 | Created : June 01, 2004 |
|---|
| 9 | Last Updated : May 1, 2007 |
|---|
| 10 | History : Don't load app.cfc, load galleon.cfc. Also pass settings to messages. (rkc 7/14/05) |
|---|
| 11 | Make app name dynamic. Remove mapping (rkc 8/27/05) |
|---|
| 12 | Support for sorting, errors (rkc 9/15/05) |
|---|
| 13 | Better admin check, logout fix (rkc 7/12/06) |
|---|
| 14 | Even better admin check, really (rkc 7/18/06) |
|---|
| 15 | BD fix, attachment folder (rkc 11/3/06) |
|---|
| 16 | Fix for getting attachment dir (rkc 11/16/06) |
|---|
| 17 | Use Factory (thanks Rob Gonda) (rkc 2/21/07) |
|---|
| 18 | case fix for the factory (rkc 5/1/07) |
|---|
| 19 | Purpose : |
|---|
| 20 | ---> |
|---|
| 21 | |
|---|
| 22 | <!--- |
|---|
| 23 | <cfset appName = "modelglue.com"> |
|---|
| 24 | <cfset prefix = getCurrentTemplatePath()> |
|---|
| 25 | <cfset prefix = reReplace(prefix, "[^a-zA-Z]","","all")> |
|---|
| 26 | <cfset prefix = right(prefix, 64 - len(appName))> |
|---|
| 27 | ---> |
|---|
| 28 | |
|---|
| 29 | <cfapplication name="model_glue_com" sessionManagement=true loginstorage="session"> |
|---|
| 30 | |
|---|
| 31 | <!--- |
|---|
| 32 | BD wants error.cfm to be relative when the app.cfm is run inside the admin |
|---|
| 33 | folder. See: http://ray.camdenfamily.com/index.cfm/2005/9/21/Galleon-Issue-with-BlueDragon |
|---|
| 34 | ---> |
|---|
| 35 | <cfif server.coldfusion.productname is "BlueDragon"> |
|---|
| 36 | <cfif findNoCase("/admin", cgi.script_name)> |
|---|
| 37 | <cferror type="exception" template="../error.cfm"> |
|---|
| 38 | <cfelse> |
|---|
| 39 | <cferror type="exception" template="error.cfm"> |
|---|
| 40 | </cfif> |
|---|
| 41 | <cfelse> |
|---|
| 42 | <cferror type="exception" template="error.cfm"> |
|---|
| 43 | </cfif> |
|---|
| 44 | |
|---|
| 45 | <cfif not isDefined("application.galleon.init") or isDefined("url.reinit")> |
|---|
| 46 | <cfset application.galleon = structNew() /> |
|---|
| 47 | |
|---|
| 48 | <cfset structDelete(application.galleon, "userCache")> |
|---|
| 49 | |
|---|
| 50 | <!--- get user CFC ---> |
|---|
| 51 | <cfset application.galleon.factory = createObject("component","cfcs.objectfactory").init()> |
|---|
| 52 | |
|---|
| 53 | <!--- Get main settings ---> |
|---|
| 54 | <cfset application.galleon.settings = application.galleon.factory.get('galleonSettings').getSettings()> |
|---|
| 55 | |
|---|
| 56 | <cfset application.galleon.settings.attachmentdir = getDirectoryFromPath(getCurrentTemplatePath()) & "attachments"> |
|---|
| 57 | |
|---|
| 58 | <cfif not directoryExists(application.galleon.settings.attachmentdir)> |
|---|
| 59 | <cfdirectory action="create" directory="#application.galleon.settings.attachmentdir#"> |
|---|
| 60 | </cfif> |
|---|
| 61 | |
|---|
| 62 | <!--- get user CFC ---> |
|---|
| 63 | <cfset application.galleon.user = application.galleon.factory.get('user')> |
|---|
| 64 | |
|---|
| 65 | <!--- get utils CFC ---> |
|---|
| 66 | <cfset application.galleon.utils = application.galleon.factory.get('utils')> |
|---|
| 67 | |
|---|
| 68 | <!--- get conference CFC ---> |
|---|
| 69 | <cfset application.galleon.conference = application.galleon.factory.get('conference')> |
|---|
| 70 | |
|---|
| 71 | <!--- get forum CFC ---> |
|---|
| 72 | <cfset application.galleon.forum = application.galleon.factory.get('forum')> |
|---|
| 73 | |
|---|
| 74 | <!--- get thread CFC ---> |
|---|
| 75 | <cfset application.galleon.thread = application.galleon.factory.get('thread')> |
|---|
| 76 | |
|---|
| 77 | <!--- get message CFC ---> |
|---|
| 78 | <cfset application.galleon.message = application.galleon.factory.get('message')> |
|---|
| 79 | |
|---|
| 80 | <!--- get rank CFC ---> |
|---|
| 81 | <cfset application.galleon.rank = application.galleon.factory.get('rank')> |
|---|
| 82 | |
|---|
| 83 | <cfset application.galleon.init = true> |
|---|
| 84 | |
|---|
| 85 | </cfif> |
|---|
| 86 | |
|---|
| 87 | <!--- include UDFs ---> |
|---|
| 88 | <cfinclude template="includes/udf.cfm"> |
|---|
| 89 | |
|---|
| 90 | <cfif isDefined("url.logout")> |
|---|
| 91 | <cfset structDelete(session, "user")> |
|---|
| 92 | <cflogout> |
|---|
| 93 | </cfif> |
|---|
| 94 | |
|---|
| 95 | <!--- handle security ---> |
|---|
| 96 | <cflogin> |
|---|
| 97 | <!--- are we trying to logon? ---> |
|---|
| 98 | <cfif isDefined("form.logon")> |
|---|
| 99 | <cfif isDefined("form.username") and isDefined("form.password")> |
|---|
| 100 | <cfif application.galleon.user.authenticate(trim(form.username), trim(form.password))> |
|---|
| 101 | <!--- good logon, grab their groups ---> |
|---|
| 102 | <cfset mygroups = application.galleon.user.getGroupsForUser(trim(form.username))> |
|---|
| 103 | <cfset session.user = application.galleon.user.getUser(trim(form.username))> |
|---|
| 104 | <cfloginuser name="#trim(form.username)#" password="#trim(form.password)#" roles="#mygroups#"> |
|---|
| 105 | </cfif> |
|---|
| 106 | </cfif> |
|---|
| 107 | </cfif> |
|---|
| 108 | |
|---|
| 109 | </cflogin> |
|---|
| 110 | |
|---|
| 111 | <!--- Used by index, forums, and threads ----> |
|---|
| 112 | <!--- however, if threads, default to lastpost ---> |
|---|
| 113 | <!--- however, don't do this in the admin ;) ---> |
|---|
| 114 | <cfif not structKeyExists(variables, "isAdmin")> |
|---|
| 115 | <cfif findNoCase("threads.cfm", cgi.script_name)> |
|---|
| 116 | <cfparam name="url.sort" default="lastpost"> |
|---|
| 117 | <cfparam name="url.sortdir" default="desc"> |
|---|
| 118 | <cfelse> |
|---|
| 119 | <cfparam name="url.sort" default="name"> |
|---|
| 120 | <cfparam name="url.sortdir" default="asc"> |
|---|
| 121 | </cfif> |
|---|
| 122 | </cfif> |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | <cfsetting enablecfoutputonly=false> |
|---|