添加 后台首页文件校验功能

This commit is contained in:
康盛Discuz! 2016-12-16 16:41:20 +08:00
parent 9b5834065a
commit d39cb2f98f
4 changed files with 73 additions and 19 deletions

View File

@ -4,7 +4,7 @@
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_checktools.php 36278 2016-12-09 07:52:35Z nemohou $
* $Id: admincp_checktools.php 36306 2016-12-16 08:12:49Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
@ -17,13 +17,21 @@ if(!isfounder()) cpmsg('noaccess_isfounder', '', 'error');
if($operation == 'filecheck') {
$step = max(1, intval($_GET['step']));
shownav('tools', 'nav_filecheck');
showsubmenusteps('nav_filecheck', array(
array('nav_filecheck_confirm', $step == 1),
array('nav_filecheck_verify', $step == 2),
array('nav_filecheck_completed', $step == 3)
));
$homecheck = !empty($_GET['homecheck']);
if(!$homecheck) {
$step = max(1, intval($_GET['step']));
shownav('tools', 'nav_filecheck');
showsubmenusteps('nav_filecheck', array(
array('nav_filecheck_confirm', $step == 1),
array('nav_filecheck_verify', $step == 2),
array('nav_filecheck_completed', $step == 3)
));
} else {
define('FOOTERDISABLED', true);
$step = 3;
}
if($step == 1) {
cpmsg(cplang('filecheck_tips_step1'), 'action=checktools&operation=filecheck&step=2', 'button', '', FALSE);
} elseif($step == 2) {
@ -31,7 +39,12 @@ if($operation == 'filecheck') {
} elseif($step == 3) {
if(!$discuzfiles = @file('./source/admincp/discuzfiles.md5')) {
cpmsg('filecheck_nofound_md5file', '', 'error');
if(!$homecheck) {
cpmsg('filecheck_nofound_md5file', '', 'error');
} else {
ajaxshowheader();
ajaxshowfooter();
}
}
$md5data = array();
@ -119,6 +132,28 @@ if($operation == 'filecheck') {
$fileststus && $dirlist[$fileststus][$dir][basename($file)] = array('', '');
}
}
$modifiedfiles = count($modifylist);
$deletedfiles = count($dellist);
$unknownfiles = count($addlist);
$doubt = intval($doubt);
C::t('common_cache')->insert(array(
'cachekey' => 'checktools_filecheck_result',
'cachevalue' => serialize(array($modifiedfiles, $deletedfiles, $unknownfiles, $doubt)),
'dateline' => $_G['timestamp'],
), false, true);
if($homecheck) {
ajaxshowheader();
echo "<em class=\"edited\">$lang[filecheck_modify]: $modifiedfiles</em> &nbsp; ".
"<em class=\"del\">$lang[filecheck_delete]: $deletedfiles</em> &nbsp; ".
"<em class=\"unknown\">$lang[filecheck_unknown]: $unknownfiles</em> &nbsp; ".
"<em class=\"unknown\">$lang[filecheck_doubt]: $doubt</em> &nbsp; ".
$lang['filecheck_last_homecheck'].': '.dgmdate(TIMESTAMP, 'u').' <a href="'.ADMINSCRIPT.'?action=checktools&operation=filecheck&step=3">['.$lang['filecheck_view_list'].']</a>';
ajaxshowfooter();
}
$result = $resultjs = '';
$dirnum = 0;
foreach($dirlist as $status => $filelist) {
@ -135,11 +170,6 @@ if($operation == 'filecheck') {
$resultjs .= '$(\'status_'.$status.'\').style.display=\'none\';';
}
$modifiedfiles = count($modifylist);
$deletedfiles = count($dellist);
$unknownfiles = count($addlist);
$doubt = intval($doubt);
$result .= '<script>function showresult(o) {'.$resultjs.'$(\'status_\' + o).style.display=\'\';}</script>';
showtips('filecheck_tips');
showtableheader('filecheck_completed');

View File

@ -4,7 +4,7 @@
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_index.php 36299 2016-12-15 06:35:18Z nemohou $
* $Id: admincp_index.php 36306 2016-12-16 08:12:49Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
@ -191,6 +191,27 @@ if($membersmod || $threadsmod || $postsmod || $medalsmod || $blogsmod || $pictur
}
showtablefooter();
if(isfounder()) {
$filecheck = C::t('common_cache')->fetch('checktools_filecheck_result');
if($filecheck) {
list($modifiedfiles, $deletedfiles, $unknownfiles, $doubt) = unserialize($filecheck['cachevalue']);
$filecheckresult = "<em class=\"edited\">$lang[filecheck_modify]: $modifiedfiles</em> &nbsp; ".
"<em class=\"del\">$lang[filecheck_delete]: $deletedfiles</em> &nbsp; ".
"<em class=\"unknown\">$lang[filecheck_unknown]: $unknownfiles</em> &nbsp; ".
"<em class=\"unknown\">$lang[filecheck_doubt]: $doubt</em> &nbsp; ".
$lang['filecheck_last_homecheck'].': '.dgmdate($filecheck['dateline'], 'u').' <a href="'.ADMINSCRIPT.'?action=checktools&operation=filecheck&step=3">['.$lang['filecheck_view_list'].']</a>';
} else {
$filecheckresult = '';
}
showtableheader($lang['nav_filecheck'].' <a href="javascript:;" onclick="ajaxget(\''.ADMINSCRIPT.'?action=checktools&operation=filecheck&homecheck=yes\', \'filecheck_div\')">['.$lang['filecheck_check_now'].']</a>', 'nobottom fixpadding');
echo '<tr><td><div id="filecheck_div">'.$filecheckresult.'</div></td></tr>';
showtablefooter();
if(TIMESTAMP - $filecheck['dateline'] > 86400 * 7) {
echo '<script>ajaxget(\''.ADMINSCRIPT.'?action=checktools&operation=filecheck&homecheck=yes\', \'filecheck_div\');</script>';
}
}
showtableheader('home_onlines', 'nobottom fixpadding');
echo '<tr><td>'.$onlines.'</td></tr>';
showtablefooter();

View File

@ -83,7 +83,7 @@ e48263dce4356396f52bfbcfb5071c64 *source/admincp/admincp_block.php
dda34ea9edc3f37fb7f3c8bae9d587e0 *source/admincp/admincp_blogcategory.php
20479a5ebcc8c8de3dac7a61764af979 *source/admincp/admincp_blogrecyclebin.php
ac14d324de325ee9485caca992f796c1 *source/admincp/admincp_card.php
f394fe161b022e06f3d505fd2cce2b70 *source/admincp/admincp_checktools.php
615d2c26ecb9e7818cbce80d286a5adb *source/admincp/admincp_checktools.php
b40bc52669c410d5fbedaaf37550fb01 *source/admincp/admincp_click.php
85ef3aadb8fad22f669b99e44da52649 *source/admincp/admincp_cloud.php
b3d0837eef87b5ebfd0b7a1e177eed64 *source/admincp/admincp_cloudaddons.php
@ -103,7 +103,7 @@ d71f49a5a00dfb6350c83c2459e5d689 *source/admincp/admincp_forums.php
813040e4f5aac34d57418cf2b86ce38f *source/admincp/admincp_founder.php
9100bd5f83e6bffb1d80750b17a608da *source/admincp/admincp_grid.php
377b4f5663f9d281437cbb1292a54e40 *source/admincp/admincp_group.php
42ab9d72b92b3c53b629909adbf96ec7 *source/admincp/admincp_index.php
10b8d370374958030ef1242aa7833950 *source/admincp/admincp_index.php
bfc548c408092bbd9cb683440a743a2e *source/admincp/admincp_login.php
b83851a2371b917115ade4d6ba6e7863 *source/admincp/admincp_logs.php
1bb4886383e494b58807893cdd465f70 *source/admincp/admincp_magics.php
@ -1073,7 +1073,7 @@ e6f1091f01a20d35925c95d7a62222bc *source/language/home/lang_magic.php
664d74dbc5ba16c367af3436eaf17e4c *source/language/home/lang_template.php
d41d8cd98f00b204e9800998ecf8427e *source/language/index.htm
0e1469673cc7b512bfaef290d974a046 *source/language/lang_action.php
e7be828f8db8155e3db272af02a6f4dc *source/language/lang_admincp.php
8c17d7e8e3c40290b5b600d1dc27e5f3 *source/language/lang_admincp.php
b9c66d9e883a768cac74ae0e90ce6ee7 *source/language/lang_admincp_cloud.php
d6a2fb315dab1868cca8e9a7944bb5d9 *source/language/lang_admincp_login.php
2fcb38a6248b7a00684b532818968c0f *source/language/lang_admincp_menu.php

View File

@ -4,7 +4,7 @@
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: lang_admincp.php 36278 2016-12-09 07:52:35Z nemohou $
* $Id: lang_admincp.php 36306 2016-12-16 08:12:49Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
@ -5917,6 +5917,9 @@ $lang = array
'filecheck_doubt' => '一周内更新',
'filecheck_check_ok' => '正确',
'filecheck_status' => '状态',
'filecheck_check_now' => '立即检测',
'filecheck_view_list' => '查看文件列表',
'filecheck_last_homecheck' => '最后校验时间',
'hookcheck_start' => '开 始',
'hookcheck_verifying' => '正在进行嵌入点校验,请稍候......',