root/trunk/website/blog/Application.cfm

Revision 5, 7.0 kB (checked in by DanWilson, 17 years ago)

Initial Commit Of ModelGlue? Website (upgrade to blogcfc 511)

Line 
1<cfsetting enablecfoutputonly="true" showdebugoutput="false">
2
3<cfset request.mashed.mode = "blog" />
4
5<!---
6        Name         : Application.cfm
7        Author       : Raymond Camden
8        Created      : Some time ago
9        Last Updated : April 13, 2007
10        History      : Reset history for version 5.7
11                                 : Added comments, and Scott P's pod manager cfc (rkc 4/13/07)
12        Purpose          : Blog application page
13--->
14
15<cfset setEncoding("form","utf-8")>
16<cfset setEncoding("url","utf-8")>
17
18<!--- Edit this line if you are not using a default blog --->
19<cfset blogname = "modelglue">
20
21<!---
22The prefix is now dynamic in case 2 people want to run blog.cfc on the same machine. Normally they
23          would run both blogs with the same org, and use different names, but on an ISP that may not be possible.
24          So I base part of the application name on the file path.
25
26        Name can only be 64 max. So we will take right most part.
27--->
28<cfset prefix = hash(getCurrentTemplatePath())>
29<cfset prefix = reReplace(prefix, "[^a-zA-Z]","","all")>
30<cfset prefix = right(prefix, 64 - len("_blog_#blogname#"))>
31<cfapplication name="model_glue_com" sessionManagement="true" loginStorage="session">
32
33<!--- Our exception template. --->
34<cferror type="exception" template="error.cfm">
35
36<cfinclude template="includes/udf.cfm">
37
38<!--- By default we cache a lot of information. Allow reinit=1 in the URL to restart cache. --->
39<cfif not isDefined("application.init") or isDefined("url.reinit")>
40
41        <!--- load and init blog --->
42        <cfset application.blog = createObject("component","org.camden.blog.blog").init(blogname)>
43
44        <!--- Root folder for uploaded images, used under images folder --->
45        <cfset application.imageroot = application.blog.getProperty("imageroot")>
46
47        <!--- locale related --->
48        <cfset application.resourceBundle = createObject("component","org.hastings.locale.resourcebundle")>
49
50        <!--- Path may be different if admin. --->
51
52        <cfset currentPath = getDirectoryFromPath(getCurrentTemplatePath()) />
53        <cfset theFile = currentPath & "includes/main" />
54        <cfset lylaFile = getRelativePath(currentPath & "includes/captcha.xml") />
55        <cfset slideshowdir = currentPath & "images/slideshows/" & application.imageroot />
56
57        <cfset application.resourceBundle.loadResourceBundle(theFile, application.blog.getProperty("locale"))>
58        <cfset application.resourceBundleData = application.resourceBundle.getResourceBundleData()>
59        <cfset application.localeutils = createObject("component","org.hastings.locale.utils")>
60        <cfset application.localeutils.loadLocale(application.blog.getProperty("locale"))>
61
62        <!--- load slideshow --->
63        <cfset application.slideshow = createObject("component", "org.camden.blog.slideshow").init(slideshowdir)>
64
65        <!--- Use Captcha? --->
66        <cfset application.usecaptcha = application.blog.getProperty("usecaptcha")>
67
68        <!--- Use CFFORMProtect? --->
69        <cfset application.usecfp = application.blog.getProperty("usecfp")>
70
71        <cfif application.usecaptcha>
72                <cfset application.captcha = createObject("component","org.captcha.captchaService").init(configFile="#lylaFile#") />
73                <cfset application.captcha.setup() />
74        </cfif>
75
76        <!--- load coldfish --->
77        <cfset coldfish = createObject("component", "org.delmore.coldfish").init()>
78        <!--- inject it --->
79        <cfset application.blog.setCodeRenderer(coldfish)>
80
81        <!--- use tweetbacks? --->
82        <cfset application.usetweetbacks = application.blog.getProperty("usetweetbacks")>
83        <cfif not isBoolean(application.usetweetbacks)>
84                <cfset application.usetweetbacks = false>
85        </cfif>
86        <cfif application.usetweetbacks>
87                <cfset application.sweetTweets = createObject("component","org.sweettweets.SweetTweets").init()/>
88        </cfif>
89       
90        <!--- clear scopecache --->
91        <cfmodule template="tags/scopecache.cfm" scope="application" clearall="true">
92
93        <cfset majorVersion = listFirst(server.coldfusion.productversion)>
94        <cfset minorVersion = listGetAt(server.coldfusion.productversion,2,",.")>
95        <cfset cfversion = majorVersion & "." & minorVersion>
96
97        <cfset application.isColdFusionMX7 = server.coldfusion.productname is "ColdFusion Server" and cfversion gte 7>
98
99        <!--- Used in various places --->
100        <cfset application.rootURL = application.blog.getProperty("blogURL")>
101        <!--- per documentation - rooturl should be http://www.foo.com/something/something/index.cfm --->
102        <cfset application.rootURL = reReplace(application.rootURL, "(.*)/index.cfm", "\1")>
103
104        <!--- used for cache purposes is 60 minutes --->
105        <cfset application.timeout = 60*60>
106
107        <!--- how many entries? --->
108        <cfset application.maxEntries = application.blog.getProperty("maxentries")>
109
110        <!--- TBs allowed? --->
111        <cfset application.trackbacksAllowed = application.blog.getProperty("allowtrackbacks")>
112
113        <!--- Gravatars allowed? --->
114        <cfset application.gravatarsAllowed = application.blog.getProperty("allowgravatars")>
115
116        <!--- Load the Utils CFC --->
117        <cfset application.utils = createObject("component", "org.camden.blog.utils")>
118
119        <!--- Load the Page CFC --->
120        <cfset application.page = createObject("component", "org.camden.blog.page").init(dsn=application.blog.getProperty("dsn"), username=application.blog.getProperty("username"), password=application.blog.getProperty("password"),blog=blogname)>
121
122        <!--- Load the TB CFC --->
123        <cfset application.textblock = createObject("component", "org.camden.blog.textblock").init(dsn=application.blog.getProperty("dsn"), username=application.blog.getProperty("username"), password=application.blog.getProperty("password"),blog=blogname)>
124
125        <!--- Do we have comment moderation? --->
126        <cfset application.commentmoderation = application.blog.getProperty("moderate")>
127
128        <!--- Do we allow file browsing in the admin? --->
129        <cfset application.filebrowse = application.blog.getProperty("filebrowse")>
130
131        <!--- Do we allow settings in the admin? --->
132        <cfset application.settings = application.blog.getProperty("settings")>
133
134        <!--- load pod --->
135        <cfset application.pod = createObject("component", "org.camden.blog.pods")>
136
137        <!--- We are initialized --->
138        <cfset application.init = true>
139
140</cfif>
141
142<!--- Let's make a pointer to our RB --->
143<!---
144Attention:
145Normally, I'd say "rb" as a variable name is sucky. It is too short
146and not clear. However, I'm using it as a localization service, and I'm DARN tired
147of typing the same crap over and over again.
148
149In case you are curious, the line below makes a pointer to the struct.
150Also note I didn't use Variables. Again, I'm tired of the typing.
151--->
152<cfset rb = application.utils.getResource>
153
154<!--- Used to remember the pages we have viewed. Helps keep view count down. --->
155<cfif not structKeyExists(session,"viewedpages")>
156        <cfset session.viewedpages = structNew()>
157</cfif>
158
159<!--- KillSwitch for comments. We don't authenticate because this kill uuid is something only the admin can get. --->
160<cfif structKeyExists(url, "killcomment")>
161        <cfset application.blog.killComment(url.killcomment)>
162</cfif>
163<!--- Quick approval for comments --->
164<cfif structKeyExists(url, "approvecomment")>
165        <cfset application.blog.approveComment(url.approvecomment)>
166</cfif>
167
168
169<cfsetting enablecfoutputonly="false">
170
Note: See TracBrowser for help on using the browser.