From f593750e04cab6466a155f21fc8db3ed5a2c9967 Mon Sep 17 00:00:00 2001 From: tianya Date: Fri, 2 Jun 2023 00:43:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E8=A1=A8=E6=94=AF=E6=8C=81=E4=BC=AA?= =?UTF-8?q?=E9=9D=99=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/system/archive/sglistview.class.php | 29 ++++++--- src/system/taglib/infolink.lib.php | 85 ++++++++++++++++++++----- 2 files changed, 91 insertions(+), 23 deletions(-) diff --git a/src/system/archive/sglistview.class.php b/src/system/archive/sglistview.class.php index 40bc378f..161a6eaa 100755 --- a/src/system/archive/sglistview.class.php +++ b/src/system/archive/sglistview.class.php @@ -931,7 +931,7 @@ class SgListView */ function GetPageListDM($list_len, $listitem = "index,end,pre,next,pageno") { - global $nativeplace, $infotype, $keyword; + global $nativeplace, $infotype, $keyword,$cfg_rewrite; if (empty($nativeplace)) $nativeplace = 0; if (empty($infotype)) $infotype = 0; if (empty($keyword)) $keyword = ''; @@ -949,23 +949,30 @@ class SgListView return "
  • 0页".$this->TotalResult."条
  • "; } $purl = $this->GetCurUrl(); - $geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&nativeplace=$nativeplace&infotype=$infotype&keyword=".urlencode($keyword)."&"; + //开启伪静态对规则替换 + if ($cfg_rewrite == 'Y') { + $purl = str_replace("/apps", "", $purl); + $nowurls = preg_replace("/\-/", ".php?", $purl); + $nowurls = explode("?", $nowurls); + $purl = $nowurls[0]; + } + $geturl = "&TotalResult=".$this->TotalResult."&nativeplace=$nativeplace&infotype=$infotype&keyword=".urlencode($keyword)."&"; $hidenform = "\r\n"; $hidenform = "\r\n"; $hidenform = "\r\n"; $hidenform = "\r\n"; $hidenform .= "\r\n"; - $purl .= "?".$geturl; + $purl .= "?tid=".$this->TypeID."&"; //获得上一页和下一页的链接 if ($this->PageNo != 1) { - $prepage .= "
  • 上一页
  • \r\n"; - $indexpage = "
  • 首页
  • \r\n"; + $prepage .= "
  • 上一页
  • \r\n"; + $indexpage = "
  • 首页
  • \r\n"; } else { $indexpage = "
  • 首页
  • \r\n"; } if ($this->PageNo != $totalpage && $totalpage > 1) { - $nextpage .= "
  • 下一页
  • \r\n"; - $endpage = "
  • 末页
  • \r\n"; + $nextpage .= "
  • 下一页
  • \r\n"; + $endpage = "
  • 末页
  • \r\n"; } else { $endpage = "
  • 末页
  • "; } @@ -988,10 +995,16 @@ class SgListView if ($j == $this->PageNo) { $listdd .= "
  • $j
  • \r\n"; } else { - $listdd .= "
  • ".$j."
  • \r\n"; + $listdd .= "
  • ".$j."
  • \r\n"; } } $plist = $indexpage.$prepage.$listdd.$nextpage.$endpage; + //伪静态栏目分页 + if ($cfg_rewrite == 'Y') { + $plist = str_replace(".php?tid=", "-", $plist); + $plist = preg_replace("/&PageNo=(\d+)/i", "-\\1", $plist); + $plist = preg_replace("/&TotalResult=(\d+)&/i", "?", $plist);//去掉分页数值 + } return $plist; } /** diff --git a/src/system/taglib/infolink.lib.php b/src/system/taglib/infolink.lib.php index 8825c75e..9df1d421 100755 --- a/src/system/taglib/infolink.lib.php +++ b/src/system/taglib/infolink.lib.php @@ -25,7 +25,7 @@ function is_str_float($value){ } function lib_infolink(&$ctag, &$refObj) { - global $dsql, $nativeplace, $infotype, $hasSetEnumJs, $cfg_cmspath, $cfg_mainsite, $em_nativeplaces, $em_infotypes; + global $dsql, $nativeplace, $infotype, $cfg_rewrite, $cfg_cmspath, $cfg_mainsite, $em_nativeplaces, $em_infotypes; //属性处理 //$attlist="row|12,titlelen|30"; //FillAttsDefault($ctag->CAttribute->Items,$attlist); @@ -54,18 +54,31 @@ function lib_infolink(&$ctag, &$refObj) 'channelid' => $channelid, 'linkallplace' => '', 'linkalltype' => '' ); $fields['nativeplace'] = $fields['infotype'] = ''; - $fields['linkallplace'] = "不限"; - $fields['linkalltype'] = "不限"; + if ($cfg_rewrite == 'Y') { + $fields['linkallplace'] = "不限"; + $fields['linkalltype'] = "不限"; + } else { + $fields['linkallplace'] = "不限"; + $fields['linkalltype'] = "不限"; + } //地区链接 if (empty($nativeplace)) { foreach ($em_nativeplaces as $eid => $em) { if ($eid % 500 != 0) continue; - $fields['nativeplace'] .= " {$em}\r\n"; + if ($cfg_rewrite == 'Y') { + $fields['nativeplace'] .= " {$em}\r\n"; + } else { + $fields['nativeplace'] .= " {$em}\r\n"; + } } } else { $sontype = (($nativeplace % 500 != 0) ? $nativeplace : 0); //子集 $toptype = (($nativeplace % 500 == 0) ? (int)$nativeplace : (int)($nativeplace - ($nativeplace % 500))); //顶级联动分类 - $fields['nativeplace'] = " {$em_nativeplaces[$toptype]} -"; + if ($cfg_rewrite == 'Y') { + $fields['nativeplace'] = " {$em_nativeplaces[$toptype]} -"; + } else { + $fields['nativeplace'] = " {$em_nativeplaces[$toptype]} -"; + } if ($nativeplace % 500 == 0) { //1级分类 foreach ($em_nativeplaces as $eid => $em) { @@ -74,7 +87,11 @@ function lib_infolink(&$ctag, &$refObj) if ($eid == $nativeplace) { $fields['nativeplace'] .= " {$em}\r\n"; } else { - $fields['nativeplace'] .= " {$em}\r\n"; + if ($cfg_rewrite == 'Y') { + $fields['nativeplace'] .= " {$em}\r\n"; + } else { + $fields['nativeplace'] .= " {$em}\r\n"; + } } } } else if (!is_str_float($nativeplace)) { @@ -91,7 +108,12 @@ function lib_infolink(&$ctag, &$refObj) if ($eid === $nativeplace) { $ff .= " {$em}\r\n"; } else { - $ff .= " {$em}\r\n"; + if ($cfg_rewrite == 'Y') { + $ff .= " {$em}\r\n"; + } else { + $ff .= " {$em}\r\n"; + } + } } } @@ -100,14 +122,22 @@ function lib_infolink(&$ctag, &$refObj) } else { //3级分类 $t = intval($nativeplace); - $fields['nativeplace'] .= " {$em_nativeplaces[$t]} -"; + if ($cfg_rewrite == 'Y') { + $fields['nativeplace'] .= " {$em_nativeplaces[$t]} -"; + } else { + $fields['nativeplace'] .= " {$em_nativeplaces[$t]} -"; + } foreach ($em_nativeplaces as $eid => $em) { if ($eid < $t + 1 && $eid > $t) { if ($eid === $nativeplace) { $fields['nativeplace'] .= " {$em}\r\n"; } else { - $fields['nativeplace'] .= " {$em}\r\n"; + if ($cfg_rewrite == 'Y') { + $fields['nativeplace'] .= " {$em}\r\n"; + } else { + $fields['nativeplace'] .= " {$em}\r\n"; + } } } } @@ -121,13 +151,21 @@ function lib_infolink(&$ctag, &$refObj) if ($eid == $infotype) { $fields['infotype'] .= " {$em}\r\n"; } else { - $fields['infotype'] .= " {$em}\r\n"; + if ($cfg_rewrite == 'Y') { + $fields['infotype'] .= " {$em}\r\n"; + } else { + $fields['infotype'] .= " {$em}\r\n"; + } } } } else { $sontype = (($infotype % 500 != 0) ? $infotype : 0); $toptype = (($infotype % 500 == 0) ? (int)$infotype : (int)($infotype - ($infotype % 500))); - $fields['infotype'] = "{$em_infotypes[$toptype]} - "; + if ($cfg_rewrite == 'Y') { + $fields['infotype'] = "{$em_infotypes[$toptype]} - "; + } else { + $fields['infotype'] = "{$em_infotypes[$toptype]} - "; + } if ($infotype % 500 == 0) { //1级分类 foreach ($em_infotypes as $eid => $em) { @@ -136,7 +174,11 @@ function lib_infolink(&$ctag, &$refObj) if ($eid == $infotype) { $fields['infotype'] .= " {$em}\r\n"; } else { - $fields['infotype'] .= " {$em}\r\n"; + if ($cfg_rewrite == 'Y') { + $fields['infotype'] .= " {$em}\r\n"; + } else { + $fields['infotype'] .= " {$em}\r\n"; + } } } } else if (!is_str_float($infotype)) { @@ -153,7 +195,12 @@ function lib_infolink(&$ctag, &$refObj) if ($eid === $infotype) { $ff .= " {$em}\r\n"; } else { - $ff .= " {$em}\r\n"; + if ($cfg_rewrite == 'Y') { + $ff .= " {$em}\r\n"; + } else { + $ff .= " {$em}\r\n"; + } + } } } @@ -162,14 +209,22 @@ function lib_infolink(&$ctag, &$refObj) } else { //3级分类 $t = intval($infotype); - $fields['infotype'] .= " {$em_infotypes[$t]} -"; + if ($cfg_rewrite == 'Y') { + $fields['infotype'] .= " {$em_infotypes[$t]} -"; + } else { + $fields['infotype'] .= " {$em_infotypes[$t]} -"; + } foreach ($em_infotypes as $eid => $em) { if ($eid < $t + 1 && $eid > $t) { if ($eid === $infotype) { $fields['infotype'] .= " {$em}\r\n"; } else { - $fields['infotype'] .= " {$em}\r\n"; + if ($cfg_rewrite == 'Y') { + $fields['infotype'] .= " {$em}\r\n"; + } else { + $fields['infotype'] .= " {$em}\r\n"; + } } } }