From 531da98c92a85cebc4c7f6fdf7a1f8156f5737a0 Mon Sep 17 00:00:00 2001 From: tianya Date: Sat, 2 Apr 2022 19:35:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=AA=E9=9D=99=E6=80=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/system/archive/archives.class.php | 7 +++-- src/system/archive/listview.class.php | 6 ++-- src/system/helpers/channelunit.helper.php | 37 ++++++++++++++--------- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/system/archive/archives.class.php b/src/system/archive/archives.class.php index 9cc1562f..9610ae26 100755 --- a/src/system/archive/archives.class.php +++ b/src/system/archive/archives.class.php @@ -288,7 +288,10 @@ class Archives */ function MakeHtml($isremote = 0) { - global $fileFirst, $cfg_basehost; + global $fileFirst, $cfg_basehost,$cfg_rewrite; + if ($cfg_rewrite) { + return ''; + } if ($this->IsError) { return ''; @@ -998,7 +1001,7 @@ class Archives $karr = $kaarr = $GLOBALS['replaced'] = array(); //暂时屏蔽超链接 $body = preg_replace("#()(.*)(<)(\/a>)#isU", '\\1-]-\\4-[-\\6', $body); - $query = "SELECT * FROM #@__keywords WHERE rpurl<>'' ORDER BY rank DESC"; + $query = "SELECT * FROM `#@__keywords` WHERE rpurl<>'' ORDER BY `rank` DESC"; $this->dsql->SetQuery($query); $this->dsql->Execute(); while ($row = $this->dsql->GetArray()) { diff --git a/src/system/archive/listview.class.php b/src/system/archive/listview.class.php index f973d575..6a6e9227 100755 --- a/src/system/archive/listview.class.php +++ b/src/system/archive/listview.class.php @@ -823,6 +823,7 @@ class ListView */ function GetPageListST($list_len, $listitem = "index,end,pre,next,pageno") { + global $cfg_rewrite,$cfg_cmspath; $prepage = $nextpage = ''; $prepagenum = $this->PageNo - 1; $nextpagenum = $this->PageNo + 1; @@ -901,7 +902,7 @@ class ListView //伪静态分页处理 if ($cfg_rewrite == 'Y') { - + $plist = str_replace('/apps/', $cfg_cmspath.'/', $plist); $plist = str_replace('.php?tid=','-',$plist); $plist = preg_replace("/&TotalResult=(\d+)/i","",$plist);//去掉总结果数值 //目录版 @@ -920,7 +921,7 @@ class ListView */ function GetPageListDM($list_len, $listitem = "index,end,pre,next,pageno") { - global $cfg_rewrite; + global $cfg_rewrite,$cfg_cmspath; $prepage = $nextpage = ''; $prepagenum = $this->PageNo - 1; $nextpagenum = $this->PageNo + 1; @@ -991,6 +992,7 @@ class ListView if (preg_match('/option/i', $listitem)) $plist .= $optionlist; if (preg_match('/info/i', $listitem)) $plist .= $maininfo; if ($cfg_rewrite == 'Y') { + $plist = str_replace('/apps/', $cfg_cmspath.'/', $plist); $plist = str_replace('.php?tid=', '-', $plist); $plist = str_replace('&TotalResult=', '-', $plist); $plist = preg_replace("/&PageNo=(\d+)/i", '-\\1.html', $plist); diff --git a/src/system/helpers/channelunit.helper.php b/src/system/helpers/channelunit.helper.php index f375252d..4f61636f 100755 --- a/src/system/helpers/channelunit.helper.php +++ b/src/system/helpers/channelunit.helper.php @@ -109,6 +109,7 @@ if (!function_exists('GetFileNewName')) { $articlename = $articlename."index.html"; } $slen = strlen($articlename) - 1; + $subpos = 0; for ($i = $slen; $i >= 0; $i--) { if ($articlename[$i] == '/') { $subpos = $i; @@ -144,15 +145,16 @@ if (!function_exists('GetFileName')) { $namerule = $cfg_special.'/arc-{aid}.html'; $typeid = -1; } + //伪静态文档,Nginx伪静态规则参考: + //rewrite ^/([0-9]+).html$ /apps/view.php?arcID=$1; + //rewrite ^/([0-9]+)-([0-9]+).html$ /apps/view.php?aid=$1&pageno=$2; + if ($cfg_rewrite == 'Y') { + //目录版return "/article/".$aid.""; + //网页版 + return $GLOBALS['cfg_cmspath'].'/'.$aid.".html"; + } if ($rank != 0 || $ismake == -1 || $typeid == 0 || $money > 0) { - //伪静态文档,Nginx伪静态规则参考:rewrite ^/([0-9]+).html$ /apps/view.php?arcID=$1;rewrite ^/([0-9]+)-([0-9]+).html$ /apps/view.php?aid=$1&pageno=$2; - if ($cfg_rewrite == 'Y') { - //目录版return "/article/".$aid.""; - //网页版 - return "/".$aid.".html"; - } else { - return $GLOBALS['cfg_phpurl']."/view.php?aid=$aid"; - } + return $GLOBALS['cfg_phpurl']."/view.php?aid=$aid"; } else { $articleDir = MfTypedir($typedir); $articleRule = strtolower($namerule); @@ -200,14 +202,21 @@ if (!function_exists('GetFileName')) { if (!function_exists('GetTypeUrl')) { function GetTypeUrl($typeid, $typedir, $isdefault, $defaultname, $ispart, $namerule2, $moresite = 0, $siteurl = '', $sitepath = '') { - global $cfg_typedir_df; + global $cfg_typedir_df,$cfg_rewrite; $typedir = MfTypedir($typedir); $sitepath = MfTypedir($sitepath); - //伪静态栏目,Nginx伪静态规则参考:rewrite ^/list-([0-9]+)$ /apps/list.php?tid=$1;rewrite ^/list-([0-9]+)-([0-9]+)$ /apps/list.php?tid=$1&PageNo=$2; + //伪静态栏目,Nginx伪静态规则参考: + //rewrite ^/list-([0-9]+)$ /apps/list.php?tid=$1; + //rewrite ^/list-([0-9]+)-([0-9]+)$ /apps/list.php?tid=$1&PageNo=$2; + if ($cfg_rewrite == 'Y') { + //目录版return "/article/".$aid.""; + //网页版 + return $GLOBALS['cfg_cmspath']."/list-".$typeid.""; + } + if($isdefault==-1) { - //目录版 - $reurl = "/list-".$typeid.""; - //网页版$reurl = "/list".$typeid.".html"; + //动态 + $reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid; } else if ($ispart == 2) { //跳转网址 $reurl = $typedir; @@ -400,7 +409,7 @@ function FormatScript($atme) */ function FillAttsDefault(&$atts, $attlist) { - $attlists = explode(',', $attlist); + $attlists = explode(',', (string)$attlist); for ($i = 0; isset($attlists[$i]); $i++) { list($k, $v) = explode('|', $attlists[$i]); if (!isset($atts[$k])) {