From caa8818781d63d50335ebd54eb4746c058d9c99f 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: Thu, 1 Jun 2023 16:03:25 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=B4=E6=98=8E?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/system/archive/listview.class.php | 4 +-
src/system/helpers/channelunit.helper.php | 124 +++++++++++-----------
2 files changed, 64 insertions(+), 64 deletions(-)
diff --git a/src/system/archive/listview.class.php b/src/system/archive/listview.class.php
index 223294a7..ebec5b51 100755
--- a/src/system/archive/listview.class.php
+++ b/src/system/archive/listview.class.php
@@ -1112,7 +1112,7 @@ class ListView
}
$maininfo = "
{$totalpage}页".$this->TotalResult."条\r\n";
$purl = $this->GetCurUrl();
- //如果开启为静态,则对规则进行替换
+ //开启伪静态对规则替换
if ($cfg_rewrite == 'Y') {
$nowurls = preg_replace("/\-/", ".php?", $purl);
$nowurls = explode("?", $nowurls);
@@ -1169,7 +1169,7 @@ class ListView
if (preg_match('/end/i', $listitem)) $plist .= $endpage;
if (preg_match('/option/i', $listitem)) $plist .= $optionlist;
if (preg_match('/info/i', $listitem)) $plist .= $maininfo;
- //伪静态分页
+ //伪静态栏目分页
if ($cfg_rewrite == 'Y') {
$plist = str_replace(".php?tid=", "-", $plist);
$plist = preg_replace("/&PageNo=(\d+)/i", "-\\1", $plist);
diff --git a/src/system/helpers/channelunit.helper.php b/src/system/helpers/channelunit.helper.php
index 6d3376d6..8ca75e73 100755
--- a/src/system/helpers/channelunit.helper.php
+++ b/src/system/helpers/channelunit.helper.php
@@ -119,68 +119,7 @@ if (!function_exists('GetFileNewName')) {
}
}
/**
- * 获得文件相对于主站点根目录的物理文件名,动态网址返回url
- *
- * @param int $aid 文档id
- * @param int $typeid 栏目id
- * @param int $timetag 时间戳
- * @param string $title 标题
- * @param int $ismake 是否生成
- * @param int $rank 阅读权限
- * @param string $namerule 名称规则
- * @param string $typedir 栏目dir
- * @param string $money 需要金币
- * @param string $filename 文件名称
- * @return string
- */
-if (!function_exists('GetFileName')) {
- function GetFileName($aid, $typeid, $timetag, $title, $ismake = 0, $rank = 0, $namerule = '', $typedir = '', $money = 0, $filename = '')
- {
- global $cfg_cmspath, $cfg_arcdir, $cfg_special, $cfg_arc_dirname, $cfg_rewrite;
- //没指定栏目时用固定专题规则
- if (empty($namerule)) {
- $namerule = $cfg_special.'/{aid}.html';
- $typeid = -1;
- }
- //动态文档
- if ($rank != 0 || $ismake == -1 || $typeid == 0 || $money > 0) {
- if ($cfg_rewrite == 'Y') {
- //开启伪静态文档/doc-1.html、/doc-2.html,则分页/doc-1-1.html、/doc-1-2.html
- return "/doc-".$aid.".html";
- } else {
- return $GLOBALS['cfg_phpurl']."/view.php?aid=$aid";
- }
- } else {
- $articleDir = MfTypedir($typedir);
- $articleRule = strtolower($namerule);
- if ($articleRule == '') {
- $articleRule = strtolower($GLOBALS['cfg_df_namerule']);
- }
- if ($typedir == '') {
- $articleDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
- }
- $dtime = GetDateMk($timetag);
- list($y, $m, $d) = explode('-', $dtime);
- $arr_rpsource = array('{typedir}', '{y}', '{m}', '{d}', '{timestamp}', '{aid}', '{cc}');
- $arr_rpvalues = array($articleDir, $y, $m, $d, $timetag, $aid, dd2char($m.$d.$aid.$y));
- if ($filename != '') {
- $articleRule = dirname($articleRule).'/'.$filename.$GLOBALS['cfg_df_ext'];
- }
- $articleRule = str_replace($arr_rpsource, $arr_rpvalues, $articleRule);
- if (preg_match("/\{p/", $articleRule)) {
- $articleRule = str_replace('{pinyin}', GetPinyin($title).'_'.$aid, $articleRule);
- $articleRule = str_replace('{py}', GetPinyin($title, 1).'_'.$aid, $articleRule);
- }
- $articleUrl = '/'.preg_replace("/^\//", '', $articleRule);
- if (preg_match("/index\.html/", $articleUrl) && $cfg_arc_dirname == 'Y') {
- $articleUrl = str_replace('index.html', '', $articleUrl);
- }
- return $articleUrl;
- }
- }
-}
-/**
- * 获得指定栏目链接,对于使用封面文件和单独页面的情况,强制使用默认页名称
+ * 获得栏目链接
*
* @param int $typeid 栏目id
* @param string $typedir 栏目目录
@@ -239,6 +178,67 @@ if (!function_exists('GetTypeUrl')) {
return $reurl;
}
}
+/**
+ * 获得文档链接
+ *
+ * @param int $aid 文档id
+ * @param int $typeid 栏目id
+ * @param int $timetag 时间戳
+ * @param string $title 标题
+ * @param int $ismake 是否生成
+ * @param int $rank 阅读权限
+ * @param string $namerule 名称规则
+ * @param string $typedir 栏目dir
+ * @param string $money 需要金币
+ * @param string $filename 文件名称
+ * @return string
+ */
+if (!function_exists('GetFileName')) {
+ function GetFileName($aid, $typeid, $timetag, $title, $ismake = 0, $rank = 0, $namerule = '', $typedir = '', $money = 0, $filename = '')
+ {
+ global $cfg_cmspath, $cfg_arcdir, $cfg_special, $cfg_arc_dirname, $cfg_rewrite;
+ //没指定栏目时用固定专题规则
+ if (empty($namerule)) {
+ $namerule = $cfg_special.'/{aid}.html';
+ $typeid = -1;
+ }
+ //动态文档
+ if ($rank != 0 || $ismake == -1 || $typeid == 0 || $money > 0) {
+ if ($cfg_rewrite == 'Y') {
+ //开启伪静态文档/doc-1.html、/doc-2.html,则分页/doc-1-1.html、/doc-1-2.html
+ return $GLOBALS['cfg_cmspath']."/doc-".$aid.".html";
+ } else {
+ return $GLOBALS['cfg_phpurl']."/view.php?aid=$aid";
+ }
+ } else {
+ $articleDir = MfTypedir($typedir);
+ $articleRule = strtolower($namerule);
+ if ($articleRule == '') {
+ $articleRule = strtolower($GLOBALS['cfg_df_namerule']);
+ }
+ if ($typedir == '') {
+ $articleDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
+ }
+ $dtime = GetDateMk($timetag);
+ list($y, $m, $d) = explode('-', $dtime);
+ $arr_rpsource = array('{typedir}', '{y}', '{m}', '{d}', '{timestamp}', '{aid}', '{cc}');
+ $arr_rpvalues = array($articleDir, $y, $m, $d, $timetag, $aid, dd2char($m.$d.$aid.$y));
+ if ($filename != '') {
+ $articleRule = dirname($articleRule).'/'.$filename.$GLOBALS['cfg_df_ext'];
+ }
+ $articleRule = str_replace($arr_rpsource, $arr_rpvalues, $articleRule);
+ if (preg_match("/\{p/", $articleRule)) {
+ $articleRule = str_replace('{pinyin}', GetPinyin($title).'_'.$aid, $articleRule);
+ $articleRule = str_replace('{py}', GetPinyin($title, 1).'_'.$aid, $articleRule);
+ }
+ $articleUrl = '/'.preg_replace("/^\//", '', $articleRule);
+ if (preg_match("/index\.html/", $articleUrl) && $cfg_arc_dirname == 'Y') {
+ $articleUrl = str_replace('index.html', '', $articleUrl);
+ }
+ return $articleUrl;
+ }
+ }
+}
/**
* 魔法变量,用于获取两个可变的值
*