{php} $cid = $article['cid']; $ptpuser = $article['ptpuser'] ?? ''; $ptpys = isFlag($article['ptpys'] ?? 1, 1); $ptpgg = $article['ptpgg'] ?? 0; $ptpggurl = $article['ptpggurl'] ?? ''; $commauth = isFlag($article['commauth'] ?? 1, 1); $title = trim((string)($article['article_title'] ?? '')); if ($title === '') { $title = strCut(strip_tags($article['ptptext'] ?? ''), 30, ''); } $cover = assetUrl($article['article_cover'] ?? '/assets/img/thumbnailbg.svg'); $coverCss = str_replace(["\\", "'", "\n", "\r", ")"], '', $cover); $dateText = !empty($article['ptptime']) ? date('Y年m月d日 H:i', strtotime($article['ptptime'])) : ''; $location = trim((string)($article['ptpdw'] ?? '')); $markdownHtml = renderArticleEmojis(renderMarkdownArticleCached($article['ptptext'] ?? '', $cid)); $authorName = getUserDisplayName($ptpuser); $authorAvatar = getUserAvatar($ptpuser); $readCount = (int)($article['views'] ?? $article['view_count'] ?? $article['read_count'] ?? $article['hits'] ?? $article['clicks'] ?? $article['click'] ?? 0); $tagsEnabled = \app\service\ContentFeatureService::tagsEnabled(); $tagList = $tagsEnabled ? array_values(array_filter(array_map('trim', explode(',', $article['tags'] ?? '')))) : []; $topIds = !empty($siteConfig['topes']) ? array_filter(array_map('trim', explode("\n", $siteConfig['topes']))) : []; $isAdminPinned = in_array((string)$cid, $topIds, true); $isUserPinned = !empty($article['user_top']); $isPinned = $isAdminPinned || $isUserPinned; $isOwner = $user && ($ptpuser === $user['username']); $isAdminUser = $user && isAdmin($user['username']); $canManage = $isOwner || $isAdminUser; $dianzanText = !empty($liked) ? '取消' : '赞'; $commentBtn = ($commauth === 1) ? '
评论
' : '
评论关闭
'; {/php}

{$title}

{if condition="$cover !== '/assets/img/thumbnailbg.svg'"}
{$title}
{/if}
{$markdownHtml|raw} {notempty name="tagList"} {/notempty}
{notempty name="attachments"}
附件 ({:count($attachments)})
{php} $attachUser = $user ?? null; foreach ($attachments as $att) { $attId = (int)$att['id']; $attName = sanitizeHtml($att['file_name'] ?: basename($att['file_url'])); $attDesc = sanitizeHtml($att['file_desc'] ?? ''); $attSize = ''; if ($att['file_size'] > 0) { if ($att['file_size'] > 1048576) $attSize = number_format($att['file_size'] / 1048576, 1) . 'MB'; elseif ($att['file_size'] > 1024) $attSize = number_format($att['file_size'] / 1024, 0) . 'KB'; else $attSize = $att['file_size'] . 'B'; } $attCode = $att['extract_code'] ?? ''; $attType = $att['type'] ?? 'file'; $attUrl = $att['file_url']; $iconClass = $attType === 'link' ? 'icon-lianjie1' : 'icon-biaoqian'; $sizeHtml = $attSize ? ' (' . $attSize . ')' : ''; $codeHtml = $attCode !== '' ? ' 提取码: ' . sanitizeHtml($attCode) . '' : ''; $descHtml = $attDesc !== '' ? '
' . $attDesc . '
' : ''; if ($attachUser) { if ($attType === 'link') { echo '
' . $attName . '' . $descHtml . '
' . $sizeHtml . $codeHtml . '
'; } else { echo '
' . $attName . '' . $descHtml . '
' . $sizeHtml . $codeHtml . '
'; } } else { echo '
' . $attName . '' . $descHtml . '
' . $sizeHtml . '
'; } } {/php}
{/notempty} {notempty name="poll"}
投票
{$poll.question}
{volist name="poll.options" id="opt"}
{$opt.text} {if condition="$poll['has_voted']"} {$opt.count}票 ({$opt.percent}%) {/if}
{if condition="$opt['selected']"}{/if}
{/volist}
{/notempty}
阅读 {$readCount} 点赞 {:count($likes)}

{$commentBtn|raw}
    {php} $visitorCount = 0; foreach ($likes as $like) { $luser = (string)($like['luser'] ?? ''); if (isVisitorUser($luser) && trim((string)($like['lname'] ?? '')) === '') { $visitorCount++; } else { $avatar = getLikeAvatar($like, $likeUsers); $likeName = getLikeDisplayName($like); echo '
  • ' . sanitizeHtml($likeName) . '
  • '; } } if ($visitorCount > 0) { echo '
  • ' . $visitorCount . '位访客
  • '; } {/php}

留言 {:count($comments)}

{if condition="$commauth == 1"}
{else /} {/if}
{php} $commgs = $commgs ?? 10; $commentCount = 0; $showMore = false; {/php} {volist name="comments" id="comment"} {php} $commentCount++; if ($commgs < $commentCount) { $showMore = true; break; } $commentText = (isFlag($comment['comaud'] ?? 1, 1) === 1) ? $comment['cotext'] : '该条评论未通过审核!'; $commentTime = formatFriendlyDate(strtotime($comment['cotime'])); $commentAvatar = getCommentAvatar($comment); $commentName = getUserDisplayName((string)($comment['couser'] ?? ''), (string)($comment['coname'] ?? '')); $replyName = getUserDisplayName((string)($comment['bcouser'] ?? ''), (string)($comment['bconame'] ?? '')); $commentUrl = empty($comment['courl']) ? '' : 'href="' . sanitizeUrl($comment['courl']) . '" style="pointer-events: all;"'; $commentLocation = trim((string)($comment['location'] ?? $comment['province'] ?? $comment['city'] ?? $comment['addr'] ?? '')); $commentLikeCount = (int)($comment['like_count'] ?? $comment['likes'] ?? $comment['codz'] ?? 0); {/php}
avatar
{$commentName} {if condition="$commentLocation !== ''"}{$commentLocation}{/if}
{if condition="$commauth == 1"} {/if}
{if condition="(!empty($comment['bcouser']) && $comment['bcouser'] !== 'false') || (!empty($comment['bconame']) && $comment['bconame'] !== 'false')"}

回复 {$replyName}

{/if}

{php}echo isFlag($comment['comaud'] ?? 1, 1) === 1 ? renderArticleEmojis(sanitizeHtml($comment['cotext'])) : $commentText;{/php}

{if condition="$commentCount == 1"} 首评 {/if}
{/volist}
{if condition="$showMore"} {/if}
{eq name="commauth" value="1"} {/eq}
分享
{if condition="$authorQr['alipay_qr'] || $authorQr['wechat_qr']"}
打赏
{/if} {notempty name="canManage"}
{notempty name="isAdminUser"}
{$isAdminPinned ? '取消首页置顶' : '首页置顶'}
{/notempty} {if condition="$isOwner"}
{$isUserPinned ? '取消个人置顶' : '个人置顶'}
{/if}
编辑
{$ptpys === 1 ? '设为隐私' : '取消隐私'}
{/notempty}
取消
{if condition="$authorQr['alipay_qr'] || $authorQr['wechat_qr']"} {/if} {php} // 检测是否包含 Mermaid 或 LaTeX $rawText = $article['ptptext'] ?? ''; $hasMermaid = stripos($rawText, '```mermaid') !== false; $hasKatex = strpos($rawText, '$$') !== false || preg_match('/(? {/if} {if condition="$hasKatex"} {/if}