do_best_stories(); } do_rss_box(); do_banner_promotions(); echo '</div>'; /*** END SIDEBAR ***/ echo '<div id="content-main" class="' . $globals['links_container_class'] . '">' . "\n"; echo '<div id="newswrap" class="clearfix row"><!-- topclicked.php -->'; $link->print_summary('full', 0, true, 'full'); switch ($tab_option) { case 1: case 2: echo '<div class="comments">'; if ($tab_option == 1) { print_external_anaylsis($link); print_relevant_comments($link, $no_page); } else { $last_com_first = false; } do_comment_pages($link->comments, $current_page, $last_com_first); $update_comments = false; $comments = $db->object_iterator("SELECT" . Comment::SQL . "WHERE comment_link_id={$link->id} ORDER BY {$order_field} {$limit}", "Comment"); if ($comments) { $order = $offset + 1; $prev = false; echo '<ol class="comments-list">'; foreach ($comments as $comment) { // Check the comment order is correct, otherwise, force an update if ($tab_option == 1) { if ($comment->c_order != $order) { if ($prev) {
/////////////// 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) { foreach ($res as $c) { $tree->addByIds($c->parent, $c->child); } } $sort_roots = true; } else { $sql = "select t1.comment_id as parent, c.conversation_from as child FROM comments as t0 INNER JOIN (select comment_id from comments WHERE comment_link_id = {$link->id} order by comment_id asc LIMIT {$offset}, {$limit}) t1 ON t1.comment_id = t0.comment_id LEFT JOIN conversations c ON c.conversation_type='comment' and c.conversation_to = t0.comment_id order by t0.comment_id, c.conversation_from LIMIT {$global_limit}"; $res = $db->get_results($sql); if ($res) { foreach ($res as $c) {