@@ -83,7 +79,7 @@ function comment_reply($pid, $id) {
if($pid){
$item=db_fetch_object(db_query("SELECT c.*, u.name FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.cid = '$pid'"));
comment_view(newComment($item->uid,$item->name,$item->subject,$item->comment,$item->timestamp,$item->url,comment_score($comment),$comment->votes,$item->cid,$item->lid),t("reply to this comment"));
comment_view(newComment($item->uid,$item->name,$item->subject,$item->comment,$item->timestamp,$item->url,$item->cid,$item->lid),t("reply to this comment"));
}
else{
node_view(node_get_object(array("nid"=>$id)));
...
...
@@ -128,7 +124,7 @@ function comment_post($edit) {
$query.="SELECT u.*, c.* FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.lid = '$lid'";
if($pid>=0)$query.=" AND pid = '$pid'";
if($order==1)$query.=" ORDER BY c.timestamp DESC";
elseif($order==2)$query.=" ORDER BY c.timestamp";
elseif($order==3)$query.=" ORDER BY c.score DESC";
elseif($order==4)$query.=" ORDER BY c.score";
$query.="SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.lid = '$lid'";
if($return)return"<A HREF=\"".comment_uri("id=$comment->lid#$comment->cid")."\"><FONT COLOR=\"$theme->type\">".t("return")."</FONT></A> | <A HREF=\"".comment_uri("op=reply&id=$comment->lid&pid=$comment->cid")."\"><FONT COLOR=\"$theme->type\">".t("reply to this comment")."</FONT></A>";
elsereturn"<A HREF=\"".comment_uri("op=reply&id=$comment->lid&pid=$comment->cid")."\"><FONT COLOR=\"$theme->type\">".t("reply to this comment")."</FONT></A>";
if($return){
return"<a href=\"node.php?id=$comment->lid#$comment->cid\"><font color=\"$theme->type\">".t("return")."</font></a> | <a href=\"node.php?op=reply&id=$comment->lid&pid=$comment->cid\"><font color=\"$theme->type\">".t("reply to this comment")."</font></a>";
}
else{
return"<a href=\"node.php?op=reply&id=$comment->lid&pid=$comment->cid\"><font color=\"$theme->type\">".t("reply to this comment")."</font></a>";
}
}
functioncomment_view($comment,$folded=0){
global$theme;
// calculate comment's score:
$comment->score=comment_score($comment);
// display comment:
if($folded)$theme->comment($comment,$folded);
elseprint"<A HREF=\"".comment_uri("id=$comment->lid&cid=$comment->cid#$comment->cid")."\">".check_output($comment->subject)."</A> by ".format_name($comment)." <SMALL>($comment->score)</SMALL><P>";
if($folded){
$theme->comment($comment,$folded);
}
else{
print"<a href=\"node.php?id=$comment->lid&cid=$comment->cid#$comment->cid\">".check_output($comment->subject)."</a> by ".format_name($comment)." <small>(".($comment->score?$comment->score:"--")." / $comment->votes)</small><p />";
}
}
functioncomment_thread_min($cid,$threshold){
global$user;
$result=db_query("SELECT u.*, c.* FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.pid = '$cid' ORDER BY c.timestamp, c.cid");
$result=db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.pid = '$cid' GROUP BY c.cid ORDER BY c.timestamp, c.cid");
** We had quite a few browser specific issues with expanded comments below
** the top level getting truncated on the right hand side. A range of
** solutions have been suggested and tried but either the right margins of
** the comments didn't line up as well, or the heavily nested tables made
** for slow rendering and cluttered HTML. This is the best work-around in
** terms of speed and size.
** We had quite a few browser specific issues: expanded comments below
** the top level got truncated on the right hand side. A range of
** solutions have been proposed and tried but either the right margins of
** the comments didn't line up well, or the heavily nested tables made
** for slow rendering and cluttered HTML. This is the best work-around
** in terms of speed and size.
*/
$result=db_query("SELECT u.*, c.* FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.pid = '$cid' ORDER BY c.timestamp, c.cid");
$result=db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.pid = '$cid' GROUP BY c.cid ORDER BY c.timestamp, c.cid");
$result=db_query("SELECT u.*, c.* FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE cid = '$cid'");
$result=db_query("SELECT u.*, c.*, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN user u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.cid = '$cid' GROUP BY c.cid");
if($comment=db_fetch_object($result)){
comment_view($comment,comment_links($comment));
}
...
...
@@ -308,14 +318,14 @@ function comment_render($lid, $cid) {
@@ -16,7 +19,7 @@ function _node_get($conditions) {
}
if($type){
returndb_query("SELECT n.*, l.*, u.uid, u.name FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN user u ON n.author = u.uid WHERE $where ORDER BY n.timestamp DESC");
returndb_query("SELECT n.*, l.*, u.uid, u.name, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN user u ON n.author = u.uid LEFT JOIN moderate m ON m.nid = n.nid WHERE $where GROUP BY n.nid ORDER BY n.timestamp DESC");
}
}
...
...
@@ -267,7 +270,8 @@ function node_moderation($nid) {
$output.=form_item(t("Node rating"),node_moderation($id)." <input type=\"submit\" name=\"op\" value=\"".t("Update ratings")."\" />",t("Nodes and comments can be moderated by assigning them a score: content with a high rating is made more visible."));
}
$output.=form_item(t("Comment viewing options"),comment_mode($mode).comment_order($order).comment_threshold($threshold)." <input type=\"submit\" name=\"op\" value=\"".t("Update settings")."\" />",t("Select your prefered way to display the comments and click 'Update settings' to active your changes."));
if(user_access("post comment")){
$output.=form_item(t("Add a comment"),"<input type=\"submit\" name=\"op\" value=\"".t("Add comment")."\" />",t("Click 'Add comment' to start a new thread in the discussion."));
$_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';