Ejemplo n.º 1
0
 /**
  * see `get`
  *
  * @param string  $section_title
  * @param int     $post_id
  * @return Illuminate\Http\JsonResponse
  */
 public function getJson($section_title, $post_id)
 {
     $post = $this->post->get($post_id);
     $post->selected = $this->vote->getSelected(Constant::POST_TYPE, $post);
     $commentTree = new CommentTree($this->comment->getByPostId($post_id, $this->vote));
     return Response::json(['post' => $post, 'comments' => $commentTree->grab()->sort('new')]);
 }
Ejemplo n.º 2
0
             $comment->link_object = $link;
             $comment->print_summary(2500, true);
             echo '</li>';
         }
         echo '</ol>';
         Haanga::Load('get_total_answers_by_ids.html', array('type' => 'comment', 'ids' => implode(',', $ids)));
         Comment::print_form($link);
     }
     echo '</div>';
     break;
     /////////////// TODO: in progress
 /////////////// TODO: in progress
 case 10:
     echo '<div class="comments">';
     include_once mnminclude . 'commenttree.php';
     $tree = new CommentTree();
     if (!$current_page) {
         $current_page = 1;
     }
     $offset = ($current_page - 1) * $globals['comments_page_size'];
     $limit = $globals['comments_page_size'];
     $global_limit = $limit * 2;
     // The limit including references
     if ($show_relevants || $no_page) {
         print_external_analysis($link);
         print_relevant_comments($link);
     }
     if ($link->page_mode == 'interview') {
         $sql = "select t1.comment_id as parent, t1.w1 as w1, t2.comment_id as child, t2.comment_karma + 200 * (t2.comment_user_id = {$link->author}) as w2 FROM comments as t0 INNER JOIN (select comment_id, comment_karma + 200 * (comment_user_id = {$link->author}) as w1 from comments WHERE comment_link_id = {$link->id} order by w1 desc LIMIT {$offset}, {$limit}) t1 ON t1.comment_id = t0.comment_id LEFT JOIN (conversations as c, comments as t2) ON conversation_type='comment' and conversation_to = t0.comment_id and c.conversation_from = t2.comment_id order by w1 desc, w2 desc LIMIT {$global_limit}";
         $res = $db->get_results($sql);
         if ($res) {
Ejemplo n.º 3
0
    $canonical_base .= 'm/' . $link->sub_name . '/';
}
$canonical_base .= 'c/';
$globals['extra_head'] = '<link rel="canonical" href="' . $globals['scheme'] . '//' . $canonical_server . $canonical_base . $comment->id . '"/>';
do_header($title);
/*** SIDEBAR ****/
echo '<div id="sidebar">';
do_banner_right();
//do_best_stories();
do_best_comments();
do_banner_promotions();
echo '</div>';
/*** END SIDEBAR ***/
echo '<div id="newswrap">';
echo '<h3><a href="' . $link->get_permalink() . '">' . $link->title . '</a></h3>';
$tree = new CommentTree();
$tree->addByIds($comment->id);
for ($i = 0; $i < 4; $i++) {
    if (!fill_tree($tree) || $tree->size() > 30) {
        break;
    }
}
echo '<div class="comments">';
echo '<div style="text-align:right">';
$vars = array('link' => $globals['permalink'], 'title' => $title);
Haanga::Load('share.html', $vars);
echo '</div>';
Comment::print_tree($tree, $link);
echo '</div></div>';
do_footer();
exit(0);