summaryrefslogtreecommitdiffstats
path: root/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php30
1 files changed, 29 insertions, 1 deletions
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 "<link rel=\"stylesheet\" href=".$path."assets/".$type."/".$file.".".$type." />";
}
-} \ 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 = '<a class="at" uid="'.$parent.'" href="#li-comment-'.$parent.'">@'.$author.'</a>';;
+ }else if($status=='waiting'){
+ $href = '<a>评论审核中···</a>';
+ }
+ }
+ echo $href;
+ } else {
+ echo "";
+ }
+ } \ No newline at end of file