admincp_menu.php
9.16 KB
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_menu.php 34521 2014-05-14 09:07:25Z nemohou $
*/
global $_G;
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$isfounder = isset($isfounder) ? $isfounder : isfounder();
$topmenu = $menu = array();
$topmenu = array (
'index' => '',
'global' => '',
'style' => '',
'topic' => '',
'user' => '',
'portal' => '',
'forum' => '',
'group' => '',
'safe' => '',
'extended' => '',
'plugin' => $isfounder ? 'plugins' : '',
'tools' => '',
);
$menu['index'] = array(
array('menu_home', 'index'),
array('menu_custommenu_manage', 'misc_custommenu'),
);
$custommenu = get_custommenu();
$menu['index'] = array_merge($menu['index'], $custommenu);
$menu['global'] = array(
array('menu_setting_basic', 'setting_basic'),
array('menu_setting_access', 'setting_access'),
array('menu_setting_functions', 'setting_functions'),
array('menu_setting_optimize', 'setting_cachethread'),
array('menu_setting_seo', 'setting_seo'),
array('menu_setting_domain', 'domain'),
array('menu_setting_follow', 'setting_follow'),
array('menu_setting_home', 'setting_home'),
array('menu_setting_user', 'setting_permissions'),
array('menu_setting_credits', 'setting_credits'),
array('menu_setting_datetime', 'setting_datetime'),
array('menu_setting_attachments', 'setting_attach'),
array('menu_setting_imgwater', 'setting_imgwater'),
array('menu_posting_attachtypes', 'misc_attachtype'),
array('menu_setting_search', 'setting_search'),
array('menu_setting_district', 'district'),
array('menu_setting_ranklist', 'setting_ranklist'),
array('menu_setting_mobile', 'setting_mobile'),
array('menu_setting_antitheft', 'setting_antitheft'),
);
$menu['style'] = array(
array('menu_setting_customnav', 'nav'),
array('menu_setting_styles', 'setting_styles'),
array('menu_styles', 'styles'),
$isfounder ? array('menu_styles_templates', 'templates') : null,
array('menu_posting_smilies', 'smilies'),
array('menu_click', 'click'),
array('menu_thread_stamp', 'misc_stamp'),
array('menu_posting_editor', 'setting_editor'),
array('menu_misc_onlinelist', 'misc_onlinelist'),
);
$menu['topic'] = array(
array('menu_moderate_posts', 'moderate'),
array('menu_posting_censors', 'misc_censor'),
array('menu_maint_report', 'report'),
array('menu_setting_tag', 'tag'),
array('menu_setting_collection', 'collection'),
array(cplang('nav_forum'), '', 1),
array('menu_maint_threads', 'threads'),
array('menu_maint_prune', 'prune'),
array('menu_maint_attaches', 'attach'),
array(cplang('nav_forum'), '', 2),
array(cplang('nav_group'), '', 1),
array('menu_maint_threads_group', 'threads_group'),
array('menu_maint_prune_group', 'prune_group'),
array('menu_maint_attaches_group', 'attach_group'),
array(cplang('nav_group'), '', 2),
array(cplang('thread'), '', 1),
array('menu_moderate_recyclebin', 'recyclebin'),
array('menu_moderate_recyclebinpost', 'recyclebinpost'),
array('menu_threads_forumstick', 'threads_forumstick'),
array('menu_postcomment', 'postcomment'),
array(cplang('thread'), '', 2),
array(cplang('nav_home'), '', 1),
array('menu_maint_doing', 'doing'),
array('menu_maint_blog', 'blog'),
array('menu_maint_blog_recycle_bin', 'blogrecyclebin'),
array('menu_maint_feed', 'feed'),
array('menu_maint_album', 'album'),
array('menu_maint_pic', 'pic'),
array('menu_maint_comment', 'comment'),
array('menu_maint_share', 'share'),
array(cplang('nav_home'), '', 2),
);
$menu['user'] = array(
array('menu_members_edit', 'members_search'),
array('menu_members_add', 'members_add'),
array('menu_members_profile', 'members_profile'),
array('menu_members_stat', 'members_stat'),
array('menu_members_newsletter', 'members_newsletter'),
array('menu_members_mobile', 'members_newsletter_mobile'),
array('menu_usertag', 'usertag'),
array('menu_members_edit_ban_user', 'members_ban'),
array('menu_members_ipban', 'members_ipban'),
array('menu_members_credits', 'members_reward'),
array('menu_moderate_modmembers', 'moderate_members'),
array('menu_admingroups', 'admingroup'),
array('menu_usergroups', 'usergroups'),
array('menu_follow', 'specialuser_follow'),
array('menu_defaultuser', 'specialuser_defaultuser'),
array('members_verify_profile', 'verify_verify'),
array('menu_members_verify_setting', 'verify'),
);
if(is_array($_G['setting']['verify'])) {
foreach($_G['setting']['verify'] as $vid => $verify) {
if($vid != 7 && $verify['available']) {
$menu['user'][] = array($verify['title'], "verify_verify_$vid");
}
}
}
$menu['portal'] = array(
array('menu_portalcategory', 'portalcategory'),
array('menu_article', 'article'),
array('menu_topic', 'topic'),
array('menu_html', 'makehtml'),
array('menu_diytemplate', 'diytemplate'),
array('menu_block', 'block'),
array('menu_blockstyle', 'blockstyle'),
array('menu_blockxml', 'blockxml'),
array('menu_portalpermission', 'portalpermission'),
array('menu_blogcategory', 'blogcategory'),
array('menu_albumcategory', 'albumcategory'),
);
$menu['forum'] = array(
array('menu_forums', 'forums'),
array('menu_forums_merge', 'forums_merge'),
array('menu_forums_infotypes', 'threadtypes'),
array('menu_grid', 'grid'),
);
$menu['group'] = array(
array('menu_group_setting', 'group_setting'),
array('menu_group_type', 'group_type'),
array('menu_group_manage', 'group_manage'),
array('menu_group_userperm', 'group_userperm'),
array('menu_group_level', 'group_level'),
array('menu_group_mod', 'group_mod'),
);
$menu['safe'] = array(
array('menu_safe_setting', 'setting_sec'),
array('menu_safe_security', 'cloud_security'),
array('menu_safe_seccheck', 'setting_seccheck'),
array('menu_security', 'optimizer_security'),
array('menu_safe_accountguard', 'setting_accountguard'),
);
$menu['extended'] = array(
array('menu_misc_announce', 'announce'),
array('menu_adv_custom', 'adv'),
array('menu_tasks', 'tasks'),
array('menu_magics', 'magics'),
array('menu_medals', 'medals'),
array('menu_misc_help', 'faq'),
array('menu_ec', 'setting_ec'),
array('menu_misc_link', 'misc_link'),
array('memu_focus_topic', 'misc_focus'),
array('menu_misc_relatedlink', 'misc_relatedlink'),
array('menu_card', 'card')
);
if(file_exists($menudir = DISCUZ_ROOT.'./source/admincp/menu')) {
$adminextend = $adminextendnew = array();
if(file_exists($adminextendfile = DISCUZ_ROOT.'./data/sysdata/cache_adminextend.php')) {
@include $adminextendfile;
}
$menudirhandle = dir($menudir);
while($entry = $menudirhandle->read()) {
if(!in_array($entry, array('.', '..')) && preg_match("/^menu\_([\w\.]+)$/", $entry, $entryr) && substr($entry, -4) == '.php' && strlen($entry) < 30 && is_file($menudir.'/'.$entry)) {
@include_once $menudir.'/'.$entry;
$adminextendnew[] = $entryr[1];
}
}
if($adminextend != $adminextendnew) {
@unlink($adminextendfile);
if($adminextendnew) {
require_once libfile('function/cache');
writetocache('adminextend', getcachevars(array('adminextend' => $adminextendnew)));
}
unset($_G['lang']['admincp']);
}
}
if($isfounder) {
$menu['plugin'] = array(
array('menu_addons', 'cloudaddons'),
array('menu_plugins', 'plugins'),
);
}
loadcache('adminmenu');
if(is_array($_G['cache']['adminmenu'])) {
foreach($_G['cache']['adminmenu'] as $row) {
if($row['name'] == 'plugins_system') {
$row['name'] = cplang('plugins_system');
}
$menu['plugin'][] = array($row['name'], $row['action'], $row['sub']);
}
}
if(!$menu['plugin']) {
unset($topmenu['plugin']);
}
$menu['tools'] = array(
array('menu_tools_updatecaches', 'tools_updatecache'),
array('menu_tools_updatecounters', 'counter'),
array('menu_logs', 'logs'),
array('menu_misc_cron', 'misc_cron'),
$isfounder ? array('menu_tools_fileperms', 'tools_fileperms') : null,
$isfounder ? array('menu_tools_filecheck', 'checktools_filecheck') : null,
$isfounder ? array('menu_tools_hookcheck', 'checktools_hookcheck') : null,
$isfounder ? array('menu_cloud_doctor', 'cloud_doctor') : null,
);
if($isfounder) {
$topmenu['founder'] = '';
$menu['founder'] = array(
array('menu_founder_perm', 'founder_perm'),
array('menu_setting_mail', 'setting_mail'),
array('menu_patch', 'patch'),
array('menu_setting_uc', 'setting_uc'),
array('menu_db', 'db_export'),
array('menu_membersplit', 'membersplit_check'),
array('menu_postsplit', 'postsplit_manage'),
array('menu_threadsplit', 'threadsplit_manage'),
array('menu_upgrade', 'upgrade'),
array('menu_optimizer', 'optimizer_performance'),
);
$menu['uc'] = array();
}
if(!isfounder() && !isset($GLOBALS['admincp']->perms['all'])) {
$menunew = $menu;
foreach($menu as $topkey => $datas) {
if($topkey == 'index') {
continue;
}
$itemexists = 0;
foreach($datas as $key => $data) {
if(array_key_exists($data[1], $GLOBALS['admincp']->perms)) {
$itemexists = 1;
} else {
unset($menunew[$topkey][$key]);
}
}
if(!$itemexists) {
unset($topmenu[$topkey]);
unset($menunew[$topkey]);
}
}
$menu = $menunew;
}
?>