Changyan_Synchronizer::findCommentInDB PHP Method

findCommentInDB() public method

public findCommentInDB ( $aComment, $postID )
    public function findCommentInDB($aComment, $postID)
    {
        global $zbp;
        $date = $aComment->create_time;
        $ip = $aComment->ip;
        $w[] = array('=', 'comm_LogID', $postID);
        $w[] = array('=', 'comm_PostTime', $date);
        $w[] = array('=', 'comm_IP', $ip);
        $comments = $zbp->GetCommentList('*', $w, null, null, null);
        if (count($comments) == 0) {
            $cmt = new Comment();
            $cmt->LogID = $postID;
            $cmt->IsChecking = (bool) $aComment->status;
            $cmt->AuthorID = 0;
            $cmt->Name = $aComment->passport->nickname;
            $cmt->Email = '';
            $cmt->HomePage = $aComment->passport->profile_url;
            $cmt->IP = $aComment->ip;
            $cmt->PostTime = $aComment->create_time;
            $cmt->Content = $aComment->content;
            $cmt->Agent = "Changyan_" . $aComment->comment_id;
            return $cmt;
        } else {
            return $comments[0];
        }
    }