Esempio n. 1
0
 public function tweetCommentsRss()
 {
     checkUnauthorizedAccess();
     $tweetID = getIdFromURL();
     checkIntValueOfId($tweetID);
     $tweetComments = TweetCommentRepository::getTweetComments($tweetID);
     $title = "Tweet";
     $link = "http://192.168.56.101/TwitterApp/tweet/" . $tweetID;
     $description = "List of all comments for selected tweet.";
     generateCommentsRss($title, $link, $description, $tweetComments);
 }
Esempio n. 2
0
 public function postTweetComment()
 {
     checkUnauthorizedAccess();
     $id = getIdFromURL();
     checkIntValueOfId($id);
     if (post('comment')) {
         $tweetid = $id;
         $username = $_SESSION['username'];
         $userid = UserRepository::getIdByUsername($username);
         $content = htmlentities(trim(post('comment')));
         $comment = new TweetComment();
         $comment->setTweetid($tweetid);
         $comment->setUserid($userid);
         $comment->setContent($content);
         try {
             TweetCommentRepository::postComment($comment);
             echo json_encode(['comment' => parseText($comment->getContent()), 'user' => $username]);
         } catch (\PDOException $e) {
             $e->getMessage();
         }
     }
 }