From 57423732e54bd9a169d9b5db153d3816d72e46d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?=
 <93301500+xushubieli@users.noreply.github.com>
Date: Wed, 26 Mar 2025 11:33:22 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=AA=E9=9D=99=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/system/archive/archives.class.php | 16 ++++++++--------
 src/system/archive/taglist.class.php  | 13 +++++++++++++
 src/system/taglib/tag.lib.php         |  4 +++-
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/system/archive/archives.class.php b/src/system/archive/archives.class.php
index c0bcf0fd..db3af124 100755
--- a/src/system/archive/archives.class.php
+++ b/src/system/archive/archives.class.php
@@ -861,7 +861,7 @@ class Archives
                     if ($cfg_rewrite == 'Y') {
                         $revalue .= "<a href='/article/$aid-$i.html'>$v</a>";
                     } else {
-                        $revalue .= "<a href='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>$v</a>";
+                        $revalue .= "<a href='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i'>$v</a>";
                     }
                 } else {
                     if ($pageNo == $i) {
@@ -870,7 +870,7 @@ class Archives
                         if ($cfg_rewrite == 'Y') {
                             $revalue .= "<a href='/article/$aid-$i.html'>$v</a>";
                         } else {
-                            $revalue .= "<a href='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>$v</a>";
+                            $revalue .= "<a href='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i'>$v</a>";
                         }
                         
                     }
@@ -884,20 +884,20 @@ class Archives
                     if ($cfg_rewrite == 'Y') {
                         $revalue .= "<option value='/article/$aid-$i.html'>{$i}、{$v}</option>";
                     } else {
-                        $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$i}、{$v}</option>";
+                        $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i'>{$i}、{$v}</option>";
                     }
                 } else {
                     if ($pageNo == $i) {
                         if ($cfg_rewrite == 'Y') {
                             $revalue .= "<option value='/article/$aid-$i.html' selected>{$i}、{$v}</option>";
                         } else {
-                            $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i' selected>{$i}、{$v}</option>";
+                            $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i' selected>{$i}、{$v}</option>";
                         }
                     } else {
                         if ($cfg_rewrite == 'Y') {
                             $revalue .= "<option value='/article/$aid-$i.html'>{$i}、{$v}</option>";
                         } else {
-                            $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$i}、{$v}</option>";
+                            $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i'>{$i}、{$v}</option>";
                         }
                     }
                 }
@@ -938,7 +938,7 @@ class Archives
                 if ($cfg_rewrite == 'Y') {
                     $PageList .= "<li class='page-item'><a class='page-link' href='".$cfg_cmsurl."/article/$aid-$nPage.html'>上页</a></li>";
                 } else {
-                    $PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$nPage'>上页</a></li>";
+                    $PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$nPage'>上页</a></li>";
                 }
             }
         }
@@ -959,7 +959,7 @@ class Archives
                     if ($cfg_rewrite == 'Y') {
                         $PageList .= "<li class='page-item'><a class='page-link' href='".$cfg_cmsurl."/article/$aid-$i.html'>{$n}</a></li>";
                     } else {
-                        $PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$n}</a></li>";
+                        $PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i'>{$n}</a></li>";
                     }
                 } else {
                     $PageList .= "<li class='page-item active'><span class='page-link'>{$n}</span></li>";
@@ -970,7 +970,7 @@ class Archives
             if ($cfg_rewrite == 'Y') {
                 $PageList .= "<li class='page-item'><a class='page-link' href='".$cfg_cmsurl."/article/$aid-$lPage.html'>下页</a></li>";
             } else {
-                $PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$lPage'>下页</a></li>";
+                $PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$lPage'>下页</a></li>";
             }
         } else {
             $PageList .= "<li class='page-item'><span class='page-link'>下页</span></li>";
diff --git a/src/system/archive/taglist.class.php b/src/system/archive/taglist.class.php
index db1cd4b5..dc6a8bdf 100755
--- a/src/system/archive/taglist.class.php
+++ b/src/system/archive/taglist.class.php
@@ -529,6 +529,7 @@ class TagList
      */
     function GetPageListDM($list_len, $listitem = "info,index,end,pre,next,pageno")
     {
+        global $cfg_rewrite;
         $prepage = '';
         $nextpage = '';
         $prepagenum = $this->PageNo - 1;
@@ -545,6 +546,13 @@ class TagList
         }
         $maininfo = "<li class='page-item disabled'><span class='page-link'>{$totalpage}页".$this->TotalResult."条</span></li>";
         $purl = $this->GetCurUrl();
+        //开启伪静态对规则替换
+        if ($cfg_rewrite == 'Y') {
+            $purl = str_replace("/apps", "", $purl);
+            $nowurls = preg_replace("/", ".php?", $purl);
+            $nowurls = explode("?", $nowurls);
+            $purl = $nowurls[0];
+        }
         $purl .= "?/".urlencode($this->Tag);
         //获得上页和下页的链接
         if ($this->PageNo != 1) {
@@ -588,6 +596,11 @@ class TagList
         if (preg_match('/next/i', $listitem)) $plist .= $nextpage;
         if (preg_match('/end/i', $listitem)) $plist .= $endpage;
         if (preg_match('/info/i', $listitem)) $plist .= $maininfo;
+        //伪静态标签分页
+        if ($cfg_rewrite == 'Y') {
+            $plist = str_replace("?/", "", $plist);
+            $plist = preg_replace("/&pageno=(\d+)/i", "/\\1", $plist);
+        }
         return $plist;
     }
     /**
diff --git a/src/system/taglib/tag.lib.php b/src/system/taglib/tag.lib.php
index 3c7edb5a..4b062bcc 100755
--- a/src/system/taglib/tag.lib.php
+++ b/src/system/taglib/tag.lib.php
@@ -11,7 +11,7 @@ if (!defined('DEDEINC')) exit ('dedebiz');
  */
 function lib_tag(&$ctag, &$refObj)
 {
-    global $dsql, $envs, $cfg_cmsurl, $cfg_tags_dir;
+    global $dsql, $envs, $cfg_cmsurl, $cfg_tags_dir ,$cfg_rewrite;
     $attlist = "row|30,sort|new,getall|0,typeid|0,ishtml|0";
     FillAttsDefault($ctag->CAttribute->Items, $attlist);
     extract($ctag->CAttribute->Items, EXTR_SKIP);
@@ -54,6 +54,8 @@ function lib_tag(&$ctag, &$refObj)
         $row['tag'] = dede_htmlspecialchars($row['tag']);
         if (isset($envs['makeTag']) && $envs['makeTag'] == 1 || $ishtml == 1) {
             $row['link'] = $cfg_cmsurl.$tagsdir."/".$row['id']."/";
+        } else if ($cfg_rewrite == 'Y') {
+            $row['link'] = $cfg_cmsurl."/tags/".$row['id'];
         } else {
             $row['link'] = $cfg_cmsurl."/apps/tags.php?/".$row['id'];
         }