Exemplo n.º 1
0
         echo MSG_INVALID_REQUEST;
         exit;
     }
     //Check the post id is correct
     if (!BuckysPost::checkPostID($postID)) {
         echo MSG_POST_NOT_EXIST;
         exit;
     }
     $post = BuckysPost::getPostById($postID);
     if ($post['visibility'] == 0 && $userID != $post['poster'] && !BuckysFriend::isFriend($userID, $post['poster'])) {
         //Only Friends can leave comments to private post
         echo MSG_INVALID_REQUEST;
         exit;
     }
     //If error, show it
     if (!($commentID = BuckysComment::saveComments($userID, $postID, $comment))) {
         echo $db->getLastError();
         exit;
     } else {
         //Show Results
         header('Content-type: application/xml');
         $newComment = BuckysComment::getComment($commentID);
         $newCount = BuckysComment::getPostCommentsCount($postID);
         render_result_xml(array('newcomment' => render_single_comment($newComment, $userID, true), 'count' => $newCount > 1 ? $newCount . " comments" : $newCount . " comment"));
         exit;
     }
 }
 //Getting More Comments
 if ($_POST['action'] == 'get-comments') {
     $postID = $_POST['postID'];
     $lastDate = $_POST['last'];