forked from cevio/PJBlog4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.asp
186 lines (169 loc) · 4.58 KB
/
config.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!--#include file="server/core/obay.asp" -->
<!--#include file="profile/handler/config.asp" -->
<%
/*
* version V4.0 ( 2012-08-10 )
* http://sizzle.cc http://pjhome.net
* 全局设置
* 可以通过这里的设置对全局网站有关功能开启和关闭以及数据库路径的修改。
* 具体参见各项说明。
*/
config.debug = false; // 是否开启DEBUG模式
config.useApp = true; // 是否使用APP
config.cacheAccess = "profile/caches"; // 缓存文件夹名
config.platform = "http://platform.pjhome.net";
config.version = "4.0.0.405";
/*
* 网站模块映射
* 调用模块时候注意模块返回变量。
* 在调用前请先确定模块的稳定性和存在性。
* 建议使用官方推荐模块
*/
// 通用模块映射
map["DBO"] = "server/core/dbo";
map["FSO"] = "server/core/fso";
map["STREAM"] = "server/core/stream";
map["XML"] = "server/core/xml";
map["XMLHTTP"] = "server/core/xmlhttp";
map["WINHTTP"] = "server/core/winhttp";
map["UPLOAD"] = "server/core/upload";
map["COOKIE"] = "server/core/cookie";
map["DATE"] = "server/core/date";
map["MD5"] = "server/core/md5";
map["SHA1"] = "server/core/sha1";
map["PACKAGE"] = "server/core/package";
map["SPKPACKAGE"] = "server/core/spkPackage";
map["SQL"] = "server/core/sql";
map["DOWN"] = "server/core/download";
// 逻辑模块映射
map["fn"] = "server/fn";
map["gra"] = "server/gravatar";
map["openDataBase"] = "server/dataBaseOperation";
map["cache"] = "server/cache";
map["icon"] = "server/getIcons";
map["tags"] = "server/tags";
map["xmltable"] = "server/xmltable";
map["pluginCustom"] = "server/pluginCustom";
map["sap"] = "server/SystemActionProxy";
map["member"] = "server/member";
map["article"] = "server/article";
map["comment"] = "server/comment";
map["guestbook"] = "server/guestbook";
map["theme"] = "server/theme";
map["plugin"] = "server/plugin";
map["status"] = "server/status";
// handler处理模块映射
map["cacheHandle"] = "profile/handler/cache";
// 缓存模块
map["cache_global"] = "server/module/global";
map["cache_category"] = "server/module/category";
// cms模块
map["cms"] = "server/proxy/cms";
http.service = function( callback, isposter ){
http.async(function(req){
try{
require("status")();
var j = req.query.j, callbacks = {};
if ( config.user.admin === true || ( (isposter === true) && (config.user.poster === true) ) ){
var dbo = require("DBO"),
connecte = require("openDataBase"),
sap = require("sap");
if ( connecte === true ){
callback.call(callbacks, req, dbo, sap);
if ( callbacks[j] !== undefined ){
return callbacks[j]();
}else{
return {
success: false,
error: "未找到对应处理模块"
}
}
}else{
return {
success: false,
error: "数据库连接失败"
}
}
}else{
return {
success: false,
error: "非法权限操作"
}
}
}catch(e){
return {
success: false,
error: e.message
}
}
});
CloseConnect();
}
/*
* 系统默认变量
* 不允许修改和赋值
* 改动可能引起系统异常
*/
config.conn = null;
config.user = {
login: false,
id: 0
}
config.page = { assets: {}, server: {} };
/*
* 全局ASA文件加载
* 如果修改过以上的config.appName属性,请删除网站根目录的global.asa文件
* 之后系统将自动创建该文件
*/
asa();
/*
* 数据库关闭
* 尝试关闭数据库方法。一般写在系统结束末尾。
* 请谨慎使用此方法。
*/
function CloseConnect(){
try{
config.conn.Close();
config.conn = null;
}catch(error){
console.push(error.message);
}
}
function ConsoleClose( word ){
CloseConnect();
console.end(word);
}
function ConsoleDisAble( word ){
CloseConnect();
console.log(word);
}
/*
* 数据源缓存
* 打开某一数据源,通过缓存
* 适用于模板制作。
*/
function LoadCacheModule( ModuleName, ModuleCallback ){
var ModuleCacheDatas = require(ModuleName);
if ( typeof ModuleCallback === "function" ){
ModuleCallback( ModuleCacheDatas );
}
}
function LoadPluginsCacheModule( ModuleName, ModuleCallback ){
if ( config.pluginModen === undefined ){
config.pluginModen = require("pluginCustom");
}
var ModuleCacheDatas = config.pluginModen.loadPlugin( ModuleName );
if ( ModuleCacheDatas !== null ){
if ( typeof ModuleCallback === "function" ){
ModuleCallback( ModuleCacheDatas );
}else{
return ModuleCacheDatas;
}
}
}
var pageCustomParams = {
tempCaches: {},
tempParams: {},
tempModules: {}
};
%>