function get_comments($fetch = false, $parent = 0, $comment_id = 0, $show_parent = 0) { global $db, $main_smarty, $current_user, $CommentOrder, $link, $cached_comments; //Set comment order to 1 if it's not set in the admin panel if (isset($_GET['comment_sort'])) { setcookie('CommentOrder', $CommentOrder = $_GET['comment_sort'], time() + 60 * 60 * 24 * 180); } elseif (isset($_COOKIE['CommentOrder'])) { $CommentOrder = $_COOKIE['CommentOrder']; } if (!isset($CommentOrder)) { $CommentOrder = 1; } if ($CommentOrder == 1) { $CommentOrderBy = "comment_votes DESC, comment_date DESC"; } if ($CommentOrder == 2) { $CommentOrderBy = "comment_date DESC"; } if ($CommentOrder == 3) { $CommentOrderBy = "comment_votes ASC, comment_date DESC"; } if ($CommentOrder == 4) { $CommentOrderBy = "comment_date ASC"; } $output = ''; if (checklevel('admin') || checklevel('moderator')) { $status_sql = " OR comment_status='moderated'"; } // get all parent comments if ($comment_id != 0) { $comments = $db->get_results("SELECT * \n\t FROM " . table_comments . " \n\t WHERE (comment_status='published' {$status_sql}) AND \n\t comment_link_id={$link->id} AND comment_id = {$comment_id} \n\t ORDER BY " . $CommentOrderBy); } elseif ($show_parent == 1) { $comments = $db->get_results("SELECT * \n\t FROM " . table_comments . " \n\t WHERE (comment_status='published' {$status_sql}) AND \n\t comment_link_id={$link->id} AND comment_id = {$parent} \n\t ORDER BY " . $CommentOrderBy); } else { $comments = $db->get_results("SELECT * \n\t FROM " . table_comments . " \n\t WHERE (comment_status='published' {$status_sql}) AND \n\t comment_link_id={$link->id} AND comment_parent = {$parent} \n\t ORDER BY " . $CommentOrderBy); } if ($comments) { require_once mnminclude . 'comment.php'; $comment = new Comment(); foreach ($comments as $dbcomment) { $comment->id = $dbcomment->comment_id; $cached_comments[$dbcomment->comment_id] = $dbcomment; $comment->read(); $output .= $comment->print_summary($link, true); $output .= "<div class='child-comment'>\n"; if ($comment_id == 0) { $output .= get_comments(true, $dbcomment->comment_id); } $output .= "</div>\n"; } if ($fetch == false) { echo $output; } else { return $output; } } }
} do_header($title . ' | ' . $globals['site_name']); //do_subheader(_('comentario de') . ' ' . $username); /*** SIDEBAR ****/ echo '<div id="sidebar">'; do_banner_right(); //do_best_stories(); do_best_comments(); do_banner_promotions(); echo '</div>' . "\n"; /*** END SIDEBAR ***/ echo '<div id="newswrap">' . "\n"; echo '<h3 style="text-shadow: 0 1px #ccc"><a href="' . $link->get_permalink() . '">' . $link->title . '</a></h3>'; echo '<ol class="comments-list">'; echo '<li>'; $comment->print_summary($link, 0, false); echo '<div style="text-align:right">'; $vars = array('link' => $globals['permalink'], 'title' => $title); Haanga::Load('share.html', $vars); echo '</div>'; echo "</li>\n"; echo "</ol>\n"; print_answers($comment->id, 1); Comment::print_form($link, 8); echo '</div>'; // Show the error if the comment couldn't be inserted if (!empty($new_comment_error)) { add_javascript('mDialog.notify("' . _('Aviso') . ": {$new_comment_error}" . '", 5);'); } do_footer(); exit(0);
$trackback->read(); echo '<li class="tab-trackback-entry"><a href="' . $trackback->url . '" rel="nofollow">' . $trackback->title . '</a> [' . preg_replace('/https*:\\/\\/([^\\/]+).*/', "\$1", $trackback->url) . ']</li>' . "\n"; } echo '</ul>'; echo '</fieldset>'; } } $comments = $db->get_col("SELECT comment_id FROM comments WHERE comment_link_id={$link->id} ORDER BY {$order_field} {$limit}"); if ($comments) { echo '<ol class="comments-list">'; require_once mnminclude . 'comment.php'; $comment = new Comment(); foreach ($comments as $comment_id) { $comment->id = $comment_id; $comment->read(); $comment->print_summary($link, 700, true); echo "\n"; } echo "</ol>\n"; } if ($link->date < $globals['now'] - $globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) { // Comments already closed if ($tab_option == 1) { do_comment_pages($link->comments, $current_page); } echo '<div class="commentform warn">' . "\n"; echo _('comentarios cerrados') . "\n"; echo '</div>' . "\n"; } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] || $current_user->user_id == $link->author)) { // User can comment print_comment_form();
function do_shaken_comments() { global $db, $rows, $user, $offset, $page_size, $globals; do_user_subheader(array($user->username => get_user_uri($user->username, 'commented'), _('conversación') . $globals['extra_comment_conversation'] => get_user_uri($user->username, 'conversation'), _('votados') => get_user_uri($user->username, 'shaken_comments'), _('favoritos') => get_user_uri($user->username, 'favorite_comments')), 2); $comment = new Comment(); $rows = -1; $db->get_var("SELECT count(*) FROM votes, comments WHERE vote_type='comments' and vote_user_id={$user->id} and comment_id = vote_link_id and comment_user_id != vote_user_id"); $comments = $db->get_results("SELECT vote_link_id as id, vote_value as value FROM votes, comments WHERE vote_type='comments' and vote_user_id={$user->id} and comment_id = vote_link_id and comment_user_id != vote_user_id ORDER BY vote_date DESC LIMIT {$offset},{$page_size}"); if ($comments) { echo '<ol class="comments-list">'; foreach ($comments as $c) { $comment->id = $c->id; if ($c->value > 0) { $color = '#00d'; } else { $color = '#f00'; } $comment->read(); if ($comment->author != $user->id && !$comment->admin) { echo '<li>'; $comment->print_summary(false, 1000, false); echo '<div class="box" style="margin:0 0 -16px 0;background:' . $color . ';position:relative;top:-34px;left:30px;width:30px;height:16px;border-color:' . $color . ';opacity: 0.5"></div>'; echo '</li>'; } } echo "</ol>\n"; } }
$main_smarty->assign('the_story', $link->print_summary('summary', true)); if ($current_user->user_level == "admin" or $current_user->user_level == "god") { $comments = $db->get_results("SELECT * FROM " . table_comments . " WHERE comment_id={$link->commentid} ORDER BY comment_date"); } else { $comments = $db->get_results("SELECT * FROM " . table_comments . " WHERE comment_id={$link->commentid} and comment_user_id={$current_user->user_id} ORDER BY comment_date"); } if ($comments) { $current_user->owncomment = "YES"; require_once mnminclude . 'comment.php'; $comment = new Comment(); foreach ($comments as $dbcomment) { $comment->id = $dbcomment->comment_id; $cached_comments[$dbcomment->comment_id] = $dbcomment; $comment->read(); $comment->hideedit = 'yes'; $main_smarty->assign('the_comment', $comment->print_summary($link, true)); $link->thecomment = $comment->quickread(); $main_smarty->assign('TheComment', $comment->quickread()); } } else { $current_user->owncomment = "NO"; echo $main_smarty->get_config_vars("PLIGG_Visual_EditComment_NotYours") . '<br/><br/>'; echo $main_smarty->get_config_vars("PLIGG_Visual_EditComment_Click") . '<a href = "' . getmyurl('story', sanitize($_GET['id'], 3)) . '">' . $main_smarty->get_config_vars("PLIGG_Visual_EditComment_Here") . '</a> ' . $main_smarty->get_config_vars("PLIGG_Visual_EditComment_ToReturn") . '<br/><br/>'; } if ($current_user->authenticated) { if ($current_user->owncomment == "YES") { $main_smarty->assign('comment_form', print_comment_form(true)); } if ($current_user->user_level == "admin" or $current_user->user_level == "god") { $main_smarty->assign('removed_link', '<a href="#" onclick=(document.getElementById("comment").value="' . $main_smarty->get_config_vars("PLIGG_Visual_EditComment_Removed") . '")>' . $main_smarty->get_config_vars("PLIGG_Visual_EditComment_Removed") . '</a>'); }
function get_comments($fetch = false) { global $db, $main_smarty, $current_user, $CommentOrder, $link; //Set comment order to 1 if it's not set in the admin panel if (!isset($CommentOrder)) { $CommentOrder = 1; } if ($CommentOrder == 1) { $CommentOrderBy = "comment_votes DESC, comment_date DESC"; } if ($CommentOrder == 2) { $CommentOrderBy = "comment_date DESC"; } if ($CommentOrder == 3) { $CommentOrderBy = "comment_votes ASC, comment_date DESC"; } if ($CommentOrder == 4) { $CommentOrderBy = "comment_date ASC"; } $output = ''; // get all parent comments $comments = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_link_id={$link->id} and comment_parent = 0 ORDER BY " . $CommentOrderBy); if ($comments) { require_once mnminclude . 'comment.php'; $comment = new Comment(); foreach ($comments as $comment_id) { $comment->id = $comment_id; $comment->read(); $output .= $comment->print_summary($link, true); // get all child comments $comments2 = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_parent={$comment_id} ORDER BY " . $CommentOrderBy); if ($comments2) { $output .= '<div style="margin-left:40px">'; require_once mnminclude . 'comment.php'; $comment2 = new Comment(); foreach ($comments2 as $comment_id) { $comment2->id = $comment_id; $comment2->read(); $output .= $comment2->print_summary($link, true); } $output .= "</div>\n"; } } if ($fetch == false) { echo $output; } else { return $output; } } }
function print_comment_list($comments, $user) { global $globals, $current_user; $link = new Link; $comment = new Comment; foreach ($comments as $dbcomment) { if ($dbcomment->comment_type == 'admin' && ! $current_user->admin) continue; $link->id=$dbcomment->link_id; $comment->id = $dbcomment->comment_id; if ($last_link != $link->id) { $link->read(); echo '<h4>'; echo '<a href="'.$link->get_permalink().'">'. $link->title. '</a>'; echo ' ['.$link->comments.']'; echo '</h4>'; $last_link = $link->id; } $comment->read(); echo '<ol class="comments-list">'; echo '<li>'; $comment->print_summary($link, 2000, false); echo '</li>'; echo "</ol>\n"; } }
function get_comments($fetch = false) { global $db, $main_smarty, $current_user, $CommentOrder, $link, $cached_comments; //Set comment order to 1 if it's not set in the admin panel if (!isset($CommentOrder)) { $CommentOrder = 1; } if ($CommentOrder == 1) { $CommentOrderBy = "comment_votes DESC, comment_date DESC"; } if ($CommentOrder == 2) { $CommentOrderBy = "comment_date DESC"; } if ($CommentOrder == 3) { $CommentOrderBy = "comment_votes DESC, comment_date ASC"; } if ($CommentOrder == 4) { $CommentOrderBy = "comment_date ASC"; } $output = ''; if (checklevel('god') || checklevel('admin')) { $status_sql = " OR comment_status='moderated'"; } // get all parent comments $comments = $db->get_results("SELECT * FROM " . table_comments . " WHERE (comment_status='published' {$status_sql}) AND comment_link_id={$link->id} and comment_parent = 0 ORDER BY " . $CommentOrderBy); if ($comments) { require_once mnminclude . 'comment.php'; $comment = new Comment(); foreach ($comments as $dbcomment) { $comment->id = $dbcomment->comment_id; $cached_comments[$dbcomment->comment_id] = $dbcomment; $comment->read(); $output .= $comment->print_summary($link, true); // get all child comments $comments2 = $db->get_results("SELECT * FROM " . table_comments . " WHERE (comment_status='published' {$status_sql}) AND comment_parent={$dbcomment->comment_id} ORDER BY " . $CommentOrderBy); if ($comments2) { $output .= '<div class="child-comment">'; require_once mnminclude . 'comment.php'; $comment2 = new Comment(); foreach ($comments2 as $dbcomment2) { $comment2->id = $dbcomment2->comment_id; $cached_comments[$dbcomment2->comment_id] = $dbcomment2; $comment2->read(); $output .= $comment2->print_summary($link, true); } $output .= "</div>\n"; } } if ($fetch == false) { echo $output; } else { return $output; } } }
function get_comments() { global $db, $main_smarty, $current_user, $CommentOrder, $link; //Set comment order to 1 if it's not set in the config.php if (!isset($CommentOrder)) { $CommentOrder = 1; } if ($CommentOrder == 1) { $CommentOrderBy = "comment_votes DESC, comment_date DESC"; } if ($CommentOrder == 2) { $CommentOrderBy = "comment_date DESC"; } if ($CommentOrder == 3) { $CommentOrderBy = "comment_votes DESC, comment_date ASC"; } if ($CommentOrder == 4) { $CommentOrderBy = "comment_date ASC"; } $comments = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_link_id={$link->id} and comment_parent = 0 ORDER BY " . $CommentOrderBy); if ($comments) { echo '<ul id="comments-list">'; require_once mnminclude . 'comment.php'; $comment = new Comment(); foreach ($comments as $comment_id) { $comment->id = $comment_id; $comment->read(); $comment->print_summary($link); $comments2 = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_parent={$comment_id} ORDER BY " . $CommentOrderBy); if ($comments2) { echo '<ul id="comments-list">'; require_once mnminclude . 'comment.php'; $comment2 = new Comment(); foreach ($comments2 as $comment_id) { $comment2->id = $comment_id; $comment2->read(); $comment2->print_summary($link); } echo "</ul>\n"; } } echo "</ul>\n"; } }
echo '<ol class="comments-list">'; echo '<li>'; $comment->print_summary($link, 10000, true); echo "</li>\n"; echo "</ol>\n"; // Print answers to the comment $sql = "SELECT conversation_from as comment_id FROM conversations, comments WHERE conversation_type='comment' and conversation_to = {$comment->id} and comment_id = conversation_from ORDER BY conversation_from asc LIMIT {$page_size}"; $answers = $db->get_results($sql); if ($answers) { $answer = new Comment(); echo '<div style="padding-left: 40px; padding-top: 10px">' . "\n"; echo '<ol class="comments-list">'; foreach ($answers as $dbanswer) { $answer->id = $dbanswer->comment_id; $answer->read(); echo '<li>'; $answer->print_summary($link); echo '</li>'; } echo "</ol>\n"; echo '</div>' . "\n"; } Comment::print_form($link, 8); echo '</div>'; // Show the error if the comment couldn't be inserted if (!empty($new_comment_error)) { echo '<script type="text/javascript">'; echo '$(function(){alert(\'' . _('Aviso') . ": {$new_comment_error}" . '\')});'; echo '</script>'; } do_footer();
$link->print_summary(); // AdSense do_banner_story(); echo '<div id="comments">'; echo '<h2>'._('comentarios').'</h2>'; $comments = $db->get_col("SELECT comment_id FROM comments WHERE comment_link_id=$link->id ORDER BY comment_date"); if ($comments) { echo '<ol id="comments-list">'; require_once(mnminclude.'comment.php'); $comment = new Comment; foreach($comments as $comment_id) { $comment->id=$comment_id; $comment->read(); $comment->print_summary($link); } echo "</ol>\n"; } if($link->date < time()-604800) { // older than 7 days //echo '<br />'."\n"; echo '<div class="commentform" align="center" >'."\n"; echo _('comentarios cerrados')."\n"; echo '</div>'."\n"; } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] || $current_user->user_id == $link->author)) { print_comment_form(); } else { echo '<br/>'."\n";
function do_commented() { global $db, $rows, $user, $offset, $page_size, $globals, $current_user; if ($globals['bot']) { return; } $link = new Link(); $comment = new Comment(); $rows = $db->get_var("SELECT count(*) FROM comments WHERE comment_user_id={$user->id}"); $comments = $db->get_results("SELECT comment_id, link_id, comment_type FROM comments, links WHERE comment_user_id={$user->id} and link_id=comment_link_id ORDER BY comment_date desc LIMIT {$offset},{$page_size}"); if ($comments) { echo '<div class="bookmarks-export-user-stories">'; echo '<a href="' . $globals['base_url'] . 'link_bookmark.php?user_id=' . $user->id . '&option=commented" title="' . _('exportar bookmarks en formato Mozilla') . '" class="bookmarks-export-user-commented"><img src="' . $globals['base_url'] . 'img/common/bookmarks-export-01.png" alt="Mozilla bookmark"/></a>'; echo ' <a href="' . $globals['base_url'] . 'comments_rss2.php?user_id=' . $user->id . '" title="' . _('obtener comentarios en rss2') . '"><img src="' . $globals['base_url'] . 'img/common/rss-button01.png" alt="rss2"/></a>'; echo '</div>'; foreach ($comments as $dbcomment) { if ($dbcomment->comment_type == 'admin' && $current_user->user_level != 'god' && $current_user->user_level != 'admin') { continue; } $link->id = $dbcomment->link_id; $comment->id = $dbcomment->comment_id; if ($last_link != $link->id) { $link->read(); echo '<h4>'; echo '<a href="' . $link->get_permalink() . '">' . $link->title . '</a>'; echo ' [' . $link->comments . ']'; echo '</h4>'; $last_link = $link->id; } $comment->read(); echo '<ol class="comments-list">'; $comment->print_summary($link, 2000, false); echo "</ol>\n"; } } }
function do_commented() { global $db, $rows, $user, $offset, $page_size; $link = new Link(); $comment = new Comment(); echo '<h2>' . _('comentarios') . '</h2><br />'; $rows = $db->get_var("SELECT count(*) FROM comments WHERE comment_user_id={$user->id}"); $comments = $db->get_results("SELECT comment_id, link_id FROM comments, links WHERE comment_user_id={$user->id} and link_id=comment_link_id ORDER BY comment_date desc LIMIT {$offset},{$page_size}"); if ($comments) { foreach ($comments as $dbcomment) { $link->id = $dbcomment->link_id; $comment->id = $dbcomment->comment_id; if ($last_link != $link->id) { $link->read(); echo '<h4>'; echo '<a href="' . $link->get_permalink() . '">' . $link->title . '</a>'; echo ' [' . $link->comments . ']'; echo '</h4>'; $last_link = $link->id; } $comment->read(); echo '<ol class="comments-list">'; $comment->print_summary($link, 2000, false); echo "</ol>\n"; } } }
$link->print_summary(); // AdSense do_banner_story(); echo '<div id="comments">'; echo '<h2>'._('comentarios').'</h2>'; $comments = $db->get_col("SELECT comment_id FROM comments WHERE comment_link_id=$link->id ORDER BY comment_date"); if ($comments) { echo '<ol id="comments-list">'; require_once(mnminclude.'comment.php'); $comment = new Comment; foreach($comments as $comment_id) { $comment->id=$comment_id; $comment->read(); $comment->print_summary($link, 700); } echo "</ol>\n"; } if($link->date < time()-604800) { // older than 7 days //echo '<br />'."\n"; echo '<div class="commentform" align="center" >'."\n"; echo _('comentarios cerrados')."\n"; echo '</div>'."\n"; } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] || $current_user->user_id == $link->author)) { print_comment_form(); } else { echo '<br/>'."\n"; echo '<div class="commentform" align="center" >'."\n";