diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/comment.inc | 5 | ||||
-rw-r--r-- | includes/node.inc | 6 | ||||
-rw-r--r-- | includes/structure.inc | 6 |
3 files changed, 14 insertions, 3 deletions
diff --git a/includes/comment.inc b/includes/comment.inc index 0d1003530..6d6290f1e 100644 --- a/includes/comment.inc +++ b/includes/comment.inc @@ -145,6 +145,11 @@ function comment_post($pid, $id, $subject, $comment) { } } +function comment_status($index = -1) { + $status = array("disabled", "enabled"); + return $index < 0 ? $status : $status[$index]; +} + function comment_score($comment) { $value = ($comment->votes) ? ($comment->score / $comment->votes) : (($comment->score) ? $comment->score : 0); return ((strpos($value, ".")) ? substr($value ."00", 0, 4) : $value .".00"); diff --git a/includes/node.inc b/includes/node.inc index 9a8b9f020..733c38da0 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -6,7 +6,7 @@ $rstatus = array(0 => dumped, 1 => expired, 2 => queued, 3 => posted); function _node_get($field, $value) { $result = db_query("SELECT lid, type FROM node WHERE $field = '$value'"); if ($node = db_fetch_object($result)) { - return db_query("SELECT n.*, l.*, c.name AS category, c.comment, t.name AS topic, u.userid FROM node n LEFT JOIN $node->type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.id LEFT JOIN category c ON n.cid = c.cid LEFT JOIN topic t ON n.tid = t.tid WHERE n.$field = '$value' ORDER BY n.timestamp DESC"); + return db_query("SELECT n.*, l.*, u.userid FROM node n LEFT JOIN $node->type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.id WHERE n.$field = '$value' ORDER BY n.timestamp DESC"); } } @@ -39,7 +39,7 @@ function node_get_comments($nid) { function node_save($node) { global $user, $status; - $rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, timestamp); + $rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, comment, timestamp); if ($node[nid] > 0) { $n = node_get_object("nid", $node[nid]); @@ -74,7 +74,7 @@ function node_save($node) { throttle("post node", variable_get(max_node_rate, 900)); // setup default values: - $node = array_merge(array(title => "?", author => $user->id, type => "?", pid => 0, cid => 0, tid => 0, log => "node created", status => $status[queued], score => 0, votes => 0, timestamp => time()), $node); + $node = array_merge(array(title => "?", author => $user->id, type => "?", pid => 0, cid => 0, tid => 0, log => "node created", status => $status[queued], score => 0, votes => 0, comment => 1, timestamp => time()), $node); // prepare queries: $f1 = array(); diff --git a/includes/structure.inc b/includes/structure.inc index 6d6655a3e..94c14ad6d 100644 --- a/includes/structure.inc +++ b/includes/structure.inc @@ -47,6 +47,12 @@ function category_expire_threshold($cid) { return $category->threshold; } +// return default comment status of category $cid: +function category_comment($cid) { + $category = category_get_object("cid", $cid); + return $category->comment; +} + // return linked string with name of category $cid: function category_name($cid) { $category = category_get_object("cid", $cid); |