forked from wangkilin/cms
/
index.php
161 lines (139 loc) · 4.65 KB
/
index.php
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
<?php
/*
[SupeSite] (C) 2007-2009 Comsenz Inc.
$Id: index.php 11388 2009-03-04 08:12:55Z zhaofei $
*/
include_once('./common.php');
//获取变量
if($_SCONFIG['urltype'] == '2' || $_SCONFIG['urltype'] == '5') {
$parsegetvar = empty($_SERVER['PATH_INFO'])?(empty($_SERVER['ORIG_PATH_INFO'])?'':substr($_SERVER['ORIG_PATH_INFO'], 1)):substr($_SERVER['PATH_INFO'], 1);
}
if(empty($parsegetvar)) {
$parsegetvar = empty($_SERVER['QUERY_STRING'])?'':$_SERVER['QUERY_STRING'];
}
if(!empty($parsegetvar)) {
$parsegetvar = addslashes($parsegetvar);
$_SGET = parseparameter(str_replace(array('-','_'), '/', $parsegetvar));
}
//变量处理
if(!empty($_SGET['viewnews'])) {
$_SGET['action'] = 'viewnews';
$_SGET['itemid'] = intval($_SGET['viewnews']);
} elseif(!empty($_SGET['category'])) {
$_SGET['action'] = 'category';
$_SGET['catid'] = intval($_SGET['category']);
}elseif(!empty($_SGET['viewthread'])) {
$_SGET['action'] = 'viewthread';
$_SGET['tid'] = intval($_SGET['viewthread']);
}elseif(empty($_SGET['action']) && !empty($_SGET['uid'])) {
$spacegetvar = 'uid='.$_SGET['uid'];
unset($_SGET['uid']);
foreach($_SGET as $k => $v) $spacegetvar .= "&$k=$v";
showmessage('', S_URL.'/space.php?'.$spacegetvar, 0);
} else {
$_SGET['action'] = empty($_SGET['action'])?'index':trim(preg_replace("/[^a-z0-9\-\_]/i", '', trim($_SGET['action'])));
}
//站点关闭
if(!empty($_SCONFIG['closesite']) && $_SGET['action'] != 'login') {
if(empty($_SGLOBAL['group']['groupid']) || $_SGLOBAL['group']['groupid'] != 1) {
if(empty($_SCONFIG['closemessage'])) $_SCONFIG['closemessage'] = $lang['site_close'];
showmessage($_SCONFIG['closemessage'].'<p style="font-size:12px;"><a href="'.geturl("action/login").'">'.$lang['admin_login'].'</a></p>');
}
}
$_SGLOBAL['maxpages'] = 500;
//限制分页500
if(!empty($_SGET['page'])) {
if($_SGET['page'] > $_SGLOBAL['maxpages']) {
$_SGET['page'] = $_SGLOBAL['maxpages'];
}
}
//频道关闭隐藏
if(($_SGET['action'] == 'channel' && in_array($_SGET['name'], $_SCONFIG['closechannels'])) || in_array($_SGET['action'], $_SCONFIG['closechannels']) || ($_SGET['action'] == 'bbs' && !discuz_exists()) || (in_array($_SGET['action'], array('uchblog', 'uchimage', 'blogdetail', 'bloglist', 'imagedetail', 'imagelist')) && !uchome_exists())) {
$_SGET['action'] = 'index';
}
//关键字、描述、导航、标题
$keywordarr = $descriptionarr = $guidearr = $titlearr = array();
//自定义频道
if($_SGET['action'] == 'channel') {
$_SGET['name'] = empty($_SGET['name'])?'':trim(preg_replace("/[^a-z0-9\-\_]/i", '', trim($_SGET['name'])));
if(!empty($_SGET['name'])) {
if(!empty($_SCONFIG['hidechannels'][$_SGET['name']])) {
$_SCONFIG['channel'][$_SGET['name']] = $_SCONFIG['hidechannels'][$_SGET['name']];
}
$scriptfile = S_ROOT.'./channel/channel_'.$_SGET['name'].'.php';
if(file_exists($scriptfile)) {
include_once($scriptfile);
exit();
}
}
}
//自定义模型
if($_SGET['action'] == 'model') {
$_SGET['name'] = empty($_SGET['name'])?'':trim(preg_replace("/[^a-z0-9\-\_]/i", '', trim($_SGET['name'])));
if(!empty($_SGET['name'])) {
if(!empty($_SGET['itemid'])) {
$scriptfile = S_ROOT.'./modelview.php';
} else {
$scriptfile = S_ROOT.'./modelindex.php';
}
if(file_exists($scriptfile)) {
include_once($scriptfile);
exit();
}
}
}
//系统频道
if($_SGET['action'] != 'index') {
$scriptfile = S_ROOT.'./'.$_SGET['action'].'.php';
if(file_exists($scriptfile)) {
include_once($scriptfile);
exit();
}
} else {
$forumarr = array();
$forumnum = 0;
@include_once S_ROOT.'/data/system/bbsforums.cache.php';
if(!empty($_SGLOBAL['bbsforumarr']) && is_array($_SGLOBAL['bbsforumarr'])) {
foreach($_SGLOBAL['bbsforumarr'] as $value) {
if($value['allowshare'] == 1 && $forumnum < 12) {
if($value['type'] == 'forum') {
//链接
if($_SCONFIG['bbsurltype'] == 'bbs') {
$value['url'] = B_URL.'/forumdisplay.php?fid='.$value['fid'];
} else {
$value['url'] = geturl('action/forumdisplay/fid/'.$value['fid']);
}
$forumarr[] = $value;
$forumnum++;
}
}
}
}
}
//默认首页
if(!empty($channels['default']) && $channels['default'] != 'index.php') {
if(strpos($channels['default'], '?')) {
sheader(S_URL.'/'.$channels['default']);
exit();
} else {
include_once(S_ROOT.'./'.$channels['default']);
}
} else {
if(!empty($_SCONFIG['htmlindex'])) {
$_SHTML['action'] = 'index';
$_SGLOBAL['htmlfile'] = gethtmlfile($_SHTML);
ehtml('get', $_SCONFIG['htmlindextime']);
$_SCONFIG['debug'] = 0;
}
$title = $_SCONFIG['sitename'];
$keywords = $_SCONFIG['sitename'];
$description = $_SCONFIG['sitename'];
include template('index');
ob_out();
if(!empty($_SCONFIG['htmlindex'])) {
ehtml('make');
} else {
maketplblockvalue('cache');
}
}
?>