<input type="hidden" name="feed_token" value="<?php echo Token::generateToken(); ?> " > <button name="feed" class="ui blue submit icon button">Submit</button> </form> <br> <div class="ui relaxed divided items" id="profile_feed_comments"> <?php } if (empty($posts)) { echo "<p id='emptycmt'>There's nothing here!</p>"; } else { foreach ($posts as $post) { $votes_count = QNA::get_votes($post->id) ?: "0"; $cCount = count($comments = Comment::get_comments($post->id)); $post->img_path = $post->img_path ?: DEF_PIC; ?> <div class="item"> <a href="/user/<?php echo $post->uid; ?> /" class="ui tiny image"> <img src="<?php echo $post->img_path; ?> "> </a> <div class="content"> <span>
$template->assign('edit_data', $comment->get_edit_data($_GET['get_4'])); #$action = 'edit'; } elseif (isset($_POST['edit_save'])) { $comment->edit_save(); if (isset($cache)) { $cache->clearPhoto($photo_data['id']); } header('Location: ' . BASE_URL . PAGE . ',' . IMAGE_IDENTIFIER . ',' . $photo_data['id'] . ',0,1,' . $comment->current_page . '#comments'); } elseif (isset($_SESSION[$settings['session_prefix'] . 'user_id']) && isset($_GET['get_3']) && $_GET['get_3'] == 'delete' && isset($_GET['get_4'])) { $comment->delete($_GET['get_4']); if (isset($cache)) { $cache->clearPhoto($photo_data['id']); } header('Location: ' . BASE_URL . PAGE . ',' . IMAGE_IDENTIFIER . ',' . $photo_data['id'] . ',0,1,' . $comment->current_page . '#comments'); } $template->assign('comments', $comment->get_comments()); $template->assign('total_comments', $comment->total_comments); switch ($comment->total_comments) { case 0: $localization->selectVariant('number_of_comments', 0); break; case 1: $localization->selectVariant('number_of_comments', 1); break; default: $localization->selectVariant('number_of_comments', 2); $localization->replacePlaceholder('comments', $comment->total_comments, 'number_of_comments'); } $template->assign('pagination', pagination($comment->total_pages, $comment->current_page)); $template->assign('current_page', $comment->current_page); $template->assign('errors', $comment->errors);
<br><br><hr> <h3>Stories</h3> <?php echo $pag->display(); ?> <div class="questions front-page" id="questions"> <?php if (count($qs) < 1) { echo "There are no stories in this section yet.<br>"; } else { foreach ($qs as $q) { if ($q->status != 1 && $q->uid != USER_ID) { continue; } $self = $q->uid === USER_ID ?: false; $commentsCount = count(Comment::get_comments($q->id)); $votes = QNA::get_votes($q->id); $votes = $votes ?: "0"; $reports_count = QNA::get_reports_count($q->id) ?: null; $img_path = $q->img_path ?: DEF_PIC; $type = $q->fid == 5 ? 'Generated' : 'Written'; ?> <div class="ui items"> <div class="item"> <div class="ui tiny image"> <a href="/user/<?php echo $q->uid; ?> /"><img src="<?php echo $img_path; ?>
$PostID = sanitize_id($_GET['post_id']); if (!$PostID) { Redirect::redirectTo(); } $post = new Post(); $post = $post->get_post($PostID); if (!is_object($post)) { Redirect::redirectTo(); } $self_p = $post->user_id === $post->poster_id ? true : false; $self = $post->user_id === USER_ID ? true : false; if (USER_ID) { $voted = QNA::has_voted($PostID, USER_ID); } $votes_count = QNA::get_votes($PostID) ?: "0"; $comments = Comment::get_comments($post->id); include ROOT_PATH . "inc/head.php"; ?> <body> <div class="user-feed post ui container section"> <div class="feed-post ui segment" id="post-page" post-id="<?php echo $post->id; ?> "> <?php if ($self || $post->poster_id === USER_ID) { ?> <div title="Actions" class="ui pointing dropdown" id="post-actions"> <i class="setting link large icon"></i> <div class="menu">
$comment->akismet_entry_check = $settings['akismet_entry_check']; $comment->remove_blank_lines = $settings['comment_remove_blank_lines']; $comment->auto_link = $settings['comment_auto_link']; $comment->smilies = $settings['comment_smilies']; $comment->settings = $settings; if (!empty($data['type_addition'])) { $comment->comments_closed = true; $template->assign('comments_closed', true); } if (isset($_SESSION[$settings['session_prefix'] . 'user_id'])) { $comment->set_admin_mode(); } $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'main'; if (isset($_GET['get_1']) && $_GET['get_1'] == 'commentrss') { $comment->comments_per_page = $settings['rss_maximum_items']; $comments = $comment->get_comments(true); if ($comments) { $i = 0; foreach ($comments as $comment) { $rss_items[$i]['title'] = $comment['name']; $rss_items[$i]['content'] = $comment['comment']; $rss_items[$i]['link'] = BASE_URL . PAGE . '#comment-' . $comment['id']; $rss_items[$i]['pubdate'] = gmdate('r', $comment['time']); $i++; } } if (isset($rss_items)) { $template->assign('rss_items', $rss_items); } $content_type = 'text/xml'; $template_file = 'rss.tpl';
function getComments($dbh) { $this->comments = Comment::get_comments(0, $this->id, $dbh); }
<?php $comments = Comment::get_comments($id); ?> <br> <h3>Comments (<span id="commentscount"><?php echo count($comments); ?> </span>): </h3> <form class="ui reply form" action=""> <div class="field"> <textarea name="content" id="comment-submit-textarea" rows="2" placeholder="Add a new comment.."></textarea> </div> <input type="hidden" name="post_id" value="<?php echo $id; ?> " > <input type="hidden" name="comment_token" value="<?php echo Token::generateToken(); ?> " > <button name="comment" id="subcomment" style="display:none;" class="ui blue submit disabled icon button">Submit</button> </form> <hr> <div id="comments"> <?php if (count($comments) === 0) { echo "<span id=\"emptycmt\">There is nothing here yet, be the first to comment!</span>"; } else { } foreach ($comments as $comment) {
/** * get comments posted on a question * * @return array */ public function get_Qcomments($id = '') { if (empty($id)) { $id = $this->PostID; } return Comment::get_comments($id); }
<?php require_once realpath($_SERVER['DOCUMENT_ROOT']) . '/includes/init_trigger.inc.php'; $comment_cava = new Comment(); //Get comments if (isset($_GET['a']) && $_GET['a'] == 'g') { if (isset($_GET['url'])) { try { header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Content-type: application/json'); header("HTTP/1.1 200 OK"); $comments = $comment_cava->get_comments($_GET['url']); if (empty($comments)) { $comments = array(); } echo json_encode($comments); } catch (PDOException $e) { //output an empty JSON array echo json_encode(array()); } } } //Captcha if (isset($_GET['a']) && $_GET['a'] == 'c') { echo $comment_cava->generate_captcha(); } //POST a comment if (isset($_GET['a']) && $_GET['a'] == 'p') { //Add the comment $comment_cava->add_comment($_POST['url'], $_POST['name'], $_POST['comment'], $_POST['captcha']);