Exemplo n.º 1
0
        header('Content-type: application/xml');
        $commentsHTML = '';
        foreach ($comments as $comment) {
            $commentsHTML .= render_single_comment($comment, $userID, true);
            $lastDate = $comment['posted_date'];
        }
        $result = array('comment' => $commentsHTML);
        render_result_xml(array('comment' => $commentsHTML, 'lastdate' => $lastDate, 'hasmore' => $commentsHTML != '' && BuckysComment::hasMoreComments($postID, $lastDate) ? 'yes' : 'no'));
    }
} else {
    if ($_GET['action']) {
        //Delete Post
        if ($_GET['action'] == 'delete-comment') {
            if (!$userID) {
                echo MSG_INVALID_REQUEST;
                exit;
            }
            $postID = $_GET['postID'];
            $commentID = $_GET['commentID'];
            $cUserID = $_GET['userID'];
            if (!BuckysComment::deleteComment($userID, $commentID)) {
                echo 'Invalid Request';
            } else {
                header('content-type: application/xml');
                $newCount = BuckysComment::getPostCommentsCount($postID);
                render_result_xml(array('commentcount' => $newCount > 1 ? $newCount . " comments" : $newCount . " comment"));
            }
            exit;
        }
    }
}