From e190f6f93be9926b5c8da8b677e11b5b98b84d8e Mon Sep 17 00:00:00 2001 From: tianya Date: Mon, 21 Nov 2022 22:19:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=A8=8B=E5=BA=8Fstep1?= =?UTF-8?q?=E3=80=81step2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/api.php | 52 +++- src/admin/js/indexbody.js | 96 +++--- src/admin/templets/index_body.htm | 379 +++++++++++++++-------- src/system/common.inc.php | 5 +- src/system/database/dedesqlite.class.php | 3 + 5 files changed, 349 insertions(+), 186 deletions(-) diff --git a/src/admin/api.php b/src/admin/api.php index baf02004..ad37366a 100644 --- a/src/admin/api.php +++ b/src/admin/api.php @@ -4,7 +4,24 @@ define('DEDEADMIN', str_replace("\\", '/', dirname(__FILE__))); require_once(DEDEADMIN.'/../system/common.inc.php'); require_once(DEDEINC.'/userlogin.class.php'); AjaxHead(); -$action = isset($action) && in_array($action, array('is_need_check_code'))? $action : ''; +$action = isset($action) && in_array($action, array('is_need_check_code','has_new_version','get_changed_files'))? $action : ''; +/** + * 登录鉴权 + * + * @return void + */ +function checkLogin() +{ + $cuserLogin = new userLogin(); + if ($cuserLogin->getUserID() <= 0 || $cuserLogin->getUserType() != 10) { + echo json_encode(array( + "code" => -1, + "msg" => "当前操作需要登录超级管理员账号", + "data" => null, + )); + exit; + } +} if ($action === 'is_need_check_code') { $cuserLogin = new userLogin(); $isNeed = $cuserLogin->isNeedCheckCode($userid); @@ -16,5 +33,38 @@ if ($action === 'is_need_check_code') { ), )); exit; +} else if ($action === 'has_new_version'){ + require_once(DEDEINC.'/libraries/dedehttpdown.class.php'); + checkLogin(); + //是否存在更新版本 + $offUrl = DEDEBIZURL."/version?version={$cfg_version_detail}&formurl={$nurl}&phpver={$phpv}&os={$sp_os}&mysqlver={$mysql_ver}{$add_query}&json=1"; + $dhd = new DedeHttpDown(); + $dhd->OpenUrl($offUrl); + $data = $dhd->GetHtml(); + echo $data; +} else if ($action === 'get_changed_files'){ + require_once(DEDEINC.'/libraries/dedehttpdown.class.php'); + checkLogin(); + // 获取本地更改过的文件 + $hashUrl = DEDEBIZCDN.'/release/'.$cfg_version_detail.'.json'; + $dhd = new DedeHttpDown(); + $dhd->OpenUrl($hashUrl); + $data = $dhd->GetJSON(); + $changedFiles = array(); + foreach ($data as $file) { + $realFile = DEDEROOT. str_replace("\\", '/', $file->filename); + if ( file_exists($realFile) && md5_file($realFile) !== $file->hash) { + $changedFiles[] = $file; + continue; + } + } + echo json_encode(array( + "code" => 0, + "msg" => "", + "data" => array( + "files" => $changedFiles, + ), + )); + exit; } ?> \ No newline at end of file diff --git a/src/admin/js/indexbody.js b/src/admin/js/indexbody.js index 6ea961b3..27c26c5e 100644 --- a/src/admin/js/indexbody.js +++ b/src/admin/js/indexbody.js @@ -29,7 +29,7 @@ function DedeCopyToClipboard(text) { textarea.select(); document.execCommand('copy', true); document.body.removeChild(textarea); - } + } } $(function () { $.get("index_testenv.php", function (data) { @@ -46,7 +46,7 @@ $(function () { function copyFn() { var val = document.getElementById('text'); window.getSelection().selectAllChildren(val); - document.execCommand ("Copy"); + document.execCommand("Copy"); alert("环境配置信息已复制"); } //Dedebiz info @@ -106,40 +106,6 @@ function LoadServer() { 如果您已购买商业版授权,可以在我们的授权中心查询到相信关授权信息,如果查询结果与实际授权不符,则说明您可能购买了非法商业授权,请及时与我们取得联系。 - - - - - -
您的后台已是最新软件版本
- - - - - - - - - - - - - - - - -
本更新提供了重要的安全性更新,建议所有用户升级,软件更新将覆盖以下文件,请做好备份。下一步
文件1:.../system/database/1.php
文件2:.../system/database/2.php
文件3:.../system/database/3.php
- - - - - - - -
更新诊断出数据结构有问题,可能无法正常使用后台,是否尝试修复数据?
- 修复 - 取消 -
`); } }); @@ -161,25 +127,29 @@ Date.prototype.Format = function (fmt) { //author: meizz } function LoadStat() { $.get("index_body.php?dopost=get_statistics", function (data) { - let rsp = JSON.parse(data); - if (rsp.code == 200) { - var tpv = parseInt(rsp.result.pv); - var tuv = parseInt(rsp.result.uv); - var tip = parseInt(rsp.result.ip); - var tvv = parseInt(rsp.result.vv); - $("#today_pv").html(tpv); - $("#today_uv").html(tuv); - $("#today_ip").html(tip); - $("#today_vv").html(tvv); - $.get("index_body.php?dopost=get_statistics&sdate=-1", function (data) { - let rsp = JSON.parse(data); - if (rsp.code == 200) { - $("#total_pv").html(parseInt(rsp.result.pv) + tpv); - $("#total_uv").html(parseInt(rsp.result.uv) + tuv); - $("#total_ip").html(parseInt(rsp.result.ip) + tip); - $("#total_vv").html(parseInt(rsp.result.vv) + tvv); - } - }); + try { + let rsp = JSON.parse(data); + if (rsp.code == 200) { + var tpv = parseInt(rsp.result.pv); + var tuv = parseInt(rsp.result.uv); + var tip = parseInt(rsp.result.ip); + var tvv = parseInt(rsp.result.vv); + $("#today_pv").html(tpv); + $("#today_uv").html(tuv); + $("#today_ip").html(tip); + $("#today_vv").html(tvv); + $.get("index_body.php?dopost=get_statistics&sdate=-1", function (data) { + let rsp = JSON.parse(data); + if (rsp.code == 200) { + $("#total_pv").html(parseInt(rsp.result.pv) + tpv); + $("#total_uv").html(parseInt(rsp.result.uv) + tuv); + $("#total_ip").html(parseInt(rsp.result.ip) + tip); + $("#total_vv").html(parseInt(rsp.result.vv) + tvv); + } + }); + } + } catch (error) { + console.log(error) } }); var d = new Date(); @@ -187,12 +157,16 @@ function LoadStat() { var s = d.Format("yyyy-MM-dd"); s = s.replaceAll("-", ""); $.get("index_body.php?dopost=get_statistics&sdate=" + s, function (data) { - let rsp = JSON.parse(data); - if (rsp.code == 200) { - $("#yestoday_pv").html(rsp.result.pv); - $("#yestoday_uv").html(rsp.result.uv); - $("#yestoday_ip").html(rsp.result.ip); - $("#yestoday_vv").html(rsp.result.vv); + try { + let rsp = JSON.parse(data); + if (rsp.code == 200) { + $("#yestoday_pv").html(rsp.result.pv); + $("#yestoday_uv").html(rsp.result.uv); + $("#yestoday_ip").html(rsp.result.ip); + $("#yestoday_vv").html(rsp.result.vv); + } + } catch (error) { + console.log(error) } }); } diff --git a/src/admin/templets/index_body.htm b/src/admin/templets/index_body.htm index 64cbf9e1..bacf0daa 100644 --- a/src/admin/templets/index_body.htm +++ b/src/admin/templets/index_body.htm @@ -1,137 +1,272 @@ - - - - 系统主页 - - - - - - - - - - - - - -
-
-
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
浏览次数(PV)独立访客(UV)独立地址(IP)访问次数(VV)
今日0000
昨日0000
历史累计0000
-
+ + + + + 系统主页 + + + + + + + + + + + + + + + +
+
+
+
+ -
-
-
系统信息 - 软件:|操作系统:|Web服务器:|PHP:|数据库:GetVersion();?> -
-
- - - - - - - +
+
-
-

操作系统

- -
-
-
-

Web服务器

- -
-
-
-

服务器IP

- -
-
-
-

PHP版本

- -
-
-
-

数据库版本

- GetVersion();?> -
-
+ + + + + + + + + + + + + + + + + + + + + -
浏览次数(PV)独立访客(UV)独立地址(IP)访问次数(VV)
今日0000
昨日0000
-
+ + 历史累计 + 0 + 0 + 0 + 0 + + +
-
-
-
- 版本授权 - 软件更新 -
-
正在加载
+
+
+
+
系统信息 + 软件: + |操作系统: + |Web服务器: + |PHP: + |数据库: + GetVersion();?> + +
+
+ + + + + + + + +
+
+

操作系统

+ + + +
+
+
+

Web服务器

+ + + +
+
+
+

服务器IP

+ + + +
+
+
+

PHP版本

+ + + +
+
+
+

数据库版本

+ + GetVersion();?> + +
+
-
-
- -
- -
+
+
+
+
+ 版本授权 + 软件更新 + 已是最新软件版本
+
正在加载
-
-
-
- 最新文档 -
-
正在加载
+
+
+
+ +
+ +
+
+
+
+
+
+ 最新文档 +
+
正在加载
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/system/common.inc.php b/src/system/common.inc.php index f545b950..db382929 100755 --- a/src/system/common.inc.php +++ b/src/system/common.inc.php @@ -37,7 +37,8 @@ define('DEDEDATA', substr(DEDEINC, 0, -6).'data'); define('DEDESTATIC', DEDEROOT.'/static'); define('DEDEMEMBER', DEDEROOT.'/user'); define('DEDETEMPLATE', DEDEROOT.'/theme'); -define('DEDEBIZURL', "https://www.dedebiz.com");//DedeBiz商业支持 +define('DEDEBIZURL', "http://127.0.0.1:8898");//DedeBiz商业支持 +define('DEDEBIZCDN', "https://cdn.dedebiz.com");//DedeBizCDN镜像 define('DEDEVER', 6);//当前系统大版本 define('DEDEPUB', ' -----BEGIN PUBLIC KEY----- @@ -186,7 +187,7 @@ $cfg_soft_dir = $cfg_medias_dir.'/soft'; $cfg_other_medias = $cfg_medias_dir.'/media'; //软件摘要信息,请不要删除,否则系统无法正确接收系统漏洞或升级信息 $cfg_version = 'V6'; -$cfg_version_detail = '6.2.0'; //详细版本号 +$cfg_version_detail = '6.0.0'; //详细版本号 $cfg_soft_lang = 'utf-8'; $cfg_soft_public = 'base'; $cfg_softname = '得得系统'; diff --git a/src/system/database/dedesqlite.class.php b/src/system/database/dedesqlite.class.php index 86ccbb51..fe10bade 100755 --- a/src/system/database/dedesqlite.class.php +++ b/src/system/database/dedesqlite.class.php @@ -182,6 +182,9 @@ class DedeSqlite if ($this->safeCheck) CheckSql($this->queryString, 'update'); $t1 = ExecTime(); $rs = $this->linkID->exec($this->queryString); + if ($rs === false) { + var_dump_cli("Error in fetch ".$this->linkID->lastErrorMsg().",SQL:{$this->queryString}"); + } //查询性能测试 if ($this->recordLog) { $queryTime = ExecTime() - $t1;