From c56ee67e29e89f5158801ba7bbe8f574a93215b4 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 11 Jun 2001 20:01:13 +0000 Subject: - Changed field_set(), field_get() and field_merge() to use ',' and '=' instead of ';' and ':'. It is considered to be more readable. --> A _first_ step towards and improved index.module. Stay tuned for more. + Important: If you update from CVS - apply the queries in 2.00-to-x.xx.sql! - Changed all 'attribute' to 'attributes'. + Important: If you update from CVS - apply the queries in 2.00-to-x.xx.sql! + Important: This might require to ieni-wieni small update to your custom themes and/or node-related modules: - themes: node_index($node->attribute) -> node_index($node) - node modules: attribute -> attributes --- includes/node.inc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'includes/node.inc') diff --git a/includes/node.inc b/includes/node.inc index 73b8f8c1c..892dde6aa 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -63,7 +63,7 @@ function node_get_comments($nid) { } function node_save($node, $filter) { - $rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, comment, promote, moderate, attribute, timestamp, timestamp_posted, timestamp_queued, timestamp_hidden); + $rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, comment, promote, moderate, attributes, timestamp, timestamp_posted, timestamp_queued, timestamp_hidden); if ($node[nid] > 0) { $n = node_get_object(array("nid" => $node[nid])); @@ -211,17 +211,14 @@ function node_preview($node) { return $node; } -function node_index($string) { - return $string ? implode(" / ", node_attributes_view($string)) : " "; -} function node_attributes_edit($edit) { - return index_collection_form("section", ($edit[section] ? $edit[section] : "section:". field_get($edit[attribute], "section") .";")); + return index_collection_form("section", ($edit[section] ? $edit[section] : "section:". field_get($edit[attributes], "section") .";")); } function node_attributes_save($edit) { if ($edit[nid] && $node = node_get_array(array("nid" => $edit[nid]))) { - return field_merge($node[attribute], $edit[section]); + return field_merge($node[attributes], $edit[section]); } else { return $edit[section]; @@ -229,8 +226,8 @@ function node_attributes_save($edit) { } function node_attributes_view($string) { - foreach (explode(";", $string) as $data) { - $entry = explode(":", $data); + foreach (explode(",", $string) as $data) { + $entry = explode("=", $data); if (in_array($entry[0], array("section"))) { $array[] = "$entry[1]"; } @@ -238,6 +235,10 @@ function node_attributes_view($string) { return $array ? $array : array(); } +function node_index($node) { + return $node->attributes ? implode(" / ", node_attributes_view($node->attributes)) : " "; +} + function node_visible($node) { global $user, $status; return ($node->status == $status[posted]) || ($node->status == $status[queued] && $user->id) || user_access($user, $node->type) || user_access($user, "node"); -- cgit v1.2.3