diff --git a/upload/index.php b/upload/index.php index 374da65d139ac11b9bf1b61bdc656185d4f471e8..f826c6da32a6c9ca33c2a96ad54c5e2351500293 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 56271f0f84863d793264136c8baf7f9aef6d00e1..6c0eba1eb4d4f753cfc027a92059b42a7abfb680 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 3141b9a8551dfcd2b2601a48b07451de09838a86..4de2a37f498d60eefdb3f978279397cea916f3ce 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 1c3457cbe5bdeec215762054355776746fe78971..a5bdb0fb4393a036e130660dc8698dee42569167 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 ff35e967bd3e55c9a115a0ff577de3eb3e21ac0a..f29018d419f0b58f0b481456b66c0c6bf7d84029 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;