From 51cf09ff8d7d806d55158905abd2e5c52b611130 Mon Sep 17 00:00:00 2001 From: Eltrac <45323514+BigCoke233@users.noreply.github.com> Date: Wed, 22 Jan 2020 16:30:55 +0800 Subject: =?UTF-8?q?=F0=9F=91=86=20Add:=20=E5=9B=9E=E5=A4=8D=E6=97=B6=20@?= =?UTF-8?q?=20=E4=B8=8A=E7=BA=A7=E8=AF=84=E8=AE=BA=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index d8e80b0..6d6b0f3 100644 --- a/functions.php +++ b/functions.php @@ -90,4 +90,32 @@ function generate_require($files,$type,$cdn = NULL) { elseif ($type == "css") echo ""; } -} \ No newline at end of file +} + +/** + * 获取上级评论人 + */ + function getCommentHF($coid){ + $db = Typecho_Db::get(); + $prow = $db->fetchRow($db->select('parent') + ->from('table.comments') + ->where('coid = ? AND status = ?', $coid, 'approved')); + $parent = $prow['parent']; + if ($parent != "0") { + $arow = $db->fetchRow($db->select('text','author','status') + ->from('table.comments') + ->where('coid = ?', $parent)); + $author = $arow['author']; + $status = $arow['status']; + if($author){ + if($status=='approved'){ + $href = '@'.$author.'';; + }else if($status=='waiting'){ + $href = '评论审核中···'; + } + } + echo $href; + } else { + echo ""; + } + } \ No newline at end of file -- cgit v1.2.3