Browse Source

PHP8兼容性调整

tags/6.0.2
tianya 4 months ago
parent
commit
b15d6d5cf1
3 changed files with 16 additions and 5 deletions
  1. +1
    -3
      src/dede/templets/index_body.htm
  2. +12
    -2
      src/include/arc.archives.class.php
  3. +3
    -0
      src/include/inc/inc_fun_funAdmin.php

+ 1
- 3
src/dede/templets/index_body.htm View File

@@ -162,9 +162,7 @@
<?php echo ($isSafeMode ? 'On' : 'Off')?></font>
<?php
if($isSafeMode) {
echo "<br>  <font color='blue'>由于您的系统以安全模式运行,为了确保程序兼容性,第一次进入本系统时请更改“<a href='sys_info.php'><u>更改系统参数</u></a>”里的FTP选项,并选择用FTP形式创建目录,完成后:<a href='testenv.php' style='color:red'><u>点击此进行一次DedeCMS目录权限检测&gt;&gt;</u></a></font>";
} else {
echo " <a href='testenv.php' style='color:blue'><u>DedeCMS目录权限检测&gt;&gt;</u></a></font>";
echo "<br>  <font color='blue'>由于您的系统以安全模式运行,为了确保程序兼容性,第一次进入本系统时请更改“<a href='sys_info.php'><u>更改系统参数</u></a>”里的FTP选项,并选择用FTP形式创建目录</font>";
}
?>
</td>


+ 12
- 2
src/include/arc.archives.class.php View File

@@ -1066,8 +1066,14 @@ class Archives
$kaarr[] = "<a href='$key_url' target='_blank'><u>$key</u></a>";
}
$GLOBALS['_dd_karr'] = $karr;
$GLOBALS['_dd_kaarr'] = $kaarr;
// 这里可能会有错误
if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
if (version_compare(PHP_VERSION, '8.0.0', '>=')) {
$body = @preg_replace_callback("#(^|>)([^<]+)(?=<|$)#sU", "_highlight8", $body);
} else if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
$body = @preg_replace_callback("#(^|>)([^<]+)(?=<|$)#sU", "_highlight('\\2', \$karr, \$kaarr, '\\1')", $body);
} else {
$body = @preg_replace("#(^|>)([^<]+)(?=<|$)#sUe", "_highlight('\\2', \$karr, \$kaarr, '\\1')", $body);
@@ -1079,11 +1085,15 @@ class Archives
}
} //End Archives
function _highlight8($matches){
return _highlight($matches[2], $GLOBALS['_dd_karr'], $GLOBALS['_dd_kaarr'], $matches[1]);
}
//高亮专用, 替换多次是可能不能达到最多次
function _highlight($string, $words, $result, $pre)
{
global $cfg_replace_num;
if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
if (version_compare(PHP_VERSION, '5.5.0', '>=') && version_compare(PHP_VERSION, '8.0.0', '<')) {
$string = $string[0];
$pre = $pre[0];
}


+ 3
- 0
src/include/inc/inc_fun_funAdmin.php View File

@@ -21,6 +21,9 @@
function SpGetPinyin($str, $ishead = 0, $isclose = 1)
{
global $pinyins;
if ($pinyins==null) {
$pinyins = array();
}
global $cfg_bizcore_appid, $cfg_bizcore_key, $cfg_bizcore_hostname, $cfg_bizcore_port;
global $cfg_soft_lang;
$restr = '';


Loading…
Cancel
Save