{php} /** * Article detail content. */ $cid = $article['cid']; $ptpuser = $article['ptpuser']; $ptpimg = getUserAvatar($ptpuser); $isAnonymousPost = isFlag($article['is_anonymous'] ?? 0) === 1; $displayName = $isAnonymousPost ? '匿名用户' : getUserDisplayName($ptpuser); if ($isAnonymousPost) { $ptpimg = '/assets/img/tx.png'; } $ptptext = renderArticleEmojis(cleanArticleHtml($article['ptptext'] ?? '')); $ptpimag = $article['ptpimag'] ?? ''; $ptpvideo = $article['ptpvideo'] ?? ''; $ptpmusic = $article['ptpmusic'] ?? ''; $ptplx = $article['ptplx'] ?? 'only'; $ptpdw = $article['ptpdw'] ?? ''; $ptptime = $article['ptptime'] ?? ''; $ptpgg = $article['ptpgg'] ?? 0; $ptpggurl = $article['ptpggurl'] ?? ''; $ptpys = isFlag($article['ptpys'] ?? 1, 1); $commauth = isFlag($article['commauth'] ?? 1, 1); $tagsEnabled = \app\service\ContentFeatureService::tagsEnabled(); $tagList = $tagsEnabled ? array_values(array_filter(array_map('trim', explode(',', $article['tags'] ?? '')))) : []; $musicSource = ''; $videoParts = explode('|', $ptpvideo); $videoUrl = assetUrl($videoParts[0] ?? ''); $videoCover = assetUrl($videoParts[1] ?? ''); $images = $ptpimag === '' ? [] : array_values(array_filter(explode('(+@+)', $ptpimag), function ($value) { return trim((string)$value) !== ''; })); $imgCount = count($images); if ($imgCount === 1) { $gridStyle = 'grid-template-columns:1fr;width: 55%;'; } elseif ($imgCount === 2 || $imgCount === 4) { $gridStyle = 'grid-template-columns:1fr 1fr;width: 55%;'; } else { $gridStyle = 'grid-template-columns:1fr 1fr 1fr;'; } $adStyle = (isFlag($ptpgg ?? 0) === 1) ? 'display: flex;' : 'display: none;'; $adUrl = (isFlag($ptpgg ?? 0) === 1 && $ptpggurl !== '') ? '
进一步了解
' : ''; $gps = (isFlag($ptpgg ?? 0) === 1) ? '' : '
' . sanitizeHtml($ptpdw) . '
'; $contentText = preg_replace('/]+>/i', '', $ptptext); $contentText = preg_replace('/]+>/i', '', $contentText); $contentText = preg_replace('/]+>/i', '', $contentText); $contentText = str_replace(' ', '', $contentText); $displayText = iconv_strlen($contentText, 'UTF-8') > 100 ? '' . $ptptext . '全文' : '' . $ptptext . ''; $dianzanText = '赞'; $dianzanClass = 'iconfont icon-aixin ri-sxdzlike'; if (!empty($liked)) { $dianzanText = '取消'; $dianzanClass = 'iconfont icon-aixin2 ri-sxdzlikehs'; } $commentBtn = ($commauth === 1) ? '
评论
' : '
评论关闭
'; $isOwner = $user && ($ptpuser === $user['username']); $isAdminUser = $user && isAdmin($user['username']); $canManage = $isOwner || $isAdminUser; $deleteIcon = $canManage ? '' : ''; $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; $pinStyle = 'background: var(--themetm);' . (isFlag($ptpgg ?? 0) === 1 ? 'margin-right: 5px;' : ''); {/php}
avatar

{$displayName}

{php}$ptpggFlag = isFlag($ptpgg ?? 0);{/php} {if condition="$isPinned || $ptpggFlag === 1"}
{if condition="$isPinned"}

置顶

{/if}

广告

{/if}
{$displayText|raw} {notempty name="tagList"} {/notempty} {if condition="$ptplx === 'img'"}
{php} foreach ($images as $index => $image) { $imageUrl = assetUrl($image); $picStyle = $imgCount > 1 ? 'style="width: 100%;"' : ''; if ($index > 7 && $imgCount > 9) { if ($index === 8) { echo ' +' . ($imgCount - $index - 1) . ' '; } else { echo ''; } } else { echo ' '; } } {/php}
{elseif condition="$ptplx === 'video'" /} {php} $videoAutoplay = isFlag($siteConfig['videoauplay'] ?? 0) === 1 ? 'autoplay' : ''; $videoPlayIcon = isFlag($siteConfig['videoauplay'] ?? 0) === 0 ? '' : ''; $isBilibili = stripos($videoUrl, 'player.bilibili.com') !== false; {/php} {if condition="$isBilibili"}
BiliBili
{else/}
{$videoPlayIcon|raw} MP4
{/if} {elseif condition="$ptplx === 'music' && !is_numeric($ptpmusic)" /} {php} $mus = explode('|', $ptpmusic); echo \think\facade\View::fetch('component/music_play', ['mus' => $mus, 'cid' => $cid]); $mu = $mus[0] ?? ''; $musicSource = ''; if (stripos($mu, 'qq-proxy') !== false || stripos($mu, 'qq.com') !== false) { $musicSource = 'QQ音乐'; } elseif (stripos($mu, 'kugou') !== false) { $musicSource = '酷狗音乐'; } elseif (stripos($mu, 'kuwo') !== false) { $musicSource = '酷我音乐'; } elseif (stripos($mu, '163.com') !== false || stripos($mu, '/api/music/proxy') !== false) { $musicSource = '网易云音乐'; } {/php} {/if}
{if condition="$ptpdw !== ''"} {$gps|raw} {/if} {$adUrl|raw} {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}
{:formatFriendlyDate(strtotime($ptptime))}{if condition="$musicSource"}来自 {$musicSource}{/if}{$deleteIcon|raw}
{$dianzanText|raw}

{$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}
    {volist name="comments" id="comment"} {php} $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;"'; {/php}
  • avatar
    {$commentName} · {$commentTime}
    {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}
  • {/volist}
{eq name="commauth" value="1"} {else/} {/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}