From fcb9729c0695dedaac78749c3cedd61ef03299ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=91=A8=E9=83=A8=E8=90=BD?= Date: Fri, 9 Jul 2021 21:32:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E6=97=B6=E6=A3=80=E6=B5=8B=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- upload/index.php | 4 + upload/install/include/install_function.php | 76 ++++++++++++++++++- upload/install/include/install_lang.php | 6 ++ upload/install/index.php | 7 ++ .../source/function/function_cloudaddons.php | 2 +- 5 files changed, 92 insertions(+), 3 deletions(-) diff --git a/upload/index.php b/upload/index.php index 374da65d1..f826c6da3 100644 --- a/upload/index.php +++ b/upload/index.php @@ -7,6 +7,10 @@ * $Id: index.php 34524 2014-05-15 04:42:23Z nemohou $ */ +if(version_compare(PHP_VERSION, '8.0.0', '>=')) { + exit('This version of Discuz! is not compatible with >= PHP 8.0, Please install or update to higher version.'); +} + if(!empty($_SERVER['QUERY_STRING']) && is_numeric($_SERVER['QUERY_STRING'])) { $_ENV['curapp'] = 'home'; $_GET = array('mod'=>'space', 'uid'=>$_SERVER['QUERY_STRING']); diff --git a/upload/install/include/install_function.php b/upload/install/include/install_function.php index 56271f0f8..6c0eba1eb 100644 --- a/upload/install/include/install_function.php +++ b/upload/install/include/install_function.php @@ -450,8 +450,38 @@ function show_form(&$form_items, $error_msg) { show_footer(); } +function dunserialize($data) { + if(($ret = unserialize($data)) === false) { + $ret = unserialize(stripslashes($data)); + } + return $ret; +} + +function cloudaddons_getversion($instid) { + $timestamp = time(); + $data = 'product=discuzx&sitever='.DISCUZ_VERSION.'/'.DISCUZ_RELEASE.'&sitecharset='.CHARSET.'&addonversion=1&os='.PHP_OS .'&php='.PHP_VERSION.'&web='.$_SERVER['SERVER_SOFTWARE'].'&lang='.INSTALL_LANG.'&type=installer&instid='.$instid; + $param = 'data='.rawurlencode(base64_encode($data)); + $param .= '&md5hash='.substr(md5($data.$timestamp), 8, 8).'×tamp='.$timestamp; + $param .= '&mod=app&ac=installcheck'; + + $url = 'https://addon.dismall.com/index.php?'.$param; + + $return = dfopen($url, 0, '', '', FALSE, '', 3); + + if(!empty($return)) { + $ret = dunserialize($return); + if(is_array($ret) && isset($ret['is_latest']) && !$ret['is_latest']) { + return $ret; + } else { + return array('is_latest' => 1, 'url' => ''); + } + } else { + return array('is_latest' => 1, 'url' => ''); + } +} + function show_license() { - global $self, $uchidden, $step; + global $self, $uchidden, $step, $instid; $next = $step + 1; if(VIEW_OFF) { @@ -464,6 +494,27 @@ function show_license() { $license = str_replace(' ', '  ', lang('license')); $lang_agreement_yes = lang('agreement_yes'); $lang_agreement_no = lang('agreement_no'); + + $lang_php8 = lang('php8_tips'); + $lang_noutf8 = lang('no_utf8_tips').lang('next_tips'); + $lang_unstable = lang('unstable_tips').lang('next_tips'); + + $is_php8 = version_compare(PHP_VERSION, '8.0.0', '>=') ? 1 : 0; + $is_utf8 = (strtolower(CHARSET) == 'utf-8') ? 1 : 0; + $is_unstable = (strlen(DISCUZ_RELEASE) != 8 || DISCUZ_RELEASE == 20180101) ? 1 : 0; + + $info = cloudaddons_getversion($instid); + + $hrefurl = empty($info['url']) ? 'https://gitee.com/Discuz/DiscuzX/releases' : $info['url']; + + if($info['is_latest']) { + $is_latest = 1; + $lang_nolatest = lang('no_latest_tips').lang('next_tips'); + } else { + $is_latest = 0; + $lang_nolatest = empty($info['tips']) ? (lang('no_latest_tips').lang('next_tips')) : ($info['tips'].lang('next_tips')); + } + echo <<
@@ -472,10 +523,31 @@ function show_license() {
-   +  
+ EOT; show_footer(); diff --git a/upload/install/include/install_lang.php b/upload/install/include/install_lang.php index 3141b9a85..4de2a37f4 100644 --- a/upload/install/include/install_lang.php +++ b/upload/install/include/install_lang.php @@ -308,6 +308,12 @@ $lang = array( ', + 'php8_tips' => '您好,当前产品暂不支持 PHP 8 安装,请降级到至少 PHP 7.4 后再试!', + 'no_utf8_tips' => '您好,您使用的版本为 GBK / BIG-5 等本地化编码版本,此版本已经不作为主推版本,如果您计划建设新站点【强烈】建议您使用最新正式 UTF-8 版本安装。', + 'no_latest_tips' => '您好,您使用的版本较老,可能存在 Bug 以及安全隐患,如无特殊情况建议您改用最新正式 UTF-8 版本安装。', + 'unstable_tips' => '您好,您使用的版本为非正式版本,可能存在未知的 Bug 或缺陷,如果您计划正式建站或购买插件建议您使用最新正式 UTF-8 版本安装。', + 'next_tips' => '\r\n点击【确定】跳转到最新正式 UTF-8 版本下载页面,点击【取消】继续安装(不推荐)', + 'uc_installed' => '您已经安装过 UCenter,如果需要重新安装,请删除 data/install.lock 文件', 'i_agree' => '我已仔细阅读,并同意上述条款中的所有内容', 'supportted' => '支持', diff --git a/upload/install/index.php b/upload/install/index.php index 1c3457cbe..a5bdb0fb4 100644 --- a/upload/install/index.php +++ b/upload/install/index.php @@ -66,6 +66,13 @@ if(in_array($method, array('app_reg', 'ext_info'))) { $default_appurl = $bbserver.substr($PHP_SELF, 0, strrpos($PHP_SELF, '/') - 8); } +if(isset($_COOKIE['ULTRAXINSTID']) && strpos($_COOKIE['ULTRAXINSTID'], 'ULTRAXINSTID') === 0) { + $instid = $_COOKIE['ULTRAXINSTID']; +} else { + $instid = uniqid('ULTRAXINSTID', true); + setcookie('ULTRAXINSTID', $instid); +} + if($method == 'show_license') { transfer_ucinfo($_POST); diff --git a/upload/source/function/function_cloudaddons.php b/upload/source/function/function_cloudaddons.php index ff35e967b..f29018d41 100644 --- a/upload/source/function/function_cloudaddons.php +++ b/upload/source/function/function_cloudaddons.php @@ -51,7 +51,7 @@ function cloudaddons_url($extra) { global $_G; require_once DISCUZ_ROOT.'./source/discuz_version.php'; - $data = 'siteuniqueid='.rawurlencode(cloudaddons_getuniqueid()).'&siteurl='.rawurlencode($_G['siteurl']).'&sitever='.DISCUZ_VERSION.'/'.DISCUZ_RELEASE.'&sitecharset='.CHARSET.'&mysiteid='.$_G['setting']['my_siteid'].'&addonversion=1&dlip='.CLOUDADDONS_DOWNLOAD_IP; + $data = 'siteuniqueid='.rawurlencode(cloudaddons_getuniqueid()).'&siteurl='.rawurlencode($_G['siteurl']).'&sitever='.DISCUZ_VERSION.'/'.DISCUZ_RELEASE.'&sitecharset='.CHARSET.'&mysiteid='.$_G['setting']['my_siteid'].'&addonversion=1&dlip='.CLOUDADDONS_DOWNLOAD_IP.'&os='.PHP_OS .'&php='.PHP_VERSION.'&web='.$_SERVER['SERVER_SOFTWARE'].'&db='.helper_dbtool::dbversion().'&lang='.currentlang(); $param = 'data='.rawurlencode(base64_encode($data)); $param .= '&md5hash='.substr(md5($data.TIMESTAMP), 8, 8).'×tamp='.TIMESTAMP; return CLOUDADDONS_DOWNLOAD_URL.'?'.$param.$extra; -- Gitee