$result=db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.pid = $cid ORDER BY c.timestamp, c.cid");
$result=db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.pid = $cidAND (c.votes = 0 OR c.score / c.votes >= $thold) ORDER BY c.timestamp, c.cid");
$result=db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.pid = $cid ORDER BY c.timestamp, c.cid");
$result=db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.pid = $cidAND (c.votes = 0 OR c.score / c.votes >= $thold) ORDER BY c.timestamp, c.cid");
$thread.="<LI><A HREF=\"discussion.php?id=$comment->sid&cid=$comment->cid&pid=$comment->pid\">".check_output($comment->subject)."</A> by ".format_username($comment->userid)." <SMALL>(".discussion_score($comment).")<SMALL></LI>";
$query="SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.sid = $sid AND c.pid = $pid";
if($mode=='threaded'||mode=='nested'){
if($thold!="")$query.=" AND c.score >= $thold";
else$query.=" AND c.score >= 0";
}
$query.="SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.sid = $sid AND c.pid = $pid AND (c.votes = 0 OR c.score / c.votes >= $thold)";
if($order==1)$query.=" ORDER BY c.timestamp DESC";
list($pid)=mysql_fetch_row(mysql_query("SELECT pid FROM comments WHERE cid = $comment->pid"));
list($pid)=db_fetch_row(db_query("SELECT pid FROM comments WHERE cid = $comment->pid"));
$link="<A HREF=\"discussion.php?id=$comment->sid&pid=$pid\"><FONT COLOR=\"$theme->hlcolor2\">return to parent</FONT></A> | <A HREF=\"discussion.php?op=reply&sid=$comment->sid&pid=$comment->cid\"><FONT COLOR=\"$theme->hlcolor2\">reply to this comment</FONT></A>";
else$theme->box("Failed","You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
else$theme->box("Failed","You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
else$theme->box("Failed","You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
else$theme->box("Failed","You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
else$theme->box("Failed","You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");}
else$theme->box("Failed","You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
else$theme->box("Failed","You don't have permission to access this section.<P ALIGN=\"right\">[ <A HREF=\"javascript: history.back()\">back</A> ]</P>");
}
}
else{
if($poll){
$theme->box("Voting poll",displayResult(getActivePoll())."<P><B>Note:</B> you have voted already recently.</P>");