admincp_main.php
15.9 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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_main.php 33988 2013-09-13 10:06:19Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
lang('admincp_menu');
$extra = cpurl('url');
$extra = $extra && getgpc('action') ? $extra : 'action=index';
$charset = CHARSET;
$title = cplang('admincp_title');
$header_welcome = cplang('header_welcome');
$header_logout = cplang('header_logout');
$header_bbs = cplang('header_bbs');
if(isfounder()) {
cplang('founder_admin');
} else {
if($GLOBALS['admincp']->adminsession['cpgroupid']) {
$cpgroup = C::t('common_admincp_group')->fetch($GLOBALS['admincp']->adminsession['cpgroupid']);
$cpadmingroup = $cpgroup['cpgroupname'];
} else {
cplang('founder_master');
}
}
require './source/admincp/admincp_menu.php';
$basescript = ADMINSCRIPT;
$shownotice = '';
if($_G['uid'] && $_G['member']['allowadmincp'] == 1 && ($_G['setting']['showpatchnotice'] == 1 || !isset($_G['cookie']['checkpatch']))) {
$discuz_patch = new discuz_patch();
if($_G['setting']['showpatchnotice'] == 1) {
$notice = $discuz_patch->fetch_patch_notice();
if($notice['data']) {
$shownotice = '<div class="notice"><a href="'.$basescript.'?action=patch" id="notice">'.($notice['fixed'] ? $lang['patch_fix_complete'] : $lang['patch_fix_rigth_now']).'</a></div>';
}
}
if(!isset($_G['cookie']['checkpatch'])) {
$discuz_patch->check_patch();
}
}
if($_G['uid'] && $_G['member']['allowadmincp'] == 1 && !$shownotice && $_G['setting']['upgrade']) {
$shownotice = '<div class="notice"><a href="'.$basescript.'?action=upgrade" id="notice">'.$lang['upgrade_right_now'].'</a></div>';
}
if($_G['uid'] && $_G['member']['allowadmincp'] == 1 && !isset($_G['cookie']['checkupgrade'])) {
$discuz_upgrade = new discuz_upgrade();
if($discuz_upgrade->check_upgrade()) {
if(empty($shownotice)) {
$shownotice = '<div class="notice"><a href="'.$basescript.'?action=upgrade" id="notice">'.$lang['upgrade_right_now'].'</a></div>';
}
}
dsetcookie('checkupgrade', 1, 7200);
}
echo <<<EOT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=$charset">
<title>$title</title>
<meta content="Comsenz Inc." name="Copyright" />
<link rel="stylesheet" href="static/image/admincp/admincp.css?{$_G[style][verhash]}" type="text/css" media="all" />
<script src="{$_G[setting][jspath]}common.js?{$_G[style][verhash]}" type="text/javascript"></script>
</head>
<body style="margin: 0px" scroll="no">
<div id="append_parent"></div>
$shownotice
<table id="frametable" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr>
<td colspan="2" height="90">
<div class="mainhd">
<a href="$basescript?frames=yes&action=index" class="logo">Discuz! Administrator's Control Panel</a>
<div class="uinfo" id="frameuinfo">
<p>$header_welcome, $cpadmingroup <em>{$_G['member']['username']}</em> [<a href="$basescript?action=logout" target="_top">$header_logout</a>]</p>
<p class="btnlink"><a href="index.php" target="_blank">$header_bbs</a></p>
</div>
<div class="navbg"></div>
<div class="nav">
<ul id="topmenu">
EOT;
foreach($topmenu as $k => $v) {
if($k == 'cloud') {
continue;
}
if($v === '') {
$v = @array_keys($menu[$k]);
$v = $menu[$k][$v[0]][1];
}
showheader($k, $v);
}
$uc_api_url = '';
if($isfounder) {
loaducenter();
$uc_api_url = UC_API;
echo '<li><em><a id="header_uc" hidefocus="true" href="'.UC_API.'/admin.php?m=frame" onmouseover="previewheader(\'uc\')" onmouseout="previewheader()" onclick="uc_login=1;toggleMenu(\'uc\', \'\');doane(event);">'.cplang('header_uc').'</a></em></li>';
$topmenu['uc'] = '';
}
$headers = "'".implode("','", array_keys($topmenu))."'";
echo <<<EOT
</ul>
<div class="currentloca">
<p id="admincpnav"></p>
</div>
<div class="navbd"></div>
<div class="sitemapbtn">
<div style="float: left; margin:-7px 10px 0 0"><form name="search" method="post" autocomplete="off" action="$basescript?action=search" target="main"><input type="text" name="keywords" value="" class="txt" x-webkit-speech speech /> <input type="hidden" name="searchsubmit" value="yes" class="btn" /><input type="submit" name="searchsubmit" value="$lang[search]" class="btn" style="margin-top: 5px;vertical-align:middle" /></form></div>
<span id="add2custom" style="display: none"></span>
<a href="###" id="cpmap" onclick="showMap();return false;"><img src="static/image/admincp/btn_map.gif" title="$lang[admincp_maptext]" width="46" height="18" /></a>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td valign="top" width="160" class="menutd">
<div id="leftmenu" class="menu">
EOT;
foreach ($menu as $k => $v) {
showmenu($k, $v);
}
unset($menu);
$plugindefaultkey = $isfounder ? 1 : 0;
echo <<<EOT
</div>
</td>
<td valign="top" width="100%" class="mask">
<iframe src="$basescript?$extra" id="main" name="main" width="100%" height="100%" frameborder="0" scrolling="yes" style="overflow: visible;display:"></iframe>
</td>
</tr>
</table>
<div id="scrolllink" style="display: none">
<span onclick="menuScroll(1)"><img src="static/image/admincp/scrollu.gif" /></span><span onclick="menuScroll(2)"><img src="static/image/admincp/scrolld.gif" /></span>
</div>
<div class="copyright">
<p>Powered by <a href="http://www.discuz.net/" target="_blank">Discuz!</a> {$_G['setting']['version']}</p>
<p>© 2001-2013, <a href="http://www.comsenz.com/" target="_blank">Comsenz Inc.</a></p>
</div>
<div id="cpmap_menu" class="custom" style="display: none">
<div class="cmain" id="cmain"></div>
<div class="cfixbd"></div>
</div>
<script type="text/JavaScript">
var cookiepre = '{$_G[config][cookie][cookiepre]}', cookiedomain = '{$_G[config][cookie][cookiedomain]}', cookiepath = '{$_G[config][cookie][cookiepath]}';
var headers = new Array($headers), admincpfilename = '$basescript', menukey = '';
function switchheader(key) {
if(!key || !$('header_' + key)) {
return;
}
for(var k in top.headers) {
if($('menu_' + headers[k])) {
$('menu_' + headers[k]).style.display = headers[k] == key ? '' : 'none';
}
}
var lis = $('topmenu').getElementsByTagName('li');
for(var i = 0; i < lis.length; i++) {
if(lis[i].className == 'navon') lis[i].className = '';
}
$('header_' + key).parentNode.parentNode.className = 'navon';
}
var headerST = null;
function previewheader(key) {
if(key) {
headerST = setTimeout(function() {
for(var k in top.headers) {
if($('menu_' + headers[k])) {
$('menu_' + headers[k]).style.display = headers[k] == key ? '' : 'none';
}
}
var hrefs = $('menu_' + key).getElementsByTagName('a');
for(var j = 0; j < hrefs.length; j++) {
hrefs[j].className = '';
}
}, 1000);
} else {
clearTimeout(headerST);
}
}
function toggleMenu(key, url) {
menukey = key;
switchheader(key);
if(url) {
parent.main.location = admincpfilename + '?action=' + url;
var hrefs = $('menu_' + key).getElementsByTagName('a');
for(var j = 0; j < hrefs.length; j++) {
hrefs[j].className = j == (key == 'plugin' ? $plugindefaultkey : 0) ? 'tabon' : '';
}
}
if(key == 'uc') {
parent.main.location = $('header_uc').href + '&a=main&iframe=1';
}
setMenuScroll();
}
function setMenuScroll() {
$('frametable').style.width = document.body.offsetWidth < 1000 ? '1000px' : '100%';
var obj = $('menu_' + menukey);
if(!obj) {
return;
}
var scrollh = document.body.offsetHeight - 160;
obj.style.overflow = 'visible';
obj.style.height = '';
$('scrolllink').style.display = 'none';
if(obj.offsetHeight + 150 > document.body.offsetHeight && scrollh > 0) {
obj.style.overflow = 'hidden';
obj.style.height = scrollh + 'px';
$('scrolllink').style.display = '';
}
}
function resizeHeadermenu() {
var lis = $('topmenu').getElementsByTagName('li');
var maxsize = $('frameuinfo').offsetLeft - 160, widths = 0, moi = -1, mof = '';
if($('menu_mof')) {
$('topmenu').removeChild($('menu_mof'));
}
if($('menu_mof_menu')) {
$('append_parent').removeChild($('menu_mof_menu'));
}
for(var i = 0; i < lis.length; i++) {
widths += lis[i].offsetWidth;
if(widths > maxsize) {
lis[i].style.visibility = 'hidden';
var sobj = lis[i].childNodes[0].childNodes[0];
if(sobj) {
mof += '<a href="'+ sobj.getAttribute('href') + '" onclick="$(\'' + sobj.id + '\').onclick()">› ' + sobj.innerHTML + '</a><br style="clear:both" />';
}
} else {
lis[i].style.visibility = 'visible';
}
}
if(mof) {
for(var i = 0; i < lis.length; i++) {
if(lis[i].style.visibility == 'hidden') {
moi = i;
break;
}
}
mofli = document.createElement('li');
mofli.innerHTML = '<em><a href="javascript:;">»</a></em>';
mofli.onmouseover = function () { showMenu({'ctrlid':'menu_mof','pos':'43'}); }
mofli.id = 'menu_mof';
$('topmenu').insertBefore(mofli, lis[moi]);
mofmli = document.createElement('li');
mofmli.className = 'popupmenu_popup';
mofmli.style.width = '150px';
mofmli.innerHTML = mof;
mofmli.id = 'menu_mof_menu';
mofmli.style.display = 'none';
$('append_parent').appendChild(mofmli);
}
}
function menuScroll(op, e) {
var obj = $('menu_' + menukey);
var scrollh = document.body.offsetHeight - 160;
if(op == 1) {
obj.scrollTop = obj.scrollTop - scrollh;
} else if(op == 2) {
obj.scrollTop = obj.scrollTop + scrollh;
} else if(op == 3) {
if(!e) e = window.event;
if(e.wheelDelta <= 0 || e.detail > 0) {
obj.scrollTop = obj.scrollTop + 20;
} else {
obj.scrollTop = obj.scrollTop - 20;
}
}
}
function menuNewwin(obj) {
var href = obj.parentNode.href;
if(obj.parentNode.href.indexOf(admincpfilename + '?') != -1) {
href += '&frames=yes';
}
window.open(href);
doane();
}
function initCpMenus(menuContainerid) {
var key = '', lasttabon1 = null, lasttabon2 = null, hrefs = $(menuContainerid).getElementsByTagName('a');
for(var i = 0; i < hrefs.length; i++) {
if(menuContainerid == 'leftmenu' && '$extra'.indexOf(hrefs[i].href.substr(hrefs[i].href.indexOf(admincpfilename + '?') + admincpfilename.length + 1)) != -1) {
if(lasttabon1) {
lasttabon1.className = '';
}
if(hrefs[i].parentNode.parentNode.tagName == 'OL') {
hrefs[i].parentNode.parentNode.style.display = '';
hrefs[i].parentNode.parentNode.parentNode.className = 'lsub desc';
key = hrefs[i].parentNode.parentNode.parentNode.parentNode.parentNode.id.substr(5);
} else {
key = hrefs[i].parentNode.parentNode.id.substr(5);
}
hrefs[i].className = 'tabon';
lasttabon1 = hrefs[i];
}
if(!hrefs[i].getAttribute('ajaxtarget')) hrefs[i].onclick = function() {
if(menuContainerid != 'custommenu') {
var lis = $(menuContainerid).getElementsByTagName('li');
for(var k = 0; k < lis.length; k++) {
if(lis[k].firstChild && lis[k].firstChild.className != 'menulink') {
if(lis[k].firstChild.tagName != 'DIV') {
lis[k].firstChild.className = '';
} else {
var subid = lis[k].firstChild.getAttribute('sid');
if(subid) {
var sublis = $(subid).getElementsByTagName('li');
for(var ki = 0; ki < sublis.length; ki++) {
if(sublis[ki].firstChild && sublis[ki].firstChild.className != 'menulink') {
sublis[ki].firstChild.className = '';
}
}
}
}
}
}
if(this.className == '') this.className = menuContainerid == 'leftmenu' ? 'tabon' : '';
}
if(menuContainerid != 'leftmenu') {
var hk, currentkey;
var leftmenus = $('leftmenu').getElementsByTagName('a');
for(var j = 0; j < leftmenus.length; j++) {
if(leftmenus[j].parentNode.parentNode.tagName == 'OL') {
hk = leftmenus[j].parentNode.parentNode.parentNode.parentNode.parentNode.id.substr(5);
} else {
hk = leftmenus[j].parentNode.parentNode.id.substr(5);
}
if(this.href.indexOf(leftmenus[j].href) != -1) {
if(lasttabon2) {
lasttabon2.className = '';
}
leftmenus[j].className = 'tabon';
if(leftmenus[j].parentNode.parentNode.tagName == 'OL') {
leftmenus[j].parentNode.parentNode.style.display = '';
leftmenus[j].parentNode.parentNode.parentNode.className = 'lsub desc';
}
lasttabon2 = leftmenus[j];
if(hk != 'index') currentkey = hk;
} else {
leftmenus[j].className = '';
}
}
if(currentkey) toggleMenu(currentkey);
hideMenu();
}
}
}
return key;
}
function lsub(id, obj) {
display(id);
obj.className = obj.className != 'lsub' ? 'lsub' : 'lsub desc';
if(obj.className != 'lsub') {
setcookie('cpmenu_' + id, '');
} else {
setcookie('cpmenu_' + id, 1, 31536000);
}
setMenuScroll();
}
var header_key = initCpMenus('leftmenu');
toggleMenu(header_key ? header_key : 'index');
function initCpMap() {
var ul, hrefs, s = '', count = 0;
for(var k in headers) {
if(headers[k] != 'index' && headers[k] != 'uc' && $('header_' + headers[k])) {
s += '<tr><td valign="top"><h4>' + $('header_' + headers[k]).innerHTML + '</h4></td><td valign="top">';
ul = $('menu_' + headers[k]);
if(!ul) {
continue;
}
hrefs = ul.getElementsByTagName('a');
for(var i = 0; i < hrefs.length; i++) {
s += '<a href="' + hrefs[i].href + '" target="' + hrefs[i].target + '" k="' + headers[k] + '">' + hrefs[i].innerHTML + '</a>';
}
s += '</td></tr>';
count++;
}
}
var width = 720;
s = '<div class="cnote" style="width:' + width + 'px"><span class="right"><a href="###" class="flbc" onclick="hideMenu();return false;"></a></span><h3>$lang[admincp_maptitle]</h3></div>' +
'<div class="cmlist" style="width:' + width + 'px;height: 410px"><table id="mapmenu" cellspacing="0" cellpadding="0">' + s +
'</table></div>';
$('cmain').innerHTML = s;
$('cmain').style.width = (width > 1000 ? 1000 : width) + 'px';
}
initCpMap();
initCpMenus('mapmenu');
var cmcache = false;
function showMap() {
showMenu({'ctrlid':'cpmap','evt':'click', 'duration':3, 'pos':'00'});
}
function resetEscAndF5(e) {
e = e ? e : window.event;
actualCode = e.keyCode ? e.keyCode : e.charCode;
if(actualCode == 27) {
if($('cpmap_menu').style.display == 'none') {
showMap();
} else {
hideMenu();
}
}
if(actualCode == 116 && parent.main) {
parent.main.location.reload();
if(document.all) {
e.keyCode = 0;
e.returnValue = false;
} else {
e.cancelBubble = true;
e.preventDefault();
}
}
}
function uc_left_menu(uc_menu_data) {
var leftmenu = $('menu_uc');
leftmenu.innerHTML = '';
var html_str = '';
for(var i=0;i<uc_menu_data.length;i+=2) {
html_str += '<li><a href="'+uc_menu_data[(i+1)]+'" hidefocus="true" onclick="uc_left_switch(this)" target="main"><em onclick="menuNewwin(this)" title="$lang[nav_newwin]"></em>'+uc_menu_data[i]+'</a></li>';
}
leftmenu.innerHTML = html_str;
}
var uc_left_last = null;
function uc_left_switch(obj) {
if(uc_left_last) {
uc_left_last.className = '';
}
obj.className = 'tabon';
uc_left_last = obj;
}
function uc_modify_sid(sid) {
$('header_uc').href = '$uc_api_url/admin.php?m=frame';
}
_attachEvent(document.documentElement, 'keydown', resetEscAndF5);
_attachEvent(window, 'resize', setMenuScroll, document);
_attachEvent(window, 'resize', resizeHeadermenu, document);
if(BROWSER.ie){
$('leftmenu').onmousewheel = function(e) { menuScroll(3, e) };
} else {
$('leftmenu').addEventListener("DOMMouseScroll", function(e) { menuScroll(3, e) }, false);
}
resizeHeadermenu();
</script>
</body>
</html>
EOT;
?>