source: trunk/Application.cfc @ 27

Revision 27, 3.0 KB checked in by mattwoodward, 4 years ago (diff)

changes for new fckeditor

Line 
1<!---
2Copyright: (c) 2006 The MachBlog Authors
3Authors: Matt Woodward (mpwoodward@gmail.com) & Peter J. Farrell (pjf@maestropublishing.com)
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16
17$Id:  $
18
19Notes:
20--->
21<cfcomponent displayname="Application CFC" output="true" extends="MachII.mach-ii">
22
23        <cfprocessingdirective pageencoding="utf-8" />
24       
25        <cfscript>
26                // application settings
27                this.name = "machblog";
28                this.clientmanagement = false;
29                this.sessionmanagement = true;
30                this.sessiontimeout = createTimeSpan(0,20,0,0);
31                this.setclientcookies = false;
32               
33                // mach-ii settings
34                MACHII_CONFIG_PATH = ExpandPath("./config/mach-ii.xml.cfm");
35                MACHII_APP_KEY = GetFileFromPath(ExpandPath("."));
36                MACHII_CONFIG_MODE = 0;
37                MACHII_VALIDATE_XML = false;
38                MACHII_DTD_PATH = ExpandPath("/MachII/mach-ii_1_5_0.dtd");
39        </cfscript>
40
41        <cffunction name="onApplicationStart" output="false" returntype="boolean">
42                <cfset loadFramework() />
43                <cfreturn true />
44        </cffunction>
45
46        <cffunction name="onRequestStart" output="true" returntype="boolean">
47                <cfargument name="targetPage" type="string" required="true" />
48
49                <cfset request.self = "index.cfm" />
50                <cfset setEncoding("form", "utf-8") />
51                <cfset setEncoding("url", "utf-8") />
52               
53                <!--- handle initialization and FCKeditor settings --->
54                <cfif Not StructKeyExists(Application, "init") OR Not Application.init OR (StructKeyExists(url, "init") AND url.init EQ "yes")>
55                        <cflock scope="Application" type="exclusive" timeout="10" throwontimeout="yes">
56                                <cfset Application.init = true />
57                                <cfset Application.FCKeditor = StructNew() />
58                                <cfset Application.FCKeditor.userFilesPath = "/machblog/uploads/" />
59                        </cflock>
60       
61                        <cfset MACHII_CONFIG_MODE = 1 />
62                        <cfsetting requesttimeout="120" />
63                        <cfobjectcache action="CLEAR" />
64                <cfelse>
65                        <cfset MACHII_CONFIG_MODE = 0 />
66                </cfif>
67               
68                <!--- security for fckeditor --->
69                <cfif find("fckeditor", CGI.SCRIPT_NAME)>
70                        <cfif not structKeyExists(session, "user") or session.user.getUserId() eq "">
71                                You are not logged in.
72                                <cfabort />
73                        </cfif>
74                </cfif>
75
76                <!--- set per-session cookies if not using j2ee session management --->
77                <cfif structKeyExists(session, "cfid") and (not structKeyExists(cookie, "cfid") or not structKeyExists(cookie, "cftoken"))>
78                        <cfcookie name="cfid" value="#session.cfid#" />
79                        <cfcookie name="cftoken" value="#session.cftoken#" />
80                </cfif>
81
82                <!--- handle the request --->
83                <cfif findNoCase("index.cfm", listLast(arguments.targetPage, "/"))>
84                        <cfset handleRequest() />
85                </cfif>
86               
87                <cfreturn true />
88        </cffunction>
89
90</cfcomponent>
Note: See TracBrowser for help on using the repository browser.