header('Content-type: application/json'); if (!$CURUSER->isOnline()) { $error = 'You must be logged in!'; } $PostId = isset($_GET['id']) ? (int) $_GET['id'] : false; if ($PostId === false) { $error = 'Invalid post id.'; } //Validate the post $res = $DB->prepare("SELECT * FROM `wcf_posts` WHERE `id` = :id LIMIT 1;"); $res->bindParam(':id', $PostId, PDO::PARAM_INT); $res->execute(); if ($res->rowCount() == 0) { $error = 'Invalid post id.'; } //check for errors if (!$error) { //Fetch the post data $Post = $res->fetch(); if ($author = WCF::getAuthorById($Post['author'])) { $Post['author_str'] = $author; } else { $Post['author_str'] = 'Unknown'; } unset($author); $data = array('text' => $Post['text'], 'author' => $Post['author_str']); echo json_encode($data); } else { echo json_encode(array('error' => $error)); } unset($res);
', $pages['next'], ' </ul>'; } echo ' </div> <!-- Actions.End -->'; } echo ' <!--<ul class="topic_header"> <li class="topic">Topic</li> <li class="lastpost">Last post</li> </ul>-->'; if ($countOnPage > 0) { //loop the records while ($arr = $topics_res->fetch()) { if ($author = WCF::getAuthorById($arr['author'])) { $arr['author_str'] = $author; } else { $arr['author_str'] = 'Unknown'; } unset($author); //format the time $arr['added'] = date('D M j, Y, h:i a', strtotime($arr['added'])); //Get the last post $lastPost = WCF::getTopicLastPost($arr['id']); echo ' <ul class="topic_row"> <li class="icon"> <img src="template/forums/style/icons/topic_unread_mine.png" width="55px" height="39px"/> </li> <li class="topic_title_by_date">