From e6f3df7eaf6881a303358289dadb904824872d45 Mon Sep 17 00:00:00 2001 From: Eltrac Koalar Date: Wed, 7 Oct 2020 20:40:09 +0800 Subject: bring back the 1.x files to master --- libs/Comments.php | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 libs/Comments.php (limited to 'libs/Comments.php') diff --git a/libs/Comments.php b/libs/Comments.php new file mode 100644 index 0000000..1e4cb7e --- /dev/null +++ b/libs/Comments.php @@ -0,0 +1,51 @@ +-->'; + echo ''; + echo ''; + } + + /** + * 获取上级评论人 + */ + public static 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 ""; + } + } +} -- cgit v1.2.3